silcrow 0.1.0

Deterministic CLI for a citable, checkable graph of laws in a git tree.
silcrow-0.1.0 is not a library.

Silcrow

Silcrow is an agent overlay that scaffolds coding agents while they build, with no silent drift between the rules and their code over the long run.

It sits on top of the agent CLI you already use, Claude Code, Codex, Cursor or another, and replaces none of them. It instructs the agent through its own CLI, silcrow agent and the messages of each command, and checks the agent's work with check, the git hooks and diff.

An agent changes code faster than anyone rereads it, and a rule you gave it once lives on only in a chat and in the code. The next change, by the same agent or another, can break that rule without anyone seeing it.

So the agent consolidates each business decision you state into structured documentation, laws and their clauses in markdown notes under docs/decisions/, and marks and zones the code that carries each one. Silcrow pins every zone to the code it reads and to the text of its law.

When either side moves, silcrow check fails until someone reads the code against its law. silcrow diff prints the change rule by rule, each behaviour change beside the rule it touches, every rule retired or deleted, then what no rule governs, and silcrow check in CI names each change for the person who merges, the merge being the approval. Silcrow does not prove the code right. It makes sure no change to a rule, or to the code under it, gets past a person unseen.

Silcrow governs its own code this way, and Lade and Substantial run on it.

Example

You tell the agent: "Refunds over 500 need a second approval, and nobody approves their own refund. A refund goes back to how the customer paid." It writes the note and marks the code. After silcrow fix, step 2 of the loop, docs/decisions/refunds.md reads:

Refunds

Refunds send money out of the company, so a large one needs a second pair of eyes, and the money goes back the way it came in.

§ c09206qct A refund over 500 is paid only after a second person approves it.

  • (a) The person who requested the refund cannot be its approver.

§ hsqwqt1vn A refund goes back to the payment method the customer paid with.

and src/refunds.ts reads:

const LIMIT = 500;

export function canPay(refund: Refund): boolean {
  // § c09206qct@w1wb7
  if (refund.amount <= LIMIT) {
    return true;
  }
  // § c09206qct.a@cnxg2
  const approvers = refund.approvals.filter((who) => !samePerson(who, refund.requestedBy));
  // § end c09206qct.a
  return approvers.length >= 1;
}

function samePerson(a: string, b: string): boolean {
  return a === b;
}

export function refundTarget(order: { paidWith: string }): string {
  // § hsqwqt1vn@962xz
  return order.paidWith;
}
  • A law is one rule: a bold sentence opened by § and an id, which is a hash of the sentence. A law the public documentation promises its readers opens §!, a public promise, and owes a marker in that documentation besides its code. A clause is a lettered item under it, or a row of a table under its head whose first cell is (a), addressed as c09206qct.a. A letter is never reused.
  • A marker is a § comment on its own line inside the code that carries a law or a clause. //, #, -- or a /* */ closed on the same line wraps it, and in a page of the public documentation it is <!-- § c09206qct.a -->. A § after code on the same line fails check, and text inside a string is never a marker. No grammar delimits a construct inside a JSX expression or the token tree of a Rust macro, a tokio::select! arm included, so a marker there fails check, unless a § end line closes it in a macro.
  • Its span is the code it covers: the whole construct that holds it, statements above the marker included, here the function canPay, or the lines from the marker down to its § end. A marker on the line above a module-level function spans that function. The clause span is cut out of the law span around it. A marker that no span holds fails check, and so do two markers on one span, or on two spans that overlap without one holding the other: each address gets the code that carries it. Place a marker in the block that holds its clause first, and add a § end only when the rest of the block is not governed by the clause.
  • A § one marker spans only the statement or member right below it: a statement, a field, an argument, a match arm or case clause, an enum variant, an object or dict entry, a class member, or in Markdown the next block element. It lists every address that statement carries, // § one c09206qct.a, 4mzp1x8kd, and each gets its own pin. Use it only when that statement carries the whole clause: a value computed there and used further down takes the block. It needs a tested grammar and a statement or member the grammar parses, so inside the arguments of a Rust macro, concat! or vec!, it fails as having nothing below it. It takes no § end, and fails check when its list names an address twice or a law beside its own clause.
  • Its pin is the digest after @. It hashes the span, the code before it in its function, the project functions the span calls by name, as Following narrows them, the constants that either names, the import lines that spell those names, and the text of its law's sentence, of the lines under its head and of its clause. fix and accept write it, never a person.

What fails which pin in these two files:

  • LIMIT = 1000 fails c09206qct and c09206qct.a. Both read the constant, the clause through the if before its span.
  • An edit of the filter, or of the body of samePerson, which the clause span calls, fails c09206qct.a alone.
  • >= 2 on the last line of canPay fails c09206qct alone.
  • An edit of the text of clause (a) fails c09206qct.a. An edit of the law's sentence fails both pins, and its id no longer hashes it: for a change of form, silcrow accept c09206qct remints the id, rewrites every pointer to it and re-pins every pin of the law, its clause markers included, naming each. silcrow accept c09206qct.a re-pins that clause alone.
  • An edit of refundTarget fails hsqwqt1vn alone.
  • Reformatting, a comment, renaming who, refund, or samePerson with its call, or moving samePerson within the file fails nothing.

When the agent later makes samePerson compare lowercase, as in the loop, silcrow diff shows the reviewer the law, the clause, its span and the callee that changed, here through delta:

silcrow diff in a terminal, side by side: law c09206qct and its clause (a) as one hunk of the decision note, the span of the clause, and the patch of the followed callee samePerson, which now compares lowercase

What a pin reads, and what it does not, is under What a pin reads.

