caslatch-mcp
by slchy
README.md
# caslatch
Lightweight optimistic-lock TDD gate & heterogeneous multi-agent audit **CLI + stdio MCP server**.
**Zero third-party runtime dependencies** (pure Node.js >= 22 ESM). Designed for coordinator-led multi-agent development with one projection direction: **Slice Spec → Tests → Implementation**.
## Core Ideas
1. **Optimistic Lock (CAS)**: Concurrent worker agents write to disjoint file whitelists directly in the workspace (no heavy worktrees, no intermediate lock commits). At merge points, `caslatch check` deterministically verifies spec/test locks and write boundaries.
2. **Mechanical Double Locks + 1+1 Spot-Check**: Spec and accepted test files are SHA-256 locked in `.dsh/lock.json`. When `caslatch check` passes, it automatically selects **1 random changed file** (`RANDOM_SPOT_CHECK`) so the coordinator always reviews **1 random + 1 highest-risk** diff (never zero diff, never full-diff token bloat).
3. **Heterogeneous First-Class Audit**: `caslatch audit` / `caslatch_audit` is a one-shot action enforcing three independence invariants:
- **Model-ID mutual exclusion** (`auditor_model !== author_model`, e.g. `grok-4.7-xhigh-fast` auditing `deepseek-flash`);
- **Mutually invisible auditors** (isolated short-lived sessions & distinct report files);
- **Read-only + workspace snapshot comparison** (any side-effect write marks `SNAPSHOT: DIRTY` and blocks).
- Returns `AUDIT: PASS | BLOCK | UNAVAILABLE`. If `AUDIT: UNAVAILABLE` (unconfigured, quota/auth/network error, or spawn failure), the coordinator decides whether to review directly, dispatch read-only `dsh`, or use another auditor.
4. **Dual Interface (CLI + MCP)**:
- **MCP (`caslatch-mcp`)**: 5 compact tools (`caslatch_lock`, `caslatch_check`, `caslatch_snap`, `caslatch_gate`, `caslatch_audit`) for the coordinator—mount globally once and use across every repo.
- **CLI (`caslatch`)**: Direct terminal/CI invocation and per-repo `agents/gate.mjs` shim.
## CLI Usage
```bash
caslatch lock spec agents/specs/my-slice.md
caslatch lock test tests/my-slice.test.ts
caslatch check --allow src/module-a.ts src/module-b.ts
caslatch run typecheck -- npm run typecheck
caslatch gate
caslatch snap
caslatch audit --stage gate2 --author-model deepseek-flash --model grok-4.7-xhigh-fast --spec agents/specs/my-slice.md
```
## MCP Configuration Example
Register `caslatch-mcp` once in your host's `mcp_config.json`:
```json
{
"mcpServers": {
"caslatch": {
"command": "node",
"args": ["C:/caslatch/bin/caslatch-mcp.mjs"]
}
}
}
```
## Consuming in Any Repository
Keep each consuming repo minimal with `agents/`:
- `agents/caslatch.json` — project gate commands & default author/auditor models
- `agents/gate.mjs` — tiny shim pulling `https://github.com/slchy/caslatch.git` into gitignored `agents/.upstream/`
- Add `.dsh/` and `agents/.upstream/` to `.gitignore`
See [docs/WORKFLOW.md](docs/WORKFLOW.md) (Chinese) or [docs/WORKFLOW.en.md](docs/WORKFLOW.en.md) (English) for the complete governance specification.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues