@nurix/etna 0.20.25 → 0.20.26

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 (72) hide show
  1. package/data/harness-index.json +1 -1
  2. package/data/harnesses/code/CLAUDE.md +4 -4
  3. package/data/harnesses/code/agents/bookkeeper.md +1 -1
  4. package/data/harnesses/code/agents/change-review.md +1 -1
  5. package/data/harnesses/code/agents/lld-mode.md +1 -1
  6. package/data/harnesses/code/agents/maintenance.md +7 -9
  7. package/data/harnesses/code/docs/structure.md +133 -71
  8. package/data/harnesses/code/harness.json +4 -4
  9. package/data/harnesses/code/hooks/awareness.mjs +0 -10
  10. package/data/harnesses/code/hooks/lib/ownership.mjs +4 -2
  11. package/data/harnesses/code/hooks/lib/sweep.mjs +4 -8
  12. package/data/harnesses/code/skills/documentation/SKILL.md +19 -8
  13. package/data/harnesses/code/skills/documentation/references/frontmatter.md +3 -3
  14. package/data/harnesses/code/skills/documentation/references/style-guide.md +70 -27
  15. package/data/harnesses/code/skills/documentation/references/untemplated.md +2 -1
  16. package/data/harnesses/code/skills/documentation/scripts/doc-lint.mjs +87 -1
  17. package/data/harnesses/code/skills/documentation/templates/Readme.md +4 -3
  18. package/data/harnesses/code/skills/documentation/templates/bookkeeping.md +1 -1
  19. package/data/harnesses/code/skills/documentation/templates/docs-readme.md +15 -36
  20. package/data/harnesses/code/skills/documentation/templates/doctrine.md +82 -0
  21. package/data/harnesses/code/skills/documentation/templates/feature.md +31 -123
  22. package/data/harnesses/code/skills/documentation/templates/handover.md +174 -0
  23. package/data/harnesses/code/skills/documentation/templates/operations-procedure.md +1 -1
  24. package/data/harnesses/code/skills/documentation/templates/package.md +28 -94
  25. package/data/harnesses/code/skills/documentation/templates/root-readme.md +103 -65
  26. package/data/harnesses/code/skills/documentation/templates/setup.md +138 -0
  27. package/data/harnesses/code/skills/documentation/templates/system.md +25 -109
  28. package/data/harnesses/delivery/agents/lld-mode.md +1 -1
  29. package/data/harnesses/delivery/agents/maintenance.md +7 -9
  30. package/data/harnesses/delivery/harness.json +2 -2
  31. package/data/harnesses/delivery/skills/documentation/SKILL.md +19 -8
  32. package/data/harnesses/delivery/skills/documentation/references/frontmatter.md +3 -3
  33. package/data/harnesses/delivery/skills/documentation/references/style-guide.md +70 -27
  34. package/data/harnesses/delivery/skills/documentation/references/untemplated.md +2 -1
  35. package/data/harnesses/delivery/skills/documentation/scripts/doc-lint.mjs +87 -1
  36. package/data/harnesses/delivery/skills/documentation/templates/Readme.md +4 -3
  37. package/data/harnesses/delivery/skills/documentation/templates/bookkeeping.md +1 -1
  38. package/data/harnesses/delivery/skills/documentation/templates/docs-readme.md +15 -36
  39. package/data/harnesses/delivery/skills/documentation/templates/doctrine.md +82 -0
  40. package/data/harnesses/delivery/skills/documentation/templates/feature.md +31 -123
  41. package/data/harnesses/delivery/skills/documentation/templates/handover.md +174 -0
  42. package/data/harnesses/delivery/skills/documentation/templates/operations-procedure.md +1 -1
  43. package/data/harnesses/delivery/skills/documentation/templates/package.md +28 -94
  44. package/data/harnesses/delivery/skills/documentation/templates/root-readme.md +103 -65
  45. package/data/harnesses/delivery/skills/documentation/templates/setup.md +138 -0
  46. package/data/harnesses/delivery/skills/documentation/templates/system.md +25 -109
  47. package/data/harnesses/etna/agents/change-review.md +1 -1
  48. package/data/harnesses/etna/agents/lld-mode.md +1 -1
  49. package/data/harnesses/etna/agents/maintenance.md +7 -9
  50. package/data/harnesses/etna/harness.json +2 -2
  51. package/data/harnesses/etna/skills/documentation/SKILL.md +19 -8
  52. package/data/harnesses/etna/skills/documentation/references/frontmatter.md +3 -3
  53. package/data/harnesses/etna/skills/documentation/references/style-guide.md +70 -27
  54. package/data/harnesses/etna/skills/documentation/references/untemplated.md +2 -1
  55. package/data/harnesses/etna/skills/documentation/scripts/doc-lint.mjs +87 -1
  56. package/data/harnesses/etna/skills/documentation/templates/Readme.md +4 -3
  57. package/data/harnesses/etna/skills/documentation/templates/bookkeeping.md +1 -1
  58. package/data/harnesses/etna/skills/documentation/templates/docs-readme.md +15 -36
  59. package/data/harnesses/etna/skills/documentation/templates/doctrine.md +82 -0
  60. package/data/harnesses/etna/skills/documentation/templates/feature.md +31 -123
  61. package/data/harnesses/etna/skills/documentation/templates/handover.md +174 -0
  62. package/data/harnesses/etna/skills/documentation/templates/operations-procedure.md +1 -1
  63. package/data/harnesses/etna/skills/documentation/templates/package.md +28 -94
  64. package/data/harnesses/etna/skills/documentation/templates/root-readme.md +103 -65
  65. package/data/harnesses/etna/skills/documentation/templates/setup.md +138 -0
  66. package/data/harnesses/etna/skills/documentation/templates/system.md +25 -109
  67. package/lib/install/materialize.mjs +4 -12
  68. package/lib/install/plan.mjs +4 -11
  69. package/package.json +3 -2
  70. package/data/harnesses/code/skills/documentation/templates/structure.md +0 -71
  71. package/data/harnesses/delivery/skills/documentation/templates/structure.md +0 -71
  72. package/data/harnesses/etna/skills/documentation/templates/structure.md +0 -71
@@ -1,131 +1,65 @@
1
1
  # Package Documentation (docs/architecture/packages/{package}.md)
2
2
 
3
- Truth document. Use for: **one workspace package — what it is and how it behaves**. One file per package, named for the package's folder (`packages/cli/` → `docs/architecture/packages/cli.md`). It states the package's own machinery: its manifest and published identity, its build and entry point, its source layout, and every behavior of its tree that no system or feature document claims.
3
+ Truth document. Use for: **one workspace package** — one unit of distribution: a manifest, a build, a binary, a bundle, a Worker. One file per package, named for its folder.
4
4
 
5
- **A package document is the residual owner of its own tree.** Its `owns:` is the whole package glob — `["packages/{name}/**"]` — and that glob is the *broadest* claim anything makes on those paths, so it loses to every narrower one. A system document naming `packages/{name}/src/server/runs/**` wins those files by specificity; a feature document naming `packages/{name}/src/surfaces/apps/**` wins those. What is left after every narrower claim is what this document describes, and it describes that exhaustively. **The residual claim is a promise of completeness, not of scope**: a package document with nothing left after the systems and features have claimed their subtrees is still owed — the manifest, the build, the entry, the layout, the test wiring and the deploy shape are always residual.
5
+ **A document is read by people, and its footer is for the agent** (`references/style-guide.md` § Documents are read by people). A package document tells a person what the package is for, why it is its own unit, how it ships and to whom, how it is meant to be used, and what its consumers can rely on. Its manifest, build, entry, internal layout and test wiring are the code graph's (`docs/architecture/systems/knowledge-layer.md`), not a roster here.
6
6
 
7
- **Two rules bind the glob.** Neither genre may claim a path another document claims at **equal specificity** — equal-specificity overlap is an ownership conflict to resolve before either document ships, not a duplication to live with. And every glob **matches at least one file on disk** at `status: active`; a projected glob is permitted only at `draft`, and is confirmed when the document flips.
7
+ **A package document's deepest layer is its public contract** (`references/style-guide.md` § Shape — the model first, the detail after): the commands and flags a person types, the exports another package imports, what is installed and where. For a CLI the flags *are* the promise, so they belong in How it is used. It stops before internal layout, build steps and which file holds what.
8
8
 
9
- **How this differs from its neighbours.** A **feature** document covers one capability or one page a person names, and owns that surface's globs. A **system** document covers one machine that spans packages, and owns the subtrees that machine is made of. A **package** document covers one unit of distribution — a manifest, a build, a binary or a bundle — and owns what is left of it. The unit is the package boundary, so if the subject you are writing about does not stop at a `package.json`, it is not this genre. Route it: one screen → feature; one machine crossing two packages → [system](system.md).
9
+ **A package document is the residual owner of its own tree.** Its `owns:` is the whole package glob — the broadest claim on those paths, so it loses to every narrower system or feature claim. The one enumerable fact it declares is the ownership table: which subtrees other documents claim.
10
10
 
11
- **Required vs optional.** Required in every package document: the **frontmatter**, the **opening** (title, identity line, what the package is), the **ownership boundary** (what this document does not describe and which document does), at least one **behavior section**, **Files**, and **Related**. Everything else is optional — include a section only when the package has something real to put in it. A package with no test wiring of its own gets no verification section; a package that nothing else in the repo consumes says so in one line rather than growing a Consumers section. A short accurate document beats a full skeleton with empty headings.
12
-
13
- Package documents run long because they are exhaustive over their residue — roughly 150 to 600 lines is the working range, and the top of that range is a package holding an application, not a document that has lost discipline.
11
+ **Required:** the frontmatter, the identity line, the goal line, **Why it exists**, **Ownership** (one paragraph or a table), **How it is used**, **What it promises**, **For the agent**. **What was decided** once any choice was made the code cannot explain. **Known gaps** only when there is one. Nothing else — the feature template's lint rules apply. Forty to a hundred and twenty lines.
14
12
 
15
13
  ```yaml
16
14
  ---
17
- owns: ["packages/{name}/**"] # required — the whole package tree, one glob; the residual claim
18
- keywords: [package-name, binary, build, entry] # required — discovery terms: the npm name, the binary, the surfaces
19
- status: active # required — active | draft | deprecated
20
- applies: [docs/architecture/common/api.md] # optional — cross-cutting doctrine this package is BOUND by (obligation, not a bibliography); omit when none
21
- type: package # required tooling key — genre stamp; preserve on edits, never narrate
15
+ type: package
16
+ status: active
17
+ objects: [nustack cli, device credential] # required — the objects this package designs or ships
18
+ owns: ["packages/{name}/**"] # required until the graph computes ownership — the residual claim
19
+ applies: [docs/architecture/common/api.md] # optional
22
20
  ---
23
21
  ```
24
22
 
25
- > A package document carries no `module:` — a package is already a bounded unit, and a second label
26
- > for the same boundary is a thing to keep in sync for nothing. `last-reviewed:` is optional and,
27
- > like `type:`, is tooling metadata: preserve it, never narrate it.
28
-
29
23
  ```
30
24
  # {package-path} — {the one-line role}
31
25
 
32
- **Package:** `@scope/name` · **Ships as:** {a public npm package with one binary `x` / a private
33
- source-first workspace package / a Worker on {domain}} · **Source:** `packages/{name}`
34
-
35
- {One paragraph: what this package is and the job it does in the product. Name what it holds that
36
- nothing else does, and what it deliberately does not hold. Written for someone who has not opened
37
- the folder.}
38
-
39
- {One paragraph: the ownership boundary. This document is the residual owner of `packages/{name}/**`;
40
- these subtrees are claimed at higher specificity by these documents and are pointed at, not
41
- restated. Where the routing is more than a sentence, make it the table below instead.}
26
+ **Package:** `@scope/name` · **Ships as:** {…} · **Source:** `packages/{name}`
42
27
 
43
- {Optional, and worth its line whenever the body names paths: "Paths below are relative to
44
- `packages/{name}/` unless they name another package."}
28
+ {One sentence: the job this package does in the product, for whom.}
45
29
 
46
- ## What is built and what is not
30
+ ## Why it exists
47
31
 
48
- {Optional — required in substance whenever some of the tree does not run. State plainly which
49
- halves exist and which do not, with the source evidence for each claim, and say what a reader who
50
- runs the unbuilt half will actually observe. A package whose subject as a whole does not run is
51
- `status: draft` and says so here; a scoped gap in a working package stays `active` and takes an
52
- UNBUILT marker at the section that describes the gap.}
32
+ {Why it is its own unit, what it holds that nothing else does, what it deliberately does not hold, who consumes it, how and when it ships. Prose.}
53
33
 
54
- ## Ownership — packages/{name}
34
+ ## Ownership
55
35
 
56
- {Optional — use the table form when more than two documents claim subtrees of this package.}
57
-
58
- **The package glob is the residual claim.** A system or feature document's `owns:` is more specific
59
- and wins by specificity, so this document describes only what none of them claims, and points to
60
- each for the rest.
61
-
62
- | Path | What it is |
63
- | --- | --- |
64
- | `src/index.ts` | {the residue: the entry, the dispatch, the layout} |
36
+ This document is the residual owner of `packages/{name}/**`. Claimed at higher specificity:
65
37
 
66
38
  | Subtree | Stated and owned by |
67
39
  | --- | --- |
68
40
  | `src/{machine}/**` | [{system}](../systems/{system}.md) |
69
- | `src/surfaces/{x}/**` | [{feature}](../../features/{feature}.md) |
70
41
 
71
- ## {Behavior sections — named for this package's own machinery}
42
+ ## How it is used
72
43
 
73
- {The body. There is no fixed section list, and inventing one would be a lie: what a CLI owes
74
- (commands, the store, the on-ramp) and what a UI package owes (the host port, the frame, the route
75
- zones, the component pool) share no headings. Name each section for the thing it describes and
76
- order them the way a reader meets them — identity and build first, then the surface, then what it
77
- writes, then how it is verified. Prefer a table wherever the content is a roster (commands, routes,
78
- exports, bindings, environment variables); prefer prose wherever the content is a rule and its
79
- reason. State mechanisms and contracts, never pasted implementations.}
44
+ {What a person or another package does with it, in plain words — install, run, import, call — and what they see. Terms introduced on first use. Code named only at a seam.}
80
45
 
81
- ## Tests
46
+ ## What was decided
82
47
 
83
- {Optional. What proves this package, and what each suite pins — a `Suite | Pins` table, or the
84
- commands a reader runs. A package whose verification is a build check names the check instead
85
- (`## Checks`, `## Build and test`); a package with no suite of its own says so in one line in the
86
- build section and carries no heading here.}
48
+ {Themed paragraphs.}
87
49
 
88
- ## Files
50
+ ## What it promises
89
51
 
90
- | Path | Role |
91
- | --- | --- |
92
- | `packages/{name}/package.json` | {the manifest: the bin, the exports, the scripts} |
93
- | `packages/{name}/src/index.ts` | {the entry} |
52
+ {What a consumer can rely on and what the package refuses; checkable sentences, grouped.}
94
53
 
95
- {One row or bullet per file this document owns, with what it holds — the roster a reader uses to go
96
- from the document to the code. Close with the inverse where it helps: "Read here, owned elsewhere:"
97
- naming the paths the body describes but another document claims.}
54
+ ## Known gaps
98
55
 
99
- ## Related
56
+ {One paragraph, only when needed.}
100
57
 
101
- - [`{system}.md`](../systems/{system}.md) — {why a reader of this document would open that one}
102
- - [`{other-package}.md`]({other-package}.md) — {the seam between the two}
103
- - [`{doctrine}.md`](../common/{doctrine}.md) — {the cross-cutting contract this package answers to}
104
- ```
105
-
106
- ### The identity line
58
+ ## For the agent
107
59
 
108
- The bolded `·`-separated run under the title is what a reader checks first, and it answers three
109
- questions no body section should have to: **what is this called** on the registry or in the
110
- workspace, **how does it ship** (a public tarball, a private source-first package, a deployed
111
- Worker, a signed installer), and **where is its source**. A package that ships two artifacts names
112
- both. Add a `**Crate:**` or `**Deploys as:**` term where the package has one; drop any term that
113
- would restate the title.
60
+ Objects: {…}. Commands {…} and exports {…} — the public contract. Code root `packages/{name}/`. Seams {…} by name. Checklist `tests/{package}.md`. See also {neighbour} ({why}). No file lists or symbol rosters — those are the graph's.
61
+ ```
114
62
 
115
63
  ### Marking what is decided and unbuilt
116
64
 
117
- Where the package holds code for a design that is decided and not built — or a surface whose other
118
- half does not exist — wrap the prose in a marker so the gap is machine-findable and its evidence
119
- travels with it:
120
-
121
- ```
122
- <!-- UNBUILT:START — {what is decided, where it is decided (an AD or an owner ruling), and the
123
- source evidence that it is not built: the file that does not exist, the route that is not mounted,
124
- the binding that is not declared} -->
125
- {the prose describing the unbuilt half}
126
- <!-- UNBUILT:END -->
127
- ```
128
-
129
- **A design that was decided *against* carries no marker.** A marker means the work is owed and
130
- absent; using one for a rejected design turns the register of debt into a register of opinions.
131
- Say in prose that it is not built and not owed, and name the decision that settled it.
65
+ `<!-- UNBUILT:START — {…} -->` … `<!-- UNBUILT:END -->` around the prose for a decided, unbuilt half; a design decided *against* carries no marker.
@@ -1,104 +1,142 @@
1
- # Project Root README
1
+ # Project Root README (/README.md)
2
2
 
3
- Truth document. Use for: the human-facing entry point at the repository root (`/README.md`) — what visitors and new contributors land on. Distinct from `docs/README.md` (the agent/doc index — see **docs/README.md (Documentation Root)** above). The two coexist; don't merge them.
3
+ Truth document. Use for: the repository root `/README.md`. It opens outward — what the product does, for whom, and where it runs, in a user's terms — then turns inward for the team and coding agents: what state the repo is in, how it works, what its parts are and what must not break, then routes every other question into `docs/`. The outward part comes first because it is what a stranger reads; the inward part is longer because it is what the team uses. **It hosts nothing it can link to.** It is distinct from `docs/README.md`, which describes the folders of the docs tree, and from `CLAUDE.md` / `AGENTS.md`, the standing rules an agent loads. It points at both and restates neither.
4
4
 
5
- ### Strategy
5
+ ### What it carries
6
6
 
7
- The root README answers, in order:
7
+ Sections come in this order; 1 to 3 are the outward-facing first screen, 4 onward the inward page. Skip any section the repo cannot fill truthfully. Never pad it, and never leave a stub.
8
8
 
9
- 1. **What is this?** — one to two sentences, no marketing claims
10
- 2. **What do I get if I install it?** — capability families
11
- 3. **What's it built on?** — terse stack list with versions
12
- 4. **How do I run it?** — the three or four scripts that matter
13
- 5. **How is it laid out?** — directory tree, one-liner per significant folder
14
- 6. **How do I extend it?** — numbered contribution checklist
15
- 7. **What state is it in?** — pre-publish, beta, stable, internal
9
+ 1. **Identity.** The H1 plus two or three sentences in a user's terms: what the product is, where it runs, and what using it is like.
10
+ 2. **What it does.** Two to four paragraphs, outward-facing: the core loop as a person meets it, what surrounds that loop, how the product follows the person across its surfaces, and who it is for, closing with what it deliberately is not. Plain words, no feature roster, no superlatives.
11
+ 3. **Where it runs.** One paragraph: the addresses, the distributed artifacts and where they are published, where identity comes from, and whether a self-hosted edition exists.
12
+ 4. **The turn.** A rule and one paragraph saying the rest is for the team and agents, with the scope line: what lives in this repo and what lives elsewhere.
13
+ 5. **State.** Optional: a one-line blockquote, present only while something repo-wide is true that a newcomer must know (frozen, mid-migration, mid-breaking-change on `dev`). It links the plan or runbook that owns the change. Say here which units publish and where, if any do.
14
+ 6. **How it works.** Three to six short paragraphs, or numbered stages, along the main request or data path: who arrives, what is built, where state lives, how the result leaves. Name a technology only where it explains a stage. End with a link to the system overview.
15
+ 7. **What is in the repository.** A sentence on how the tree is organised, then one table row per top-level unit (package, app, service), giving its path, what it is in one line, and its owning doc; the top folders that are not packages get a sentence each. This replaces the tree.
16
+ 8. **Rules that bite.** Optional. At most five one-line invariants, public/internal boundaries, never-edit paths (generated, protected) or non-goals, each linked to the doc that argues it.
17
+ 9. **Where to go.** An intent-to-destination table. Its last row is the one for agents.
18
+ 10. **Everyday commands.** Optional. At most four commands run on every change, ending at the gate a push must pass. First-run commands are never here.
16
19
 
17
- Skip any section that doesn't apply. Don't pad to fill the template.
20
+ ### What it leaves out
21
+
22
+ | Left out | Lives in |
23
+ | --- | --- |
24
+ | Getting started, install, prerequisites, env files, first run, troubleshooting | `docs/operations/setup.md` |
25
+ | Stack: technologies, what each is for, where its version is pinned | `docs/operations/setup.md` § Stack. Why it was chosen goes in `docs/architecture/` |
26
+ | Directory or file tree | `docs/structure.md`, the only tree |
27
+ | Daily loop, watch modes, per-package traps | `docs/operations/local-development.md` |
28
+ | Contributing procedure, branch model, commit rules | `CLAUDE.md` and `docs/operations/` |
29
+ | Feature list, news, "what's new", roadmap, changelog | `docs/features/`, `docs/history/` |
30
+ | Badges, logos, images, screenshots, social links, sponsors, hand-written TOC, license text, superlatives | Nowhere. The outward sections are plain prose too. Agents cannot read them and the team does not need them. License is one line or absent |
18
31
 
19
32
  ### Writing rules
20
33
 
21
- - **Sentence-case headings.** "Getting started", not "Getting Started".
22
- - **Concrete over abstract.** Real versions, real paths, real commands. No "leverages cutting-edge…".
23
- - **The tagline answers "what is this?"** — not "why is it great?". Two sentences max.
24
- - **Tables for enumeration** (routes, commands, endpoints). **Bullets for families and categories.**
25
- - **Directory tree as a code block**, not a nested markdown list.
26
- - **Numbered checklist** for "how to add a thing" — readers should be able to follow it top-to-bottom without re-reading.
27
- - **Point to `docs/` for depth.** The root README links into deep docs; it doesn't host them.
28
- - **Detect the package manager from the lockfile** (`pnpm-lock.yaml` → pnpm, `yarn.lock` → yarn, otherwise npm) and write commands accordingly. Don't hardcode `npm` if the repo uses pnpm.
34
+ - **Budget: between 60 and 140 non-blank lines, the outward part under a third of it.** Prose is welcome — How it works and Rules that bite read better as paragraphs than as rows — but past the ceiling a section is hosting content that belongs in a doc. Move it and leave the link.
35
+ - **Every section is either a fact the reader acts on or a link.** If a section needs a paragraph, it needs a doc.
36
+ - **One H1, then H2 sections, in plain Markdown.** Sentence-case headings, no emoji, no HTML layout, and no `#` comment lines inside code blocks (they parse as H1s).
37
+ - **Relative links into the repo only.** Never an absolute repo URL. Never an external site as the home of a canonical doc.
38
+ - **Link folders and mandated scaffolds, never rosters.** The allowed targets are folders, `docs/README.md`, `docs/structure.md`, `docs/operations/setup.md`, `docs/history/CHANGELOG.md`, `docs/history/backlog.md`, `CLAUDE.md` and the owning docs in the Map. A procedure is named only where a Where-to-go row needs it. Never list individual feature docs: the ownership index finds them.
39
+ - **No tree.** The Map stops at top-level units and never lists files. Mark paths that look primary but are not, for example "`legacy/`: reference only, never edited".
40
+ - **The Map is a coarse view of the ownership index, not a rival to it.** The Owning doc column names the doc that the index's `owns:` globs resolve to. When the two disagree the index wins, and the Map row is fixed in the same change.
41
+ - **No version numbers and no dates.** Name the file that pins a version (`.nvmrc`, `packageManager`, `rust-toolchain.toml`). Write in the present tense, with no "coming soon" and no "as of".
42
+ - **State rules, don't argue them.** One line each. The reasoning lives in the linked doc, and agent process rules stay in `CLAUDE.md`.
43
+ - **Commands come from the repo.** Detect the package manager from the lockfile (`pnpm-lock.yaml` gives pnpm, `yarn.lock` gives yarn, otherwise npm). Use only scripts that exist, each with a trailing comment saying what it does.
29
44
 
30
45
  ### Template
31
46
 
32
47
  ```markdown
33
- # {package-name}
48
+ # {Project name}
34
49
 
35
- {One- to two-sentence positioning. What it is and what scope it covers. No superlatives, no value claims.}
50
+ {Two or three sentences in a user's terms: what the product is, where it runs, what using it is like.}
36
51
 
37
- ## What's in the box
52
+ ## What it does
38
53
 
39
- - **{Family 1}** — {what's in it; a few specific items, comma-listed.}
40
- - **{Family 2}** — {what's in it.}
41
- - **{Family 3}** — {what's in it.}
54
+ {The core loop as a person meets it: what they bring, what the product does, what they get back and what record it leaves.}
42
55
 
43
- The full surface lives in [`{path/to/public-index}`]({path/to/public-index}). ← optional pointer for libraries
56
+ {What surrounds the loop: the capabilities a team needs to run it, named plainly.}
44
57
 
45
- ## Stack
58
+ {How it follows the person across surfaces: CLI, desktop, integrations, agents' doors.}
46
59
 
47
- - {Framework} {version} · {Language} {version}
48
- - {Build tool} {version}
49
- - {Other load-bearing deps}
60
+ {Who it is for, and what it deliberately is not.}
50
61
 
51
- ## Getting started
62
+ ## Where it runs
52
63
 
53
- \`\`\`bash
54
- {pm} install
55
- {pm} run dev # what it does (port, URL)
56
- {pm} run build # what it does
57
- {pm} run preview # what it does (omit if not applicable)
58
- \`\`\`
64
+ {Addresses; distributed artifacts and where they publish; where identity comes from; whether a self-hosted edition exists.}
59
65
 
60
- {Optional one-liner about first-run behavior — e.g., "Dev server lands on /playground."}
66
+ ---
61
67
 
62
- ## {Runtime entry point} ← optional; e.g., "The playground", "CLI", "API endpoints"
68
+ The rest of this page is for the team and for coding agents working in this repository. {What lives in this repo and what lives elsewhere.} {One sentence: the sections below route every other question into docs/.}
63
69
 
64
- {Brief description of the dev/runtime surface.}
70
+ > **State:** {one line: what is in flux right now; which units publish where} → [{plan or runbook}](docs/history/{plans|migrations}/{file}.md) ← optional; delete when the flux ends
65
71
 
66
- | {Thing} | {What it shows / does} |
67
- | -------------------- | ---------------------- |
68
- | `{route or command}` | {description} |
72
+ ## How it works
69
73
 
70
- ## Layout
74
+ 1. **{Stage}**: {what happens, naming the mechanism only where it explains the step}.
75
+ 2. **{Stage}**: {…}.
76
+ 3. **{Stage}**: {where state lives}.
77
+ 4. **{Stage}**: {the outbound effect: what is written, deployed or returned}.
71
78
 
72
- \`\`\`
73
- src/
74
- ├── {entry-file} # {purpose}
75
- ├── {folder}/ # {purpose}
76
- │ └── ...
77
- └── {folder}/ # {purpose}
78
- \`\`\`
79
+ {Optional, one sentence naming the seam everything passes through, e.g. "Every client reaches data through `{path}`; nothing else talks to the database."} The full account: [{system overview}](docs/architecture/{overview}.md).
80
+
81
+ ## What is in the repository
82
+
83
+ {One or two sentences: the workspace shape and where each unit's design document lives.}
79
84
 
80
- ## Adding a {primary unit}
85
+ | Path | Role | Owning doc |
86
+ | --- | --- | --- |
87
+ | [`{packages/unit}/`]({packages/unit}/) | {one line: what it is and who consumes it} | [{doc}](docs/architecture/packages/{unit}.md) |
88
+ | [`{packages/unit}/`]({packages/unit}/) | {one line} | [{doc}]({path}) |
89
+ | [`{top-folder}/`]({top-folder}/) | {one line; "generated" or "reference only" where true} | — |
81
90
 
82
- 1. {Drop the source under the right family/folder.}
83
- 2. {Re-export from the public surface.}
84
- 3. {Wire into the playground / example app / test harness so reviewers can see it render.}
85
- 4. {Document any divergence from upstream in `docs/{...}`.}
91
+ {One sentence each for the top folders that are not packages — `registry/`, `scripts/`, `docs/` — with their owning doc.} Where every doc lives: [docs/structure.md](docs/structure.md).
86
92
 
87
- ## Styling ← optional; replace with whichever cross-cutting concern matters most
93
+ ## Rules that bite
88
94
 
89
- {Configuration notes that affect every consumer — design tokens, conventions, opt-outs.}
95
+ {One sentence saying these are stated here and argued in the documents they point at.}
90
96
 
91
- ## Status
97
+ - **{Invariant}**: {the rule, one line}. → [{source}]({path})
98
+ - **{Boundary}**: `{path}` is the only {public | published} surface; everything else is internal.
99
+ - **{Never-edit paths}**: `{path}` is {generated by `{command}` | protected}; edit {the source} instead.
100
+ - **Not here:** {a non-goal stated as a refusal}.
92
101
 
93
- {Pre-publish, beta, stable, internal-only. State the stability tier per surface — which APIs are contracts and which are experimental — so readers know what can be relied on.}
102
+ ## Where to go
94
103
 
95
- ## License
104
+ | I want to… | Go to |
105
+ | --- | --- |
106
+ | Set up a machine and run it the first time | [docs/operations/setup.md](docs/operations/setup.md) |
107
+ | Work on it day to day | [docs/operations/{local-development}.md](docs/operations/{local-development}.md) |
108
+ | Understand the design | [docs/architecture/](docs/architecture/) |
109
+ | Change a feature | [docs/features/](docs/features/), found through the ownership index |
110
+ | Change a contract ({db schema · wire envelope · auth · events · env}) | [{contract doc}]({path}), boundary-checked before the change |
111
+ | Ship or release | [docs/operations/{deployment}.md](docs/operations/{deployment}.md) |
112
+ | Place a new doc | [docs/structure.md](docs/structure.md) · [docs/README.md](docs/README.md) |
113
+ | See what changed and what is open | [CHANGELOG](docs/history/CHANGELOG.md) · [backlog](docs/history/backlog.md) |
114
+ | Work here as a coding agent | [CLAUDE.md](CLAUDE.md) ([AGENTS.md](AGENTS.md) for other runtimes): load before any edit |
96
115
 
97
- {License name — scope. e.g., "UNLICENSED — internal use only", "MIT".}
116
+ ## Everyday commands
117
+
118
+ \`\`\`bash
119
+ {pm} {typecheck} # {what it checks}
120
+ {pm} {test} # {the unit suite, from a cold shell}
121
+ {pm} {gate} # {what a change must pass before it is pushed}
122
+ \`\`\`
123
+
124
+ `{pm} --filter <unit> run` lists a unit's own scripts.
125
+
126
+ {License, one line, e.g. "UNLICENSED, internal use only."} ← optional
98
127
  ```
99
128
 
100
129
  ### Baseline scaffolding behavior
101
130
 
102
- The baseline audit **does** scaffold the project root README when missing. The risk this template guards against — template-shaped placeholders that look abandoned — is mitigated by the writing rules above: fill every section with concrete details from the repo (real package manager from the lockfile, real scripts, real layout, real status). Skip sections that genuinely don't apply rather than leaving stubs.
131
+ The baseline **does** scaffold `/README.md` when it is missing, and it fills each section from the repo:
132
+
133
+ - **Identity, What it does, Where it runs:** from the product charter and vision documents under `docs/architecture/common/` (what the product is, the core loop, who it is for), the package manifests (what publishes where), and the deploy config (addresses). Written in a user's terms; where the charter is missing, the baseline writes Identity only and raises a `note:` row for the rest.
134
+ - **How it works:** from the system overview.
135
+ - **Map:** from the workspace globs and the ownership index.
136
+ - **Rules:** from `docs/operations/protected-files.md` and the architecture doctrine.
137
+ - **Commands:** from the lockfile and the root scripts.
138
+ - **Where to go:** only the rows whose targets exist.
139
+
140
+ It drops every section it cannot fill concretely.
103
141
 
104
- **Never overwrite an existing root README** during a baseline. If one is present — even sparse or outdated — leave it untouched. Treat updates to a pre-existing root README as a separate, explicit request.
142
+ **It never overwrites an existing root README.** If one is present, even sparse or outdated, the baseline leaves it untouched and raises a `note:` row proposing the reshape. Reshaping is a separate, explicit request. When it runs, each removed section moves in the same change: getting-started, install and env content and the Stack go to `docs/operations/setup.md`, a drawn tree becomes the Map (the tree itself stays in `structure.md`), and a contributing checklist goes to `docs/operations/`. Nothing is deleted without a home.
@@ -0,0 +1,138 @@
1
+ # Setup (docs/operations/setup.md)
2
+
3
+ Truth document, operations genre (`type: operations`). Use for: **the one-time path from a fresh machine to a first verified run.** It covers what the repo is built on, prerequisites, install, env files, local services, the first commands, proof that it works, and the failures a fresh clone hits. There is **one per repo**, always named `setup.md`, and it is a mandated scaffold. The root README's only setup content is a Where-to-go row linking it.
4
+
5
+ It is distinct from `local-development.md`, the daily loop: watch modes, resetting state, per-package traps, the inner test cycle. Setup runs once per machine. Local development runs every session. Setup ends by handing off to it, and neither copies the other. Deploying is `deployment.md`.
6
+
7
+ Required: **Goal**, **Stack**, **Prerequisites**, **Install**, **First run**, **Verify**. Optional, included only with real content: the audience fork, **Before cloning**, **Environment files**, **Local services**, **Reset**, **Common failures**.
8
+
9
+ ### Writing rules
10
+
11
+ - **Never write a version a file already pins.** Each row names the pinning file (`.nvmrc`, `package.json` `engines` / `packageManager`, `rust-toolchain.toml`, `go.mod`) and the command that checks it. A typed number is a second source that drifts on the next bump.
12
+ - **Stack is one row per layer.** Give the technology, what it is for in this repo, and where its version is pinned. Why it was chosen belongs to `docs/architecture/`, linked once. Don't repeat the dependency list: the manifests are the roster.
13
+ - **One path, from the lockfile.** `pnpm-lock.yaml` gives pnpm, `yarn.lock` gives yarn, otherwise npm. Say how it is activated (`corepack enable`). Never write "or npm / yarn". Give a per-OS variant only where the commands really differ.
14
+ - **Traps before commands.** Anything a fresh clone hits before the first command goes in Before cloning, not halfway down the steps: LFS, submodules, a required stub file, an access grant, a credential that has to be requested.
15
+ - **Copy-paste runnable, one action per step, each with its expected outcome.** Run non-interactively where the tool allows it, so an agent can execute the step unchanged. "It should work now" is never a step.
16
+ - **Script first, then document.** If a bootstrap script or task exists, it is the step, and the doc carries only the judgment around it. A setup sequence run often with no script gets a script.
17
+ - **Env files as a table, never a variable dump.** One row per file: where it is copied from, what must be filled, where the values come from, whether it is required to boot. The variable contract is the example file and the code's env type, linked and never copied. Secret values never appear.
18
+ - **Destructive commands state their blast radius where they appear:** what is deleted or truncated, whether it prompts, and the flag that skips the prompt.
19
+ - **Verification is observable:** a health probe and its expected status, a URL and what it shows, a seeded login, a doctor command and its output, or the test command passing from a cold shell.
20
+ - **Common failures are keyed by the exact error text,** followed by the cause and the fix, where the fix is a command or a file edit. Append a failure only once it has been root-caused, never as speculation.
21
+ - **Per-package divergence is a subsection of this file.** A unit whose setup differs gets a `### {unit}` block under First run, or a row linking its own procedure. It never gets a second setup doc.
22
+
23
+ ### Template
24
+
25
+ ```markdown
26
+ ---
27
+ type: operations
28
+ ---
29
+
30
+ # Setup
31
+
32
+ **Goal:** take a fresh machine from clone to a verified first run of {what runs: e.g. "the product Worker on :{port} and the web shell on :{port}, signed in as the dev fixture"}. Done once per machine; the daily loop is [`local-development.md`]({local-development}.md).
33
+
34
+ {Optional audience fork: "Only running {the CLI / one package}? Stop after Install and see [`{procedure}`]({path})."}
35
+
36
+ ## Stack
37
+
38
+ | Layer | Technology | For | Version pinned by |
39
+ | --- | --- | --- | --- |
40
+ | {Runtime} | {Node} | {what runs on it} | [`.nvmrc`](../../.nvmrc) |
41
+ | {Server} | {framework · data layer} | {what it serves} | [`{package.json}`](../../{path}/package.json) |
42
+ | {Client} | {framework · build tool · styling} | {which surfaces} | [`{package.json}`](../../{path}/package.json) |
43
+ | {Tests} | {runners} | {unit · e2e} | {manifest} |
44
+
45
+ Why these were chosen: [{system overview}](../architecture/{overview}.md).
46
+
47
+ ## Prerequisites
48
+
49
+ | Tool | Version from | Check |
50
+ | --- | --- | --- |
51
+ | {Node} | [`.nvmrc`](../../.nvmrc) | `node -v` |
52
+ | {pnpm} | `packageManager` in [`package.json`](../../package.json), via `corepack enable` | `pnpm -v` |
53
+ | {Docker / Rust / wrangler / …} | {pinning file, or "any current"} | `{command}` |
54
+
55
+ - **Access:** {repo, secrets store, cloud account, registry token, and who grants each}.
56
+
57
+ ## Before cloning ← delete if none
58
+
59
+ - **{Trap}:** {what a fresh clone hits and the one command that clears it, e.g. `git lfs install`, `git submodule update --init`}.
60
+
61
+ ## Install
62
+
63
+ \`\`\`bash
64
+ git clone {url} && cd {repo}
65
+ corepack enable
66
+ {pm} install # expect: {what a clean install ends with}
67
+ \`\`\`
68
+
69
+ ## Environment files ← delete if none
70
+
71
+ | File | Copy from | Fill | Values come from | Required to boot |
72
+ | --- | --- | --- | --- | --- |
73
+ | `{path/.dev.vars}` | `{path/.dev.vars.example}` | {keys, or "every blank"} | {vault, the owner, a generated local value} | {yes / no} |
74
+
75
+ The contract is [`{example file or typed Env}`](../../{path}). Read it before concluding a value is missing. {Which of these files are gitignored.}
76
+
77
+ ## Local services ← delete if none
78
+
79
+ | Service | Start | Port | Ready when |
80
+ | --- | --- | --- | --- |
81
+ | {local DB / emulator} | `{command}` | {port} | `{probe}` returns {expected} |
82
+
83
+ ## First run
84
+
85
+ 1. Prepare local state.
86
+
87
+ \`\`\`bash
88
+ {pm} --filter {unit} {migrate-and-seed} # expect: {output}
89
+ \`\`\`
90
+
91
+ 2. Start the {backend}.
92
+
93
+ \`\`\`bash
94
+ {pm} --filter {unit} {dev:server} # expect: listening on :{port}
95
+ \`\`\`
96
+
97
+ 3. Start the {frontend / CLI}.
98
+
99
+ \`\`\`bash
100
+ {pm} --filter {unit} {dev} # expect: {URL}
101
+ \`\`\`
102
+
103
+ 4. Open `{http://localhost:port}` and {sign in as `{seeded user}` / reach `{first screen}`}.
104
+
105
+ ## Verify
106
+
107
+ - `{curl -fsS http://localhost:{port}/{health}}` returns `200` {and `{body}`}.
108
+ - `{doctor or status command}` reports {expected}. ← keep whichever exists
109
+ - `{pm} {test}` passes from this cold shell ({expected tail}).
110
+
111
+ ## Reset ← delete if none
112
+
113
+ | Command | Deletes | Prompts? |
114
+ | --- | --- | --- |
115
+ | `{pm} {reset-script}` | {local state at `{path}`} | {yes; `{FORCE=1}` skips / no} |
116
+
117
+ ## Common failures
118
+
119
+ - **`{exact error text}`.** {Cause.} Fix: `{command or file edit}`.
120
+
121
+ ## Next
122
+
123
+ The daily loop and its per-package traps: [`local-development.md`]({local-development}.md). Deploying: [`deployment.md`](deployment.md). Standing rules: [`CLAUDE.md`](../../CLAUDE.md).
124
+ ```
125
+
126
+ ### Baseline scaffolding behavior
127
+
128
+ The baseline scaffolds `docs/operations/setup.md` when it is missing and the repo has a lockfile and at least one runnable root script. It fills each section from the repo:
129
+
130
+ - **Stack:** from the workspace manifests, one row per layer.
131
+ - **Prerequisites:** from the pinning files.
132
+ - **Install and First run:** from the root README's getting-started block (if one exists) and the root scripts.
133
+ - **Environment files:** from every `*.example` / `.dev.vars.example` in the workspace.
134
+ - **Verify:** from a health route, a doctor command or the test script.
135
+
136
+ It leaves Common failures empty until a failure is root-caused, and it drops every section it cannot fill concretely.
137
+
138
+ **It never overwrites an existing `setup.md`.** If the repo already has a first-run procedure under another name, the baseline proposes the rename with a `note:` row and does not create a second file.