Sandbox

Multi-agent factory and MCP server for Claude Code

CAS is a Rust-based workflow system for Claude Code that runs a supervisor plus multiple workers in isolated git worktrees. It also exposes an MCP server so agents can keep memory, tasks, rules, skills, and searchable context in SQLite between sessions.

161 stars16 forksRustUpdated 6mo ago
Who it's for

Builders who want their Claude Code agents to coordinate parallel work, share context, and avoid repeated setup.

What it delivers

You can split work across multiple agent sessions, keep shared memory between them, and review progress from one place.

What it does

Supervisor and worker factory

Runs one supervisor agent that plans work and multiple worker agents that execute tasks in parallel.

Worktree isolation

Gives each worker its own git worktree and branch so parallel edits do not collide.

Persistent context via MCP

Lets agents remember facts, tasks, rules, and skills across sessions through an MCP server.

Searchable local storage

Stores project context in SQLite with full-text search for past notes and decisions.

Session management

Supports attach, detach, list, and kill for running factory sessions.

Terminal session recording

Can record and replay agent terminal sessions.

How to get it

  1. 1Run
    # Install
    curl -fsSL https://cas.dev/install.sh | sh
    
    # Initialize in your project
    cas init
    
    # Launch the factory TUI
    cas
  2. 2Run
    curl -fsSL https://cas.dev/install.sh | sh
  3. 3Run
    brew tap codingagentsystem/cas
    brew install cas
  4. 4Run
    git clone https://github.com/codingagentsystem/cas.git
    cd cas
    cargo build --release
    # Binary at target/release/cas

README

  ██████╗ █████╗ ███████╗
 ██╔════╝██╔══██╗██╔════╝
 ██║     ███████║███████╗
 ██║     ██╔══██║╚════██║
 ╚██████╗██║  ██║███████║
  ╚═════╝╚═╝  ╚═╝╚══════╝

Multi-agent coding factory with persistent memory.

License: MIT CI Latest Release

Factory · Context System · Quick Start · Installation · Architecture · Contributing

CAS Factory TUI

What is CAS?

CAS is a multi-agent coding factory and persistent context system for AI agents. It has two core capabilities:

  1. Factory — A terminal UI that orchestrates multiple Claude Code instances working in parallel on the same codebase, with a supervisor agent coordinating worker agents across isolated git worktrees.

  2. Context System — An MCP server that gives agents persistent memory, task tracking, rules, and skills across sessions, backed by SQLite and full-text search.

Factory

Factory mode turns your terminal into a multi-agent coding operation. A supervisor agent breaks work into tasks while worker agents execute them in parallel — each in its own git worktree to avoid conflicts.

# Launch the factory TUI
cas

# Launch with 3 workers in isolated worktrees
cas -w 3

How it works

┌─────────────────────────────────────────────────────────┐
│  CAS Factory                                            │
├──────────────────────┬──────────────────────────────────┤
│                      │                                  │
│  Supervisor          │  Worker 1        Worker 2        │
│                      │                                  │
│  Plans EPICs,        │  Executes tasks  Executes tasks  │
│  breaks down work,   │  in isolated     in isolated     │
│  assigns tasks,      │  git worktree    git worktree    │
│  reviews & merges    │                                  │
│                      │                                  │
├──────────────────────┴──────────────────────────────────┤
│  Shared: CAS database (memories, tasks, rules, skills)  │
└─────────────────────────────────────────────────────────┘
  • Supervisor plans work, creates tasks, assigns them to workers, reviews completed work, and merges branches
  • Workers each get their own git worktree and branch — no merge conflicts during parallel execution
  • Shared context — all agents read/write the same CAS database for memories, tasks, rules, and coordination messages
  • Built-in terminal multiplexer — side-by-side or tabbed views of all agent sessions, with a custom VT parser (based on Ghostty)

Factory features

FeatureDescription
Worktree isolationEach worker gets its own git worktree and branch — parallel edits without conflicts
Task coordinationSupervisor assigns tasks with dependencies; workers claim, execute, and report back
Live TUISide-by-side or tabbed terminal views of all agents, with real-time status bar
Message passingPush-based communication between supervisor and workers via prompt queue
Session managementAttach, detach, list, and kill factory sessions (cas attach, cas list, cas kill)
Desktop notificationsOptional alerts when tasks complete or workers hit blockers (--notify)
Session recordingRecord terminal sessions for playback (--record)

When to use Factory

  • Large features — break an epic into subtasks and parallelize across workers
  • Codebase-wide refactors — workers modify different files simultaneously without conflicts
  • Multi-step workflows — tasks with dependencies execute in the right order
  • Code review — supervisor reviews worker output before merging to the main branch