The loop

  1. You state the rules, as above.

  2. The agent writes the note and marks the code. It never picks an id: it writes a provisional name, **§ +second-approval A refund over 500 ...**, a (+) in place of each letter, and markers that name them, // § +second-approval.a. Then:

    $ silcrow fix
      MINT +second-approval -> c09206qct
      MINT +target -> hsqwqt1vn
      LETTER c09206qct.a
      REWRITE docs/decisions/refunds.md
      REWRITE src/refunds.ts
      PIN src/refunds.ts
    
    ✓ Fixed. Run `silcrow check`.
    

    The files now read as in the example. check fails while a provisional name or a (+) is left, and the pre-commit hook runs fix and check on every commit.

    A rule decided before its code is a draft: **§? +second-approval A refund over 500 ...** for a law, **§!? ...** for a public promise, - (+)? ... for a clause. A draft is declared, cited and listed, it owes no marker, and check prints it under Not implemented, not pinned: with its age, the date of the first commit that wrote its line, neither an error nor a warning. stats counts the drafts and names the oldest. Once its code and its marker exist, fix drops the ?, which moves no id and no pin. A marker on a draft fails check until fix drops it, and a check in CI names for the person who merges every draft the merge target did not hold, a new one or a ? added to a law or clause it held.

  3. Weeks later, a change. "The requester can still approve their own refund when the email case differs." The agent makes samePerson compare lowercase. The clause span calls it, so:

    $ silcrow check
      ERR src/refunds.ts:8: § c09206qct.a changed since its pin @cnxg2: the followed callee `samePerson` in src/refunds.ts reads otherwise since the last commit that held this pin. Read it against its law or clause with `silcrow diff`, then run `silcrow accept c09206qct.a`.
    
    ✗ Graph is broken. 3 reference(s) resolved, 1 error(s), 0 warning(s).
    
  4. The agent reads the span against clause (a). The clause still holds, so it accepts the new code:

    $ silcrow accept c09206qct.a
      REPIN src/refunds.ts § c09206qct.a
    ✓ Re-pinned § c09206qct.a.
    

    Had the clause no longer held, it would fix the code, or strike the law and write a successor.

  5. The reviewer runs silcrow diff. Under c09206qct, a behaviour change accepted, they read the clause, the new pin, and the patch of samePerson. silcrow diff --md prints that entry as:

    ## § c09206qct: behaviour change accepted
    
    Decision note `docs/decisions/refunds.md`.
    
    Check: does the code below still do what c09206qct.a says?
    
    > A refund over 500 is paid only after a second person approves it.
    
    ### c09206qct.a: behaviour change accepted
    
    > The person who requested the refund cannot be its approver.
    
    * `src/refunds.ts:8`: span of c09206qct.a, accepted (@cnxg2 → @ghxv4). A callee changed: its patch is below.
    
    ```diff
    diff --git a/src/refunds.ts b/src/refunds.ts
    --- a/src/refunds.ts
    +++ b/src/refunds.ts
    @@ -9,1 +9,1 @@ span of c09206qct.a, accepted
       const approvers = refund.approvals.filter((who) => !samePerson(who, refund.requestedBy));
    @@ -14,3 +14,3 @@ followed callee samePerson
     function samePerson(a: string, b: string): boolean {
    -  return a === b;
    +  return a.toLowerCase() === b.toLowerCase();
     }
    ```
    

    Review with diff shows a fuller review. The reviewer can be another agent, as Review by another agent shows. Merging ratifies it.

  6. CI runs silcrow check --all on the pull request. It compares every project against the merge-base of the branch the pull request targets, which the forge names, GITHUB_BASE_REF on GitHub. It prints a count of the changes it names per law, then the packet of step 5, names each change under it for the person who merges, grouped per law, and passes, since the merge is the approval:

    $ silcrow check --all
    # Silcrow: 1 change(s) named for the person who merges
    
    - [.] § c09206qct: 1
    
    # Silcrow review against 0e9c74a1be675508fe13104e0578ff3f8bbcdc70
    ...
    Changed since the comparison point, named for the person who merges, as the packet above shows:
      [.] § c09206qct, 1 change(s):
        [.] src/refunds.ts:8: § c09206qct.a carries @ghxv4, and 0e9c74a1b pinned it here as @cnxg2: it was re-pinned.
    
    ✓ Graph is closed. 3 reference(s) resolved, 0 error(s), 0 warning(s), 1 change(s) named.
    

Install

Prebuilt binaries for macOS (x86_64, aarch64) and Linux (x86_64, aarch64, gnu and musl) are attached to each GitHub release, with a .sha256 beside each archive. The installer picks yours, checks the checksum, failing when it is missing or does not match, and moves silcrow to /usr/local/bin, with sudo if that folder is not writable:

curl -fsSL https://raw.githubusercontent.com/zifeo/silcrow/main/installer.sh | bash

Variables on the bash side of the pipe change it: VERSION=0.1.0 pins a release, OUT_DIR=~/.local/bin changes the folder, PLATFORM=x86_64-unknown-linux-musl overrides detection. From crates.io:

cargo install silcrow --locked

Then, at the root of a git repository:

$ silcrow install
wrote /home/dev/shop/.agents/skills/silcrow/SKILL.md
wrote /home/dev/shop/AGENTS.md
wrote /home/dev/shop/.git/hooks/pre-commit
wrote /home/dev/shop/.git/hooks/post-merge
wrote /home/dev/shop/.git/hooks/post-rewrite
wrote /home/dev/shop/.git/hooks/commit-msg

It names only the files it writes, so a second run, with every file current, prints nothing. That is the whole setup. Your agent reads AGENTS.md, finds the Silcrow block and the skill, and runs silcrow agent for the protocol. You never have to name Silcrow in a prompt. The protocol tells it that every file it writes states the product as it is or as a person decided it will be: a decided promise not built yet is a draft, a dated record states the past as past, a current limit is written as the supported scope, and a promise nobody decided goes to the tracker.

This is the block install writes at the top of AGENTS.md, in full. The rest of the file is yours, and install leaves it as it is:

