@mriekki/project-forge 0.0.0-stage → 2.0.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.
Files changed (117) hide show
  1. package/README.md +134 -2
  2. package/assets/components.json +33 -0
  3. package/assets/core/distribution.json +66 -0
  4. package/assets/deployment/distribution.json +54 -0
  5. package/assets/generated/ASSEMBLY.json +557 -0
  6. package/assets/generated/core/core/agents/coach.agent.md +69 -0
  7. package/assets/generated/core/core/agents/reviewer.agent.md +85 -0
  8. package/assets/generated/core/core/instructions/project-forge-docs.instructions.md +45 -0
  9. package/assets/generated/core/core/instructions/project-forge-workflow.instructions.md +79 -0
  10. package/assets/generated/core/core/learning/CODING_DRILLS.md +35 -0
  11. package/assets/generated/core/core/learning/DIAGRAM_GUIDE.md +59 -0
  12. package/assets/generated/core/core/learning/ENGINEERING_LEARNING_WORKBOOK.md +108 -0
  13. package/assets/generated/core/core/learning/LEARNING_MAP.md +108 -0
  14. package/assets/generated/core/core/learning/LEARNING_PROGRESS.md +39 -0
  15. package/assets/generated/core/core/learning/RESOURCE_CATALOG.md +25 -0
  16. package/assets/generated/core/core/learning/SQL_DRILLS.md +90 -0
  17. package/assets/generated/core/core/learning/SYSTEM_DESIGN_DRILLS.md +301 -0
  18. package/assets/generated/core/core/process/COACHING_GUIDE.md +92 -0
  19. package/assets/generated/core/core/process/DATABASE_LEARNING_WORKBENCH.md +397 -0
  20. package/assets/generated/core/core/process/DEPLOYMENT_ENABLEMENT.md +166 -0
  21. package/assets/generated/core/core/process/GUIDED_NEXT_STEPS.md +48 -0
  22. package/assets/generated/core/core/process/HUMAN_GATES.md +83 -0
  23. package/assets/generated/core/core/process/INTERACTIVE_SESSION_GUIDE.md +64 -0
  24. package/assets/generated/core/core/process/PROJECT_DOCUMENTATION_FRAMEWORK.md +326 -0
  25. package/assets/generated/core/core/process/PROJECT_FORGE_ENGINEERING_GUIDE.md +308 -0
  26. package/assets/generated/core/core/process/PR_WORKFLOW.md +55 -0
  27. package/assets/generated/core/core/process/SETUP_ACCEPTANCE_CHECKLIST.md +72 -0
  28. package/assets/generated/core/core/process/SYSTEM_DESIGN_LEARNING_WORKBENCH.md +520 -0
  29. package/assets/generated/core/core/process/WORK_ITEM_MODEL.md +56 -0
  30. package/assets/generated/core/core/skills/cleanup-branches/SKILL.md +190 -0
  31. package/assets/generated/core/core/skills/coach/SKILL.md +174 -0
  32. package/assets/generated/core/core/skills/code-walkthrough/SKILL.md +197 -0
  33. package/assets/generated/core/core/skills/core-sync/SKILL.md +178 -0
  34. package/assets/generated/core/core/skills/db-lab/SKILL.md +245 -0
  35. package/assets/generated/core/core/skills/define-feature/SKILL.md +144 -0
  36. package/assets/generated/core/core/skills/deliver/SKILL.md +397 -0
  37. package/assets/generated/core/core/skills/deploy/SKILL.md +188 -0
  38. package/assets/generated/core/core/skills/deployment-readiness/SKILL.md +234 -0
  39. package/assets/generated/core/core/skills/developer-env-mode/SKILL.md +231 -0
  40. package/assets/generated/core/core/skills/docs/SKILL.md +116 -0
  41. package/assets/generated/core/core/skills/grill-me/SKILL.md +77 -0
  42. package/assets/generated/core/core/skills/grill-with-docs/SKILL.md +90 -0
  43. package/assets/generated/core/core/skills/learning-review/SKILL.md +90 -0
  44. package/assets/generated/core/core/skills/next-step/SKILL.md +221 -0
  45. package/assets/generated/core/core/skills/progress/SKILL.md +207 -0
  46. package/assets/generated/core/core/skills/project-forge-update/SKILL.md +228 -0
  47. package/assets/generated/core/core/skills/pull-latest/SKILL.md +166 -0
  48. package/assets/generated/core/core/skills/refine-requirements/SKILL.md +207 -0
  49. package/assets/generated/core/core/skills/setup/SKILL.md +362 -0
  50. package/assets/generated/core/core/skills/start-work/SKILL.md +190 -0
  51. package/assets/generated/core/core/skills/system-lab/SKILL.md +333 -0
  52. package/assets/generated/core/core/skills/tear-down/SKILL.md +140 -0
  53. package/assets/generated/core/core/skills/upstream-fix/SKILL.md +221 -0
  54. package/assets/generated/core/core/skills/wait-what/SKILL.md +86 -0
  55. package/assets/generated/core/core/templates/ADR_TEMPLATE.md +41 -0
  56. package/assets/generated/core/core/templates/FEATURE_BRIEF_TEMPLATE.md +27 -0
  57. package/assets/generated/core/core/templates/PRODUCT_BRIEF_TEMPLATE.md +27 -0
  58. package/assets/generated/core/core/templates/PULL_REQUEST_TEMPLATE.md +37 -0
  59. package/assets/generated/core/core/templates/REQUIREMENTS_TEMPLATE.md +17 -0
  60. package/assets/generated/core/profiles/greenfield/project-forge-workspace.json +12 -0
  61. package/assets/generated/core/tools/db_lab/sqlite_workbench.py +463 -0
  62. package/assets/generated/core/tools/docs_site/docs_site.py +512 -0
  63. package/assets/generated/core/tools/package/check_baseline.py +102 -0
  64. package/assets/generated/core/tools/package/check_upstream.py +171 -0
  65. package/assets/generated/core/tools/system_lab/system_workbench.py +243 -0
  66. package/assets/generated/deployment/distribution/project-forge-deploy.py +8 -0
  67. package/assets/generated/deployment/docs/DEVELOPER_ENVIRONMENTS.md +335 -0
  68. package/assets/generated/deployment/docs/ENVIRONMENT_PROOF.md +95 -0
  69. package/assets/generated/deployment/docs/WORKSPACE_INSTANCES.md +154 -0
  70. package/assets/generated/deployment/docs/images/developer-environment-journey.svg +56 -0
  71. package/assets/generated/deployment/docs/images/personal-environment-architecture.svg +54 -0
  72. package/assets/generated/deployment/docs/images/poc-environment-model.svg +61 -0
  73. package/assets/generated/deployment/src/project_forge_deployment/__init__.py +3 -0
  74. package/assets/generated/deployment/src/project_forge_deployment/__main__.py +3 -0
  75. package/assets/generated/deployment/src/project_forge_deployment/app_cli.py +163 -0
  76. package/assets/generated/deployment/src/project_forge_deployment/app_runtime.py +455 -0
  77. package/assets/generated/deployment/src/project_forge_deployment/app_runtime_remote.py +416 -0
  78. package/assets/generated/deployment/src/project_forge_deployment/app_runtime_workstation.py +136 -0
  79. package/assets/generated/deployment/src/project_forge_deployment/box_platform.py +208 -0
  80. package/assets/generated/deployment/src/project_forge_deployment/box_platform_assets.py +100 -0
  81. package/assets/generated/deployment/src/project_forge_deployment/box_platform_remote.py +271 -0
  82. package/assets/generated/deployment/src/project_forge_deployment/cli.py +437 -0
  83. package/assets/generated/deployment/src/project_forge_deployment/doctor.py +121 -0
  84. package/assets/generated/deployment/src/project_forge_deployment/entrypoint.py +37 -0
  85. package/assets/generated/deployment/src/project_forge_deployment/environment_cli.py +271 -0
  86. package/assets/generated/deployment/src/project_forge_deployment/environment_probe.py +228 -0
  87. package/assets/generated/deployment/src/project_forge_deployment/errors.py +5 -0
  88. package/assets/generated/deployment/src/project_forge_deployment/home_lab.py +328 -0
  89. package/assets/generated/deployment/src/project_forge_deployment/image_transfer.py +105 -0
  90. package/assets/generated/deployment/src/project_forge_deployment/keys.py +171 -0
  91. package/assets/generated/deployment/src/project_forge_deployment/local_cli.py +189 -0
  92. package/assets/generated/deployment/src/project_forge_deployment/local_runtime.py +526 -0
  93. package/assets/generated/deployment/src/project_forge_deployment/local_spec.py +82 -0
  94. package/assets/generated/deployment/src/project_forge_deployment/local_sqlite.py +205 -0
  95. package/assets/generated/deployment/src/project_forge_deployment/portable_profile.py +181 -0
  96. package/assets/generated/deployment/src/project_forge_deployment/profile_migration.py +70 -0
  97. package/assets/generated/deployment/src/project_forge_deployment/profile_repository.py +348 -0
  98. package/assets/generated/deployment/src/project_forge_deployment/profiles.py +204 -0
  99. package/assets/generated/deployment/src/project_forge_deployment/registry_access.py +114 -0
  100. package/assets/generated/deployment/src/project_forge_deployment/registry_cli.py +51 -0
  101. package/assets/generated/deployment/src/project_forge_deployment/route_registry.py +367 -0
  102. package/assets/generated/deployment/src/project_forge_deployment/route_registry_remote.py +443 -0
  103. package/assets/generated/deployment/src/project_forge_deployment/security.py +290 -0
  104. package/assets/generated/deployment/src/project_forge_deployment/sqlite_adapter.py +335 -0
  105. package/assets/generated/deployment/src/project_forge_deployment/sqlite_adapter_remote.py +340 -0
  106. package/assets/generated/deployment/src/project_forge_deployment/sqlite_cli.py +86 -0
  107. package/assets/generated/deployment/src/project_forge_deployment/sqlite_import_recovery.py +437 -0
  108. package/assets/generated/deployment/src/project_forge_deployment/ssh.py +119 -0
  109. package/assets/generated/deployment/src/project_forge_deployment/teardown.py +300 -0
  110. package/assets/generated/deployment/src/project_forge_deployment/teardown_cli.py +139 -0
  111. package/assets/generated/deployment/src/project_forge_deployment/teardown_remote.py +100 -0
  112. package/assets/generated/deployment/src/project_forge_deployment/trust.py +278 -0
  113. package/bin/project-forge.mjs +9 -0
  114. package/package.json +31 -4
  115. package/src/cli.mjs +150 -0
  116. package/src/engine.mjs +243 -0
  117. package/src/package-data.mjs +18 -0
