ucsandman/claude-harness

The Claude Code harness I run every day, published under this name since day one and now the same repository as ucsandman/Agnostic-AI: guard hooks, rules, context modules, Mods, subagents, workflows, tools and jobs, ported to 20 clients. Zero-dependency Node.

JavaScript

25

172 commits

updated Sep 29, 2026

See the code

See what people are saying

SourceMessageScoreDate

https://github.com/ucsandman/claude-harness

on Fable Decides, Opus and Sonnet Do the Work: How I Route Claude Code Subagents

0

Sep 29, 2026

README

Agnostic AI

CI License: MIT Node 18+ Zero dependencies Clients Platform Sponsor

One harness. Every client. One repository.

Agnostic AI is the operating system for an AI coding harness: the guard hooks that block secrets and destructive commands, the working agreement (rules), the on-demand context modules, subagents, saved workflows, Mods (function-hook plugins), operator tools, scheduled jobs and the learning loop that turns incidents into rules. It is installed into the client you use (Claude Code) as links, and ported from there into every other client on the machine (Codex, Gemini CLI, Cursor and sixteen more) in each one's dialect. Your identity, private rules, memory and machine config stay in a small private overlay of your own.

It is not a starter kit designed in an afternoon. It grew rule by rule out of daily use, and most of it exists because something broke first: every guard has an incident behind it, every doc has a word ceiling, every check reports the count it processed, and a check that was never seen failing does not count as verified.

This repository is also published as ucsandman/claude-harness, the name it was first shared under. Both receive every push; they are the same commits.

Contents

Install

git clone https://github.com/ucsandman/Agnostic-AI.git && cd Agnostic-AI
npm run setup      # wire the core guards, link the surfaces, assemble CLAUDE.md, port, doctor

Node 18+ and git, nothing else. setup compiles core/rules into ~/.claude/agnostic-rules.md, generates a CLAUDE.md that imports it, wires the core guards into settings.json, links ~/.claude/{hooks,tools,mods,agents,workflows} into this checkout (a real directory there is moved aside, never deleted), ports the harness to every other installed client and runs the doctor (CLAUDE_CONFIG_DIR moves the home). The three commands you keep using:

npm run sync       # rules changed, or a link is missing: recompile, relink, reassemble CLAUDE.md
npm run port       # push the harness to every other installed client
npm run doctor     # drift, a second writer, a broken link, an old path, a private path in public code

To use it as a template: click Use this template, clone, npm run setup. core/port.json chooses the source client, restricts targets, or excludes a hook, skill or MCP server with a reason.

What is inside

DirectoryWhat it holdsSize
core/The source of truth: rules/global-rules.md and its on-demand modules, templates/targets.json (the client registry), safety/guards.json (the one safety policy), traits/, port.json, incident examples/7 modules, 20 clients
engine/The port engine and everything that runs: harness/ (capture, apply, status), sync/ (rules compiler, link binder, CLAUDE.md assembly), setup/ (first run, links), doctor/, context/ (the module graph), hooks/ (the guards, their probes, the client shim), mods/, harvest/ and distill/ (the learning loop), ingest/, skills/, audit/, docs/ (generators), tests/14 subsystems, 39 hooks
agents/Subagent definitions with model, tools and scope6
workflows/Saved Workflow scripts for multi-agent work4
tools/Operator CLIs and pages: measure, search, prove, render25
jobs/Scheduled jobs and the installer that points Task Scheduler at them6
skills/The consolidated skill library, linked (never copied) into each client216
packages/markdown-agent-memory, the published memory policy, templates and linter1
docs/The documentation, each file under a word ceiling the pre-commit hook enforces29
labs/Research: the Mods sprint record, detached builder, process ledger, token-flow audit. Nothing in engine/ depends on it4
examples/An installed harness for reference1
harness/, storage/Your captured bundle and runtime state, both gitignored

How it fits together

Dependency direction is one way: core to engine to the installed surfaces to the client homes. The overlay is read through three named files. Every generated file has one writer, and the doctor fails on a second one.

flowchart LR
  core["core/<br/>rules, modules, targets.json,<br/>guards.json, port.json"] --> engine["engine/<br/>sync, setup, doctor, context graph,<br/>hooks, Mods, harness port"]
  overlay["overlay/ (private)<br/>profile.md, context-graph.json, gates.json"] -. read by sync .-> engine
  engine --> home["~/.claude<br/>hooks, tools, mods, agents, workflows as links<br/>agnostic-rules.md, CLAUDE.md generated"]
  home -- capture --> bundle["harness/ bundle<br/>rules, identity, hooks, skills,<br/>agents, commands, mcp, permissions"]
  bundle -- apply --> clients["19 other clients<br/>Codex, Gemini, Cursor, Windsurf, Cline, ..."]
  clients -- one shim --> guards["engine/hooks/<br/>the same guard scripts everywhere"]
  1. Capture reads the client you use into a client-neutral bundle: rules with every @import inlined, hooks in one dialect, skills, agents, commands, MCP servers, permissions. A value that looks like a token becomes ${NAME} and you are told what to export.
  2. Apply renders the bundle into each other client's dialect. Hooks are not copied: every client is pointed at the same scripts through a shim; skills are linked.
  3. Nothing is destroyed. Generated files carry the port's header; user-owned files get a marked region and are otherwise preserved. Every overwrite is backed up. --check exits 1 on drift.
  4. Every drop is explained by npm run explain, from core/port.json.

The three places in full, with the storage layout and the adapter contract: docs/architecture.md.

Guards

engine/hooks/ holds 41 hooks: 38 Node, 2 Python, 1 PowerShell. They run on Claude Code's events (PreToolUse, PostToolUse, UserPromptSubmit, Stop, SessionStart, SubagentStart, PreCompact) and, through engine/hooks/shim.cjs, on every other client that has hooks. One file, core/safety/guards.json, is the policy every guard reads: secret paths are always blocked, hard-stop commands need a human, a missing policy fails closed.

GroupHooksWhat they do
Secretssecret-guard, secret-path-guard, tool-output-secret-watch, output-secret-watchDeny reads and writes of secret files, redact secret-looking values in tool output and in what is displayed
Destructive commandsrm-guard, process-kill-guard, git-tree-guard, dev-server-guard, slow-command-guard, slopsquat-guard, security-tier-checkRecursive deletes outside scratch need a marker, kills are by PID not by name, no recursive search from a drive root, package names that look hallucinated are refused
Model routing and costagent-model-guard, capability-graph-guard, subagent-budget-guard, fable-delegate-guard, batch-guard, repeat-tool-guardEvery spawn names a model and flows down the capability graph; fan-outs declare a ceiling; a run of single-statement calls or an identical repeated call is denied
Scope and integrityscope-lock, gate-freeze, guard-canary.ps1, mods-liveness, forced-verify-stop-gateEdits stay inside the claimed scope, frozen guard files match their lock, the guards are proven alive at session start, the Mods heartbeat is checked, a turn cannot end without its verification
Prompt chainprompt-dispatch, wakeup-guardThe ONE UserPromptSubmit process: runs every prompt hook in-process and merges their answers (eight spawns per prompt timed out on a loaded machine); a session woken three times in a row by a Monitor or task notification is told to stop answering "Waiting." and stop the stalled task
Contextcontext-graph, declick-nudge, opus-handoff-inject, codex-memory-injectLoad the modules the prompt, file or command calls for, under a token budget, with the reason attached
Session statesession-count, creds-resolve, correction-tracker, precompact-extract, compaction-ledger, post-edit-diagnostics, skill-telemetry.py, sync-main-checkout.pyCount live sessions, fill .env from the local vault, record corrections, carry state across compaction, syntax-check edited files, record skill use
Governancedashclaw-guard, dashclaw-setupOptional: hold risky calls for remote approval in DashClaw
Client adaptersadapters/codex-rewrite, adapters/codex-delegate-guard, universal-adapterTranslate Codex payloads to the Claude dialect and back; declare what each client's runtime can do

Every guard has an override marker for the case it was not written for, and a probe under engine/hooks/tests/ that makes it fail on purpose. The roster with markers: docs/guards.md. Measured cost per event: docs/hook-latency.md.

Rules and context modules

core/rules/global-rules.md is the working agreement every client receives: non-negotiables (secrets, hard stops), how to work, communication, definition of done, memory. npm run sync compiles it (with core/traits/traits.md) into the primary client's rules file; npm run port carries it everywhere.

Situational text is a module, not standing prompt. A module is a markdown file with a context: block (keyword, path and command triggers; requires and suggests edges) that loads when the prompt, the edited file or the command says it applies, in dependency order, under a budget, with the reason attached.

ModuleLoads when
delegation-and-model-routingAn agent is about to be spawned: the model ladder, escalations, fan-out arithmetic
memory-writing-rulesA prompt or a write touches memory: provenance tags, the recurrence gate, supersession
secrets-non-negotiableA command or edit names an env file, a key or a token
harness-integrityA hook or settings.json changes: probe, freeze, docs, doctor green
parallel-agents-inboxAnother agent shares the repository or the inbox holds a claim
harness-push-destinationsA commit is about to leave: which repository, which mirror
seo-floorA public web surface is created

How the graph selects, resolves and packs: docs/context-graph.md. Your own section of CLAUDE.md comes from overlay/profile.md and never enters this repository.

Mods

engine/mods/ holds the function-hook plugins that run inside Claude Code's hooks engine with no process spawn: claude-runtime (the runtime adapter: events, judgments, snapshots) and harness-mods (routing, context nudges, secret redaction, subagent accounting, a read cache). canary.cjs and shadow-report.cjs verify them from a classic hook, and universal-adapter.cjs records which of these capabilities each other client has, so a port drops a Mods-only artefact with a reason instead of pretending. The research record behind them is labs/claude-mods/.

Subagents and workflows

AgentModelRole
haiku-scouthaikuMechanical lookups: file and symbol hunts, inventories, git history; cites file and line
sonnet-implementersonnetA feature slice or refactor within a given scope; never edits test files
opus-owneropusA large or risky task end to end; may delegate to the two above
e2e-verifiersonnetRuns the verify command for a change someone else made; reports, never fixes
security-revieweropusRead-only review of auth, billing, secrets, webhooks and database changes
advisorone rung above the callerOne focused decision when an architecture choice or a second failed fix needs a stronger model
WorkflowShape
adversarial-reviewRead-only finders per dimension, then a skeptic per finding that defaults to refuted
fix-findingsApply confirmed findings in disjoint ownership groups, review each fix, re-fix once, verify, converge
tournamentN angled candidates, a judge panel scoring five criteria, one synthesized spec from the winner plus grafts
understandParallel readers over named subsystems, one synthesized map answering a question

Every spawn names its model and every fan-out declares its ceiling; the guards enforce it. The contract: core/rules/modules/delegation-and-model-routing.md.

Tools

Zero-dependency Node and PowerShell, each in its own directory with a README or a header that says what it does.

