@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,178 @@
1
+ ---
2
+ name: core-sync
3
+ description: Direct Core-to-consumer synchronization for component-only consumers; package-managed consumers are routed to /project-forge-update so umbrella and component baselines remain coherent.
4
+ argument-hint: "[optional local Core path]"
5
+ user-invocable: true
6
+ disable-model-invocation: true
7
+ ---
8
+
9
+ # Core Sync
10
+
11
+ `/core-sync` is the direct component synchronization path for consumers that are managed directly by `CORE_BASELINE.json` **without** an umbrella `PROJECT_FORGE_BASELINE.json`.
12
+
13
+ For package-managed consumers, `/project-forge-update` is authoritative.
14
+
15
+ Invocation starts read-only. Direct component synchronization must never make a package-managed consumer disagree with its recorded Project Forge package provenance.
16
+
17
+ ## 1. Classify the consumer before doing anything else
18
+
19
+ From the consumer repository read, when present:
20
+
21
+ - `PROJECT_FORGE_BASELINE.json`;
22
+ - `CORE_BASELINE.json`;
23
+ - `.github/project-forge-workspace.json`;
24
+ - `.github/project-forge-core-sync.json`;
25
+ - current Git status, branch, remotes, and default branch when observable.
26
+
27
+ ### Package-managed consumer
28
+
29
+ If `PROJECT_FORGE_BASELINE.json` exists:
30
+
31
+ ```text
32
+ PACKAGE-MANAGED PROJECT FORGE CONSUMER
33
+ Direct Core sync: NOT PERMITTED
34
+ Next: /project-forge-update
35
+ ```
36
+
37
+ Stop before refreshing a Core checkout, running `tools/package/sync.py`, creating a sync branch, or sending a remote `[sync-core]` request.
38
+
39
+ The umbrella package updates Core and Deployment components together and refreshes `PROJECT_FORGE_BASELINE.json`, `CORE_BASELINE.json`, and `DEPLOYMENT_BASELINE.json` coherently. A Core-only sync would bypass that contract.
40
+
41
+ ### Component-only Core consumer
42
+
43
+ If `PROJECT_FORGE_BASELINE.json` is absent and a valid `CORE_BASELINE.json` exists, continue with the component-managed path below.
44
+
45
+ If neither baseline exists, report `CORE SYNC BLOCKED`; do not invent provenance or initialize a consumer implicitly.
46
+
47
+ ## 2. Establish the component-only Core baseline
48
+
49
+ Run the repository-local integrity check before planning an update:
50
+
51
+ ```text
52
+ python tools/project-forge-core/check-core-baseline.py --root .
53
+ ```
54
+
55
+ Stop if the managed overlay has unexplained local drift, missing managed files, or invalid baseline metadata.
56
+
57
+ Resolve from `CORE_BASELINE.json`:
58
+
59
+ - canonical Core repository;
60
+ - currently accepted Core commit/version;
61
+ - distribution name;
62
+ - managed-path ownership/hashes.
63
+
64
+ ## 3. Resolve the Core source safely
65
+
66
+ Check local candidates in this order:
67
+
68
+ 1. an explicit Core path supplied by the human;
69
+ 2. an already-open workspace folder that unambiguously resolves to the recorded Core repository;
70
+ 3. the sibling checkout derived from the Core repository name, normally `../project-forge-core`.
71
+
72
+ Do not broadly scan the filesystem. A local Core checkout is an optimization, not a prerequisite.
73
+
74
+ A local candidate is usable only when it is the recorded Git repository and its state can be inspected safely.
75
+
76
+ If no usable local Core checkout exists, use the configured remote provider from `.github/project-forge-core-sync.json` when available. Do not ask the developer to clone Core merely to satisfy `/core-sync`.
77
+
78
+ ## 4. Classify a local Core checkout
79
+
80
+ Before modifying a local Core checkout inspect:
81
+
82
+ ```text
83
+ git -C <core-path> status --short --branch
84
+ git -C <core-path> branch --show-current
85
+ git -C <core-path> remote -v
86
+ git -C <core-path> branch -vv
87
+ ```
88
+
89
+ It may be refreshed automatically only when clean, on its normal accepted/default branch, backed by an unambiguous upstream, and fast-forward-safe.
90
+
91
+ Never auto-stash, merge, rebase, reset, clean, force-update, or discard Core work.
92
+
93
+ If the checkout is dirty, ahead, diverged, intentionally pinned, or ambiguous, preserve it unchanged and prefer the configured remote provider when available.
94
+
95
+ ## 5. Present one bounded component-sync choice
96
+
97
+ For a safe local source:
98
+
99
+ ```text
100
+ CORE SYNC READY
101
+
102
+ Consumer baseline: <commit/version>
103
+ Source: LOCAL <core-path>
104
+ Distribution: <distribution>
105
+
106
+ 1. Sync the component-only Core baseline [GIT + FILE WRITE] — recommended
107
+ 2. Keep inspecting only [READ ONLY]
108
+ 3. Stop [NO ACTION]
109
+ ```
110
+
111
+ For a configured remote source:
112
+
113
+ ```text
114
+ CORE SYNC READY
115
+
116
+ Consumer baseline: <commit/version>
117
+ Source: REMOTE PROVIDER
118
+ Provider: <provider repository>
119
+
120
+ 1. Request remote Core sync [REMOTE WRITE] — recommended
121
+ 2. Keep inspecting only [READ ONLY]
122
+ 3. Stop [NO ACTION]
123
+ ```
124
+
125
+ The selected choice does not authorize merge, release publication, or deployment.
126
+
127
+ ## 6. Local component path
128
+
129
+ After local option 1 is selected:
130
+
131
+ 1. Refresh Core remote state.
132
+ 2. Reclassify the accepted/default Core branch.
133
+ 3. Fast-forward it only when safe.
134
+ 4. Run canonical Core sync preview using the distribution recorded by the baseline.
135
+ 5. Stop on `LOCAL_DRIFT`, `CONFLICT`, `LOCAL_MISSING`, `UNTRACKED_CONFLICT`, or an unaccepted `RETIRED_PATH`.
136
+ 6. If the consumer is on its default branch, create/switch to a short-lived branch such as `chore/sync-core-<version-or-short-sha>`.
137
+ 7. Apply only safe Core additions/updates and refresh `CORE_BASELINE.json` using canonical `tools/package/sync.py`.
138
+
139
+ Do not manually copy managed files as a substitute for the canonical tool.
140
+
141
+ ## 7. Remote component path
142
+
143
+ Remote orchestration is consumer configuration. Read `.github/project-forge-core-sync.json` and require its configured provider contract, for example `github-issue-control-plane` with an owner/repository title template and an empty body.
144
+
145
+ Create exactly the configured request. Do not put product requirements, baseline JSON, source code, secrets, or other private consumer details into a public request.
146
+
147
+ The provider is expected to validate target authorization, obtain its own short-lived credentials, run canonical Core sync, refuse unsafe drift/conflicts, publish a short-lived consumer branch/PR, and observe consumer CI.
148
+
149
+ If the provider cannot satisfy that contract, report `REMOTE SYNC UNAVAILABLE`; do not silently clone Core or invent another synchronization mechanism.
150
+
151
+ ## 8. Verification
152
+
153
+ For a local apply run:
154
+
155
+ ```text
156
+ python tools/project-forge-core/check-core-baseline.py --root .
157
+ git status --short --branch
158
+ git diff --stat
159
+ git diff -- CORE_BASELINE.json
160
+ ```
161
+
162
+ Confirm exact Core provenance, managed hashes, consumer-owned preservation, and intended branch scope. Present the meaningful diff and recommend `/deliver` after human acceptance.
163
+
164
+ For a remote path, report the resulting PR and exact Core commit when observed. Merge remains the normal explicit final gate.
165
+
166
+ ## 9. Boundaries
167
+
168
+ `/core-sync` never:
169
+
170
+ - directly synchronizes Core when `PROJECT_FORGE_BASELINE.json` exists;
171
+ - uses direct Core sync as a substitute for `/project-forge-update`;
172
+ - modifies ambiguous local Core state;
173
+ - treats managed consumer drift as disposable;
174
+ - publishes Core or Project Forge package releases/tags;
175
+ - merges the consumer sync PR;
176
+ - deploys production.
177
+
178
+ If reusable Core behavior itself is wrong, fix Core canonically through `/upstream-fix`; then adopt it through the update channel appropriate to the consumer's provenance model.
@@ -0,0 +1,245 @@
1
+ ---
2
+ name: db-lab
3
+ description: "Optional project-aware database learning lab using actual schema, ORM, migration, query, and query-plan evidence for SQL, relational design, debugging, change exploration, and interview practice."
4
+ argument-hint: "[schema|changes|trace|plan|debug|migration|interview|topic] [work-item] [light|focused|deep]"
5
+ user-invocable: true
6
+ disable-model-invocation: true
7
+ ---
8
+
9
+ # Database Lab
10
+
11
+ `/db-lab` is an optional hands-on database learning surface. It complements `/coach`; it does not replace the engineering workflow or authorize implementation changes.
12
+
13
+ For detailed usage and examples, read `docs/process/DATABASE_LEARNING_WORKBENCH.md` in a greenfield consumer (or the canonical `core/process/DATABASE_LEARNING_WORKBENCH.md`).
14
+
15
+ ## 1. Boundaries
16
+
17
+ - Start from the **current** repository and its documented development/test database configuration.
18
+ - Re-discover relevant database evidence whenever the lab is invoked. Running `/db-lab` means inspect current evidence and show the current view; do not make the human remember to refresh/rebuild an ERD.
19
+ - Prefer read-only inspection. Do not mutate application data, apply migrations, add/drop indexes, or change production code while in Database Lab mode.
20
+ - Never inspect Production credentials or Production data.
21
+ - Do not invent schema, SQL, query-plan behavior, ORM translation, or index usage. Distinguish inferred behavior from captured evidence.
22
+ - If safe local database/runtime evidence is unavailable, fall back to repository artifacts and say what could not be verified.
23
+ - Generated learning artifacts are disposable projections of current evidence. Generate in temp/cache output and do not commit them unless explicitly requested.
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. Database competencies
28
+
29
+ Use the common L1-L6 learning levels across independent database areas:
30
+
31
+ ```text
32
+ relational modeling
33
+ keys + integrity constraints
34
+ normalization + data anomalies
35
+ SQL query construction
36
+ indexes + access patterns
37
+ query plans + performance reasoning
38
+ transactions + concurrency
39
+ ORM translation + abstraction leaks
40
+ schema evolution + migrations
41
+ database debugging
42
+ design defense + interview communication
43
+ ```
44
+
45
+ Do not collapse these into one generic "SQL level". A developer may be strong in query syntax and weak in relational design, indexing, transactions, or ORM translation.
46
+
47
+ ## 3. Schema mode
48
+
49
+ Build an evidence-backed current view from the best available sources:
50
+
51
+ ```text
52
+ physical database metadata
53
+ ORM model/configuration
54
+ migration history
55
+ schema SQL / DDL
56
+ project architecture and requirements
57
+ ```
58
+
59
+ Show tables/entities, columns, types, nullability, primary keys, foreign keys, unique/check constraints, indexes, relationship cardinality, cascade behavior, and relevant ORM mappings when evidence exists.
60
+
61
+ When useful, distinguish:
62
+
63
+ ```text
64
+ DOMAIN MODEL — what the application/domain expresses
65
+ ORM MODEL — what the ORM maps and tracks
66
+ PHYSICAL MODEL — what the relational database actually stores/enforces
67
+ ```
68
+
69
+ ## 4. Change-focused mode
70
+
71
+ `/db-lab changes <work-item>` should focus on the accepted/delivered change set when evidence is available.
72
+
73
+ Show relevant changes to:
74
+
75
+ - entities/tables and columns;
76
+ - keys, constraints, relationships and cascade behavior;
77
+ - indexes/access paths;
78
+ - ORM mappings and generated SQL behavior;
79
+ - migrations/schema evolution;
80
+ - affected query paths;
81
+ - transaction/concurrency assumptions.
82
+
83
+ Connect each material change to the learning implication. A changed ORM/model file is evidence that persistence code was touched, not proof that the physical database changed; verify against migrations/schema/database evidence.
84
+
85
+ When a previous disposable workbench snapshot exists, it may be used as a comparison aid. The current database/repository evidence remains authoritative.
86
+
87
+ ## 5. Query trace mode
88
+
89
+ Trace a real application query without guessing:
90
+
91
+ ```text
92
+ application/ORM expression
93
+ → ORM translation preview when available
94
+ → actual executed SQL when captured
95
+ → parameters
96
+ → tables/relationships touched
97
+ → query plan when available
98
+ → indexes actually chosen by the planner
99
+ → materialized/application result
100
+ ```
101
+
102
+ Keep translation preview and actual executed command distinct when the framework exposes both.
103
+
104
+ ## 6. Query-to-ERD highlighting
105
+
106
+ When the distributed SQLite workbench or another compatible viewer is available, a selected query should drive a linked ERD view:
107
+
108
+ - highlight tables referenced by the SQL;
109
+ - highlight FK edges when both related tables participate in the selected query;
110
+ - highlight qualified query columns when they can be resolved to a table;
111
+ - distinguish candidate indexes from indexes actually selected by the query planner;
112
+ - show query-plan evidence alongside the diagram;
113
+ - allow table/column/index selection for deeper explanation.
114
+
115
+ Never claim the planner used an index merely because it exists or looks relevant.
116
+
117
+ If no interactive viewer is available, provide a temporary Mermaid/text diagram using the same evidence and clearly label it as a fallback rather than a live ERD.
118
+
119
+ ## 7. SQLite workbench
120
+
121
+ When `tools/project-forge-db-lab/sqlite-workbench.py` exists and a safe local development/test SQLite database is known, prefer it for physical-schema and query-plan evidence.
122
+
123
+ The tool:
124
+
125
+ - opens the SQLite database in `mode=ro`;
126
+ - introspects tables/views, columns, primary keys, foreign keys, indexes, and DDL;
127
+ - accepts optional captured-query JSON containing `name`, `sql`, and optional `parameters`;
128
+ - uses `EXPLAIN QUERY PLAN` only for `SELECT`/`WITH` queries;
129
+ - generates self-contained `index.html` plus `workbench.json` learning artifacts;
130
+ - supports interactive table/index inspection and query-to-ERD highlighting.
131
+
132
+ Generate output in a stable per-repository disposable/temp location when practical. Running the lab should regenerate the current view; an already-open older browser tab is not authoritative.
133
+
134
+ The workbench analyzes captured SQL; it does not itself capture Entity Framework commands. Obtain translation/execution evidence through supported framework mechanisms first, then pass the captured SQL into the workbench when useful.
135
+
136
+ ## 8. Query-plan/performance mode
137
+
138
+ Use provider-native plan evidence where safely available. Ask the developer to predict likely scans/searches/joins/index behavior before revealing the plan when that improves learning.
139
+
140
+ ```text
141
+ query/access pattern
142
+ → developer prediction
143
+ → plan evidence
144
+ → explain scan/search/join behavior
145
+ → developer proposes index/query change
146
+ → predict changed plan
147
+ → compare evidence in a safe sandbox when available
148
+ ```
149
+
150
+ Do not teach "add an index" without connecting it to a concrete access pattern, selectivity/order needs, write cost, and plan evidence.
151
+
152
+ ## 9. Debug mode
153
+
154
+ ```text
155
+ symptom
156
+ → database hypotheses
157
+ → distinguishing evidence
158
+ → SQL / parameters
159
+ → plan / constraints / transaction state
160
+ → root cause
161
+ → fix concept
162
+ → prevention
163
+ ```
164
+
165
+ The human should diagnose before the lab reveals the answer unless they explicitly request explanation-first coaching.
166
+
167
+ ## 10. Migration mode
168
+
169
+ Connect:
170
+
171
+ ```text
172
+ ORM migration/change
173
+ ↔ generated DDL/SQL when available
174
+ ↔ schema before
175
+ ↔ schema after
176
+ ↔ data-safety implications
177
+ ```
178
+
179
+ Ask the developer to predict effects before showing generated SQL when useful. Discuss destructive changes, nullability transitions, backfills, constraint creation, and rollback limitations without applying migrations in learning mode.
180
+
181
+ ## 11. Interview/design mode
182
+
183
+ Use the active project domain as context, but perturb requirements so the developer must reason rather than reproduce the existing schema.
184
+
185
+ Drive one material question at a time through:
186
+
187
+ ```text
188
+ requirements clarification
189
+ → entities
190
+ → relationships/cardinality
191
+ → keys
192
+ → constraints
193
+ → normalization
194
+ → access patterns
195
+ → indexes
196
+ → transactions/concurrency
197
+ → evolution/scaling
198
+ → design defense
199
+ ```
200
+
201
+ Challenge unsupported choices. Ask why a junction table exists, why a key was selected, what deletion means historically, which queries justify an index, and how changed requirements alter the design.
202
+
203
+ ## 12. ORM-specific evidence
204
+
205
+ When Entity Framework Core is present, distinguish:
206
+
207
+ - LINQ/application expression;
208
+ - translation preview such as `ToQueryString()` when appropriate;
209
+ - actual executed `DbCommand` from supported logging/interception evidence;
210
+ - generated migration SQL;
211
+ - entity/change-tracking state versus physical SQL operations.
212
+
213
+ Do not present a translation preview as proof of the exact command that executed.
214
+
215
+ For other ORMs, apply the same principle using framework-supported evidence instead of guessing.
216
+
217
+ ## 13. Cross-lab navigation
218
+
219
+ Database Lab owns database depth; System Lab owns end-to-end system context.
220
+
221
+ When database exploration reaches service boundaries, request/event flow, traffic, availability, security, deployment, or system-wide failure behavior, offer `/system-lab` when installed.
222
+
223
+ When `/system-lab` reaches a database node and the learner needs schema/query/index/ORM/plan depth, return to `/db-lab`.
224
+
225
+ ## 14. Delivery-completion visibility
226
+
227
+ After successful delivery, Project Forge may visibly recommend `/db-lab` while the change is fresh when the accepted diff changed database-related evidence such as entities, migrations, schema, SQL/query code, repository/persistence behavior, indexes, constraints, or transaction logic.
228
+
229
+ Prefer learner-facing wording such as:
230
+
231
+ ```text
232
+ ★ /db-lab changes WI-24
233
+ This work changed database structure or behavior.
234
+ Explore affected relationships, queries, indexes, constraints, and ORM behavior.
235
+ ```
236
+
237
+ Do **not** say "rebuild the database diagram" or "refresh the model". Current evidence is part of invoking the lab.
238
+
239
+ Best-effort disposable workbench generation after delivery is allowed only when a safe development/test database is already known. Do not guess a database path, create/apply migrations, or touch Production just to generate a learning artifact. Generation failure never changes delivery state.
240
+
241
+ ## 15. Tooling
242
+
243
+ Optional IDE/database extensions may improve exploration but are not workflow authority and must not become a required dependency unless the project explicitly owns that requirement.
244
+
245
+ Prefer provider/framework-native inspection plus repository evidence. The SQLite workbench is a reusable read-only learning aid; future provider/ORM adapters should preserve the same evidence, current-by-default behavior, and safety contract.
@@ -0,0 +1,144 @@
1
+ ---
2
+ name: define-feature
3
+ description: Define or clarify a feature, initiative, engineering enabler, or other work item while respecting the configured source-of-truth and optional brief model.
4
+ argument-hint: "<work-item ID, external key, idea, or topic>"
5
+ user-invocable: true
6
+ disable-model-invocation: true
7
+ ---
8
+
9
+ # Define Feature
10
+
11
+ Keep discovery proportional. Do not turn a small change into a ceremony.
12
+
13
+ ## 1. Resolve authority first
14
+
15
+ Read `.github/project-forge-workspace.json` when present before assuming a document hierarchy.
16
+
17
+ Possible authoritative sources include:
18
+ - Jira Story/Epic,
19
+ - GitHub Issue,
20
+ - local Product/Feature/Enabler brief,
21
+ - local requirements,
22
+ - another team work-item system,
23
+ - small session context for trivial work.
24
+
25
+ Use external work-item content only when it is actually available. Never claim a Jira/Issue was read when it was not.
26
+
27
+ Never assume `Jira Epic == Feature Brief`.
28
+
29
+ ## 2. Classify the request
30
+
31
+ Classify as one of:
32
+ - Product Feature,
33
+ - Engineering Enabler,
34
+ - Small Change / Task,
35
+ - Cross-Cutting Requirement / Standard,
36
+ - ADR-worthy Architecture Decision,
37
+ - Future Roadmap Idea.
38
+
39
+ Do not invent user stories for technical foundation work.
40
+
41
+ ## 3. Respect brief modes
42
+
43
+ Product/Feature Brief modes may be:
44
+
45
+ ```text
46
+ not-used
47
+ read-existing
48
+ supplemental-experimental
49
+ authoritative
50
+ suggest-complex
51
+ ```
52
+
53
+ Behavior:
54
+ - `not-used`: do not create the brief.
55
+ - `read-existing`: read when relevant; do not create/update.
56
+ - `supplemental-experimental`: an optional brief may be proposed, clearly labeled non-authoritative.
57
+ - `authoritative`: use/update the configured brief as authority.
58
+ - `suggest-complex`: recommend a brief only when cross-work-item or workflow complexity makes it useful.
59
+
60
+ Do not create a competing source of truth.
61
+
62
+ ## 4. Discovery cadence
63
+
64
+ Ask one material question at a time when a real decision is unresolved.
65
+
66
+ For bounded decisions with a small credible answer space, use the choice-first interaction guidance from `INTERACTIVE_SESSION_GUIDE.md`. Keep initial product/problem framing, desired outcomes, workflows, and other answers that need the human's own wording open-ended rather than constraining them to invented options.
67
+
68
+ Clarify only what matters, such as:
69
+ - user/engineering outcome,
70
+ - scope and non-scope,
71
+ - important workflows/lifecycle,
72
+ - domain/engineering invariants,
73
+ - destructive/reversible behavior,
74
+ - security/privacy expectations,
75
+ - dependencies,
76
+ - acceptance summary,
77
+ - open decisions.
78
+
79
+ Record unresolved decisions explicitly rather than inventing them.
80
+
81
+ ## 5. Detailed requirements are proportional
82
+
83
+ Create/refine detailed requirements only when precision is useful.
84
+
85
+ When local detailed requirements are permitted and useful, prefer one combined file.
86
+
87
+ Product Feature:
88
+
89
+ ```text
90
+ requirements.md
91
+ ├── User Stories
92
+ ├── Domain Requirements
93
+ ├── Acceptance / Validation Scenarios
94
+ ├── Open Decisions
95
+ ├── Traceability
96
+ └── Approval
97
+ ```
98
+
99
+ Engineering Enabler:
100
+
101
+ ```text
102
+ requirements.md
103
+ ├── Engineering Requirements
104
+ ├── Acceptance Criteria / Validation Scenarios
105
+ ├── Open Decisions
106
+ ├── Traceability
107
+ └── Approval
108
+ ```
109
+
110
+ If the configured external work item is primary and local detailed requirements are not an approved supplement, propose updates to that external source instead of creating local duplicate authority.
111
+
112
+ ## 6. Stop boundary
113
+
114
+ Stop before implementation.
115
+
116
+ Do not create an implementation plan or production code as part of `/define-feature`.
117
+
118
+ If systematic lower-level coverage is valuable, recommend:
119
+
120
+ ```text
121
+ /refine-requirements <ID-or-key>
122
+ ```
123
+
124
+ ## 7. Guided ending
125
+
126
+ Use a small evidence-backed menu, for example:
127
+
128
+ ```text
129
+ CURRENT STATE
130
+ <what is defined and what remains open>
131
+
132
+ RECOMMENDED NEXT STEP
133
+ <one action and why>
134
+
135
+ OPTIONS
136
+ 1. Review definition [READ ONLY]
137
+ 2. Grill unresolved behavior [READ ONLY]
138
+ 3. Refine detailed requirements [READ ONLY initially]
139
+ 4. Approve requirements/scope when applicable [REQUIREMENTS GATE]
140
+ 5. Start work if already ready [READ ONLY]
141
+ 6. Stop [NO ACTION]
142
+ ```
143
+
144
+ Only show relevant options. A file-changing choice authorizes only that bounded action/session.