ctxcarry keeps agent work durable across Claude, Codex, and other local coding
tools. It records what happened, prepares compact handoffs, runs verification,
isolates tasks in git worktrees, and can run generator/evaluator loops on a
schedule.
The goal is simple: make agent work reviewable, repeatable, and recoverable without sending your project state to a hosted coordination service. The core idea:
Coding agents should not own your context. Your repo should.
Install and build from this repository:
pnpm install
pnpm build
npm install -g .Initialize a project:
ctxcarry initRun a normal wrapped agent session:
ctxcarry run codexRun a generator/evaluator loop:
ctxcarry loop \
--task "Fix the failing tests" \
--generator codex \
--evaluator codexDiscover local work and run the top task:
ctxcarry discover
ctxcarry loop --from-discovery --generator codex --evaluator codex- Stores durable project memory under
.ctxcarry/. - Captures session summaries, decisions, constraints, failures, and next steps.
- Writes handoff blocks into
AGENTS.mdorCLAUDE.md. - Runs verification and stores pass/fail artifacts.
- Creates isolated git worktrees for agent tasks.
- Runs generator/evaluator loops so the author does not grade its own work.
- Discovers local tasks from failed checks, board items, failed loops, and TODOs.
- Schedules unattended local loops with macOS
launchd. - Keeps token use under control with compact handoffs, trimmed artifacts, and loop limits.
Repo
|
| ctxcarry discover
v
Discovered task
|
| ctxcarry loop
v
Isolated git worktree
|
| generator agent writes changes
v
Verification runs in that worktree
|
| evaluator agent reviews diff + verification
v
Verdict: PASS / FAIL / NEEDS_REVIEW
|
v
.ctxcarry/board.md + .ctxcarry/loops/<id>/
The important rule is separation: the generator writes the change, and the evaluator assumes the change is broken until it proves otherwise.
ctxcarry writes local state to disk:
.ctxcarry/state.json
.ctxcarry/state.md
.ctxcarry/events.jsonl
.ctxcarry/sessions/<session-id>/
Sessions are expected to write a short summary.md with durable state. Future
agents can continue from that summary without rereading the entire conversation.
Compile a handoff for another agent:
ctxcarry compile --agent codex --budget 4000
ctxcarry switch claude --budget 4000For Codex, ctxcarry writes a managed block in AGENTS.md. For Claude, it writes
to CLAUDE.md.
ctxcarry verify runs the configured commands from ctxcarry.config.json and
stores artifacts:
.ctxcarry/verification/latest.md
.ctxcarry/verification/<timestamp>.json
Typical generated config for this repo:
{
"verify": {
"commands": ["pnpm test", "pnpm build"]
}
}Worktrees keep agent tasks isolated from your main checkout:
ctxcarry worktree create "Fix flaky test"
ctxcarry worktree list
ctxcarry worktree clean --forceLoop runs use this same idea automatically.
Run one task through a generator and evaluator:
ctxcarry loop \
--task "Improve README command examples" \
--generator codex \
--evaluator codexLoop artifacts are written to:
.ctxcarry/loops/<loop-id>/task.txt
.ctxcarry/loops/<loop-id>/diff.md
.ctxcarry/loops/<loop-id>/verification.md
.ctxcarry/loops/<loop-id>/evaluator.md
.ctxcarry/loops/<loop-id>/verdict.md
The evaluator writes one of:
PASS
FAIL
NEEDS_REVIEW
Discovery finds local work:
ctxcarry discover
ctxcarry discover --skip-verify --limit 5
ctxcarry discover --jsonCurrent sources:
- failed
ctxcarry verify .ctxcarry/board.mdtasks- failed or incomplete loop verdicts
TODOandFIXMEmarkers
Discovery writes:
.ctxcarry/discovery/latest.md
.ctxcarry/discovery/latest.json
Install a local macOS schedule:
ctxcarry schedule install \
--every 1h \
--limit 1 \
--allow-dirty \
--generator codex \
--evaluator codex \
--timeout-seconds 1800Run it manually:
ctxcarry schedule run \
--limit 1 \
--allow-dirty \
--generator codex \
--evaluator codex \
--timeout-seconds 1800Inspect or remove it:
ctxcarry schedule status
ctxcarry schedule uninstallSchedule logs are stored in:
.ctxcarry/schedule/
Loop engineering can get expensive. ctxcarry uses a conservative default model:
- compact handoffs instead of full transcripts
- summarized verification output
- trimmed diff artifacts in evaluator prompts
- one scheduled loop per run by default
- explicit timeouts for scheduled jobs
- token estimates via
ctxcarry tokens
Useful commands:
ctxcarry tokens --agent codex --budget 4000
ctxcarry compactRecommended operating pattern:
- Use cheap/default agents for discovery and simple tasks.
- Use stronger or more expensive models only for high-risk generator/evaluator runs.
- Keep scheduled runs limited until the loop has proven useful on real work.
- Do not treat a
PASSverdict as a substitute for human judgment on important code.
ctxcarry init
ctxcarry setup [--aliases]
ctxcarry capture [--agent claude]
ctxcarry note --type decision|failure|todo|constraint|task|next|resolved --text "..."
ctxcarry run <agent> [--prompt "..."]
ctxcarry enter <agent> [--no-launch]
ctxcarry compact
ctxcarry compile --agent codex|claude [--budget 4000]
ctxcarry switch <agent> [--budget 4000]
ctxcarry verify
ctxcarry board
ctxcarry worktree <create|list|clean>
ctxcarry discover [--limit 10] [--json] [--skip-verify]
ctxcarry loop --task "..." --generator codex --evaluator codex
ctxcarry loop --from-discovery [--limit 1] [--allow-dirty]
ctxcarry schedule <install|uninstall|status|run>
ctxcarry status
ctxcarry tokens [--agent codex] [--budget 4000]
ctxcarry learn [--apply]
ctxcarry mcp serve
ctxcarry can expose local session memory to MCP-compatible clients:
ctxcarry mcp serveAvailable tools include:
get_relevant_session_eventsexpand_session_artifact
Use ctxcarry when you:
- work with multiple coding agents
- want durable context across sessions
- need local worktree isolation
- want evaluator review before trusting generated code
- want scheduled maintenance loops while keeping state local
Skip or keep it manual when:
- the repo has weak or unreliable verification
- the task requires high product judgment
- token cost matters more than automation
- you are not prepared to review generated changes
- Generated work happens in git worktrees.
- Verification results and verdicts are stored on disk.
- Secret-looking values are redacted in stored outputs.
- Worktree cleanup requires
--force. - Scheduled jobs should use
--timeout-seconds. - Commit ctxcarry changes before relying on loop worktrees; worktrees are based on git state.
pnpm install
pnpm build
pnpm test
pnpm run benchUseful scripts:
pnpm buildcompiles TypeScript.pnpm testbuilds and runs the Node test suite.pnpm run smokebuilds and prints CLI help.pnpm run benchruns benchmark tooling.
ctxcarry is local-first agent infrastructure. It is intentionally plain: Markdown, JSON, git worktrees, shell commands, and MCP. The core idea is not to hide agent work. The core idea is to make it inspectable.
Unknown repositories and agents can be risky. Treat agent execution as untrusted automation: review setup commands, inspect diffs, run verification, and prefer isolated worktrees before letting generated changes near your main checkout. Recent reporting around AI coding agents has highlighted how agents can be manipulated into running malicious setup commands from seemingly normal repositories, so ctxcarry is designed around local state, reviewable artifacts, verification, and generator/evaluator separation.
