Repository navigation
Closed
Labels
Description
What happens
The host-safety installer, host-setup/agent-safety/claude/install.py, manages only two marker blocks in ~/.claude/CLAUDE.md. Everything outside the markers is never written and never checked. The fleet writes nothing at all to the global instruction files of Codex (~/.codex/AGENTS.md) or opencode (~/.config/opencode/AGENTS.md).
So a host can run with global instructions that are out of date with the fleet, in four ways:
- Stale blocks. A re-run of the installer refreshes the blocks, but nothing triggers one.
merge-and-releasestep 7 refreshes Skills only. One host was found running blocks installed three weeks earlier, with its containment hook missing. - Hand-written content outside the markers. It is never updated and never reported. On that host it was three sections that predate the kit and restate fleet rules in older wording. One of them described
pr_review.py replybehavior the same day a release changed it. - Codex and opencode outside a fleet repository. Neither gets the host-wide content: repository boundaries, representative data, authorization scope, or the fleet entry point.
- Edits versus versions.
--reportcompares the live blocks only against the current checkout. A block edited by hand and a block from an older install both read "differs", so the report cannot say which.
Proposed
- One source, three targets. Render the host-wide content from one source to each installed agent's global instruction file:
~/.claude/CLAUDE.md,~/.codex/AGENTS.md, and~/.config/opencode/AGENTS.md. Include a target only where that agent is installed, and verify each path empirically with the installed agent version. - Whole-file ownership. The installer writes the whole file and always overwrites it. Host-specific content lives in a separate local file that the installer never edits. The rendered output appends it under a marker, because Codex has no
@import. - Telling an edit from an old version. The stamp already records the digest of what was installed.
- The live file matches the stamp: it is an untouched previous version. Overwrite it silently.
- The live file differs from the stamp: it was edited locally. Back it up, overwrite it, and print the diff so the edit can be moved into the local file.
- No stamp, from an install before this change: treat it as edited.
- First run on an existing file. The content outside the old markers is backed up. Nothing moves into the local file automatically, so whatever restates fleet content is dropped rather than carried forward. The report names the backup path.
- Staleness is reported at release time.
merge-and-releasestep 7 also runs this kit's--reportnext to the Skills refresh, and a stale host is reported to the maintainer.
Out of scope
Write-guard hooks for Codex and opencode stay on #781. This issue covers instruction content only.
Activity
ptr727 commentedon Oct 5, 2026
How each agent loads global instructions, verified against the installed binaries
Each finding below was read from the installed binary's own instruction-loading code. They were not taken from the agents' docs.
AGENTS.override.mdorAGENTS.mdin~/.codex, preferring the override. The override replaces the global file rather than adding to it. The installer must therefore never write one, and--reportshould flag one as shadowing the fleet content.[~/.config/opencode/AGENTS.md, ~/.claude/CLAUDE.md], and it takes the first that exists. With no opencodeAGENTS.md, it falls back to the Claude file, Claude Code-specific text included.OPENCODE_DISABLE_CLAUDE_CODEorOPENCODE_DISABLE_CLAUDE_CODE_PROMPTturns that fallback off. Its config has an additiveinstructionsarray, which accepts extra file paths and URLs.CLAUDE.local.mdis a project-level file only, with no user-level counterpart.~/.claude/CLAUDE.mdsupports@pathimports. Codex has no import syntax.So no native "local" mechanism adds content in all three agents. The portable design renders each target as the fleet content plus a host-local file, appended under a marker. Writing an opencode
AGENTS.mdalso ends opencode's fallback to the Claude file, so each agent gets text written for it.Refuse a Dangling Local Symlink and Distrust a Malformed Stamp
Report a Local File Whose Directory Cannot Be Entered
Probe the Local File With lstat So Python 3.14 Still Refuses It
Drop the Stale exists() Comment Above the lstat Probe
Render the Whole Global CLAUDE.md and Back Up a Hand Edit (#2424)
Render CLAUDE.md First and Let the Real Write Be the Check (#2427)
State the Descriptor Invariant Rather Than the Removed fdopen
Read the Local Instruction File Only When It Is a Regular File (#2428)
Refuse a Local Instruction Path Whose Parent Is a File (#2429)
Promote develop to main: Whole-File Global CLAUDE.md Ownership (#2425)