aaif-goose / aaif-goose/goose

Make subdirectory hints injection resume-safe

Open
#10,330 4 comments 0 reactions 1 assignee Claimed by @Abhijay007 View on GitHub
Dominant language
Rust
Stars
54.2k
Forks
6.2k
Avg merge
3d 2h
Merged PRs (30d)
262

Description

## 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.