@mriekki/lean 0.4.4 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/assets/components.json +3 -3
  2. package/assets/core/distribution.json +5 -0
  3. package/assets/deployment/distribution.json +2 -0
  4. package/assets/generated/ASSEMBLY.json +48 -13
  5. package/assets/generated/core/core/instructions/lean-docs.instructions.md +33 -2
  6. package/assets/generated/core/core/instructions/lean-workflow.instructions.md +42 -0
  7. package/assets/generated/core/core/process/DEPLOYMENT_ENABLEMENT.md +108 -71
  8. package/assets/generated/core/core/process/LEAN_ENGINEERING_GUIDE.md +317 -0
  9. package/assets/generated/core/core/process/PROJECT_DOCUMENTATION_FRAMEWORK.md +324 -0
  10. package/assets/generated/core/core/skills/deploy/SKILL.md +164 -121
  11. package/assets/generated/core/core/skills/deployment-readiness/SKILL.md +223 -250
  12. package/assets/generated/core/core/skills/docs/SKILL.md +116 -0
  13. package/assets/generated/core/core/skills/next-step/SKILL.md +15 -10
  14. package/assets/generated/core/core/skills/tear-down/SKILL.md +101 -61
  15. package/assets/generated/core/core/templates/ADR_TEMPLATE.md +41 -0
  16. package/assets/generated/core/tools/docs_site/docs_site.py +382 -0
  17. package/assets/generated/deployment/src/lean_poc_deployment/entrypoint.py +5 -1
  18. package/assets/generated/deployment/src/lean_poc_deployment/local_cli.py +112 -0
  19. package/assets/generated/deployment/src/lean_poc_deployment/local_runtime.py +523 -0
  20. package/assets/generated/deployment/src/lean_poc_deployment/teardown.py +49 -35
  21. package/assets/generated/deployment/src/lean_poc_deployment/teardown_cli.py +31 -12
  22. package/package.json +1 -1
@@ -0,0 +1,317 @@
1
+ # Lean POC Platform — Engineering Guide
2
+
3
+ > This Markdown guide began as a repository-friendly conversion of the **Lean POC Platform | Integrated Briefing** prepared 16 October 2026. The platform has continued to evolve. Live repository evidence, accepted baselines, and current process docs outrank historical example/status statements when they differ.
4
+
5
+ ## From Idea to Engineering Environment
6
+
7
+ **Core promise:** provide an easy way to turn a personal software idea into a reproducible, AI-enabled engineering project — with technology choice, streamlined setup, deliberate learning, real SDLC practices, and a deployment model that can scale from one-machine local use to distinct Staging / Production environments when the project actually needs them.
8
+
9
+ ```mermaid
10
+ flowchart LR
11
+ IDEA[Idea] --> DISCOVERY[Discovery]
12
+ DISCOVERY --> GENERATE[Generate]
13
+ GENERATE --> BUILD[Build + Learn]
14
+ BUILD --> DELIVER[Deliver]
15
+ DELIVER --> DEPLOY[Deploy when selected]
16
+ ```
17
+
18
+ Technology choice + deterministic setup + Lean AI workflow + learning + CI + explicit deployment topology.
19
+
20
+ ---
21
+
22
+ ## 1. Purpose & Executive Thesis
23
+
24
+ ### Make experimentation easy without making engineering disposable
25
+
26
+ The platform lowers the friction of starting a personal project while preserving enough professional engineering structure that the work is repeatable, teachable, and credible.
27
+
28
+ | Principle | Meaning |
29
+ | --- | --- |
30
+ | Low friction | Start from a short idea instead of hand-assembling repository conventions, setup scripts, AI instructions, and workflow boilerplate. |
31
+ | Choice | Select a technology direction based on project needs or learning goals, with explicit support-state signals rather than hidden assumptions. |
32
+ | Discipline | Use a Lean Agentic workflow with bounded implementation, review, CI evidence, and meaningful human acceptance points. |
33
+ | Learning | Build understanding alongside code through work-item guides, code walkthroughs, learning review, and targeted coaching. |
34
+ | Realism | Exercise containerization, source control, CI, releases, environment isolation, and deployment tradeoffs without pretending every POC needs dedicated Staging/Production computers. |
35
+ | Repeatability | Create self-contained generated repositories with explicit provenance and controlled platform updates. |
36
+
37
+ ### Why this is different from “generate me an app”
38
+
39
+ The outcome is not just source code. It is a project with an engineering operating model: approved scope, stack decision, workspace conventions, AI behavior, work items, setup/readiness, CI, delivery gates, learning support, and deployment boundaries.
40
+
41
+ ---
42
+
43
+ ## 2. Value Stream
44
+
45
+ ### One guided path from idea to a working engineering system
46
+
47
+ AI is used where conversation and judgment help; deterministic tooling is used where reproducibility and safety matter.
48
+
49
+ 1. **Define** — conversational discovery turns a vague idea into users, workflows, state/lifecycle, success criteria, non-goals, security/privacy, and learning goals.
50
+ 2. **Choose** — technology and deployment outcome/topology are selected against a live catalog and recipe model, with support maturity made visible.
51
+ 3. **Generate** — a human-approved manifest drives deterministic generation of a self-contained repository and AI-ready workspace.
52
+ 4. **Build** — work items flow through Lean implementation, tests, review, meaningful-diff acceptance, and CI-backed delivery.
53
+ 5. **Learn** — the same work becomes deliberate practice through walkthrough, learning review, and focused coaching.
54
+ 6. **Operate** — when deployment is selected, the logical environment topology is explicit: workstation, remote target, supported provider adapter, or intentionally deferred.
55
+
56
+ **Design rule:** conversational product discovery is separate from deterministic repository generation.
57
+
58
+ ---
59
+
60
+ ## 3. Platform Architecture
61
+
62
+ ### Reusable platform layers; self-contained consumer projects
63
+
64
+ Clear ownership boundaries keep process, package transport, orchestration, deployment mechanics, and product state from collapsing into one AI-controlled blob.
65
+
66
+ ```mermaid
67
+ flowchart TB
68
+ BOOT[POC Bootstrap<br/>Discovery, catalog, manifests,<br/>deterministic generation] --> POC[Generated POC<br/>self-contained consumer]
69
+ CORE[Agentic Core<br/>Workflow, agents, skills,<br/>HITL gates, learning] --> POC
70
+ PLATFORM[Lean Platform / @mriekki/lean<br/>Exact accepted reusable components] --> POC
71
+ CONTROL[Control Plane<br/>GitHub App orchestration<br/>and safe publication] --> POC
72
+ DEPLOY[Deployment Kit<br/>Workstation + remote-target mechanics] --> POC
73
+ ```
74
+
75
+ | Layer | Responsibility |
76
+ | --- | --- |
77
+ | POC Bootstrap | Discovery protocol, catalog/support states, approved `POC_BOOTSTRAP.json`, deployment topology intent, deterministic generation, setup/readiness helpers, work-item materialization. |
78
+ | Agentic Core | Reusable workflow behavior, agents/skills, Human-in-the-Loop gates, review/delivery semantics, learning flows, topology-aware deployment orchestration. |
79
+ | Lean Platform | Consumer-facing `@mriekki/lean` package that assembles exact accepted reusable components and records provenance. |
80
+ | Control Plane | GitHub App orchestration for target validation, short-lived scoped credentials, deterministic generation, and safe publication. |
81
+ | Deployment Kit | Reusable one-workstation loopback-container runtime plus strict remote target/access, Ubuntu/Docker/Caddy routing, persistence, and scoped tear-down mechanics. Managed hosting remains adapter-specific rather than generic implied support. |
82
+ | Generated POC | Owns product scope, architecture, code/tests, work items, CI evidence, logical environment/topology facts, concrete deployment bindings, accepted baselines, and implementation history. |
83
+
84
+ **Architectural outcome:** a generated POC remains usable on its own. Normal development and deployment do not depend on sibling clones of the platform repositories.
85
+
86
+ ---
87
+
88
+ ## 4. Technology Choice
89
+
90
+ ### Standardization without stack lock-in
91
+
92
+ The platform separates “what I want to use” from “what the bootstrap system can automate confidently today.”
93
+
94
+ - **Choice remains explicit.** Stack selection is part of discovery and can reflect product constraints, developer preference, or a learning objective.
95
+ - **Support is declared.** Catalog entries and recipes expose support state.
96
+ - **Gaps are visible.** An uncataloged recommendation can still be reasonable engineering advice, but it is labeled `CATALOG GAP` rather than presented as supported automation.
97
+ - **Automation can grow.** New recipes, deployment adapters, and support states can be added to repository-owned catalog definitions without changing the overall experience.
98
+
99
+ Reference recipes captured in the original source briefing:
100
+
101
+ - `dotnet-react-sqlite` — Partial support
102
+ - `java-angular-postgres` — Partial support
103
+ - `java-angular-sqlite` — Partial support
104
+ - `react-vite` — Partial support
105
+
106
+ **Implication:** avoid both a rigid golden path that blocks experimentation and ungoverned AI that implies unsupported stacks/providers are production-ready. Choice is broad; automation claims stay evidence-based.
107
+
108
+ ---
109
+
110
+ ## 5. Bootstrap & Provenance
111
+
112
+ ### Definition is conversational; generation is deterministic
113
+
114
+ Once scope is approved, generation authority becomes an explicit manifest rather than conversation memory.
115
+
116
+ ```mermaid
117
+ flowchart LR
118
+ IDEA[Idea] --> DISC[Discovery]
119
+ DISC --> SCOPE[Scope + non-goals]
120
+ SCOPE --> STACK[Stack + support]
121
+ STACK --> ITEMS[Work items]
122
+ ITEMS --> MANIFEST[Approved manifest]
123
+ MANIFEST --> GEN[Generate + publish]
124
+ GEN --> CI[CI]
125
+ CI --> SETUP[Clone + setup]
126
+ SETUP --> ACCEPT[Doctor + acceptance]
127
+ ACCEPT --> START[/start-work]
128
+ START --> IMPL[Implement + review]
129
+ IMPL --> DELIVER[/deliver]
130
+ DELIVER --> MERGE[Merge gate]
131
+ ```
132
+
133
+ 1. Human approves schema-v2 `POC_BOOTSTRAP.json` with initial work items and an exact `@mriekki/lean` package version/profile/integrity.
134
+ 2. The private target repository is seeded with only the approved manifest; a public Control Plane request identifies only the repository.
135
+ 3. The Control Plane validates the private seed, uses short-lived scoped credentials, obtains the exact package artifact, and verifies integrity before reusable target mutation.
136
+ 4. Bootstrap materializes project-owned content; the exact Lean package applies its reusable profile only after drift/collision preflight.
137
+ 5. The generated repository records umbrella and component-native baselines, is published without force/history rewrite, and must pass default-branch CI before local setup continues.
138
+
139
+ ### Why provenance matters
140
+
141
+ A future AI session can inspect what was actually accepted instead of guessing which reusable behavior or generator version produced the workspace.
142
+
143
+ ---
144
+
145
+ ## 6. Generated Developer Experience
146
+
147
+ ### Generation creates an engineering workspace — not just folders
148
+
149
+ A project can be generated, set up, and accepted as an engineering workspace even when its application scaffold or deployment binding is intentionally deferred.
150
+
151
+ | Area | Generated experience |
152
+ | --- | --- |
153
+ | Workspace shell | VS Code workspace, editor conventions, `.gitignore`/`.gitattributes`, settings/extensions, and pre-scaffold launch surfaces. |
154
+ | Agent behavior | `AGENTS.md` plus repository-local agents, skills, scoped instructions, process guidance, and provider-specific integration. |
155
+ | Project definition | Materialized product scope, roadmap, approved work items, architecture/design context, deployment topology, and implementation/learning guidance. |
156
+ | Setup + doctor | Workstation setup and readiness checks stay distinct from human editor/workspace acceptance. A deferred deployment target is not a failed development workspace. |
157
+ | CI baseline | CI exists before substantive implementation and becomes reusable evidence throughout delivery. |
158
+ | Provenance | `POC_BOOTSTRAP.json`, `LEAN_BASELINE.json`, component baselines, `DEV_ENVIRONMENT.json`, and `SCAFFOLD_PLAN.json` make generated state inspectable. |
159
+
160
+ **Important distinction:** machine success is evidence, not human acceptance. Setup and doctor checks can prove tools are ready; the human still decides whether the checkout is actually usable.
161
+
162
+ ---
163
+
164
+ ## 7. Lean Agentic Engineering
165
+
166
+ ### AI handles mechanics; humans retain engineering authority
167
+
168
+ The Lean workflow removes ceremonial prompts while preserving explicit control where scope, acceptance, merge, deployment, or destructive actions are consequential.
169
+
170
+ ```mermaid
171
+ flowchart LR
172
+ WORK[Work Item<br/>requirements + plan] --> IMPLEMENT[Implement<br/>AI-assisted bounded change]
173
+ IMPLEMENT --> REVIEW[Review<br/>Reviewer + meaningful diff]
174
+ REVIEW --> DELIVER[Deliver<br/>commit + push + PR + CI]
175
+ DELIVER --> LEARN[Learn<br/>walkthrough + review + coach]
176
+ LEARN --> WORK
177
+ ```
178
+
179
+ - **`/start-work <ID>`** loads approved work-item context, refines requirements/plan when warranted, then authorizes bounded implementation and routine branch setup.
180
+ - **Implement + Review** is AI-assisted bounded change with tests and Reviewer evidence, followed by human meaningful-diff acceptance.
181
+ - **`/deliver`** performs selective stage, staged-diff verification, commit, push, PR creation/update, and CI inspection after delivery is invoked.
182
+ - **Merge gate** remains one explicit “Merge and finalize delivery?” decision. If evidence materially changes, review re-opens.
183
+ - **Post-merge** verifies default-branch CI and safely cleans up only the delivered short-lived branch.
184
+ - **`/wait-what`** is read-only communication repair: explain what just happened without silently doing work or authorizing the pending action.
185
+
186
+ **Governance pattern:** standardize high-frequency routine mechanics; preserve human authority for material requirements, meaningful implementation acceptance, merge/finalization, release publication, Production deployment, and destructive operations.
187
+
188
+ ---
189
+
190
+ ## 8. Learning Mechanism
191
+
192
+ ### Use AI to increase capability, not only throughput
193
+
194
+ The system treats a personal POC as both a software deliverable and a deliberate learning vehicle — without turning learning into a release gate.
195
+
196
+ - **Embedded context** — work-item Implementation & Learning Guides connect engineering outcomes to concepts, reasoning prompts, things to notice, hands-on opportunities, and learning evidence.
197
+ - **Code walkthrough** — `/code-walkthrough` explains the actual implementation, architecture boundaries, control flow, and important tradeoffs after the work exists.
198
+ - **Learning review** — `/learning-review` distinguishes what the developer can explain from what was merely generated and accepted.
199
+ - **Targeted coaching** — `/coach` focuses on specific gaps instead of re-teaching the whole project.
200
+ - **Evidence labs** — `/db-lab` and `/system-lab` reconstruct current database/system evidence and support change-focused learning without requiring hand-maintained diagrams.
201
+
202
+ ### Comprehension model
203
+
204
+ Distinguish:
205
+
206
+ - personally implemented/used;
207
+ - AI-generated but reviewed/understood;
208
+ - studied/practiced;
209
+ - not yet understood.
210
+
211
+ The goal is evidence of understanding, not artificial claims of authorship.
212
+
213
+ ### No delivery tax
214
+
215
+ Learning is optional and deliberately non-blocking. The project can be delivered once engineering acceptance is satisfied, even if the developer chooses to defer the learning flow.
216
+
217
+ ---
218
+
219
+ ## 9. Environments & Deployment
220
+
221
+ ### Logical environments, flexible physical topology
222
+
223
+ Environment purpose is independent from machine count.
224
+
225
+ ```mermaid
226
+ flowchart TB
227
+ DEV[Development] --> CHOICE{Desired deployment outcome}
228
+ CHOICE --> LOCAL[Demo on workstation<br/>container + loopback]
229
+ CHOICE --> REMOTE[Remote target<br/>one or more logical environments]
230
+ CHOICE --> DEFER[Deferred binding<br/>continue development now]
231
+ CHOICE --> PROVIDER[Managed provider<br/>only through supported adapter]
232
+ ```
233
+
234
+ Keep these dimensions separate:
235
+
236
+ ```text
237
+ purpose / role
238
+ placement
239
+ isolation
240
+ exposure
241
+ binding state / adapter
242
+ target or provider
243
+ failure domain
244
+ ```
245
+
246
+ Examples:
247
+
248
+ | Topology | Meaning |
249
+ | --- | --- |
250
+ | One workstation | `demo` may run as a loopback-only container; no second PC or SSH onboarding required. |
251
+ | Separate remote hosts | Staging and Production can each have their own target/failure domain. |
252
+ | One shared VPS | Staging and Production can remain separate logical environments while sharing a physical failure domain; Lean must state that this does not prove host-level Production isolation. |
253
+ | Deployment deferred | A desired shareable/production-like outcome can be recorded without forcing immediate infrastructure provisioning. |
254
+ | Managed provider | Only an implemented/cataloged provider adapter may be called supported; otherwise it is `CATALOG GAP`/planned. |
255
+
256
+ Production remains separately authorized regardless of physical placement. Colocation never turns Staging validation into Production evidence and never weakens Production data/deployment gates.
257
+
258
+ ### Current maturity statement
259
+
260
+ Reusable deployment mechanics exist for a loopback-only workstation-container path and the strict remote Ubuntu/SSH path. Bootstrap support remains partial until the corresponding package-delivered unrelated generated-consumer proofs are completed. Managed service hosting is an adapter boundary rather than a generic support claim.
261
+
262
+ ---
263
+
264
+ ## 10. Concrete Historical Example
265
+
266
+ ### Family Meal Planner v3: a generated consumer, not a platform fork
267
+
268
+ The original briefing used Family Meal Planner v3 to demonstrate re-baselining a mature product definition into the reusable platform without copying historical execution state.
269
+
270
+ - **Product goal:** private, mobile-friendly household Recipe Library with structured recipes, ingredients/tags, lifecycle management, search/filtering, and family ratings.
271
+ - **Selected stack:** `dotnet-react-sqlite` recipe with partial support; generic scaffold intentionally deferred rather than allowed to overwrite mature architecture decisions.
272
+ - **First work item:** EN-001 — Application Foundation / Walking Skeleton: prove React, ASP.NET, browser-to-API, SQLite through approved layers, dependency injection, health/system info, Compose, and CI.
273
+ - **App-specific deployment model in that reference consumer:** Production and Staging are distinct Ubuntu environments over trusted-LAN SSH with separate target/access contracts and no cross-environment fallback.
274
+ - **Learning goal:** use the project as a hands-on software-engineering POC and build enough understanding to review and explain the system rather than only accept generated implementation.
275
+ - **Lifecycle point in the original briefing:** the v3 repository had an approved seed manifest and was at the GitHub-first generation handoff when the original briefings were prepared.
276
+
277
+ The FMP topology is an **example consumer choice**, not a reusable requirement for other Lean users.
278
+
279
+ **Why the example matters:** it demonstrates that the platform can preserve non-trivial product, architecture, work-item, deployment, and learning intent while still applying a standardized engineering workspace and Lean operating model.
280
+
281
+ ---
282
+
283
+ ## 11. Boundaries, Maturity & Takeaway
284
+
285
+ ### Make the easy path a disciplined path
286
+
287
+ The strongest claim is not that AI can do everything. It is that a reusable operating model can make disciplined engineering the lowest-friction way to explore an idea.
288
+
289
+ - **Not “any stack, fully automated.”** Technology choice is broad; Bootstrap automation is claimed only where the live catalog supports it.
290
+ - **Not “every POC needs servers.”** One-machine local/demo and explicitly deferred deployment are valid outcomes.
291
+ - **Not generic cloud support.** A plausible provider is not supported until a provider adapter is cataloged, implemented, and proven.
292
+ - **Not autonomous Production.** Merge, CI, or release publication never implies Production deployment. Production and destructive operations remain separately gated regardless of placement.
293
+ - **Not model-dependent.** Repository-local workflow assets define behavior; Core does not rely on one fixed AI model to preserve the engineering process.
294
+ - **Not hidden regeneration.** Generated POCs are self-contained consumers. Reusable updates go through controlled package/baseline paths rather than silent wholesale regeneration.
295
+ - **AI drift is bounded.** Repository protocol, catalog, baselines, and project-owned artifacts outrank conversational inference about project state.
296
+ - **Still a POC platform.** This is a disciplined engineering POC platform with strong foundations and explicit remaining proof/maturity work — not a finished enterprise developer platform.
297
+
298
+ ### Strategic takeaway
299
+
300
+ This is a small-system proving ground for AI-native engineering: low-friction project creation, governed technology choice, repository-owned AI behavior, realistic delivery/deployment practice, and learning built into the same workflow.
301
+
302
+ ---
303
+
304
+ ## Source Basis
305
+
306
+ The original integrated briefing retained source basis from:
307
+
308
+ - `lean-poc-bootstrap`
309
+ - `lean-agentic-core`
310
+ - `lean-platform`
311
+ - `lean-poc-control-plane`
312
+ - `lean-poc-deployment-kit`
313
+ - `family-meal-planner-v3`
314
+ - `Lean_Coding_Projects_Shared_Handoff_v3_1.md`
315
+ - `Mark_Coding_Projects_Handoff_v3_1.md`
316
+
317
+ Historical example/status statements originated in the briefing prepared 16 October 2026. Current reusable claims in this guide are constrained by live repository evidence.
@@ -0,0 +1,324 @@
1
+ # Lean Project Documentation Framework
2
+
3
+ Lean project documentation is a small, evidence-aware engineering system rather than a pile of unrelated Markdown files.
4
+
5
+ ## Goals
6
+
7
+ - Keep a short, obvious root-level front door.
8
+ - Keep Markdown as the canonical human-readable source.
9
+ - Preserve one authority for product and work-item requirements.
10
+ - Separate project-owned prose from Lean-managed process material and disposable generated evidence.
11
+ - Make architecture, database, operations, learning, and decision context easy to find.
12
+ - Provide a local documentation website without requiring a documentation framework dependency.
13
+ - Make stale generated views visible instead of asking developers to maintain diagrams manually.
14
+ - Keep documentation support non-blocking for normal engineering delivery.
15
+
16
+ ## Canonical shape
17
+
18
+ Greenfield POCs should normally converge on:
19
+
20
+ ```text
21
+ README.md
22
+ PROJECT_BRIEF.md
23
+
24
+ docs/
25
+ index.md
26
+ lean-docs.json
27
+
28
+ product/
29
+ PRODUCT_BRIEF.md
30
+ IMPLEMENTATION_ROADMAP.md
31
+
32
+ architecture/
33
+ OVERVIEW.md
34
+ DATA.md
35
+ RUNTIME_FLOWS.md
36
+ decisions/
37
+ README.md
38
+ ADR-*.md
39
+
40
+ engineering/
41
+ DEVELOPMENT.md
42
+ TESTING.md
43
+ DELIVERY.md
44
+
45
+ operations/
46
+ ENVIRONMENTS.md
47
+ DEPLOYMENT.md
48
+ TROUBLESHOOTING.md
49
+
50
+ learning/
51
+ OVERVIEW.md
52
+ DATABASE.md
53
+ SYSTEM_DESIGN.md
54
+
55
+ generated/
56
+ README.md
57
+
58
+ lean/
59
+ LEAN_ENGINEERING_GUIDE.md
60
+
61
+ tools/
62
+ lean-docs/
63
+ docs-site.py
64
+ ```
65
+
66
+ The exact set may vary for an adopted repository, but ownership and authority rules should remain explicit.
67
+
68
+ ## Root-level front doors
69
+
70
+ ### `README.md`
71
+
72
+ Keep it short. It should answer:
73
+
74
+ - what the repository is;
75
+ - where to start;
76
+ - how to set up/run the project;
77
+ - where the authoritative product/work-item docs live;
78
+ - how to open project documentation;
79
+ - what the first approved work item is when applicable.
80
+
81
+ ### `PROJECT_BRIEF.md`
82
+
83
+ `PROJECT_BRIEF.md` is the integrated project briefing and navigation surface. It may summarize approved product scope, stack, environments, initial work items, learning goals, and important documentation links.
84
+
85
+ It is **not** a second requirements authority. In a normal Lean greenfield POC:
86
+
87
+ - `docs/product/PRODUCT_BRIEF.md` remains product authority;
88
+ - approved work-item briefs/requirements remain work-item authority;
89
+ - `PROJECT_BRIEF.md` summarizes and links to those authorities.
90
+
91
+ If a repository already has a different accepted authority model, preserve it.
92
+
93
+ ## Ownership classes
94
+
95
+ Each document in `docs/lean-docs.json` should identify one of these ownership classes.
96
+
97
+ ### `project`
98
+
99
+ Project-owned material. It may be created by Bootstrap and then evolve with the application.
100
+
101
+ Examples:
102
+
103
+ - `PROJECT_BRIEF.md`
104
+ - product/architecture/engineering/operations/learning docs
105
+ - ADRs
106
+
107
+ Do not overwrite project-owned prose during Lean package updates merely because a newer template exists.
108
+
109
+ ### `lean`
110
+
111
+ Reusable Lean-managed material whose source lives in a reusable platform repository and whose accepted bytes/provenance are controlled through the package/baseline mechanism.
112
+
113
+ Examples:
114
+
115
+ - Lean process guides
116
+ - `docs/lean/LEAN_ENGINEERING_GUIDE.md`
117
+ - the local documentation viewer
118
+ - reusable templates
119
+
120
+ ### `generated-evidence`
121
+
122
+ Disposable projections reconstructed from current repository/database evidence.
123
+
124
+ Examples:
125
+
126
+ - System Lab workbench snapshots
127
+ - DB Lab workbench snapshots
128
+ - local documentation site output
129
+
130
+ Generated evidence is not authoritative prose and should not normally be committed. The default local cache is:
131
+
132
+ ```text
133
+ .lean/docs-cache/
134
+ ```
135
+
136
+ ## Documentation manifest
137
+
138
+ `docs/lean-docs.json` is a small project-owned index, not a competing content store.
139
+
140
+ Recommended schema:
141
+
142
+ ```json
143
+ {
144
+ "schemaVersion": 1,
145
+ "site": {
146
+ "title": "Example POC",
147
+ "entry": "PROJECT_BRIEF.md"
148
+ },
149
+ "documents": [
150
+ {
151
+ "path": "PROJECT_BRIEF.md",
152
+ "section": "Overview",
153
+ "type": "project-brief",
154
+ "ownership": "project",
155
+ "authority": "navigation"
156
+ },
157
+ {
158
+ "path": "docs/product/PRODUCT_BRIEF.md",
159
+ "section": "Product",
160
+ "type": "product-brief",
161
+ "ownership": "project",
162
+ "authority": "product"
163
+ },
164
+ {
165
+ "path": "docs/lean/LEAN_ENGINEERING_GUIDE.md",
166
+ "section": "Lean",
167
+ "type": "platform-guide",
168
+ "ownership": "lean",
169
+ "authority": "reference"
170
+ }
171
+ ]
172
+ }
173
+ ```
174
+
175
+ The site renderer should tolerate missing optional documents so Bootstrap and reusable-package application can remain separate deterministic phases.
176
+
177
+ ## Local documentation website
178
+
179
+ The reusable viewer is intentionally dependency-free and local-only.
180
+
181
+ Normal command:
182
+
183
+ ```powershell
184
+ python .\tools\lean-docs\docs-site.py serve --root .
185
+ ```
186
+
187
+ Build-only mode:
188
+
189
+ ```powershell
190
+ python .\tools\lean-docs\docs-site.py build --root . --out .\.lean\docs-site
191
+ ```
192
+
193
+ The viewer should:
194
+
195
+ - bind to loopback only;
196
+ - discover `docs/lean-docs.json` when present;
197
+ - fall back to safe Markdown discovery for adopted repositories;
198
+ - provide section navigation and full-text search;
199
+ - render common Markdown without external dependencies;
200
+ - render the simple `flowchart` Mermaid subset used by the Lean engineering guide and preserve unsupported Mermaid source visibly rather than failing;
201
+ - show document ownership/authority metadata when known;
202
+ - show the current Git commit when available;
203
+ - show DB/System Lab cache availability and freshness where evidence permits;
204
+ - never mutate project prose merely by being opened.
205
+
206
+ The HTML/site is a projection. Markdown remains canonical.
207
+
208
+ ## Lab integration
209
+
210
+ Use the standard local cache paths:
211
+
212
+ ```text
213
+ .lean/docs-cache/system/
214
+ .lean/docs-cache/database/
215
+ ```
216
+
217
+ ### System Lab
218
+
219
+ Because System Lab can reconstruct its model from repository evidence, the docs viewer may best-effort prepare the current System Lab projection when it starts and the tool is available:
220
+
221
+ ```powershell
222
+ python .\tools\lean-system-lab\system-workbench.py export --repo . --out .\.lean\docs-cache\system
223
+ ```
224
+
225
+ This is read-only and non-blocking.
226
+
227
+ ### DB Lab
228
+
229
+ Do not guess a database path. The docs viewer may surface an existing DB Lab projection and the `/db-lab` entry point. Automatic DB Lab generation is allowed only when a safe local development/test database path is already explicit in project configuration/evidence.
230
+
231
+ Never create a database, apply migrations, mutate data, or inspect Production to make documentation look current.
232
+
233
+ ## Freshness model
234
+
235
+ Generated views should report one of:
236
+
237
+ ```text
238
+ CURRENT
239
+ STALE
240
+ AVAILABLE / FRESHNESS UNKNOWN
241
+ NOT GENERATED
242
+ ```
243
+
244
+ For System Lab, compare its recorded repository commit/fingerprint with the current checkout when possible.
245
+
246
+ For DB Lab, freshness is evidence-dependent. Do not call a DB projection current merely because the HTML exists when no repository/schema binding proves it.
247
+
248
+ Tracked narrative docs are not automatically rewritten based on file timestamps. Instead, delivery/change analysis should identify likely documentation impact.
249
+
250
+ ## Delivery-completion behavior
251
+
252
+ After engineering delivery is complete, classify documentation impact separately from delivery state.
253
+
254
+ Examples of likely impact:
255
+
256
+ - public API/contract change → architecture/API/runtime docs;
257
+ - new service/dependency/queue/cache → architecture/runtime/system evidence;
258
+ - schema/migration/query/index change → data/database evidence;
259
+ - environment/deployment change → operations docs;
260
+ - new architectural tradeoff → possible ADR;
261
+ - test strategy or developer workflow change → engineering docs.
262
+
263
+ Safe generated projections may be rebuilt automatically. Human/project-authored prose should not be silently rewritten merely because the code changed.
264
+
265
+ A useful completion surface is:
266
+
267
+ ```text
268
+ DOCUMENTATION IMPACT
269
+
270
+ ✓ Project brief: no material change detected
271
+ ★ System evidence: changed; current projection prepared
272
+ ★ Database evidence: changed; /db-lab recommended
273
+ ○ ADR consideration: new synchronous external dependency introduced
274
+ ```
275
+
276
+ This is informative and non-blocking.
277
+
278
+ ## ADRs
279
+
280
+ Use ADRs for consequential architecture decisions that benefit from preserving context and tradeoffs.
281
+
282
+ An ADR should record:
283
+
284
+ - status;
285
+ - context;
286
+ - decision;
287
+ - alternatives considered;
288
+ - tradeoffs/consequences;
289
+ - evidence/links.
290
+
291
+ Do not create an ADR for every implementation detail. Do not silently invent a decision on the human's behalf. When delivery evidence reveals a material architectural choice without an ADR, surface the opportunity rather than auto-approving prose.
292
+
293
+ ## Evidence and safety
294
+
295
+ - Never put secret values in tracked Markdown or generated site data.
296
+ - Do not infer runtime behavior from architecture prose alone.
297
+ - Label architecture claims with evidence provenance where appropriate.
298
+ - Repository and runtime/database evidence outrank stale generated diagrams.
299
+ - A generated site build failure must not invalidate otherwise successful engineering delivery.
300
+ - Production access is never required merely to render documentation.
301
+
302
+ ## Relationship to learning
303
+
304
+ Project documentation is a learning surface, not just reference material.
305
+
306
+ The site should keep these entry points visible when available:
307
+
308
+ ```text
309
+ /db-lab
310
+ /system-lab
311
+ /code-walkthrough
312
+ /learning-review
313
+ /coach
314
+ ```
315
+
316
+ System/database diagrams remain current-by-default projections. The learner should think “open the lab,” not “maintain the diagram.”
317
+
318
+ ## Relationship to Lean updates
319
+
320
+ Lean-managed files may be updated through the controlled Lean package/baseline path.
321
+
322
+ Project-owned docs and ADRs must be preserved unless a change explicitly owns them. Generated evidence/cache is reconstructed instead of merged.
323
+
324
+ This keeps package updates deterministic without turning documentation into a regeneration hazard.