ToolWhat it answers
hook-latencyWhy a session is slow or token-hungry: wall clock per event, per hook, fixed context and cache losses per transcript, RAM and spawn latency
bash-noprofileA Git Bash shim for Claude Code's Bash tool on Windows that skips the login profile (a tool call went from 31.6 s to 4.2 s on the machine that motivated it)
spendTokens and estimated dollars per day, model and session, from local transcripts, with rolling windows
fleetWhich sessions are active, what each is working on, how heavy each is
recallOne search across project memory, decision docs and the archive
memstaleEvery absolute path a memory mentions still exists
memory-lintMachine checks for markdown memory stores, run by the pre-commit hook
skillfindFind any skill on the machine, including the invisible ones (stale plugins, project-scoped, disabled versions)
skill-telemetrySkill usage over time, from transcripts and the Stop hook
gatesThe mechanical doc checks: word budgets, markdown links, the reference ratchet, note format, rule expiry, the guard freeze
proveBreaks the thing a check watches, confirms the check goes red, restores it, confirms green
wiredarkCatches a new export with no production caller before it is committed
task-contractValidates a TASK_CONTRACT.md and can discharge every test-tier check
envdoctorSecrets and env wiring by name and presence only, never values
gitradarEvery git repository on the machine: dirty, unpushed, gone branches, last commit age
cronwatchA health board for scheduled jobs that fail silently overnight
harness-healthEvery settings layer scanned, every hook command optionally probed once
syncThe parity matrix per client and component, with check and port-now buttons
dashboardThe command center: rules, skills, decisions, the error explorer, maintenance routines, in a browser
errorlogTwo daily logs: what the agent predicted wrong, and what the human got wrong
subagent-budgetFits the subagent cost constants to measured transcripts
deskclawA Windows desktop eye and hand: UI trees, screenshots, click, type, key, with redaction and denylists
agent-browserDetects and clears a wedged browser daemon
earsLocal transcription, loudness and silence, waveform and spectrogram
mouthShort spoken status lines through Windows text-to-speech

Scheduled jobs and the learning loop

jobs/install.cjs --apply points Windows Task Scheduler at this checkout. The jobs are the harness's memory of its own mistakes:

JobWhenWhat
errorlog/harvest.sh06:22 dailyExtracts deviations and wrong assumptions from the day's transcripts
meditation/run-nightly.sh06:40 dailyA headless session runs the reflection skill over the fresh error log with no credentials in its environment; a stronger model on Sundays for the weekly synthesis
daily-distill.ps1nightlyengine/distill clusters the errors, evaluates candidate rules on a promotion ladder (observation, fact, rule, trait) and writes a proposal for a human to accept in the dashboard
port-daily.ps1after the meditationCaptures the primary client and ports it, so every client wakes up with the promoted rules
reapers/periodicKill orphaned agent processes and orphaned language servers

engine/harvest feeds storage/candidates.jsonl; engine/distill promotes on evidence (three signals across two sessions, older signals counting half, a contradiction demoting); tools/dashboard is where a human approves. The same ladder produced most of the rules in core/rules/global-rules.md.

Porting to twenty clients

