Skip to content

thehumanworks/cortex

Repository files navigation

cortex

A cross-platform, daemon-backed, agent-aware session multiplexer with a Cloudflare-native messaging fabric and git-worktree parallelism — split into a headless core and a separate presentation tier.

In one sentence: cortex is to a fleet of AI coding agents what tmux is to terminals, plus the cloud plumbing to reach and recover them from anywhere.

Install

cortex ships as a native binary wrapped in a tiny Node launcher, so you can run it with the JavaScript package runners you already have. macOS and Linux, Apple Silicon and x86-64, are supported.

Run the published CLI from npm without installing anything globally:

npx -y @nothumanwork/cortex --help

Or run straight from this GitHub repository with Bun:

bunx github:thehumanworks/cortex --help

Install it globally to put cortex on your PATH:

npm install -g @nothumanwork/cortex
cortex daemon start

How it resolves the binary, in order: a prebuilt per-platform package pulled in as an optional dependency (the fast npm path, no toolchain needed); a cached download from this repo's GitHub Releases; or, when you run from a source checkout (as bunx github: does) with no release yet, a one-time cargo build. Set CORTEX_DEBUG=1 to see which path was used. See docs/usage.md for the CLI itself and RELEASING.md for how releases and npm publishing work.

What problem it solves

People increasingly run AI coding agents in a leader → runner shape: one "orchestrator" agent (or a human) steers a set of "runner" agents, monitoring them, correcting them, and enforcing good practice. Today that is hand-rolled on top of tmux, which is noisy to drive programmatically, scrapes pixels instead of reading structured output, has no notion of roles, no cross-machine story, and no mobile reach.

cortex makes that pattern first-class:

  • A pane is any process (shell, server, agent — not prescribed).
  • Panes are grouped by workspace, and a pane can be marked orchestrator or runner. The orchestrator gets a cheap, structured roster and live state of everything it manages.
  • For panes that are recognised AI harnesses (Claude Code, OpenAI Codex, Pi, official Grok Build), cortex reads their output token-efficiently from the agent's own structured event stream rather than scraping the terminal.
  • A runner can be turned into a git worktree so work parallelises on isolated branches.
  • Every node and client meets at a Cloudflare control plane, so after one identity login everything is reachable from macOS, Linux, Windows, and iPhone/iPad — no per-device pairing, no inbound ports ("the Tailscale feel").
  • It is decoupled from presentation: the core is runnable from anywhere like tmux; a terminal app and a mobile app are clients of the same protocol.

Status

Early build (MVP-1). The headless core exists: a cortexd daemon and a cortex CLI that drives it over a local Unix socket (workspaces, panes in PTYs, roles, send/read). It installs and runs across macOS and Linux via npx/bunx as shown above. The Cloudflare control plane, harness adapters, and client apps described below are still ahead on the roadmap. The design docs remain the source of truth for where this is going.

Read the docs in this order

  1. docs/glossary.md — the vocabulary (node, pane, workspace, role, harness, adapter, hub, inbox, manifest).
  2. docs/architecture.md — the layered system (L0–L7), the topology, the central inversion, durability, and how every requirement maps to a home.
  3. docs/invariants.md — the load-bearing constraints that must not be violated.
  4. docs/decisions.md — the decision log (ADRs) with context and rationale for each major choice.
  5. docs/trust-and-security.md — the five-layer, monotonic trust model.
  6. docs/harness-support.md — the four target harnesses and the adapter contract.
  7. docs/messaging-and-fabric.md — per-pane inboxes, shared blobs, and shared state.
  8. docs/prior-art.md — what already exists and what we reuse from whom.
  9. docs/roadmap.md — the phased build plan (v0 → v3).

The one idea to remember

Make every daemon node and every client dial in to a per-workspace Cloudflare Durable Object. That single inversion gives nodes the no-inbound-port, NAT-proof property, keeps the Durable Object hibernation-eligible and cheap, and delivers the identity-based "everything reachable, no pairing" experience — all on the Cloudflare stack, without WireGuard or Tailscale. See ADR-0005.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors