A Claude Code harness that earns its autonomy.
Deep research, then interrogation — until the spec is extracted from your head onto the page. An orchestrator agent with a tight spec and a solid harness can be trusted to work while you sleep.
The commands you invoke, in order — turning a vague brief into a spec worth trusting, then a fork: hand it to the night, or ship it beside you.
What gets run
You invoke these in order. /requirements sets the charter, /discovery fans it into tickets, /lifecycle carries one from spec to shipped — its front phases run alone as /refine. Underneath runs the charter — project.md — which every stage reads to stay on course.
Get step zero right and everything after it stays on course. Skip it and discovery fans out on guesses, every spec earns the wrong edges, and the overnight build ships the wrong thing — fast.
The interrogation bench · /requirements
Give it a brief — vague or detailed — and it returns a rapid sequence of questions that draw the real requirements out of your head and onto project.md. Watch the charter densify, a glossary term get minted, and an ADR spin off the moment a decision clears the gate.
Three durable layers, one interview: project.md holds the rules, glossary.md the words, cortex/adr/ the why.
HOW IT WORKS
- Relentless questioning. Question-beams fire one at a time and a meter tallies them. Keep asking until the gaps are addressed.
- An ADR spins off at the gate. When a decision is hard to reverse · surprising · a real trade-off, the interview proposes an ADR (lands proposed, promotes to accepted at merge). The project.md row keeps only a → 0007 back-pointer; the ADR owns the rationale.
- Progressive disclosure keeps context lean. project.md stays terse and always-loaded; the why lives in ADRs and the words in the glossary, pulled in on demand only when a stage needs them. Downstream agents read the rule, not the whole backstory.
/discovery fires it off
One prompt. Discovery clarifies ambiguities, reviews adversarially, and spawns one ticket per scoped piece of work.
/refine each ticket separately
Refinement turns a scoped ticket into a buildable spec. Each ticket lands with shared scope, cited prior art, and pinned acceptance criteria — the things that prevent rework once code starts.
Earn the spec, pick the harness.
Cortex scales its rigor to the work — and runs the phases that turn a feature into a real spec.
Complexity earns ceremony. Simplicity skips it.
Two values in your spec — complexity and criticality — set how much rigor the work earns. The harness reads them and patches the lifecycle to match.
Research phase 02
- Stardew Valley: tight skill window, instant feedback.
- Animal CrossingSea of Thieves: fishing as social ritual.
- Dredge: dread, reward, depth as risk axis.
- Real-world nightline: hooks set at dusk, retrieved at dawn — a sleep-while-you-fish craft.
Specify phase 03
Plan phase 04/critical-review available before approval
What happens after you walk away — the overnight handoff in motion, and the safety contract that makes “work while you sleep” a claim you can check.
If a spec earns it, this is what handoff looks like.
-
spec earnedlifecycle/{slug}/spec.mdall four phases locked. the orchestrator now has a tight enough spec to work without you.
-
/discovery — fan-outlifecycle-research/{topic}/*.mdspawns research branches in parallel — one rail per reference signal.
- → Stardew Valley · feedback-loop ref
- → Sea of Thieves · social-ritual ref
- → Dredge · depth-as-risk ref
- → real-world nightline · sleep-while-you-fish craft
-
backlog · 5 ticketsbacklog/NNN-*.mddiscovery converges into named, refinable tickets.
-
/refine — per ticketclarify · research · spec · plan · critical-revieweach ticket clears its own gates. five tickets → five tight specs.
- → tackle data model
- → cast/set screen
- → overnight resolver
- → dawn reveal anim
- → catch encyclopedia
-
/overnight — parallel railsovernight-state.json · MCP serverorchestrator runs the tickets in parallel.
read_spec → advance_phaseper ticket. branches and PRs created as they pass critical-review. -
/morning-review — convergelifecycle/morning-report.mdmerges PRs · closes lifecycles · drops a report you can skim with coffee.
Inside /overnight · the safety contract.
Show the safety-contract figures
Knows when to stop.
Three independent counters watch the run. zero_progress trips when nothing has advanced in 5 rounds. time trips at 10 hours. failures trips when the same ticket keeps blowing up. Any one of them ends the run cleanly — saves state, writes the report, exits — instead of churning until your wallet or your repo notices.
Climbs when stuck — stops calmly when it can't.
Failed gates don't loop blindly. The first retry runs on the same model; the next escalates to opus; the third hands off to a separate brain agent that decides SKIP, DEFER, or continue.
When even the brain can't decide cleanly, the harness writes ./deferred/<ticket>.md with what it tried and what it needs from you — then carries on with the rest of the queue. Three rungs, a judge, one calm exit.
Stays in its lane.
Each ticket runs in its own git worktree on its own branch. The agent can’t reach main, can’t touch packed-refs, can’t read other repos, and has its tool list pinned ahead of time. The fence is enforced at the seatbelt layer, not asked-for politely — the agent literally cannot do the things outside it.
Schedules around conflicts. Heals what slips through.
Conflicts are mostly prevented before they happen. /overnight reads each ticket's file list and groups tickets into rounds so no two tickets in the same round touch the same file — and dependencies wait for their predecessors to finish. When a conflict still slips through, the harness uses a graded heal: trivial conflicts (whitespace, imports, non-overlapping hunks) take a fast-path stamp; real conflicts get exactly one bounded repair attempt, then defer. No infinite repair loops, no surprise force-pushes.
Survives interruption.
Every phase transition writes overnight-state.json atomically before continuing. Close your laptop mid-run, lose power, kill the process — on restart, interrupt.py reads the last checkpoint, reconciles any half-finished branch, and resumes from exactly where it left off. No double-merges, no orphaned worktrees, no lost work.
Tells you everything it did.
Five JSONL streams record everything during the run: phase transitions, agent spawns, retries, conflicts, and brain triage decisions. At dawn they’re collated into a single morning-report.md — what merged, what was skipped and why, what’s waiting for you. Every decision is auditable; nothing happens off the record.
The deterministic CLI underneath the prose — why it exists, and the one command that installs all of it.
Prose skills wander. The CLI is the toolkit that doesn't.
A Cortex skill is prose — and prose, under fatigue or context drift, paraphrases, skips, coerces "close enough." Every skill shells out to deterministic cortex-* subcommands for the parts that can't. Three guarantees a prose skill alone can never give you.
- cortex-lifecycle-statetier · criticality · phase, from events.log
- cortex-common detect-phaselifecycle dir → current phase, plan progress
- cortex-resolve-backlog-itemid, slug, or title → filename
- cortex-update-itematomic frontmatter write-back
- cortex-backlog-readyreadiness-gate filter
- cortex-load-parent-epicwalk discovery_source frontmatter
- cortex-refine emit-lifecycle-startseed lifecycle_start event
- cortex-lifecycle-counterstally for morning report
- cortex-complexity-escalatoropen-question threshold check
- prepare-dispatchrealpath + SHA-256 in one call
- check-artifact-stableparse + match + atomic log
- check-synth-stablesynth SHA verify + drift log
- record-exclusionmanual sentinel_absence append
- cortex-commit-preflightcommit-message gate
- cortex-git-sync-rebasesync + clean rebase
- cortex-jccjit commit-and-checkout
Five agents must read the same bytes. A prompt can't enforce that.
/critical-review fans out four parallel reviewer angles plus an Opus synthesizer. All five must judge the same bytes.prepare-dispatch, check-artifact-stable, check-synth-stable. Each call fuses validation + mutation in one subprocess — no longer addressable as independent steps.READ_OK sentinel carries a SHA. If the file moved while they were reading — concurrent edit, branch switch, partial save — that SHA won't match the pin from prepare-dispatch. check-artifact-stable notices, atomically appends sentinel_absence to events.log, and excludes the reviewer's findings from the synthesizer's payload. No prose ceremony to forget.
This pattern repeats across the whole bench. Lifecycle state, backlog reads, atomic event appends, gate transitions — every operation that needs to be the same every time lives behind a subprocess. The CLI is how the framework makes "consistent" a property you can prove.
Start with the core. It's complete on its own — add the rest as you want them.
cortex-core
One simple plugin gives you the rails to build a project end to end. You set the direction in /requirements, then /discovery breaks ideas down into small bodies of work. From there, /lifecycle runs each one down the same track, a gated stop at every phase, to a shipped PR.
cortex-backlog
Plain-markdown tickets the cortex-* CLI reads and writes directly — token-cheap and fast, which is why it's the recommended default. The harness is built around it, but a repo can point its config at a different backend like GitHub Issues — just not as fast.
cortex-overnight
Runs through the Claude Code SDK to plan and implement refined tickets in batches while you sleep. Skip it if you only want to work in-session.
-
Install the cortex CLI
One command in your terminal — the bootstrap installs
uvfirst if it's missing.curl -fsSL https://raw.githubusercontent.com/charleshall888/cortex-command/main/install.sh | sh -
Add the marketplace
One command, run inside Claude Code.
plugin marketplace add charleshall888/cortex-command -
Install the plugins you want
Run
/plugin(or/plugins) and pick — or just paste:plugin install cortex-core@cortex-commandplugin install cortex-backlog@cortex-commandplugin install cortex-overnight@cortex-command
That's it. The skills are live in your session.
-
Set up each reporecommended
In each repo you work in, run
cortex init— it scaffolds thecortex/workspace and registers the sandbox path so the core skills (lifecycle, refine, backlog) and overnight all run cleanly, then tune per-repo preferences incortex/lifecycle.config.md.cortex init