,___,
 (O,O)
 (   )
 -"-"-
Adaptive governance for Claude Code

Auto-applies the safe edits. Surfaces the ones worth your review.

Hedwig learns your preferences and calibrates Claude Code. It decides which edits need your eyes and which can go through on their own.

online logistic regression·embedding-ranked retrieval·self-correcting·local SQLite, zero cloud

claude code
$ claude plugin marketplace add tanjalshukla/HedwigCLI
$ claude plugin install hedwig@hedwig-marketplace
# make an edit, then check what Hedwig did:
$ /hedwig-status

Trust a kind of edit and it starts flowing through. Revert one and the next like it stops for review. Autonomy moves both ways.

See it work

Watch Hedwig learn and decide.

/hedwig-status all-time
 ,___,
 (O,O)
 (   )
 -"-"-

Hedwig · trust runtime

  Auto-applied   10   ███████████████░░░░░  77%
  Surfaced        2   for your review
  Blocked         1   agent asked to revise

  10 of 13 edits auto-applied all-time.

  Why it surfaced these:
    · core/migrations.py: data-model change
    · api/routes.py: interface change, multi-file blast radius
/hedwig-weights 60 decisions
learned classifier drift
· scorer ACTIVE ·

  avg review time      -12.55
  blast radius          -8.60
  change pattern risk   +8.22
  new file              +5.07
  security sensitive    -3.31
  prior denials         -3.31

  toward auto-apply
  toward check-in
 no weight hand-tuned
/hedwig-retrospective where it was too trusting
3 self-corrections
auto-applied, then walked back

 • db/models.py
   reverted after auto-apply
 • core/cache.py
   failed verification
 • api/routes.py
   reverted after auto-apply

each one tightened the next
decision on that file.

Powered by your trace data and behavior in this repo.

How it works

Score. Decide. Learn.

  1. Score the edit

    Diff size, blast radius, security sensitivity, change pattern. Deterministic, the model can't talk its way to a low score.

  2. Apply or surface

    Familiar low-risk edits go through silently. Anything riskier surfaces with a plain reason.

  3. Learn from outcomes

    A reverted edit or a failed verification is a training signal.

1 · score size · blast radius · sensitive · new file 2 · decide apply quietly, or surface for review 3 · outcome kept? reverted? verify failed? 4 · learn corrective gradient, once per event feeds back runs locally. nothing is sent anywhere
What makes it work

It calibrates to how you work in this repo.

Hedwig learns the line from what you actually revert, and holds a security floor it won't cross no matter what it learns. It calibrates per repo, not per developer.

It learns from your reverts

Undo something Hedwig auto-applied and it takes the hint. That revert becomes a negative signal the scorer carries forward, so the next edit like it stops for review.

It tells the agent exactly why

When Hedwig holds an edit, it sends the agent a plain-English reason and asks it to narrow the scope. The agent self-corrects same-turn. No human needed, and the floor it held stays held regardless of what the agent argues.

A real classifier, trained live

A lightweight logistic-regression scorer updates one decision at a time and takes over from the built-in heuristics after ten real calls.

It scans for what keywords miss

Run /hedwig-scan once and Hedwig flags security-sensitive files that don't have obvious names. Nothing changes until you confirm.

Memory is on disk.

Decisions, self-corrections, classifier weights, your rules. All of it lives in a local file, not a context window. It survives restarts, carries across sessions, and is shared across agents. Every Claude Code session on the same repo reads the same governance state. A regret recorded by one agent tightens the next.

Rule retrieval runs on-device. Pattern inference runs in the Claude Code session you're already in.

Token overhead is near-zero. Rules surface only when relevant: a few lines, capped. A fresh repo costs nothing until you've built up history.

Two commands.

All you need is Claude Code and Python 3.11+.