discipline-md 0.1.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.
- package/LICENSE +21 -0
- package/README.md +80 -0
- package/bin/discipline.js +587 -0
- package/package.json +40 -0
- package/templates/.claude/settings.json +58 -0
- package/templates/AGENTS.md +463 -0
- package/templates/AGENT_TRACKER.md +138 -0
- package/templates/API_REFERENCE.md +131 -0
- package/templates/ARCHITECTURE.md +89 -0
- package/templates/ASSETS.md +90 -0
- package/templates/AUTONOMOUS_QUEUE.md +119 -0
- package/templates/BUILD_PLAN.md +89 -0
- package/templates/CHANGELOG.md +90 -0
- package/templates/CLAUDE.md +89 -0
- package/templates/CREDITS.md +109 -0
- package/templates/DATA_MODEL.md +88 -0
- package/templates/DECISIONS.md +120 -0
- package/templates/DEPLOYMENT.md +342 -0
- package/templates/HANDOFF.md +289 -0
- package/templates/IMPROVEMENT_LOOP.md +103 -0
- package/templates/INVESTIGATION.md +154 -0
- package/templates/LICENSE +68 -0
- package/templates/NOTICE +55 -0
- package/templates/OPEN_DECISIONS.md +61 -0
- package/templates/PLAYBOOK_FEEDBACK.md +87 -0
- package/templates/PROJECT_CONTEXT.md +91 -0
- package/templates/README.md +60 -0
- package/templates/ROADMAP.md +96 -0
- package/templates/SECURITY_AUDIT.md +235 -0
- package/templates/SETUP.md +162 -0
- package/templates/SPEC.md +105 -0
- package/templates/SPEC_WORKFLOW.md +173 -0
- package/templates/TODO.md +118 -0
- package/templates/USAGE.md +153 -0
- package/templates/VERIFICATION_GATE.md +68 -0
- package/templates/agents/CROSS_REPO_SYNC.md +124 -0
- package/templates/agents/DEBUGGER.md +112 -0
- package/templates/agents/PLANNER.md +111 -0
- package/templates/agents/README.md +64 -0
- package/templates/agents/RECON.md +99 -0
- package/templates/agents/SECURITY_REVIEWER.md +123 -0
- package/templates/agents/SPEC_ARCHITECT.md +133 -0
- package/templates/agents/STAKEHOLDER.md +197 -0
- package/templates/agents/_TEMPLATE.md +116 -0
- package/templates/agents/optional/ARCHITECT.md +109 -0
- package/templates/agents/optional/BACKEND_IMPACT.md +108 -0
- package/templates/agents/optional/DOC_AUDIT.md +108 -0
- package/templates/agents/optional/FRONTEND_IMPACT.md +109 -0
- package/templates/agents/optional/QUEUE_CURATOR.md +114 -0
- package/templates/agents/optional/TEST_STRATEGIST.md +107 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Human-readable record of notable changes. Update this file before committing meaningful work. Every commit should have an entry, either by commit hash after the commit exists or by exact commit title before committing.
|
|
4
|
+
|
|
5
|
+
This is the **canonical chronological log of shipped work** for this project. Per the mandatory cleanup gate in `docs/HANDOFF.md` and `docs/AGENTS.md`, shipped TODO entries are deleted from `docs/TODO.md` once captured here, and completed roadmap items are marked ✅ in `docs/ROADMAP.md`. Do not introduce a separate `FEATURES.md` — it would only duplicate either this file (chronological) or `docs/PROJECT_CONTEXT.md` (current-state).
|
|
6
|
+
|
|
7
|
+
This file is **project-scoped**. The framework repo additionally maintains a root `CHANGELOG.md` for changes that affect multiple downstream projects. See "Dual-CHANGELOG Convention" in `DocumentationFramework.md`. Project changelogs do not log framework-template changes; framework changelogs do not log project work.
|
|
8
|
+
|
|
9
|
+
## Entry conventions
|
|
10
|
+
|
|
11
|
+
Three conventions keep the log skim-able for both humans and agents looking at it cold:
|
|
12
|
+
|
|
13
|
+
### 1. Date or wave headings
|
|
14
|
+
|
|
15
|
+
Use H2 for the heading. The default shape is a date plus an optional branch / PR / commit-hash suffix in parentheses for traceability:
|
|
16
|
+
|
|
17
|
+
```markdown
|
|
18
|
+
## 2026-05-06 (feature/payment-flow)
|
|
19
|
+
## 2026-05-06 (#147)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Projects running concurrent multi-subagent batches (a coordinator session that fans work out to several subagents and lands the results in one cleanup) should group those into a **wave** heading instead of one H2 per subagent — the wave is the unit of human review.
|
|
23
|
+
|
|
24
|
+
```markdown
|
|
25
|
+
## Wave 6 — 2026-05-09 (feature/dual-changelog-rollout)
|
|
26
|
+
|
|
27
|
+
- (infra: framework) Adopted dual-CHANGELOG convention; root log now scoped to cross-project changes only.
|
|
28
|
+
- (docs: meta) ...
|
|
29
|
+
- (feat: queue) ...
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
One H2 per logical change set (date or wave); bullet body for what shipped. Newest at the top — keep ordering consistent across the file.
|
|
33
|
+
|
|
34
|
+
### 2. Test-count delta on every entry
|
|
35
|
+
|
|
36
|
+
Each entry includes a test-count line so regressions stand out at a glance:
|
|
37
|
+
|
|
38
|
+
```markdown
|
|
39
|
+
(tests N/N green, +M from prior)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`N/N green` is the absolute count after the change; `+M from prior` is the delta vs. the previous entry. A negative delta or a `green → red` shift lights up immediately. If the change set did not touch tests, write `(tests N/N green, +0 from prior)` so the silence is explicit.
|
|
43
|
+
|
|
44
|
+
For wave entries put the test-count line directly under the H2; for single-change entries put it as the first bullet or as a parenthetical at the end of the change line.
|
|
45
|
+
|
|
46
|
+
### 3. Category prefixes on bullets
|
|
47
|
+
|
|
48
|
+
Tag each bullet with one of the following prefixes for skim-ability:
|
|
49
|
+
|
|
50
|
+
- `(infra: ...)` — build, CI, deploy, mirroring, repo-level plumbing.
|
|
51
|
+
- `(docs: ...)` — documentation-only changes, no runtime behavior delta.
|
|
52
|
+
- `(fix: ...)` — bug fix; behavior was wrong and is now correct.
|
|
53
|
+
- `(feat: ...)` — new feature or capability shipped to users.
|
|
54
|
+
- `(refactor: ...)` — code reshape with no behavior change. Use sparingly; a refactor that doesn't unlock something usually doesn't deserve its own bullet.
|
|
55
|
+
- `(test: ...)` — test additions or fixes that don't ride along with a feat/fix.
|
|
56
|
+
- `(chore: ...)` — dependency bumps, formatting, housekeeping.
|
|
57
|
+
|
|
58
|
+
After the prefix, lead with the **user-visible** change, then mention the file or system that moved. The prefix doubles as the section a future reader will jump to when looking for "what features shipped this quarter" or "what infra moved last month."
|
|
59
|
+
|
|
60
|
+
## Worked example
|
|
61
|
+
|
|
62
|
+
```markdown
|
|
63
|
+
## Wave 6 — 2026-05-09 (feature/dual-changelog-rollout)
|
|
64
|
+
|
|
65
|
+
(tests 142/142 green, +4 from prior)
|
|
66
|
+
|
|
67
|
+
- (feat: queue) `AUTONOMOUS_QUEUE.md` now supports per-item agent-tier suggestions; the autonomous host respects them when picking a subagent.
|
|
68
|
+
- (infra: framework) Mirrored the new `agents/` folder into `docs/agents/` during bootstrap.
|
|
69
|
+
- (docs: meta) Documented the dual-CHANGELOG convention; clarified that `docs/CHANGELOG.md` is project-scoped.
|
|
70
|
+
- (fix: handoff) `HANDOFF.md` Approval Signals section corrected: "go ahead" alone is not approval for `[needs-human-collab]` items.
|
|
71
|
+
|
|
72
|
+
## 2026-05-08 (#214)
|
|
73
|
+
|
|
74
|
+
(tests 138/138 green, +2 from prior)
|
|
75
|
+
|
|
76
|
+
- (feat: usage) Added `--dry-run` to the daily ingest CLI so operators can preview without writing.
|
|
77
|
+
- (test: ingest) Two new test cases covering empty-input and partial-failure modes.
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## YYYY-MM-DD (branch-or-pr-or-hash)
|
|
81
|
+
|
|
82
|
+
(tests N/N green, +M from prior)
|
|
83
|
+
|
|
84
|
+
- (category: ...) Added/changed/fixed something notable. Lead with the user-visible change, then mention the file or system that moved.
|
|
85
|
+
|
|
86
|
+
## YYYY-MM-DD (branch-or-pr-or-hash)
|
|
87
|
+
|
|
88
|
+
(tests N/N green, +M from prior)
|
|
89
|
+
|
|
90
|
+
- (category: ...) Subsequent change set (newest at top — keep ordering consistent across the file).
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
TEMPLATE: CLAUDE.md (Tier B7 — repo-root agent onboarding)
|
|
3
|
+
|
|
4
|
+
WHEN TO USE:
|
|
5
|
+
- At the root of any repo where AI coding agents (Claude Code or others)
|
|
6
|
+
will operate. This is the agent's HOT PATH — the first file read every
|
|
7
|
+
session.
|
|
8
|
+
|
|
9
|
+
HOW TO USE:
|
|
10
|
+
1. Copy this file to the repo root as `CLAUDE.md`.
|
|
11
|
+
2. Replace every <placeholder>.
|
|
12
|
+
3. Keep it SHORT. Target under 80 lines. Anything that needs more depth
|
|
13
|
+
belongs in a doc that Reading Order points to, not here.
|
|
14
|
+
4. CLAUDE.md is for orientation, not policy detail. The Hard Rules section
|
|
15
|
+
is for things that, if violated, cause real damage; routine guidance
|
|
16
|
+
belongs in the linked docs.
|
|
17
|
+
|
|
18
|
+
WHY KEEP IT TIGHT:
|
|
19
|
+
- Every session pays the token cost of this file as part of context.
|
|
20
|
+
- A wall of text trains the agent to skim it instead of obey it.
|
|
21
|
+
- The four sections below are the minimum useful surface; resist adding more.
|
|
22
|
+
-->
|
|
23
|
+
|
|
24
|
+
# CLAUDE.md
|
|
25
|
+
|
|
26
|
+
Working notes for Claude Code (and any other AI coding agents) operating
|
|
27
|
+
inside `<repo-path>`.
|
|
28
|
+
|
|
29
|
+
## Session start
|
|
30
|
+
|
|
31
|
+
Preflight (loads every session — cheapest mishap insurance):
|
|
32
|
+
|
|
33
|
+
1. **Read the handoff.** Read `HANDOFF.md` in your current working directory if present; treat a stale `Last updated` as a smell — flag mismatches, don't trust them.
|
|
34
|
+
2. **Place yourself.** Confirm the working directory and git branch before editing; for new work, branch off the latest default branch (see Hard Rules).
|
|
35
|
+
3. **Scope big moves out loud.** Multi-file edits, deletions, pushes, or deploys: say what you're about to do, then proceed.
|
|
36
|
+
4. **Verify before "done."** "Builds clean" / a subagent's "done" is intent, not proof — run it, grep, or check in-app first.
|
|
37
|
+
|
|
38
|
+
End of session: update this folder's `HANDOFF.md` (`Status` + `Last updated`) and clear shipped TODOs.
|
|
39
|
+
|
|
40
|
+
## Reading Order
|
|
41
|
+
|
|
42
|
+
Before editing, read in this order:
|
|
43
|
+
|
|
44
|
+
1. `<docs/HANDOFF.md or session-state doc>` — current work-in-progress / where the last session left off.
|
|
45
|
+
2. `<docs/README.md or PROJECT_CONTEXT.md>` — what this project is.
|
|
46
|
+
3. `<docs/PROJECT_CONTEXT.md or equivalent>` — funded scope / build contract.
|
|
47
|
+
4. `<docs/AGENTS.md or AGENTS-policy doc>` — tier routing, who does what.
|
|
48
|
+
5. `<docs/TODO.md and AUTONOMOUS_QUEUE.md>` — what's in scope right now.
|
|
49
|
+
|
|
50
|
+
## Common Commands
|
|
51
|
+
|
|
52
|
+
```<powershell | bash>
|
|
53
|
+
<install command> # first run only, e.g. npm install / pnpm install / pip install -e ".[dev]"
|
|
54
|
+
<dev command> # local dev server / watcher
|
|
55
|
+
<typecheck command> # e.g. tsc -b --noEmit / mypy / pyright
|
|
56
|
+
<test command> # unit tests
|
|
57
|
+
<test:watch command> # watch-mode tests (omit if not applicable)
|
|
58
|
+
<full-gate command> # the single command CI runs and you should run before commit
|
|
59
|
+
<lint command> # if separate from typecheck
|
|
60
|
+
<build command> # production build
|
|
61
|
+
<preview command> # serve / preview the production build locally
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
> Keep this list to commands the agent will actually run. If the project has
|
|
65
|
+
> 30 npm scripts, list the 8 that matter and link the rest from package.json.
|
|
66
|
+
|
|
67
|
+
## Hard Rules
|
|
68
|
+
|
|
69
|
+
Things never to do. Each line is a load-bearing rule — violating it causes
|
|
70
|
+
real damage (data loss, scope creep, license drift, content-safety incident,
|
|
71
|
+
secret leak).
|
|
72
|
+
|
|
73
|
+
- **<funded-scope rule>.** <e.g. "The pitch in `docs/PROJECT_CONTEXT.md` is what may be built. Material drift requires a re-pitch in `docs/OPEN_DECISIONS.md` and a fresh `FUNDING_APPROVED` signal.">
|
|
74
|
+
- **<no-secrets-in-repo rule>.** Never commit `.env*`, credentials, API keys, deploy tokens, or anything in `<secret-paths>`. `.gitignore` covers the common cases; if you're about to bypass it, stop.
|
|
75
|
+
- **<no-push-without-approval rule>.** Don't `git push` without the operator's explicit go-ahead. Don't force-push to `<protected-branch>` ever.
|
|
76
|
+
- **One PR per change — open a new one every time, never reuse.** Every change reaches `<protected-branch>` through a pull request; no direct pushes to `<protected-branch>`, never force-push it. Branch off the latest `<protected-branch>` and open a NEW PR for each set of edits. Do NOT add commits to an existing or already-open PR — even your own, even if related — unless the operator explicitly says so; when unsure, open a new PR.
|
|
77
|
+
- **<no-deploy-without-security-audit rule>.** Don't deploy to a public-facing surface without a current `docs/SECURITY_AUDIT_<YYYY-MM-DD>.md` (≤90 days old OR covering all changes since the last audit, whichever is stricter). See `docs/DEPLOYMENT.md` Pre-Deploy Gate.
|
|
78
|
+
- **<content-safety rule>.** <project-specific — e.g. "See `docs/agents/FOUNDER.md` for the rules: real options must link to a real Wikipedia article, fakes must be invented, no living-person gotchas, no medical claims, no tragedy material.">
|
|
79
|
+
- **<doc-sync rule>.** When work crosses a doc-completion-gate boundary (`<docs/HANDOFF.md or equivalent>` lists them), update those docs in the same change.
|
|
80
|
+
- **<no-shipped-todo-residue rule>.** Once a task ships and is logged in `<docs/CHANGELOG.md>`, delete it from `<docs/TODO.md>`.
|
|
81
|
+
|
|
82
|
+
## Defaults
|
|
83
|
+
|
|
84
|
+
- **Default model tier:** <e.g. Sonnet for routine implementation, Opus for architect / security-reviewer / planner. See `docs/AGENTS.md` for the full routing table.>
|
|
85
|
+
- **Default branch:** `<main | master | trunk>`. <one line on protection state if any.>
|
|
86
|
+
- **License:** `<All Rights Reserved | MIT | Apache-2.0 | …>` (see `LICENSE`). Do not silently change it.
|
|
87
|
+
- **Stack:** `<one line: language + framework + runtime>`. Do not add `<things-that-would-be-scope-creep>` without a re-pitch.
|
|
88
|
+
- **Code comments:** <project's stance — e.g. "Default to writing no comments; names should carry meaning." or "Document every public function.">
|
|
89
|
+
- **Formatter / linter:** `<prettier | black | rustfmt>` is the source of truth — don't argue with it.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Credits
|
|
2
|
+
|
|
3
|
+
Record of third-party code, libraries, assets, fonts, and notable inspirations the project depends on. Update this file whenever a new dependency is added, an asset is licensed in, or a code snippet is vendored from another source.
|
|
4
|
+
|
|
5
|
+
This file is for **attribution and credit**. License compliance is a related-but-separate concern — note license obligations here when they require attribution text in the running app, but project-wide license tracking belongs in `LICENSE` and (for distributed projects) a `NOTICE` file at the repo root.
|
|
6
|
+
|
|
7
|
+
## How to use this file
|
|
8
|
+
|
|
9
|
+
For each entry, capture enough that a future maintainer can:
|
|
10
|
+
|
|
11
|
+
- Find the original source.
|
|
12
|
+
- Verify the license still permits use as the project evolves.
|
|
13
|
+
- Reproduce any required attribution text in the right place.
|
|
14
|
+
|
|
15
|
+
Group entries by category. Use the categories below as a starting point; delete the ones that don't apply, add new ones as needed.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Runtime Dependencies
|
|
20
|
+
|
|
21
|
+
(Libraries the project ships with or depends on at runtime — npm packages, system libraries, CDN-loaded scripts, etc.)
|
|
22
|
+
|
|
23
|
+
### Library Name
|
|
24
|
+
|
|
25
|
+
- **Source:** repository or registry URL.
|
|
26
|
+
- **Version:** version pinned in the project (or "latest", or a range).
|
|
27
|
+
- **License:** SPDX identifier (e.g. MIT, Apache-2.0, BSD-3-Clause).
|
|
28
|
+
- **Purpose:** what the project uses it for.
|
|
29
|
+
- **Used in:** files / modules that import it.
|
|
30
|
+
- **Attribution required in app?** yes/no — if yes, where it lives (footer, About page, NOTICE file).
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Development / Build Dependencies
|
|
35
|
+
|
|
36
|
+
(Tools used during development that don't ship to users — test runners, linters, bundlers, scaffolding tools.)
|
|
37
|
+
|
|
38
|
+
### Tool Name
|
|
39
|
+
|
|
40
|
+
- **Source:**
|
|
41
|
+
- **Version:**
|
|
42
|
+
- **License:**
|
|
43
|
+
- **Purpose:**
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Vendored Code / Snippets
|
|
48
|
+
|
|
49
|
+
(Code copied or adapted from another project rather than imported as a dependency. Each entry is a discrete chunk, not a sweeping copy.)
|
|
50
|
+
|
|
51
|
+
### Snippet Name
|
|
52
|
+
|
|
53
|
+
- **Original source:** URL of the original code.
|
|
54
|
+
- **Original author / project:**
|
|
55
|
+
- **Original license:**
|
|
56
|
+
- **Lives at:** path in this repo.
|
|
57
|
+
- **Modifications:** what was changed from the original.
|
|
58
|
+
- **Why vendored instead of depended on:** brief reason (size, no package available, customization needed).
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Assets
|
|
63
|
+
|
|
64
|
+
(Fonts, images, audio, video, icons — anything visual or media-shaped that the project uses.)
|
|
65
|
+
|
|
66
|
+
### Asset Name
|
|
67
|
+
|
|
68
|
+
- **Source:** URL or marketplace.
|
|
69
|
+
- **License:** specific license terms (CC0, CC-BY, custom).
|
|
70
|
+
- **Attribution text:** if the license requires a credit line, the exact wording goes here.
|
|
71
|
+
- **Used in:** files that reference the asset.
|
|
72
|
+
- **Modifications:** if the asset was edited, what was changed (matters for some licenses).
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Fonts
|
|
77
|
+
|
|
78
|
+
(Treat fonts as a sub-category of assets, but break them out because licensing is often distinct.)
|
|
79
|
+
|
|
80
|
+
### Font Family
|
|
81
|
+
|
|
82
|
+
- **Source:**
|
|
83
|
+
- **License:** SIL Open Font License, custom EULA, etc.
|
|
84
|
+
- **Loaded via:** Google Fonts CDN, self-hosted, system font, etc.
|
|
85
|
+
- **Used in:**
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Inspirations / References (optional)
|
|
90
|
+
|
|
91
|
+
(Projects, papers, or designs the project drew from without copying code or assets directly. Optional but useful for posterity, especially for creative or research projects.)
|
|
92
|
+
|
|
93
|
+
### Reference Name
|
|
94
|
+
|
|
95
|
+
- **Source:**
|
|
96
|
+
- **What it inspired:** the part of this project that was influenced.
|
|
97
|
+
- **Notes:**
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Sunsetted (optional)
|
|
102
|
+
|
|
103
|
+
(Dependencies, assets, or sources that were used in earlier versions of the project but no longer ship. Keep them recorded if their license terms required attribution at the time, or if their absence would otherwise be confusing to a future archaeologist.)
|
|
104
|
+
|
|
105
|
+
### Former Dependency
|
|
106
|
+
|
|
107
|
+
- **Was used for:**
|
|
108
|
+
- **Removed in:** date or version.
|
|
109
|
+
- **Why removed:**
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Data Model
|
|
2
|
+
|
|
3
|
+
Update this document when tables/collections/fields change, persistence moves between layers, sensitive data classification changes, or import/export/migration behavior changes.
|
|
4
|
+
|
|
5
|
+
## Persistence Overview
|
|
6
|
+
|
|
7
|
+
Describe where state lives in production and local development. One short paragraph; reserve detail for the per-entity sections below.
|
|
8
|
+
|
|
9
|
+
**Canonical schema / source-of-truth file:** `path/to/schema.sql` (or Prisma file, ORM models, OpenAPI spec, "n/a — ephemeral state").
|
|
10
|
+
|
|
11
|
+
## Production Data Stores
|
|
12
|
+
|
|
13
|
+
- Store/service:
|
|
14
|
+
- Purpose:
|
|
15
|
+
- Backup/migration notes:
|
|
16
|
+
|
|
17
|
+
## Local Development Data
|
|
18
|
+
|
|
19
|
+
- File/database/cache:
|
|
20
|
+
- Reset process:
|
|
21
|
+
|
|
22
|
+
## Tables / Collections / Entities
|
|
23
|
+
|
|
24
|
+
### Entity Name
|
|
25
|
+
|
|
26
|
+
Purpose:
|
|
27
|
+
|
|
28
|
+
Important fields:
|
|
29
|
+
|
|
30
|
+
- `field`: Description.
|
|
31
|
+
|
|
32
|
+
Constraints / uniqueness:
|
|
33
|
+
|
|
34
|
+
- E.g. unique on `(handle)`, foreign key on `parent_id`, NOT NULL on `created_at`.
|
|
35
|
+
|
|
36
|
+
Relationships:
|
|
37
|
+
|
|
38
|
+
- Relationship description.
|
|
39
|
+
|
|
40
|
+
Never expose / server-only:
|
|
41
|
+
|
|
42
|
+
- Fields that must not appear in client responses, logs, or exports (`password_hash`, `reset_token`, internal IDs, etc.). Empty list = explicitly nothing.
|
|
43
|
+
|
|
44
|
+
## Sensitive Data
|
|
45
|
+
|
|
46
|
+
- Data type:
|
|
47
|
+
- Storage rule (encryption, hashing, never-stored):
|
|
48
|
+
- Exposure rule (which API responses include / exclude):
|
|
49
|
+
- Logging rule (redaction, what shows up in error logs):
|
|
50
|
+
|
|
51
|
+
## Import / Export / Seed / Migration Notes
|
|
52
|
+
|
|
53
|
+
Describe any CSV imports, schema migrations, seed data, generated files, or export tooling. For each:
|
|
54
|
+
|
|
55
|
+
- Trigger / when it runs.
|
|
56
|
+
- Expected columns/keys (or pointer to the source spec).
|
|
57
|
+
- What it produces / where it writes.
|
|
58
|
+
|
|
59
|
+
## State Change Map (optional — delete if N/A)
|
|
60
|
+
|
|
61
|
+
For projects with backends, queues, or background jobs, list each operation/endpoint/job and the entities it reads/writes. Useful when state can be touched by multiple paths.
|
|
62
|
+
|
|
63
|
+
| Operation | Reads | Writes |
|
|
64
|
+
|---|---|---|
|
|
65
|
+
| `POST /example` | `users` | `users`, `audit_log` |
|
|
66
|
+
|
|
67
|
+
Skip this section for libraries, CLI tools, or apps with no persistent operations.
|
|
68
|
+
|
|
69
|
+
## Concurrency & Atomicity (optional — delete if N/A)
|
|
70
|
+
|
|
71
|
+
For projects with contended writes, document:
|
|
72
|
+
|
|
73
|
+
- Locking strategy (DB transactions, application-level mutexes, optimistic concurrency).
|
|
74
|
+
- Idempotency keys / replay protection.
|
|
75
|
+
- Transaction boundaries (what is and is not atomic).
|
|
76
|
+
- Race conditions known about and how they are handled.
|
|
77
|
+
|
|
78
|
+
Skip for projects without concurrent writes.
|
|
79
|
+
|
|
80
|
+
## Derived / Computed State (optional — delete if N/A)
|
|
81
|
+
|
|
82
|
+
For state derived from other state rather than stored:
|
|
83
|
+
|
|
84
|
+
- Derivation rule.
|
|
85
|
+
- Where it is computed (SQL view, application code, per-request).
|
|
86
|
+
- What invalidates it.
|
|
87
|
+
|
|
88
|
+
Skip for projects without derived state.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Decisions
|
|
2
|
+
|
|
3
|
+
Record important product and technical decisions that future maintainers should not have to rediscover. The `architect` Frontier-tier subagent (defined in `docs/AGENTS.md`) produces draft entries in this format; the host reviews and lands them.
|
|
4
|
+
|
|
5
|
+
Each decision is its own H2 section dated and titled. Body subsections are H3 so multiple decisions stack cleanly in one file.
|
|
6
|
+
|
|
7
|
+
## Common Decisions Worth Recording
|
|
8
|
+
|
|
9
|
+
A non-exhaustive prompt list — decisions you'll likely face on any non-trivial product, worth recording the moment they're made (or the moment you realize an unwritten convention has hardened into one). Each is a stub shape; expand into a full entry when the decision is actually made.
|
|
10
|
+
|
|
11
|
+
- **Branded ID types in the domain layer.** When the domain has multiple entity types with string- or number-shaped IDs, branded types (e.g. `SampleId` ≠ `SourceId` ≠ `ProjectId`) prevent cross-entity confusion at the type-checker level. Record the branding mechanism, the entities that get branded, and which boundaries enforce or unwrap them.
|
|
12
|
+
- **`schemaVersion: N` on persisted state with a load-time guard.** Any state that round-trips through a file, KV, or database earns a `schemaVersion` field plus a load-time switch that runs migrations forward (and rejects `version > current`). Record the initial version, where the guard lives, and the migration strategy (forward-only, reversible, etc.).
|
|
13
|
+
- **Auth model.** Anonymous-first vs sign-in-first; password vs magic-link vs OAuth; session storage (cookie / JWT in localStorage / opaque KV token).
|
|
14
|
+
- **Local-only vs hosted phase.** Whether the project is intentionally not deployed yet, with explicit exit criteria for graduating to a hosted phase.
|
|
15
|
+
- **Persistence boundary in dev vs prod.** Local JSON / SQLite for dev, hosted DB for prod — and the seam that switches between them.
|
|
16
|
+
- **License choice.** Default (e.g. All Rights Reserved) vs open-source vs source-available. Affects whether external contributions are accepted.
|
|
17
|
+
- **Funding / scope drift rule.** When implementation diverges materially from a funded spec, what's the procedure? (Pause and re-pitch upstream, or proceed under stated authority.)
|
|
18
|
+
- **Error-shape conventions.** How errors flow from data layer → service → UI. Status codes, error envelopes, `Result<T, E>` vs throws.
|
|
19
|
+
- **ID generation.** UUIDv4 vs ULID vs nanoid vs DB sequence; client-generated vs server-generated.
|
|
20
|
+
- **Time and timezone handling.** UTC everywhere internally vs local time at boundaries; how "today" is defined for daily-reset features.
|
|
21
|
+
|
|
22
|
+
When one of these gets decided, write it up as a full entry below using the format that follows.
|
|
23
|
+
|
|
24
|
+
## Entry Format
|
|
25
|
+
|
|
26
|
+
Every decision uses the same H3 structure under an H2 header:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
## YYYY-MM-DD — <Decision Title>
|
|
30
|
+
|
|
31
|
+
Status: Decided | Accepted | Superseded
|
|
32
|
+
Decided: YYYY-MM-DD
|
|
33
|
+
Decision: <one-line summary of what was chosen>
|
|
34
|
+
|
|
35
|
+
### Context
|
|
36
|
+
|
|
37
|
+
Why this came up — the problem, the tradeoff, the trigger. Reference relevant docs (`PROJECT_CONTEXT.md`, prior `DECISIONS.md` entries, `ARCHITECTURE.md`) rather than restating their content.
|
|
38
|
+
|
|
39
|
+
### Consequences
|
|
40
|
+
|
|
41
|
+
What changes as a result. Use bullets for clarity:
|
|
42
|
+
|
|
43
|
+
- Positive consequence.
|
|
44
|
+
- Negative or tradeoff consequence.
|
|
45
|
+
- New maintenance burden, constraint, or downstream work introduced.
|
|
46
|
+
|
|
47
|
+
### Asserted by
|
|
48
|
+
|
|
49
|
+
Files, tests, code locations, deployment assets, or external configuration that **depend on this decision being true**. If any of these change shape, the decision is implicitly broken and should be revisited. Use `path:line` format where possible so a future reader can jump straight there.
|
|
50
|
+
|
|
51
|
+
- `<path/to/test>:Lxx` — `<what it asserts>`
|
|
52
|
+
- `<path/to/code>:Lxx-Lyy` — `<the implementation that embodies this decision>`
|
|
53
|
+
- `<path/to/deployment-asset>` — `<config that encodes this decision>`
|
|
54
|
+
|
|
55
|
+
### Future audits
|
|
56
|
+
|
|
57
|
+
Conditions under which this decision should be revisited. Not a deadline — a list of *triggers* that should automatically re-open the question.
|
|
58
|
+
|
|
59
|
+
- If `<X>` is ever retired, this decision should be re-evaluated.
|
|
60
|
+
- If `<metric>` exceeds `<threshold>`, the alternative (`<alt>`) becomes worth reconsidering.
|
|
61
|
+
- When `<dependency>` ships `<version>`, check whether the workaround is still needed.
|
|
62
|
+
|
|
63
|
+
### Alternatives Considered (optional)
|
|
64
|
+
|
|
65
|
+
- Alternative — why it was not chosen.
|
|
66
|
+
- Alternative — why it was not chosen.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## YYYY-MM-DD — <Worked Example: Use Branded ID Types in Domain Layer>
|
|
70
|
+
|
|
71
|
+
Status: Decided
|
|
72
|
+
Decided: YYYY-MM-DD
|
|
73
|
+
Decision: All entity IDs in `<src/domain/types.ts>` use TypeScript branded types so cross-entity ID confusion is a compile error.
|
|
74
|
+
|
|
75
|
+
### Context
|
|
76
|
+
|
|
77
|
+
The domain has `<EntityA>`, `<EntityB>`, and `<EntityC>`, each with string-shaped IDs. Without branding, `function foo(id: string)` accepts any of the three, and a refactor that swaps argument order silently compiles. Caught a real instance of this in `<test or code path>` during `<milestone>`.
|
|
78
|
+
|
|
79
|
+
### Consequences
|
|
80
|
+
|
|
81
|
+
- Cross-entity ID mix-ups become compile errors instead of runtime bugs.
|
|
82
|
+
- Constructing an ID from a raw string requires going through a branded constructor (`<makeEntityAId(s)>`), which adds one line per ID-creating boundary (parsers, DB reads, URL params).
|
|
83
|
+
- Generic helpers that take "any ID" need either a union type or a generic parameter.
|
|
84
|
+
- Test fixtures need the constructor too — `<fixture-helper-path>` exposes `<asEntityAId(s)>` etc. for ergonomic construction.
|
|
85
|
+
|
|
86
|
+
### Asserted by
|
|
87
|
+
|
|
88
|
+
- `<src/domain/types.ts>:Lxx-Lyy` — branded type declarations.
|
|
89
|
+
- `<src/domain/ids.ts>:Lxx` — branded constructors and unwrap helpers.
|
|
90
|
+
- `<test/domain/ids.test.ts>:Lxx` — type-level negative test (should fail to compile if branding is removed).
|
|
91
|
+
- `<src/api/routes/*.ts>` — every route handler that accepts an ID parses it through the branded constructor at the boundary.
|
|
92
|
+
|
|
93
|
+
### Future audits
|
|
94
|
+
|
|
95
|
+
- If the project migrates off TypeScript (e.g. to Go or Rust), the branding mechanism changes shape — re-record under the new language's idiom (newtype, distinct types, etc.).
|
|
96
|
+
- If the domain is ever flattened to a single entity type, branding becomes overhead — revisit.
|
|
97
|
+
- If runtime parsing libraries (zod, valibot) are adopted project-wide, fold branded constructors into their schemas rather than maintaining parallel constructors.
|
|
98
|
+
|
|
99
|
+
### Alternatives Considered
|
|
100
|
+
|
|
101
|
+
- Plain `string` aliases (`type EntityAId = string`) — rejected; aliases are not nominal in TypeScript, so the compiler still treats them as interchangeable.
|
|
102
|
+
- Wrapper objects (`{ kind: "EntityA", value: string }`) — rejected; runtime overhead and ergonomics worse than zero-cost branding.
|
|
103
|
+
|
|
104
|
+
## YYYY-MM-DD — <Second Decision Title>
|
|
105
|
+
|
|
106
|
+
Status: Accepted
|
|
107
|
+
Decided: YYYY-MM-DD
|
|
108
|
+
Decision: <one-line summary>
|
|
109
|
+
|
|
110
|
+
### Context
|
|
111
|
+
|
|
112
|
+
(Each decision repeats the same H3 structure. Keep entries chronological — newest at the bottom or newest at the top, pick one and stay consistent across the file.)
|
|
113
|
+
|
|
114
|
+
### Consequences
|
|
115
|
+
|
|
116
|
+
### Asserted by
|
|
117
|
+
|
|
118
|
+
### Future audits
|
|
119
|
+
|
|
120
|
+
### Alternatives Considered
|