the local agent must read an existing AGENTS.md and add it to the starting prompt of a session #29
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
When the first user message starts a new local-agent session, include the selected project root AGENTS.md in the agent system prompt and reuse a cached KV bootstrap for the deterministic prompt prefix.
Required behavior
KV bootstrap
Cache only the deterministic prefix shared by new sessions with the same effective configuration. This includes the rendered agent/tool prompt, configured system instructions, optional A2UI system instructions, AGENTS.md, model, and reasoning mode.
Session-specific data such as the current date/time, A2UI client metadata, and the user message remains in the uncached suffix.
On the first user submission:
Prompt identity is the invalidation mechanism. Any change to tools, configured system instructions, A2UI instructions, AGENTS.md, model, reasoning mode, tokenizer/rendering identity, context, or checkpoint-compatible execution settings must prevent stale reuse. Loading an invalid checkpoint falls back to rebuilding it.
Do not add a separate persisted component hash, file watcher, eager regeneration job, copy-on-write Metal buffers, or a new KV-slice ownership abstraction. The existing content-addressed key and checkpoint header provide invalidation and compatibility.
DS4 reference
The native ds4-agent uses a sysprompt.kv bootstrap checkpoint, verifies the exact rendered system-prompt text and model compatibility, and rebuilds the checkpoint on mismatch. DS4Server should preserve that behavior while reusing its existing prefix-aware KV store.
Acceptance criteria
Implemented in
4adb49a. All required commit gates pass.