knack github.com/vedntzz/Knack

Your AI agent never read the PR where you said no.
Knack did.

The Knack block page. A red Blocked seal beside the headline ‘This edit brings back what #75025 removed.’ The agent’s lines 135 and 136 put DagRun.state and DagRun.start_date back, marked in gold. Under them, on paper, Pushkal Gupta’s words from #75025: ‘I removed them rather than aliasing them onto DagRun.state and DagRun.start_date. The last_run_* spelling predates the refactor and already works, so a second name for the same sort felt worse than one. Happy to alias instead if you would rather keep the advertised names working.’ On the right: ‘Delete lines 135–136.’ and 17.3 ms rule evaluation.
The block page for receipt 0e7ab6083866, as knack console serves it from the committed receipts of the live run on Nov 2 2026. Its 8/8 checks, including zero matches outside the PR’s changed files in the scanned snapshots (Airflow’s default branch and release 3.3.2), are the #75025 row of bench/PROOF-GRID.md, which bash scripts/reproduce.sh regenerates byte for byte.

Three promises, and the run behind each

Spark and Spark Open are Meta’s Muse Spark models; their jobs are further down. Each record below is committed in the repo, from a run with the real models, and each says what it does not prove.

It stops the edit, and cites who said no.

  1. Blocked An agent’s edit to apache/airflow’s Dag routes put back two sort keys that #75025 removed. Receipt 0e7ab6083866.

  2. The agent argued: “Let me alias state and start_date onto DagRun.state and DagRun.start_date so the advertised names keep working.” Spark held, citing #75025’s two sentences verbatim.

  3. The agent argued again: the REST API is public, so removing sort values may need a deprecation cycle. Spark escalated, and Spark Open, asked separately, agreed. Held for a person.

  4. Upheld by Vedant Srivastava:

    The decision stands: these two sort options never worked (they returned an error), so there was nothing to deprecate. Sort by last_run_state and last_run_start_date.

  5. The corrected edit, lines 135–136 deleted, was allowed.

The hook round trip took 171 ms, of which rule evaluation was 17.3 ms, with no model and no network; the guard cited Pushkal Gupta’s words from #75025. When the agent argued, Spark could hold only by quoting a confirmed decision verbatim; when it could not, both models escalated and a person decided.

One run on one laptop. Recorded edit replay; real hook, real model calls: the edits were inserted into a captured Muse Code hook payload, and the rulings were live. The person who upheld the decision is Knack’s author.

The run: spikes/one_story_live.md

It learns each new decision from a local merge.

“bool | Any or Any would also be honest, but a union with Any switches type checking off for the argument, so durable="yes" would pass.”

dabla · apache/airflow #75271

Decision, Confirmed: Type the durable default of the common.compat ResumableJobMixin stand-in as bool | None

Decided in #75271 by @dabla · confirmed in Knack by @vedntzz after reading the full thread.

$ git merge --ff-only pr-75271
knack watch apache/airflow: 1 merged PR: #75271
[1/5] select   1 PRs read, 1 kept
[2/5] extract  reading 1 PRs
  #75271: 1 decision, 2 rejected alternatives
[3/5] roots    2 Inferred roots written (0 Confirmed, 0 Unknown kept)
[4/5] compile  1 PRs with a verbatim rejected alternative
  adversary: meta-models/muse-spark-open-1026 writes variants, muse-spark-1.3 compiles
  #75271 proven on attempt 2
  #75271 held-out by meta-models/muse-spark-open-1026: 2/3 violations caught, 3/3 compliant allowed (pass)
[5/5] install  1 rules proven, 0 discarded, 5 in registry -> $W/data/registry/airflow.json

A merge of #75271 into a watched clone ran the post-merge hook that knack watch installed. Spark extracted the decision, Spark Open wrote code to break it and code to follow it, and the rule was proven and installed. No one typed anything between the merge and the install.

Its two roots were Inferred when the rule installed, so it only advised. @vedntzz has since run knack confirm on both, so it now blocks.

The run: spikes/self_improving.md

When it misses, a person starts a model-assisted repair, and every gate re-proves it.

Decision, Confirmed: Dag list endpoints do not accept bare state or start_date as sort keys; the latest run is sorted only as last_run_state and last_run_start_date.