@@ -0,0 +1,333 @@
1
+ ---
2
+ name: system-lab
3
+ description: "Optional evidence-backed advanced system-design lab for architecture, runtime flows, APIs, failures, capacity, performance, observability, security, messaging, deployment, testing, evolution, debugging, and interview practice."
4
+ argument-hint: "[architecture|runtime|api|failure|capacity|performance|observability|security|messaging|deployment|testing|debug|changes|evolve|compare|interview|topic] [work-item]"
5
+ user-invocable: true
6
+ disable-model-invocation: true
7
+ ---
8
+
9
+ # System Lab
10
+
11
+ `/system-lab` is an optional advanced learning surface built from current repository/runtime evidence. It complements `/coach`; it does not replace the engineering workflow or authorize implementation changes.
12
+
13
+ For detailed usage, model semantics, and examples, read `docs/process/SYSTEM_DESIGN_LEARNING_WORKBENCH.md` in a greenfield consumer (or canonical `core/process/SYSTEM_DESIGN_LEARNING_WORKBENCH.md`).
14
+
15
+ ## 1. Core contract
16
+
17
+ - Start from the current repository and the minimum safe evidence needed for the requested lens.
18
+ - Treat the repository/runtime/configuration evidence as authoritative; generated diagrams are disposable projections, never a second source of truth.
19
+ - Re-discover evidence whenever the lab is invoked. Do not make the human remember to refresh or rebuild a diagram.
20
+ - Prefer the distributed `tools/project-forge-system-lab/system-workbench.py` when present. It always rebuilds its model from current evidence and may compare with its prior disposable snapshot.
21
+ - Never inspect Production credentials, Production data, or secret values.
22
+ - Do not change production code, configuration, infrastructure, schemas, data, or deployment state while in System Lab mode.
23
+ - Do not claim runtime behavior from static topology alone. Label evidence precisely.
24
+ - Discovered implementation defects return to the normal engineering workflow; do not silently fix them here.
25
+ - Learning is optional and never blocks delivery.
26
+
27
+ ## 2. Evidence labels
28
+
29
+ Use these labels consistently:
30
+
31
+ ```text
32
+ CONFIRMED BY CODE — directly observed in source/configuration/tests
33
+ CONFIRMED BY RUNTIME — directly observed in safe runtime/telemetry evidence
34
+ DOCUMENTED INTENT — stated in project documentation/ADR/requirements
35
+ INFERRED — reasonable interpretation from incomplete evidence
36
+ UNKNOWN — evidence is insufficient
37
+ LEARNER ASSUMPTION — value supplied for a design/capacity exercise
38
+ ```
39
+
40
+ A diagram edge is not automatically proof that a runtime call occurred. A dependency discovered from configuration/package references may still be only structural evidence.
41
+
42
+ ## 3. System-design competencies
43
+
44
+ Assess independently rather than using one generic "system design level":
45
+
46
+ ```text
47
+ requirements + scope framing
48
+ capacity estimation + workload modeling
49
+ API + contract design
50
+ service/module decomposition
51
+ data/storage selection
52
+ caching
53
+ messaging + asynchronous workflows
54
+ consistency + distributed coordination
55
+ scaling + partitioning
56
+ availability + fault tolerance
57
+ latency + performance
58
+ runtime/deployment topology
59
+ observability + SLO reasoning
60
+ security + abuse resistance
61
+ cost/complexity awareness
62
+ architecture evolution
63
+ incident/debug reasoning
64
+ testing/verification strategy
65
+ tradeoff defense
66
+ interview communication
67
+ ```
68
+
69
+ Use the common L1-L6 levels, but record evidence per competency.
70
+
71
+ ## 4. Architecture lenses
72
+
73
+ Treat one system model as the basis for multiple views:
74
+
75
+ ```text
76
+ STRUCTURE components and dependencies
77
+ RUNTIME request/event path for a scenario
78
+ API contracts, boundaries, callers, downstreams
79
+ DATA stateful components and data movement
80
+ SCALE load assumptions and bottleneck questions
81
+ FAILURE failure domains and propagation hypotheses
82
+ CONSISTENCY places state may disagree or ordering/idempotency matters
83
+ PERFORMANCE latency budgets, fan-out, saturation, timeout/retry behavior
84
+ OBSERVABILITY metrics/logs/traces/SLO evidence and gaps
85
+ SECURITY trust boundaries, authn/authz, secrets/PII exposure, abuse controls
86
+ MESSAGING producers/consumers, delivery semantics, ordering, retries, DLQ
87
+ DEPLOYMENT processes/containers/nodes/environments and rollout concerns
88
+ TESTING verification boundaries and untested risk
89
+ CHANGES architecture impact of the current/recent work item
90
+ EVOLUTION what complexity becomes justified as constraints change
91
+ ```
92
+
93
+ If evidence for a lens is absent, show the gap instead of inventing detail.
94
+
95
+ ## 5. Interactive workbench
96
+
97
+ When `tools/project-forge-system-lab/system-workbench.py` exists, prefer it for a current project snapshot.
98
+
99
+ The tool is read-only and dependency-free. It:
100
+
101
+ - scans current repository evidence for application/service/frontend/library/datastore/cache/messaging/external/deployment/test signals;
102
+ - records provenance for inferred components and dependencies;
103
+ - generates a stable evidence fingerprint and current Git commit when available;
104
+ - automatically compares with the prior disposable snapshot in the selected output directory;
105
+ - accepts optional explicit model JSON for richer known architecture, scenarios, failure behavior, decisions, SLOs, and metadata;
106
+ - accepts changed-file paths so a delivered work item can be overlaid on the architecture;
107
+ - creates self-contained `index.html` plus `workbench.json`;
108
+ - supports draggable nodes, search, zoom, clickable nodes/edges, scenario highlighting, lens switching, change overlays, failure exploration, capacity calculations, latency budgets, scale/evolution prompts, design drills, and interview perturbations.
109
+
110
+ Generate into a stable per-repository temp/cache directory so the prior disposable snapshot can be used for change comparison. Do not commit generated output unless explicitly requested.
111
+
112
+ ## 6. Scenario-to-architecture tracing
113
+
114
+ For a scenario such as checkout, authentication, background processing, or notification:
115
+
116
+ ```text
117
+ entry point
118
+ → participating components
119
+ → synchronous calls
120
+ → state reads/writes
121
+ → asynchronous messages
122
+ → external dependencies
123
+ → user-visible/result state
124
+ ```
125
+
126
+ Highlight only evidence-backed participants. If the sequence is inferred from topology rather than captured runtime evidence, say so.
127
+
128
+ Ask the learner to explain the path before filling gaps when that improves learning.
129
+
130
+ ## 7. Prediction before reveal
131
+
132
+ For advanced learning, default to making the human predict before revealing the explanation when practical.
133
+
134
+ Examples:
135
+
136
+ ```text
137
+ What fails if this dependency times out?
138
+ Which component becomes the bottleneck at 10x traffic?
139
+ Where can duplicate delivery cause damage?
140
+ Which signal would distinguish database latency from downstream latency?
141
+ What consistency guarantee does the requirement actually need?
142
+ ```
143
+
144
+ Do not turn every interaction into a quiz. Explanation-first remains valid when explicitly requested.
145
+
146
+ ## 8. Failure and debugging mode
147
+
148
+ Failure mode should distinguish verified behavior from topological hypotheses.
149
+
150
+ ```text
151
+ symptom/failure injection
152
+ → learner predicts impact
153
+ → identify failure boundary
154
+ → likely propagation
155
+ → distinguishing telemetry/evidence
156
+ → resilience behavior
157
+ → user-visible effect
158
+ → prevention/design alternatives
159
+ ```
160
+
161
+ Useful perturbations include database/cache/queue/dependency unavailability, slow dependency, duplicate/delayed/out-of-order messages, retry amplification, queue backlog, regional failure, network partition, bad deployment, and traffic spikes.
162
+
163
+ For `/system-lab debug`, reveal evidence incrementally and ask what evidence the learner would inspect next. Do not implement the fix in learning mode.
164
+
165
+ ## 9. Capacity and performance mode
166
+
167
+ Use explicit learner/design assumptions, not invented production numbers.
168
+
169
+ Connect:
170
+
171
+ ```text
172
+ DAU / active users
173
+ requests per user
174
+ peak multiplier
175
+ read/write mix
176
+ payload size
177
+ retention
178
+ fan-out
179
+ latency/SLO target
180
+ ```
181
+
182
+ with derived average/peak RPS, write RPS, bandwidth, storage growth, and latency-budget reasoning. Explain simplifying assumptions.
183
+
184
+ A scale slider or changed workload is a prompt to re-evaluate bottlenecks and complexity; it is not proof that a specific technology is required.
185
+
186
+ ## 10. Distributed-systems and messaging mode
187
+
188
+ Practice:
189
+
190
+ - strong/eventual/read-after-write consistency;
191
+ - optimistic concurrency and conflict handling;
192
+ - idempotency and deduplication;
193
+ - at-least-once delivery and the limits of "exactly once" claims;
194
+ - ordering and partitioning;
195
+ - retry/backoff/DLQ behavior;
196
+ - outbox/inbox patterns;
197
+ - sagas/compensation;
198
+ - distributed locks only when justified.
199
+
200
+ Use timelines when helpful. Make the learner reason about state before and after duplicate, delayed, failed, or reordered events.
201
+
202
+ ## 11. API, security, observability, testing, and deployment lenses
203
+
204
+ API:
205
+ - contract shape, validation, versioning, auth, errors, pagination, idempotency, downstream coupling.
206
+
207
+ Security:
208
+ - trust boundaries, public exposure, authentication, authorization, secret handling, PII/data classification, replay/abuse/rate limiting.
209
+
210
+ Observability:
211
+ - logs, metrics, traces, SLOs, correlation, dependency health, saturation/queue depth, evidence gaps.
212
+
213
+ Testing:
214
+ - unit/integration/contract/e2e boundaries, failure-path coverage, architecture risks not currently exercised.
215
+
216
+ Deployment:
217
+ - artifact/process/container topology, environment/config boundaries, health/readiness, scaling, rollout/rollback, region/failure-domain assumptions.
218
+
219
+ Treat missing evidence as a learning question, not a defect by itself.
220
+
221
+ ## 12. Architecture evolution and counterfactuals
222
+
223
+ Use the current system as the baseline and explore changes such as:
224
+
225
+ ```text
226
+ remove the cache
227
+ make a synchronous path asynchronous
228
+ increase traffic 10x/100x
229
+ move from SQLite to a server database
230
+ introduce multi-region requirements
231
+ split or recombine a service
232
+ add a queue/search/object store/CDN
233
+ tighten latency/availability/privacy requirements
234
+ ```
235
+
236
+ For each evolution:
237
+
238
+ ```text
239
+ problem/evidence
240
+ → change
241
+ → expected benefit
242
+ → new complexity/failure modes
243
+ → migration path
244
+ → when NOT to do it
245
+ ```
246
+
247
+ Prefer evolutionary design over cargo-cult complexity.
248
+
249
+ ## 13. Tradeoff and "why not?" drills
250
+
251
+ Challenge choices with credible alternatives:
252
+
253
+ ```text
254
+ Why not a monolith?
255
+ Why not microservices?
256
+ Why not Kafka/a queue?
257
+ Why not synchronous HTTP?
258
+ Why not cache this?
259
+ Why not shard now?
260
+ Why not retry here?
261
+ Why not use the existing relational database?
262
+ ```
263
+
264
+ The goal is to defend the simplest design that satisfies current constraints, then adapt when constraints materially change.
265
+
266
+ ## 14. Architecture decisions
267
+
268
+ When ADRs or documented decisions exist, connect diagram components/edges to them. For each major choice discuss:
269
+
270
+ ```text
271
+ context
272
+ chosen decision
273
+ alternatives
274
+ tradeoffs
275
+ consequences
276
+ revisit trigger
277
+ ```
278
+
279
+ Do not silently create durable ADRs in learning mode.
280
+
281
+ ## 15. Change-focused learning
282
+
283
+ `/system-lab changes <work-item>` should focus on the accepted/delivered change set when evidence is available.
284
+
285
+ Show:
286
+
287
+ - added/removed/changed components and dependencies;
288
+ - affected runtime/data/message paths;
289
+ - newly introduced or materially changed failure modes;
290
+ - new security/observability/performance/testing questions;
291
+ - architecture decisions or assumptions worth explaining.
292
+
293
+ A changed file is evidence that a component was touched, not proof that its runtime behavior changed. Keep that distinction visible.
294
+
295
+ ## 16. Interview mode
296
+
297
+ Make the human drive:
298
+
299
+ ```text
300
+ requirements
301
+ → constraints + scale assumptions
302
+ → API/contracts
303
+ → data/storage
304
+ → high-level architecture
305
+ → deep dive
306
+ → bottleneck/failure analysis
307
+ → consistency/reliability
308
+ → security/observability
309
+ → evolution
310
+ → tradeoff defense
311
+ ```
312
+
313
+ Perturb one material constraint at a time: 20x traffic, multi-region, strict data residency, unreliable dependency, tighter p99, zero-downtime migration, duplicate delivery, cost pressure, or new abuse threat.
314
+
315
+ Score/coach the independent system-design competencies rather than assigning one generic score.
316
+
317
+ ## 17. Cross-lab navigation
318
+
319
+ System Lab owns system context; Database Lab owns schema/query/ORM/plan depth.
320
+
321
+ When a system node represents a database, explicitly offer `/db-lab` for deeper relational/query evidence. When `/db-lab` reaches system-level concerns such as service boundaries, traffic, availability, or end-to-end runtime flow, offer `/system-lab`.
322
+
323
+ Do not duplicate database internals inside System Lab or architecture reasoning inside Database Lab.
324
+
325
+ ## 18. Delivery-completion visibility
326
+
327
+ After successful delivery, Project Forge may recommend the labs as optional learning while the change is fresh.
328
+
329
+ - If database-related evidence changed, make `/db-lab` or `/db-lab changes <work-item>` visibly recommended.
330
+ - If architecture/runtime/API/messaging/deployment/security/observability behavior changed, make `/system-lab` or `/system-lab changes <work-item>` visibly recommended.
331
+ - If neither is especially relevant, the labs may remain visible as available options without claiming the ticket changed them.
332
+ - Never use user-facing wording such as "rebuild the diagram" or "refresh the database model". Running a lab already means inspect current evidence and generate the current view.
333
+ - Best-effort disposable artifact generation after delivery is allowed when safe and cheap, but failure to generate a learning artifact never changes delivery state.
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: tear-down
3
+ description: "Guided destructive cleanup for local state, one exact repository-defined named environment, or all explicitly configured POC environments. Preserves ownership boundaries and resolved Production-data authorization."
4
+ argument-hint: "[local|<environment>|all]"
5
+ user-invocable: true
6
+ disable-model-invocation: true
7
+ ---
8
+
9
+ # Tear Down
10
+
11
+ `/tear-down` is the human-facing destructive cleanup workflow for repository-owned POC state.
12
+
13
+ Logical environment names are data-driven and are not limited to Staging/Production:
14
+
15
+ ```text
16
+ /tear-down demo
17
+ /tear-down qa
18
+ /tear-down staging
19
+ /tear-down prod-east
20
+ ```
21
+
22
+ The skill owns exact scope selection, read-only preflight, destructive preview, and Human-in-the-Loop authorization. Repository-provided deterministic tooling owns deletion mechanics.
23
+
24
+ ## 1. Resolve exact project topology
25
+
26
+ Prefer:
27
+
28
+ ```text
29
+ DEPLOYMENT_TOPOLOGY.json
30
+ ```
31
+
32
+ Use `PROJECT_BOOTSTRAP.json` deployment topology only as the initial topology fallback.
33
+
34
+ Resolve only configured logical environments and their current purpose/Production classification, placement/target binding, repository/application identity, and ownership evidence.
35
+
36
+ If `demo` is configured, `/tear-down demo` means exactly `demo`. If `prod-east` has purpose `production`, it remains Production-class regardless of its literal name.
37
+
38
+ Never guess a similar environment and never widen scope after failure.
39
+
40
+ ## 2. Select exact destructive scope
41
+
42
+ ```text
43
+ local
44
+ <one exact repository-defined named environment>
45
+ all
46
+ ```
47
+
48
+ If no scope is named, present only scopes the repository actually supports; never silently default to a Production environment or `all`.
49
+
50
+ `all` means only all explicitly configured scopes for this POC; it never means machine-wide cleanup.
51
+
52
+ Selecting scope does not authorize deletion. Physical colocation never merges ownership: deleting `demo` must not remove `staging` or `prod-east` merely because they share hardware.
53
+
54
+ If the requested name is absent from project topology, stop. Do not substitute another environment.
55
+
56
+ ## 3. Resolve Production classification from the deletion set
57
+
58
+ For each selected environment identify:
59
+
60
+ ```text
61
+ environment name
62
+ purpose / Production classification
63
+ placement / target
64
+ repository/application identity
65
+ ownership markers required by installed tooling
66
+ ```
67
+
68
+ For current Deployment Kit consumers, custom Production names may be passed explicitly, for example:
69
+
70
+ ```text
71
+ --production-environment prod-east
72
+ ```
73
+
74
+ Use actual installed help/version evidence. If the installed tool cannot preserve a custom Production classification, stop rather than downgrading the destructive gate.
75
+
76
+ ## 4. Present an exact destructive preview
77
+
78
+ Show what will be removed and what will be preserved.
79
+
80
+ ```text
81
+ TEAR-DOWN READY
82
+
83
+ Scope: <local|demo|qa|staging|prod-east|all>
84
+ Repository/app: <verified identity>
85
+ Selected environments:
86
+ <name> → <placement/target> — <purpose/classification>
87
+
88
+ Will remove:
89
+ <only tool-owned resources for exact selected scopes>
90
+
91
+ Will preserve:
92
+ <shared/unrelated environment and platform resources>
93
+ ```
94
+
95
+ Do not promise deletion of named/shared Docker volumes unless the installed deterministic contract proves exact ownership and explicitly includes them. Do not promise deletion of any shared/unrelated resource whose ownership cannot be proven.
96
+
97
+ ## 5. Authorization gates
98
+
99
+ Every modifying tear-down requires the installed normal authorization, conceptually:
100
+
101
+ ```text
102
+ [POC TEAR DOWN]
103
+ ```
104
+
105
+ whenever **any selected environment is Production-class**, require the stronger Production-data deletion authorization, conceptually:
106
+
107
+ ```text
108
+ [PRODUCTION DATA DELETE]
109
+ ```
110
+
111
+ Resolve exact phrases from the installed tool/version. Do not tie the Production-data gate only to literal scope strings such as `production` or `all`; it depends on the actual resolved deletion set.
112
+
113
+ A prior `/setup`, environment proof, `/deploy`, merge, CI, or other approval never authorizes destructive cleanup.
114
+
115
+ If identity, selected environment set, classification, binding, ownership evidence, or deletion set changes after preview, require renewed review/authorization.
116
+
117
+ ## 6. Execute only repository-provided deterministic cleanup
118
+
119
+ After authorization, invoke only the approved tear-down command with exact named scopes/bindings. Do not improvise shell commands.
120
+
121
+ For a generalized current Deployment Kit invocation, exact bindings may look conceptually like:
122
+
123
+ ```text
124
+ --environment-target demo=<target>
125
+ --environment-target staging=<target>
126
+ --environment-target prod-east=<target>
127
+ --production-environment prod-east
128
+ ```
129
+
130
+ Use the installed contract rather than inventing flags for older versions.
131
+
132
+ Never add machine-wide Docker prune, shared platform/network removal, unrelated environment cleanup, host reprovisioning, target rebinding, credential/trust deletion, or registry-package deletion unless a separate lifecycle operation explicitly owns and authorizes it.
133
+
134
+ If aggregate `all` cleanup stops partway, report completed and remaining scopes. Do not manually compensate by deleting the rest.
135
+
136
+ ## 7. Verify and report outcome
137
+
138
+ Use repository-provided status/evidence commands when available. Report only observed evidence: requested scope, exact environment names/targets processed, Production-class environments included, local state processed, removed versus already-absent resources, and any remaining scopes after a partial stop.
139
+
140
+ When the installed deterministic contract is idempotent, already-absent owned resources should remain safe to re-check/re-run without broadening scope.
@@ -0,0 +1,221 @@
1
+ ---
2
+ name: upstream-fix
3
+ description: Route reusable bugs discovered in a consumer to the canonical shared repository, allow bounded upstream implementation, and return adoption through the consumer's actual provenance/update boundary.
4
+ argument-hint: "[optional problem summary]"
5
+ user-invocable: true
6
+ disable-model-invocation: true
7
+ ---
8
+
9
+ # Upstream Fix
10
+
11
+ `/upstream-fix` is for a problem discovered while working in a consumer repository when the likely owner is shared Project Forge code rather than consumer product code.
12
+
13
+ The governing rule is:
14
+
15
+ ```text
16
+ discover in consumer
17
+ → diagnose/prove in consumer
18
+ → fix in owning canonical repository
19
+ → deliver there
20
+ → adopt through the consumer's recorded distribution boundary
21
+ → verify again in consumer
22
+ ```
23
+
24
+ A temporary edit to a shared-managed file inside a consumer may be useful as diagnosis/proof, but it is never the canonical delivered fix.
25
+
26
+ ## 1. Invocation authorization
27
+
28
+ Invoking `/upstream-fix` authorizes:
29
+
30
+ - read-only ownership/provenance inspection in the consumer;
31
+ - classification to the smallest canonical owner;
32
+ - inspection of already-available local canonical repository candidates;
33
+ - when ownership and the bounded patch are clear and a canonical checkout is safe, routine creation/use of one short-lived canonical work branch and application of only that bounded fix plus focused tests/docs.
34
+
35
+ Invocation does **not** authorize commit, push, PR creation, merge, release publication, package publication, deployment, rewriting/discarding consumer work, or changing multiple canonical repositories in one bounded fix.
36
+
37
+ Normal review and `/deliver` occur later while focused on the owning canonical repository.
38
+
39
+ ## 2. Establish consumer provenance
40
+
41
+ From the consumer root inspect, when present:
42
+
43
+ - `PROJECT_FORGE_BASELINE.json`;
44
+ - `CORE_BASELINE.json`;
45
+ - `DEPLOYMENT_BASELINE.json`;
46
+ - `.github/project-forge-workspace.json`;
47
+ - current Git branch/status/diff;
48
+ - the files involved in the reported problem or temporary proof.
49
+
50
+ Run repository-local managed-baseline checks when available.
51
+
52
+ Do not assume every generated-looking file is shared-owned. Use baseline managed-path records as the primary ownership evidence, and use `PROJECT_FORGE_BASELINE.json` to determine whether component baselines are managed together by an umbrella package.
53
+
54
+ ## 3. Classify the owner
55
+
56
+ Use the smallest owning layer that would need the same fix for another consumer.
57
+
58
+ ### Consumer-owned
59
+
60
+ Application domain logic, UI behavior, app-specific configuration, product tests, and consumer architecture normally remain consumer-owned.
61
+
62
+ Result:
63
+
64
+ ```text
65
+ CONSUMER FIX
66
+ Owner: current repository
67
+ ```
68
+
69
+ Return to the consumer's normal `/start-work` / implementation / review / `/deliver` flow.
70
+
71
+ ### Core-owned
72
+
73
+ Evidence includes a path managed by `CORE_BASELINE.json` or behavior defined by reusable Core workflow assets.
74
+
75
+ ```text
76
+ CORE BUG
77
+ Owner: <repository recorded by CORE_BASELINE.json>
78
+ ```
79
+
80
+ ### Deployment-Kit-owned
81
+
82
+ Evidence includes a path managed by `DEPLOYMENT_BASELINE.json` or reusable deployment mechanics owned by that recorded Kit.
83
+
84
+ ```text
85
+ DEPLOYMENT BUG
86
+ Owner: <repository recorded by DEPLOYMENT_BASELINE.json>
87
+ ```
88
+
89
+ ### Package assembly / Project Forge Platform-owned
90
+
91
+ When canonical component source is correct but the published package bytes, component pins, package engine, or umbrella baseline behavior is wrong:
92
+
93
+ ```text
94
+ PROJECT FORGE PLATFORM BUG
95
+ Owner: package/platform repository supported by evidence
96
+ ```
97
+
98
+ ### Generator/control-plane owned
99
+
100
+ If the package payload is correct but generation/publication/orchestration materializes it incorrectly, classify Bootstrap/control-plane ownership from evidence rather than patching a generated consumer.
101
+
102
+ If ownership is genuinely ambiguous, stop at `UPSTREAM OWNER UNCLEAR`. Do not write to multiple repositories speculatively.
103
+
104
+ ## 4. Temporary consumer proof
105
+
106
+ A temporary consumer edit to a shared-managed path is allowed for diagnosis when it proves the fix in real application context.
107
+
108
+ Report it explicitly:
109
+
110
+ ```text
111
+ TEMPORARY SHARED-MANAGED PROOF
112
+ Consumer path: <path>
113
+ Canonical owner: <repo>
114
+ Do not deliver this consumer copy.
115
+ ```
116
+
117
+ Do not silently discard the proof and do not stage/commit it as ordinary consumer implementation.
118
+
119
+ ## 5. Resolve a safe canonical checkout
120
+
121
+ For the classified owner consider, in order:
122
+
123
+ 1. an explicit path supplied by the human;
124
+ 2. an already-open workspace folder with the expected Git remote;
125
+ 3. a normal sibling checkout derived from the canonical repository name.
126
+
127
+ Do not broadly scan the filesystem and do not clone automatically merely to continue.
128
+
129
+ A candidate is safe only when it is the expected repository, has no merge/rebase/cherry-pick in progress, has no unrelated local work, and does not require stash/reset/rebase/force/discard operations.
130
+
131
+ ## 6. Port the bounded fix upstream
132
+
133
+ When a safe canonical checkout exists and the equivalent reusable fix is clear:
134
+
135
+ 1. inspect canonical implementation/tests before editing;
136
+ 2. create/use one repository-appropriate short-lived branch;
137
+ 3. reproduce the root cause canonically where practical;
138
+ 4. apply the reusable fix without consumer-specific names/configuration;
139
+ 5. add/update focused tests that would have caught the defect;
140
+ 6. update canonical docs when the contract changed;
141
+ 7. run relevant local checks;
142
+ 8. show the meaningful canonical diff and observed validation.
143
+
144
+ If the consumer proof cannot be generalized safely, stop and reclassify rather than forcing it upstream.
145
+
146
+ ## 7. Handoff to canonical delivery
147
+
148
+ When the upstream implementation is ready:
149
+
150
+ ```text
151
+ UPSTREAM FIX READY
152
+
153
+ Owner: <canonical repo>
154
+ Branch: <branch>
155
+ Consumer proof: <path/status>
156
+ Validation: <observed checks>
157
+ Next: focus the canonical repository and run /deliver
158
+ ```
159
+
160
+ `/upstream-fix` does not commit/push/open/merge the canonical PR itself.
161
+
162
+ ## 8. Adopt the accepted fix through the right boundary
163
+
164
+ After the canonical PR is merged and required default-branch CI is green, re-read the consumer provenance before choosing adoption.
165
+
166
+ ### Package-managed consumer (`PROJECT_FORGE_BASELINE.json` present)
167
+
168
+ Do **not** direct-sync Core or Deployment Kit into the consumer.
169
+
170
+ The accepted component fix must first become part of an accepted published Project Forge package:
171
+
172
+ ```text
173
+ canonical Core/Deployment fix merged
174
+ → Project Forge Platform pins the exact accepted component commit
175
+ → Project Forge Platform PR + CI
176
+ → explicit package publication gate
177
+ → published exact @mriekki/project-forge version
178
+ → consumer /project-forge-update <version>
179
+ ```
180
+
181
+ Until that package exists, report:
182
+
183
+ ```text
184
+ PACKAGE RELEASE REQUIRED
185
+ Consumer adoption is blocked on a Project Forge package that contains the accepted upstream commit.
186
+ ```
187
+
188
+ Do not silently patch `PROJECT_FORGE_BASELINE.json`, `CORE_BASELINE.json`, or `DEPLOYMENT_BASELINE.json` to pretend the package contains the new component.
189
+
190
+ ### Component-only Core consumer (`PROJECT_FORGE_BASELINE.json` absent)
191
+
192
+ A Core-owned fix may return through `/core-sync` using the exact accepted Core commit/distribution.
193
+
194
+ ### Component-only Deployment consumer (`PROJECT_FORGE_BASELINE.json` absent)
195
+
196
+ A Deployment-owned fix may return through the canonical Deployment Kit component sync and refresh `DEPLOYMENT_BASELINE.json`.
197
+
198
+ ### Generator/control-plane fix
199
+
200
+ Validate through that platform's canonical regeneration/update path, never by manually editing generated managed files.
201
+
202
+ Then rerun the original reproduction and baseline checks in the consumer.
203
+
204
+ ## 9. Consumer delivery guard
205
+
206
+ If `/deliver` is invoked in a consumer with unexplained Core-, Deployment-, or Project Forge-package-managed drift, stop before staging/commit/push. Route reusable managed-file changes through `/upstream-fix` and then through the appropriate accepted update boundary.
207
+
208
+ Consumer-owned changes may be delivered normally when managed baselines are clean.
209
+
210
+ ## 10. Boundaries
211
+
212
+ `/upstream-fix` never:
213
+
214
+ - merges changes;
215
+ - publishes releases/tags/packages;
216
+ - deploys production;
217
+ - commits one bounded fix across multiple repositories;
218
+ - auto-stashes, resets, rebases, force-pushes, or discards work;
219
+ - requires ordinary consumer users to clone shared repositories;
220
+ - treats a temporary managed consumer edit as a permanent fork;
221
+ - bypasses `PROJECT_FORGE_BASELINE.json` with component-only sync.