System Architecture โ
Quick Reference
- Pattern: Modular Monolith (CLI + REST API in single process)
- Runtime: Node.js with TypeScript
- Storage: File-based JSON (zero external DB)
- API: Express REST API (dashboard)
- CLI: Commander.js
High-Level Architecture โ
Developers interact via CLI or Dashboard. AI agents read skills directly from filesystem and interact with the REST API. All data persists to JSON files.
Component Overview โ
CLI (src/index.ts) โ
The primary interface for developers. Built with Commander.js, it provides commands for:
- Task management โ add, list, move, done, dispatch
- Project management โ add, list, remove
- Deploy tracking โ staging, production, rollback
- Working memory โ init, status, reset, learnings
- Skill chain โ list, start, advance, auto
- Judge โ evaluate task health, suggest agents
Dashboard Server (src/dashboard.ts) โ
Express.js REST API that powers the browser-based Kanban dashboard.
- SPA architecture โ static files served from
public/dashboard/ - Full CRUD for projects, tasks, deployments, changelog
- Real-time features โ transition validation, stuck task detection
- Judge API โ task health evaluation, agent suggestions
- Chain API โ start/advance/abort skill chain executions
Judge Agent (src/judge.ts) โ
Autonomous task health evaluator:
- Detects stuck tasks (no updates for 30+ minutes)
- Evaluates task complexity and suggests priority changes
- Recommends best agents for specific skills
- Maps skills to domains (engineering, operations, product, etc.)
- Suggests valid state transitions
Working Memory (src/continuity.ts) โ
Persistent context system โ inspired by Loki Mode:
- CONTINUITY.md โ current session state, active goal, next actions
- learnings.json โ captured error patterns (persists across sessions)
- decisions.json โ architecture decisions (persists across projects)
- config.yaml โ RARV cycle settings
Skill Chain (src/skill-chain.ts) โ
Multi-skill pipeline engine:
- Predefined chains โ e.g., "feature" chain: planning โ tdd โ execution โ review โ deploy
- Chain execution โ tracks progress through steps
- Auto-matching โ matches task titles to appropriate chains
- Skip/abort โ allows skipping steps or aborting chains
Agent Dispatch (src/agent-dispatch.ts) โ
Dispatches tasks to AI agents with platform-specific adapters:
- Generates dispatch files for each AI platform
- Validates dispatch preconditions (agent assigned, project path exists)
- Supports force re-dispatch for retries
Design Decisions โ
Why File-based JSON Storage? โ
| Decision | Rationale |
|---|---|
| JSON files over database | Zero setup overhead. cm init works immediately. No Docker, no PostgreSQL, no SQLite drivers. |
| Single data file | Atomic read/write. No migration scripts. Easy backup (just copy the file). |
.cm/ directory per project | Keeps working memory alongside code. Version-controllable context. |
Why Modular Monolith? โ
| Decision | Rationale |
|---|---|
| Single process | CLI and dashboard share the same data layer. No IPC overhead. |
| Module separation | Each concern (judge, continuity, chain) is a separate TypeScript module. Easy to test and refactor independently. |
| No microservices | For a developer tool, operational simplicity trumps scalability. One npm install and you're done. |
Why Universal Skills Format? โ
| Decision | Rationale |
|---|---|
| Plain markdown | Every AI agent can read markdown. No proprietary format required. |
| YAML frontmatter | Standard metadata format with name and description fields. |
| Platform adapters | Small adapter files translate the universal format to each platform's conventions (Antigravity, Claude, Cursor, etc.) |
Technology Stack โ
| Layer | Technology | Rationale |
|---|---|---|
| Language | TypeScript 5.9 | Type safety + Node.js ecosystem |
| CLI | Commander.js 14 | Industry standard CLI framework |
| HTTP | Express 5 | Lightweight REST API server |
| Testing | Vitest 4 | Fast, TypeScript-native test runner |
| Build | tsc + ts-node | Simple compilation, no bundler needed |
| Hosting | Cloudflare Pages | Edge deployment for landing page |
| Terminal UX | Chalk 5 | Cross-platform colored terminal output |