coordination // cortex

Mesh-control CLI for multi-project agent dispatch.

Cortex is the connective tissue between the custody layer (blackwall), the memory layer (reverie), and the ticket layer (Linear). A single CLI that binds a custody run to a Linear ticket at dispatch time, persists the session's memory to reverie as observations, and syncs settle-state back to the originating ticket — so every agent run is traceable, recoverable, and accountable without a human holding the join table.

What it does

Ticket binding

Every dispatch is bound to a Linear ticket at admit time. The ticket ID rides the custody chain end-to-end — through the DAG node, the edge worker, and the resulting artifact — so a run's provenance points back to the originating issue. Status transitions on settle are written back to the ticket, closing the loop between intent (the ticket) and outcome (the run).

Multi-project dispatch

Operates across multiple cerebral-work repositories from one mesh. Project manifests declare per-repo agent roles, worktree layout, and custody roots; cortex fans a dispatch out to the right project, the right role, and the right worktree without the operator stitching together per-repo CLIs. One coordinator, many repos, one command surface.

Reverie integration

Talks to reverie over its MCP server to read pre-dispatch context and write post-dispatch observations. A session loads the directives, prior decisions, and conventions relevant to its ticket before the agent runs; on settle, the session's key learnings are captured as structured observations keyed to the same ticket — so the next run on a related ticket starts with what the last one learned.

Linear sync

Bidirectional sync against the Linear API. On dispatch the bound ticket moves to In Progress with the run's custody chain attached; on settle it transitions to Done (or Backlog on failure) with the resulting commit SHA and reverie observation IDs recorded as a shipping comment. Sync is rate-limit aware and idempotent — a retried settle never double-posts.

Architecture

Surface Role
CLI The cortex binary. One-shot installs to ~/.local/bin. Owns project manifests, dispatch invocation, dash, gate, and settle-state observation. The single operator surface over the whole mesh.
Linear API The ticket layer. cortex reads ticket state at dispatch, writes status transitions and shipping comments on settle, and resolves blockedBy / relatedTo wiring across spec-driven ticket batches. Rate-limit aware, idempotent.
reverie MCP The memory layer. cortex calls reverie's MCP server to load pre-dispatch context (directives, prior decisions, project conventions) and to write post-dispatch observations keyed to the bound ticket — keeping memory and provenance on the same join key.
blackwall REST The custody layer. cortex submits custody runs to blackwall's REST surface as one-shot jobs, polls settle-state, and reads back the resulting artifact SHA and provenance chain that Linear-sync then writes onto the ticket.

Status

alpha

Cortex is in alpha. Ticket binding, multi-project dispatch, and the blackwall REST → Linear sync loop are wired and dispatching real custody runs today; the reverie MCP write path and the full admission-control gate surface are stabilizing. The CLI surface, project-manifest schema, and settle-state comment format will move before the v1 contract locks. Bundled with the cerebral-work mesh — track release notes on github.com/cerebral-work.