Skip to main content

Behavioral governance for AI agents. Corrections become structural improvements to the agent's environment, enforced over MCP.

Reason this release was yanked:

tombstone

Project description

Calx

Your AI agent keeps making the same mistakes. Calx captures corrections, detects recurrence, and compiles them into enforceable mechanisms that actually change behavior.

pip install getcalx

Quickstart

calx init

That's it. calx init scaffolds .calx/, registers an MCP server in .claude/settings.json, and installs session hooks. Claude Code starts the server automatically via stdio. Corrections, rules, and briefings flow over MCP backed by local SQLite.

# Log a correction (your agent can do this too via the MCP log_correction tool)
calx correct "don't mock the database in integration tests"
# -> Logged C014. Matches C007: "don't mock the database." (3rd occurrence)

# Compile recurring corrections into enforceable mechanisms
calx distill
# -> Promoted to tests-R003. Available in every future briefing.

Not using Claude Code? Run calx serve and point your MCP client at it:

calx serve                          # streamable-http on 127.0.0.1:4195
calx serve --transport stdio        # for Claude Desktop, Cursor, etc.

Requires Python 3.10+. Works with anything MCP-compatible. Built on FastMCP.

How it works

Capture -> Recurrence -> Compilation -> Environmental Modification

  1. Capture. You correct your agent. Calx logs it to an append-only event log. Three capture layers ensure nothing is lost: explicit command, session-end prompt, and dirty-exit recovery. The agent can also capture corrections via calx correct or the MCP log_correction tool.

  2. Recurrence. Calx matches new corrections against existing ones using keyword similarity. When the same correction recurs 3+ times, it surfaces once at a task boundary. Never mid-flow.

  3. Compilation. Recurring corrections are diagnostic signals, not rules to memorize. Compilation means identifying what needs to change in the agent's environment so the error class is eliminated, not just documented.

  4. Environmental modification. Compiled mechanisms modify how the agent operates: hooks that enforce behavior before code is written, rules scoped to the directories where they apply, token discipline that protects the learning loop. The agent's environment changes structurally. Text rules become documentation; hooks become enforcement.

Each pass through this loop tightens the correction surface. Without intervention, correction rates stay flat. With Calx, they drop as mechanisms compound.

Why corrections are pair-specific

Corrections form between a specific person and a specific agent. We transferred 237 rules to a new agent. It made 44 new mistakes, 13 in categories the rules explicitly covered. Rules-as-documentation don't transfer behavior. The correction-enforcement loop within each dyad is what works. This is the feature, not the limitation. The methodology transfers; the raw rules don't.

What Calx is NOT

  • Not a CLAUDE.md manager. Calx doesn't organize your markdown files. It operates on the behavioral plane: hooks, enforcement gates, and compiled mechanisms that structurally modify agent behavior.
  • Not a prompt template library. There are no "best practice" prompts to copy. Calx captures your corrections and compiles them into enforcement specific to how you work.

Commands

Command What it does
calx init Initialize .calx/, detect domains, install hooks, register MCP server
calx correct <text> Log a correction with automatic recurrence detection
calx distill Compile recurring corrections into enforceable mechanisms (--review for weekly review)
calx status Corrections, rules, pending promotions at a glance
calx config View or modify configuration
calx health Rule health: score, conflicts, staleness, coverage, dedup, conversion
calx dispatch <domain> Generate scoped dispatch prompt with domain rules for a subagent
calx stats Local metrics: corrections by domain, recurrence rates, trends
calx sync Write AGENTS.md files to source directories from .calx/rules/
calx serve Start the MCP server (--host, --port, --transport)
calx telemetry Manage anonymous usage telemetry (view status, opt in/out)
calx board Show the enforcement board grouped by status
calx plan View and manage the enforcement plan
calx promote Promote a correction to a rule, or list promotion candidates
calx review Manage foil reviews, review gaps, and review history
calx rules List rules and their enforcement status

MCP Server

Calx runs as an MCP server with local SQLite storage. calx init registers it automatically for Claude Code. Any MCP-compatible client can read rules, log corrections, and fetch briefings.

Resources: calx://briefing/{surface}, calx://rules, calx://corrections Tools: log_correction, promote_correction, get_briefing

For editors other than Claude Code:

# Claude Desktop: add to claude_desktop_config.json
calx serve --transport stdio

# Any MCP client: connect to HTTP endpoint
calx serve
# -> http://127.0.0.1:4195/mcp (auth token in .calx/server.json)

Full reference: docs/mcp-reference.md

Schema safety

Upgrades run migrations automatically. Your data is safe. The SQLite schema evolves with the package, and migrations are applied on first use after an upgrade. No manual steps required.

What Calx collects

All correction data stays local. SQLite on disk. Nothing leaves your machine.

  • Corrections: Stored in an append-only event log (.calx/corrections.jsonl) and SQLite (.calx/calx.db). Never transmitted.
  • Anonymous telemetry (opt-in): Event type, tool/resource name, latency. No correction text. No code. No content. No personally identifiable information.
  • Opt out anytime: calx telemetry --off
  • Team tier (future): opt-in Postgres backend for shared state. You choose what syncs.

Development

pip install -e ".[serve,dev]"

pytest                    # run tests
ruff check src/ tests/    # lint
mypy src/calx/            # type check

Docs

  • Quickstart: Install to running MCP server in 2 minutes
  • Concepts: The behavioral plane and why corrections are pair-specific
  • MCP Reference: Every resource and tool with parameters and examples
  • Correction Workflow: Full capture-to-rule lifecycle
  • Hooks: What each hook does, how to configure and customize

Contributing

Contributions welcome. Please open an issue first for anything beyond small fixes so we can align before you invest time.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

getcalx-0.7.1.tar.gz (120.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

getcalx-0.7.1-py3-none-any.whl (158.7 kB view details)

Uploaded Python 3

File details

Details for the file getcalx-0.7.1.tar.gz.

File metadata

  • Download URL: getcalx-0.7.1.tar.gz
  • Upload date:
  • Size: 120.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for getcalx-0.7.1.tar.gz
Algorithm Hash digest
SHA256 06f77603a40fa58927a1f8bfaa7802af6b21020c1bd8ae5687b5981ceefbf07e
MD5 972b0992f214a92957f7c7914f0f215f
BLAKE2b-256 5ff26a98b00e604a0e8abfa34cec276a5268ffeee8fe0f9e8c7d2f8300b59eaf

See more details on using hashes here.

File details

Details for the file getcalx-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: getcalx-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 158.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for getcalx-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bd422a4b4f76ed6c78d73a71947304eaa7d3731c614faa5183dfbceca4c61a5f
MD5 deff211eef99671b8f50946c6d9613cc
BLAKE2b-256 5d597e45f937ff49965b2e9e02e0b7fb070414cf14ed4a2a87bbb8ebbafa120e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page