Make subdirectory hints injection resume-safe
- Lenguaje dominante
- Rust
- Estrellas
- 54.2k
- Forks
- 6.2k
- Merge medio
- 3 d 4 h
- PR fusionados (30 d)
- 240
Descripción
## 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.
Guía de contribución
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- rust
- Área
- ai-infra-agents
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Activo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100