Skip to content

Corrections

Ashlar ships its ledger, ledger.json. Each entry is a rule, or a check Ashlar makes from the import graph, and the correction it came from:

ledger.json
{
"id": "no-timer",
"rule": true,
"says": "No timers in features: a hook from primitives/, named for what it waits on, instead",
"applies": "features",
"corrected": "A setTimeout(…, 0) added for one flicker grew to 183 timers, and six places moved focus after a render, each in its own way",
"by": "developer",
"replaces": null,
"case": {
"file": "src/plugin/features.test.ts",
"test": "the column's sheet focused two frames later"
},
"message": "A timer patches over a render you don't control. Use a hook from `primitives/`, named for what it waits on."
}

ashlar ledger prints it for a person to read:

Terminal window
$ pnpm exec ashlar ledger
…
no-timer: No timers in features: a hook from primitives/, named for what it waits on, instead, in features.
It corrected: A setTimeout(…, 0) added for one flicker grew to 183 timers, and six places moved focus after a render, each in its own way.
Its case: src/plugin/features.test.ts, “the column's sheet focused two frames later”.
A timer patches over a render you don't control. Use a hook from `primitives/`, named for what it waits on.
…

An agent's mistake that a person corrects once will come back in the next task, and in the next agent. Prose doesn't stop it: a line in CLAUDE.md or a review comment goes stale, and nothing checks that anyone read it. The no-comment rule came from 15,875 comment lines, 1,611 of them citing a decision, and agents writing down why a quick fix was justified.

So a correction becomes a rule, and a rule holds four things:

  • The correction. A person corrected an agent's work and didn't want to do it again. A rule with no correction behind it isn't taken.
  • What to do instead. The message names the replacement, not only the mistake, in one or two sentences. It is what the agent reads when the rule fires.
  • Its case, as a test. The code that went wrong becomes a test named after what went wrong, and the rule fires on it. The ledger names that test, and a test checks that it is there to run.
  • A person's yes. The developer agrees to each rule before it is added.

A rule also replaces the prose it came from, so the instruction lives in one place, where it is checked.

Field What it holds
id The rule's name, as check prints it.
rule true for a rule check counts; false for a check Ashlar makes from the import graph.
says The rule in one line.
applies Where it holds, such as features or all code.
corrected What went wrong, with counts when there are some.
by Who corrected it: developer, lead or gate.
replaces The prose instruction it replaced, or null.
case The test that holds its case: its file and its name.
message What an agent reads when it fires.

Two entries aren't rules. affected lists the tests a change reaches through the import graph, and builds leaves a screen or Electron test out when the change doesn't touch its build's inputs. affected replaced a line agents were given in prose, and ashlar ledger says so:

Terminal window
affected: A builder and the item gate run the tests the import graph says a change reaches, in every change.
It corrected: Decisions 161 and 163: builders ran whole suites, eleven of them spending 394 of their 439 minutes of commands in test runs, and their prompts then told them in prose to pick the tests that cover their change.
Its case: src/affected.test.ts, “lists every test that reaches a changed file through the graph”.
It replaced: “Run only the test files you wrote or changed, each named by its path, never the whole test suite or a whole package's tests.”
A builder and the item gate run the tests the import graph says a change reaches.

ashlar ledger prints the messages your project's config sets, so it shows what your agents read. ashlar ledger --json prints the same entries for tools.

A correction can land in one of three places, depending on whose it is:

  • A rule for every project. Open a "Rule from a correction" issue on Ashlar's repository with the case: what the agent did, the file and the code that show it, and what the rule should say. It becomes a test, a rule and a ledger entry. See Add a rule from a correction.
  • A name only one folder may use. A confined entry in your config, with its message, holds it with the named-only-in rule. See Rules.
  • Something to know about one area. A line in DECISIONS.md or a folder rule in .claude/rules/. An agent reads it in its brief before it changes that area. See Onboarding.

The same holds for turning a rule off. No comment in code can do it. If a rule is wrong for a case, change the rule and record why in the ledger, or turn it off for the whole project in the config.