Skip to main content

Correction engineering for AI agents.

Reason this release was yanked:

tombstone

Project description

Calx

Your AI agent keeps making the same mistakes. Calx makes it stop.

You correct your AI agent. It learns for that session. Next session, same mistake. You correct it again. The correction never transfers between sessions, between agents, or between projects.

Calx captures corrections, detects when the same mistake recurs, promotes recurring corrections into rules, and injects those rules at the start of every session automatically.

calx correct "don't mock the database in integration tests"
# → Logged C014 (2026-03-22). Matches C007: "don't mock the database." (3rd occurrence — promotion eligible.)

# Next session, your agent loads the rule automatically. No manual editing. No copy-paste.

Install

pip install getcalx

Then in your Claude Code session, run init directly:

! calx init

This walks you through 4 questions (domains, agent naming, referral, Claude plan), scaffolds .calx/, installs hooks, and adds Calx instructions to your CLAUDE.md. If you already have a CLAUDE.md, Calx appends its sections without overwriting your existing content.

Requires Python 3.10+. Works with Claude Code. Cursor, Copilot, and Windsurf support planned. Any agent with session hooks can integrate.

How it works

CaptureDetectPromoteInject

  • 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 itself. The generated CLAUDE.md instructs agents to run calx correct when corrected, so most corrections require no human action.
  • Calx silently matches new corrections against existing ones. When the same correction recurs 3+ times, it surfaces once at the end of your current task as a single yes/no. Never mid-flow.
  • On approval, the correction graduates to a rule in .calx/rules/{domain}.md, written in your own words. The full temporal chain is preserved as provenance.
  • At the start of every session, domain-specific rules are injected into the agent's context via hooks. The agent reads and applies them before writing any code.

Each pass through this loop tightens the correction surface. Without intervention, you'll average ~2.9 corrections per task, every task, forever. With Calx, that number drops as rules compound.

What this changes about how you work

Calx isn't just a correction logger. It encodes an orchestration methodology as automation so you stop managing your agent and start working with it.

Token discipline. Calx auto-detects your subscription tier and enforces context limits (Max: 200k soft / 250k ceiling, Pro: 80k / 100k). You never hit compaction, which means the correction signal, the thing that makes the learning loop work, is never destroyed by context summarization.

Session lifecycle runs itself. Session start injects rules, shows an effectiveness signal (corrections trending down per domain), and gates edits until rules are read. Session end captures uncommitted corrections, writes a clean-exit marker, and hands off state to the next session. If a session crashes, dirty-exit recovery prompts for anything that was lost.

Scoped rules, scoped agents. Rules sync from .calx/rules/ to AGENTS.md files co-located in your source directories. When you dispatch a subagent to work on src/api/, it reads src/api/AGENTS.md and gets exactly the rules it needs, nothing more. Your main window coordinates. Subagents do focused deep work.

src/
├── api/
│   ├── AGENTS.md          ← rules for API work
│   └── routes.py
├── services/
│   ├── AGENTS.md          ← rules for service layer
│   └── auth.py
└── db/
    ├── AGENTS.md          ← rules for data access
    └── migrations/

Distillation runs in the background. Recurrence detection is silent. Promotion surfaces at task boundaries, not mid-flow. Weekly review is a PR-style diff of your rule set. The system learns while you work.

Rule health

Not all rules age the same way. Architectural rules (structural fixes that eliminate an error class) don't decay from dormancy. Zero corrections means they're working. Process rules decay with age unless reinforced. Calx tracks the difference and surfaces when a recurring process rule should become an architectural fix instead.

Why Calx over alternatives?

Other approaches assume corrections compound and transfer between agents. Share rules, everyone gets better. Our evidence shows they don't. We gave an agent 237 transferred rules and 30% of new corrections fell in categories those rules explicitly covered. So Calx automates the formation process instead of trying to share the output.

Approach What it does What it misses
Editing CLAUDE.md by hand Works. Rules persist across sessions. No recurrence detection. No health tracking. No signal when rules conflict or go stale. Scales to ~20 rules before it becomes a wall of text agents skim.
Compound engineering Document corrections, share rules across agents. Assumes rules transfer as behavior. Our evidence says they transfer as documentation only. The agent reads them, follows them mechanically, and still gets them wrong in novel contexts.
Agent memory tools (Mem0, etc.) Store and retrieve information across sessions. Same transfer assumption, different mechanism. 30% of new corrections fell in categories with explicit rules.
Doing nothing Zero overhead. ~2.9 corrections per task, every task, forever. That's the error floor without intervention.
Calx Captures corrections, detects recurrence, promotes to rules, injects via hooks, enforces token discipline, automates the session lifecycle, scopes rules to directories, tracks health. Doesn't try to transfer corrections between agents. Accelerates behavioral formation within each relationship instead.

The evidence

We gave an AI agent 237 rules learned from another agent. It made 44 new mistakes, 13 in categories the rules explicitly covered. Process rules showed ~50% persistence. Architectural fixes had zero recurrence.

The Behavioral Plane (paper) | Evidence repo

Commands

Command What it does
calx init Initialize .calx/, detect domains, scaffold CLAUDE.md, install hooks
calx correct <text> Log a correction with automatic recurrence detection
calx distill Promote recurring corrections or run weekly review (--review)
calx status Corrections, rules, pending promotions at a glance
calx sync Write AGENTS.md files to source directories from .calx/rules/
calx dispatch <domain> Generate scoped dispatch prompt for builder or foil agent
calx health <sub> Rule health: score, conflicts, staleness, coverage, dedup, conversion
calx config View or modify configuration
calx stats Local metrics: corrections by domain, recurrence rates, trends

Project structure

.calx/
├── calx.json              # Configuration (domains, token discipline, thresholds)
├── corrections.jsonl       # Append-only event log (gitignored)
├── rules/
│   └── {domain}.md         # Promoted rules per domain (committed)
├── health/
│   ├── state.json          # Health scores per rule
│   └── .last_clean_exit    # Session state marker
├── method/
│   ├── how-we-document.md  # Three-tier learning model
│   ├── orchestration.md    # Session lifecycle and hooks
│   ├── dispatch.md         # Agent dispatch scaffolding
│   └── review.md           # Foil review methodology
└── hooks/
    ├── session-start.sh
    ├── session-end.sh
    ├── orientation-gate.sh
    └── collapse-guard.sh

Development

pip install -e ".[dev]"

pytest                    # 323 tests
ruff check src/ tests/    # Lint
mypy src/calx/            # Type check

Contributing

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

License

MIT. The complete learning loop ships free with no feature gates.

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.2.2.tar.gz (54.7 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.2.2-py3-none-any.whl (66.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for getcalx-0.2.2.tar.gz
Algorithm Hash digest
SHA256 6158eaaf8f2b27bb18dfa46fce5608a0d382b5d6baa2c2854418d1185e2f41a4
MD5 fe0fada7175b2259d73ba10d8c8a3c93
BLAKE2b-256 70154565e4ad3cddd26e497e8b54905e3ab27a76a17e28112584fdd94f90cdf0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: getcalx-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 66.0 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.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 994ee18355ba2754724a3e423f914e286c027f13ad48132a9f5d6ab1b52abdd5
MD5 6efca64980b299b82101c70de5252b16
BLAKE2b-256 455c36d051f1f16b4b7ae7a671ccb3749fd44754402f114445be4eba62c7c0aa

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