ComponentFrom (Claude Code)To Codex CLITo Gemini CLITo CursorTo 16 others
Rules (CLAUDE.md, imports inlined)✓AGENTS.mdGEMINI.mdrules/*.mdceach client's rules file
Identity (SOUL.md)✓inlinedinlinedinlinedinlined or traits file
Hooks (settings.json)✓config.toml, pre-trustedsettings.json via shimhooks.json via shimwhere the client has hooks
Skills (skills/*/SKILL.md)✓linkedlinkedlinkedlinked
Subagents (agents/*.md)✓agents/*.toml, model ladder mapped–agents/*.mdwhere supported
Slash commands (commands/*.md)✓prompts/*.mdcommands/*.tomlcommands/*.mdwhere supported
MCP servers (.claude.json)✓[mcp_servers]mcpServersmcp.jsonwhere supported
Permissions✓rules/*.rules–––

Codex CLI works as the source too: the same eight components are read back from ~/.codex and written into Claude Code and the rest. The live matrix for your machine is npm run status; the generated per-client table is docs/targets.md: rules written to 20 of 20 clients, hooks driven in 5, skills linked in 15, subagents in 4, commands in 6, MCP in 8.

Supported clients: Claude Code, Codex CLI, Gemini CLI, Antigravity CLI, Cursor, Windsurf, GitHub Copilot, Cline, Aider, OpenHands, Goose, Continue, Zed, OpenCode, Trae, Amazon Q, Sourcegraph Cody, OpenClaw, Hermes, and a generic system prompt for any local or API model. Adding one is one entry in core/templates/targets.json (engine/harness/README.md).

Health checks

npm run doctor answers one question: is the installed harness the one this repository describes? Fourteen checks, each printing the count it processed:

links, hook-wiring, rules-drift, claude-md, old-refs, private-boundary, linked-leftovers, orphan-hooks, unexpected-links, context-graph, data-files, deps, jobs, mirror-current.

The pre-commit hook runs the secrets scan, wiredark, the guard freeze and the doc gates on every commit. tools/prove exists because a check that was never observed failing has been run, not verified.

What is shared, what stays private

This repository holds everything portable: rules and modules, guards, Mods, agents, workflows, tools, jobs, docs. Your overlay (~/.claude/overlay/, in a repository of your own) holds profile.md (the private section of CLAUDE.md), context-graph.json (your context roots) and gates.json (extra frozen files); memory, meditations and settings.json stay in the Claude home. CLAUDE.md has one writer, npm run sync. The doctor fails when a tracked file here carries your account's home path. docs/private-overlay.md.

Commands

CommandWhat
npm run setupFirst install: wire the core guards, link the surfaces, assemble CLAUDE.md, port, doctor.
npm run sync / npm run sync:checkCompile the rules for the primary client, bind the links, assemble CLAUDE.md. Idempotent.
npm run port / npm run port:checkCapture the primary client and apply to every other installed client; check writes nothing, exit 1 on drift.
npm run doctorFourteen checks with counts: links, hook wiring, generated drift, second writers, retired references, private paths, data files, orphans, context graph, deps, scheduled jobs, the mirror.
npm run status / npm run status:openPer-client, per-component matrix, in the terminal or as a page.
npm run explainEverything that was not ported, with reasons.
npm run distillRun the promotion ladder over the harvested candidates and write the proposal.
npm run dashboardThe command center in a browser.
node jobs/install.cjs --applyRe-point the scheduled jobs (Windows Task Scheduler) at this checkout.
npm testEngine suite plus sync, hook, wire-protocol, port, capability and context regressions.

Flags: --from claude|codex, --to codex,gemini, --check, --dry-run, --force, --home <dir>, --json. Full list: docs/configuration.md.

Documentation

docs/where-things-go.mdOne implementation per capability, one writer per generated file: where every kind of change goes.
docs/architecture.mdThe three places, the dependency direction, capture and apply, storage.
docs/ownership.mdThe ownership matrix: every capability, its one implementation, its writer, what generates from it.
docs/private-overlay.mdWhat the engine reads from your overlay and what stays private.
docs/guards.md, docs/hook-latency.mdEvery guard hook and its override marker; what each event costs, measured.
docs/context-graph.mdContext modules: triggers, edges, budgets, the ledger.
docs/porting.md, docs/parity.md, docs/targets.mdHow each component maps per client, verification, the generated per-client table.
docs/configuration.mdcore/port.json, every command and flag, env vars, scheduled jobs, uninstall.
docs/doc-standard.md, docs/decision-notes.mdHow prose is placed, sized and kept honest; how a decision is recorded.
docs/DECISIONS.md, docs/ERRORS.mdDurable decisions, newest first; what broke, why, and the lesson.
docs/windows-gotchas.md, docs/token-cache-discipline.md, docs/plugin-hygiene.mdPlatform failures that are not code; why the cache ratio matters; why a disabled plugin is not a stopped one.
docs/migration-2026-09.md, docs/PROVENANCE.mdThe 2026-09 consolidation and where every moved file came from.
engine/harness/README.md, engine/context/README.md, engine/mods/README.mdThe adapter contract, the context graph internals, the Mods.
CONTRIBUTING.md, SECURITY.md, CHANGELOG.mdSetup and rules for a change; scope and reporting; release notes.

Repository layout

core/       rules/ (global-rules.md + modules/), templates/targets.json (the client registry), safety/guards.json, traits/, port.json, examples/
engine/     harness/ (capture, apply, status, cli; sources/, targets/)   context/ (the module graph)   sync/   setup/   doctor/
            hooks/ (the guards, lib/, tests/, adapters/, shim.cjs)   mods/ (function-hook plugins)   harvest/  distill/  ingest/  skills/  audit/  docs/  tests/
agents/     subagent definitions        workflows/   saved Workflow scripts        skills/    the consolidated skill library
tools/      operator CLIs and pages      jobs/        scheduled jobs + install.cjs   packages/  markdown-agent-memory
docs/       this documentation           examples/    an installed harness           labs/      research (may depend on engine; never the reverse)
harness/    your captured bundle (gitignored)    storage/  runtime state, backups, reports (gitignored)

Installed surfaces: ~/.claude/{hooks,tools,mods,agents,workflows} are links into engine/hooks, tools, engine/mods, agents, workflows.

Development

npm test               # engine suite + sync, hook, wire-protocol, port, capability and context regressions
npm run docs:check     # generated docs are current

Every test builds a throwaway home directory; nothing in the suite touches yours. CI runs on Ubuntu (Node 18 and 22) and Windows (Node 22). Commits pass the secrets scan, wiredark, the guard freeze and the doc gates locally first. See CONTRIBUTING.md.

Security

No secret is read by the harness: guards deny the paths, envdoctor reports names and presence only, a captured value that looks like a token is replaced by ${NAME}, and the doctor fails on the author's home path or on transcript-derived data in the tree. Report a vulnerability privately as described in SECURITY.md.

  • agnostic-agent: the terminal coding agent that used to live in this repo. Local or hosted models, subagents, the same safety policy.
  • DashClaw: remote approvals and execution evidence for unattended agents.
  • agent-capsule: move a whole Claude Code harness onto a fresh Linux box.
  • markdown-agent-memory: the memory policy this harness runs on, as a package.

If this saved you an incident, sponsoring keeps the nightly loop running.

License

MIT. See LICENSE.

Runtime capabilities (supports in core/templates/targets.json)

Claude Code now has capabilities other targets do not (the Function Hooks layer in ~/.claude/mods, 2026-09-16). Every target declares them explicitly; universal-adapter.cjs exposes capabilitiesOf(client) and requires(client, feature) so a porter DROPS a Mods-only artefact with a recorded reason (dropped: target lacks <feature>) instead of forcing every runtime to the lowest common denominator or pretending a target exposes a feature it does not. The Claude row describes the harness with ~/.claude/mods installed. engine/tests/reg-capabilities.cjs fails when this table and targets.json disagree.

targettool interceptresult mutationruntime eventssubagent eventsUI injectiondynamic permissionscontext signalsusage signalsmiddlewareruntime memorycheckpointingsemantic judgment
claudeyesyesyesyesyesyesyesyesyesyesfile-levelstub,model,jev
codexyesnoyesyesnoyesnonononononestub
geminiyesnoyesnononononononononestub
agyyesnoyesnononononononononestub
cursornonononononononononononestub
windsurfnonononononononononononestub
copilotnonononononononononononestub
clinenonononononononononononestub
aidernonononononononononononestub
openhandsnonononononononononononestub
goosenonononononononononononestub
continuenonononononononononononestub
zednonononononononononononestub
opencodenonononononononononononestub
traenonononononononononononestub
amazonqnonononononononononononestub
codynonononononononononononestub
openclawnonononononononononononestub
hermesnonononononononononononestub
genericnonononononononononononestub
agent-guardrails
ai-agents
anthropic
claude
claude-code
developer-tools
hooks
llm-ops
windows

Significant stargazers

Rezolv

49 followers · starred Sep 2026

Denis Iskandarov

42 followers · starred Sep 2026

ucsandman/claude-harness

The Claude Code harness I run every day, published under this name since day one and now the same repository as ucsandman/Agnostic-AI: guard hooks, rules, context modules, Mods, subagents, workflows, tools and jobs, ported to 20 clients. Zero-dependency Node.

JavaScript

25

172 commits

updated Sep 29, 2026

See the code

See what people are saying

SourceMessageScoreDate

https://github.com/ucsandman/claude-harness

on Fable Decides, Opus and Sonnet Do the Work: How I Route Claude Code Subagents

0

Sep 29, 2026

README

Agnostic AI

CI License: MIT Node 18+ Zero dependencies Clients Platform Sponsor

One harness. Every client. One repository.

Agnostic AI is the operating system for an AI coding harness: the guard hooks that block secrets and destructive commands, the working agreement (rules), the on-demand context modules, subagents, saved workflows, Mods (function-hook plugins), operator tools, scheduled jobs and the learning loop that turns incidents into rules. It is installed into the client you use (Claude Code) as links, and ported from there into every other client on the machine (Codex, Gemini CLI, Cursor and sixteen more) in each one's dialect. Your identity, private rules, memory and machine config stay in a small private overlay of your own.

It is not a starter kit designed in an afternoon. It grew rule by rule out of daily use, and most of it exists because something broke first: every guard has an incident behind it, every doc has a word ceiling, every check reports the count it processed, and a check that was never seen failing does not count as verified.

This repository is also published as ucsandman/claude-harness, the name it was first shared under. Both receive every push; they are the same commits.

Contents

Install

git clone https://github.com/ucsandman/Agnostic-AI.git && cd Agnostic-AI
npm run setup      # wire the core guards, link the surfaces, assemble CLAUDE.md, port, doctor

Node 18+ and git, nothing else. setup compiles core/rules into ~/.claude/agnostic-rules.md, generates a CLAUDE.md that imports it, wires the core guards into settings.json, links ~/.claude/{hooks,tools,mods,agents,workflows} into this checkout (a real directory there is moved aside, never deleted), ports the harness to every other installed client and runs the doctor (CLAUDE_CONFIG_DIR moves the home). The three commands you keep using:

npm run sync       # rules changed, or a link is missing: recompile, relink, reassemble CLAUDE.md
npm run port       # push the harness to every other installed client
npm run doctor     # drift, a second writer, a broken link, an old path, a private path in public code

To use it as a template: click Use this template, clone, npm run setup. core/port.json chooses the source client, restricts targets, or excludes a hook, skill or MCP server with a reason.

What is inside

DirectoryWhat it holdsSize
core/The source of truth: rules/global-rules.md and its on-demand modules, templates/targets.json (the client registry), safety/guards.json (the one safety policy), traits/, port.json, incident examples/7 modules, 20 clients
engine/The port engine and everything that runs: harness/ (capture, apply, status), sync/ (rules compiler, link binder, CLAUDE.md assembly), setup/ (first run, links), doctor/, context/ (the module graph), hooks/ (the guards, their probes, the client shim), mods/, harvest/ and distill/ (the learning loop), ingest/, skills/, audit/, docs/ (generators), tests/14 subsystems, 39 hooks
agents/Subagent definitions with model, tools and scope6
workflows/Saved Workflow scripts for multi-agent work4
tools/Operator CLIs and pages: measure, search, prove, render25
jobs/Scheduled jobs and the installer that points Task Scheduler at them6
skills/The consolidated skill library, linked (never copied) into each client216
packages/markdown-agent-memory, the published memory policy, templates and linter1
docs/The documentation, each file under a word ceiling the pre-commit hook enforces29
labs/Research: the Mods sprint record, detached builder, process ledger, token-flow audit. Nothing in engine/ depends on it4
examples/An installed harness for reference1
harness/, storage/Your captured bundle and runtime state, both gitignored

How it fits together

Dependency direction is one way: core to engine to the installed surfaces to the client homes. The overlay is read through three named files. Every generated file has one writer, and the doctor fails on a second one.

flowchart LR
  core["core/<br/>rules, modules, targets.json,<br/>guards.json, port.json"] --> engine["engine/<br/>sync, setup, doctor, context graph,<br/>hooks, Mods, harness port"]
  overlay["overlay/ (private)<br/>profile.md, context-graph.json, gates.json"] -. read by sync .-> engine
  engine --> home["~/.claude<br/>hooks, tools, mods, agents, workflows as links<br/>agnostic-rules.md, CLAUDE.md generated"]
  home -- capture --> bundle["harness/ bundle<br/>rules, identity, hooks, skills,<br/>agents, commands, mcp, permissions"]
  bundle -- apply --> clients["19 other clients<br/>Codex, Gemini, Cursor, Windsurf, Cline, ..."]
  clients -- one shim --> guards["engine/hooks/<br/>the same guard scripts everywhere"]
  1. Capture reads the client you use into a client-neutral bundle: rules with every @import inlined, hooks in one dialect, skills, agents, commands, MCP servers, permissions. A value that looks like a token becomes ${NAME} and you are told what to export.
  2. Apply renders the bundle into each other client's dialect. Hooks are not copied: every client is pointed at the same scripts through a shim; skills are linked.
  3. Nothing is destroyed. Generated files carry the port's header; user-owned files get a marked region and are otherwise preserved. Every overwrite is backed up. --check exits 1 on drift.
  4. Every drop is explained by npm run explain, from core/port.json.

The three places in full, with the storage layout and the adapter contract: docs/architecture.md.

Guards

engine/hooks/ holds 41 hooks: 38 Node, 2 Python, 1 PowerShell. They run on Claude Code's events (PreToolUse, PostToolUse, UserPromptSubmit, Stop, SessionStart, SubagentStart, PreCompact) and, through engine/hooks/shim.cjs, on every other client that has hooks. One file, core/safety/guards.json, is the policy every guard reads: secret paths are always blocked, hard-stop commands need a human, a missing policy fails closed.

GroupHooksWhat they do
Secretssecret-guard, secret-path-guard, tool-output-secret-watch, output-secret-watchDeny reads and writes of secret files, redact secret-looking values in tool output and in what is displayed
Destructive commandsrm-guard, process-kill-guard, git-tree-guard, dev-server-guard, slow-command-guard, slopsquat-guard, security-tier-checkRecursive deletes outside scratch need a marker, kills are by PID not by name, no recursive search from a drive root, package names that look hallucinated are refused
Model routing and costagent-model-guard, capability-graph-guard, subagent-budget-guard, fable-delegate-guard, batch-guard, repeat-tool-guardEvery spawn names a model and flows down the capability graph; fan-outs declare a ceiling; a run of single-statement calls or an identical repeated call is denied
Scope and integrityscope-lock, gate-freeze, guard-canary.ps1, mods-liveness, forced-verify-stop-gateEdits stay inside the claimed scope, frozen guard files match their lock, the guards are proven alive at session start, the Mods heartbeat is checked, a turn cannot end without its verification
Prompt chainprompt-dispatch, wakeup-guardThe ONE UserPromptSubmit process: runs every prompt hook in-process and merges their answers (eight spawns per prompt timed out on a loaded machine); a session woken three times in a row by a Monitor or task notification is told to stop answering "Waiting." and stop the stalled task
Contextcontext-graph, declick-nudge, opus-handoff-inject, codex-memory-injectLoad the modules the prompt, file or command calls for, under a token budget, with the reason attached
Session statesession-count, creds-resolve, correction-tracker, precompact-extract, compaction-ledger, post-edit-diagnostics, skill-telemetry.py, sync-main-checkout.pyCount live sessions, fill .env from the local vault, record corrections, carry state across compaction, syntax-check edited files, record skill use
Governancedashclaw-guard, dashclaw-setupOptional: hold risky calls for remote approval in DashClaw
Client adaptersadapters/codex-rewrite, adapters/codex-delegate-guard, universal-adapterTranslate Codex payloads to the Claude dialect and back; declare what each client's runtime can do

Every guard has an override marker for the case it was not written for, and a probe under engine/hooks/tests/ that makes it fail on purpose. The roster with markers: docs/guards.md. Measured cost per event: docs/hook-latency.md.

Rules and context modules

core/rules/global-rules.md is the working agreement every client receives: non-negotiables (secrets, hard stops), how to work, communication, definition of done, memory. npm run sync compiles it (with core/traits/traits.md) into the primary client's rules file; npm run port carries it everywhere.

Situational text is a module, not standing prompt. A module is a markdown file with a context: block (keyword, path and command triggers; requires and suggests edges) that loads when the prompt, the edited file or the command says it applies, in dependency order, under a budget, with the reason attached.

ModuleLoads when
delegation-and-model-routingAn agent is about to be spawned: the model ladder, escalations, fan-out arithmetic
memory-writing-rulesA prompt or a write touches memory: provenance tags, the recurrence gate, supersession
secrets-non-negotiableA command or edit names an env file, a key or a token
harness-integrityA hook or settings.json changes: probe, freeze, docs, doctor green
parallel-agents-inboxAnother agent shares the repository or the inbox holds a claim
harness-push-destinationsA commit is about to leave: which repository, which mirror
seo-floorA public web surface is created

How the graph selects, resolves and packs: docs/context-graph.md. Your own section of CLAUDE.md comes from overlay/profile.md and never enters this repository.

Mods

engine/mods/ holds the function-hook plugins that run inside Claude Code's hooks engine with no process spawn: claude-runtime (the runtime adapter: events, judgments, snapshots) and harness-mods (routing, context nudges, secret redaction, subagent accounting, a read cache). canary.cjs and shadow-report.cjs verify them from a classic hook, and universal-adapter.cjs records which of these capabilities each other client has, so a port drops a Mods-only artefact with a reason instead of pretending. The research record behind them is labs/claude-mods/.

Subagents and workflows

AgentModelRole
haiku-scouthaikuMechanical lookups: file and symbol hunts, inventories, git history; cites file and line
sonnet-implementersonnetA feature slice or refactor within a given scope; never edits test files
opus-owneropusA large or risky task end to end; may delegate to the two above
e2e-verifiersonnetRuns the verify command for a change someone else made; reports, never fixes
security-revieweropusRead-only review of auth, billing, secrets, webhooks and database changes
advisorone rung above the callerOne focused decision when an architecture choice or a second failed fix needs a stronger model
WorkflowShape
adversarial-reviewRead-only finders per dimension, then a skeptic per finding that defaults to refuted
fix-findingsApply confirmed findings in disjoint ownership groups, review each fix, re-fix once, verify, converge
tournamentN angled candidates, a judge panel scoring five criteria, one synthesized spec from the winner plus grafts
understandParallel readers over named subsystems, one synthesized map answering a question

Every spawn names its model and every fan-out declares its ceiling; the guards enforce it. The contract: core/rules/modules/delegation-and-model-routing.md.

Tools

Zero-dependency Node and PowerShell, each in its own directory with a README or a header that says what it does.

ToolWhat it answers
hook-latencyWhy a session is slow or token-hungry: wall clock per event, per hook, fixed context and cache losses per transcript, RAM and spawn latency
bash-noprofileA Git Bash shim for Claude Code's Bash tool on Windows that skips the login profile (a tool call went from 31.6 s to 4.2 s on the machine that motivated it)
spendTokens and estimated dollars per day, model and session, from local transcripts, with rolling windows
fleetWhich sessions are active, what each is working on, how heavy each is
recallOne search across project memory, decision docs and the archive
memstaleEvery absolute path a memory mentions still exists
memory-lintMachine checks for markdown memory stores, run by the pre-commit hook
skillfindFind any skill on the machine, including the invisible ones (stale plugins, project-scoped, disabled versions)
skill-telemetrySkill usage over time, from transcripts and the Stop hook
gatesThe mechanical doc checks: word budgets, markdown links, the reference ratchet, note format, rule expiry, the guard freeze
proveBreaks the thing a check watches, confirms the check goes red, restores it, confirms green
wiredarkCatches a new export with no production caller before it is committed
task-contractValidates a TASK_CONTRACT.md and can discharge every test-tier check
envdoctorSecrets and env wiring by name and presence only, never values
gitradarEvery git repository on the machine: dirty, unpushed, gone branches, last commit age
cronwatchA health board for scheduled jobs that fail silently overnight
harness-healthEvery settings layer scanned, every hook command optionally probed once
syncThe parity matrix per client and component, with check and port-now buttons
dashboardThe command center: rules, skills, decisions, the error explorer, maintenance routines, in a browser
errorlogTwo daily logs: what the agent predicted wrong, and what the human got wrong
subagent-budgetFits the subagent cost constants to measured transcripts
deskclawA Windows desktop eye and hand: UI trees, screenshots, click, type, key, with redaction and denylists
agent-browserDetects and clears a wedged browser daemon
earsLocal transcription, loudness and silence, waveform and spectrogram
mouthShort spoken status lines through Windows text-to-speech

Scheduled jobs and the learning loop

jobs/install.cjs --apply points Windows Task Scheduler at this checkout. The jobs are the harness's memory of its own mistakes:

JobWhenWhat
errorlog/harvest.sh06:22 dailyExtracts deviations and wrong assumptions from the day's transcripts
meditation/run-nightly.sh06:40 dailyA headless session runs the reflection skill over the fresh error log with no credentials in its environment; a stronger model on Sundays for the weekly synthesis
daily-distill.ps1nightlyengine/distill clusters the errors, evaluates candidate rules on a promotion ladder (observation, fact, rule, trait) and writes a proposal for a human to accept in the dashboard
port-daily.ps1after the meditationCaptures the primary client and ports it, so every client wakes up with the promoted rules
reapers/periodicKill orphaned agent processes and orphaned language servers

engine/harvest feeds storage/candidates.jsonl; engine/distill promotes on evidence (three signals across two sessions, older signals counting half, a contradiction demoting); tools/dashboard is where a human approves. The same ladder produced most of the rules in core/rules/global-rules.md.

Porting to twenty clients

ComponentFrom (Claude Code)To Codex CLITo Gemini CLITo CursorTo 16 others
Rules (CLAUDE.md, imports inlined)✓AGENTS.mdGEMINI.mdrules/*.mdceach client's rules file
Identity (SOUL.md)✓inlinedinlinedinlinedinlined or traits file
Hooks (settings.json)✓config.toml, pre-trustedsettings.json via shimhooks.json via shimwhere the client has hooks
Skills (skills/*/SKILL.md)✓linkedlinkedlinkedlinked
Subagents (agents/*.md)✓agents/*.toml, model ladder mapped–agents/*.mdwhere supported
Slash commands (commands/*.md)✓prompts/*.mdcommands/*.tomlcommands/*.mdwhere supported
MCP servers (.claude.json)✓[mcp_servers]mcpServersmcp.jsonwhere supported
Permissions✓rules/*.rules–––

Codex CLI works as the source too: the same eight components are read back from ~/.codex and written into Claude Code and the rest. The live matrix for your machine is npm run status; the generated per-client table is docs/targets.md: rules written to 20 of 20 clients, hooks driven in 5, skills linked in 15, subagents in 4, commands in 6, MCP in 8.

Supported clients: Claude Code, Codex CLI, Gemini CLI, Antigravity CLI, Cursor, Windsurf, GitHub Copilot, Cline, Aider, OpenHands, Goose, Continue, Zed, OpenCode, Trae, Amazon Q, Sourcegraph Cody, OpenClaw, Hermes, and a generic system prompt for any local or API model. Adding one is one entry in core/templates/targets.json (engine/harness/README.md).

Health checks

npm run doctor answers one question: is the installed harness the one this repository describes? Fourteen checks, each printing the count it processed:

links, hook-wiring, rules-drift, claude-md, old-refs, private-boundary, linked-leftovers, orphan-hooks, unexpected-links, context-graph, data-files, deps, jobs, mirror-current.

The pre-commit hook runs the secrets scan, wiredark, the guard freeze and the doc gates on every commit. tools/prove exists because a check that was never observed failing has been run, not verified.

What is shared, what stays private

This repository holds everything portable: rules and modules, guards, Mods, agents, workflows, tools, jobs, docs. Your overlay (~/.claude/overlay/, in a repository of your own) holds profile.md (the private section of CLAUDE.md), context-graph.json (your context roots) and gates.json (extra frozen files); memory, meditations and settings.json stay in the Claude home. CLAUDE.md has one writer, npm run sync. The doctor fails when a tracked file here carries your account's home path. docs/private-overlay.md.

Commands

CommandWhat
npm run setupFirst install: wire the core guards, link the surfaces, assemble CLAUDE.md, port, doctor.
npm run sync / npm run sync:checkCompile the rules for the primary client, bind the links, assemble CLAUDE.md. Idempotent.
npm run port / npm run port:checkCapture the primary client and apply to every other installed client; check writes nothing, exit 1 on drift.
npm run doctorFourteen checks with counts: links, hook wiring, generated drift, second writers, retired references, private paths, data files, orphans, context graph, deps, scheduled jobs, the mirror.
npm run status / npm run status:openPer-client, per-component matrix, in the terminal or as a page.
npm run explainEverything that was not ported, with reasons.
npm run distillRun the promotion ladder over the harvested candidates and write the proposal.
npm run dashboardThe command center in a browser.
node jobs/install.cjs --applyRe-point the scheduled jobs (Windows Task Scheduler) at this checkout.
npm testEngine suite plus sync, hook, wire-protocol, port, capability and context regressions.

Flags: --from claude|codex, --to codex,gemini, --check, --dry-run, --force, --home <dir>, --json. Full list: docs/configuration.md.

Documentation

docs/where-things-go.mdOne implementation per capability, one writer per generated file: where every kind of change goes.
docs/architecture.mdThe three places, the dependency direction, capture and apply, storage.
docs/ownership.mdThe ownership matrix: every capability, its one implementation, its writer, what generates from it.
docs/private-overlay.mdWhat the engine reads from your overlay and what stays private.
docs/guards.md, docs/hook-latency.mdEvery guard hook and its override marker; what each event costs, measured.
docs/context-graph.mdContext modules: triggers, edges, budgets, the ledger.
docs/porting.md, docs/parity.md, docs/targets.mdHow each component maps per client, verification, the generated per-client table.
docs/configuration.mdcore/port.json, every command and flag, env vars, scheduled jobs, uninstall.
docs/doc-standard.md, docs/decision-notes.mdHow prose is placed, sized and kept honest; how a decision is recorded.
docs/DECISIONS.md, docs/ERRORS.mdDurable decisions, newest first; what broke, why, and the lesson.
docs/windows-gotchas.md, docs/token-cache-discipline.md, docs/plugin-hygiene.mdPlatform failures that are not code; why the cache ratio matters; why a disabled plugin is not a stopped one.
docs/migration-2026-09.md, docs/PROVENANCE.mdThe 2026-09 consolidation and where every moved file came from.
engine/harness/README.md, engine/context/README.md, engine/mods/README.mdThe adapter contract, the context graph internals, the Mods.
CONTRIBUTING.md, SECURITY.md, CHANGELOG.mdSetup and rules for a change; scope and reporting; release notes.

Repository layout

core/       rules/ (global-rules.md + modules/), templates/targets.json (the client registry), safety/guards.json, traits/, port.json, examples/
engine/     harness/ (capture, apply, status, cli; sources/, targets/)   context/ (the module graph)   sync/   setup/   doctor/
            hooks/ (the guards, lib/, tests/, adapters/, shim.cjs)   mods/ (function-hook plugins)   harvest/  distill/  ingest/  skills/  audit/  docs/  tests/
agents/     subagent definitions        workflows/   saved Workflow scripts        skills/    the consolidated skill library
tools/      operator CLIs and pages      jobs/        scheduled jobs + install.cjs   packages/  markdown-agent-memory
docs/       this documentation           examples/    an installed harness           labs/      research (may depend on engine; never the reverse)
harness/    your captured bundle (gitignored)    storage/  runtime state, backups, reports (gitignored)

Installed surfaces: ~/.claude/{hooks,tools,mods,agents,workflows} are links into engine/hooks, tools, engine/mods, agents, workflows.

Development

npm test               # engine suite + sync, hook, wire-protocol, port, capability and context regressions
npm run docs:check     # generated docs are current

Every test builds a throwaway home directory; nothing in the suite touches yours. CI runs on Ubuntu (Node 18 and 22) and Windows (Node 22). Commits pass the secrets scan, wiredark, the guard freeze and the doc gates locally first. See CONTRIBUTING.md.

Security

No secret is read by the harness: guards deny the paths, envdoctor reports names and presence only, a captured value that looks like a token is replaced by ${NAME}, and the doctor fails on the author's home path or on transcript-derived data in the tree. Report a vulnerability privately as described in SECURITY.md.

  • agnostic-agent: the terminal coding agent that used to live in this repo. Local or hosted models, subagents, the same safety policy.
  • DashClaw: remote approvals and execution evidence for unattended agents.
  • agent-capsule: move a whole Claude Code harness onto a fresh Linux box.
  • markdown-agent-memory: the memory policy this harness runs on, as a package.

If this saved you an incident, sponsoring keeps the nightly loop running.

License

MIT. See LICENSE.

Runtime capabilities (supports in core/templates/targets.json)

Claude Code now has capabilities other targets do not (the Function Hooks layer in ~/.claude/mods, 2026-09-16). Every target declares them explicitly; universal-adapter.cjs exposes capabilitiesOf(client) and requires(client, feature) so a porter DROPS a Mods-only artefact with a recorded reason (dropped: target lacks <feature>) instead of forcing every runtime to the lowest common denominator or pretending a target exposes a feature it does not. The Claude row describes the harness with ~/.claude/mods installed. engine/tests/reg-capabilities.cjs fails when this table and targets.json disagree.

targettool interceptresult mutationruntime eventssubagent eventsUI injectiondynamic permissionscontext signalsusage signalsmiddlewareruntime memorycheckpointingsemantic judgment
claudeyesyesyesyesyesyesyesyesyesyesfile-levelstub,model,jev
codexyesnoyesyesnoyesnonononononestub
geminiyesnoyesnononononononononestub
agyyesnoyesnononononononononestub
cursornonononononononononononestub
windsurfnonononononononononononestub
copilotnonononononononononononestub
clinenonononononononononononestub
aidernonononononononononononestub
openhandsnonononononononononononestub
goosenonononononononononononestub
continuenonononononononononononestub
zednonononononononononononestub
opencodenonononononononononononestub
traenonononononononononononestub
amazonqnonononononononononononestub
codynonononononononononononestub
openclawnonononononononononononestub
hermesnonononononononononononestub
genericnonononononononononononestub
agent-guardrails
ai-agents
anthropic
claude
claude-code
developer-tools
hooks
llm-ops
windows

Significant stargazers

Rezolv

49 followers · starred Sep 2026

Denis Iskandarov

42 followers · starred Sep 2026

Languages

JavaScript

67.9%

TypeScript

10.2%

HTML

8.7%

PowerShell

7.4%

Python

5.0%