Make subdirectory hints injection resume-safe
- 主要语言
- Rust
- 星标
- 54.2k
- 派生
- 6.2k
- 平均合并
- 3 天 4 小时
- 30 天内合并 PR
- 240
描述
## Problem
Goose supports context files such as `.goosehints` and `AGENTS.md` in subdirectories. When an agent tool call touches a path under a subdirectory, Goose should discover and apply the hints from that directory hierarchy so subsequent model calls have the right local context.
PR #9767 explored moving this from system prompt mutation into agent-visible, user-hidden conversation messages. That is the right general direction: subdirectory hints discovered during a turn should reach the live in-flight conversation without changing the system prompt, which also helps keep prompt caching stable.
## Desired behavior
When a tool call references a file or command path inside a subdirectory:
- Discover relevant context files for that subdirectory, respecting the existing context-file names and import/boundary behavior.
- Inject newly discovered hint content into the conversation as an agent-visible, user-hidden message so the next provider call in the same turn can see it.
- Inject each directory's hints at most once for the conversation.
- Preserve this deduplication across resumed sessions, not just within the current in-memory `Agent` instance.
## Implementation notes
The important unresolved requirement is resume-safe deduplication. An implementation should not rely only on an in-memory `HashSet` of loaded directories, because after a session is resumed the agent can otherwise rediscover and reinject hints that are already present in the conversation history.
A likely approach:
- Keep a stable per-directory marker/key such as `subdir_hints:` associated with each injected hint message.
- Before injecting new hints, reconstruct the already-loaded directory set from existing conversation history.
- Canonicalize or otherwise normalize paths before using them for deduplication, so equivalent paths do not produce duplicate injected hints.
- Keep the actual hint message hidden from the user but visible to the agent.
See PR #9767 for prior work and discussion. The code there demonstrates the live-conversation injection direction, but it still needs the resume-safe deduplication behavior described above before it can land.
贡献指南
调研方向
Review PR #9767 to understand the current injection approach. The main task is to implement resume-safe deduplication. Look at the conversation history handling and how hint messages are currently tagged. You'll need to design a stable key (like 'subdir_hints:') and a method to scan existing history to reconstruct the set of already-loaded directories. Focus on the agent's message injection logic and session resumption mechanics. Testing will involve simulating a resumed session to ensure hints are not re-injected.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- rust
- 领域
- ai-infra-agents
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100