cortex-command · landing.spec.md R3 · live document · MIT · v2.0.0

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.

01

/discovery fires it off

One prompt. Discovery clarifies ambiguities, reviews adversarially, and spawns one ticket per scoped piece of work.

02

/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.

03

Earn the spec, pick the harness.

specs/ · 4 ready
nightline-loopLR3
dawn-revealMR2
tackle-progressionXLR5
weather-tablesSR1
option a · overnight harness
ships by morning, while you sleep
/overnight batches it. A scheduled overnight process runs on the CLI and orchestrates the full pipeline — with safeguards and error handling — then /morning-review hands you a full summary of what was done.
option b · guided lifecycle
ships with you, in-session
One ticket at a time, planned and shipped with you in the terminal. Optionally runs in an isolated worktree so your working tree stays clean.
§02 · lifecycle playground

The same lifecycle, three different gate sequences.

Frontmatter declares complexity and criticality. Those two values decide which gates fire. Drag the slider — a ghost-train runs the new sequence so you can see exactly which phases the framework runs.

simple complex critical
small change, low blast radius. skip the review gate; ship in one pass.
§03 · /refine writes the spec · scrolls to lock 4 gates · 0 of 4 cleared
§ 01
3/3 scope agreed
R3
phase complete

Clarify phase 01the lifecycle's first phase

status: drafting → locked · acceptance: scope agreed
[ pending — scroll to capture from interview ]
What does it feel like to set a nightline well? Player loop: choose tackle → cast at dusk → set depth → leave the line → return at dawn. Fish simulated overnight. Catch determined by depth, bait, weather, patience. Scope-in: a satisfying choice + a morning the night actually paid for.
§ 02
3/3 refs cited
R3
phase complete

Research phase 02

status: collecting → locked · 4 sources cited
[ pending — research bullets resolve here ]
  • 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.
§ 03
3/3 OUTCOME NAMED
R3
phase complete

Specify phase 03

status: resolving → locked · acceptance criteria pinned
[ pending — system + edge cases resolve here ]
Tackle: 3 rod tiers, 6 lure types, 4 bait types. Depth: 1–5 fathoms. Weather modifies catch table per fathom. Overnight simulation: discrete tick at midnight resolves bites against a Markov model parameterized by depth/bait/weather. Morning UI: animated reveal of the line being pulled. Edge cases: empty, snagged, legendary.
§ 04
3/3 risks named
R3
phase complete

Plan phase 04/critical-review available before approval

status: drafting → locked · 5 tasks · 1 named risk
[ pending — implementation order resolves here ]
Implementation: (a) tackle data model + UI, (b) cast/set screen, (c) overnight resolver, (d) dawn reveal animation, (e) catch encyclopedia. Acceptance: a player who sets a line and sleeps wakes to a result that feels earned. Risk: the resolver carries the loop. Mock it badly and the loop collapses.
§04 · the overnight payoff · scroll to scrub

If a spec earns it, this is what handoff looks like.

spawns 4 research branches in parallel — one rail per reference signal
each ticket runs in its own claude window · clears spec → research → critical-review before a plan is approved
merges PRs · closes lifecycles · drops a morning-report.md you can skim with coffee
  1. spec earned
    lifecycle/{slug}/spec.md
    all four phases locked. the orchestrator now has a tight enough spec to work without you.
  2. /discovery — fan-out
    lifecycle-research/{topic}/*.md
    spawns 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
  3. backlog · 5 tickets
    backlog/NNN-*.md
    discovery converges into named, refinable tickets.
  4. /refine — per ticket
    clarify · research · spec · plan · critical-review
    each ticket clears its own gates. five tickets → five tight specs.
    • → tackle data model
    • → cast/set screen
    • → overnight resolver
    • → dawn reveal anim
    • → catch encyclopedia
  5. /overnight — parallel rails
    overnight-state.json · MCP server
    orchestrator runs the tickets in parallel. read_spec → advance_phase per ticket. branches and PRs created as they pass critical-review.
  6. /morning-review — converge
    lifecycle/morning-report.md
    merges PRs · closes lifecycles · drops a report you can skim with coffee.
draw
discovery refine night dawn
§05 · /overnight · operational guarantees

Inside /overnight · the safety contract.

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.

three circuit breakers · zero-progress · time · watchdog

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.

retry → escalate → triage → calm pause

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.

sandboxed by design · seatbelt-enforced

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.

round scheduler · graded heal

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.

atomic state · resumes cleanly

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.

five logs · one morning-report
§06 · what installs · 2 plugins · CLI + MCP auto-bundle

Start with the skills. Add overnight when you want autonomy.

01 required · start here

cortex-core

The interactive lifecycle — /discovery, /refine, /critical-review, /lifecycle — installed as a Claude Code plugin. Start here. Run /lifecycle on a real ticket to feel the gates with you in the loop.

install: /plugin install cortex-core@cortex-command

02 optional · auto-bundles cli + mcp

cortex-overnight

The autonomous half. Installing this plugin auto-bundles the cortex CLI (cortex overnight / cortex morning-review) and an MCP server (read_spec, advance_phase, list_lifecycles) so any MCP-speaking agent can read Cortex state. Skip it if you only want gated lifecycles in-session.

install: /plugin install cortex-overnight@cortex-command

first run: cortex init — registers Cortex's umbrella path with Claude Code's sandbox.

plugins keep the CLI and MCP server in sync — no separate install loop

full setup walkthrough → github.com/charleshall888/cortex-command ↗ MIT · v2.0.0 · plain markdown state · readable commands
Achievement
Spec Earned
all four phases locked · ready for handoff
Achievement
First Light
overnight run completed before you woke up