Integration

Agents are first-class users

Claude Code, Cursor, Codex, AZMX Code — one protocol serves all of them. Three surfaces, roughly ten minutes of work, no per-platform forks.

1 · MCP — the zero-work integration

Every major agent platform ships an MCP client. Register kal once and it gains twelve tools: status, snap, log, why, ask, context, ops, undo, verify, archive, blame and stats.

# Claude Code
claude mcp add kal -- kal mcp
# Cursor · Codex · others: command "kal", args ["mcp"]
# cloud IDEs and remote agents
kal mcp --http --port 8738
terminal
$ kal mcp   # any MCP client → tools/list
{"jsonrpc":"2.0","id":2,"result":{"tools":[
  {"name":"kal_status"}, {"name":"kal_snap"}, {"name":"kal_why"},
  {"name":"kal_ask"},    {"name":"kal_undo"}, {"name":"kal_verify"},
  {"name":"kal_blame"},  {"name":"kal_stats"}, …]}}
Automatic attribution. Snapshots made through MCP are recorded as AI-authored by the connected client and enter the trust ladder as unverified — no configuration needed.

2 · The attribution contract

For any platform that can set environment variables, this is the integration:

export KAL_AGENT=azmx-code
export KAL_AGENT_MODEL=azmx-coder-v0.3
export KAL_SESSION=sess_8f2a

Every snapshot made under those variables carries structured provenance, which powers per-line blame, per-session undo, trust tiers and model scorecards. The variable names and the commit JSON schema are a stable, versioned interface.

3 · Teach the agent your house rules

kal context --agents-md > AGENTS.md

Generates the briefing that tells any coding agent to snapshot with intents, consult kal why and kal ask before editing, check archived lessons so it doesn't repeat a dead end, and verify its own work — plus a live summary of the repository.

terminal
$ kal context
# Repository context: payments
Branch: main | Generated by kal v0.7.0

## Abandoned approaches (negative knowledge — do not repeat)
- feature (72d109c8e852): server-side rendering doubled p95 latency

## Files
- README.md (24 bytes)
- app.py (71 bytes)

## Recent history (message · intent · author · trust)
- 8cc7226d95ba merge feature
    intent: -
    author: dev[human] · trust: human-authored · files changed: 1
- e2bd12335d35 friendlier greeting
    intent: -
    author: dev[human] · trust: human-authored · files changed: 1
- 72d109c8e852 feature docs
    intent: document the feature
    author: dev[human] · trust: human-authored · files changed: 1
…

Claude Code hooks: micro-checkpoints for free

{ "hooks": { "PostToolUse": [ {
    "matcher": "Edit|Write",
    "hooks": [{ "type": "command", "command": "kal checkpoint || true" }] } ] } }

Every agent edit becomes a rewindable point in the timeline. For platforms you cannot configure, kal watch achieves the same thing from the outside.

Model scorecards from ordinary bookkeeping

Because kal knows which model wrote each snapshot and what happened next — tests passed, human approved, or reverted — it can score models against real work with no eval set to curate.

terminal
$ kal stats
author/model                 kind   snaps verified approved reverted  verify%  revert%
dev                          human      2        1        0        0      50%       0%
claude-opus-5                ai         1        0        0        0       0%       0%

Deploy a new checkpoint behind KAL_AGENT_MODEL=azmx-coder-vN and the comparison against the previous version accumulates on its own.

Choose your model backend

kal config llm.provider azmx        # or: anthropic (default)
kal config llm.azmx.base_url http://models.internal:8000/v1
kal ask --llm "why was the cache layer abandoned?"

The deterministic core never calls a model — snapshots, merges and history are offline and reproducible. Only the opt-in AI features route through the provider interface.

The training flywheel

kal export --training emits intent → diff → outcome records: verified and approved work as positives, reverted work and archived experiments as negatives with human-written reasons. It is consent-gated per repository and secret-scrubbed.

terminal
$ kal export --training
{"author_kind": "human", "diff": "--- a/README.md\n+++ b/README.md\n@@ -0,0 +1 @@\n+# payments\n\n--- a/app.py\n+++ b/app.py\n@@ -0,0 +1,2 @@\n+def hello():\n+    return 'hi'\n", "id": "70b33dfef2896315457243e1be6bbd8c616564d706d643445145e9eebcf886fd", "intent": "starting the payments service", "label": "unlabeled", "message": "scaffold service", "model": null, "outcome": {"approved": false, "reverted": false, "verified_fail": false, "verified_pass": false}, "type": "change"}
{"author_kind": "ai", "diff": "--- a/app.py\n+++ b/app.py\n@@ -1,2 +1,5 @@\n def hello():\n     return 'hi'\n+\n+def retry(n=3):\n+    return n\n", "id": "e8c7405a0044569741196a4022f4516173efbbaaa2cb3fea8882ceb3cc9f6763", "intent": "the IdP rate-limits bursts of logins", "label": "unlabeled", "message": "add retry helper", "model": "claude-opus-5", "outcome": {"approved": false, "reverted": false, "verified_fail": false, "verified_pass": false}, "type": "change"}
{"author_kind": "human", "diff": "--- a/app.py\n+++ b/app.py\n@@ -3,3 +3,4 @@\n \n def retry(n=3):\n     return n\n+# tuned\n", "id": "33223d8c4ba1760bcb28a827362fb8e1b2717427ef424d97b888ba1f52dfd708", "intent": "automatic work-in-progress checkpoint", "label": "positive", "message": "checkpoint", "model": null, "outcome": {"approved": false, "reverted": false, "verified_fail": false, "verified_pass": true}, "type": "change"}
…