@johanesimm/fundamentum 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/README.md +185 -0
- package/bin/cli.mjs +167 -0
- package/blueprint/SKILL.md +96 -0
- package/blueprint/phases/architecture.md +78 -0
- package/blueprint/phases/engineering.md +146 -0
- package/blueprint/phases/foundation.md +78 -0
- package/blueprint/phases/planning.md +95 -0
- package/blueprint/phases/prd.md +97 -0
- package/excavate/SKILL.md +141 -0
- package/excavate/phases/engineering.md +96 -0
- package/excavate/phases/foundation.md +75 -0
- package/excavate/phases/planning.md +91 -0
- package/excavate/phases/prd.md +103 -0
- package/package.json +33 -0
- package/primer/SKILL.md +258 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Phase 1 — Product Foundation (docs/foundation/00–08)
|
|
2
|
+
|
|
3
|
+
> Extension of `blueprint`. Read and follow this file when the
|
|
4
|
+
> orchestrator reaches the foundation phase. Interview-driven — never
|
|
5
|
+
> invents product facts.
|
|
6
|
+
|
|
7
|
+
Produce nine documents in dependency order. Each is written only after
|
|
8
|
+
its interview round; **every product fact comes from the user**.
|
|
9
|
+
Recommended defaults are allowed for structure, never for domain
|
|
10
|
+
content.
|
|
11
|
+
|
|
12
|
+
## Documents & what to grill for each
|
|
13
|
+
|
|
14
|
+
Work strictly in order — later docs consume earlier ones:
|
|
15
|
+
|
|
16
|
+
1. **00-Product-Vision** — vision/mission; the 2–3 questions the
|
|
17
|
+
product answers; product philosophy principles; personas (+ future
|
|
18
|
+
personas); core capability domains; MVP in/out-of-scope lists;
|
|
19
|
+
success criteria; explicit non-goals ("the product is NOT…").
|
|
20
|
+
*Grill:* purpose, who suffers today and how, what stays manual,
|
|
21
|
+
what is explicitly refused.
|
|
22
|
+
2. **01-Product-Principles** — ~10 stable product principles + UX and
|
|
23
|
+
engineering principle lists; note that principles change only via
|
|
24
|
+
explicit product decisions. *Grill:* trade-off stances (e.g.
|
|
25
|
+
standardization vs flexibility, simplicity vs power); at least one
|
|
26
|
+
quantified UX target if possible.
|
|
27
|
+
3. **02-Product-Glossary** — THE authoritative terminology table;
|
|
28
|
+
controlled vocabularies (statuses, categories) enumerated in full;
|
|
29
|
+
naming rules ("use X never Y"); governance line (changes require a
|
|
30
|
+
product decision). *Grill:* every ambiguous noun surfaced in 00;
|
|
31
|
+
exact status lists.
|
|
32
|
+
4. **03-Domain-Model** — entity tree, per-entity rules, relationship
|
|
33
|
+
table with cardinalities, business rules, design rationale, and an
|
|
34
|
+
honest **Open Questions** section (allowed here — foundation docs
|
|
35
|
+
may carry open questions; they get resolved in the PRDs).
|
|
36
|
+
*Grill:* containment chains, what is immutable, lifecycle
|
|
37
|
+
endpoints (can X be reopened?).
|
|
38
|
+
5. **04-Organization-Model** — org hierarchy vs work assignment
|
|
39
|
+
(keep them independent unless the user says otherwise), role
|
|
40
|
+
responsibilities with Can/Cannot lists, coarse permission scopes.
|
|
41
|
+
*Grill:* who approves what; one-or-many leads; matrix org needs.
|
|
42
|
+
6. **05-Information-Architecture** — global navigation tree, module
|
|
43
|
+
definitions, per-role default landing + primary navigation,
|
|
44
|
+
navigation rules (hidden modules not rendered), MVP vs future
|
|
45
|
+
navigation, design principles (three-click rule, action-first).
|
|
46
|
+
*Grill:* what each role sees first thing in the morning.
|
|
47
|
+
7. **06-User-Journeys** — one end-to-end journey per persona (use
|
|
48
|
+
the product's natural cadence, e.g. weekly Monday/Friday), AI
|
|
49
|
+
touchpoints table if AI exists, notifications-per-role list,
|
|
50
|
+
exception flows, success criteria. *Grill:* the unhappy paths
|
|
51
|
+
(rejection, escalation, completion).
|
|
52
|
+
8. **07-AI-Strategy** — only if the product has AI: capabilities
|
|
53
|
+
matrix (MVP vs future), context sources, guardrails (recommends-
|
|
54
|
+
only, no business writes, human approval model), what is
|
|
55
|
+
deliberately deferred to engineering. *Grill:* what AI must never
|
|
56
|
+
do.
|
|
57
|
+
9. **08-MVP-Roadmap** — capability phases (not dates), per-phase
|
|
58
|
+
deliverables + exit criteria, MoSCoW prioritization, dependency
|
|
59
|
+
graph, MVP success criteria, risk table, and a closing "Transition
|
|
60
|
+
to Master PRD" section. *Grill:* the smallest release that would
|
|
61
|
+
actually be used; what can wait.
|
|
62
|
+
|
|
63
|
+
## Conventions (mandatory)
|
|
64
|
+
|
|
65
|
+
- Header blockquote (`Document ID`, `Status: Draft v0.1`,
|
|
66
|
+
`Depends On`), Documentation Roadmap status table, `---`
|
|
67
|
+
separators.
|
|
68
|
+
- Glossary discipline from doc 02 onward: one name per concept,
|
|
69
|
+
everywhere.
|
|
70
|
+
- After EACH document: update PROJECT_STATE.md (milestone),
|
|
71
|
+
CHANGELOG.md, ROADMAP/README status markers.
|
|
72
|
+
|
|
73
|
+
## Done when
|
|
74
|
+
|
|
75
|
+
All nine exist, cross-reference cleanly (no term used that 02 doesn't
|
|
76
|
+
define; no feature in 08 absent from 00's scope), open questions are
|
|
77
|
+
consolidated in 03/04, and PROJECT_STATE points at the architecture
|
|
78
|
+
phase (`phases/architecture.md`).
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Phase 5 — Development Plan (docs/planning/)
|
|
2
|
+
|
|
3
|
+
> Extension of `blueprint`. Read and follow this file when the
|
|
4
|
+
> orchestrator reaches the planning phase — the final documentation
|
|
5
|
+
> step. Requires PRDs and engineering specs.
|
|
6
|
+
|
|
7
|
+
This plan turns the specs into a **priority-ordered, dependency-
|
|
8
|
+
sequenced build order** with verifiable gates. It contains no new
|
|
9
|
+
decisions — only sequencing (confirm the priority cut with the user if
|
|
10
|
+
the product has any unusual emphasis).
|
|
11
|
+
|
|
12
|
+
## Files to produce
|
|
13
|
+
|
|
14
|
+
**`00-Development-Plan-Overview.md`** containing:
|
|
15
|
+
|
|
16
|
+
- Phase index table: number, file, one-line scope, priority
|
|
17
|
+
(P1 = irreducible core → P3 = observability/shipping), depends-on,
|
|
18
|
+
mapping to the product roadmap (08)
|
|
19
|
+
- Rationale for the priority cut (P1 = the product's primary
|
|
20
|
+
workflow end-to-end; P2 = what makes it decision-grade; P3 =
|
|
21
|
+
measurable + shippable)
|
|
22
|
+
- Working agreements: specs are authoritative (changes go through
|
|
23
|
+
docs first); checklist discipline; tracking via PROJECT_STATE/
|
|
24
|
+
CHANGELOG; a **Definition of Done** for every deliverable — adapt
|
|
25
|
+
its clauses to the project (the web default: implements its cited
|
|
26
|
+
requirements with server-side guards, emits its events/activities
|
|
27
|
+
transactionally, covered by its spec's verification, runs in the dev
|
|
28
|
+
environment; a library/CLI instead: public API stable, invariants
|
|
29
|
+
enforced, tests green, usable from a clean install)
|
|
30
|
+
- **Out of Plan** list — everything the Master PRD defers, stated as
|
|
31
|
+
"do not build"
|
|
32
|
+
|
|
33
|
+
**One file per phase** (typically 6–9 phases). Derive the sequence
|
|
34
|
+
from the roadmap dependency graph. The canonical shape below is a
|
|
35
|
+
**web-product example** — keep the ordering principle (irreducible core
|
|
36
|
+
first, hardening/shipping last) but replace the middle phases with the
|
|
37
|
+
project's real building blocks (a CLI has commands/config/output; a
|
|
38
|
+
library has core API/edge-cases/docs; a pipeline has ingest/transform/
|
|
39
|
+
sink):
|
|
40
|
+
|
|
41
|
+
1. Foundation — scaffold, dev environment, persistence/migration (if
|
|
42
|
+
any), auth, core plumbing, app shell (always P1, always first)
|
|
43
|
+
2. Organization/administration — users, org entities, assignments
|
|
44
|
+
(if the product has them)
|
|
45
|
+
3. Core domain module(s) — the "what are we managing" layer
|
|
46
|
+
4. Primary workflow — the product's main loop end-to-end + its jobs
|
|
47
|
+
(always P1; the MVP is meaningless without it)
|
|
48
|
+
5. Delivery channels (email/integrations, if any)
|
|
49
|
+
6. Intelligence/AI (against a stub provider first, if any)
|
|
50
|
+
7. Analytics/reporting (if any)
|
|
51
|
+
8. Hardening & release — full acceptance-criteria sweep, performance
|
|
52
|
+
budgets, production packaging/publishing, bootstrap rehearsal
|
|
53
|
+
(always last)
|
|
54
|
+
|
|
55
|
+
Each phase file:
|
|
56
|
+
|
|
57
|
+
- Header: goal (one paragraph), priority, depends-on, the spec
|
|
58
|
+
sections it implements
|
|
59
|
+
- **Deliverables as checkboxes**, grouped by the project's real tiers
|
|
60
|
+
(e.g. backend / worker / frontend, or core / CLI / docs), each
|
|
61
|
+
citing its requirement IDs
|
|
62
|
+
- **Cross-phase seams made explicit**: if a guard or view needs data
|
|
63
|
+
from a later phase, ship it as a stub now and name the phase that
|
|
64
|
+
wires it (never silently defer)
|
|
65
|
+
- **Exit criteria**: numbered, verifiable, mapped to PRD acceptance
|
|
66
|
+
scenarios — a phase is done when these pass, not when the boxes
|
|
67
|
+
are ticked
|
|
68
|
+
|
|
69
|
+
## Wire it into the primer file
|
|
70
|
+
|
|
71
|
+
Add/replace the **Implementation Guide** section of the project's
|
|
72
|
+
agent-context (primer) file — `CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, or
|
|
73
|
+
whichever the `primer` skill resolves for the user's tool: trigger
|
|
74
|
+
condition; "no decisions remain open — do not invent behavior; if a
|
|
75
|
+
spec doesn't answer, stop and update the spec first"; the phase list
|
|
76
|
+
with the rule that a phase starts only when the previous exit criteria
|
|
77
|
+
pass; a "which spec answers what" map; the non-negotiables (server-side
|
|
78
|
+
transactional guards, transactional event emission, immutable tables,
|
|
79
|
+
AI isolation, no dev bypasses, the do-not-build list). Generate the
|
|
80
|
+
primer file itself with the `primer` skill (it asks which tool/file and
|
|
81
|
+
reuses everything above as interview input).
|
|
82
|
+
|
|
83
|
+
## Validation & bookkeeping
|
|
84
|
+
|
|
85
|
+
Cross-check every requirement ID cited in planning files against the
|
|
86
|
+
PRDs (same comm/grep as the engineering phase). Update PROJECT_STATE
|
|
87
|
+
(current milestone = Dev Phase 1), CHANGELOG, README (add the planning
|
|
88
|
+
section), ROADMAP (documentation ✅, implementation 🚧 Next).
|
|
89
|
+
|
|
90
|
+
## Done when
|
|
91
|
+
|
|
92
|
+
Overview + all phase files exist with clean ID cross-checks, the primer
|
|
93
|
+
file guides a fresh session from zero to "start Phase 1", and the state
|
|
94
|
+
files agree. The documentation pipeline is complete — implementation
|
|
95
|
+
begins.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Phase 3 — PRDs (docs/prd/): Master PRD 10 + Feature PRDs 11+
|
|
2
|
+
|
|
3
|
+
> Extension of `blueprint`. Read and follow this file when the
|
|
4
|
+
> orchestrator reaches the PRD phase. Enforces the fully-decided rule
|
|
5
|
+
> (zero open questions in Feature PRDs) and grills the user on every
|
|
6
|
+
> product decision instead of parking it.
|
|
7
|
+
|
|
8
|
+
Requires foundation (00–08) and architecture (09.x) to exist — read
|
|
9
|
+
them first and mine them for **gaps, ambiguities, and inconsistencies**
|
|
10
|
+
(undefined metrics, conflicting scope statements, terms used but not
|
|
11
|
+
defined, thresholds referenced but never quantified). Those gaps are
|
|
12
|
+
your interview agenda: **every one becomes a question to the user,
|
|
13
|
+
then a decision in the PRD. Nothing is parked.**
|
|
14
|
+
|
|
15
|
+
## Part 1 — Master PRD (10)
|
|
16
|
+
|
|
17
|
+
Recommend the **comprehensive** model (confirm with the user): the
|
|
18
|
+
Master PRD owns all cross-cutting requirements; Feature PRDs inherit
|
|
19
|
+
and never restate.
|
|
20
|
+
|
|
21
|
+
Build chapter by chapter in `docs/prd/10-chapters/10.NN-<name>.md`,
|
|
22
|
+
then merge (header + concatenation) into `docs/prd/10-Master-PRD.md`:
|
|
23
|
+
|
|
24
|
+
1. **Executive Summary** — product, problem, solution, MVP in one
|
|
25
|
+
paragraph, this document's role
|
|
26
|
+
2. **Goals & Success Metrics** — foundation criteria made measurable
|
|
27
|
+
3. **Personas & Roles** — persona → role → landing/workspace binding
|
|
28
|
+
4. **Scope** — MVP in/out per module; a numbered **Scope Decisions**
|
|
29
|
+
table resolving every foundation ambiguity (SD-1, SD-2, …)
|
|
30
|
+
5. **Cross-Cutting Requirements** — the heart. Define the
|
|
31
|
+
requirement-ID convention (recommend module-prefixed:
|
|
32
|
+
`<MOD>-NNN` + a cross-cutting prefix), then themed ID blocks:
|
|
33
|
+
core workflow mechanics, permission matrix (role × capability ×
|
|
34
|
+
scope), notification matrix (event × recipient × channel),
|
|
35
|
+
controlled-vocabulary gaps (add missing ones to the glossary as a
|
|
36
|
+
recorded product decision), metric/threshold definitions with
|
|
37
|
+
formulas, event catalog (extending 09.E), AI guardrails as
|
|
38
|
+
requirements, general terminology/navigation rules
|
|
39
|
+
6. **Feature PRD Index** — one Feature PRD per architecture module
|
|
40
|
+
(09.C), each with scope paragraph, owned ID prefix, dependency
|
|
41
|
+
order, and the **template obligations** list (§ below)
|
|
42
|
+
7. **Non-Functional Requirements** — security, performance,
|
|
43
|
+
reliability, usability, AI quality — numbered in the cross-cutting
|
|
44
|
+
scheme
|
|
45
|
+
8. **Open Questions & Deferred Items** — the ONLY place unresolved
|
|
46
|
+
questions may live in the whole documentation set: inherited
|
|
47
|
+
foundation questions (OQ-n), deliberate deferrals (DF-n), and
|
|
48
|
+
foundational defaults awaiting confirmation (convert to
|
|
49
|
+
"Confirmed" with date once the user ratifies them)
|
|
50
|
+
9. **Traceability** — chapter → sources → consumers; ID block →
|
|
51
|
+
consuming PRDs; amendments this PRD makes to upstream docs
|
|
52
|
+
|
|
53
|
+
## Part 2 — Feature PRDs (11+)
|
|
54
|
+
|
|
55
|
+
One per architecture module, in dependency order. **Do not start a
|
|
56
|
+
PRD until the previous one is fully decided.** Per PRD, sections in
|
|
57
|
+
order:
|
|
58
|
+
|
|
59
|
+
1. Metadata header + status table
|
|
60
|
+
2. Purpose & module boundary (cite 09.C/09.F data ownership)
|
|
61
|
+
3. Personas & permissions (reference the master matrix; deltas only)
|
|
62
|
+
4. Structural Decisions table (SD-NN.n) — the decisions this PRD's
|
|
63
|
+
interview produced
|
|
64
|
+
5. Functional requirements, `<PREFIX>-NNN`, themed blocks, each
|
|
65
|
+
testable
|
|
66
|
+
6. Business rules — inherited (cited) + new (BR-NN.n, flagged as
|
|
67
|
+
product decisions)
|
|
68
|
+
7. Workflows traceable to the user journeys
|
|
69
|
+
8. Events emitted (subset of the master catalog; new events =
|
|
70
|
+
Master-PRD amendment, applied immediately)
|
|
71
|
+
9. Notifications consumed (subset of the master matrix)
|
|
72
|
+
10. Acceptance criteria — concrete numbered scenarios
|
|
73
|
+
11. **Out of Scope (definitive)** — "This PRD is fully decided; it
|
|
74
|
+
contains no open questions." Future items reference the Master
|
|
75
|
+
PRD deferred registry. NEVER an "Open Questions" section; avoid
|
|
76
|
+
the word "Pending" in status tables (use "⏳ Planned").
|
|
77
|
+
|
|
78
|
+
## Working loop per PRD
|
|
79
|
+
|
|
80
|
+
1. Read the relevant foundation/architecture/master material; list
|
|
81
|
+
the genuine product decisions the docs don't settle.
|
|
82
|
+
2. Grill the user (AskUserQuestion, recommended option first).
|
|
83
|
+
3. Write the PRD fully decided.
|
|
84
|
+
4. Apply ripple effects immediately: glossary/domain-model amendments
|
|
85
|
+
(marked as product decisions), Master-PRD catalog/matrix
|
|
86
|
+
amendments, merged-file regeneration.
|
|
87
|
+
5. Validate: `grep` for duplicate/dangling requirement IDs, unresolved
|
|
88
|
+
language, banned terms.
|
|
89
|
+
6. Bookkeeping: PROJECT_STATE (next milestone), CHANGELOG (decisions
|
|
90
|
+
recorded individually), ROADMAP/README markers.
|
|
91
|
+
|
|
92
|
+
## Done when
|
|
93
|
+
|
|
94
|
+
Master PRD + all module PRDs exist, validation greps are clean
|
|
95
|
+
everywhere, every foundation open question is either decided in a PRD
|
|
96
|
+
or explicitly registered in Master PRD chapter 8, and PROJECT_STATE
|
|
97
|
+
points at engineering (`phases/engineering.md`).
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: excavate
|
|
3
|
+
description: Retro-document an EXISTING codebase — survey the real code and database, then drive a reduced documentation pipeline (foundation → prd → data/API engineering → planning) that captures what the system already does and why. Use when the user wants to document, backfill docs for, or "reverse-engineer" an existing/brownfield project, or asks for vision/domain/glossary, PRDs, an ERD/schema/API reference, or a forward dev plan for a codebase that already exists. Reads the code as the source of truth; interviews the user only to fill product-intent gaps. Skips architecture and backend/frontend build-specs (the code already embodies those).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Documented Project (existing codebase) — orchestrator
|
|
7
|
+
|
|
8
|
+
You are documenting a project that **already has code**. Unlike a
|
|
9
|
+
greenfield init, most technical facts already exist — your job is to
|
|
10
|
+
**read them out of the code and database**, then interview the user
|
|
11
|
+
**only for product intent the code cannot reveal** (vision, non-goals,
|
|
12
|
+
business rationale, intended rules, canonical terminology). This is the
|
|
13
|
+
brownfield sibling of `blueprint`.
|
|
14
|
+
|
|
15
|
+
Reduced pipeline (architecture and backend/frontend build-specs are
|
|
16
|
+
deliberately skipped — the code is the authority for those):
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
foundation (00-08) → PRDs (10-16) → data/API engineering (20-22)
|
|
20
|
+
→ planning (remaining work)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Each phase is a bundled instruction file in `phases/`; read the
|
|
24
|
+
relevant `phases/*.md` file and follow it. **Never invent behavior the
|
|
25
|
+
code doesn't have** — when code and stated intent disagree, surface the
|
|
26
|
+
discrepancy, don't paper over it. If the user asks for just one phase,
|
|
27
|
+
jump to that file (each states its prerequisites).
|
|
28
|
+
|
|
29
|
+
## Golden rule: code is the source of truth
|
|
30
|
+
|
|
31
|
+
For anything observable in the repo — entities, modules, routes, DB
|
|
32
|
+
tables, enums, current behavior — **derive it from the code, do not ask
|
|
33
|
+
the user to recite it.** Interview only for what the code cannot tell
|
|
34
|
+
you: *why* it exists, what it deliberately does NOT do, which behaviors
|
|
35
|
+
are intended vs accidental, canonical names, and locked business rules.
|
|
36
|
+
Every documented fact is either (a) read from the code, or (b) a
|
|
37
|
+
product-intent answer from the user — never a guess.
|
|
38
|
+
|
|
39
|
+
## Step 1 — Survey the codebase (always first)
|
|
40
|
+
|
|
41
|
+
Before any interview, spend real effort mapping the repo. Produce a
|
|
42
|
+
short internal survey (you'll reuse it in every phase):
|
|
43
|
+
|
|
44
|
+
- **Stack & shape**: languages, frameworks, package manifests, how it
|
|
45
|
+
runs (compose files, entrypoints, workers, jobs).
|
|
46
|
+
- **Modules / features**: top-level code boundaries (folders,
|
|
47
|
+
packages) — these become the Feature-PRD and data-ownership units.
|
|
48
|
+
- **Domain entities**: models/schemas/ORM classes/migrations → the
|
|
49
|
+
noun list and their relationships.
|
|
50
|
+
- **Database**: locate migrations/schema; identify the live/dev DB so
|
|
51
|
+
the engineering phase can introspect it.
|
|
52
|
+
- **API surface**: route definitions → endpoints, methods, auth.
|
|
53
|
+
- **Terminology & enums**: status/enum values and names actually used
|
|
54
|
+
in code (the glossary must match these).
|
|
55
|
+
- **Existing docs**: any README/docs already present — reconcile, do
|
|
56
|
+
not duplicate.
|
|
57
|
+
|
|
58
|
+
Present a 5–8 line summary of what you found and the **gaps only the
|
|
59
|
+
user can fill** (intent, non-goals, rules, canonical names). That gap
|
|
60
|
+
list is your interview agenda.
|
|
61
|
+
|
|
62
|
+
## Step 2 — Interview (product intent only)
|
|
63
|
+
|
|
64
|
+
Ask (AskUserQuestion, batched) about what the code can't show: product
|
|
65
|
+
name + one-sentence purpose; what it explicitly is NOT; target users /
|
|
66
|
+
roles and who they map to in the code; which observed behaviors are
|
|
67
|
+
intended vs legacy/accidental; locked business rules; canonical
|
|
68
|
+
terminology where the code is inconsistent; and how far they want to go
|
|
69
|
+
now (full reduced pipeline vs one phase). Do not re-ask anything the
|
|
70
|
+
survey already answered.
|
|
71
|
+
|
|
72
|
+
## Step 3 — Scaffold `./docs/`
|
|
73
|
+
|
|
74
|
+
Create the four state files (small, from the survey + answers). Mark
|
|
75
|
+
them clearly as documenting an **existing** system:
|
|
76
|
+
|
|
77
|
+
- `docs/README.md` — documentation index listing the phases below
|
|
78
|
+
with status markers (✅ / 🚧 Next / ⏳ Planned)
|
|
79
|
+
- `docs/PROJECT_STATE.md` — Project, Current Phase, Current Milestone,
|
|
80
|
+
Completed, Next Tasks, Locked Decisions (seed with decisions
|
|
81
|
+
already evident in code), Conversation Resume Prompt
|
|
82
|
+
- `docs/ROADMAP.md` — phase table + "Repository Rule: update
|
|
83
|
+
PROJECT_STATE.md and CHANGELOG.md after completing a major document"
|
|
84
|
+
- `docs/CHANGELOG.md` — `## v0.1` scaffold entry noting this documents
|
|
85
|
+
a pre-existing codebase as of today, + the record-all-decisions
|
|
86
|
+
policy line
|
|
87
|
+
|
|
88
|
+
Create empty dirs: `docs/foundation`, `docs/prd`, `docs/engineering`,
|
|
89
|
+
`docs/planning`. (No `docs/architecture` — that phase is skipped.)
|
|
90
|
+
|
|
91
|
+
## Step 4 — Drive the phases
|
|
92
|
+
|
|
93
|
+
Work through these in order, one at a time, finishing each before the
|
|
94
|
+
next. For each, **read the phase file and follow it to completion**:
|
|
95
|
+
|
|
96
|
+
| Order | Phase file | Produces |
|
|
97
|
+
|---|---|---|
|
|
98
|
+
| 1 | `phases/foundation.md` | foundation/00–08 (derived + intent-confirmed) |
|
|
99
|
+
| 2 | `phases/prd.md` | prd/10-Master-PRD + Feature PRDs 11+ (as-built, fully decided) |
|
|
100
|
+
| 3 | `phases/engineering.md` | engineering/20-ERD, 21-Database-Schema, 22-REST-API (introspected from the real code + DB) |
|
|
101
|
+
| 4 | `phases/planning.md` | planning/ forward plan for remaining/desired work |
|
|
102
|
+
|
|
103
|
+
Each phase file ends with a "Done when" gate and a pointer to the next
|
|
104
|
+
file — do not advance until the gate passes.
|
|
105
|
+
|
|
106
|
+
## House conventions (enforced by every phase file; you enforce them
|
|
107
|
+
too when reviewing output)
|
|
108
|
+
|
|
109
|
+
1. **Code first, intent second**: observable facts come from the code;
|
|
110
|
+
the user is interviewed only for intent, rationale, and non-goals.
|
|
111
|
+
2. **Surface discrepancies**: when the code contradicts stated intent
|
|
112
|
+
or is internally inconsistent, record it explicitly (a "Known
|
|
113
|
+
Discrepancies" note) rather than choosing silently.
|
|
114
|
+
3. **Doc format**: header blockquote (`Document ID`, `Status: Draft
|
|
115
|
+
vX.Y`, `Depends On`), a Documentation Roadmap status table, `---`
|
|
116
|
+
separators between sections.
|
|
117
|
+
4. **Numbering**: 00–08 foundation, 10 Master PRD, 11+ Feature PRDs,
|
|
118
|
+
20–22 engineering. IDs never reused. (09.x architecture and 23–25
|
|
119
|
+
build/deploy specs are intentionally absent.)
|
|
120
|
+
5. **Single source of truth**: reference authoritative docs, never
|
|
121
|
+
duplicate them; the glossary owns terminology (and must match the
|
|
122
|
+
code's actual names).
|
|
123
|
+
6. **Fully-decided rule** (PRDs onward): no "Open Questions" / "TBD" in
|
|
124
|
+
Feature PRDs or engineering specs — resolve every question with the
|
|
125
|
+
user (or by reading the code) before finishing. The Master PRD's
|
|
126
|
+
deferred-registry chapter is the ONLY place unresolved future
|
|
127
|
+
questions may live.
|
|
128
|
+
7. **Bookkeeping after every major document**: update PROJECT_STATE.md,
|
|
129
|
+
CHANGELOG.md, README.md and ROADMAP.md status markers.
|
|
130
|
+
8. **Validate against reality**: the engineering phase introspects and
|
|
131
|
+
checks docs against the actual running database and route table —
|
|
132
|
+
a schema/API doc that doesn't match the code is not done.
|
|
133
|
+
|
|
134
|
+
## Exit
|
|
135
|
+
|
|
136
|
+
When the four phases are complete, generate the project's agent-context
|
|
137
|
+
(primer) file with the `primer` skill — it asks which agentic coding
|
|
138
|
+
tool the user uses and writes the correctly-named file (`CLAUDE.md`,
|
|
139
|
+
`AGENTS.md`, `GEMINI.md`, …) or skips if they use none, reusing the
|
|
140
|
+
survey + docs above as interview input. Then hand over to implementation
|
|
141
|
+
of the planned remaining work.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Phase 3 — Engineering Reference (docs/engineering/20–22), introspected
|
|
2
|
+
|
|
3
|
+
> Extension of `excavate`. Read and follow this file when
|
|
4
|
+
> the orchestrator reaches the engineering phase. Generate the data +
|
|
5
|
+
> API reference FROM the real code and database — do not design.
|
|
6
|
+
|
|
7
|
+
Requires fully-decided PRDs. This phase produces up to three
|
|
8
|
+
**reference** documents that describe the system's data and contract as
|
|
9
|
+
it actually is: **20-ERD, 21-Database-Schema, 22-REST-API**. The
|
|
10
|
+
backend/frontend build-specs (23/24) and deployment guide (25) are
|
|
11
|
+
intentionally skipped — for an existing project the code and its
|
|
12
|
+
deploy config are the authority, and re-specifying them adds no value.
|
|
13
|
+
|
|
14
|
+
**Produce only the docs the project actually has.** The trio below
|
|
15
|
+
assumes a service with a relational database and an HTTP API — the
|
|
16
|
+
common case, not a universal one. Adapt:
|
|
17
|
+
|
|
18
|
+
- **No datastore** (CLI, stateless service, library) → skip 20 and 21.
|
|
19
|
+
- **Non-relational store** → keep 20/21 but document the real model
|
|
20
|
+
(collections/keys/documents, or the KV/graph shape) in that store's
|
|
21
|
+
terms instead of an ER diagram + DDL.
|
|
22
|
+
- **Non-HTTP interface** → retitle 22 to the real surface
|
|
23
|
+
(**22-CLI-Interface**, **22-Public-API** for a library, **22-API**
|
|
24
|
+
for gRPC/GraphQL) and document that contract as-built.
|
|
25
|
+
|
|
26
|
+
Note any skipped/retitled doc in 20 (or the umbrella) so the omission is
|
|
27
|
+
explicit. Everything here is **introspected, then verified against
|
|
28
|
+
reality** — not invented. Every requirement ID cited must already exist
|
|
29
|
+
in the PRDs; run the cross-check grep after each document:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
comm -13 <(cat docs/prd/*.md | grep -oE '<ID-REGEX>' | sort -u) \
|
|
33
|
+
<(grep -oE '<ID-REGEX>' <spec>.md | sort -u)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 20-ERD (or data-model reference)
|
|
37
|
+
|
|
38
|
+
Reconstruct the data model **from the actual migrations / ORM models /
|
|
39
|
+
live schema**, not from a redesign. For a non-relational store, describe
|
|
40
|
+
the real collections/documents/keys and their relationships instead of
|
|
41
|
+
an ER diagram. Include: a conventions
|
|
42
|
+
table describing the patterns the code already follows (PK strategy,
|
|
43
|
+
naming, timestamps, enum policy, deletion policy, immutability as
|
|
44
|
+
implemented); entity overview by owning module (mirror the code's
|
|
45
|
+
module boundaries); a mermaid `erDiagram` matching the real tables and
|
|
46
|
+
foreign keys; entity notes for **non-obvious existing choices only**,
|
|
47
|
+
each tied to a requirement ID or flagged as an unexplained artifact; a
|
|
48
|
+
table of referential-integrity rules the schema actually enforces vs
|
|
49
|
+
those enforced in the service layer. Where the model diverges from
|
|
50
|
+
what the PRDs describe, record it in **Known Discrepancies**.
|
|
51
|
+
|
|
52
|
+
## 21-Database-Schema
|
|
53
|
+
|
|
54
|
+
The **authoritative current schema**, captured from the real database
|
|
55
|
+
— not a fresh design. Prefer introspecting the live/dev database
|
|
56
|
+
(`pg_dump --schema-only` or the equivalent) and/or consolidating the
|
|
57
|
+
migrations, then present the DDL grouped by module with the existing
|
|
58
|
+
constraints, indexes, triggers, and enum types, citing requirement IDs
|
|
59
|
+
in comments where a constraint enforces a PRD rule.
|
|
60
|
+
|
|
61
|
+
**MANDATORY when there is a database: verify the doc against the real
|
|
62
|
+
store.** Point at the existing dev/live database (or spin the migrations
|
|
63
|
+
up in a throwaway instance), diff the documented schema against the
|
|
64
|
+
introspected one, and reconcile until they match — field for field. A
|
|
65
|
+
schema doc that doesn't match the running store is not done. Record any
|
|
66
|
+
migration-vs-store drift you find as a Known Discrepancy (do not
|
|
67
|
+
silently "fix" it in the doc).
|
|
68
|
+
|
|
69
|
+
## 22-REST-API (or the project's real interface)
|
|
70
|
+
|
|
71
|
+
The **actual contract**, read from the code — route definitions for an
|
|
72
|
+
HTTP API, command/flag definitions for a CLI, exported signatures for a
|
|
73
|
+
library. Start with conventions the code already uses (for HTTP: base
|
|
74
|
+
path/versioning, auth, response/error envelope, status codes — including
|
|
75
|
+
how business-rule violations are signalled today, e.g. 409 vs 400).
|
|
76
|
+
Then per-module operation tables (method/path/roles/behavior for HTTP,
|
|
77
|
+
or command/args/output, or function/params/returns) generated from the
|
|
78
|
+
real code, each row referencing the PRD requirement it satisfies. Include
|
|
79
|
+
a guard-code / error-code registry **if the code has one** (map each
|
|
80
|
+
code → PRD rule → endpoints); if error signalling is inconsistent,
|
|
81
|
+
document it as-is and flag it. Note the cross-cutting behaviors that
|
|
82
|
+
actually exist (event emission, async patterns, pagination).
|
|
83
|
+
|
|
84
|
+
Endpoints with no corresponding PRD requirement, and PRD requirements
|
|
85
|
+
with no endpoint, both get listed explicitly — that gap list feeds the
|
|
86
|
+
planning phase.
|
|
87
|
+
|
|
88
|
+
## Bookkeeping & done
|
|
89
|
+
|
|
90
|
+
After each doc: cross-check grep, PROJECT_STATE, CHANGELOG (record
|
|
91
|
+
notable discrepancies found), ROADMAP/README markers. Done when every
|
|
92
|
+
applicable doc in 20–22 exists (skipped/retitled ones noted), any schema
|
|
93
|
+
doc has been verified against the real store, the interface doc matches
|
|
94
|
+
the real code, all reference greps are clean, every code-vs-doc
|
|
95
|
+
discrepancy is recorded, and PROJECT_STATE points at planning
|
|
96
|
+
(`phases/planning.md`).
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Phase 1 — Product Foundation (docs/foundation/00–08), as-built
|
|
2
|
+
|
|
3
|
+
> Extension of `excavate`. Read and follow this file when
|
|
4
|
+
> the orchestrator reaches the foundation phase. Derive structure from
|
|
5
|
+
> the code; interview only for product intent.
|
|
6
|
+
|
|
7
|
+
Produce nine foundation documents in dependency order. For an existing
|
|
8
|
+
codebase, **the domain-shaped docs are read out of the code and merely
|
|
9
|
+
confirmed with the user; the intent-shaped docs come from the user.**
|
|
10
|
+
Never invent product facts.
|
|
11
|
+
|
|
12
|
+
## Where each document's content comes from
|
|
13
|
+
|
|
14
|
+
Split every doc into what the **code already tells you** (write it,
|
|
15
|
+
then confirm) vs what only the **user knows** (grill for it):
|
|
16
|
+
|
|
17
|
+
1. **00-Product-Vision** — *user:* vision/mission, the questions the
|
|
18
|
+
product answers, philosophy, personas, explicit non-goals ("is
|
|
19
|
+
NOT…"). *Code:* the capability domains actually implemented (list
|
|
20
|
+
them from the modules). *Grill:* purpose, who it's for, what it
|
|
21
|
+
deliberately refuses — none of which is in the code.
|
|
22
|
+
2. **01-Product-Principles** — *user:* the stable product/UX/eng
|
|
23
|
+
principles and trade-off stances. *Code:* infer candidate
|
|
24
|
+
principles from recurring patterns and propose them for
|
|
25
|
+
confirmation; never assert intent from a pattern that may be
|
|
26
|
+
incidental.
|
|
27
|
+
3. **02-Product-Glossary** — THE authoritative terminology table.
|
|
28
|
+
*Code:* enumerate the real nouns, statuses, enum values, and
|
|
29
|
+
role names as they appear in code — the glossary MUST match them.
|
|
30
|
+
*Grill:* where the code is inconsistent (two names for one
|
|
31
|
+
concept), ask the canonical choice and record the alias as a
|
|
32
|
+
known discrepancy.
|
|
33
|
+
4. **03-Domain-Model** — *Code:* entity tree, per-entity fields,
|
|
34
|
+
relationships with cardinalities read from models/migrations;
|
|
35
|
+
render the real structure. *User:* which rules are intended vs
|
|
36
|
+
accidental, what is immutable by design, lifecycle intent. Keep an
|
|
37
|
+
honest **Open Questions / Known Discrepancies** section.
|
|
38
|
+
5. **04-Organization-Model** — *Code:* the roles/permissions actually
|
|
39
|
+
enforced. *User:* the intended org hierarchy vs work assignment,
|
|
40
|
+
role responsibilities (Can/Cannot), who approves what.
|
|
41
|
+
6. **05-Information-Architecture** — *Code:* the real navigation tree,
|
|
42
|
+
modules, and per-role routes/landing pages from the frontend.
|
|
43
|
+
*User:* the design intent (three-click/action-first) and any
|
|
44
|
+
gap between current and desired navigation.
|
|
45
|
+
7. **06-User-Journeys** — *Code:* the flows that actually exist
|
|
46
|
+
(routes + handlers). *User:* the intended end-to-end journey per
|
|
47
|
+
persona, the unhappy paths, and which existing flows are intended.
|
|
48
|
+
8. **07-AI-Strategy** — only if the codebase has AI: *Code:* what the
|
|
49
|
+
AI integration actually does, its inputs, and existing guardrails.
|
|
50
|
+
*User:* what it must never do; intended vs current guardrails.
|
|
51
|
+
9. **08-MVP-Roadmap** — reframed as **current-state + gap**: what is
|
|
52
|
+
already shipped (from the code), what is partial, and what the user
|
|
53
|
+
still wants — a capability map of built vs remaining (this feeds the
|
|
54
|
+
planning phase). *Grill:* which unbuilt capabilities matter next.
|
|
55
|
+
|
|
56
|
+
## Conventions (mandatory)
|
|
57
|
+
|
|
58
|
+
- Header blockquote (`Document ID`, `Status: Draft v0.1`,
|
|
59
|
+
`Depends On`), Documentation Roadmap status table, `---`
|
|
60
|
+
separators.
|
|
61
|
+
- Glossary discipline from doc 02 onward: one name per concept, and
|
|
62
|
+
that name must be the one the code uses (or the recorded canonical
|
|
63
|
+
choice).
|
|
64
|
+
- Any code-vs-intent mismatch goes in a **Known Discrepancies** note,
|
|
65
|
+
never silently resolved.
|
|
66
|
+
- After EACH document: update PROJECT_STATE.md, CHANGELOG.md,
|
|
67
|
+
ROADMAP/README status markers.
|
|
68
|
+
|
|
69
|
+
## Done when
|
|
70
|
+
|
|
71
|
+
All nine exist, the domain-shaped docs (02/03/04/05) faithfully match
|
|
72
|
+
the code, intent-shaped docs (00/01/06/07) are user-confirmed,
|
|
73
|
+
discrepancies are recorded, and PROJECT_STATE points at the PRD phase
|
|
74
|
+
(`phases/prd.md`). Architecture (09.x) is intentionally skipped — the
|
|
75
|
+
PRDs cite the code and data-ownership directly.
|