# Install dependencies (workspace-aware, must use pnpm)
pnpm install
# Run preflight checks (security + quality gates)
pnpm run preflight
# Run all tests (unit, integration, E2E)
pnpm run test:all
# Start development infrastructure
docker compose up -d
# Start web control plane
pnpm run dev:webThis is a pnpm monorepo with 3 workspaces covering 13 packages + 4 apps + 1 IDE extension:
Phase 1 (High-Priority):
- shared — Shared types, logger, DB pool registry
- auth — JWT execution tokens, session revocation, RBAC, InsForge integration
- policy — Policy evaluation (role-mapping, permissions)
- governance — 9 governance gates + risk scoring + adaptive consensus
- orchestrator — Run state machine and step sequencing
Phase 2 (Tier A - Optional):
- audit — SHA-256 hash-chain audit logger (dual-emit to InsForge)
- agents — Agent profiles and definitions (used by governance consensus)
- realtime — WebSocket event bus for real-time updates
- observability — Prometheus metrics and traces
- learning — Outcome-driven learning loop + policy evolution
- healing — Self-healing strategies and rollback coordination
- skill-engine — Skill routing, registration, and execution
- prompt-system — Dynamic prompt compilation and versioning
Tier B (Orchestration):
- core — Foundational utilities, type helpers, shared constants
- adapters — Pluggable adapter system for platform integration
- cku — CLI framework and command definitions
- storage — Artifact and log storage abstraction (local, InsForge, combined)
- control-service — Express.js orchestration hub (port 7474), governs all execution
- cli — Command-line interface wrapper using control-service API
- web-control-plane — React operator control plane UI for governance
- web-landing — Next.js landing page with docs and examples
- code-kit-vscode — VS Code integration with sidebar views and approvals
docker compose up -dStarts PostgreSQL (5432), Redis (6379), control-service in containers.
# PostgreSQL 16 (macOS)
brew install postgresql@16 && brew services start postgresql@16
# PostgreSQL 16 (Ubuntu)
sudo apt-get install postgresql-16 && sudo systemctl start postgresql
# Redis 7 (macOS)
brew install redis && brew services start redis
# Redis 7 (Ubuntu)
sudo apt-get install redis-server && sudo systemctl start redis-serverNote: Windows users should use Docker or WSL2 for development. Native Windows PostgreSQL/Redis setup is not tested.
Comprehensive guides for system design, policy configuration, testing, and automation:
Core Architecture & Design:
- System Architecture — System layers, request/execution flows, package dependency graph
- Config Schema — policy.json reference, mode-specific overrides, role definitions
Testing & Quality:
- Testing Guide — Consolidated test commands, patterns, and fixtures
- Security Runbooks — Credential rotation, incident response, audit verification
Phase 3 Automation:
- Phase 3 Workflow Design — Auto-approval chains, alert acknowledgment, test verification, healing, rollback workflows
| Command | Purpose |
|---|---|
pnpm run preflight |
Type checking + auth tests (critical path validation) |
pnpm run test:auth |
Auth module tests |
pnpm run test:governance |
Governance gates tests |
pnpm run test:unit |
All unit tests |
pnpm run test:integration |
Control-service integration tests |
pnpm run test:coverage |
Coverage report (target 80%+) |
pnpm run test:smoke |
Smoke tests only (fastest feedback) |
pnpm run typecheck |
TypeScript type checking across all workspaces |
CKU enforces 9 governance gates on every execution:
- Security — Auth token validation, RBAC
- Quality — Test coverage, linting
- Operations — Audit readiness, risk scoring
- Plan Approval — Execution plan review 5-9. Context Gates — Tenant scope, approval consensus, etc.
Gates are mode-aware (dev, staging, prod) via config/policy.json.
Required (see .env.example):
ANTIGRAVITY_API_KEY,ANTIGRAVITY_BASE_URL— Identity providerCURSOR_API_KEY,CURSOR_BASE_URL— Cursor integrationWINDSURF_API_KEY,WINDSURF_BASE_URL— Windsurf integrationCODEKIT_PROFILE— Execution mode (default:local-safe)CODEKIT_TIMEOUT_MS,CODEKIT_MAX_RETRIES— Execution timeouts
- workflows/ — New workflow system under development
- policy/permissions.ts, role-mapping.ts — RBAC updates
- middleware/authenticate.ts — Session handling improvements
- vitest.integration.config.ts — Integration test runner (not in root config)
Run integration tests separately:
pnpm exec vitest run --config apps/control-service/vitest.integration.config.ts- Execution Tokens — All API calls require signed JWT tokens from
packages/auth - Policy Evaluation —
config/policy.jsondrives gate decisions; changes require service restart - Audit Trail — Every execution step is logged to SHA-256 chain + InsForge
- Immutable Patterns — State updates use spread operators (never mutate)
- Integration Tests — Use separate Vitest config; connect to real PostgreSQL
- Dependency Management — Always use
pnpm runfor scripts; never runpnpm installin individual packages (workspace-aware) - Type Checking — Run
pnpm run typecheckbefore commits to catch type errors across workspaces - Docker on Windows — WSL2 backend required; native Windows Docker Desktop works but volume mounts use forward slashes (
/)