<silcrow notes="docs/decisions/**/*.md" default-branch="main" code="**/*" docs="" tests="conventions" test-markers="error" note-words="error:3000">
This repo follows [Silcrow](https://github.com/zifeo/silcrow).
Decisions: `docs/decisions/**/*.md`. Usage: `silcrow help`.
Engineering principles:
- Locality: keep behavior, data, and decisions close to where they are used, and fix a shared defect once at its source.
- Explicitness: make inputs, outputs, dependencies, and failure modes visible.
- Economy: use the smallest mechanism that completely solves the problem, reusing existing code before adding any, and finish every caller, test, and fixture it touches.
- Stability: preserve observable behavior, including error handling and validation, across refactors unless a law changes it.
- Decisions: state each law as a business decision, in plain and abstract words a person can reason about and steer behavior with, never as a restatement of the code, and leave out any value or detail with no reason behind it.
- Verifiability: prefer deterministic behavior that can be checked directly, leave a test for new non-trivial logic, and name what was skipped or left unchecked.
- Order: make it work, then make it right, then make it fast only when a measured need or a law demands it.
</silcrow>

The principles are generic guidance for the agent, never parsed or cited. The skill, .agents/skills/silcrow/SKILL.md, is a pointer of a few lines that tells the agent to run silcrow agent, so the protocol comes from the binary and never goes stale. The hooks are under Hooks.

The attributes of the opening tag are the whole configuration of a project. install writes all seven, each at its default until you set it, and keeps the values you set: edit them in place. A block that omits one fails check, which names it and install.

Attribute Values Default What it decides
notes patterns from the project root, split on spaces, gitignore style docs/decisions/**/*.md Which Markdown files are decision notes. A pattern opening with ! excludes, and the last pattern that matches a file decides: notes="docs/**/*.md !docs/archive/**" reads every note under docs/ but the archive.
default-branch a branch origin/HEAD, else the current branch The branch changes land on, which diff compares against, and whose history keeps the ids, letters and aliases a law once held. install writes it from origin/HEAD, else the current branch.
code patterns, as notes **/* The files whose markers pay the code duty: every active clause, or law with none, owes a marker in one. A Markdown file never pays it.
docs patterns, as notes none The public documentation, a manual, guide, API spec or FAQ, in any language with a comment syntax, docs="website/docs/**/*.html" for a site: every active public promise, a law written §!, owes a marker of itself or of a clause in one, and fails check while the list is empty. A plain law owes code alone and may carry a documentation marker too, which pins the page that explains it. A file it matches is documentation even when code matches it, and a marker in any other Markdown file that is not a decision note fails check, so internal docs carry none. In MDX a marker is {/* § <id> */}, the comment its compiler accepts.
tests patterns, as notes, or conventions each language's convention The test code, which a pin reads apart from the code it tests and stats counts apart: by default a file under tests/, Go *_test.go, Python test_*.py and *_test.py, JavaScript and TypeScript *.test.*, *.spec.* and __tests__/, Java and Kotlin src/test/. conventions names them. A written list replaces the conventions, and Rust items compiled only for tests stay test code.
test-markers error, warn or allow error What check does with a marker in test code: error fails it, naming the attribute, warn keeps it valid with a warning, and allow keeps it valid. Under warn and allow it pays the code duty as any other. Set allow where a test is the one carrier of a law, as when the deciding code is a compiled module or another repository's service, and keep markers on the deciding code everywhere else.
note-words a positive integer, after error: or warn: error:3000 The words a decision note holds at most, counted as the whitespace-separated tokens of its file. check fails a longer note, or warns on it under warn:, and says to split it by sub-topic into a directory of the same name, docs/decisions/refunds/ for refunds.md.

Any other attribute fails check, and so do a note-words of neither form, a test-markers of none of its values, a list that is not a glob, or that matches no note while a marker points to a law. install fails on an unknown attribute or a value it cannot read, naming each unknown attribute, and writes nothing. A block that a commit holds is read in the names and values it was written in, so a comparison and the history read across the rename. Nothing else is configured: the skill is always written at .agents/skills/silcrow/SKILL.md, the hooks where git reads them, and no other file or flag sets a project's policy. What a pin follows is set in the code, by the marks under Following.

silcrow upgrade replaces the binary with the latest release, after a confirm that --yes skips, and --version 0.2.0 picks one. See How do upgrades work? for the release notice.

Adopt an existing project

A project with code, docs and tests already made its decisions. Tell the agent to adopt it, and silcrow agent adopt gives it the method:

  • Writers draft the laws, one per note in parallel. A verifier of a stronger model, or at least a fresh context, gets the code and the docs but never the writers' conclusions, and tries to refute each law. A gap finder names each promise no law covers.
  • It reads the promises and the docs first, then the tests, then the code: code says what happens, the docs and tests say what is promised.
  • It adopts with docs="" first. Once the laws are true and reviewed, it asks you which public documentation the project has, names it in docs and marks §! only the laws those docs promise, whose documentation markers go there, never in internal docs. A business rule that must not be public is still a law, a plain § that owes no documentation marker.
  • A law is written for the person who reviews it: present tense, active voice, the product or an actor as subject, one of the five EARS shapes, always, When, While, If ... then or Where, and no RFC 2119 capitals. Clauses that vary along one or two axes are a table of row clauses, a state machine is a mermaid diagram, and an enumeration is a sub-list. The verifier asks of each law whether it is singular, verifiable and unambiguous, holds no vague word, and would read better as a table. silcrow agent author gives the same form to any note.
  • A law needs a reason a source independent of the adoption states, a design note, a test or the code, and someone who relies on it, and says what the product does or supports, never only what it does not. A value with no reason and a restatement of the code stay out.
  • A gap between code and docs is settled by rule: a documented promise wins over the code, copies align on the reference, a silent drop becomes an explicit failure, a missing test gets written. Only a business choice no rule settles comes to you, with its evidence.
  • docs/silcrow-adoption.md keeps the ledger by hand: what was decided, what was removed and where it went, and the questions left for you. Coverage and carriers come from silcrow list and silcrow stats.
  • It stops when every promise maps to a law and a fresh review finds no false law and no wrong carrier, or at a cap on rounds. It never installs hooks in a checkout whose hooks another tree shares, and never writes outside the project.

What a pin reads

A pin reads a closure of whole syntactic units around its span, as the Example shows. Silcrow never models what a language means by a name, and narrows one only by its text. The rules, the closed list of what narrows a name, and what normalises away are docs/decisions/contract.md, and the list of what is not read is docs/decisions/limits.md.

Beyond the pins, check, diff and the check in CI catch:

  • an edit of the text of a law or a clause, the lines under its head and the header of a table whose rows are its clauses included: diff shows it beside its head, and the check in CI names it even when it has no pin;
  • an edit of the context of a law, the prose between its head and its clauses, which binds nothing and no pin hashes: diff shows it under its law as a change of its context, and the check in CI names it;
  • a law, a clause or an alias anchor deleted without a strike: diff lists it first, as deleted without a strike, and the check in CI names it at the deleted law's head;
  • a marker a law owes missing, a pointer to an id that does not exist, a marker on a retired clause;
  • a merge that git sees as clean, where one side changed a law and the other changed a marker of it;
  • every re-pin, which diff shows, log counts and the check in CI names, and every removed pin, which diff shows as a behaviour change accepted and the check in CI names.

Nothing catches whether the code does what the law says, code that carries a rule but has no marker, two laws that contradict each other, a commit no Silcrow hook ran on (see Hooks), or a reviewer who approves without reading. The Quint model under spec/ checks the lifecycle of laws and pointers, not the code duty: its replay against the binary sets aside a missing code marker, as it sets aside a drift.

Formatting, whitespace, comments and trailing commas do not move a pin, nor does the rename of a local, nor the rename of a followed function or constant with all its calls and reads where no import line spells its name. Reading whole units costs noise rather than missed reads:

  • An edit above a span in its function drifts it, so every marker of a long function drifts on an edit near its top.
  • Moving code or a file, or renaming a function across files, drifts the callers whose import lines it rewrites, since those lines are read as text, and the callers whose cone it enters or leaves.
  • Declaring a second function of a name a span calls drifts the span, since the name then reads neither.
  • Renaming a recursive function, a boundary or a silcrow:technical function drifts its callers, since a call into a cycle, a boundary or a function Silcrow does not follow keeps its name.
  • Renaming a project type also drifts its readers, since types stay in the digest. So does renaming a local that a Rust format string captures, a Python parameter a caller may bind by name, or a name bound in a class body.

Keep one law to one function, and close a stretch with // § end for the rest: a span then reads little beyond the code that carries its law.

Languages

In git every tracked or unignored file is walked, under target/ or node_modules/ too; outside git those directories are skipped. A symbolic link is skipped, whatever it points to. Tested grammars are parsed with Tree-sitter.

Language Extensions
Rust .rs
Python .py
JavaScript, JSX .js, .jsx, .mjs, .cjs
TypeScript .ts, .mts, .cts
TSX .tsx
HTML .html, .htm
CSS .css
HCL .hcl, .tf, .tfvars
Bash .sh, .bash
Markdown .md, .markdown, .mdx

Every other extension, Go, Java, Kotlin, C, C++ and Ruby included, gets a fallback pin over the text from the marker to the end of the file, or to its § end line, so any edit in that stretch drifts it, and a § one marker there fails check. fix and check warn once per file and link an issue to request the grammar:

WRN svc/pay.go: `Go` has no tested grammar, so its pins use a fallback heuristic. Each span runs to the end of the file, or to its `§ end` line, so a pin is coarse and will drift often. Tested languages: rust (.rs), python (.py), javascript (.js, .jsx, .mjs, .cjs), typescript (.ts, .mts, .cts), tsx (.tsx), html (.html, .htm), css (.css), hcl (.hcl, .tf, .tfvars), bash (.sh, .bash), markdown (.md, .markdown, .mdx). Search existing requests: https://github.com/zifeo/silcrow/issues?q=is%3Aissue+Add+tested+grammar%3A+Go  Request support: https://github.com/zifeo/silcrow/issues/new?title=Add+tested+grammar%3A+Go

Avoid the fallback for code that carries laws.

Following

A law is often carried out by a function and the helpers it calls, so a pin follows the project functions its span calls by name, and what those call in turn, each by its shape: renaming a helper or its locals, making it pub or export, or editing a TypeScript type leaves callers alone. A Python annotation moves them, since pydantic, FastAPI and dataclasses read it at run time. A call through a value Silcrow cannot name, x.f() or a trait method, is not followed: call a helper by name, through its type or class, or through self, this or cls. A span whose every statement is such a call to a name the project declares, discarded, returned or awaited, with only names and fields of names as its receivers and arguments, guards nothing, since an edit of the code that acts moves no pin, and fails check: move the marker onto that code, or mark the call silcrow:follow. A call whose arguments hold a literal, a comparison, a closure or any other expression carries what they decide, since its pin hashes them, and a call to a library or standard function, min(amount, cap), carries it by its name. A name that more than one function answers, after its own file and its qualifier narrow it, follows none, Rust cfg twins aside. Enums are not followed. Constants are.

A TypeScript or JavaScript import through a path alias, @/lib/cap, reads the project file it names when the nearest tsconfig.json compilerOptions.paths or deno.json imports maps its prefix to one path. A call follows only into its cone: the directory of the caller's file and every directory below it. The cone and silcrow:functional are how you decide what is functional. Code beside or below the rule is part of it, and a shared helper elsewhere is part of it only once you mark it. That sits between syntactic zoning, which reads the span alone, and logical zoning, which would read everything the span depends on. docs/decisions/contract.md states the rules.

A function whose own marker covers its whole body is a boundary: its pin already guards it, so callers do not follow it, and check warns with their laws when it drifts. Four marks change what is followed. Each is a comment on the line before a function or a call:

Mark Where Effect
// silcrow:technical before a function No caller follows it. For logging, formatting and other plumbing.
// silcrow:functional before a function Every caller follows it, even when it is a boundary or outside the caller's cone.
// silcrow:skip before a call That call is not followed.
// silcrow:follow before a call That call is followed, even into a boundary or outside the cone. A method called on a value, this.policy.allows(r), follows the one method of its name in the project, other than the one it sits in. A marked call that names no single function, class or constant of the project fails check.
Symptom What to do
My pins drift too often. Keep one law to one function. Mark shared plumbing silcrow:technical, or give it its own law so it becomes a boundary. When the rest of the block is not governed by the clause, give the marker its own stretch with // § end <address>, so the span runs from the marker to that line instead of the whole construct. Mark the clause the code implements, not the whole law.
I want to see which pins read the most. Run silcrow stats: per law, the bytes each pin reads and the bodies it follows, the ten bodies the most pins follow, and the size of each decision note.
A business rule changed and nothing failed. Check that the helper sits in the caller's cone or is marked silcrow:functional, that no other function shares its name, and that it is neither technical nor a boundary. Remove silcrow:technical, since no mark follows past it. For a boundary, mark it silcrow:functional, or put silcrow:follow before the one call that needs it. Check that the change is not one docs/decisions/limits.md lists as not read.

silcrow agent code gives your agent the same guidance.

Review with diff

silcrow diff compares your work with the point where it left the default branch, or with any revision or range you pass. The rule is the unit, not the file. It prints one entry per law the change touched, riskiest first: deleted, retired and removed laws, then accepted behaviour changes, new laws, remints and other text changes, and the rest, and within each a law whose drift moved its own span before one whose drift moved only what its span reads. Under each law come its sentence and each clause the change touched, and under each of those every place that moved for it, in any file or language: the span on both sides, the code before the span, the followed callees that changed, and the doc sections that carry it. It ends with the changes no law governs.

Here the branch of the loop also struck hsqwqt1vn and declared a successor that allows store credit, in the code and in a new guide page, and it added a currency suffix to a formatter no law governs. silcrow diff --md prints:

# Silcrow review against 0e9c74a1be675508fe13104e0578ff3f8bbcdc70

3 laws: 1 retired, 1 behaviour change accepted, 1 new. 2 files changed under no law.

Each section is one law. Read its text, then each place under it: the spans, the code before them, the followed callees and the doc sections that changed. Judge whether they still do what the text says. Then judge whether a change under no law carries a rule that lacks a law or a marker.

## § hsqwqt1vn: retired

Decision note `docs/decisions/refunds.md`.

Check: does nothing still rely on hsqwqt1vn, and does its successor, if any, carry what still holds?

~~A refund goes back to the payment method the customer paid with.~~

<details>
<summary>Patch of hsqwqt1vn</summary>

```diff
diff --git a/docs/decisions/refunds.md b/docs/decisions/refunds.md
--- a/docs/decisions/refunds.md
+++ b/docs/decisions/refunds.md
@@ -1,1 +0,0 @@ text of hsqwqt1vn
-A refund goes back to the payment method the customer paid with.
```

</details>

* `src/refunds.ts:19`: span of hsqwqt1vn, removed.

```diff
diff --git a/src/refunds.ts b/src/refunds.ts
--- a/src/refunds.ts
+++ b/src/refunds.ts
@@ -18,4 +17,0 @@ span of hsqwqt1vn, removed
-export function refundTarget(order: { paidWith: string }): string {
-
-  return order.paidWith;
-}
```

## § c09206qct: behaviour change accepted

Decision note `docs/decisions/refunds.md`.

Check: does the code below still do what c09206qct.a says?

> A refund over 500 is paid only after a second person approves it.

### c09206qct.a: behaviour change accepted

> The person who requested the refund cannot be its approver.

* `src/refunds.ts:8`: span of c09206qct.a, accepted (@cnxg2 → @ghxv4). A callee changed: its patch is below.

```diff
diff --git a/src/refunds.ts b/src/refunds.ts
--- a/src/refunds.ts
+++ b/src/refunds.ts
@@ -9,1 +9,1 @@ span of c09206qct.a, accepted
   const approvers = refund.approvals.filter((who) => !samePerson(who, refund.requestedBy));
@@ -14,3 +14,3 @@ followed callee samePerson
 function samePerson(a: string, b: string): boolean {
-  return a === b;
+  return a.toLowerCase() === b.toLowerCase();
 }
```

## § ngd1hef99: new

Decision note `docs/decisions/refunds.md`.

Check: does the code below do what ngd1hef99 says, and does every place that carries it hold a marker?

**A refund goes back to the payment method the customer paid with, or to store credit when the customer asks for it.**

<details>
<summary>Patch of ngd1hef99</summary>

```diff
diff --git a/docs/decisions/refunds.md b/docs/decisions/refunds.md
--- a/docs/decisions/refunds.md
+++ b/docs/decisions/refunds.md
@@ -0,0 +1,1 @@ text of ngd1hef99
+A refund goes back to the payment method the customer paid with, or to store credit when the customer asks for it.
```

</details>

* `docs/guide/refunds.md:5`: doc section of ngd1hef99, added.

```diff
diff --git a/docs/guide/refunds.md b/docs/guide/refunds.md
--- /dev/null
+++ b/docs/guide/refunds.md
@@ -0,0 +3,4 @@ doc section of ngd1hef99, added
+## Where the money goes
+
+
+The refund goes back to the card or account you paid with, or to store credit if you ask for it.
```

* `src/refunds.ts:19`: span of ngd1hef99, added.

```diff
diff --git a/src/refunds.ts b/src/refunds.ts
--- a/src/refunds.ts
+++ b/src/refunds.ts
@@ -17,0 +18,7 @@ span of ngd1hef99, added
+export function refundTarget(order: { paidWith: string; wantsCredit: boolean }): string {
+
+  if (order.wantsCredit) {
+    return "store-credit";
+  }
+  return order.paidWith;
+}
```

## Changes under no law

No marker covers these lines and no pin reads them. Check: does any of them carry a rule that lacks a law or a marker?

* `docs/guide/refunds.md`: +1 -0
* `src/format.ts`: +1 -1

```diff
diff --git a/docs/guide/refunds.md b/docs/guide/refunds.md
--- /dev/null
+++ b/docs/guide/refunds.md
@@ -0,0 +1,1 @@
+# Refunds
diff --git a/src/format.ts b/src/format.ts
--- a/src/format.ts
+++ b/src/format.ts
@@ -2,1 +2,1 @@
-  return (cents / 100).toFixed(2);
+  return (cents / 100).toFixed(2) + " EUR";
```
  • retired: the law was struck in the note, so it reads as dead where it was declared, and its marker went with it.
  • behaviour change accepted: the clause is unchanged, so its text reads as it stands, quoted with no patch, and the code under it moved. This is the entry to read before approving. When the code before the span in its function, or an attribute around it, changed, a patch beside the span shows it, then each followed callee that changed. A changed import line is named in the reason. When a followed callee changed, the reason says a callee changed; a rebinding is named only when every body shown reads alike.
  • new: the successor and each place that now carries it, the code and the guide section.
  • reminted from <old> to <new>: accept reminted the law after a change of its words, and kept the old id as an alias anchor. It is one entry under the new id, its text as old new, and each pin the remint re-pinned under it. A strike with a successor still reads as retired and new.
  • A law or a clause whose text moved shows on the structure its note writes: its new text with each changed run of words as old new, a changed table as a table whose first column marks each changed, added or removed row and whose changed cells read old new, a row clause with its letter cell, a changed list as a list with each item marked, and a fenced block, a mermaid diagram included, as its text before and after, then the lines that changed. The raw patch of the text, the lines under the head and the header of a lettered table included, stays folded under each view, and each pin of it that kept its digest is listed as code changed.
  • context changed: the prose between the head and the clauses moved. It binds nothing and no pin hashes it, so it shows under its law on both sides, with its patch folded.
  • A law removed after its strike was merged reads as removed after a published strike. A law deleted with no strike reads as deleted without a strike, with its last text and code, so nothing disappears unseen.
  • Changes under no law lists each changed line that no marker covers and no pin reads, with each file's line counts. A marker governs its line and its span, a pin the code it reads before its span and each callee it follows, and a decision note the lines of its laws, the context between a head and its clauses included, its clauses and cites. Here that is the title of the new guide and the formatter. An import line a pin reads is still listed here, a known limit.

A patch leaves out marker lines, so a re-pin alone moves no line, and the place names the move of its pin once. On a TTY only the patches remain, with no prose and no status: per law its text as one hunk of its note, then its code, through delta side by side, which paints each place in its language, or the pager when delta is absent. Piped, it is JSON with the same structure: laws, each with its id, status, note, check, sentence and clauses, and reminted_from for a remint, each address with its text on both sides, its changes and its locations, each place with its pins, the stretches it reads and its callees, then ungoverned, each file with its counts and hunks. The clause above reads:

{
  "address": "c09206qct.a",
  "letter": "a",
  "status": "accepted",
  "text": {
    "old": "The person who requested the refund cannot be its approver.",
    "new": "The person who requested the refund cannot be its approver."
  },
  "changes": [],
  "locations": [
    {
      "path": "src/refunds.ts",
      "doc": false,
      "pins": [
        {
          "kind": "accepted",
          "lines": [8, 8],
          "old": "  // § c09206qct.a@cnxg2\n  const approvers = refund.approvals.filter((who) => !samePerson(who, refund.requestedBy));\n  // § end c09206qct.a\n",
          "new": "  // § c09206qct.a@ghxv4\n  const approvers = refund.approvals.filter((who) => !samePerson(who, refund.requestedBy));\n  // § end c09206qct.a\n",
          "why": "A callee changed: its patch is below."
        }
      ],
      "reads": [],
      "callees": [
        {
          "name": "samePerson",
          "path": "src/refunds.ts",
          "old": "function samePerson(a: string, b: string): boolean {\n  return a === b;\n}",
          "new": "function samePerson(a: string, b: string): boolean {\n  return a.toLowerCase() === b.toLowerCase();\n}"
        }
      ]
    }
  ]
}

and the formatter under no law:

{
  "path": "src/format.ts",
  "added": 1,
  "removed": 1,
  "binary": false,
  "hunks": [
    {
      "old": [2, 1],
      "new": [2, 1],
      "lines": ["-  return (cents / 100).toFixed(2);", "+  return (cents / 100).toFixed(2) + \" EUR\";"]
    }
  ]
}

--json forces JSON on a TTY, and --md prints the packet wherever stdout goes. Its arguments are revisions alone, as git diff takes them: silcrow diff HEAD~3 compares a revision with the worktree, silcrow diff main feature or silcrow diff main..feature the two ends, and silcrow diff main...feature the merge-base with feature. silcrow diff --law c09206qct keeps one law, --law c09206qct.a one clause, repeatable, and drops the changes under no law, and an address no law of either side declares fails. In a monorepo, silcrow diff --all reads every project, the root and each nested one, as one review with paths from the root. A plain silcrow diff names each nested project the comparison touched and left unread. A check that compares reads every project, as --all does.

Review by another agent

One agent makes the change and another reviews it before a person merges. The reviewer needs no context of the first session: the packet holds each rule beside what moved for it, and the Check: line of each entry is the question to answer. silcrow agent review prints the protocol to the reviewing agent:

  1. Run silcrow diff --md on the branch, or silcrow diff --md <ref> from where the change started.
  2. Spawn one fresh finder per law, given its entry and the repository, never the author's summary, and one more for the changes under no law. A finding quotes the clause it breaks and cites the path:line that breaks it. Holds is a full answer. A finder also asks of each new or changed law whether it is singular, verifiable and unambiguous, holds no vague word, and would read better as a table.
  3. Spawn one fresh verifier per finding, given the law and the cited code, never the finder's reasoning. Only a confirmed finding is kept.
  4. Report each law as holds, or does not hold with its confirmed findings ranked blocking, important or minor.
  5. After a fix, review again only what it touched. Stop when a round confirms nothing new, or after three rounds.

The reviewer never runs accept or fix on the change under review, with or without --write: a re-pin approves it, and a release build writes without --write. On the packet above, a verdict reads like this:

  • hsqwqt1vn, retired: holds. No place still returns paidWith alone, and ngd1hef99 carries the rule.
  • c09206qct.a, accepted: holds. samePerson now compares lowercase, so the requester still cannot approve, whatever the case.
  • ngd1hef99, new: holds in src/refunds.ts:19 and docs/guide/refunds.md:5.
  • Under no law, important: src/format.ts:2 fixes the currency of every amount to EUR. That is a rule without a law: declare it or drop it.

The check in CI still names each accepted change for the person who merges.

Log

$ silcrow log c09206qct --verbose
[c09206qct] A refund over 500 is paid only after a second person approves it.
  declared  2026-11-17  (4 seconds ago)
  markers  code 2  doc 0  remint 0  accept 0  re-pin 1
  re-pin  b407016  Dev, 17 Nov 2026  c09206qct.a
[c09206qct] declare, Dev, 17 Nov 2026
  + A refund over 500 is paid only after a second person approves it.

The genealogy comes from git log -S, with no store beside the tree. It follows a law across rewordings and counts every re-pin, and --verbose lists them.

History

silcrow stats --history measures whether the laws pay for themselves, from git alone. It reads the first-parent history of the default branch, or the range you pass, silcrow stats --history v0.1.0..main, and --since 2026-09-01 keeps the commits after a date. Per law and clause it counts the re-pins, each under the first cause that holds, as diff reads it: remint of the address or of the hashing scheme, span, prefix for the code before the span in its function or the attributes that govern it, callee, import, text of the law or clause, other for any other read, and unread for a span this binary cannot read in an old commit. Beside them:

  • with_test: the re-pins whose commit also wrote a marker of the same address, new or re-pinned, in test code.
  • neither: the re-pins with no change to their own span and no test change, remints and unread spans aside. It is the closest history comes to an accept by reflex.

Per ISO week it counts the commits, those that change a line inside the span of a marker, the re-pins by cause, the laws and clauses declared and struck, and the markers added. It ends with the laws and clauses never re-pinned in the range, and, for the tree today, the marker and § end lines against the other lines that are not blank, per language. On a TTY it prints tables, piped it prints JSON.

History holds only what was committed. A drift that check stopped and the agent fixed before the commit never reaches it, so the measure cannot count the regressions a pin prevented that way: it shows what the markers cost, not all they caught.

Squash

On a branch, a note is a journal: a law can be born and struck before anyone else reads it. silcrow squash, run before the merge or on main right after, deletes a struck law that was never published. A struck clause becomes (c) **Retired.**, which keeps its letter taken. One that was never published and still has an active sub-clause stays as written. A published struck law stays for the removal below. No hook runs it.

Removing a law cleanly

  1. On a branch, strike the law in place, **§ b02drqepj ~~A refund under 50 is paid the same day.~~**, then run silcrow accept b02drqepj. It deletes the markers of the law and re-pins the code around them:
$ silcrow accept b02drqepj
  UNMARK [.] src/refunds.ts:35 § b02drqepj
✓ Removed the markers of § b02drqepj. Its struck text stays until the published tree holds the strike: run `silcrow accept b02drqepj` again after the merge.
  1. Merge. Every other branch now reads the law as retired.
  2. On a new branch, run it again:
$ silcrow accept b02drqepj
  REMOVE docs/decisions/refunds.md:15 § b02drqepj
✓ Removed § b02drqepj.

It deletes the law with its clauses and every line that only referred to it, and refuses while a sentence elsewhere still cites it. diff lists it as removed after a published strike. The id is never minted again.

Eject

silcrow eject removes the markers, the follow marks, the § and ids in the notes, the AGENTS.md block, the skill pointer and the hooks it wrote. Each active law stays as a bold sentence, so the notes remain the record of why the code is the way it is. Struck laws and clauses, tombstones and adoptions go. Preview it first:

$ silcrow eject --dry-run
silcrow: dry-run: nothing will be written
  EJECT AGENTS.md
  EJECT docs/decisions/refunds.md
  EJECT src/refunds.ts
  DELETE .agents/skills/silcrow/SKILL.md
  DELETE .git/hooks/commit-msg
  DELETE .git/hooks/post-merge
  DELETE .git/hooks/post-rewrite
  DELETE .git/hooks/pre-commit
--- a/docs/decisions/refunds.md
+++ b/docs/decisions/refunds.md
@@ -3,7 +3,7 @@
 Refunds send money out of the company, so a large one needs a second pair of eyes, and the money goes back the way it came in.
 
-**§ <a id="c09206qct">c09206qct</a> A refund over 500 is paid only after a second person approves it.**
+**A refund over 500 is paid only after a second person approves it.**
 
...
--- a/src/refunds.ts
+++ b/src/refunds.ts
@@ -3,6 +3,5 @@
 export function canPay(refund: Refund): boolean {
-  // § c09206qct@w1wb7
   if (refund.amount <= LIMIT) {
...

Each path is followed by the diff of what it writes or deletes. A hook or skill file that is not Silcrow's is left alone. Git history is never touched.

Hooks

Hook What it does
pre-commit Runs fix on the staged files, so provisional names are minted and new markers pinned before the commit, restages them, then runs check. A bare marker that stands for a pin HEAD held in its file, at its old path for a file git reads as renamed, while its span hashes to another digest, stays bare and fails the commit, naming accept. It reads the index, so the commit records what was checked. It refuses a partially staged file that fix would rewrite. A refused commit writes nothing, so a name it would have minted stays provisional until a commit passes.
commit-msg Appends Silcrow-Scheme: <n> when history does not already record the scheme of this binary, and Silcrow-Op: remint on a commit that only moves digests, ids and alias anchors after a scheme change, so log can skip it.
post-merge Runs check after a pull or merge, and fails on a law changed by one side and its marker by the other. It reports, it does not roll back.
post-rewrite Runs check after a rebase or commit --amend.

Each hook is a three-line script that runs exec silcrow hook <event>. install writes the four files where git reads hooks, in .git/hooks/ or in core.hooksPath when it is set, and from a linked worktree in the hooks folder of the common git directory, which every worktree shares.

Silcrow manages only its own hooks. A hook file it did not write is never overwritten and never counts as installed: install writes the others, then fails, naming each such file with the line silcrow hook <event> "$@" you may add to it. A hook that is the copy of your global git template, which git init made, is named as that copy: delete it and run install again, or add the line. A hook of husky, lefthook or pre-commit is named with its manager. No other command warns on it, since nothing you change clears that warning. If husky, pre-commit or another tool owns those files, keep it and add that line where it runs your hooks. Silcrow cannot tell whether that hook runs it.

Git runs pre-commit only for git commit, commit-msg for git commit and git merge, and post-rewrite for a rebase and commit --amend. A cherry-pick or a revert that applies cleanly, and git am, run none of the four, so the commit they land is not checked: run silcrow check after one. A cherry-pick resumed with --continue after a conflict commits through git commit and runs the hooks. The hooks read the index, so a file git does not track is not read there: check run by hand warns when a pin follows a body in such a file.

Hooks are local to a clone, so run silcrow check --all in CI either way. A hook is reported by check, which the hooks run, and by install, which writes them, and every other verb that reads a tree reports only the block and the skill pointer. With CI set, as CI services set it, and in a repository whose git root holds no Silcrow block, as a monorepo whose folders hold the projects, check reports none. silcrow install --dry-run lists every hook, block or skill file that differs from this binary, and a skill named silcrow in the home directory of an agent, which may load in place of the pointer, and writes nothing.

Every directory whose AGENTS.md carries the block is a project, with its own notes and policy. A project's tree stops at the next project, so two projects can carry the same id. A nested project starts as an AGENTS.md with a Silcrow block in its folder: write it there, then run silcrow install in that folder to complete it. From a folder that holds no block, install writes the block of the enclosing project. The hooks and the skill pointer are written once, at the git root.

A marker for a law of another project names its path from the git root:

def total(xs):
    # § libs/money:k924mpp7r@x101z
    return sum(xs)

It is checked and pinned against that project's text, so an edit of the law there fails the pin here. A project that must implement another's law adopts it with a paragraph that is only the bold head, **§ libs/money:k924mpp7r**, and then owes markers for it. Every verb acts on the nearest project. check --all, fix --all, list --all, diff --all and eject --all act on every project.

$ silcrow check --all
✓ Graph is closed. 2 reference(s) resolved, 0 error(s), 0 warning(s).

CI

check:
  runs-on: ubuntu-24.04
  steps:
    - uses: actions/checkout@v6
      with:
        fetch-depth: 0
    - run: curl -fsSL https://raw.githubusercontent.com/zifeo/silcrow/main/installer.sh | VERSION=0.1.0 OUT_DIR="$RUNNER_TEMP" bash
    - run: $RUNNER_TEMP/silcrow check --all

uses: zifeo/silcrow@v0.1.0 with version: 0.1.0 installs the same binary through the installer and puts it on PATH, and the image ghcr.io/zifeo/silcrow:0.1.0 holds it for a container job.

The merge is the approval, so the check stays plain. With CI set, as CI services set it, check compares against the merge-base of HEAD and the merge target the forge names: GITHUB_BASE_REF on GitHub, CI_MERGE_REQUEST_DIFF_BASE_SHA, else CI_MERGE_REQUEST_TARGET_BRANCH_NAME, on GitLab, BITBUCKET_PR_DESTINATION_BRANCH, SYSTEM_PULLREQUEST_TARGETBRANCH on Azure Pipelines, CHANGE_TARGET on Jenkins, BUILDKITE_PULL_REQUEST_BASE_BRANCH and CI_COMMIT_TARGET_BRANCH on Woodpecker, a branch read as origin/<branch>. --base <ref> names the point anywhere, in CI or on a laptop. A check that compares reads every project of the workspace and prints the diff --md packet of the comparison whenever it holds a change under a law, a pin whose digest held while what it reads moved included. On GitHub it appends the count and the packet to the job summary, the file GITHUB_STEP_SUMMARY names, where the person who merges reads it. A place whose code and text did not change is listed with no patch. Under the packet comes one line per change a person must see, grouped per law: a pin that moved, a pin added for a law it held, a law reworded, deleted or reminted, the context of a law, a new law or clause, a draft, a public promise made or made plain, an attribute of the block. Those pass, and only what breaks the graph fails, so a legitimate accept never turns CI red. A head on an id a removed law carried, and a clause on a burned letter, still fail.

A job with no merge target, a push to main, checks coherence and says in one line that it compared nothing. A target the clone does not hold fails and names the fetch, and so does a shallow clone, since the check reads the history of the target for the ids and letters a removed law held: hence fetch-depth: 0. silcrow check --all reads every project, the nested ones included, and fails on a marker in a file outside every project. A plain check at the root outside CI reads the root project only.

FAQ

Why are ids hashes and not readable names? The id is a hash of the carrying sentence, nine characters. Two branches that write the same sentence get the same id, with no counter to coordinate, and moving a note or a file breaks nothing. Agents do not need readable ids, and people read the sentence, which list, diff and log always print next to it. Rewording a sentence changes its hash: silcrow accept <id> rewrites every pointer, and a published id stays as an alias so old links resolve.

Can the agent re-pin until check passes? It can run accept, and every accept is visible: diff lists it as a behaviour change accepted, log counts it, and the check in CI names it for the person who merges. The skill tells the agent to read the span against its clause first and to fix the code when the clause no longer holds. Deleting a digest is no way around it: fix leaves a marker bare when it stands for a pin HEAD held in its file, or at the old path of a file git reads as renamed, and its span changed since, and names accept. A digest is 25 bits, so it guards against accidental drift, not against a deliberate search for a span that matches an old digest.

Do I write the notes? No. You say the rule, the agent writes the note. You read the law text in diff, and silcrow list prints every active law. silcrow list --path src/refunds.ts:9 prints only the laws and clauses whose pins read that line, through their span, the code before it or a callee they follow, then the drafts of the same notes, and the agent runs it before it edits a file.

Is there a GitHub Action? Not one that reviews. A product on top of Silcrow is for later. Today, install the binary in a job and run check --all, which compares a pull request against its merge target, as in CI.

How do upgrades work? silcrow upgrade downloads the release asset for your platform from GitHub, fails unless the .sha256 beside it matches, as the installer does, and replaces the running binary after a confirm. At a terminal, a command checks for a newer release at most once a day, with a two-second timeout. When there is one, it prints one line on stderr, at most once an hour:

silcrow: release 0.2.0 is out, this is 0.1.0. Run `silcrow upgrade` to install it.

Nothing is checked in CI, when stderr is not a terminal, or in a development build. A failed check never fails the command.

What happens to my existing hooks? Keep your hook manager and add silcrow hook <event> "$@" to it. See Hooks.

How do I remove Silcrow? silcrow eject. The notes stay as plain prose, the markers go. See Eject.

Does it slow commits? Silcrow runs its own hooks on every commit of this repository, and a release build of silcrow check finishes there in a few seconds. The pre-commit hook runs fix and check on the index, so it takes a little longer.

My pins drift too often. See the symptom table in Following.

Does it send anything over the network? Only the daily release check at a terminal, and silcrow upgrade. Comparisons are local git.

License

MPL-2.0