Add DeepSeek-style hierarchical AGENTS.md instruction lifecycle #74
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
Upgrade the root-only
AGENTS.mdsupport delivered by #29 into the durable, hierarchical workspace-instruction lifecycle used by DeepSeek Harness, adapted to DS4Server's Rust-native session and tool architecture.Today
src/app/generation.rsreads only<project>/AGENTS.mdon the opening turn and reuses that frozen text. It has no nested scope discovery, update/removal handling, prompt budget, or resume reconciliation.Required behavior
Discovery and precedence
<Application Support>/de.rfc1437.ds4server/AGENTS.md, then every applicable project instruction from the selected project root to the session working directory, broadest to most specific.AGENTS.md, then optionalAGENTS.local.md. More-specific files and local overlays take precedence, while system/developer/direct-user instructions remain authoritative.read,write, oreditreaches a deeper directory, discover every newly crossed scope before the next model request. Do not infer filesystem activity by parsingbashcommands.Durable lifecycle
path, scope, action, digest), not as mutable process-global state.Additional instructions from: <path>message. A changed file appends an explicit replacement; a confirmed deletion appends a removal notice. Temporary read/stat failures do not mean removal.Rendering and limits
<system-reminder>frame that names every source, explains broad-to-specific precedence, and states that workspace files cannot override higher-authority instructions. Escape literal closing reminder tags from file content.Implementation plan
src/app/generation.rsinto a small Rust instruction module responsible for discovery, bounded reads, rendering, digests, and reconciliation.set/replace/removetransitions are distinguishable without parsing prompt prose.Boundaries
AGENTS.mdandAGENTS.local.mdonly.CLAUDE.md, imports, lowercase aliases, and generic workflow configuration are out of scope.Acceptance criteria
read/write/editmakes its instructions effective on the next request exactly once; edits and confirmed removals produce durable replacement/removal messages.cargo fmt --all -- --check, Clippy with-D warnings,make bundle, andcargo test --all-featurespass.Implemented in commit
1597ddb.Verified in isolation: