docgov-cli 0.2.0

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.
Files changed (68) hide show
  1. package/.claude-plugin/marketplace.json +29 -0
  2. package/.claude-plugin/plugin.json +41 -0
  3. package/LICENSE +21 -0
  4. package/README.md +136 -0
  5. package/agents/architect.md +65 -0
  6. package/agents/classifier.md +44 -0
  7. package/agents/drift-reviewer.md +59 -0
  8. package/agents/quality-reviewer.md +59 -0
  9. package/bin/docgov +1160 -0
  10. package/bin/docgov.cmd +2 -0
  11. package/core/check.js +298 -0
  12. package/core/classify.js +233 -0
  13. package/core/config.js +162 -0
  14. package/core/context.js +144 -0
  15. package/core/document.js +132 -0
  16. package/core/drift.js +225 -0
  17. package/core/find.js +61 -0
  18. package/core/frontmatter.js +65 -0
  19. package/core/git.js +113 -0
  20. package/core/graph.js +182 -0
  21. package/core/health.js +101 -0
  22. package/core/impact.js +146 -0
  23. package/core/invariants.js +126 -0
  24. package/core/inventory.js +167 -0
  25. package/core/links.js +80 -0
  26. package/core/migrate.js +158 -0
  27. package/core/onboard.js +271 -0
  28. package/core/paths.js +53 -0
  29. package/core/publish.js +92 -0
  30. package/core/registry.js +71 -0
  31. package/core/similarity.js +89 -0
  32. package/core/size.js +87 -0
  33. package/core/suppressions.js +58 -0
  34. package/core/taxonomy.js +477 -0
  35. package/core/templates.js +159 -0
  36. package/core/util.js +124 -0
  37. package/core/yaml.js +250 -0
  38. package/hooks/hooks.json +65 -0
  39. package/lenses/agent.md +38 -0
  40. package/lenses/architecture.md +30 -0
  41. package/lenses/developer.md +26 -0
  42. package/lenses/operations.md +32 -0
  43. package/lenses/readme.md +32 -0
  44. package/lenses/security.md +33 -0
  45. package/lenses/user.md +30 -0
  46. package/package.json +39 -0
  47. package/policy/documentation.md +82 -0
  48. package/schemas/config.json +239 -0
  49. package/schemas/frontmatter.json +299 -0
  50. package/skills/affected/SKILL.md +41 -0
  51. package/skills/brief/SKILL.md +38 -0
  52. package/skills/create/SKILL.md +53 -0
  53. package/skills/find/SKILL.md +32 -0
  54. package/skills/health/SKILL.md +36 -0
  55. package/skills/inspect/SKILL.md +58 -0
  56. package/skills/publish/SKILL.md +45 -0
  57. package/skills/review/SKILL.md +65 -0
  58. package/skills/setup/SKILL.md +52 -0
  59. package/skills/stale/SKILL.md +55 -0
  60. package/skills/tag/SKILL.md +59 -0
  61. package/templates/architecture.adr.md +42 -0
  62. package/templates/architecture.domain.md +44 -0
  63. package/templates/architecture.trd.md +72 -0
  64. package/templates/constitution.invariants.md +40 -0
  65. package/templates/operations.runbook.md +47 -0
  66. package/templates/product.prd.md +60 -0
  67. package/templates/security.threat-model.md +51 -0
  68. package/templates/user.readme.md +43 -0
@@ -0,0 +1,299 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://raw.githubusercontent.com/ZeeshanSultan/DocGov/main/schemas/frontmatter.json",
4
+ "title": "DocGov document frontmatter",
5
+ "description": "The docgov block in a governed document's YAML frontmatter. Point your editor at this for completion and validation.",
6
+ "type": "object",
7
+ "required": [
8
+ "docgov"
9
+ ],
10
+ "properties": {
11
+ "docgov": {
12
+ "type": "object",
13
+ "required": [
14
+ "id",
15
+ "type"
16
+ ],
17
+ "additionalProperties": false,
18
+ "properties": {
19
+ "id": {
20
+ "type": "string",
21
+ "pattern": "^[a-z0-9][a-z0-9-]{1,59}$",
22
+ "description": "Stable identifier. How every other document, relationship and agent addresses this one. Changing it breaks references."
23
+ },
24
+ "type": {
25
+ "enum": [
26
+ "constitution.product",
27
+ "constitution.principles",
28
+ "constitution.invariants",
29
+ "constitution.glossary",
30
+ "constitution.domains",
31
+ "product.vision",
32
+ "product.prd",
33
+ "product.feature",
34
+ "product.persona",
35
+ "product.roadmap",
36
+ "design.ux",
37
+ "design.flow",
38
+ "design.accessibility",
39
+ "architecture.overview",
40
+ "architecture.domain",
41
+ "architecture.component",
42
+ "architecture.data",
43
+ "architecture.integration",
44
+ "architecture.trd",
45
+ "architecture.adr",
46
+ "security.architecture",
47
+ "security.threat-model",
48
+ "security.authorization",
49
+ "security.data-classification",
50
+ "security.public-model",
51
+ "engineering.development",
52
+ "engineering.testing",
53
+ "engineering.conventions",
54
+ "engineering.dependencies",
55
+ "operations.deployment",
56
+ "operations.infrastructure",
57
+ "operations.configuration",
58
+ "operations.observability",
59
+ "operations.runbook",
60
+ "operations.disaster-recovery",
61
+ "release.notes",
62
+ "release.migration",
63
+ "release.deprecation",
64
+ "user.readme",
65
+ "user.getting-started",
66
+ "user.guide",
67
+ "user.admin-guide",
68
+ "user.tutorial",
69
+ "user.troubleshooting",
70
+ "user.faq",
71
+ "user.reference",
72
+ "governance.contributing",
73
+ "governance.support",
74
+ "governance.lifecycle",
75
+ "governance.policy",
76
+ "contract.openapi",
77
+ "contract.schema",
78
+ "note.internal",
79
+ "archive.document",
80
+ "agent.instructions",
81
+ "unknown"
82
+ ],
83
+ "description": "Document class. Determines location, template, required sections, limits and quality threshold."
84
+ },
85
+ "authority": {
86
+ "enum": [
87
+ "constitution",
88
+ "canonical",
89
+ "requirements",
90
+ "decision",
91
+ "machine-contract",
92
+ "implementation",
93
+ "generated",
94
+ "audience",
95
+ "historical"
96
+ ],
97
+ "description": "Defaults from the type. A lower-authority document may not contradict a higher one."
98
+ },
99
+ "domain": {
100
+ "type": "string",
101
+ "description": "Bounded area this belongs to. Joins the document to config domains and to invariant scoping."
102
+ },
103
+ "audience": {
104
+ "type": "array",
105
+ "items": {
106
+ "type": "string"
107
+ }
108
+ },
109
+ "visibility": {
110
+ "enum": [
111
+ "public",
112
+ "internal",
113
+ "confidential",
114
+ "generated-public",
115
+ "generated-internal"
116
+ ],
117
+ "description": "Governs which paths may hold it and whether it can be published."
118
+ },
119
+ "lens": {
120
+ "enum": [
121
+ "readme",
122
+ "developer",
123
+ "architecture",
124
+ "security",
125
+ "user",
126
+ "agent",
127
+ "operations"
128
+ ],
129
+ "description": "Review lens. Defaults from the type."
130
+ },
131
+ "owner": {
132
+ "type": "string",
133
+ "description": "Required in team and enterprise modes."
134
+ },
135
+ "status": {
136
+ "enum": [
137
+ "draft",
138
+ "active",
139
+ "deprecated",
140
+ "superseded",
141
+ "archived"
142
+ ]
143
+ },
144
+ "documents": {
145
+ "oneOf": [
146
+ {
147
+ "type": "string"
148
+ },
149
+ {
150
+ "type": "array",
151
+ "items": {
152
+ "type": "string"
153
+ }
154
+ }
155
+ ],
156
+ "description": "Code path globs this document describes. Without this the document is invisible to drift detection and to invariant injection \u2014 the single most valuable field in the block."
157
+ },
158
+ "invariants": {
159
+ "type": "array",
160
+ "description": "Explicit invariants. Usually written as list items in the body instead.",
161
+ "items": {
162
+ "oneOf": [
163
+ {
164
+ "type": "string"
165
+ },
166
+ {
167
+ "type": "object",
168
+ "required": [
169
+ "id"
170
+ ],
171
+ "properties": {
172
+ "id": {
173
+ "type": "string"
174
+ },
175
+ "statement": {
176
+ "type": "string"
177
+ },
178
+ "paths": {
179
+ "type": "array",
180
+ "items": {
181
+ "type": "string"
182
+ }
183
+ },
184
+ "severity": {
185
+ "enum": [
186
+ "critical",
187
+ "high",
188
+ "medium",
189
+ "low"
190
+ ]
191
+ }
192
+ }
193
+ }
194
+ ]
195
+ }
196
+ },
197
+ "relationships": {
198
+ "type": "object",
199
+ "additionalProperties": false,
200
+ "description": "Edges in the documentation graph. Inverses are derived automatically.",
201
+ "properties": {
202
+ "depends_on": {
203
+ "type": "array",
204
+ "items": {
205
+ "type": "string"
206
+ }
207
+ },
208
+ "defines": {
209
+ "type": "array",
210
+ "items": {
211
+ "type": "string"
212
+ }
213
+ },
214
+ "implements": {
215
+ "type": "array",
216
+ "items": {
217
+ "type": "string"
218
+ }
219
+ },
220
+ "derived_from": {
221
+ "type": "array",
222
+ "items": {
223
+ "type": "string"
224
+ }
225
+ },
226
+ "supersedes": {
227
+ "type": "array",
228
+ "items": {
229
+ "type": "string"
230
+ }
231
+ },
232
+ "references": {
233
+ "type": "array",
234
+ "items": {
235
+ "type": "string"
236
+ }
237
+ },
238
+ "validated_by": {
239
+ "type": "array",
240
+ "items": {
241
+ "type": "string"
242
+ }
243
+ },
244
+ "generated_from": {
245
+ "type": "array",
246
+ "items": {
247
+ "type": "string"
248
+ }
249
+ },
250
+ "exposes": {
251
+ "type": "array",
252
+ "items": {
253
+ "type": "string"
254
+ }
255
+ },
256
+ "documents": {
257
+ "type": "array",
258
+ "items": {
259
+ "type": "string"
260
+ }
261
+ }
262
+ }
263
+ },
264
+ "review": {
265
+ "type": "object",
266
+ "additionalProperties": false,
267
+ "properties": {
268
+ "cadence": {
269
+ "type": "string",
270
+ "pattern": "^\\d+[dwmy]$"
271
+ },
272
+ "last": {
273
+ "type": "string"
274
+ }
275
+ }
276
+ },
277
+ "generation": {
278
+ "type": "object",
279
+ "additionalProperties": false,
280
+ "properties": {
281
+ "mode": {
282
+ "enum": [
283
+ "human-maintained",
284
+ "generated",
285
+ "assisted"
286
+ ]
287
+ },
288
+ "source": {
289
+ "type": "string"
290
+ },
291
+ "generator": {
292
+ "type": "string"
293
+ }
294
+ }
295
+ }
296
+ }
297
+ }
298
+ }
299
+ }
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: affected
3
+ description: Analyze which documents a code change affects and produce the documentation change manifest — required updates, optional updates, and the PR-ready review comment. Use before committing, when opening a PR, or for "what docs do I need to update".
4
+ allowed-tools: Bash(docgov *) Bash(git diff*) Bash(git status*) Read Write Edit
5
+ argument-hint: "[--base main]"
6
+ ---
7
+
8
+ # Change impact
9
+
10
+ ## Impact and manifest
11
+
12
+ !`docgov affected --json --compact $ARGUMENTS 2>&1 | head -c 10000`
13
+
14
+ ## What to do
15
+
16
+ 1. **Report the required list first.** Entries with `required: true` and `updated: false`
17
+ are the work. Everything else is context. Lead with the short list of files the user
18
+ actually has to touch.
19
+
20
+ 2. **Update them.** For each, read the document, find the part the change invalidates, and
21
+ make the minimal correct edit. Do not rewrite a document because one sentence is wrong.
22
+
23
+ 3. **Write the manifest** with `docgov checklist`. It lands in `.docgov/checklist.yaml` as a
24
+ deterministic checklist that survives across sessions and CI — and is deleted after
25
+ merge. Use it rather than holding the list in your head.
26
+
27
+ 4. **For a PR,** run `docgov checklist --pr` and post the output as a comment. It states the
28
+ code impact, the documentation impact, what is covered and what is outstanding.
29
+
30
+ 5. **If a required document genuinely does not need updating,** say why, explicitly, in the
31
+ PR comment or the commit message. "No documentation change needed because the refactor
32
+ preserved the documented behaviour" is a legitimate answer. Silence is not.
33
+
34
+ ## Signals worth reacting to
35
+
36
+ - `securityChanged` — the security architecture and threat model are almost always affected
37
+ and almost always forgotten. Check them specifically.
38
+ - `apiChanged` without a contract change — either the contract is now wrong, or the change
39
+ was internal and the signal is a false positive. Work out which.
40
+ - `behaviorChanged` without `testsChanged` — not a documentation problem, but worth saying
41
+ out loud once.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: brief
3
+ description: Load the minimal authoritative documentation context for a topic or domain before changing code — the constitution, the canonical specification, the invariants in force, the relevant ADRs and the machine contracts, and nothing else. Use before implementing or modifying anything in a governed area.
4
+ allowed-tools: Bash(docgov *) Read
5
+ argument-hint: "<domain-or-topic>"
6
+ ---
7
+
8
+ # Authoritative context
9
+
10
+ !`docgov brief $ARGUMENTS 2>&1 | head -c 28000`
11
+
12
+ ## How to use this
13
+
14
+ Everything above is authoritative and ordered: the most authoritative document is first.
15
+ It replaces reading the documentation tree — that is the point, and it is why the pack is
16
+ small.
17
+
18
+ **The rules while you work in this area:**
19
+
20
+ 1. **Invariants are binding.** If one blocks your approach, the invariant wins. Changing it
21
+ means changing its source document in the same change, with a stated reason. Do not
22
+ route around it.
23
+
24
+ 2. **Machine contracts beat prose.** Where a schema, OpenAPI document or migration is
25
+ listed, it is authoritative over any description of it, including the one in this pack.
26
+
27
+ 3. **Lower authority may not contradict higher.** If you find the canonical specification
28
+ and a guide disagreeing, the canonical specification is right and the guide is a bug.
29
+
30
+ 4. **If the pack is wrong, fix the document.** Do not write code that works around
31
+ incorrect documentation and leave the documentation incorrect — that is exactly the
32
+ state this product exists to prevent.
33
+
34
+ 5. **"Not included in full"** entries are real documents that did not fit the budget. Read
35
+ them directly if your change touches what their headings describe.
36
+
37
+ After you change code here, run `/docgov:affected` to find out which of these documents you
38
+ now owe an update.
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: create
3
+ description: Create a new governed document of the right class in the right place, with its template, its required sections, and its relationships already wired into the documentation graph. Use whenever new documentation is needed — a PRD, TRD, ADR, threat model, runbook, domain spec, guide or README.
4
+ allowed-tools: Bash(docgov *) Read Write Edit
5
+ argument-hint: "<type> \"<name>\" [--domain <domain>]"
6
+ ---
7
+
8
+ # Create a governed document
9
+
10
+ ## Before writing anything
11
+
12
+ 1. **Check it does not already exist.** Run `docgov find "<topic>"`. The results are in
13
+ authority order. If an authoritative document already covers this, update that one —
14
+ a second document on the same subject is how contradictions are born.
15
+
16
+ 2. **Pick the class.** `docgov types` lists all 56. If the user said "write docs for X",
17
+ decide which class X actually is rather than defaulting to a guide. Do not invent a class.
18
+
19
+ 3. **Load the authoritative context.** Run `docgov brief <domain-or-topic>`. Read it
20
+ before writing. It carries the constitution, the canonical spec, the invariants in
21
+ force and the machine contracts — the things your document must not contradict.
22
+
23
+ ## Create it
24
+
25
+ ```bash
26
+ docgov create <type> "<name>" --domain <domain>
27
+ ```
28
+
29
+ This puts the file in the canonical location, applies the template, declares the right
30
+ authority and visibility, and wires `depends_on` / `implements` edges from documents it
31
+ found to be related. It prints the required sections and the line limits.
32
+
33
+ ## Then write it
34
+
35
+ - **Fill every required section.** They are a deterministic gate: a TRD with no failure
36
+ analysis fails `docgov check`, and rightly so.
37
+ - **Stay inside the limit** the command printed. If the content genuinely needs more, the
38
+ document is probably two documents.
39
+ - **Reference, do not restate.** Machine contracts (OpenAPI, schemas, migrations) are
40
+ authoritative; link them. Copying a schema into prose creates a second source of truth
41
+ that will be wrong within a month.
42
+ - **Declare invariants** if this is a canonical document. Any line beginning
43
+ `INV-<DOMAIN>-001` becomes a first-class object that gets injected into every agent that
44
+ later touches the matching code. This is the highest-value thing you can write.
45
+ - **Map the code** this document describes, in frontmatter: `documents: ["src/licensing/**"]`.
46
+ Without it the document is invisible to drift detection.
47
+ - **Write for the class's audience.** A README is not an architecture document. A runbook
48
+ is numbered steps with expected results, not an essay.
49
+
50
+ ## Finish
51
+
52
+ Run `docgov check --path <new-file>` and fix what it reports. Then `docgov affected` to see
53
+ whether creating this document obliges you to update anything else.
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: find
3
+ description: Search documentation with authority-aware ranking, so the canonical specification is returned before the tutorial that paraphrases it. Use for "where is X documented", "what do we say about Y", or finding the authoritative source for a behaviour.
4
+ allowed-tools: Bash(docgov *) Read
5
+ argument-hint: "<query>"
6
+ ---
7
+
8
+ # Find documentation
9
+
10
+ !`docgov find "$ARGUMENTS" 2>&1 | head -c 10000`
11
+
12
+ ## How to read this
13
+
14
+ Results are ordered by **authority first, relevance second**. That ordering is deliberate:
15
+ an agent that reads the user guide before the canonical specification writes confidently
16
+ wrong code.
17
+
18
+ - `[CONSTITUTION]` / `[CANONICAL]` — authoritative. Start here. If something below
19
+ contradicts these, the thing below is wrong.
20
+ - `[REQUIREMENTS]` / `[DECISION]` — why it was built this way. ADRs explain decisions you
21
+ might otherwise reverse by accident.
22
+ - `[CONTRACT]` — machine-readable and authoritative over any prose about it.
23
+ - `[AUDIENCE]` — written for a reader, not for precision. Do not treat a guide as a spec.
24
+ - `[HISTORICAL]` — may be out of date on purpose. Check `status` before believing it.
25
+
26
+ If a result is marked `deprecated` or `superseded`, follow its `supersedes` edge to the
27
+ current document instead of using it.
28
+
29
+ ## If nothing relevant comes back
30
+
31
+ That is a coverage gap, not a search failure. Run `docgov health` to see whether DocGov
32
+ already knows the document is missing, and offer to create it with `/docgov:create`.
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: health
3
+ description: Score documentation health across coverage, freshness, consistency, structure, discoverability, cross-linking, canonical integrity and metadata, and list the gaps the repository's own stack implies. Use for "how are my docs doing", documentation audits, or a periodic review.
4
+ allowed-tools: Bash(docgov *) Read
5
+ ---
6
+
7
+ # Documentation health
8
+
9
+ !`docgov health --json --compact 2>&1 | head -c 8000`
10
+
11
+ ## How to report this
12
+
13
+ 1. **The score, then the single highest-leverage fix.** Not eight bullet points of
14
+ component scores the user has to rank themselves. Lead with: "91/100. The one thing
15
+ worth fixing is X."
16
+
17
+ 2. **Explain any component below 80 in terms of what is actually wrong** — the files, not
18
+ the metric. "Freshness 67" means nothing; "four canonical documents have had no review
19
+ while the code they describe changed 30 times" is a fact someone can act on.
20
+
21
+ 3. **Coverage gaps are the most actionable part.** Each one means the repository's stack
22
+ implies documentation that does not exist — Kubernetes manifests with no deployment
23
+ guide, OAuth with no authentication model. Offer to create the top two or three with
24
+ `/docgov:create`.
25
+
26
+ 4. **Do not recommend raising the score.** Recommend fixing specific documents. A score
27
+ that goes up because someone added frontmatter to archived notes is worse than a score
28
+ that stays flat.
29
+
30
+ ## Context for the numbers
31
+
32
+ - **canonical integrity** below 100 is the serious one: it means the authority model itself
33
+ has been violated, and every other number is built on sand.
34
+ - **coverage** counts both what is classified and what the stack implies should exist.
35
+ - **freshness** is semantic, not calendar-based — a correct document that has not changed
36
+ in two years scores fine.
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: inspect
3
+ description: Review documentation quality against its audience lens, find contradictions between documents, and check whether another agent could safely act on a document. Use for "review my docs", documentation quality checks, contradiction hunting, or before publishing.
4
+ allowed-tools: Bash(docgov *) Read
5
+ argument-hint: "[--path <file>] [--contradictions] [--lens readme|developer|architecture|security|user|agent|operations]"
6
+ ---
7
+
8
+ # Review documentation
9
+
10
+ ## Deterministic findings (already decided, do not re-litigate)
11
+
12
+ !`docgov check --json --compact 2>&1 | head -c 10000`
13
+
14
+ ## What to review
15
+
16
+ Everything above is settled by software. Your job is the part software cannot decide.
17
+ Work only on these four questions, and say plainly when the answer is "this is fine".
18
+
19
+ ### 1. Audience fit — apply the right lens
20
+
21
+ Read the lens for the document's class in `lenses/<lens>.md` and judge against it, not
22
+ against your general taste. The lenses are: `readme`, `developer`, `architecture`,
23
+ `security`, `user`, `agent`, `operations`. A document that is excellent under the wrong
24
+ lens is a defect: an architecture essay inside a getting-started guide fails even if every
25
+ sentence is true.
26
+
27
+ ### 2. Contradictions
28
+
29
+ Run `docgov inspect contradictions --json`. You get narrowed candidate pairs with excerpts,
30
+ not a verdict. For each:
31
+ - **Genuine contradiction** — two documents state incompatible facts. The higher-authority
32
+ document is presumed right; name which one must change and why.
33
+ - **Equal authority** — no tie-break exists. This is the dangerous case. Escalate it to the
34
+ user rather than picking.
35
+ - **Acceptable overlap** — different audiences saying the same thing differently. Leave it.
36
+
37
+ Quote the conflicting sentences. A contradiction report without the two sentences in it is
38
+ unactionable.
39
+
40
+ ### 3. Agent readiness
41
+
42
+ Could a different agent act on this document without making a wrong assumption? Check for:
43
+ unstated prerequisites, `TBD`/`TODO` that reads as fact, examples that cannot run as
44
+ written, stale version numbers, and claims with no source. This lens matters more every
45
+ month and is the one humans skip.
46
+
47
+ ### 4. Quality scores — advisory, and say so
48
+
49
+ Run `docgov inspect quality --json` for the deterministic dimensions (structure, grounding,
50
+ cross-references, freshness). Add your judgement on clarity, completeness, audience fit and
51
+ security reasoning. Present the result as advice with the reasoning attached, never as a
52
+ pass/fail. Do not tell the user a document "scores 87" without saying what the missing 13
53
+ actually is.
54
+
55
+ ## Output
56
+
57
+ Findings ordered by what you would fix first, each with the file, the line or section, and
58
+ the concrete edit. No scores without reasons. No praise padding.
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: publish
3
+ description: Analyze which documentation is safe to publish externally, detect information that would leak, and produce external-lens rewrite briefs. Use before publishing docs, opening a repository, or moving internal documentation to a public site.
4
+ disable-model-invocation: true
5
+ allowed-tools: Bash(docgov *) Read Write Edit
6
+ argument-hint: "[--target docs/11-external]"
7
+ ---
8
+
9
+ # Publishing analysis
10
+
11
+ !`docgov publish --json --compact $ARGUMENTS 2>&1 | head -c 10000`
12
+
13
+ ## The rule this skill exists to enforce
14
+
15
+ **An external document is a different artifact, not a copy of an internal one.** They serve
16
+ different readers and answer different questions. Copying internal documentation outward —
17
+ even with the secrets removed — produces documentation that is technically safe and
18
+ practically useless, and it leaks information structure even when it leaks no values.
19
+
20
+ ## What to do
21
+
22
+ 1. **`blocked[]` — report and stop.** These contain detected sensitive patterns. List the
23
+ file, line and what was found. Do not publish, do not "clean up and publish anyway" on
24
+ your own judgement. Hand it back to the user.
25
+
26
+ 2. **`rewrite[]` — write a new document, do not edit the old one.** Use the brief in
27
+ `briefs[]`. Under the external lens:
28
+ - no internal jargon, team names, ticket ids, or hostnames
29
+ - no unmitigated risks, no infrastructure topology
30
+ - task-oriented: what the reader wants to do, not how the system is built
31
+ - prerequisites stated explicitly, because the external reader has none of your context
32
+ - every example runnable exactly as written
33
+
34
+ 3. **`publishable[]` — still read before shipping.** Soft flags (ticket references, email
35
+ addresses, work-in-progress markers) are judgement calls, not false positives.
36
+
37
+ 4. **Never publish.** This skill analyzes and drafts. A human approves and a human ships.
38
+ Say that explicitly when you report, and do not offer to push anything.
39
+
40
+ ## The threat model / public security model pair
41
+
42
+ These are the canonical example of the same subject needing two documents. The threat model
43
+ is `visibility: internal` and names unmitigated risks. The public security model is
44
+ `visibility: public` and says what you protect and how to report a vulnerability. One is
45
+ not a redaction of the other.
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: review
3
+ description: Inventory, classify and produce a migration plan for a repository that already has documentation. Detects duplicates, contradictions, oversized documents, wrong locations, missing frontmatter and coverage gaps, then writes a plan that changes nothing until approved. Use for existing repositories, messy documentation trees, or "organize my docs".
4
+ disable-model-invocation: true
5
+ allowed-tools: Bash(docgov *) Bash(git status*) Bash(git log*) Read Write Edit
6
+ ---
7
+
8
+ # Onboard an existing repository
9
+
10
+ ## Plan
11
+
12
+ !`docgov review --json --compact 2>&1 | head -c 24000`
13
+
14
+ ## What to do
15
+
16
+ The JSON above is the full plan; `.docgov/fix-plan.md` is the human-readable version.
17
+ **Nothing has been changed.**
18
+
19
+ 1. **Summarize honestly, shortest first.** How many documents, how many DocGov could not
20
+ classify, how many moves, how many real judgement calls. Do not pad the summary with
21
+ the things that went fine.
22
+
23
+ 2. **Work the low-confidence classifications.** `classifications[]` entries with
24
+ `needsReview: true` are where the deterministic classifier gave up. Read each document
25
+ (just enough of it) and decide its class yourself. Run `docgov types` if you need the
26
+ list. Then write the decision into the document's frontmatter:
27
+
28
+ ```
29
+ docgov:
30
+ id: <kebab-id>
31
+ type: <class>
32
+ authority: <from the class>
33
+ visibility: internal|public|confidential
34
+ ```
35
+
36
+ Declaring the type is what turns a guess into a fact — the classifier never overrides
37
+ a declared type.
38
+
39
+ 3. **Adjudicate the contradiction candidates.** `contradictionCandidates[]` is a narrowed
40
+ list, not a verdict. For each pair, read both and decide: genuine contradiction,
41
+ acceptable overlap (different audiences saying the same thing in different words), or
42
+ genuine duplicate. Use the `architect` agent for the non-obvious ones. Only real
43
+ contradictions need fixing, and the higher-authority document is the one that is right
44
+ unless you have a reason to think otherwise.
45
+
46
+ 4. **Propose, do not perform, the high-risk actions.** `SPLIT`, `MERGE` and `EXTRACT`
47
+ rewrite prose. Present them to the user as a short list with your recommendation, and
48
+ handle them one at a time through `/docgov:tag`.
49
+
50
+ 5. **When the user approves, run the mechanical half:**
51
+ ```bash
52
+ docgov fix --dry-run # every file operation, nothing touched
53
+ docgov fix # on a branch, with link repair and verification
54
+ ```
55
+ `migrate` refuses to run without git or with a dirty tree. That is deliberate: the
56
+ "no information lost" promise is only real if every change is revertible.
57
+
58
+ 6. **Verify.** After migrating, run `docgov check` and `docgov health`. Report the health
59
+ score and the top three things that would raise it most.
60
+
61
+ ## Do not
62
+
63
+ Do not move files yourself — `migrate` repairs links in the same transaction and your
64
+ `mv` will not. Do not merge two documents' prose without showing the user what you are
65
+ about to delete.