claude-code-config
AGENTS.md4 starsChanged 5 days agoMITView on GitHub
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,843 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 34
Read only via scripts/shared/machine.mjs.
- Very specific: line 128
Every knob is a harness.loopGuard key in claude_env_settings[.local].json or an env var …
- Very specific: line 153
After changes, update README and setup.js if needed
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 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, and reuses the whole-tree content scans (~/.claude/doctor-cache.json) while the work tree's fingerprint is unchanged. 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 wrappers, and the current project's.claude/(cc-market plugin files) up to the latest format.npm run migrate -- --dry-runpreviews link changes without writing. See/migrateskill.
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 Claude's SessionStart and bycodex.js; Claude's user hooks are not projected into Codex),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),tasks.mjs(TaskBoard: the shells and subagents a session runs now and lately, fed by both adapters, pushed to the dashboard),topic-cache.mjs(topics.json),context.mjs(machine and session context: bridge config, git context, the dashboard config summary and the one config write),jsonrpc.mjs(the line-delimited JSON-RPC peer of the local IPC),send-attachment.mjs(CLI: a file to a session's Topic, used by Codex),quota.mjs(each local account's quota as data for the dashboard: seat grouping and login checks, window use, trend, forecast —AccountReaderfeeds the push),resources.mjs(this machine's CPU / memory / GPU load for the dashboard),forges.mjs(the code forges this machine can reach — GitHub, Gitea — read for the dashboard's Code tab),quota-series.mjs(each account's quota samples while their windows are current — the last is the quota now — and where in a window it was spent: the dashboard's trend),extra-resets.mjs(announced Codex/Claude extra resets from community APIs, shown on the dashboard), 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 run on every session start — Claude SessionStart hook andcodex.js; it replaces a running daemon only with--replace: the daemon's own handover within a minute of a config or source change, and a SessionStart pull; the daemon's exclusivedaemon.lockmakes concurrent starts safe). Its Claude half is the channel pluginclaude_plugins/session-bridge/. Setup and config:docs/bridge.md.dashboard-push.mjspushesBridge.dashboardSessions()(read-only) to the dashboardscripts/usage/: the usage store's host side (docs/usage.md) —transcripts.mjs(a Claude transcript or Codex rollout -> turn rows: tokens, model, times, tools, branch; metadata only),scan.mjs(what is new since the cursor~/.claude/bridge/usage-cursor.json),push.mjs(turns, session costs, quota windows and hourly load -> the Worker every 5 min, run by the bridge daemon),query.mjs(npm run usage: read-only SQL for a human or an AI). The store is D1agents-usagebehind the dashboard Worker (scripts/dashboard/usage-store.mjs, schema with column comments inscripts/dashboard/migrations/*.sql)scripts/dashboard/: the read-only dashboard, a Cloudflare Worker + Telegram Mini App (worker.mjsentry +DashboardHubDurable Object,api.mjsthe HTTP API on Web-standard Request/Response,auth.mjsEd25519initData+ host tokens,registry.mjslast push per host in memory, alert state in Durable Object storage,notify.mjsevery alert (quota, host offline, failed turn, refused config) as a dashboard bot message to the private chat, woken by a Durable Object alarm only when a host would turn silent,deploy.mjshost-token / deploy / set-menu,wrangler.jsonc,public/the app withpublic/view.mjsits pure logic, andpublic/shared/the pure modules the bridge, the Worker and the page all import —vocab.mjs: agents, statuses with label and rank, the quota stale threshold). Own dashboard bot; membership in sharedbridge.dashboard. Edits onlyCONFIG_KEYS(dashboard-schema.mjs), applied by a host. Wire format:scripts/shared/dashboard-schema.mjs.docs/dashboard.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 and spawn the agent as<recorded python> -m ai_lab.session, which ownsLAB_SESSION—scripts/shared/session-launcher.mjs),cc-launcher.mjs/codex-launcher.mjs(pure env+args projection helpers — reused bysetup-vscode.jsso the two hosts cannot drift),repo-automode.mjs(the launch repo's.claude/automode.json->--settings, only for an origin in~/.claude/trusted-origins;docs/setup.md"Auto-mode rules"),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),seats.mjs(Claude seats: the only alias ->~/.claude-<alias>mapping),dashboard-schema.mjs(the dashboard wire format shared by the bridge push and the Worker),claude-defaults.mjs(UI prefs that live in each config dir's.claude.jsonand so cannot sync — e.g.diffSidebarOpen: false; re-applied bycc.jsper launch and by setup)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: reports stale plugin-cache candidates without automatic deletion),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 drive the bridge's Claude state machine and, with PostToolUseFailure, each Bash/Agent call's task; 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). Every entry runsasyncexcept Stop (it injects queued Telegram messages), PreToolUse(AskUserQuestion) (it returns the answer) and UserPromptSubmit (a prompt must open its turn before that turn's answer lands); each call carries anatstamp so the daemon never lets an older state overwrite a newer one;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.js; Codex plugin hooks exist but do not inherit Claude's user-hook wiring)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. Usage statistics are not a plugin: they are the usage store (docs/usage.md). 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 as user-scope MCP serversession-bridgeby setup and re-ensured on everyccclaunch (scripts/shared/channel-server.mjs), and loaded bycccvia--dangerously-load-development-channels server:session-bridge, seedocs/bridge.md)claude_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 template -> auto-copied toclaude_env_settings.jsonby setup. Itsproviders.<name>holds ONLY host projection rules (claudeApiKeyEnv,codexApiKeyEnv); the provider catalogue (urls, paths, model maps) is ai-lab's, copied by setup into~/.claude/provider-cache.json-- seedocs/providers.mdclaude_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). It holds NO API key: keys live in the git credential store (setup migrates a plaintextapiKeythere once); 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.state.*]/[notice]into its own config, so those are machine-local and must never sync. The active home'sconfig.tomlis a REAL FILE composed per host by setup = shared head + generated providers/notifications + this host's own state — NOT a symlink. Native machine handlers are merged separately intohooks.json. Seescripts/setup/codex-config-compose.mjsanddocs/sync-architecture.md§ 3models.json: Codex model catalog (context window, reasoning levels, image input) — generated from the provider cache's model maps on 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).ccc --seat <alias>(-s) runs as one Claude seat (an account in one Team) from~/.claude-<alias>; seats are the top-levelseatsof the sharedclaude_env_settings.json, mapped to dirs only byscripts/shared/seats.mjs— seedocs/bridge.md"Claude seats".codc/cods— Codex launchers (official / DeepSeek). Both read the provider cache (ai-lab's catalogue) and the key from the git credential store; a stale cache refuses to launch -- 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 aharness.loopGuardkey inclaude_env_settings[.local].jsonor an env varHARNESS_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
Codex native harness
Setup merges the machine hooks in scripts/setup/codex-hooks.mjs into the active
CODEX_HOME's hooks.json; scripts/hooks/codex-hook.mjs owns the native machine
entry point. User handlers and Codex trust remain user-owned. Startup, guard,
notifications, execution observations, protected-cache recovery and conservative cache audits are documented
in docs/operations.md; the current source/deployment support matrix is
docs/codex-harness-audit.md. Plugin lifecycle logic remains in cc-market.
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.