Context System

CAS runs as an MCP server that gives your agent persistent context across sessions — 50+ tools for memory, tasks, rules, skills, and search.

MCP Tools

When your agent has CAS configured, it can:

# Remember something across sessions
mcp__cas__memory action=remember content="This project uses Zod for validation"

# Create and track tasks
mcp__cas__task action=create title="Implement auth" priority=1

# Search past context
mcp__cas__search action=search query="error handling patterns"

# Create a rule that auto-syncs to .claude/rules/
mcp__cas__rule action=create content="Always validate input at API boundaries"

What persists

FeatureDescription
MemoryLearnings, preferences, and observations that survive across sessions
TasksWork items with dependencies, priorities, and structured progress notes
RulesCoding conventions that earn trust through use and auto-sync to your editor
SkillsReusable agent capabilities with templates and usage tracking
SearchFast full-text search (BM25) across all stored context

Quick Start

# Install
curl -fsSL https://cas.dev/install.sh | sh

# Initialize in your project
cas init

# Launch the factory TUI
cas

Installation

curl (recommended)

curl -fsSL https://cas.dev/install.sh | sh

Homebrew

brew tap codingagentsystem/cas
brew install cas

Build from source

git clone https://github.com/codingagentsystem/cas.git
cd cas
cargo build --release
# Binary at target/release/cas

CLI

cas                   # Launch the factory TUI
cas -w 3              # Launch with 3 workers
cas serve             # Start MCP server for Claude Code
cas init              # Initialize CAS in your project
cas attach            # Attach to a running factory session
cas list              # List running factory sessions
cas kill              # Kill a factory session
cas config list       # View all configuration options
cas doctor            # Run diagnostics
cas update            # Self-update to latest version
cas login             # Log in to CAS Cloud (optional)
cas cloud sync        # Sync data to/from cloud (optional)

Claude Code Integration

Add to your Claude Code MCP config (.claude/settings.json or project .mcp.json):

{
  "mcpServers": {
    "cas": {
      "command": "cas",
      "args": ["serve"]
    }
  }
}

Architecture

Data storage

CAS stores all data locally in your project:

.cas/
├── cas.db          # SQLite — memories, tasks, rules, skills
├── config.yaml     # Project configuration
└── indexes/
    └── tantivy/    # Full-text search index

Storage tiers:

  • Project (.cas/) — project-specific context
  • Global (~/.config/cas/) — cross-project preferences and learnings

Workspace Crates

CratePurpose
cas-cliCLI binary, MCP server, and factory TUI
cas-factoryMulti-agent session lifecycle and coordination
cas-factory-protocolMessage protocol between supervisor and workers
cas-ptyPTY management for agent terminal sessions
cas-muxTerminal multiplexer layout and rendering
cas-coreCore logic, hooks, and integrations
cas-storeSQLite storage layer
cas-searchFull-text search (BM25 via Tantivy)
cas-mcpMCP protocol handlers
cas-typesShared data types
cas-codeCode analysis (tree-sitter)
cas-diffsDiff tracking and formatting
cas-recordingTerminal session recording and playback
ghostty_vtVirtual terminal parser (based on Ghostty)

Built With

  • Rust for performance and reliability
  • SQLite for local-first storage
  • Tantivy for full-text search (BM25)
  • Ratatui for the factory TUI
  • Ghostty VT for terminal emulation
  • rmcp for MCP protocol support

Configuration

CAS is configured via .cas/config.yaml in your project root. Run cas config list to see all options or cas config describe <key> for details on any setting.

Cloud Sync (optional)

CAS works fully offline. Optionally sync your context across devices:

cas login
cas cloud sync

Cloud sync is not required — all core features work locally with SQLite.

Contributing

CAS is source-available under the MIT license. We welcome bug reports and feature suggestions through Issues and Discussions.

See CONTRIBUTING.md for details.

License

MIT

Files in the repo

Repository payload18 top-level entries
  • .cargo
  • .claude
  • .github
  • cas-cli
  • crates
  • homebrew
  • scripts
  • vendor
  • .gitignore
  • .mcp.json
  • Cargo.lock
  • Cargo.toml
  • casdemo.png
  • CHANGELOG.md
  • CLAUDE.md
  • CONTRIBUTING.md
  • LICENSE
  • README.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More harnesses

affaan-m/
ECC
affaan-m/ECCHarnesses

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

258k
ruvnet/rufloHarnesses

🌊 The original agent meta-harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

72k

Practical patterns, starters & CLI tools for loop engineering with AI coding agents. Design systems that prompt and orchestrate agents (inspired by Addy Osmani and Boris Cherny). Includes loop-audit, loop-init, loop-cost.

11k