You fix a tone. You rewrite a regex. You re-explain how your team formats PRs. Then the AI forgets, and you do it all again next session.
Gradata turns every correction into a rule your AI carries forward. Not a longer prompt. Not a bigger context window. A behavioral rule that graduates from instinct → pattern → rule the more it proves itself — and dies the moment it stops.
pip install gradataOne-command setup for Claude Code, Cursor, Windsurf, or any MCP-compatible IDE:
npx gradata-install install --ide=claude-codeWorks with any LLM. Python 3.11+. Zero required dependencies. Local-first. AGPL-3.0.
Memory systems remember what you said. Gradata learns how you think.
| System | Remembers | Learns from corrections | Graduates rules | Proves convergence |
|---|---|---|---|---|
| Mem0 | ✓ | — | — | — |
| Letta (MemGPT) | ✓ | — | — | — |
| LangChain Memory | ✓ | — | — | — |
| Gradata | ✓ | ✓ | ✓ | ✓ |
- vs fine-tuning — no training run, no model lock-in, no GPU. Adapts at inference time.
- vs system prompts — static rules you hand-write vs dynamic rules the model earns.
- vs Mem0 / Letta — they store context; Gradata evolves behavior. Use both.
Not generally smarter. Calibrated to you.
flowchart LR
A["You correct your AI"] --> B["brain.correct(draft, final)"]
B --> C["Behavioral rule extracted"]
C --> D["Confidence grows with reinforcement"]
D --> E["INSTINCT → PATTERN → RULE"]
E --> F["Related rules cluster → META-RULE"]
F --> G["Your AI converges on YOUR judgment"]
style A fill:#6366f1,stroke:#4f46e5,color:#fff
style E fill:#8b5cf6,stroke:#7c3aed,color:#fff
style G fill:#10b981,stroke:#059669,color:#fff
Every correction creates a lesson. Lessons compete. Contradicted rules lose confidence and die. Idle rules decay. Only rules that survive real-world application get promoted into your AI's behavior.
This is evolution, not configuration.
stateDiagram-v2
[*] --> INSTINCT: Correction captured
INSTINCT --> PATTERN: Reinforced across sessions
PATTERN --> RULE: Proven + passes adversarial gates
RULE --> META_RULE: 3+ related rules cluster
INSTINCT --> KILLED: Contradicted or idle
PATTERN --> INSTINCT: Confidence dropped
RULE --> ARCHIVE: Graduated (reference only)
Ablation v4 — 4 models × 6 conditions × 16 tasks × 3 iterations = 432 trials, blind-judged by Haiku 4.5.
| Model | Preference lift (rules vs base) | Correctness lift |
|---|---|---|
| Sonnet 4.6 | +2.7% | +0.4% |
| DeepSeek V3 | +5.1% | +0.9% |
| qwen2.5-coder 14B | +5.7% | +3.6% |
| gemma3:4b | +3.4% | +1.1% |
The rules aren't just a format trick. We ran the Min et al. (2022) random-label control — plausible-but-unrelated rule text in the same envelope. Three of four models regress by 3–10%. Content is doing the work, not XML structure.
Smaller/local models benefit most. Frontier models get calibrated faster. The curve is the product demo: corrections-per-session drops monotonically as the brain converges.
from gradata import Brain
brain = Brain.init("./my-brain")
# Your AI produces output. You fix it. The brain learns.
brain.correct(
draft="We are pleased to inform you of our new product offering.",
final="Hey, check out what we just shipped.",
)
# → Extracts: "Write in a casual, direct tone, avoid formal business language"
# Next session, learned rules are injected automatically:
rules = brain.apply_brain_rules("write an email")
# → [RULE] TONE: Write in a casual, direct tone...
# Prove the brain is converging:
brain.manifest() # Mathematical proof of convergence
brain.prove() # Paired t-test on correction rate/plugin marketplace add Gradata/gradata
/plugin install gradata
Prereq: pipx install gradata. See .claude-plugin/README.md.
pipx install gradata
gradata install-hook --ide=claude-codeThe @gradata/cli npm package talks to a local Gradata daemon — no Python required at call time:
npm i @gradata/cliimport { GradataClient } from "@gradata/cli";
const client = new GradataClient({ endpoint: "http://127.0.0.1:8765" });
await client.correct({
draft: "We are pleased to inform you of our new product offering.",
final: "Hey, check out what we just shipped.",
outputType: "email",
});Full API in packages/npm/README.md.
docker run --rm -p 8765:8765 -v $(pwd)/brain:/brain \
ghcr.io/gradata/gradata/daemon:latest \
daemon --brain-dir /brain --port 8765Or docker build -t gradata/daemon:dev . from the repo root. docker-compose.yml included for local dev.
gradata init ./my-brain # create a brain
gradata demo ./eval-brain # try a pre-trained one
gradata convergence # ASCII chart of correction trend
gradata manifest --json # mathematical convergence proof
gradata review # approve/reject pending promotions
gradata stats # brain health metrics
gradata doctor # diagnose issuesCore learning loop
brain.correct(draft, final)— captures corrections, extracts behavioral instructionsbrain.apply_brain_rules(task)— injects graduated rules into promptsbrain.manifest()/brain.prove()— convergence proof, not vanity metrics- Event bus:
brain.bus.on("correction.created" | "lesson.graduated" | "meta_rule.created" | "session.ended", handler)
Meta-rules. When 3+ rules cluster, an LLM synthesizes a scoped meta-rule with applies_when / never_when conditions.
Security. PII redaction before storage • HMAC-SHA256 provenance on every correction • score obfuscation so confidence never leaks to the LLM • per-brain salt on graduation thresholds.
Integrations. OpenAI · Anthropic · LangChain · CrewAI adapters · MCP server for Claude Code / Cursor / Windsurf · Claude Code hooks that auto-capture corrections · custom providers via GRADATA_LLM_PROVIDER=openai (or any OpenAI-compatible endpoint).
Every graduated rule can be traced back to the corrections that created it. No opaque behavior. Git diff for AI preferences.
from gradata import Brain
brain = Brain("./my-brain")
# List graduated rules (optionally filter)
brain.rules()
brain.rules(include_all=True, category="tone")
# Trace a rule to the corrections that created it
brain.explain("rule_abc123")
# → {"rule_id": ..., "description": ..., "source_corrections": [...], "sessions": [...]}
# Full provenance chain (rule → lesson → corrections → events)
brain.trace("rule_abc123")
# Export for review, diffing, or sharing
brain.export_data(output_format="json") # or "yaml"
brain.export_rules(min_state="PATTERN") # OpenSpace-compatible SKILL.md
brain.export_rules_json(min_state="RULE") # flat sorted array
brain.export_skill(output_dir="./skills") # full skill directory
brain.export_tree(format="obsidian", path="./vault")
# Human veto
brain.pending_promotions()
brain.approve_promotion("rule_abc123")
brain.reject_promotion("rule_abc123")Full signatures in docs/sdk/brain.md.
graph TB
subgraph Public API
Brain["brain.py"]
CLI["cli.py"]
end
subgraph Core Pipeline
Core["_core.py"]
EventBus["events_bus.py"]
EventLog["_events.py"]
end
subgraph Enhancements
Classifier["edit_classifier.py"]
Cache["instruction_cache.py"]
Graduation["self_improvement.py"]
Meta["meta_rules.py"]
end
subgraph Security
PII["safety.py"]
Prov["correction_provenance.py"]
end
Brain --> Core
Core --> Classifier --> Cache
Core --> Graduation --> Meta
Core --> EventBus
Core --> EventLog
Core --> PII
Core --> Prov
style Brain fill:#6366f1,stroke:#4f46e5,color:#fff
style Core fill:#8b5cf6,stroke:#7c3aed,color:#fff
style EventBus fill:#f59e0b,stroke:#d97706,color:#fff
src/gradata/— the Python SDK (correction → rules → graduation pipeline)tests/— SDK tests (pytest)docs/— mkdocs site sources (published to gradata.ai/docs)examples/— SDK usage examplespackages/npm/—@gradata/cliJS clientgradata-install/— npm wrapper for one-command IDE setup.claude-plugin/+hooks/— Claude Code plugin manifestbrain/— research scripts (benchmarks, simulations)
- GitHub Issues — bugs, features, questions
- GitHub Discussions — ideas, show & tell
- Docs — guides, API reference
Built on Constitutional AI (Anthropic, 2022), Duolingo's half-life regression (Settles & Meeder, ACL 2016), the Copilot RCT (Peng et al., 2023), SuperMemo's two-component memory model (Wozniak, 1995), and MT-Bench LLM-as-judge (Zheng et al., NeurIPS 2023). Sits alongside Mem0, Letta, and EverMind — with one difference: Gradata learns from your corrections, not just recalls facts. Full credits in CREDITS.md.
See CONTRIBUTING.md.
AGPL-3.0. Commercial license available — contact [email protected].