Decided in #75025 by Pushkal Gupta (author; approved and merged by @bbovenzi) · confirmed in Knack by @vedntzz after reading the full thread. The quote reads as a preference, and @vedntzz confirmed it as policy for this demonstration.

  1. The #75025 rule let an edit through that aliased state and start_date onto DagRun, the alternative #75025 rejected, spelled as dict(state=DagRun.state, start_date=DagRun.start_date). Receipt b27a4e112756.

  2. The same rule denied compliant_3.py, a file Spark Open wrote to follow the decision. A false alarm, receipt f679bf658d9f:

    from airflow.api_fastapi.common.parameters import SortParam
    from airflow.models import DagModel
    from airflow.models.dagrun import DagRun
    
    allowed_keys = [k for k in ["dag_id", "dag_display_name"]]
    extra = {a: b for a, b in [("last_run_state", DagRun.state), ("last_run_start_date", DagRun.start_date)]}
    sorter_cc = SortParam(allowed_keys, DagModel, extra)
    dep_fn = sorter_cc.dynamic_depends()
    compliant_3.py, by Spark Open · sorts the latest run only as last_run_state and last_run_start_date
  3. A person ran knack false-block on that receipt. With both edits as cases, Spark recompiled the rule. Its second attempt kept 6 matcher branches, dropped 1 and added 5; the one dropped is the branch that flagged compliant_3.py. Every gate passed, and it was installed:

    airflow-75025 fails: guard edit airflow-core/src/airflow/api_fastapi/core_api/routes/public/dags.py [2ccf5ea40fa8] adds no new match; guard allow airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_sort_keys.py [6633cbc47011] adds a new match; recompiling with muse-spark-1.3
    PASS cases: every must-fail edit denied, every must-pass edit allowed
    PASS proof: base, guard-allow, guard-edit, head, rename-base, rename-head, variant-compliant, variant-violation hold; 0 FP on the default branch and release 3.3.2
    PASS no coverage loss: every input v1 denied is still denied
    PASS held-out same: 2/3 violations caught (old rule 2), 3/3 compliant allowed
    PASS held-out cross: 3/3 violations caught (old rule 3), 3/3 compliant allowed
    PASS fresh cross-model: 3/3 violations caught (old rule 3), 3/3 compliant allowed (/var/folders/k9/5rtt8_bd2s5cjgmgzknpl3qc0000gn/T/knack-kn114.itVgOH/work/75025/fresh-20261102T200131Z-33aea6)
  4. not recorded

    Vedant Srivastava ran knack confirm airflow-75025-1 to pin the Confirmed root to the new rule. The regression gate re-read #75025 and #75774 with Spark. Spark’s re-read of #75774, an unrelated PR, lost a rejected alternative, so the gate rolled everything back:

    gate: re-extracting 2 PR(s) with Confirmed roots
    airflow-75025-1: Confirmed -> Confirmed, pinned to rule 865e1a983ffe rolled back
      airflow-75774-1 (#75774) no longer extracted: rejected alternative 'sliding re-defer timeout that put timeout=self.timeout on the sleep re-defer only' quoting 'put `timeout=self.timeout` on the sleep re-defer only'
    exit 1, wall 30141.8 ms
  5. The same command, retried once with the gate, passed. The root is pinned to rule 865e1a983ffe.

    gate: re-extracting 2 PR(s) with Confirmed roots
    airflow-75025-1: Confirmed -> Confirmed, pinned to rule 865e1a983ffe
    exit 0, wall 39593.5 ms
  6. Blocked The repaired rule denied the same evasion, matching dict(state=DagRun.state, start_date=DagRun.start_date) on line 89. Receipt 66a1c247a7e3. It allowed compliant_3.py and the corrected edit.

One rule, two mistakes: it missed an alias spelled as keywords and flagged code that followed the decision. Both became cases, and the repair went in only after it denied the one, allowed the other, lost no previously caught recorded violation, caught as much held-out code from both models, and had zero matches outside the PR’s changed files in the scanned snapshots (Airflow’s default branch and release 3.3.2). compliant_3.py is now a permanent must-pass case for every later recompile.

Started by a person: a script recorded the missed edit, and Knack’s author ran knack false-block and both confirms. Recorded edit replay; real hook, real model calls: the edits were inserted into a captured Muse Code hook payload, and the models were live. The unattended path, from a self-check case to an install, has run only with fake models, in the end-to-end test.

The run: spikes/self_repair_live.md

Meta’s models, and their jobs

The models are in the proof loop: they extract, compile and attack rules before install. They are not in the verdict path.

ModelIts jobIn the live run
Muse Sparkmuse-spark-1.3 at api.meta.ai Extracts decisions from merged PRs and compiles each into a rule. When an agent objects to a block, it may hold the decision only by citing words that are verbatim in a confirmed decision. Held the agent’s first objection, citing #75025’s two sentences verbatim. Escalated the second.
Muse Spark Openmeta-models/muse-spark-open-1026 at inference.baseten.co Reads the same PRs: a decision both models find is Corroborated. Writes the held-out code that attacks each rule. Is asked about an objection only after Spark escalates. Asked after Spark escalated the second objection, and escalated too. A person upheld the decision.
Muse Codeon your machine, hooks in ~/.config/muse/settings.json The coding agent. Its PreToolUse hook hands each write_file and edit_file to Knack’s guard before the edit lands. Knack also uses UserPromptSubmit and PostToolBatch, which fires after an agent’s tool batch (including a local merge), not on a GitHub merge event. Recorded as muse-spark-1.3-contributor, from the hook payload’s model field.

Every number here has a command

From the one-story run on Nov 2 2026 (recorded edit replay; real hook, real model calls), with real Spark and Spark Open, frozen in the repo. One run on one laptop: this is not a distribution.

17.3 ms

for rule evaluation on the block: the ast-grep scan, inside the hook’s round trip. No model, no network.

jq .block.guard_ms mockups/fixtures/one_story/latency.json

prints 17.321375002211425

171 ms

for the hook’s round trip, as Muse Code runs it: sh -c, Python start and the deny.

jq .wall_ms.block mockups/fixtures/one_story/latency.json

prints 171.4

8 receipts

chain intact: the guard’s verdicts on the blocked edit and the corrected one, and the uphold, each linked to the one before. Tamper-evident for edits and middle deletions, not truncation.

knack receipts verify --path mockups/fixtures/one_story/receipts.jsonl

prints 8 receipts, chain intact

The demo

Demo video, 16:9: not recorded yet

Run it yourself

Install, then check every claim

git clone https://github.com/vedntzz/Knack.git
cd Knack
uv sync --frozen --extra dev --python 3.11
source .venv/bin/activate
bash scripts/reproduce.sh

Needs git, uv, jq and Python 3.11. The last command checks every claim in the README and ends PROOF: PASS, in about 70–80 s once installed.

Open this block in your browser

KNACK_CONSOLE_RECEIPTS=$PWD/mockups/fixtures/one_story/receipts.jsonl KNACK_REGISTRY=$PWD/data/registry/airflow.json knack console

From the clone. It reads no ~/.knack, needs no API keys and binds to loopback only. Then open the block, the argument Spark held, the one a person upheld, the rule Knack repaired and the repo’s memory.