You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement progressive path-scoped AGENTS.md loading for V2 when the read tool successfully reads a file, using plugin-owned discovery plus Core System Context admission.
Decision
This should be implemented via V2 plugin seams, but plugins should not directly write raw synthetic user messages for authoritative instructions.
Expected shape:
A tool.after / tool.settled hook fires after a local tool succeeds.
A read-tool plugin observes successful read(file) calls, resolves the canonical file path, discovers applicable AGENTS.md files near that file, and records newly discovered instruction files in plugin-owned session state.
A session-scoped context contribution hook exposes those discovered instructions as a normal SystemContext.Source for that sessionID.
SessionContextEpoch.prepare(...) compares the source snapshot at the next safe provider-turn boundary and emits a durable ContextUpdated / Session.Message.System when new instructions become effective.
Provider adapters lower that chronological system message appropriately:
native Anthropic mid-conversation role: "system" when supported and placement is legal;
escaped user fallback for unsupported providers/models/placements.
Needed plugin/core seams
tool.after / tool.settled hook payload with at least:
sessionID
effective agent
tool name
decoded input
structured output/result
resolved/canonical resources when the tool has filesystem targets
Session-scoped System Context contribution hook, because discovered instructions depend on sessionID, not just Location.
Expected behavior
On successful read(file), walk from project root to the file directory and find applicable AGENTS.md files.
Deduplicate already discovered/admitted instruction files per session.
Do not mark instructions as loaded unless they are actually admitted to model context.
Preserve ordering/scope semantics for global, upward project, and newly discovered path-local instructions.
Do not mutate the top-level system prompt for ordinary mid-epoch updates; only epoch replacement should rebuild the baseline.
Follow-ups to verify while implementing
Replace hardcoded Anthropic native mid-conversation system support checks, currently tied to claude-opus-4-8, with route/provider capability metadata.
Double-check Anthropic cache behavior for explicit block cache_control vs top-level automatic caching; current explicit block markers are valid, but the capability should be intentional and documented.
Summary
Implement progressive path-scoped
AGENTS.mdloading for V2 when the read tool successfully reads a file, using plugin-owned discovery plus Core System Context admission.Decision
This should be implemented via V2 plugin seams, but plugins should not directly write raw synthetic user messages for authoritative instructions.
Expected shape:
tool.after/tool.settledhook fires after a local tool succeeds.read(file)calls, resolves the canonical file path, discovers applicableAGENTS.mdfiles near that file, and records newly discovered instruction files in plugin-owned session state.SystemContext.Sourcefor thatsessionID.SessionContextEpoch.prepare(...)compares the source snapshot at the next safe provider-turn boundary and emits a durableContextUpdated/Session.Message.Systemwhen new instructions become effective.role: "system"when supported and placement is legal;Needed plugin/core seams
tool.after/tool.settledhook payload with at least:sessionIDsessionID, not just Location.Expected behavior
read(file), walk from project root to the file directory and find applicableAGENTS.mdfiles.Follow-ups to verify while implementing
claude-opus-4-8, with route/provider capability metadata.cache_controlvs top-level automatic caching; current explicit block markers are valid, but the capability should be intentional and documented.Source
Design discussion in Discord: https://discord.com/channels/1391832426048651334/1521953168899182612