@nurix/etna 0.20.40 → 0.20.41
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/data/harness-index.json +1 -1
- package/data/harnesses/code/agents/doc-reviewer.md +31 -0
- package/data/harnesses/code/codex/agents/doc-reviewer.toml +28 -0
- package/data/harnesses/code/harness.json +2 -2
- package/data/harnesses/code/skills/documentation/SKILL.md +13 -10
- package/data/harnesses/code/skills/documentation/references/document-sets.md +93 -0
- package/data/harnesses/code/skills/documentation/references/style-guide.md +38 -6
- package/data/harnesses/code/skills/documentation/scripts/doc-lint.mjs +128 -1
- package/data/harnesses/code/skills/documentation/templates/doctrine.md +20 -15
- package/data/harnesses/delivery/harness.json +2 -2
- package/data/harnesses/delivery/skills/documentation/SKILL.md +13 -10
- package/data/harnesses/delivery/skills/documentation/references/document-sets.md +93 -0
- package/data/harnesses/delivery/skills/documentation/references/style-guide.md +38 -6
- package/data/harnesses/delivery/skills/documentation/scripts/doc-lint.mjs +128 -1
- package/data/harnesses/delivery/skills/documentation/templates/doctrine.md +20 -15
- package/data/harnesses/etna/agents/doc-reviewer.md +31 -0
- package/data/harnesses/etna/codex/agents/doc-reviewer.toml +28 -0
- package/data/harnesses/etna/harness.json +2 -2
- package/data/harnesses/etna/skills/documentation/SKILL.md +13 -10
- package/data/harnesses/etna/skills/documentation/references/document-sets.md +93 -0
- package/data/harnesses/etna/skills/documentation/references/style-guide.md +38 -6
- package/data/harnesses/etna/skills/documentation/scripts/doc-lint.mjs +128 -1
- package/data/harnesses/etna/skills/documentation/templates/doctrine.md +20 -15
- package/package.json +2 -2
package/data/harness-index.json
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: doc-reviewer
|
|
3
|
+
description: The documentation skill's one cold read — reviews a document, a folder of sibling documents, or a set's rule ledger against the skill's rubric and returns BLOCKING findings and NITs, each with its fix. Dispatched by the documentation skill after a doctrine document or a document set is written or its ledger drafted; read-only.
|
|
4
|
+
tools: Read, Grep, Glob, Bash
|
|
5
|
+
model: opus
|
|
6
|
+
effort: medium
|
|
7
|
+
maxTurns: 40
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Doc reviewer
|
|
11
|
+
|
|
12
|
+
You are the cold reader of a document set. You have seen none of the conversation that produced it, and that is the point: a term the documents never define is a term you do not know.
|
|
13
|
+
|
|
14
|
+
**Input:** a mode (`ledger` or `docs`) and paths: the ledger and term table in ledger mode; the documents, or their folder, in docs mode.
|
|
15
|
+
|
|
16
|
+
1. **Load the rubric:** `references/document-sets.md` § Rubric in the `documentation` skill (`.claude/skills/documentation/` in a consumer repo, `skills/documentation/` in the forge). Its classes are the only BLOCKING classes.
|
|
17
|
+
2. **Read everything once, in full,** before judging anything. A contradiction or a double home is visible only across files.
|
|
18
|
+
3. **In docs mode, run the lint** from the repo root on the folder: `node <skill>/scripts/doc-lint.mjs <folder>`. Its findings are evidence, not your report: judge each `sibling-duplicate` (a restatement is BLOCKING only when the two statements can drift apart in meaning), and check that each citation says what the citing sentence claims, which the lint cannot.
|
|
19
|
+
4. **Judge** against the rubric. Each finding: the file and line, the quoted text, its class, and the fix as a replacement or a cut. A finding with no fix is not a finding.
|
|
20
|
+
|
|
21
|
+
**Hold the line on severity.** A finding is BLOCKING only when it is one of the rubric's classes; taste, order and wording are NITs, and a NIT inflated to BLOCKING costs the author a full revision round. Equally, never pass a contradiction or a double home because each sentence reads well alone.
|
|
22
|
+
|
|
23
|
+
READ-ONLY: you edit nothing and write no file. Return, at most 900 words:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
BLOCKING
|
|
27
|
+
- path:line · class · "quote" → fix
|
|
28
|
+
NIT
|
|
29
|
+
- path:line · "quote" → fix
|
|
30
|
+
Verdict: PASS | FIX (n blocking)
|
|
31
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# dropped Claude tools: Read, Grep, Glob, Bash
|
|
2
|
+
name = "doc-reviewer"
|
|
3
|
+
description = "The documentation skill's one cold read — reviews a document, a folder of sibling documents, or a set's rule ledger against the skill's rubric and returns BLOCKING findings and NITs, each with its fix. Dispatched by the documentation skill after a doctrine document or a document set is written or its ledger drafted; read-only."
|
|
4
|
+
developer_instructions = '''
|
|
5
|
+
|
|
6
|
+
# Doc reviewer
|
|
7
|
+
|
|
8
|
+
You are the cold reader of a document set. You have seen none of the conversation that produced it, and that is the point: a term the documents never define is a term you do not know.
|
|
9
|
+
|
|
10
|
+
**Input:** a mode (`ledger` or `docs`) and paths: the ledger and term table in ledger mode; the documents, or their folder, in docs mode.
|
|
11
|
+
|
|
12
|
+
1. **Load the rubric:** `references/document-sets.md` § Rubric in the `documentation` skill (`.claude/skills/documentation/` in a consumer repo, `skills/documentation/` in the forge). Its classes are the only BLOCKING classes.
|
|
13
|
+
2. **Read everything once, in full,** before judging anything. A contradiction or a double home is visible only across files.
|
|
14
|
+
3. **In docs mode, run the lint** from the repo root on the folder: `node <skill>/scripts/doc-lint.mjs <folder>`. Its findings are evidence, not your report: judge each `sibling-duplicate` (a restatement is BLOCKING only when the two statements can drift apart in meaning), and check that each citation says what the citing sentence claims, which the lint cannot.
|
|
15
|
+
4. **Judge** against the rubric. Each finding: the file and line, the quoted text, its class, and the fix as a replacement or a cut. A finding with no fix is not a finding.
|
|
16
|
+
|
|
17
|
+
**Hold the line on severity.** A finding is BLOCKING only when it is one of the rubric's classes; taste, order and wording are NITs, and a NIT inflated to BLOCKING costs the author a full revision round. Equally, never pass a contradiction or a double home because each sentence reads well alone.
|
|
18
|
+
|
|
19
|
+
READ-ONLY: you edit nothing and write no file. Return, at most 900 words:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
BLOCKING
|
|
23
|
+
- path:line · class · "quote" → fix
|
|
24
|
+
NIT
|
|
25
|
+
- path:line · "quote" → fix
|
|
26
|
+
Verdict: PASS | FIX (n blocking)
|
|
27
|
+
```
|
|
28
|
+
'''
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"harness": "code",
|
|
3
3
|
"name": "code",
|
|
4
|
-
"version": "3.20.
|
|
4
|
+
"version": "3.20.11",
|
|
5
5
|
"files": [
|
|
6
6
|
".prettierignore",
|
|
7
7
|
".prettierrc.json",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"origin": "https://cdn.nustack.io",
|
|
30
30
|
"track": "latest"
|
|
31
31
|
},
|
|
32
|
-
"digest": "
|
|
32
|
+
"digest": "26e79ecd38c1"
|
|
33
33
|
}
|
|
@@ -13,7 +13,7 @@ This skill writes one document at a time: the genre registry says what kind of d
|
|
|
13
13
|
2. Your genre's row in [`templates/Readme.md`](templates/Readme.md) § Registry, then the template that row names.
|
|
14
14
|
3. [`references/style-guide.md`](references/style-guide.md) § The model and § Labels before writing prose; the rest of it only for the section you are writing.
|
|
15
15
|
4. [`references/frontmatter.md`](references/frontmatter.md) when you write or change frontmatter keys beyond `type:` and `description:`.
|
|
16
|
-
5. Only for their own tasks: [`references/untemplated.md`](references/untemplated.md) (no registry row fits), [`references/instruction-style.md`](references/instruction-style.md) (instruction files), [`references/source-comments.md`](references/source-comments.md) (source-file comments), [`references/examples.md`](references/examples.md) (worked good and bad examples).
|
|
16
|
+
5. Only for their own tasks: [`references/document-sets.md`](references/document-sets.md) (more than one sibling document, or a doctrine document), [`references/untemplated.md`](references/untemplated.md) (no registry row fits), [`references/instruction-style.md`](references/instruction-style.md) (instruction files), [`references/source-comments.md`](references/source-comments.md) (source-file comments), [`references/examples.md`](references/examples.md) (worked good and bad examples).
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
@@ -21,11 +21,12 @@ This skill writes one document at a time: the genre registry says what kind of d
|
|
|
21
21
|
|
|
22
22
|
1. **Find the genre.** Match the request against § Routing, then read that genre's registry row: nature, `type:`, location, required keys, required sections. No row fits ⇒ `references/untemplated.md`.
|
|
23
23
|
2. **Find the existing document.** If a document on the topic already exists, extend it; a second document on one topic is drift. If the file is a frozen record (a plan at `Complete` or `Abandoned`, a committed changelog entry, an executed runbook), never edit it: write a new dated record that links back.
|
|
24
|
-
3. **
|
|
25
|
-
4. **
|
|
26
|
-
5. **Write the
|
|
27
|
-
6. **
|
|
28
|
-
7. **
|
|
24
|
+
3. **Earn it, and route a set.** A new truth document that states rules (doctrine, a system, an architecture decision) first lists the decisions only it would own, each checked against the documents that exist; under about six, its rules go to their homes and the document is not written. More than one sibling document, or any doctrine document, follows `references/document-sets.md` from here: a term table and a rule ledger before prose, rendered from the ledger, one cold read.
|
|
25
|
+
4. **Place and name it** at the registry's location. `docs/structure.md` is the placement authority for anything the registry leaves open.
|
|
26
|
+
5. **Write it from the template.** Keep the template's section names exactly; omit optional sections with nothing real to say. Write the body from the outside in (style guide § Shape), every heading and bold label a noun phrase, every sentence after a label third person. In a truth document, every sentence is present tense (§ The three natures). Every line owns a decision: before stating a rule, search the neighbours for it, and cite the one found rather than restating it (style guide § Net-net).
|
|
27
|
+
6. **Write the frontmatter.** `type:` from the registry, `description:` in at most 300 characters saying what the document settles and where its boundary sits, then the genre's required keys (`references/frontmatter.md` for each key's rules).
|
|
28
|
+
7. **Run the lint** from the repo root on the repo-relative path: `node <skill>/scripts/doc-lint.mjs docs/features/sign-in.md` (or `--changed`). Fix every `[block]` finding; read every `[warn]` and fix it unless the judgment it flags is genuinely yours. A disable takes bare rule ids, `<!-- doc-lint-disable: id -->`, alone on its own line for the whole file with the reason in a second comment on the next line, or at the end of one line for that line only.
|
|
29
|
+
8. **Edit, don't append, on a substantive change to an existing truth document.** Keep its section shape, shed any history narration, progress marker or stale tripwire in the sections you touch, bump `last-reviewed:`, update `objects:` if what it designs changed, and remove any retired key on the way through.
|
|
29
30
|
|
|
30
31
|
---
|
|
31
32
|
|
|
@@ -67,7 +68,7 @@ The full strip-list and the record-side rules: `references/style-guide.md` § Th
|
|
|
67
68
|
- **Intent and promises; facts are the graph's.** An owning document (feature, package, system) says why the product is shaped this way and what it promises, and names the objects it designs in `objects:`. Every computable fact (a table's columns, which function writes which column, which route sits behind which guard, which file holds what) is the code's, and a hand-typed copy is wrong the day the code moves. `doc-lint` blocks the retired mechanism sections (`mechanism-section`) and an owning document with no `objects:`.
|
|
68
69
|
- **Read by people, pointed at by the footer.** Sharp bullets under noun-phrase headings, each a bold label, a colon, one or two plain sentences; code named only where a person types or sees it, or at a cross-cutting seam; every other pointer in the closing **For the agent** footer (style guide § Owning documents — the body and the footer).
|
|
69
70
|
- **The stability test.** A sentence that would change when a function is renamed, a file moves, or a route, column or error code changes is the code's, not the document's. The code is the authority on *what*; the document on *why* (style guide § Shape).
|
|
70
|
-
- **Unbuilt work has one home per kind.**
|
|
71
|
+
- **Unbuilt work has one home per kind, outside doctrine.** A doctrine document is a specification and records no product's build state. Elsewhere, decided, unbuilt design sits in the body, wrapped in an `UNBUILT` marker; a shortfall in what is built is one bullet under Gaps; the work that would close either is a backlog row, which the document never tracks (style guide § The stability test).
|
|
71
72
|
- **No empty stubs.** Omit a section with nothing real to say. Write "None" only where the absence is itself information, such as a plan's Cross-Module Contracts Affected.
|
|
72
73
|
- **No redirect documents.** Moving a document deletes the old file and repoints every inbound link; a "Moved to X" stub rots and creates false search hits.
|
|
73
74
|
|
|
@@ -92,7 +93,8 @@ A document names the objects it designs in `objects:`, and a source file names t
|
|
|
92
93
|
| Document a feature (LLD) | [`templates/feature.md`](templates/feature.md) |
|
|
93
94
|
| Document a feature's data flow or state | The feature doc's Flows (behaviour) and Promises (guarantees); a persisted shape belongs in the API reference (style guide § State at persistence points); component and transient state are not documented |
|
|
94
95
|
| Document a workspace package | [`templates/package.md`](templates/package.md), the residual owner of `packages/{name}/**` |
|
|
95
|
-
| Document one concern the platform handles everywhere (authentication, storage, the API protocol) | [`templates/doctrine.md`](templates/doctrine.md): design and principles, no mechanism, owns no code |
|
|
96
|
+
| Document one concern the platform handles everywhere (authentication, storage, the API protocol) | [`templates/doctrine.md`](templates/doctrine.md): design and principles, no mechanism, owns no code; written through [`references/document-sets.md`](references/document-sets.md) |
|
|
97
|
+
| Write or rework several sibling documents at once (a doctrine folder, a family of features) | [`references/document-sets.md`](references/document-sets.md): usefulness test, term table, rule ledger, render, one cold read |
|
|
96
98
|
| Document one system spanning packages | [`templates/system.md`](templates/system.md): one machine end to end, never a giant feature doc |
|
|
97
99
|
| Record or revise an architecture decision | [`templates/architecture-decision.md`](templates/architecture-decision.md): one AD per subject, revised in place |
|
|
98
100
|
| Create or update a changelog entry | [`templates/changelog-entry.md`](templates/changelog-entry.md) (record; frozen inside its commit; no row in `CHANGELOG.md`) |
|
|
@@ -125,12 +127,13 @@ A document names the objects it designs in `objects:`, and a source file names t
|
|
|
125
127
|
| --- | --- |
|
|
126
128
|
| `templates/Readme.md` | The genre registry: every genre's nature, `type:`, location, required keys and sections; `doc-lint` reads it |
|
|
127
129
|
| `templates/` | One template per genre the registry names |
|
|
128
|
-
| `references/
|
|
130
|
+
| `references/document-sets.md` | Writing several sibling documents as one design: the usefulness test, term table, rule ledger, render, and the review rubric the `doc-reviewer` agent reads |
|
|
131
|
+
| `references/style-guide.md` | The prose authority: the nine principles, what earns a line, depth per genre, the outside-in shape and stability test, labels and voice, owning documents, tense, diagrams, reference documents |
|
|
129
132
|
| `references/frontmatter.md` | Each frontmatter key's rules, the transitional `owns:`, the retired keys |
|
|
130
133
|
| `references/instruction-style.md` | The style for instruction files |
|
|
131
134
|
| `references/untemplated.md` | Writing a document no template covers, and co-authoring one with a person |
|
|
132
135
|
| `references/source-comments.md` | Source-file comments, and the scripts that check them |
|
|
133
136
|
| `references/examples.md` | Good and bad documentation, side by side |
|
|
134
|
-
| `scripts/doc-lint.mjs` | Mechanical checks over written docs: tense and history, dates, redirect stubs, frontmatter, the registry's keys and sections, index shape, owning-document body |
|
|
137
|
+
| `scripts/doc-lint.mjs` | Mechanical checks over written docs: tense and history, dates, redirect stubs, frontmatter, the registry's keys and sections, index shape, owning-document body, and a doctrine folder read as a set (citations resolve; no shared objects, restated sentences, body links or `UNBUILT` markers) |
|
|
135
138
|
| `scripts/source-lint.mjs` | Mechanical checks over source comments; run `--changed` before finishing any change that writes source |
|
|
136
139
|
| `scripts/comment-strip.mjs` | Proof that a comment sweep changed no executable code |
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Writing a set of documents
|
|
2
|
+
|
|
3
|
+
Load when writing or reworking more than one sibling document at once (a doctrine folder, a family of feature documents), or one doctrine document whose rules meet its siblings'. A single feature or package document needs only the steps in `SKILL.md`. One document joining an existing set runs every step below, with the existing documents as the rest of the set (§ One document into an existing set).
|
|
4
|
+
|
|
5
|
+
A set written one document at a time restates itself. Each document is made self-contained, so the same rule lands in four documents in four wordings, two of them contradict, and the defects surface only on rereading, which costs more than the writing did. So the set is designed once, as data, before any prose: every rule gets one home, every concept one name, and the review reads a table, where a fix is one edit, instead of twenty documents, where a fix is a reread of every one that states the rule.
|
|
6
|
+
|
|
7
|
+
## 1. Usefulness test
|
|
8
|
+
|
|
9
|
+
For each proposed document, list the decisions only it would own: rules a reader would get wrong without it, each checked against the documents that exist, by a search for its distinctive phrase. A decision another document already states belongs to that document.
|
|
10
|
+
|
|
11
|
+
- **Fewer than about six owned decisions:** the document is a section of a neighbour, or its rules belong in several neighbours. Fold them and drop the document.
|
|
12
|
+
- **Two documents owning overlapping lists:** the boundary between them is not drawn. Redraw it or merge them.
|
|
13
|
+
- **The output:** the document list, each with its owned decisions and its boundary sentence (the questions next to it, and which document answers each).
|
|
14
|
+
|
|
15
|
+
## 2. Term table
|
|
16
|
+
|
|
17
|
+
One row per concept: its name, a one-line definition, the one document that governs it (which lists it in `objects:`), and the synonyms it bans. The table comes before the ledger, because a rule written with two names for one concept becomes two rules.
|
|
18
|
+
|
|
19
|
+
The table starts from what the existing documents already name: every sibling's `objects:` and the one-line definitions in its "For the agent" footer. A new term is checked against them before it is used, because the collision a writer cannot see is with a name a sibling already gave another concept ("consent" for a client's scope, beside a sibling's consent of a data subject).
|
|
20
|
+
|
|
21
|
+
| Term | Means | Governed by | Not |
|
|
22
|
+
| --- | --- | --- | --- |
|
|
23
|
+
| operator | a person on the platform's own staff | authorization service | admin, staff account |
|
|
24
|
+
|
|
25
|
+
## 3. Rule ledger
|
|
26
|
+
|
|
27
|
+
One row per rule, from the user's rulings, the documents that exist, and the code where it states a design:
|
|
28
|
+
|
|
29
|
+
| Id | Rule | Reason | Source | Home | As | Stated in | Cited by |
|
|
30
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
31
|
+
| R12 | A change that narrows access ends the sessions it affects | a narrowed role must not outlive its token | owner ruling 6 | auth service | principle 5 | auth service | authorization service, security |
|
|
32
|
+
|
|
33
|
+
- **A source for every row:** an owner's ruling, a sibling's statement, or the code where it states a design. A rule with no source (a case the rulings leave open, a consequence the writer finds plausible) is not a row: it is a question for the user, with a recommendation, and the documents say nothing on the case until it is answered. Rules a writer supplies itself are where a written set's own defects concentrate, because no one has decided them.
|
|
34
|
+
|
|
35
|
+
- **Stated in, searched, not remembered:** each row's distinctive phrase is searched across the existing documents, and every document already stating the rule is listed. The ledger's defects are mostly here: a rule the writer homes in a new document while a sibling still states it is a double home on the first read.
|
|
36
|
+
- **One home per rule:** the document whose question the rule answers. A rule that seems to need two homes is resolved here, by picking one and adding the other to "Cited by". A rule a sibling already states keeps that home unless the same change edits the sibling to cite the new one; a home moves only with both edits.
|
|
37
|
+
- **Contradictions resolved here:** two rows that cannot both hold are settled before any prose exists. Where one source plainly outranks the other (the owner's latest ruling over an older sibling sentence), the ledger follows it and the losing statement is a sibling edit owed; the rest go to the user in one batch with the open cases, a recommendation first for each.
|
|
38
|
+
- **As:** a principle where the rule holds across the document's parts, a part's decision where it holds for one part only.
|
|
39
|
+
- **Scratch, never committed:** the documents are the record, and a committed ledger would be a second copy to drift from them.
|
|
40
|
+
|
|
41
|
+
## 4. Ledger review
|
|
42
|
+
|
|
43
|
+
One reviewer reads the ledger and the term table, not prose: the `doc-reviewer` agent in ledger mode, with § Rubric. Without the agent, a context-free sub-agent briefed with § Rubric and the paths, never the writer itself: a writer reviewing its own ledger passes its own blind spots, and in this skill's eval a self-reviewed ledger reached the cold read carrying seven blocking findings. Fixes land in the ledger, so every document rendered after them inherits them.
|
|
44
|
+
|
|
45
|
+
## 5. Render
|
|
46
|
+
|
|
47
|
+
Each document is written from its ledger rows and nothing else:
|
|
48
|
+
|
|
49
|
+
- **Principles:** the rows homed in the document as principles, each with its reason.
|
|
50
|
+
- **Parts in depth:** the rows homed as part decisions. A part with no such row gets no section.
|
|
51
|
+
- **Rules homed elsewhere:** a citation with the one clause of context the sentence needs (style guide principle 7), never the rule in new words.
|
|
52
|
+
- **A sentence with no row:** filler, which is cut. A rule the writer finds missing is a question for the user (§ 3), never a row the writer adds for itself.
|
|
53
|
+
|
|
54
|
+
Writers may run in parallel, one sub-agent per document or per few documents. Each brief carries the ledger, the term table, the template, the style guide's § Labels, § Voice and § Net-net, the rows homed in its documents, and the instruction to write only its own files. Each writer returns paths, not prose.
|
|
55
|
+
|
|
56
|
+
## 6. Lint
|
|
57
|
+
|
|
58
|
+
`doc-lint` over the folder. Block findings are fixed. Each `sibling-duplicate` warning is a restatement the ledger did not ask for, or a row the ledger missed; fix it in the document.
|
|
59
|
+
|
|
60
|
+
## 7. Review
|
|
61
|
+
|
|
62
|
+
One cold read of the set by the `doc-reviewer` agent in docs mode, with § Rubric. Its brief carries the paths and nothing of the session, because a reader who saw the session already knows every undefined term. Without the agent, a context-free sub-agent briefed with § Rubric does the read.
|
|
63
|
+
|
|
64
|
+
- **BLOCKING findings:** fixed.
|
|
65
|
+
- **NITs:** reported to the user as one list, never looped on.
|
|
66
|
+
- **After the fixes:** the changed lines only are verified: re-lint, and re-read each citation a fix touched. A fix never adds an unsourced rule: a finding that needs a decision the sources do not make (a Two readings the rulings left open) narrows the sentence to what the sources say and goes to the user as a question. There is no second full cold read: a review that keeps finding new BLOCKING items is reading prose the ledger never governed, so the fix is to the ledger and a re-render of the documents it touches.
|
|
67
|
+
|
|
68
|
+
## One document into an existing set
|
|
69
|
+
|
|
70
|
+
- **The siblings are the set:** the term table and the ledger are built against them (§ 2, § 3), and the cold read reads the new document against them.
|
|
71
|
+
- **A fix that belongs in a sibling is made in the sibling,** in the same change: a rule whose home moved, a term renamed, a principle that now has an exception. Where the sibling is outside the change's scope, the fix is reported to the user as a sibling edit owed, never absorbed by restating the rule in the new document.
|
|
72
|
+
- **A contradiction with a sibling's principle** is never settled by the new document alone: it is an exception the sibling's principle must cite, or a question for the user.
|
|
73
|
+
|
|
74
|
+
## Rubric
|
|
75
|
+
|
|
76
|
+
A finding names the file and line, quotes the text, names its class, and proposes the fix. "Could be clearer" with no fix is not a finding.
|
|
77
|
+
|
|
78
|
+
**BLOCKING:** the set is wrong, or unreadable as a set, until fixed.
|
|
79
|
+
|
|
80
|
+
| Class | The defect |
|
|
81
|
+
| --- | --- |
|
|
82
|
+
| Contradiction | Two statements that cannot both hold, in one document or across two |
|
|
83
|
+
| Double home | A rule stated, not cited, in two documents, or twice in one |
|
|
84
|
+
| Wrong citation | A citation whose target does not say what the citing sentence claims (the lint checks that it exists; the reader checks what it says) |
|
|
85
|
+
| Split term | Two names for one concept, or one name for two |
|
|
86
|
+
| No decision of its own | A document under about six owned decisions; a section, table or bullet that states nothing the principles do not |
|
|
87
|
+
| Missing reason | A principle with no reason |
|
|
88
|
+
| Wrong layer | Mechanism, a product's specifics or build state in doctrine; history in a truth document |
|
|
89
|
+
| Two readings | A rule a reader could act on in two incompatible ways |
|
|
90
|
+
|
|
91
|
+
**NIT:** wording, order, a label, a sentence that could be shorter, a cross-reference that would help. NITs never block.
|
|
92
|
+
|
|
93
|
+
In ledger mode the same classes apply to rows: two rows that contradict, a rule homed twice, a term used in two senses, a document left with fewer than about six rows, a row without its reason or without its source, a rule homed in a document whose question it does not answer.
|
|
@@ -7,18 +7,19 @@ This guide states how a document is written: every file under `docs/` and every
|
|
|
7
7
|
|
|
8
8
|
## The model
|
|
9
9
|
|
|
10
|
-
A document is read by a person who wants to understand something or to act on it, and it is scanned more often than it is read. Every rule below follows from
|
|
10
|
+
A document is read by a person who wants to understand something or to act on it, and it is scanned more often than it is read. Every rule below follows from nine principles; later sections cite them by number.
|
|
11
11
|
|
|
12
12
|
### Principles
|
|
13
13
|
|
|
14
14
|
1. **Three natures:** every document is a truth document (what is, now, rewritten in place), a record (what happened, dated and frozen) or a queue (work not done yet, rows appended and deleted when resolved). A truth document never narrates history, a record is never edited to match the present, and a queue holds only open rows, because a reader must be able to trust each without the others.
|
|
15
15
|
2. **The outside-in shape:** an explaining document opens on the question it answers and its boundary, then the model with its numbered principles, then the parts and their relations, then each part's decisions, and stops at its genre's deepest layer. Each layer is complete on its own, so a reader who stops at any layer holds a picture that is coarse but true, never a teaser the next section completes.
|
|
16
16
|
3. **The stability test:** a sentence that would have to change when a function is renamed, a file moves, a route, column, error code or cookie attribute changes, or a constant is retuned without the design changing belongs to the code, which the code graph computes on demand (`docs/architecture/systems/knowledge-layer.md`), and not to the document. A copy typed into a document is at best a duplicate of the code and at worst a stale one.
|
|
17
|
-
4. **The authority split:** the code is the authority on *what*; the document is the authority on *why*. A disagreement on *what* means the document is stale and the code wins; a disagreement on *why* or on an invariant is a defect to raise, because one side is wrong on purpose.
|
|
17
|
+
4. **The authority split:** the code is the authority on *what*; the document is the authority on *why*. A disagreement on *what* means the document is stale and the code wins; a disagreement on *why* or on an invariant is a defect to raise, because one side is wrong on purpose. Doctrine is the one exception: it is a specification, so code that differs from it has a gap to plan and build (`templates/doctrine.md`).
|
|
18
18
|
5. **Noun-phrase labels, third-person sentences:** every heading and every bold bullet label names something and contains no finite verb, so it carries no tense, person or voice. The sentence after a label is third person, present tense, active, with the actor as its subject.
|
|
19
19
|
6. **A body scanned by people, a footer for the agent:** an owning document is bullets under noun-phrase headings, tables wherever the cases are parallel states, code named only where a person types or sees it or at a cross-cutting seam, and a closing "For the agent" footer that holds pointers, never an inventory.
|
|
20
20
|
7. **Self-contained, never padded:** the body reads whole without opening another file, restating the one sentence of context a borrowed concept needs and citing the authority for the rest. Length is a signal of a document that has let mechanism in, never a target.
|
|
21
21
|
8. **Depth per genre:** doctrine stops at decisions and reasons, a system at behaviour across packages, a package at its public contract, a feature runs deepest at its end in Promises, and a reference document or runbook keeps full detail because the detail is its content.
|
|
22
|
+
9. **Every line owns a decision:** a line earns its place by stating a rule, a reason, a boundary or a promise a reader would otherwise get wrong. A line restating a rule that has a home is a citation instead, and a line stating nothing is cut, because restatements drift apart and filler buries the rules a reader came for.
|
|
22
23
|
|
|
23
24
|
## The genres
|
|
24
25
|
|
|
@@ -71,16 +72,16 @@ The test (principle 3) decides what a sentence may say. These survive it:
|
|
|
71
72
|
- **Decisions:** the choice made, and the alternative a reader would reach for.
|
|
72
73
|
- **Promises:** what a person or a test can check.
|
|
73
74
|
- **Cross-component contracts:** what no single file shows, such as two clients that must classify the same answer identically.
|
|
74
|
-
- **Decided-but-unbuilt intent:** what the code cannot reveal because it does not yet do it, wrapped in `<!-- UNBUILT:START — {what, and the evidence it is not built} -->` … `<!-- UNBUILT:END -->` in plain words. A design decided *against* carries no marker.
|
|
75
|
+
- **Decided-but-unbuilt intent:** outside doctrine, what the code cannot reveal because it does not yet do it, wrapped in `<!-- UNBUILT:START — {what, and the evidence it is not built} -->` … `<!-- UNBUILT:END -->` in plain words. A design decided *against* carries no marker.
|
|
75
76
|
|
|
76
|
-
Unbuilt work has one home per kind.
|
|
77
|
+
Unbuilt work has one home per kind. A doctrine document carries none of it, because it specifies every product and records no product's build state. Elsewhere, decided design the code does not do yet is an `UNBUILT` block where the design is stated; a shortfall in what is built (a promise the code does not keep, a case it mishandles) is one bullet under Gaps; the work that would close either is a backlog row, and the document never tracks that work's progress.
|
|
77
78
|
|
|
78
|
-
The authority split (principle 4) is stated once, where agents enter the docs (the root instruction file or `docs/README.md`), so a reader who finds the code and the document disagreeing knows which way to resolve it. A doctrine document
|
|
79
|
+
The authority split (principle 4) is stated once, where agents enter the docs (the root instruction file or `docs/README.md`), so a reader who finds the code and the document disagreeing knows which way to resolve it. A doctrine document states its exception in its opening, as the specification sentence (`templates/doctrine.md`), where its readers would otherwise apply the default; a feature, package or system document never restates the split, because its opening is fixed to its goal.
|
|
79
80
|
|
|
80
81
|
### Diagrams and length by layer
|
|
81
82
|
|
|
82
83
|
- **A diagram's layer:** at the model and parts layers a diagram names roles ("the browser", "the auth service"), never a URL, a header or a file. A diagram drawn from the code's names belongs to the code graph.
|
|
83
|
-
- **Length as a signal:** a document whose reference tail is longer than its body is an inventory with an introduction. A doctrine document past about
|
|
84
|
+
- **Length as a signal:** a document whose reference tail is longer than its body is an inventory with an introduction. A doctrine document past about two hundred and fifty lines has usually let mechanism or restatement in; the per-genre expectations are each template's.
|
|
84
85
|
|
|
85
86
|
## Labels
|
|
86
87
|
|
|
@@ -186,6 +187,37 @@ Every document is a truth document, a record or a queue (principle 1); `SKILL.md
|
|
|
186
187
|
|
|
187
188
|
Worked example of the strip-and-relocate move: [`examples.md`](examples.md) Example 6.
|
|
188
189
|
|
|
190
|
+
## Net-net — what earns a line
|
|
191
|
+
|
|
192
|
+
A document fails its reader less often by being wrong than by burying its rules under what it repeats (principle 9). The failure arrives one reasonable sentence at a time: each restatement helps where it stands, and the set reads as noise.
|
|
193
|
+
|
|
194
|
+
### The line test
|
|
195
|
+
|
|
196
|
+
- **A decision of its own:** the line states a rule, its reason, a boundary or a promise, and a reader without it would act differently. Otherwise it is cut.
|
|
197
|
+
- **One home:** before a rule is stated, the document and its neighbours are searched for it, by a distinctive phrase. Found, it is cited ("(auth, principle 3)") with the one clause of context the sentence needs (principle 7), never restated in new words.
|
|
198
|
+
- **Once inside the document:** a part's section carries the decisions its principles do not state; a principle repeated as a bullet below it is a duplicate wearing a label.
|
|
199
|
+
- **One name per concept:** a concept keeps the one name the document set gave it (the term table in `document-sets.md`, or the `objects:` list for a single document); a synonym reads as a second concept.
|
|
200
|
+
|
|
201
|
+
### What fails it
|
|
202
|
+
|
|
203
|
+
| ❌ | Why it fails | ✅ |
|
|
204
|
+
| --- | --- | --- |
|
|
205
|
+
| "The lock exists so that an unvetted organization can look around without creating anything." | Announces a purpose the next bullet states | "**Locked:** signs in and reads; creates and runs nothing." |
|
|
206
|
+
| A parts table whose every row reads "see principle 4" | Places nothing | No table |
|
|
207
|
+
| A Relations bullet restating principle 2 in other words | A second statement that will drift from the first | Cut, or cite principle 2 |
|
|
208
|
+
| A doctrine document whose every rule had a home elsewhere: attribution, key custody, a budget refusal, outbound deadlines | Owns no decision of its own | Each rule moved to its home; the document deleted |
|
|
209
|
+
| A rule stated in two sibling documents in different words | A reader cannot tell which binds, and the two drift | One home, one citation |
|
|
210
|
+
| A table of states, then a bullet per state restating its row | Every rule is stated twice, a page apart | The table for what each state allows; bullets only for the reasons |
|
|
211
|
+
| "Security matters at every layer." · "This section describes how…" | A truism and a ceremony: no decision | Cut; the heading already names the section |
|
|
212
|
+
|
|
213
|
+
### Port hygiene
|
|
214
|
+
|
|
215
|
+
A document that changes scope (one product's design lifted into platform doctrine, or doctrine applied to one product) has every product name, setting value, code root, build state and product-specific example rewritten for the new scope or cut. Left in place, the residue reads as a rule binding every reader.
|
|
216
|
+
|
|
217
|
+
### Proof
|
|
218
|
+
|
|
219
|
+
On a doctrine folder, `doc-lint` catches the mechanical half: a restated sentence (`sibling-duplicate`), a concept two documents govern (`objects-shared`), a citation to a principle or heading that does not exist (`citation-unresolved`), a purpose opener (`purpose-opener`). The rest is judgment, and it takes one cold read (`document-sets.md` § Review).
|
|
220
|
+
|
|
189
221
|
## Self-contained documents and the link surface
|
|
190
222
|
|
|
191
223
|
Instruction files stay lean because an agent pays for them on every load (`instruction-style.md`); a document is read on demand, so it carries what its reader needs to understand the page (principle 7).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// skills/documentation/scripts/doc-lint.mjs - mechanical checks over markdown docs (tense and history narration, dates, redirect stubs, frontmatter, index shape, owning-document body)
|
|
1
|
+
// skills/documentation/scripts/doc-lint.mjs - mechanical checks over markdown docs (tense and history narration, dates, redirect stubs, frontmatter, index shape, owning-document body, doctrine sets)
|
|
2
2
|
// Usage: node doc-lint.mjs <file.md ...> | node doc-lint.mjs --changed (git-changed + untracked .md)
|
|
3
3
|
// Exit 1 when any block-severity finding survives. Escape hatch: <!-- doc-lint-disable: id[, id] --> alone on its
|
|
4
4
|
// own line (file-wide, with a reason comment beside it) or at the end of the offending line (that line only).
|
|
@@ -392,6 +392,13 @@ function lintFile(path, findings) {
|
|
|
392
392
|
if (!label || /^For the agent$/i.test(label)) continue;
|
|
393
393
|
if (CLAUSE.test(label.replace(/`[^`]*`/g, 'X'))) findings.push({ path, n, severity: 'warn', id: 'clause-label', message: 'a heading or bold label written as a clause — a label is a noun phrase with no verb, tense or person ("Decisions", not "What was decided"; "Organization member:", not "You already belong to an organization:")', excerpt: label.slice(0, 90) });
|
|
394
394
|
}
|
|
395
|
+
// "X exists so that…" restates the subject its heading already named; the purpose belongs in the rule it implies.
|
|
396
|
+
if (!disabled.has('purpose-opener')) {
|
|
397
|
+
for (const { n, line } of lines) {
|
|
398
|
+
const bare = line.replace(/`[^`]*`/g, 'X').replace(/^\s*[-*]\s+(\*\*[^*]+\*\*:?\s*)?/, '');
|
|
399
|
+
if (/^(the |an? )?[\w' -]{1,40}? exists (so that|to |because|in order)/i.test(bare)) findings.push({ path, n, severity: 'warn', id: 'purpose-opener', message: '"X exists so that…" — state the rule the purpose implies ("An unvetted organization signs in and reads, and creates nothing"), not that the thing has a purpose', excerpt: line.trim().slice(0, 90) });
|
|
400
|
+
}
|
|
401
|
+
}
|
|
395
402
|
// The sentences after a label describe the product in the third person; quoted interface copy keeps its own "you".
|
|
396
403
|
if (!disabled.has('second-person')) {
|
|
397
404
|
for (const { n, line } of lines) {
|
|
@@ -400,6 +407,126 @@ function lintFile(path, findings) {
|
|
|
400
407
|
}
|
|
401
408
|
}
|
|
402
409
|
}
|
|
410
|
+
|
|
411
|
+
if (scope === 'truth' && !isFolderIndex && (declared === 'doctrine' || DOCTRINE_LOCATION.test(path))) lintDoctrine(path, text, lines, disabled, findings);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// A doctrine folder is read as a set: its documents cite each other's principles by number and must not restate each
|
|
415
|
+
// other (templates/doctrine.md, references/document-sets.md), so these checks read the siblings beside the linted file.
|
|
416
|
+
const DOCTRINE_LOCATION = /(^|\/)docs\/architecture\/common\/[^/]+\.md$/;
|
|
417
|
+
// The specification sentence every doctrine document carries verbatim is the template's, not a duplicated rule.
|
|
418
|
+
const SPEC_SENTENCE = /specification of its concern|has a gap to plan and build|never settled silently in code/i;
|
|
419
|
+
const STOPWORDS = new Set('the and for that this with from are its their them they into onto than then when where which while who whom whose what each every any all one its not nor but was were has have had been being does did can may must will would should could only also more most other such same own per via out off over under about after before between both either neither those these there here because so as at by in of on or to an a is be it no'.split(' '));
|
|
420
|
+
const siblingCache = new Map();
|
|
421
|
+
|
|
422
|
+
// The doctrine documents in a folder, each with its title, objects, principle numbers, headings and sentences.
|
|
423
|
+
function doctrineSiblings(dir) {
|
|
424
|
+
if (siblingCache.has(dir)) return siblingCache.get(dir);
|
|
425
|
+
const docs = [];
|
|
426
|
+
for (const name of existsSync(dir) ? readdirSync(dir) : []) {
|
|
427
|
+
if (!name.endsWith('.md') || /^readme\.md$/i.test(name)) continue;
|
|
428
|
+
const path = join(dir, name);
|
|
429
|
+
const text = readFileSync(path, 'utf8');
|
|
430
|
+
const lines = proseLines(text);
|
|
431
|
+
const title = (lines.find(({ line }) => /^#\s+/.test(line))?.line || '').replace(/^#\s+/, '').trim().toLowerCase();
|
|
432
|
+
docs.push({ path, name, title, text, lines, objects: listValue((frontmatter(text) || new Map()).get('objects')).map((o) => o.toLowerCase()), principles: principleNumbers(lines), headings: new Set(lines.map(({ line }) => /^#{2,4}\s+(.+?)\s*$/.exec(line)?.[1].toLowerCase()).filter(Boolean)), sentences: sentencesOf(lines) });
|
|
433
|
+
}
|
|
434
|
+
siblingCache.set(dir, docs);
|
|
435
|
+
return docs;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// The numbers of a document's principles: the numbered items under its Principles heading.
|
|
439
|
+
function principleNumbers(lines) {
|
|
440
|
+
const out = new Set();
|
|
441
|
+
let level = 0;
|
|
442
|
+
for (const { line } of lines) {
|
|
443
|
+
const heading = /^(#{2,4})\s+(.+?)\s*$/.exec(line);
|
|
444
|
+
if (heading) { level = /^principles$/i.test(heading[2]) ? heading[1].length : level && heading[1].length <= level ? 0 : level; continue; }
|
|
445
|
+
const item = level && /^(\d+)\.\s/.exec(line);
|
|
446
|
+
if (item) out.add(Number(item[1]));
|
|
447
|
+
}
|
|
448
|
+
return out;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// The body's sentences long enough to state a rule, as content-word sets; headings, tables and the footer drop out.
|
|
452
|
+
function sentencesOf(lines) {
|
|
453
|
+
const out = [];
|
|
454
|
+
for (const { n, line } of lines) {
|
|
455
|
+
if (/^##\s+For the agent\b/.test(line)) break;
|
|
456
|
+
if (/^\s*(#|\|)/.test(line) || !line.trim()) continue;
|
|
457
|
+
const plain = line.replace(/^\s*([-*]|\d+\.)\s+/, '').replace(/\*\*[^*]+\*\*:?/g, '').replace(/\[([^\]]+)\]\([^)]*\)/g, '$1').replace(/`/g, '');
|
|
458
|
+
for (const sentence of plain.split(/(?<=[.;])\s+(?=[A-Z(])/)) {
|
|
459
|
+
if (SPEC_SENTENCE.test(sentence)) continue;
|
|
460
|
+
const words = new Set((sentence.toLowerCase().match(/[a-z][a-z'-]+/g) || []).filter((w) => w.length > 2 && !STOPWORDS.has(w)));
|
|
461
|
+
if (words.size >= 9) out.push({ n, text: sentence.trim(), words });
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
return out;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
const slugOf = (name) => name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
|
|
468
|
+
|
|
469
|
+
function lintDoctrine(path, text, lines, disabled, findings) {
|
|
470
|
+
const siblings = doctrineSiblings(dirname(path));
|
|
471
|
+
const self = siblings.find((d) => d.name === path.split('/').pop()) || { path, objects: [], principles: principleNumbers(lines), headings: new Set(), sentences: sentencesOf(lines) };
|
|
472
|
+
const byName = (name) => siblings.find((d) => d.title === name.toLowerCase() || d.name === `${slugOf(name)}.md`);
|
|
473
|
+
const footerAt = lines.findIndex(({ line }) => /^##\s+For the agent\b/.test(line));
|
|
474
|
+
const body = footerAt === -1 ? lines : lines.slice(0, footerAt);
|
|
475
|
+
|
|
476
|
+
// A citation names a principle by number or a section by heading, in parentheses: "(principle 4)", "(auth, principle 3)", "(API protocol § Idempotency)".
|
|
477
|
+
if (!disabled.has('citation-unresolved')) {
|
|
478
|
+
for (const { n, line } of lines) {
|
|
479
|
+
for (const group of line.replace(/`[^`]*`/g, '').matchAll(/\(([^()]+)\)/g)) {
|
|
480
|
+
for (const part of group[1].split(';').map((p) => p.trim())) {
|
|
481
|
+
const principle = /^(?:(.+?),\s*)?principles?\s+(\d+(?:\s*(?:,|and)\s*\d+)*)$/i.exec(part);
|
|
482
|
+
const section = /^(.+?)\s+§\s+(.+)$/.exec(part);
|
|
483
|
+
if (!principle && !section) continue;
|
|
484
|
+
const name = principle ? principle[1] : section[1];
|
|
485
|
+
const target = name ? byName(name) : self;
|
|
486
|
+
if (!target) { findings.push({ path, n, severity: 'warn', id: 'citation-unresolved', message: `"${name}" names no doctrine document in this folder — cite a sibling by its title`, excerpt: part }); continue; }
|
|
487
|
+
const where = target === self ? 'this document' : target.name;
|
|
488
|
+
if (principle) for (const num of principle[2].split(/\s*(?:,|and)\s*/).map(Number))
|
|
489
|
+
if (!target.principles.has(num)) findings.push({ path, n, severity: 'block', id: 'citation-unresolved', message: `principle ${num} does not exist in ${where} (it numbers ${[...target.principles].join(', ') || 'none'})`, excerpt: part });
|
|
490
|
+
if (section && !target.headings.has(section[2].trim().toLowerCase())) findings.push({ path, n, severity: 'block', id: 'citation-unresolved', message: `${where} has no heading "${section[2].trim()}"`, excerpt: part });
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
// One concept has one home: an object two doctrine documents both govern is a boundary the set has not drawn.
|
|
496
|
+
if (!disabled.has('objects-shared')) {
|
|
497
|
+
for (const object of self.objects) {
|
|
498
|
+
const other = siblings.find((d) => d !== self && d.objects.includes(object));
|
|
499
|
+
if (other) findings.push({ path, n: 1, severity: 'warn', id: 'objects-shared', message: `\`${object}\` is also in ${other.name}'s objects — one concept, one governing document; the other cites it` });
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
// The body names its neighbours in plain words; links live in "For the agent" (references/style-guide.md § Self-contained documents).
|
|
503
|
+
if (!disabled.has('doctrine-body-link')) {
|
|
504
|
+
for (const { n, line } of body)
|
|
505
|
+
if (/\]\([^)]+\)/.test(line.replace(/`[^`]*`/g, '')) && !line.includes('doc-lint-disable: doctrine-body-link')) findings.push({ path, n, severity: 'warn', id: 'doctrine-body-link', message: 'a link in a doctrine body — name the neighbour in plain words; its link belongs in "For the agent"', excerpt: line.trim().slice(0, 90) });
|
|
506
|
+
}
|
|
507
|
+
// A doctrine document specifies; what one product has not built is that product's plan or backlog, never a marker here.
|
|
508
|
+
if (!disabled.has('doctrine-unbuilt')) {
|
|
509
|
+
const at = text.split('\n').findIndex((l) => /<!--\s*UNBUILT/.test(l));
|
|
510
|
+
if (at !== -1) findings.push({ path, n: at + 1, severity: 'warn', id: 'doctrine-unbuilt', message: 'an UNBUILT marker in a doctrine document — doctrine is the specification; a product that lacks a part has a gap to plan and build in its own repo' });
|
|
511
|
+
}
|
|
512
|
+
// A rule stated twice drifts; the second statement is a citation. Sentences sharing most of their content words are flagged once per pair.
|
|
513
|
+
if (!disabled.has('sibling-duplicate')) {
|
|
514
|
+
for (const s of self.sentences) {
|
|
515
|
+
for (const d of siblings) {
|
|
516
|
+
const match = d.sentences.find((t) => (d !== self || t.n !== s.n) && overlap(s.words, t.words) >= 0.7 && (d !== self || t.n > s.n));
|
|
517
|
+
if (!match) continue;
|
|
518
|
+
findings.push({ path, n: s.n, severity: 'warn', id: 'sibling-duplicate', message: `restates ${d === self ? 'this document' : d.name}:${match.n} — keep the rule in one home and cite it there`, excerpt: s.text.slice(0, 90) });
|
|
519
|
+
break;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// Shared content words over the smaller sentence's, so a sentence quoted inside a longer one still counts.
|
|
526
|
+
function overlap(a, b) {
|
|
527
|
+
let shared = 0;
|
|
528
|
+
for (const w of a) if (b.has(w)) shared++;
|
|
529
|
+
return shared / Math.min(a.size, b.size);
|
|
403
530
|
}
|
|
404
531
|
|
|
405
532
|
// A changed plan whose committed version is already frozen must not be edited.
|
|
@@ -4,20 +4,23 @@ Truth document. Use for **one concern the platform handles everywhere**: authent
|
|
|
4
4
|
|
|
5
5
|
**A doctrine document states the design and nothing beneath it** (`references/style-guide.md` § Shape — the model first, the detail after). It is the most stable document in the tree, because it says why the platform is shaped the way it is, and that changes far less often than the code. It explains no mechanism: no function, file, column, cookie attribute, header value or per-route error code, since each of those fails the stability test. The code graph answers what the code does. This document answers why, and which principles any new code in the concern must keep.
|
|
6
6
|
|
|
7
|
+
**A doctrine document is a specification, not a description.** It states how every product handles the concern, so a product whose code differs has a gap to plan and build, and the document never records which product has built what: no `UNBUILT` marker, no "today the product…", no product's name, setting value or code root. When one product's posture against the doctrine matters, it is that product's own security overview, plan or backlog.
|
|
8
|
+
|
|
9
|
+
**Earn the document before writing it.** List the decisions only this document would own, each checked against the documents that exist: a decision another document already states is a citation, not an owned decision. Fewer than about six owned decisions means the concern is a section of a neighbour, not a document (`references/document-sets.md` § Usefulness test).
|
|
10
|
+
|
|
7
11
|
**Required:**
|
|
8
12
|
|
|
9
13
|
- the frontmatter
|
|
10
|
-
- the opening (the question, the boundary, and the
|
|
14
|
+
- the opening (the question, the boundary, and the specification sentence)
|
|
11
15
|
- **The model**, ending in numbered principles, each with its reason
|
|
12
|
-
- **The parts**: one table or diagram placing every part in the model, then their relations
|
|
13
|
-
- **one section per part**
|
|
14
16
|
- **For the agent**
|
|
15
17
|
|
|
16
|
-
**Optional:**
|
|
18
|
+
**Optional, each only with something the principles do not already say:**
|
|
17
19
|
|
|
18
|
-
-
|
|
20
|
+
- **The parts**: one table or diagram placing the parts in the model, where there are enough parts that a reader needs them placed, then **Relations** where two parts meet in a way no principle states
|
|
21
|
+
- **The parts in depth**: one section per part that carries decisions of its own
|
|
19
22
|
|
|
20
|
-
Nothing else: the neighbouring documents live in **For the agent**, the one closing link surface (`references/style-guide.md` § Self-contained documents and the link surface). Expect
|
|
23
|
+
Nothing else: the neighbouring documents live in **For the agent**, the one closing link surface, and the body names them in plain words with no link (`references/style-guide.md` § Self-contained documents and the link surface). Expect eighty to two hundred and fifty lines; past that, mechanism or restatement has usually crept in.
|
|
21
24
|
|
|
22
25
|
```yaml
|
|
23
26
|
---
|
|
@@ -33,7 +36,7 @@ objects: [principal, credential, device grant] # required — the concepts thi
|
|
|
33
36
|
|
|
34
37
|
{The question this concern answers for every request, row or run, in one sentence, bolded — then what it does not answer and which document does. One paragraph.}
|
|
35
38
|
|
|
36
|
-
{The
|
|
39
|
+
{The specification sentence, verbatim, with the scope named: "This document is the specification of its concern for every product on {the scope, e.g. the enterprise plane}. A product whose code differs from it has a gap to plan and build; a disagreement with a principle or its reason is raised against this document, never settled silently in code."}
|
|
37
40
|
|
|
38
41
|
## The model
|
|
39
42
|
|
|
@@ -51,26 +54,26 @@ objects: [principal, credential, device grant] # required — the concepts thi
|
|
|
51
54
|
|
|
52
55
|
### Principles
|
|
53
56
|
|
|
54
|
-
{Numbered invariants that hold across every part, each a bold noun-phrase label, then the rule and its reason in a sentence or two. Later sections cite them by number.}
|
|
57
|
+
{Numbered invariants that hold across every part, each a bold noun-phrase label, then the rule and its reason in a sentence or two. Later sections cite them by number. A rule another doctrine document owns is cited — "(auth service, principle 5)" — never restated as a principle here.}
|
|
55
58
|
|
|
56
|
-
## {The parts, as a noun phrase — e.g. "Credential families"}
|
|
59
|
+
## {The parts, as a noun phrase — e.g. "Credential families"} (optional)
|
|
57
60
|
|
|
58
|
-
{One table: each part placed on the model's axes.
|
|
61
|
+
{One table: each part placed on the model's axes. A row whose only content is "see principle N" is not placing anything; drop the table when every row would be one. Then "Relations": only where two parts meet in a way no principle states — what they share, what keeps them apart, the order in which they are tried. A role-level diagram (mermaid) where the relationships are a flow.}
|
|
59
62
|
|
|
60
|
-
## {The parts in depth, as a noun phrase — e.g. "Families in depth"}
|
|
63
|
+
## {The parts in depth, as a noun phrase — e.g. "Families in depth"} (optional)
|
|
61
64
|
|
|
62
65
|
### {One part, named for who meets it — e.g. "Browser person", "Trusted system"}
|
|
63
66
|
|
|
64
|
-
{
|
|
67
|
+
{The decisions this part rests on that no principle states, as bullets — a bold noun-phrase label, then the rule and its reason — citing principles by number. No opener saying the part exists or what it is for; the first bullet is its first decision. A part with nothing beyond its principles gets no section. A sequence diagram at role level where the part is a flow.}
|
|
65
68
|
|
|
66
69
|
## For the agent
|
|
67
70
|
|
|
68
|
-
{Pointers, not an inventory: the objects with one line each;
|
|
71
|
+
{Pointers, not an inventory: the objects with one line each; any cross-cutting seam by name; the neighbouring doctrine with a purpose each, linked. No code roots: the doctrine binds every product, and each product's code is found through the documents that name it.}
|
|
69
72
|
```
|
|
70
73
|
|
|
71
|
-
###
|
|
74
|
+
### Citations
|
|
72
75
|
|
|
73
|
-
|
|
76
|
+
Principles are cited by number, sections by heading, always in parentheses: "(principle 4)" in the document itself, "(auth, principle 3)" or "(API protocol § Rate limits)" for a sibling, by its title. `doc-lint` resolves each against the folder and blocks a number or heading that does not exist, so a renumbering is caught at the next lint, not by a reader.
|
|
74
77
|
|
|
75
78
|
### What a doctrine document is not
|
|
76
79
|
|
|
@@ -80,3 +83,5 @@ Code cannot reveal what it does not yet do, so decided-but-unbuilt intent is one
|
|
|
80
83
|
| The catalog of routes, error codes or variables | An API reference or environment registry |
|
|
81
84
|
| The one feature that happens to use the concern most | That feature's own document, which names this doctrine in its Scope |
|
|
82
85
|
| The story of how the concern got this way | The subject's architecture decision (`decisions/`), whose Decision Changelog tail carries how it moved, and the changelog for the when |
|
|
86
|
+
| A record of which product has built which part | That product's plan, backlog, or security overview |
|
|
87
|
+
| A restatement of a sibling's rule for completeness | A citation of the sibling's principle, with the one clause of context the sentence needs |
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"harness": "delivery",
|
|
3
3
|
"name": "delivery",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.46",
|
|
5
5
|
"files": [
|
|
6
6
|
".prettierignore",
|
|
7
7
|
".prettierrc.json",
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
"origin": "https://cdn.nustack.io",
|
|
15
15
|
"track": "latest"
|
|
16
16
|
},
|
|
17
|
-
"digest": "
|
|
17
|
+
"digest": "070610adbe37"
|
|
18
18
|
}
|