aaif-goose / aaif-goose/goose

Keep the request prefix stable when an extension is enabled or disabled mid-session

Open
#11,905 0 comments 0 reactions 1 assignee Claimed by @filipkujawa View on GitHub
Dominant language
Rust
Stars
54.2k
Forks
6.2k
Avg merge
3d 4h
Merged PRs (30d)
240

Description

**What problem would this solve?**
Enabling or disabling an extension mid-session rewrites the `# Extensions` section of `system` and grows or shrinks `tools` in place. Every toggle busts the prompt cache on every provider, and on Anthropic it drops all preserved thinking, since signatures are bound to the exact `system` and `tools` that preceded them (#11800, area 3). Confirmed under enforcement on Fable 5.1.

**What would a good outcome look like?**
After the first assistant turn, an extension toggle leaves `system` and the existing `tools` entries byte-identical, and the model still learns about the change. Same behavior in both agent loops. Nothing lost on cancel, retry, or compaction.

**Possible approaches**
- Send the extension's instructions as an agent-only message instead of re-rendering the extensions section, mirroring #11284 for hints.
- On Anthropic, append new tools with `defer_loading: true` and describe the change with `tool_addition` / `tool_removal`; both are prefix-safe on the wire. Prior art in #10743.
- Disabled tools stay in `tools` and are refused at dispatch until the next compaction resets the prefix.

**Additional context**
Supersedes the "revive #10743" line and the general freeze in #11864 / #11839.

- [x] I have verified this does not duplicate an existing feature request

Contributor guide

Open the contributing guide

Research direction

The issue is about the agent's request prefix and tool management. Look at the code handling the `system` prompt and `tools` list when extensions are toggled, likely in the agent loop or session management. Review the linked issues (#11800, #11284, #10743) for context on prefix stability and Anthropic's `defer_loading` and `tool_addition`/`tool_removal`. The goal is to modify the extension toggle logic to keep the prefix byte-identical while still informing the model of the change. Check for existing tests related to extension toggling or prompt caching.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
ai-infra-agents
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.