The Problem
AI coding agents like Claude Code are stateless. Each session starts with no memory of prior decisions, no shared task list, and no enforced rules, so teams of agents working on one codebase duplicate work, overwrite each other's changes, and lose context between sessions. CAS addresses this with a persistent context layer (SQLite-backed memory, tasks, rules, skills) and a factory mode that runs multiple agents in parallel on isolated git worktrees.
What This Does
CAS is a Rust CLI (cas-cli/) that provides two integrated capabilities. The Factory is a terminal UI (cas-cli/src/cli/interactive.rs) that spawns a supervisor agent and N worker agents, each in its own git worktree, coordinating via a shared SQLite database. The Context System is an MCP server (cas-cli/src/mcp/daemon.rs) exposing persistent memory, task tracking, and rules to any MCP-compatible client.
The repository also vendors a full VT terminal parser (based on Ghostty) and a hybrid search index (BM25 + embeddings) for code retrieval, with the core logic in crates/cas-core/ and crates/cas-diffs/.
How It Is Wired
Execution starts at main in cas-cli/src/main.rs:11, which initializes logging and dispatches to subcommands. The heavy path is execute in cas-cli/src/cli/auth.rs:54, which reaches 403 functions and handles auth, then run in cas-cli/src/mcp/daemon.rs:256 (reaches 381 functions) which starts the MCP server.
The shortest path from entry to external effect is main -> init -> create_log_file (filesystem). Most work flows through cas-cli/src/store/layered.rs (47 functions, 27 callers) which owns the SQLite store hierarchy, and cas-cli/src/hybrid_search/cache.rs (24 functions, 45 callers) which caches search results. The internal call graph shows is_empty is called from 270 places—the widest blast radius—so changing its signature breaks a quarter of the codebase.
The module graph has no circular dependencies, but the daemon module (cas-cli/src/mcp/daemon.rs) is the hub: 381 functions reachable from run. Changing anything in the daemon's event loop risks breaking the entire MCP surface.
How To Use It
Setup: Build with cargo build --release in the repo root (Cargo workspace). The cas-cli/Makefile provides targets for dev workflows.
Configuration: Environment variables for Anthropic API keys go in .env (loaded by load_env_file). Agent rules and skills live in .claude/ as Markdown files; the CLI seeds built-in agents from cas-cli/src/builtins/agents/.
Running:
# Launch the factory TUI with 3 workers
cas -w 3
# Start the MCP server for context persistence
cas mcp serve
Real-World Use
For a large feature spanning multiple files: a supervisor agent in the factory breaks the epic into tasks, assigns them to 3 workers each in their own worktree, and merges results. The context system persists decisions ("we use tokio for async") so any future session—even a new agent—reads them before starting work, preventing re-litigation of settled choices.
Code Health & Issues
Static analysis found 9 issues (2 high, 6 medium, 1 low), all in CI/CD and vendored code:
- High - Unpinned GitHub Actions (
dtolnay/rust-toolchain@stable,mozilla-actions/sccache-action@v0.0.5) - tag-movable actions run with your token. Fix: pin to commit SHAs. - High -
git pushto default branch inrelease.yml- no test runs on the pushed result. Fix: push to a bot branch and open a PR. - Medium - No
permissionsdeclaration inci.yml- token inherits repo defaults. Fix:permissions: contents: read. - Medium - No Dependabot/Renovate configured despite 17 manifests. Fix: add
.github/dependabot.yml. - Medium - Unpinned Docker base image (
debian:${DISTRO_VERSION}). Fix: pin by digest. - Medium - No dependency vulnerability scan in CI. Fix: add
dependency-review-action. - Medium - Two blobs over 5MB in
vendor/ghostty/(12MB and 9.4MB). Fix: use Git LFS. - Medium -
persist-credentials: falsenot set on checkout. Fix: add to checkout step. - Low - No
timeout-minuteson CI jobs. Fix: add realistic bounds.
The repo has tests (373 files), CI, license, and lockfile. The 60 deep-nesting warnings and 502 cognitive-load findings are concentrated in cas-cli/benches/code_indexing.rs and cas-cli/src/bridge/server/sse.rs—worth refactoring if you touch those files.
The Bottom Line
CAS is a serious, well-structured Rust codebase (888 Rust files, 373 test files) that solves a real problem: persistent context and parallel agent execution. The vendored Ghostty code and 2,500+ total files make it heavy, and the CI/CD hygiene needs tightening before production use. Teams already invested in Claude Code and wanting multi-agent coordination will find it valuable; others may find the setup cost high relative to the benefit.