@panaversity/ksor 0.0.55 → 0.0.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,195 @@
1
1
  # @panaversity/ksor
2
2
 
3
+ ## 0.0.56
4
+
5
+ ### Patch Changes
6
+
7
+ - bf35e2f: `add-sources` 2.0.0: a file or a person, one skill — with a check the agent
8
+ runs instead of a rule it is asked to follow.
9
+
10
+ Two issues asked for two paths into the record. #31: an owner with a folder of
11
+ PDFs had no path — the skill stated the rules and converted nothing. #50: an
12
+ owner whose knowledge is only in their head had no path — the interview scoped
13
+ the record and stopped, leaving `knowledge/` full of samples about KSoR.
14
+
15
+ **They are one skill, not two.** The record draws no line between the kinds:
16
+ an interview attestation in `sources[].resource` passes `ksor build` today,
17
+ the fidelity rules read the same for both, and a real owner has BOTH — the
18
+ policy PDF and the exception everyone knows that the PDF never mentions. So
19
+ the person step runs after every file: "what does this not cover?" is the
20
+ question that finds the pages nobody wrote. A sibling skill would have made
21
+ the agent choose before it knew, and #50's own three-way trigger collision
22
+ vanishes.
23
+
24
+ **The source is a file.** Extract first, into a scratch file outside
25
+ `knowledge/` — the skill names the extractor per format (`pdftotext`,
26
+ `pandoc`, macOS `textutil`, `markitdown`) and what to do with none on `PATH`:
27
+ read the file directly and SAY the verification that follows is weaker. An
28
+ empty extraction is a scanned image, and the skill stops and tells the owner
29
+ rather than OCR and hope. Then decide the shape of the record, convert to
30
+ CommonMark a person would have written, name the source precisely, and run
31
+ the shipped check:
32
+
33
+ ```
34
+ node .agents/skills/add-sources/verify.mjs /tmp/in.txt knowledge/<path>.md
35
+ ```
36
+
37
+ `verify.mjs` — plain Node, no dependencies, the owner's to keep — lists every
38
+ number, date, threshold, code and capitalised name in the document's body that
39
+ does not appear in the extraction, case-folded and whitespace-collapsed.
40
+ Frontmatter and footnote ids are exempt, because they are the agent's words by
41
+ design. It is a floor, and says so: a value that passes was in the source; it
42
+ cannot see a value that was dropped, and it cannot tell a paraphrase from an
43
+ invention. Model-driven conversion is highest-fidelity for layout and
44
+ lowest for exact values, and this is the mechanical half of "copy load-bearing
45
+ values exactly".
46
+
47
+ **The source is a person.** Ask one question at a time in their words — who
48
+ triggers it, the steps, who approves and at what threshold, what goes wrong,
49
+ the exception — until someone who was not in the room could act on it. Draft
50
+ as the record, not a transcript; anything unconfirmed is an `Open question:`
51
+ line, never prose. The attestation goes in `sources` (who, role, instant,
52
+ conducted by) — there is no `provenance:` key, and no transcript is kept.
53
+ Two people describing one process differently stay two cited statements.
54
+
55
+ **Both end the same way, and the ending is new.** Read it back on `pnpm dev`,
56
+ then ask the owner to approve and write down what they said. A draft reaches
57
+ no machine surface, so a skill that stopped at the draft left every `llms.txt`
58
+ and every door empty — found on the journey walk: `1 document(s), 0 admitted`.
59
+
60
+ The rules that were restated here (placement, frontmatter, audience,
61
+ deprecation) now point at the emitted AGENTS.md instead. The trigger test that
62
+ asserted "no skill claims dictated knowledge" flips: add-sources claims it by
63
+ name, and no other skill may. Eleven cases hold `verify.mjs` to what it does
64
+ and, in three of them, to what it does not claim.
65
+
66
+ - 73530e6: Prune the scaffold's skills to the three that make a record, and fix the two
67
+ seams every adopter hits on the way to one.
68
+
69
+ **Removed: `make-slides` and `make-summary`.** They were 45% of all shipped
70
+ skill text and 21.6% identical to each other — their own commit says
71
+ "make-summary is make-slides' discipline applied to prose". A companion is
72
+ downstream of a record existing and invisible to the agent surface (no route,
73
+ no `llms.txt` line, no MCP node); no fixture and no tutorial ever fired either;
74
+ and neither was ever shown to beat its absence, which is the bar AGENTS.md sets
75
+ for keeping a skill at all. Their one real rule — a card may only say what its
76
+ document says — already lives in the emitted AGENTS.md, and the site renders
77
+ companions exactly as before. Verified: the emitted checker passes with both
78
+ gone. `format-checker/SKILL.md` is cut to what AGENTS.md does not say; the
79
+ program it names is unchanged.
80
+
81
+ **Fixed: `intake-interview` was contradicting itself in its trigger.** The
82
+ always-resident description promised "seven questions"; the body has asked
83
+ three since 2026-08-26. The body handed off to "question 4" and "question 5",
84
+ neither of which exists, and claimed `add-sources` writes `verified:` entries —
85
+ nothing does. 1.6.0 says three, hands off to add-sources with whatever material
86
+ the owner has, and drops the false claim.
87
+
88
+ **Fixed: the recommended path turned a green record red.** Walked on the
89
+ published package:
90
+
91
+ - The README said run the interview, then "delete each starter as your own
92
+ knowledge arrives". Delete the five first and the build refuses
93
+ `ksor-record-empty` and writes nothing — a slug named by no document an
94
+ adopter reads. The README now says to write and approve one document of
95
+ your own before the last starter goes, and names the refusal.
96
+ - The hello-world tutorial approves as `human:you`. The interview then retires
97
+ `human:you` from the policy, and the tutorial's own document — still approved
98
+ by an actor the policy no longer names — refuses `ksor-approver-unauthorised`.
99
+ The interview now re-attributes every act recorded under the placeholder to
100
+ the owner's handle in the same change: it is the same person.
101
+
102
+ **Consolidated:** "the record says only what its source says — a gap is an
103
+ open question, never filled from general knowledge" lived only inside
104
+ `add-sources`; it is now stated once in the emitted AGENTS.md where every
105
+ other writing rule is.
106
+
107
+ Two deterministic gates hold all of this: a skill-consistency lint (a trigger's
108
+ question count matches its body; every "question N" resolves; every refusal
109
+ slug a document names is one the product raises; every skill a document names
110
+ ships) and a journey walk against the built CLI (interview → one draft →
111
+ approve → delete starters → retire the starter actor, plus the exact state
112
+ each refusal fires on). Every lint assertion was mutation-tested.
113
+
114
+ Found by four independent reviews of the plan to build a system of record,
115
+ before building any of it.
116
+
117
+ - ab6a3ed: The agent tier: a shipped skill, run by a real coding agent, with the skill
118
+ and without it — the comparison AGENTS.md has always demanded and nothing had
119
+ ever run (issue #30).
120
+
121
+ `pnpm test:agent` scaffolds a fresh record, installs it, drops a real two-page
122
+ PDF in `src/`, and hands `claude -p` the prompt tutorial 2 hands the reader.
123
+ Once with `add-sources` present, once with it removed. What the agent leaves
124
+ behind is graded, and the split is the Testing contract's own: deterministic
125
+ behavioural graders GATE the with-skill arm — exactly one new document, under
126
+ `finance/`; `.ksor/*` and `instance.md` untouched; the record builds; `status:
127
+ draft`, `sources` present, no `id:`/`name:`; page furniture gone; every
128
+ number, date and name in the body found in the extraction by the shipped
129
+ `verify.mjs`. Cost, turns, duration and the baseline arm are REPORTED, so the
130
+ delta is visible and a skill that stops winning is seen.
131
+
132
+ "Checker passes" is deliberately not a grader: while this was being designed a
133
+ baseline run passed the checker by hand-authoring `index.md` and editing
134
+ `.ksor/people.yaml` — the worse behaviour scoring better. Files touched is the
135
+ discriminating assertion.
136
+
137
+ It spends model tokens, so it is gated like the database tier: on
138
+ `ANTHROPIC_API_KEY` in CI (a repository secret the owner has not yet added; the
139
+ tier runs and reports itself skipped until then) or a logged-in `claude`
140
+ locally, pins a mid-tier model by default (a one-word reply on the default
141
+ model measured $0.25), and runs from `skill-evals.yml` on push to main and by
142
+ hand — never per pull request.
143
+
144
+ What it cannot measure is written in the suite rather than implied: a
145
+ conversational skill needs a scripted owner, "reads as a finished page" needs
146
+ a browser, and the adopter's own model is whatever they run.
147
+
148
+ Decision 31 records the three choices this week made about the skill surface —
149
+ pruned to three, one skill for a file and a person, and this harness shape
150
+ over the Python trigger script that was proposed and measured wanting.
151
+
152
+ - c34cc3a: Tutorial 2, _Make it yours_: the walk from hello world's record to one that is
153
+ only the owner's — every output run and pasted as it appeared.
154
+
155
+ The intake interview and what it does to the placeholder approver; one policy
156
+ brought in from a real PDF, with the shipped check catching the one number the
157
+ conversion got wrong; one procedure that only ever lived in someone's head,
158
+ written with the thing they were not sure of as an open question rather than
159
+ prose; the read-back on the site and the approval act; then the samples go and
160
+ the tool that approved them leaves the policy. Two refusals do work on the way,
161
+ and the tutorial says exactly which state each fires on.
162
+
163
+ The prompt-accounting test now covers both tutorials from one table, so a new
164
+ prompt in either fails until someone names the skill that answers it. Only that
165
+ test changes under `packages/`; nothing an adopter installs behaves differently.
166
+
167
+ - 87a3542: Correct a claim the tutorial made about `build_id`, and guard the general rule.
168
+
169
+ `buildIdOf` hashes `ksor_version` along with the record — deliberately, because
170
+ "what produced this" is part of what a publication is. So a captured `build_id`
171
+ is correct for exactly one release, and the sentence 0.0.54's tutorial fix added
172
+ — "Your timestamp will differ; the `build_id` will not" — was already false when
173
+ 0.0.55 published it. A reader on any later ksor sees a hash that does not match
174
+ theirs and nothing saying why.
175
+
176
+ Found by walking the published package rather than by reading the diff: the same
177
+ practice that caught the tutorial being uncompletable caught the correction being
178
+ wrong.
179
+
180
+ The tutorial now says the id carries the toolchain, names the version its
181
+ outputs were captured on, and points at the reproducibility a reader can
182
+ actually check — run `ksor build` twice on one tree and the id is identical.
183
+ Both captured blocks are re-taken from a 0.0.55 walk.
184
+
185
+ A guard in `docs-truth.integration.test.ts` holds the general rule rather than
186
+ the sentence: a document printing a concrete `build_id` must say what moves one,
187
+ within 700 characters of the id. It is PROXIMITY rather than presence — the
188
+ first version asked whether "toolchain" appeared anywhere in the file, the file
189
+ already used the word once for an unrelated reason, and removing the caveat left
190
+ it green. Caught by mutation, and the tightened version immediately found a
191
+ second uncaveated id in the same document.
192
+
3
193
  ## 0.0.55
4
194
 
5
195
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panaversity/ksor",
3
- "version": "0.0.55",
3
+ "version": "0.0.56",
4
4
  "description": "Knowledge System of Record — compile governed markdown into a static site for people and an MCP server for AI agents, with citations and measured abstention.",
5
5
  "keywords": [
6
6
  "abstention",
@@ -1,91 +1,136 @@
1
1
  ---
2
2
  name: add-sources
3
- description: Turn source materialdocuments, pages, pasted text, notes into governed knowledge in knowledge/. Use when the owner shares material to add, says "add this to the knowledge base", or asks how to get existing content in. Not for editing the site.
3
+ description: Turn what the owner has into governed knowledge in knowledge/ a document, a page, pasted text, notes, or something nobody ever wrote down that they tell you. Use when the owner shares material to add, says "add this to the knowledge base", asks how to get existing content in, or wants to write down what they know from memory with no source to hand. Not for editing the site.
4
4
  metadata:
5
- version: "1.3.0"
5
+ version: "2.0.0"
6
6
  ---
7
7
 
8
8
  # Add sources
9
9
 
10
- Converting material into the record is the everyday work of this project.
11
- The rules that make it _governed_ rather than merely stored:
12
-
13
- ## Placement and shape
14
-
15
- - One document per topic, under `knowledge/`, path = identity: lowercase,
16
- hyphens, a folder per natural grouping. Plain CommonMark `.md` if the
17
- source is rich (tables, images), tables become markdown tables and images
18
- land _beside the document_ with relative links.
19
- - A folder's `index.md` is GENERATED by `ksor build` and committed — never
20
- author one. A folder's own introduction is a named document inside it,
21
- such as `overview.md`. Reading order is the `order:` frontmatter key
22
- (ordered documents first, ascending; the rest follow alphabetically)
23
- never `meta.json` or `sidebar_position`.
24
- - Frontmatter is the KSoR Profile of OKF. Always: `type: Document`, `title`,
25
- `description` (one sentence), `status: draft`, and `ksor.audience` (a
26
- list). Reach for a reserved `type` `Policy`, `Procedure`, `Control`,
27
- `Standard`, `Definition`, `Decision Record`, `Example`,
28
- `Attested Computation` when the knowledge really is one; those additionally require `sources` and
29
- `ksor.owner`, which is the point of them.
30
-
31
- ```yaml
32
- ---
33
- type: Policy
34
- title: Purchase approval
35
- description: Who may approve a purchase, at which thresholds.
36
- status: draft
37
- sources:
38
- - id: fin-2025
39
- title: Finance policy manual §4.2, 2025 edition
40
- resource: https://intranet.example.com/finance/manual.pdf
41
- ksor:
42
- audience: [public]
43
- owner: team:finance
44
- ---
45
-
46
- A purchase above 10,000 needs a director's signature. [^fin-2025]
47
-
48
- [^fin-2025]: Finance policy manual §4.2, 2025 edition.
49
- ```
50
-
51
- Every source needs a `resource` a URL where one exists, otherwise the
52
- scope descriptor that names it ("Finance policy manual §4.2, 2025
53
- edition"). Precision matters: that governs; "internal docs" does not. A
54
- claim cites ONE of them by footnote, and the label must match a
55
- `sources[].id` or the checker refuses it.
56
-
57
- - `status: draft` always, and never anything else from here: `stable` needs
58
- `ksor.approval` by an actor `.ksor/governance.yaml` names, and recording
59
- an approval nobody gave is the one thing this skill must never do. Ask the
60
- owner; if they approve, THEY are the approver and you write down what they
61
- said.
62
- - When `.ksor/governance.yaml` registers audiences, ask the owner which of
63
- them may read the new material and list every one in `ksor.audience` —
64
- never guess that restricted material is public, and never write an
65
- identifier the registry does not declare (the checker refuses it, because
66
- a typo reads as a restriction).
67
-
68
- ## Fidelity rules
69
-
70
- - **Copy load-bearing values exactly** numbers, thresholds, dates, names.
71
- Never round, never paraphrase a figure.
72
- - **Two disagreeing sources stay two statements**, each with its own
73
- footnote never smooth a conflict into one invented truth; flag it to the
74
- owner.
75
- - **Do not fill gaps from general knowledge.** If the source doesn't cover
76
- something, the record doesn't either — that boundary is the product.
77
- - A document replacing an older one: mark the old one `status: deprecated`
78
- with `ksor.deprecated: { by, at }` (a takedown authority the policy names, or
79
- the owner an `ownership:` rule resolves — never the document's own
80
- `ksor.owner`; ask, never guess) and `ksor.superseded_by:` naming the
81
- successor by id (`policies/refunds-v2`, no `./` and no `.md`) never
82
- delete it. The successor must exist, be `stable`, and be readable by every
83
- reader of the deprecated one.
84
-
85
- ## Finish every batch
86
-
87
- Run `pnpm check` and fix what it reports (its errors explain themselves),
88
- then `ksor build` to regenerate every folder's `index.md` and write
89
- `build.lock.json`, and commit both with the documents. Then show the owner
90
- the rendered result (`pnpm dev`) the site is the review surface: you write,
91
- they check.
10
+ Getting knowledge into the record is the everyday work of this project. The
11
+ rules that make it _governed_ are in `AGENTS.md` → "Writing knowledge" (shape,
12
+ frontmatter, audience, `draft` until the owner approves, copy values exactly,
13
+ never invent). This file is the ACT: how a source becomes a document that
14
+ passes those rules, whatever kind of source it is.
15
+
16
+ ## The source is one of two kindsand usually both
17
+
18
+ **A file** PDF, Word, slides, HTML, a Notion export, pasted text — is
19
+ knowledge that already exists somewhere. Your job is to move it without losing
20
+ anything: convert it, structure it, and prove every load-bearing value survived.
21
+
22
+ **A person** "it's just how we do it" is knowledge that exists nowhere
23
+ yet. Your job is to draw it out by asking, write it as the record and not as a
24
+ transcript, and record only what they confirm.
25
+
26
+ A real owner has both: the policy PDF, and the exception everyone knows that
27
+ the PDF never mentions. So the person step runs EVERY time, after the file:
28
+ "what does this not cover?" is the question that finds the pages nobody wrote.
29
+
30
+ ## When the source is a file
31
+
32
+ 1. **Extract the text first, into a scratch file outside `knowledge/`.** The
33
+ extraction is what you convert from and what you verify against, so it has
34
+ to be a file you can grep, not something you remember reading:
35
+
36
+ | format | extractor |
37
+ | ------------------------ | ------------------------------------------------------------------- |
38
+ | PDF | `pdftotext -layout in.pdf /tmp/in.txt` (poppler) |
39
+ | docx / odt / html / epub | `pandoc in.docx -t gfm -o /tmp/in.md` |
40
+ | docx on macOS | `textutil -convert txt in.docx -output /tmp/in.txt` (built in) |
41
+ | anything | `markitdown in.pdf > /tmp/in.md`, if installed |
42
+ | Notion / Obsidian export | already markdown — no extraction needed; the file IS the extraction |
43
+
44
+ None on `PATH`? Read the file directly (your Read tool opens PDFs) and say so
45
+ in your report — there is then no extraction to verify against, and step 5
46
+ degrades to re-reading the source by eye. That is a weaker check, and the
47
+ owner must be told it was the check that ran.
48
+
49
+ **Empty extraction — whitespace, form-feeds, nothing — means the PDF has no
50
+ text layer.** Stop and tell the owner: "This is a scanned image. I can read it
51
+ as a picture, but I cannot promise the numbers in it are right, and a wrong
52
+ threshold in a system of record is worse than a missing page. Give me a text
53
+ PDF, or paste the section you need." Do not OCR it and hope.
54
+
55
+ 2. **Decide the shape of the RECORD, not of one file.** A 200-page manual is not
56
+ one document. One document per topic — the unit someone would ask a question
57
+ about placed where its path is the identity it should have, with `order:`
58
+ set to reading order. Show the owner the proposed tree before writing it.
59
+
60
+ 3. **Convert to CommonMark a person would have written.** Real headings from
61
+ the document's own structure (never an `# h1` — the title is the frontmatter),
62
+ real lists, real tables; images extracted and placed beside the document
63
+ with relative links. Strip page furniture: running headers and footers, page
64
+ numbers, "Page 4 of 12", the table of contents. Keep the source's own words
65
+ for anything load-bearing.
66
+
67
+ 4. **Name the source precisely** in `sources` — a URL where one exists,
68
+ otherwise the descriptor that governs ("Finance policy manual §4.2, 2025
69
+ edition"; "internal docs" governs nothing) — and cite it from the claim with
70
+ a footnote whose label is that source's `id`.
71
+
72
+ 5. **Verify do not trust yourself.** Run the shipped check against the
73
+ extraction from step 1:
74
+
75
+ ```sh
76
+ node .agents/skills/add-sources/verify.mjs /tmp/in.txt knowledge/<path>.md
77
+ ```
78
+
79
+ It lists every load-bearing token in the document's body — numbers, dates,
80
+ thresholds, codes, capitalised names that does not appear in the
81
+ extraction. Each one is either a value you changed (fix it, verbatim) or a
82
+ value you introduced (delete it, or turn it into an `Open question:` line
83
+ for the owner). A value that passes was in the source; nothing more is
84
+ claimed. Frontmatter is exempt, because its title and description are your
85
+ words by design.
86
+
87
+ ## When the source is a person
88
+
89
+ 1. **Ask, one question at a time, in their words.** Who triggers this? What
90
+ happens first, then next? Who has to approve, and at what threshold? What
91
+ goes wrong, and what is the exception? Follow up until each answer is
92
+ concrete enough that someone who was not in the room could act on it —
93
+ "what would someone actually ask this?" gets further than "define the
94
+ boundary".
95
+
96
+ 2. **Draft as the record, not as a transcript.** One document per topic. Their
97
+ sentences, tightened — never your inference about what they must have
98
+ meant. Anything they did not say, or said they were not sure of, becomes an
99
+ `Open question:` line in the document. It does not become prose.
100
+
101
+ 3. **The source is the conversation, and it is named like any other.** No
102
+ `provenance:` key exists; the attestation goes in `sources`:
103
+
104
+ ```yaml
105
+ sources:
106
+ - id: ops-interview-2026-08-21
107
+ title: Interview with J. Smith, Head of Operations
108
+ resource: "Interview with human:jsmith (Head of Operations), 2026-08-21T10:00:00Z, conducted by human:you"
109
+ ```
110
+
111
+ Who, their role, the instant, and who asked. That is a claim nobody can
112
+ check against a file, and the pull request that adds it is the only thing
113
+ standing behind it — say so if the owner asks what "verified" would mean
114
+ here. No transcript is kept: raw unreviewed speech does not belong in a
115
+ governed record, and the checker refuses a `.txt` there anyway.
116
+
117
+ 4. **Two people describe one process differently — surface it, never smooth
118
+ it.** Two cited statements, each with its own footnote, and the
119
+ disagreement flagged to the owner. Which one becomes `stable` is an
120
+ approval, not an edit.
121
+
122
+ ## Finish — every batch, either kind
123
+
124
+ - `pnpm check`, and obey what it prints.
125
+ - `ksor build`: it regenerates every folder's `index.md` and writes the lock.
126
+ - **Read it back on the site.** `pnpm dev` renders the real page, drafts
127
+ marked; that page is what the owner confirms against, not a message in a
128
+ terminal. "Their words, tightened — never your invention" is the standard,
129
+ and it is theirs to say whether you met it.
130
+ - **Then ask them to approve it — and write down what they said.** A draft
131
+ reaches no machine surface: no `llms.txt`, no `/md/` twin, nothing for an
132
+ agent to cite. Until the owner says "approved" and you record
133
+ `ksor.approval: { by: <their handle>, at: <now> }` with `status: stable`,
134
+ the record still publishes nothing of theirs. Never record an approval
135
+ nobody gave.
136
+ - Commit the documents, the indexes and the lock together.
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env node
2
+ // Did the document keep its source's load-bearing values?
3
+ //
4
+ // node verify.mjs <extraction.txt> <document.md>
5
+ //
6
+ // Exit 0 when every load-bearing token in the document's BODY appears in the
7
+ // extraction; exit 1 and print each one that does not, one per line.
8
+ //
9
+ // What "load-bearing" means here: numbers (with their separators — 10,000 and
10
+ // 10000 are different claims about the source), dates, codes, and runs of two
11
+ // or more capitalised words (a name). Matched case-folded and with whitespace
12
+ // collapsed, because an extraction shouts its headings and wraps its lines.
13
+ //
14
+ // What this proves, and no more: a token that PASSES is present in the source.
15
+ // A token that FAILS was changed or introduced — either way, look at it. It
16
+ // cannot tell a paraphrase from an invention, and it cannot see a value that
17
+ // was dropped. It is a floor under model-driven conversion, which is highest
18
+ // fidelity for layout and lowest for exact values (issue #31).
19
+ //
20
+ // Plain Node, no dependencies, safe to copy: `.agents/skills/` is the owner's.
21
+
22
+ import { readFileSync } from "node:fs";
23
+
24
+ const [, , extractionPath, documentPath] = process.argv;
25
+ if (!extractionPath || !documentPath) {
26
+ console.error("usage: node verify.mjs <extraction.txt> <document.md>");
27
+ process.exit(2);
28
+ }
29
+
30
+ const fold = (s) => s.toLowerCase().replace(/\s+/g, " ");
31
+
32
+ const extraction = fold(readFileSync(extractionPath, "utf8"));
33
+ const raw = readFileSync(documentPath, "utf8");
34
+
35
+ // Body only: frontmatter is the agent's own words by design (title,
36
+ // description, ids). Footnote labels and definition prefixes are ids too.
37
+ const body = raw.replace(/^---\n[\s\S]*?\n---\n?/, "").replace(/\[\^[^\]]+\]:?/g, " ");
38
+
39
+ const tokens = new Set();
40
+ for (const m of body.matchAll(/\d[\d,.:/-]*\d|\d/g)) tokens.add(m[0]);
41
+ for (const m of body.matchAll(/\b[A-Z][a-z]+(?:\s+[A-Z][a-z]+)+\b/g)) tokens.add(m[0]);
42
+
43
+ const missing = [...tokens].filter((t) => !extraction.includes(fold(t))).sort();
44
+ for (const t of missing) console.log(t);
45
+ process.exit(missing.length === 0 ? 0 : 1);
@@ -2,54 +2,26 @@
2
2
  name: format-checker
3
3
  description: The record's format rules as a runnable check — frontmatter, filenames, links, structure. Use before handing off any change to knowledge/, when a check fails and you need to fix it, or when unsure whether a document is well-formed. Run with `pnpm check` (or node .agents/skills/format-checker/check.mjs).
4
4
  metadata:
5
- version: "2.1.0"
5
+ version: "3.0.0"
6
6
  ---
7
7
 
8
8
  # Format checker
9
9
 
10
- `pnpm check` runs `check.mjs` a self-contained Node program that needs no
11
- install. It is **generated** by ksor from the same rule set `ksor build` and
12
- `ksor ingest` run, so the three can never disagree about what a well-formed
13
- record is. Do not edit it: `ksor init` writes it and `ksor migrate` rewrites
14
- both copies of it when you upgrade the tool, so an edit is overwritten rather
15
- than kept. It is read-only in the other direction too — it reports, and never
16
- rewrites a file.
10
+ `pnpm check` runs `check.mjs`. The rules it holds the record to are the ones in
11
+ `AGENTS.md` "Writing knowledge"; this file says only what that section does
12
+ not, which is how to relate to the program.
17
13
 
18
- If its refusals contradict this document, the checker is older than the record:
19
- upgrade `@panaversity/ksor` and re-run `ksor migrate`, and never "fix" the
20
- record by undoing what the migration wrote.
21
-
22
- What it holds the record to (the full contract is ksor's record spec):
23
-
24
- - Every document in `knowledge/` is a concept in the KSoR Profile of OKF:
25
- frontmatter is real YAML carrying `type`, `title`, `description`, `status`
26
- (`draft | stable | deprecated`) and `ksor.audience` (a list; `public` or
27
- audiences registered in `.ksor/governance.yaml`). A `stable` concept carries
28
- `generated` and an approval by an authorised actor; a `deprecated` one says
29
- who deprecated it and usually names its successor; a reserved type (`Policy`,
30
- `Procedure`, …) names `sources` and `ksor.owner`. Every timestamp is an
31
- instant with an offset; every footnote label matches a `sources[].id`.
32
- - `.ksor/governance.yaml` exists and names approval and takedown authorities;
33
- `.ksor/takedowns.yaml` is append-only, every entry by a takedown authority,
34
- and never names a concept that no longer exists.
35
- - `index.md` files are generated by `ksor build`, never authored — a stale or
36
- missing one is refused (`ksor-index-stale`; run `ksor build`). `log.md` and
37
- `README.md` are reserved names.
38
- - Filenames are portable identities: lowercase ascii, no spaces, no
39
- case-collisions, no `x.md` beside `x/`, no parentheses or leading
40
- underscore. `knowledge/` holds `.md`, companions (`<doc>.summary.md`,
41
- `<doc>.{flashcards,quiz,slides}.yaml`) and images only.
42
- - Links resolve inside `knowledge/` — inline, `<angle-bracketed>` and
43
- reference-style alike; code is never a link — and never reach a document
44
- that not every reader of the source may read (the widening rule).
45
- - `instance.md` is `format: 2` with the closed key set the profile defines.
46
- - `CLAUDE.md` stays a one-line pointer; `.agents/skills/` and
47
- `.claude/skills/` hold the same files byte for byte in both directions; the
48
- site contains no content files.
49
-
50
- Every failure prints where, the rule's slug (`problem: ksor-…`), why the rule
51
- exists, and the fix — obey the printed fix literally; if it doesn't resolve
52
- the problem, that is a bug worth reporting to ksor.
53
-
54
- When you edit any skill under `.agents/skills/`, re-copy it to
55
- `.claude/skills/` — the checker holds the two trees identical.
14
+ - **It is generated, and it is the same rule set** `ksor build` and
15
+ `ksor ingest` run, so the three can never disagree about a well-formed
16
+ record. Do not edit it: `ksor init` writes it and `ksor migrate` rewrites both
17
+ copies when you upgrade, so an edit is overwritten rather than kept. It
18
+ reports and never rewrites a file.
19
+ - **Obey the printed fix literally.** Every refusal prints where, the rule's
20
+ slug (`problem: ksor-…`), why the rule exists, and the fix. If the fix does
21
+ not resolve the problem, that is a bug worth reporting to ksor.
22
+ - **If its refusals contradict `AGENTS.md`, the checker is older than the
23
+ record**: upgrade `@panaversity/ksor` and re-run `ksor migrate`. Never "fix"
24
+ the record by undoing what a migration wrote.
25
+ - **When you edit any skill under `.agents/skills/`, re-copy it to
26
+ `.claude/skills/`** the checker holds the two trees byte-identical in both
27
+ directions.
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: intake-interview
3
- description: The first conversation with the owner of this Knowledge System of Record — seven questions that define what it is authoritative for, who may read it and who may approve it, then write instance.md together. Use when the owner asks to set up, configure, or "get started with" this project, when instance.md still contains its scaffold placeholder text, or when the scope of the corpus is unclear.
3
+ description: The first conversation with the owner of this Knowledge System of Record — three questions that define what it is authoritative for, who may read it and who may approve it, then write instance.md together. Use when the owner asks to set up, configure, or "get started with" this project, when instance.md still contains its scaffold placeholder text, or when the scope of the corpus is unclear.
4
4
  metadata:
5
- version: "1.5.0"
5
+ version: "1.6.0"
6
6
  ---
7
7
 
8
8
  # Intake interview
@@ -123,9 +123,10 @@ never an email address.
123
123
  Leave `name:` and `toolchain:` alone. One block is added here only when
124
124
  the owner stands up the served MCP rung — `database:`/`embedding:`/
125
125
  `retrieval:` (see `AGENTS.md` → "Serving to agents"; that is a later
126
- climb, not part of this interview). The strictness answer from question 5
127
- is the intent behind the `retrieval.vector_floor` on that climb, measured
128
- by `ksor calibrate` — capture it in the prose now so it is ready.
126
+ climb, not part of this interview). The `declines` default above (or the owner's
127
+ correction to it) is the intent behind the `retrieval.vector_floor` on that
128
+ climb, measured by `ksor calibrate` — capture it in the prose now so it is
129
+ ready.
129
130
  - Write `.ksor/governance.yaml` from question 3: `version: "0.1"`,
130
131
  the `audiences:` registry if there is one, and the two authority sets with
131
132
  real actors. That file is the root of authority — every approval, every
@@ -134,12 +135,19 @@ never an email address.
134
135
  document is still in `knowledge/`.** Those five are approved by it, so a
135
136
  policy rewritten without it refuses the next build by name
136
137
  (`ksor-approver-unauthorised`). It leaves when the last sample does.
138
+ - **Re-attribute what `human:you` already did.** If any document carries
139
+ `human:you` as its approver, generator or deprecator — the hello-world
140
+ tutorial's own document does — rewrite those acts to the owner's handle in
141
+ the SAME change that retires the placeholder from the policy. It is the same
142
+ person. A policy that stops naming `human:you` beside a document that still
143
+ cites it turns a green record red (`ksor-approver-unauthorised`), and the
144
+ owner's first act after being interviewed should not be a refusal.
137
145
  - Write `.ksor/people.yaml` from question 3: `version: "0.1"` and a `people:`
138
146
  MAP from each actor to its natural name — `"human:bashiraziz": Bashir Aziz`.
139
147
  Keyed by the actor exactly as the record stores it, quoted because it
140
148
  contains a colon. Nothing else — the site looks the actor up at render time,
141
149
  so pages read "Owner · Bashir Aziz" instead of "Owner · human:bashiraziz". Every skill that records a governance
142
- act (this one, add-sources for `verified:` entries, `ksor takedown` for
150
+ act (this one, add-sources when it names a `ksor.owner`, `ksor takedown` for
143
151
  withdrawals) asks the owner for a natural name whenever it is about to write
144
152
  an actor that isn't in `people.yaml` yet — the owner is the only source of a
145
153
  display name, never a convention-based guess.
@@ -162,7 +170,7 @@ never an email address.
162
170
  the new title and refuses anything the profile does not accept.
163
171
  - Restart `pnpm dev` afterwards so the site picks the new title up, and
164
172
  show the owner their name on the page.
165
- - Offer to capture the source list from question 4 as the first real
166
- documents (the add-sources skill takes it from there).
173
+ - Offer to start on the owner's own documents: the add-sources skill takes
174
+ whatever material they have from there.
167
175
  - Read the result back to the owner and get an explicit yes before
168
176
  finishing. Their words, tightened — never your invention.