@nurix/etna 0.19.32 → 0.19.34
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 +5 -1
- package/data/harnesses/code/harness.json +2 -2
- package/data/harnesses/code/rules/changelog.md +5 -23
- package/data/harnesses/code/rules/database.md +77 -20
- package/data/harnesses/code/rules/express.md +7 -2
- package/data/harnesses/code/rules/frontend.md +14 -17
- package/data/harnesses/code/rules/general.md +47 -47
- package/data/harnesses/code/rules/nomenclature.md +25 -25
- package/data/harnesses/code/rules/pnpm.md +31 -28
- package/data/harnesses/code/rules/testing.md +11 -13
- package/data/harnesses/delivery/.prettierignore +29 -0
- package/data/harnesses/delivery/.prettierrc.json +3 -0
- package/data/harnesses/delivery/.vscode/settings.json +19 -0
- package/data/harnesses/delivery/CLAUDE.md +123 -0
- package/data/harnesses/delivery/agents/brainstorm.md +144 -0
- package/data/harnesses/delivery/agents/data-generator.md +23 -0
- package/data/harnesses/delivery/agents/eval-runner.md +23 -0
- package/data/harnesses/delivery/agents/judge.md +23 -0
- package/data/harnesses/delivery/agents/lld-mode.md +56 -0
- package/data/harnesses/delivery/agents/maintenance.md +229 -0
- package/data/harnesses/delivery/agents/prompt-iterator.md +23 -0
- package/data/harnesses/delivery/agents/red-team.md +23 -0
- package/data/harnesses/delivery/agents/regression-runner.md +28 -0
- package/data/harnesses/delivery/agents/retro.md +46 -0
- package/data/harnesses/delivery/codex/agents/brainstorm.toml +142 -0
- package/data/harnesses/delivery/codex/agents/data-generator.toml +22 -0
- package/data/harnesses/delivery/codex/agents/eval-runner.toml +22 -0
- package/data/harnesses/delivery/codex/agents/judge.toml +22 -0
- package/data/harnesses/delivery/codex/agents/lld-mode.toml +52 -0
- package/data/harnesses/delivery/codex/agents/maintenance.toml +228 -0
- package/data/harnesses/delivery/codex/agents/prompt-iterator.toml +22 -0
- package/data/harnesses/delivery/codex/agents/red-team.toml +22 -0
- package/data/harnesses/delivery/codex/agents/regression-runner.toml +27 -0
- package/data/harnesses/delivery/codex/agents/retro.toml +45 -0
- package/data/harnesses/delivery/harness.json +11 -0
- package/data/harnesses/delivery/hooks/generate-ownership-index.mjs +148 -0
- package/data/harnesses/delivery/hooks/hooks.json +16 -0
- package/data/harnesses/delivery/rules/changelog.md +19 -0
- package/data/harnesses/delivery/rules/evals.md +23 -0
- package/data/harnesses/delivery/rules/model-tiers.md +18 -0
- package/data/harnesses/delivery/rules/nomenclature.md +34 -0
- package/data/harnesses/delivery/rules/prompting.md +23 -0
- package/data/harnesses/delivery/skills/brainstorm/README.md +56 -0
- package/data/harnesses/delivery/skills/brainstorm/SKILL.md +173 -0
- package/data/harnesses/delivery/skills/brainstorm/references/doctrine.md +98 -0
- package/data/harnesses/delivery/skills/brainstorm/references/harvest.md +86 -0
- package/data/harnesses/delivery/skills/brainstorm/references/session-schema.md +186 -0
- package/data/harnesses/delivery/skills/brainstorm/scripts/detector.mjs +460 -0
- package/data/harnesses/delivery/skills/cost-report/SKILL.md +24 -0
- package/data/harnesses/delivery/skills/documentation/SKILL.md +129 -0
- package/data/harnesses/delivery/skills/documentation/references/examples.md +279 -0
- package/data/harnesses/delivery/skills/documentation/references/frontmatter.md +44 -0
- package/data/harnesses/delivery/skills/documentation/references/style-guide.md +340 -0
- package/data/harnesses/delivery/skills/documentation/references/untemplated.md +38 -0
- package/data/harnesses/delivery/skills/documentation/scripts/doc-lint.mjs +140 -0
- package/data/harnesses/delivery/skills/documentation/templates/Readme.md +31 -0
- package/data/harnesses/delivery/skills/documentation/templates/api-reference.md +20 -0
- package/data/harnesses/delivery/skills/documentation/templates/architecture-decision.md +121 -0
- package/data/harnesses/delivery/skills/documentation/templates/backlog.md +33 -0
- package/data/harnesses/delivery/skills/documentation/templates/changelog-entry.md +57 -0
- package/data/harnesses/delivery/skills/documentation/templates/changelog-index.md +41 -0
- package/data/harnesses/delivery/skills/documentation/templates/docs-readme.md +72 -0
- package/data/harnesses/delivery/skills/documentation/templates/domain-model.md +30 -0
- package/data/harnesses/delivery/skills/documentation/templates/environment-registry.md +15 -0
- package/data/harnesses/delivery/skills/documentation/templates/feature.md +149 -0
- package/data/harnesses/delivery/skills/documentation/templates/glossary.md +11 -0
- package/data/harnesses/delivery/skills/documentation/templates/memory-main.md +25 -0
- package/data/harnesses/delivery/skills/documentation/templates/migration-runbook.md +34 -0
- package/data/harnesses/delivery/skills/documentation/templates/non-goals.md +11 -0
- package/data/harnesses/delivery/skills/documentation/templates/operations-procedure.md +36 -0
- package/data/harnesses/delivery/skills/documentation/templates/plan.md +64 -0
- package/data/harnesses/delivery/skills/documentation/templates/protected-files.md +37 -0
- package/data/harnesses/delivery/skills/documentation/templates/root-readme.md +104 -0
- package/data/harnesses/delivery/skills/documentation/templates/security-overview.md +27 -0
- package/data/harnesses/delivery/skills/documentation/templates/structure.md +65 -0
- package/data/harnesses/delivery/skills/documentation/templates/system-overview.md +32 -0
- package/data/harnesses/delivery/skills/documentation/templates/testing-strategy.md +29 -0
- package/data/harnesses/delivery/skills/escalate/SKILL.md +25 -0
- package/data/harnesses/delivery/skills/prompt-eval/SKILL.md +22 -0
- package/data/harnesses/delivery/skills/prompt-library/SKILL.md +36 -0
- package/data/harnesses/delivery/skills/route/SKILL.md +21 -0
- package/data/harnesses/etna/harness.json +2 -2
- package/data/harnesses/etna/rules/changelog.md +5 -23
- package/data/harnesses/etna/rules/general.md +47 -47
- package/data/harnesses/etna/rules/kb.md +4 -11
- package/data/harnesses/etna/rules/nomenclature.md +25 -25
- package/data/harnesses/etna/rules/testing.md +11 -13
- package/data/harnesses/hr/harness.json +2 -2
- package/data/harnesses/hr/rules/code-eval-batcher.md +24 -28
- package/package.json +1 -1
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: documentation
|
|
3
|
+
description: "Use when creating or substantively editing ANY markdown doc — invoke BEFORE writing. Templates + style authority for technical docs: LLDs, ADs, plans, changelogs, READMEs, runbooks. Owns the tense rule: truth docs state the present; history only in dated records. Baselining is the maintenance agent."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Technical Documentation Skill
|
|
7
|
+
|
|
8
|
+
**This skill is a template & generator library, not an orchestrator.** It supplies the templates, the frontmatter-derivation generator, and the co-authoring workflow that _agents_ call to produce individual docs. It does **not** baseline, audit, or reconcile a repo's doc tree — that is the **`maintenance` agent (baseline mode)**, which calls this skill for each template it scaffolds. Reach here to generate _one_ doc from a template; reach for the `maintenance` agent (baseline mode) to bring a whole repo into shape.
|
|
9
|
+
|
|
10
|
+
Document contracts and architecture, not implementation details. Show function signatures and API shapes — never paste full implementations (they rot fast). Use ASCII diagrams over prose for flows. Only document state at persistence boundaries (Redux persistence, DB schemas, API shapes), not component-level or transient state. Mark deprecated fields with `// UNUSED:` comments stating why the field is dead now — never where it went or when it dies. Breaking changes belong in changelogs only, not module docs.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Present tense, always
|
|
15
|
+
|
|
16
|
+
**A document states what is — never how it got there, and never how far along it is.** Write as if the current design had always been the plan. This is the most-violated rule in the skill, so it sits at the top; it applies to every document written or edited through this skill, whatever the template.
|
|
17
|
+
|
|
18
|
+
| ❌ Strip this | ✅ Write this |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| "Build Sequence phases 0–4 are complete." | Nothing — progress lives in the plan/backlog record |
|
|
21
|
+
| "There is no standalone `skills/components/` — treat any reference to it as stale." | Nothing — fix the references; state only the present design |
|
|
22
|
+
| "Folded in from the `NuStack-X` repo (2026-06-12)." | "Vendor-connector catalogue; one subpath per vendor." |
|
|
23
|
+
| "was X, now Y", "the old worker", "Phase 2 softened this", "v1 → v2" | The current fact, with no predecessor named |
|
|
24
|
+
|
|
25
|
+
The journey — dates, migrations, progress, supersessions — lives only in records (`docs/history/`); when reality changes, a truth document simply becomes correct. The full strip-list and the record-side rules: [`references/style-guide.md`](references/style-guide.md) § The Two Natures — Tense & History.
|
|
26
|
+
|
|
27
|
+
The mechanical subset of these rules is checked by [`scripts/doc-lint.mjs`](scripts/doc-lint.mjs) — run it over changed docs before finishing. Block-severity findings must be fixed; `<!-- doc-lint-disable: <id> -->` with a reason beside it is the escape hatch.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## The Two Natures
|
|
32
|
+
|
|
33
|
+
Every document is exactly one of two things. Decide which before writing a word — every rule in this skill derives from the split.
|
|
34
|
+
|
|
35
|
+
| | **Truth document** | **Record** |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| States | Absolutes — how the system is, **now** | What happened — a dated account of activity |
|
|
38
|
+
| Named by | Topic: `auth.md`, `AD-003-persistence.md` | Date: `YYYY-MM-DD-slug.md` (or append position) |
|
|
39
|
+
| On change | Body rewritten in place the moment reality changes | Never edited — frozen at completion or append-only |
|
|
40
|
+
| Read to | Act correctly today | Trace provenance, diagnose, audit |
|
|
41
|
+
| Lives in | `docs/features/`, `docs/architecture/`, `docs/operations/`, `docs/tests/`, READMEs | `docs/history/` (plans, changelog, brainstorms, research, migrations), `docs/research/`, `docs/memory/` |
|
|
42
|
+
|
|
43
|
+
The two guarantees are complementary and both break on mixing: a reader holding a **truth document** must never need history to interpret it; a reader holding a **record** must be able to trust it was never rewritten. So the natures never share a document body.
|
|
44
|
+
|
|
45
|
+
- **Truth documents never narrate history** — the § Present tense, always rule above, applied to this nature. When the system changes, the change-story goes to `docs/history/` (a changelog entry) and the truth document simply becomes correct in present tense. When you find historical narration in a truth document, rewrite it to the present-tense fact and let the record carry the story.
|
|
46
|
+
- **Records are never edited to match the present.** A completed plan stays wrong-in-hindsight; a changelog entry describes close-time state; a scope change gets a *new* dated record that links back, never an edit to a frozen one.
|
|
47
|
+
- **Two sanctioned bridges — head is truth, tail is provenance.** An **Architecture Decision (AD)** ends with a **Decision Changelog** (for a decision, the journey — what each revision reversed and what triggered it — is part of the reasoning), and `docs/structure.md` ends with the maintenance agent's **Health Log** (tooling-stamped audit rows, the structural cousin of `last-reviewed:`). In both, the body stays current-truth-only; the tail carries the dates. No other truth document carries dated history.
|
|
48
|
+
- **Truth documents cite records for the _why_, never the _when_.** `Provenance: AD-002` is good; "decided in AD-002 and shipped 2026-06-13" is not. Routing/index docs point only to truth documents as a topic's authority — never a plan or changelog entry as the "read first" source. (An index _of the records themselves_ — a History section listing `plans/`, `changelog/` — is sanctioned.)
|
|
49
|
+
|
|
50
|
+
**No empty stubs.** Never leave a template section as an empty placeholder — omit any section with nothing real to say (each template declares its required core; everything else is optional). Write an explicit "None" only where the absence itself is information (e.g., a plan's Cross-Module Contracts Affected, an LLD's Ownership Conflicts). An empty table stub reads as "not yet researched"; an omitted section reads as "doesn't apply" — keep those meanings distinct.
|
|
51
|
+
|
|
52
|
+
**No redirect docs.** When moving a doc to a new location, delete the old file entirely. Update all references (cross-doc links, memory files) to point to the new path. Never leave a stub file that says "Moved to X" — redirect docs rot, clutter the repo, and create false search hits.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Routing
|
|
57
|
+
|
|
58
|
+
| Request | Route |
|
|
59
|
+
| --- | --- |
|
|
60
|
+
| Baseline / reconcile docs | `maintenance` agent (baseline mode) — it calls this skill per template |
|
|
61
|
+
| Document feature/module (LLD) | [`templates/feature.md`](templates/feature.md) |
|
|
62
|
+
| Document data flow / state / Redux | [`templates/feature.md`](templates/feature.md) — they are sections of the feature doc |
|
|
63
|
+
| Create/update changelog entry | [`templates/changelog-entry.md`](templates/changelog-entry.md) (record — one per unit of work; carries the refinement fields, frozen inside its commit, distilled by the `retro` agent) |
|
|
64
|
+
| Create/update plan | [`templates/plan.md`](templates/plan.md) (record) |
|
|
65
|
+
| Record/revise architecture decision | [`templates/architecture-decision.md`](templates/architecture-decision.md) — one AD per subject; revisions update it in place |
|
|
66
|
+
| System at a glance | [`templates/system-overview.md`](templates/system-overview.md) |
|
|
67
|
+
| Domain model | [`templates/domain-model.md`](templates/domain-model.md) |
|
|
68
|
+
| Glossary | [`templates/glossary.md`](templates/glossary.md) |
|
|
69
|
+
| Non-goals | [`templates/non-goals.md`](templates/non-goals.md) |
|
|
70
|
+
| Catalog the API surface | [`templates/api-reference.md`](templates/api-reference.md) |
|
|
71
|
+
| Document env vars / config | [`templates/environment-registry.md`](templates/environment-registry.md) |
|
|
72
|
+
| Security / threat model | [`templates/security-overview.md`](templates/security-overview.md) |
|
|
73
|
+
| Testing strategy | [`templates/testing-strategy.md`](templates/testing-strategy.md) |
|
|
74
|
+
| Recurring procedure/setup | [`templates/operations-procedure.md`](templates/operations-procedure.md) |
|
|
75
|
+
| One-shot migration/upgrade | [`templates/migration-runbook.md`](templates/migration-runbook.md) (record) |
|
|
76
|
+
| Add to protected files | [`templates/protected-files.md`](templates/protected-files.md) |
|
|
77
|
+
| Create/update root README | [`templates/root-readme.md`](templates/root-readme.md) |
|
|
78
|
+
| Scaffold a standard doc (docs index, `structure.md`, CHANGELOG, backlog, memory) | [`templates/Readme.md`](templates/Readme.md) — the index names each scaffold file |
|
|
79
|
+
| Derive/update a feature doc's `owns:` | [`references/frontmatter.md`](references/frontmatter.md) |
|
|
80
|
+
| Update existing doc | § Editing an existing doc (below) |
|
|
81
|
+
| Instruction file (`CLAUDE.md`, a rule, an agent, skill prose) | Not these templates — every-load prose stays lean: assertion—reason bullets, tables over diagrams, no ASCII; the present-tense rule still applies |
|
|
82
|
+
| **No template matches** | [`references/untemplated.md`](references/untemplated.md) — shape decisions + the co-authoring workflow |
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Editing an existing doc
|
|
87
|
+
|
|
88
|
+
"Substantive" = anything beyond typo, link, or formatting fixes. On a substantive edit:
|
|
89
|
+
|
|
90
|
+
1. **Determine the nature first.** A frozen record (a `Status: Complete`/`Abandoned` plan, a changelog entry, an executed runbook) is never edited — write a new dated record that links back.
|
|
91
|
+
2. **Preserve structure, not violations.** Keep the doc's existing section shape, but every section touched sheds history narration, progress markers, and stale tripwires on the way through (§ Present tense, always).
|
|
92
|
+
3. **Stamp and re-derive.** A substantive feature-doc update bumps `last-reviewed:`; if the documented scope moved, update `owns:` ([`references/frontmatter.md`](references/frontmatter.md)).
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Naming & Lifecycle
|
|
97
|
+
|
|
98
|
+
| Document | Nature | Name | Lifecycle |
|
|
99
|
+
| --- | --- | --- | --- |
|
|
100
|
+
| Feature (LLD) | Truth | `kebab-case.md` | Living; `status:` `draft` → `active` → `deprecated` |
|
|
101
|
+
| Architecture Decision | Truth | `AD-NNN-kebab-case.md` | Living; `Proposed` → `Accepted` → `Deprecated`; revisions rewrite the body + append to its Decision Changelog |
|
|
102
|
+
| Steering docs (overview, domain model, glossary, non-goals, security, testing strategy) | Truth | fixed names | Living |
|
|
103
|
+
| API reference / environment registry | Truth | fixed names | Living |
|
|
104
|
+
| Operations procedure | Truth | `kebab-case.md` | Living |
|
|
105
|
+
| Protected files | Truth | `protected-files.md` | Living |
|
|
106
|
+
| Plan | Record | `YYYY-MM-DD-kebab-case.md` | Freezes at `Complete` / `Abandoned` |
|
|
107
|
+
| Changelog entry | Record | `YYYY-MM-DD-kebab-case.md` | Frozen; master index append-only |
|
|
108
|
+
| Migration runbook | Record | `YYYY-MM-DD-kebab-case.md` | Freezes once executed, outcome stamped |
|
|
109
|
+
| Research | Record | `history/research/{topic}/` | Frozen snapshot |
|
|
110
|
+
| Memory | Record | `{agent-name}.md` | Append-only dated ledger |
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Frontmatter Derivation
|
|
115
|
+
|
|
116
|
+
A feature doc carries ownership frontmatter — `owns:` (required), `module:` (optional), `keywords:` (required), `status:` (required), optional `last-reviewed:`. Deriving it from code and keeping it accurate is [`references/frontmatter.md`](references/frontmatter.md) — every feature-doc create or update, and the `maintenance` agent's baseline pass, route there.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Resources
|
|
121
|
+
|
|
122
|
+
| File | Use For |
|
|
123
|
+
| --- | --- |
|
|
124
|
+
| `templates/` | One file per template, indexed by [`Readme.md`](templates/Readme.md) — feature (LLD), changelog, plan, AD, steering docs, API reference, environment registry, operations procedure, migration runbook, protected files, READMEs, and the baseline scaffolds |
|
|
125
|
+
| `references/style-guide.md` | Writing rules, formatting conventions, the two-natures tense rules |
|
|
126
|
+
| `references/frontmatter.md` | Deriving a feature doc's `owns:` / `module:` / `keywords:` / `status:` from code |
|
|
127
|
+
| `references/untemplated.md` | How to write a document no template covers (nature, placement, shape) + the co-authoring workflow |
|
|
128
|
+
| `references/examples.md` | Good vs bad documentation examples |
|
|
129
|
+
| `scripts/doc-lint.mjs` | Mechanical checks over written docs (tense narration, dates, stubs, redirects) — run over changed docs before finishing |
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
# Documentation Examples
|
|
2
|
+
|
|
3
|
+
Good vs bad examples showing the key differences.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Example 1: Function Documentation
|
|
8
|
+
|
|
9
|
+
### ❌ Bad: Full Implementation
|
|
10
|
+
|
|
11
|
+
```markdown
|
|
12
|
+
### mergeData
|
|
13
|
+
|
|
14
|
+
function mergeData(server, local, changes) { const result = {}; const serverMap = new Map(server.map((i) => [i.id, i])); // ... 30 more lines return result; }
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Problems:** Will become obsolete, focuses on HOW not WHAT.
|
|
18
|
+
|
|
19
|
+
### ✅ Good: Contract Only
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
### `mergeData(serverData, localData, changes)`
|
|
23
|
+
|
|
24
|
+
**Goal:** Merge server data with local changes
|
|
25
|
+
|
|
26
|
+
**Input:**
|
|
27
|
+
|
|
28
|
+
- `serverData` (array) - Fresh from API
|
|
29
|
+
- `localData` (array) - Current state
|
|
30
|
+
- `changes` (object) - `{ added, updated, removed }`
|
|
31
|
+
|
|
32
|
+
**Output:** `{ merged: array, conflicts: array }`
|
|
33
|
+
|
|
34
|
+
**Merge Rules:**
|
|
35
|
+
|
|
36
|
+
- Server wins for conflicts
|
|
37
|
+
- Local additions preserved
|
|
38
|
+
- Local removals marked as intent
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Example 2: State Documentation
|
|
44
|
+
|
|
45
|
+
### ❌ Bad: State Everywhere
|
|
46
|
+
|
|
47
|
+
```markdown
|
|
48
|
+
## Component State
|
|
49
|
+
|
|
50
|
+
const [items, setItems] = useState([]);
|
|
51
|
+
|
|
52
|
+
## Hook State
|
|
53
|
+
|
|
54
|
+
{ data: items, isLoading: loading, error: null }
|
|
55
|
+
|
|
56
|
+
## Redux State
|
|
57
|
+
|
|
58
|
+
{ items: [], loading: false, error: null }
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Problems:** Documents transient state, repeats shapes.
|
|
62
|
+
|
|
63
|
+
### ✅ Good: Persistence Points Only
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
## State
|
|
67
|
+
|
|
68
|
+
**Frontend (at persistence):**
|
|
69
|
+
|
|
70
|
+
{
|
|
71
|
+
"data": [],
|
|
72
|
+
"changes": { "added": [], "updated": [], "removed": [] }
|
|
73
|
+
// "cache": {} // UNUSED: dead key; kept so old persisted state rehydrates
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
**Storage:** localStorage `app_state`
|
|
77
|
+
|
|
78
|
+
**Backend:**
|
|
79
|
+
|
|
80
|
+
export const items = pgTable('items', {
|
|
81
|
+
id: text('id').primaryKey(),
|
|
82
|
+
data: jsonb('data'),
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Example 3: Changelog
|
|
89
|
+
|
|
90
|
+
### ❌ Bad: Vague
|
|
91
|
+
|
|
92
|
+
```markdown
|
|
93
|
+
# 2025-01-05 - Updates
|
|
94
|
+
|
|
95
|
+
## Changes
|
|
96
|
+
|
|
97
|
+
- Updated editor
|
|
98
|
+
- Fixed bugs
|
|
99
|
+
- Improved performance
|
|
100
|
+
|
|
101
|
+
## Files
|
|
102
|
+
|
|
103
|
+
- Various files in src/
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### ✅ Good: Function-Level Detail
|
|
107
|
+
|
|
108
|
+
```markdown
|
|
109
|
+
# 2025-01-05 - Version-Based Merge
|
|
110
|
+
|
|
111
|
+
## Summary
|
|
112
|
+
|
|
113
|
+
Replaced change-tracking merge with version-based conflict resolution.
|
|
114
|
+
|
|
115
|
+
## Changes
|
|
116
|
+
|
|
117
|
+
### Added
|
|
118
|
+
|
|
119
|
+
- `mergeAndDerive(server, local, versionsMatch, type)` in `src/utils/merge.js`
|
|
120
|
+
- Purpose: Single-pass merge with change detection
|
|
121
|
+
- Returns: `{ merged, changes }`
|
|
122
|
+
|
|
123
|
+
### Changed
|
|
124
|
+
|
|
125
|
+
- `useDataSync()` in `src/hooks/useDataSync.js`
|
|
126
|
+
- Changed: Now compares versions before merge
|
|
127
|
+
|
|
128
|
+
### Removed
|
|
129
|
+
|
|
130
|
+
- `deriveChanges()` from `src/utils/derive.js`
|
|
131
|
+
- Replaced by: Logic in `mergeAndDerive()`
|
|
132
|
+
|
|
133
|
+
## Breaking Changes
|
|
134
|
+
|
|
135
|
+
⚠️ **Merge behavior changed**
|
|
136
|
+
|
|
137
|
+
- Old: Local changes always preserved
|
|
138
|
+
- New: Local preserved only if versions match
|
|
139
|
+
|
|
140
|
+
## Files Changed
|
|
141
|
+
|
|
142
|
+
- `src/hooks/useDataSync.js`
|
|
143
|
+
- `src/utils/merge.js`
|
|
144
|
+
- `src/utils/derive.js` (deleted)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Example 4: Data Flow
|
|
150
|
+
|
|
151
|
+
### ❌ Bad: Prose Description
|
|
152
|
+
|
|
153
|
+
```markdown
|
|
154
|
+
When the page loads, the useAppInit hook calls the syncData function. This function first fetches data from the server using the API. Then it gets the local data from Redux. After that, it compares versions...
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### ✅ Good: Diagram + Key Points
|
|
158
|
+
|
|
159
|
+
```markdown
|
|
160
|
+
## Data Flow
|
|
161
|
+
|
|
162
|
+
┌─────────────────────────────────────────┐
|
|
163
|
+
│ DATA SYNC │
|
|
164
|
+
├─────────────────────────────────────────┤
|
|
165
|
+
│ │
|
|
166
|
+
│ ┌──────┐ ┌──────┐ ┌──────┐ │
|
|
167
|
+
│ │Server│────▶│Merge │────▶│Redux │ │
|
|
168
|
+
│ │ API │ │ │ │Store │ │
|
|
169
|
+
│ └──────┘ └──────┘ └──────┘ │
|
|
170
|
+
│ │ │
|
|
171
|
+
│ ▼ │
|
|
172
|
+
│ Version Check │
|
|
173
|
+
│ │
|
|
174
|
+
└─────────────────────────────────────────┘
|
|
175
|
+
|
|
176
|
+
**Trigger:** `useAppInit()` on page load
|
|
177
|
+
|
|
178
|
+
**Version Rule:** Match → local wins, Mismatch → server wins
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Example 5: Architecture Decision revision
|
|
184
|
+
|
|
185
|
+
### ❌ Bad: Supersession chain
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
docs/architecture/decisions/
|
|
189
|
+
├── AD-002-auth-keycloak.md (status: Superseded)
|
|
190
|
+
├── AD-006-auth-better-auth.md (status: Superseded, "supersedes AD-002")
|
|
191
|
+
└── AD-011-auth-better-auth-v2.md (status: Accepted, "supersedes AD-006")
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Problems:** Three files hold one subject; the reader must diff a chain to learn the current truth; two of the three are wrong-but-present (the same pathology as keeping `report_v1.sql` beside the live `report_v2.sql`); the reasoning that killed Keycloak is stranded in a dead file nobody opens.
|
|
195
|
+
|
|
196
|
+
### ✅ Good: One subject, updated in place
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
docs/architecture/decisions/
|
|
200
|
+
└── AD-002-auth.md (status: Accepted, last-updated bumped)
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
```markdown
|
|
204
|
+
## Decision
|
|
205
|
+
|
|
206
|
+
We use Better Auth with one-shot credential issuance… ← current truth, no journey
|
|
207
|
+
|
|
208
|
+
…
|
|
209
|
+
|
|
210
|
+
## Decision Changelog
|
|
211
|
+
|
|
212
|
+
- 2026-05-02 — Moved issuance to one-shot tokens because refresh-token theft
|
|
213
|
+
surfaced in review. Implemented by [plan](…). (Previously: long-lived refresh tokens.)
|
|
214
|
+
- 2026-03-18 — Replaced Keycloak with Better Auth because self-hosting cost
|
|
215
|
+
outweighed SSO needs. Implemented by [plan](…). (Previously: Keycloak.)
|
|
216
|
+
- 2026-01-10 — Initial decision accepted. Implemented by [plan](…).
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Why it works:** The body answers "how does auth work and why" without archaeology; the tail preserves every reversal with its trigger; the rejected alternatives stay findable in the one file a reader actually opens.
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Example 6: Stripping history from a truth doc
|
|
224
|
+
|
|
225
|
+
The move agents fumble: deleting narration is only half the job — the story must land in a record.
|
|
226
|
+
|
|
227
|
+
### ❌ Bad: The journey narrated in place
|
|
228
|
+
|
|
229
|
+
```markdown
|
|
230
|
+
## Export Pipeline
|
|
231
|
+
|
|
232
|
+
The exporter was extracted from the legacy `reports` worker (2026-06-02) and
|
|
233
|
+
now lives in `src/export/`. Phases 0–2 of the rewrite are complete; streaming
|
|
234
|
+
output is not yet implemented. Treat any reference to `reports/export.js` as
|
|
235
|
+
stale — it was superseded by `src/export/run.js`.
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### ✅ Good: Present-tense truth doc + a dated record carrying the story
|
|
239
|
+
|
|
240
|
+
The feature doc states only what is:
|
|
241
|
+
|
|
242
|
+
```markdown
|
|
243
|
+
## Export Pipeline
|
|
244
|
+
|
|
245
|
+
`src/export/run.js` renders every export format from one job queue. Output is
|
|
246
|
+
buffered per job (streaming is out of scope — see `docs/history/backlog.md`).
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
And the change-story goes to `docs/history/changelog/2026-06-02-export-extraction.md`:
|
|
250
|
+
|
|
251
|
+
```markdown
|
|
252
|
+
# 2026-06-02 — Export pipeline extracted
|
|
253
|
+
|
|
254
|
+
## Summary
|
|
255
|
+
|
|
256
|
+
Extracted export logic from the `reports` worker into `src/export/`.
|
|
257
|
+
|
|
258
|
+
## Changes
|
|
259
|
+
|
|
260
|
+
### Removed
|
|
261
|
+
|
|
262
|
+
- `reports/export.js` — replaced by `src/export/run.js`; all callers repointed.
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
**Why it works:** the truth doc needs no archaeology to act on; the dates, the predecessor, and the supersession live in a frozen record; the unbuilt part is a backlog pointer, not a "not yet" hedge; and no stale-reference tripwire survives because the references themselves were fixed.
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Quick Comparison
|
|
270
|
+
|
|
271
|
+
| Aspect | Bad | Good |
|
|
272
|
+
| ---------- | -------------------- | --------------------------- |
|
|
273
|
+
| Code | Full implementations | Signatures + contracts |
|
|
274
|
+
| State | Every occurrence | Persistence points only |
|
|
275
|
+
| Flows | Prose paragraphs | ASCII diagrams |
|
|
276
|
+
| Changelogs | "Updated X" | Function names + migrations |
|
|
277
|
+
| Decisions | New doc per revision | One AD per subject, updated in place |
|
|
278
|
+
| History | Narrated in the doc | Present-tense doc + dated record |
|
|
279
|
+
| Length | 100+ lines | 20-40 lines |
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Frontmatter Derivation — feature-doc ownership
|
|
2
|
+
|
|
3
|
+
Load when: creating a feature doc, updating one whose documented scope moved, or running a baseline/reconcile pass over many docs.
|
|
4
|
+
|
|
5
|
+
When creating or updating a feature doc, derive its **`owns:` frontmatter** — the code-path globs it is canonical for — from the source the doc describes. Code ownership lives in each feature doc's `owns:` frontmatter (the SessionStart hook unions them into the injected ownership index); there is no hand-maintained ownership map.
|
|
6
|
+
|
|
7
|
+
## When to run
|
|
8
|
+
|
|
9
|
+
- **Baseline / reconcile** — for every feature doc whose code paths aren't yet declared in its `owns:` frontmatter (the `maintenance` agent (baseline mode) calls this)
|
|
10
|
+
- **New feature doc** — when creating a doc via the [Feature template](../templates/feature.md), project its `owns:` globs
|
|
11
|
+
- **Doc update** — when the documented scope changes, update the doc's `owns:` globs
|
|
12
|
+
|
|
13
|
+
## How to derive the frontmatter
|
|
14
|
+
|
|
15
|
+
A feature doc's ownership frontmatter is `owns:` (required), `module:` (optional), `keywords:` (required), and `status:` (required). An optional `last-reviewed:` date (stamped whenever the doc is substantively reviewed or updated) gives the `maintenance` agent a staleness signal to rank its audits by — it is tooling metadata, never narrated in the body.
|
|
16
|
+
|
|
17
|
+
**1. `owns:`** (the path scope)
|
|
18
|
+
|
|
19
|
+
Read the doc's content. Extract every source file path it references (file listings, function locations, component paths). Group them into the narrowest glob patterns that cover all referenced files without overlapping another doc's `owns:` globs at equal specificity. A doc may own several globs.
|
|
20
|
+
|
|
21
|
+
| Doc references | Glob |
|
|
22
|
+
| ------------------------------------ | ------------------------- |
|
|
23
|
+
| Multiple files under one directory | `src/feature/**` |
|
|
24
|
+
| Specific files in a shared directory | List each file explicitly |
|
|
25
|
+
| A single entry-point file | The exact file path |
|
|
26
|
+
|
|
27
|
+
Glob each pattern against the codebase. At `status: active`, drop any that match nothing; at `status: draft`, projected globs may match nothing yet — confirm them against real code when the doc flips to `active`.
|
|
28
|
+
|
|
29
|
+
**2. `module:`**
|
|
30
|
+
|
|
31
|
+
The single bounded-context label this feature belongs to, or omit it for a cross-cutting feature that belongs to no single context. A module is a label, not a folder — features sharing a `module:` value are what ties that module to code (a filter over the generated ownership index).
|
|
32
|
+
|
|
33
|
+
**3. `keywords:` & `status:`**
|
|
34
|
+
|
|
35
|
+
`keywords:` are the discovery terms topic→doc lookup rides. `status:` is `active`, `draft`, or `deprecated` — it steers the model toward live docs and away from draft/deprecated ones.
|
|
36
|
+
|
|
37
|
+
A doc's dependencies on other docs are expressed inline in its prose (links); cross-cutting contracts are diagnosed by the `boundary` skill from source, not persisted.
|
|
38
|
+
|
|
39
|
+
## Rules
|
|
40
|
+
|
|
41
|
+
- One canonical doc per path. A doc's `owns:` globs must not overlap another doc's at equal specificity — the narrower glob wins; equal-specificity overlap is an ownership conflict to resolve.
|
|
42
|
+
- Use glob patterns for directories, explicit paths for individual files. At `active`, never list paths that don't exist in the codebase; a `draft`'s projected paths are confirmed at `active`.
|
|
43
|
+
- When a doc covers a deep feature with sub-specs (e.g., `editor/`), each sub-spec owns its own globs — don't duplicate a path across siblings.
|
|
44
|
+
- For baseline/reconcile with many docs, use parallel sub-agents to read source and propose `owns:` globs.
|