claude-code-config
AGENTS.md3 starsChanged 56 days agoMITView on GitHub
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 6
Do NOT mix plugin details here.
- Very specific: line 33
Read only via scripts/shared/machine.mjs.
- Very specific: line 125
Every knob is an env var settable from the env block of claude_settings.json: …
- Very specific: line 141
After changes, update README and setup.js if needed
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
<!--
Boundary: This file covers the config-sync repo ONLY.
For cc-market plugin development, see cc-market/AGENTS.md.
Do NOT mix plugin details here.
-->Setup
npm run setup- Initial setupnode scripts/setup/setup.js- Manual setup- Re-run setup to verify (checks existing symlinks)
npm run doctor- Read-only invariant check. Every check maps to an incident that actually happened here (a hook wired but silently dead, payload/template shape drift, absolute machine paths in shared files, orphaned plugin installs, NUL bytes making a file binary to git). Exits 1 on failure; also runs at SessionStart via--hook, which reports failures only and is silent when healthy. Add a check here whenever a new silent-divergence incident is found — that is the point of the file.- Public repo: doctor's
public-hygienecheck FAILs on personal data in any tracked file (home paths, real emails, Telegram chat ids, org cloud folders, plus the machine-local denylist~/.claude/private-markers— one literal or/regex/per line, never tracked; it lives in the sync dir so every fleet host shares it, linked by setup as an optional payload file, and doctor WARNs when a sync-dir host lacks it)..githooks/pre-commitruns it (doctor.js --public-hygiene); setup setscore.hooksPath. Exception: inlinepublic-hygiene: allow (<reason>). - Multi-machine only:
node scripts/setup/setup.js --sync-dir "<path>"points this host at the shared config payload and records~/.claude/sync-dir. Add--init-sync-diron the FIRST machine to seed an empty payload dir from the templates; on later machines wait for the cloud client to finish downloading instead — setup refuses to seed a configured-but-empty dir, which would manufacture conflict copies. With no sync dir configured everything resolves inside the repo, exactly as before. node scripts/setup/setup.js --machine <NAME>writes the machine-local~/.claude/machine.json(one unique name per host). Read only viascripts/shared/machine.mjs; the Claude launchers and, for Codex, setup's composed~/.codex/config.toml[shell_environment_policy.set]turn it into committer provenance +HARNESS_*env (harness-architecture §8b; Codex commands may run in a shared daemon no launcher env reaches). Setup without the flag never overwrites it; doctor WARNs when it is missing.- The working tree must NOT live inside a cloud-synced folder. See
docs/sync-architecture.md. npm run migrate- Bring~/.claude/~/.codexsymlinks, orphaned CLI aliases, and the current project's.claude/(cc-market plugin files) up to the latest format.npm run migrate -- --dry-runpreviews link/settings changes without writing. See/migrateskill. It no longer touchesenabledPlugins: the retired-plugin swap it used to perform (takeover→fabric) can no longer match anything, since that plugin is gone from cc-market and the settings file is shared by every host.
Architecture
Cross-platform Claude Code & Codex config sync. The working tree lives OUTSIDE any
cloud-synced folder and travels via git; only a three-file config payload rides cloud
storage. Both are linked into ~/.claude/ and ~/.codex/. See docs/sync-architecture.md
— read it before touching anything path-related.
The multi-workstation / multi-task collaboration harness (lane = branch + worktree + main session, family process owned by lab-commons,
Telegram + remote control on the same live session, per-machine bridge in
scripts/bridge/) is designed in docs/harness-architecture.md.
Structure
scripts/setup/:setup.js(OS detection, symlinks),install-cli-wrappers.js(standalone cross-platform wrappers beside each host binary; no shell-profile dependency),check-links.js(shared self-heal for setup links — invoked byscripts/hooks/setup-check-hook.json SessionStart and by both runtime launchers),doctor.js(the invariant checker —npm run doctor),check-mac-notify.js(macOS notification helper),setup-vscode.js(VS Code provider switching)scripts/bridge/: the per-machine session bridge (Telegram <-> live Claude/Codex sessions) —daemon.mjs(owns the bot token and the singlegetUpdatesloop, maps session -> project group + Topic),telegram.mjs(Bot API client),lifecycle.mjs(the one session lifecycle for both hosts: open → idle-closed → reopened → ended → deleted),topic-cache.mjs(topics.json),fleet.mjs(the fleet report: each machine posts, inbridge.fleet.orderand at a low rate, a rich-Markdown block per host that runs something or has a reset to act on — headroom verdict, run-out warning, account, quota table, running sessions; seats inbridge.fleet.seats),extra-resets.mjs(announced Codex/Claude extra resets from community APIs, shown as report state), host adapters emitting the same events —codex-adapter.mjs(client of the shared Codex app-server viacodex app-server proxy, which carries WebSocket frames —ws-stream.mjs) andclaude-adapter.mjs(127.0.0.1 IPC for the Claude channel andbridge-hook.js),install-service.mjs(npm run bridge:install: HKCU Run key / launchd / systemd --user),ensure.mjs(idempotent start-or-replace run on every session start — Claude SessionStart hook andcodex.js; the daemon's exclusivedaemon.lockmakes concurrent starts safe). Its Claude half is the channel pluginclaude_plugins/session-bridge/. Setup and config:docs/bridge.mdskills/migrate/:/migrateskill —migrate.js(orphaned symlink cleanup + cc-market plugin.claude/migrations) and testsscripts/runtime/:cc.js/codex.js(provider launchers; both runstartup-sync.mjsbefore loading repo code),cc-launcher.mjs/codex-launcher.mjs(pure env+args projection helpers — reused bysetup-vscode.jsso the two hosts cannot drift),plugin-launcher.mjs(resolves a plugin script inside the installed cache, used by thetodolauncher),win-spawn.mjs(the Windows spawn shim),todo-launcher.mjsscripts/shared/: cross-host config helpers —config.mjs(readMergedEnvSettings, two-layer shared+local merge),provider-keys.js(single source of truth for theANTHROPIC_*env-var strip list),sync-dir.mjs(resolves the payload dir:$CLAUDE_SYNC_DIR→~/.claude/sync-dir→ repo root, and definesSYNC_PAYLOAD_FILES),is-main.mjs(the entry-point guard every script that is also a module must use — see Standard): retired 2026-08-30 — all three hosts are on the split layout, so the one-time tooling (scripts/migration/migrate-host.mjs,rescue-clone.mjs, the runbook, and the payload bootstrap copies) was archived to.claude/memory/2026/08/30/.archive/. See.claude/memory/2026/08/30/host-migration-retired.md;docs/sync-architecture.mdstill documents the layout itself.scripts/hooks/:loop-guard-hook.js(PreToolUse anti-spin guard — see Workflows),sync-hook.js(--pullon SessionStart,--remindon SessionEnd — see Workflows),prune-cache-hook.js(SessionStart: drops stale plugin-cache versions),notify-hook.js(cross-platform notifications),hud-hook.js(statusLine),bridge-hook.js(UserPromptSubmit + Stop + StopFailure: mirrors Claude prompts/final answers to the session bridge's Telegram Topic; PreToolUse + PostToolUse + Notification + SessionEnd drive the bridge's Claude state machine; PreToolUse(AskUserQuestion) relays the question and, in a Telegram-started turn, waits up to 10 min for the answer; silent no-op unless the bridge daemon runs —docs/bridge.md),setup-check-hook.js(SessionStart: verifies/heals setup links — recreates missing links, converts claude-hud config symlink→hard link, warns on drifted plain files with the--replacefix command; shared logic inscripts/setup/check-links.js, also run bycodex.jssince Codex has no session hooks)system-prompt/: per-host platform prompts (claude-base.md,codex-base.md). Linked to~/.claude/system-promptand~/.codex/system-promptsofabric.systemPromptFile/codex_config.toml model_instructions_fileresolve through a per-host junction, not a hardcoded OneDrive path. See.claude/memory/2026/08/11/system-prompt-paths-symlink.md.cc-market/: the plugin marketplace (gitignored, its own repo —DawnEver/cc-market, cloned by setup). Four of its plugins are enabled and load-bearing here:rem(memory lifecycle, task enginetask-engine.js,/rem+/todo),sharp-review(post-task review: hook, skill, workflow, findings sync viapost-review.js),evolve(iterative review→fix loop),fabric(single-machine multi-provider calls —call/fan_out— and handoff; its cross-machine node feature is retired — seedocs/harness-architecture.md). Three more are dormant —watch,cc-latex,cc-academia— present but not enabled.tracemeis archived: disabled everywhere and not installed on any host (re-enable viaenabledPluginsif needed). Seecc-market/AGENTS.mdskills/: Custom skills (migrate) — the whole dir is symlinked to~/.claude/skills. Codex needs each skill linked individually (discoverCodexSkillLinks()in setup.js, because~/.codex/skillsalso holds Codex's own built-in.systemskills and cannot be replaced wholesale). Add new skills here asskills/<name>/SKILL.md; they are picked up automatically on both hosts. Account-level synced skills (anthropic-skills:*) are OFF —syncClaudeAiSkills: falseinclaude_settings.json— otherwise the CLI downloads them into~/.claude/skills/synced, i.e. straight into this repo..gitignorecarriesskills/synced/as a backstop.output-styles/: Output styles (<name>.md,keep-coding-instructions: false) — symlinked to~/.claude/output-styles. Non-coding personas (e.g.academic) for terminal use; toggle via/config→ Output style. Strips coding guidance, keeps the harness/tools. A full system-prompt replacement was rejected (degrades CC to a chatbox) — see.claude/memory/2026/06/20/persona-vs-output-style.md.claude_plugins/: Custom plugins (e.g.,claude-hudconfig;session-bridge— the bridge's Claude channel MCP server, plain Node, registered by setup as user-scope MCP serversession-bridgeand loaded bycccvia--dangerously-load-development-channels server:session-bridge, seedocs/bridge.md)cc-market/: Community plugin marketplace (gitignored, cloned by setup) — seecc-market/AGENTS.mdclaude_settings.json: Env vars, permissions, hooks (gitignored). Sync payload — lives in the sync dir, not the repoclaude_settings.template.json: Template for new clones -> auto-copied toclaude_settings.jsonby setupclaude_env_settings.json: Non-secret provider config (base URLs, model pins) — sync payload, gitignored. NO API keysclaude_env_settings.template.json: Desensitized provider template -> auto-copied toclaude_env_settings.jsonby setupclaude_env_settings.local.template.json: Desensitized per-machine secrets template -> copied by setup to~/.claude/claude_env_settings.local.json(a REAL machine-local dir, never cloud-synced). Each host fills in its own API keys there; all readers deep-merge local over sharedcodex_config.toml: sync payload, hand-edited HEAD ONLY (model, sandbox, TUI, plugins). Codex writes[projects.*]trust blocks /[hooks.*]/[notice]into its own config, so those are machine-local and must never sync.~/.codex/config.tomlis therefore a REAL FILE composed per host by setup = shared head + generated[model_providers.*]+ this host's own state — NOT a symlink. Seescripts/setup/codex-config-compose.mjsanddocs/sync-architecture.md§ 3models.json: Codex model catalog (context window, reasoning levels, image input) — generated fromproviders.<name>.modelson every setup run, linked to~/.codex/models.json. A build artifact: machine-local, gitignored, NEVER syncedcodex_config.template.toml: Desensitized Codex template -> auto-copied tocodex_config.tomlby setupkeybindings.json: Claude Code keybindings -> synced to~/.claude/keybindings.jsonGLOBAL-AGENTS.md: Global guidelines, NEVER WRITE IN this repo's memory. Single source linked to both~/.claude/CLAUDE.md(Claude) and~/.codex/AGENTS.md(Codex global instructions).claude/rules/rem/: All rules loaded every session (git-tracked), managed by REM plugin lifecycle..claude/rules/MEMORY.mdis the device-local generated index (gitignored)..claude/memory/: Historical reference — content git-tracked; access metadata in gitignored_meta.jsonper date directory.MEMORY.mdindex is device-local generated (gitignored). Findings stored assharp-review.mdper session — sole source of truth for tasks.
CLI Tools
ccc/ccds— Claude Code launchers (official / DeepSeek).codc/cods— Codex launchers (official / DeepSeek).claude_env_settings.jsonis the single provider source of truth for both hosts — seedocs/providers.md.todo— Task management:todo(list),todo <text>(add),todo rm <id>(remove),todo helpinstall-cli-wrappers.jsinstalls.cmdplus Git Bash wrappers on Windows and executable shell wrappers on macOS/Linux. They live beside the matching host binary and never depend on PowerShell profiles,.zshrc,.bashrc, or.ps1scripts.
Workflows
- Hooks wired in
claude_settings.json:SessionStartrunssync-hook.js --pull(fast-forwards this checkout onto its upstream so a session starts from the freshest tree — startup only, silent when current, refuses rather than merging when the host has its own unpushed commits; a successful pull also re-runscheckLinks()because a pull replaces theclaude-hudhard link, §10 ofdocs/sync-architecture.md), thenprune-cache-hook.js,setup-check-hook.js(verifies/heals~/.claudesymlinks viascripts/setup/check-links.js— recreates missing links, converts theclaude-hudconfig symlink to a hard link, warns on drifted plain files).SessionEndrunssync-hook.js --remind(uncommitted / unpushed report; the outbound half stays a deliberate user action — no auto-push).Notificationrunsnotify-hook.js.PreToolUse(matcher*) runsloop-guard-hook.js: per-session anti-spin guard — it hashes each(tool, normalized input)inside a sliding window, and escalates on both exact repeats and near-duplicates (trigram-Jaccard). Defaults: identical calls warn on the 3rd viaadditionalContextand are denied from the 4th; near-duplicates warn on the 4th and are denied from the 5th. Polling-by-design tools (Monitor,TaskOutput,ReadNotifications, ...) are exempt and the hook fails open. Every knob is an env var settable from theenvblock ofclaude_settings.json:CLAUDE_LOOP_GUARD_{WARN_AT,DENY_AT,SIMILAR_WARN_AT,SIMILAR_DENY_AT, SIMILAR_THRESHOLD,WINDOW_MINUTES,MAX_ENTRIES,EXEMPT,DISABLE}— seeDEFAULTSin the hook. TheStophook runs thesharp-reviewplugin (post-task code review, 3 parallel reviewers). ~/.claude/links to repo for sync~/.codex/links to repo for sync
Standard
- A script that is also a module must gate its entry point with
isMain(import.meta.url)fromscripts/shared/is-main.mjs— neverprocess.argv[1] === fileURLToPath(import.meta.url). Node realpaths a module but notargv[1], and every hook here is launched through the~/.claude/scriptslink, so the naive comparison is always false in production: the body never runs and the process exits 0 in silence. That bug shipped twice — it disabledloop-guard-hook.jsfor two days and madeSETUP_FIX_CMDa no-op.npm run doctorfails on any recurrence. - After changes, update README and
setup.jsif needed - A skill's execution knowledge goes in its
SKILL.md/reference/*.md, never inrules/*orAGENTS.md/CLAUDE.md. At runtime a skill sees only its own files and the host project's config — never this repo's rules/AGENTS.md. - Plugin development, tests, and marketplace conventions → see
cc-market/AGENTS.md - This repo is publicly available, but it is primarily intended for personal use and rapid iteration — backward compatibility is not a concern. Rename, restructure, or remove anything outdated rather than adding shims or compat layers.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

