Skip to main content

is_agentmux_managed_instructions

Function is_agentmux_managed_instructions 

Source
pub fn is_agentmux_managed_instructions(content: &str) -> bool
Expand description

Does this file’s content say AgentMux wrote it?

There are two markers, not one: CLAUDE.md carries CLAUDE_MD_MANAGED_MARKER and every other startup-instructions file carries STARTUP_INSTRUCTIONS_MANAGED_MARKER, because the two writers grew separately. Anything asking “is this ours” has to know both — a check against only the first reports every AgentMux-generated AGENTS.md, GEMINI.md, QWEN.md and .pi/APPEND_SYSTEM.md as foreign, inverting the answer for most providers (Codex, PR #3144).

Deliberately content-based rather than path-based: the marker is what makes the claim, and a file’s name says nothing about who wrote it. Phase 3 of SPEC_INSTRUCTION_AND_MEMORY_PORTABILITY_2026_09_09.md reuses this to label tracked instruction files agentmux or foreign, which is the one field that decides whether a file is ours to touch.

The two writers below deliberately do NOT use this, and that is not an oversight. Each asks a narrower question — “did I write this file, in my own format, such that I may rewrite it” — and each answer must stay pinned to its own marker. A CLAUDE.md-marked file is ours, but it is not write_startup_instructions_respecting_existing’s to rewrite. This helper answers the broader question, which is the one a read-only tracker asks.