Skip to main content

AI that learns your judgment. Corrections become behavioral rules that converge on your style.

Project description

Gradata — AI that learns your judgment

Tests PyPI Python License

Every correction you make teaches your AI something. Gradata captures those corrections, extracts the behavioral instruction behind them, and graduates it into a rule. Over time, your AI stops needing corrections. It converges on your judgment.

Not generally more intelligent. Calibrated to you.

pip install gradata

Works with any LLM. Python 3.11+. Zero required dependencies.

Quick Start

from gradata import Brain

brain = Brain.init("./my-brain")

# Your AI produces output. You fix it. Brain learns.
brain.correct(
    draft="We are pleased to inform you of our new product offering.",
    final="Hey, check out what we just shipped."
)
# Brain extracts: "Write in a casual, direct tone — avoid formal business language"

# Next session — inject learned rules into the prompt:
rules = brain.apply_brain_rules("write an email")
# > "[RULE:0.92] TONE: Write in a casual, direct tone..."

# Prove the brain is converging:
manifest = brain.manifest()

How It Works

You correct your AI
       |
brain.correct(draft, final)
       |
Behavioral instruction extracted:
  "We are pleased..." → "Hey, check this out"
  = "Write in a casual, direct tone"
       |
Confidence grows with reinforcement:
  INSTINCT (0.40) → PATTERN (0.60) → RULE (0.90)
       |
3+ related rules → META-RULE emerges
  "Use casual tone" + "No sign-offs" + "Short sentences"
  = "Match Oliver's direct communication style"
       |
Your AI converges on YOUR judgment

Why This Works

Corrections are signal. Every time you edit an AI's output, you're encoding your expertise. Most systems throw that signal away. Gradata captures it, extracts what you meant, and turns it into a rule.

Meta-rules are personalized intelligence. When individual rules start clustering — your email tone preferences aligning with your code review style aligning with your process preferences — meta-rules emerge. The AI starts predicting your patterns across domains. To you, it just "gets it." That's not general intelligence. That's convergence on your judgment.

Convergence is measurable. Track corrections-per-session over time. When the curve flattens, the brain has learned your style. That curve is the product demo.

Ablation Experiment Results

We ran a controlled experiment: 10 tasks scored with and without brain rules.

Metric Without Rules With Rules Delta
Overall quality 6.60 7.47 +13.2%
Preference adherence 5.40 6.90 +1.50
Correctness 7.50 7.80 +0.30

The rules didn't make the AI generally smarter. They made it smarter for that specific user — matching their email style, prospecting workflow, code conventions, and session handoff format.

Behavioral Extraction

Old approach (diff fingerprints — useless):

"Content change (added: getattr)"

New approach (behavioral instructions — rentable):

"Use getattr() for safe attribute access on objects that may lack the attribute"

Every correction now produces an actionable instruction through:

  1. Cache hit — instant lookup of previously extracted instructions
  2. Template match — pre-built instructions for common patterns
  3. LLM extraction — Haiku call for novel corrections (~$0.001 each)

What Makes This Different

Memory systems remember what you said. Gradata learns how you think.

System Remembers Learns from corrections Graduates rules Proves convergence
Mem0 Yes No No No
Letta (MemGPT) Yes No No No
LangChain Memory Yes No No No
Gradata Yes Yes Yes Yes

vs Mem0: Mem0 stores context. Gradata evolves behavior. You could use both.

vs fine-tuning: Fine-tuning is expensive, slow, and loses the original model. Gradata adapts at inference time — every correction takes effect immediately.

vs system prompts: System prompts are static. Gradata's rules are dynamic — they graduate, decay, and evolve based on your corrections.

Features

Core learning loop:

  • brain.correct(draft, final) — captures corrections, extracts behavioral instructions, creates lessons
  • brain.apply_brain_rules(task) — injects graduated rules into prompts
  • brain.manifest() — mathematical proof the brain is converging
  • brain.prove() — paired t-test showing correction rate decreased after graduation

Event Bus (v0.3.0):

  • brain.bus.on(event, handler) — subscribe to any event in the pipeline
  • Events: correction.created, lesson.graduated, meta_rule.created, session.ended

Human-in-the-loop:

  • brain.review_pending() — list lessons awaiting approval
  • brain.approve_lesson(id) / brain.reject_lesson(id) — pre-graduation veto
  • gradata review CLI — approve/reject from terminal

Integrations:

  • OpenAI, Anthropic, LangChain, CrewAI adapters
  • MCP server for Claude Code, Cursor, Windsurf
  • gradata init --mcp generates config automatically

Status

Gradata is in active development (v0.4.0). The SDK is fully functional and free. Cloud features (dashboard, optimization, brain rental) are on the roadmap.

Star the repo to follow progress.

CLI

gradata init                          # Create a brain
gradata correct --draft "..." --final "..."  # Log a correction
gradata review                        # Approve/reject pending lessons
gradata stats                         # Brain health + convergence
gradata manifest --json               # Quality proof
gradata doctor                        # Diagnose issues

Architecture

src/gradata/
  brain.py              # Brain class (public API)
  events_bus.py         # Central event bus
  _core.py              # Correction pipeline + behavioral extraction
  _events.py            # Append-only event log (JSONL + SQLite)
  enhancements/
    edit_classifier.py    # Classification + behavioral instruction extraction
    instruction_cache.py  # LLM extraction cache
    self_improvement.py   # Graduation pipeline
    diff_engine.py        # Edit distance, severity
    meta_rules.py         # Meta-rule synthesis
  rules/
    rule_engine.py        # Inject rules into prompts
    rule_ranker.py        # Context-aware ranking
  integrations/           # OpenAI, Anthropic, LangChain, CrewAI
  contrib/patterns/       # Optional agentic patterns

Community

Contributing

See CONTRIBUTING.md.

License

AGPL-3.0. Commercial license available.

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

gradata-0.4.0.tar.gz (471.1 kB view details)

Uploaded Source

Built Distribution

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

gradata-0.4.0-py3-none-any.whl (388.6 kB view details)

Uploaded Python 3

File details

Details for the file gradata-0.4.0.tar.gz.

File metadata

  • Download URL: gradata-0.4.0.tar.gz
  • Upload date:
  • Size: 471.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gradata-0.4.0.tar.gz
Algorithm Hash digest
SHA256 286eb521dbf4b80167ca460af4db7956befcb4aec6bf237c6fbbe80f912f2258
MD5 b892d0a2fd4ae319dad49c255ebd3716
BLAKE2b-256 a697737e27203c4ef70cba240557dfd71474d4937177e8e6148d610acab537ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for gradata-0.4.0.tar.gz:

Publisher: sdk-release.yml on Gradata/gradata

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gradata-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: gradata-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 388.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gradata-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07fb92e8031619189580ec87c5f7c3c383ab57e41029195c7d49afd25d030aab
MD5 507b79abd26746b044a4f31777a6105a
BLAKE2b-256 ffc311f95b7d1fb3ae70e6b6a22cd36d2aaadbe1d62ed48670a4af81b3710c25

See more details on using hashes here.

Provenance

The following attestation bundles were made for gradata-0.4.0-py3-none-any.whl:

Publisher: sdk-release.yml on Gradata/gradata

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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