@mriekki/lean 0.0.0-stage → 0.1.1

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 (82) hide show
  1. package/README.md +66 -2
  2. package/assets/components.json +33 -0
  3. package/assets/core/distribution.json +51 -0
  4. package/assets/deployment/distribution.json +34 -0
  5. package/assets/generated/ASSEMBLY.json +382 -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/lean-docs.instructions.md +14 -0
  9. package/assets/generated/core/core/instructions/lean-workflow.instructions.md +35 -0
  10. package/assets/generated/core/core/learning/CODING_DRILLS.md +35 -0
  11. package/assets/generated/core/core/learning/DIAGRAM_GUIDE.md +19 -0
  12. package/assets/generated/core/core/learning/ENGINEERING_LEARNING_WORKBOOK.md +82 -0
  13. package/assets/generated/core/core/learning/LEARNING_MAP.md +51 -0
  14. package/assets/generated/core/core/learning/LEARNING_PROGRESS.md +31 -0
  15. package/assets/generated/core/core/learning/RESOURCE_CATALOG.md +25 -0
  16. package/assets/generated/core/core/learning/SQL_DRILLS.md +27 -0
  17. package/assets/generated/core/core/learning/SYSTEM_DESIGN_DRILLS.md +21 -0
  18. package/assets/generated/core/core/process/COACHING_GUIDE.md +57 -0
  19. package/assets/generated/core/core/process/GUIDED_NEXT_STEPS.md +48 -0
  20. package/assets/generated/core/core/process/HUMAN_GATES.md +81 -0
  21. package/assets/generated/core/core/process/INTERACTIVE_SESSION_GUIDE.md +62 -0
  22. package/assets/generated/core/core/process/PRODUCTION_ENABLEMENT.md +59 -0
  23. package/assets/generated/core/core/process/PR_WORKFLOW.md +53 -0
  24. package/assets/generated/core/core/process/SETUP_ACCEPTANCE_CHECKLIST.md +72 -0
  25. package/assets/generated/core/core/process/WORK_ITEM_MODEL.md +56 -0
  26. package/assets/generated/core/core/skills/cleanup-branches/SKILL.md +190 -0
  27. package/assets/generated/core/core/skills/coach/SKILL.md +136 -0
  28. package/assets/generated/core/core/skills/code-walkthrough/SKILL.md +197 -0
  29. package/assets/generated/core/core/skills/core-sync/SKILL.md +220 -0
  30. package/assets/generated/core/core/skills/define-feature/SKILL.md +144 -0
  31. package/assets/generated/core/core/skills/deliver/SKILL.md +315 -0
  32. package/assets/generated/core/core/skills/deploy/SKILL.md +193 -0
  33. package/assets/generated/core/core/skills/grill-me/SKILL.md +77 -0
  34. package/assets/generated/core/core/skills/grill-with-docs/SKILL.md +90 -0
  35. package/assets/generated/core/core/skills/learning-review/SKILL.md +90 -0
  36. package/assets/generated/core/core/skills/next-step/SKILL.md +166 -0
  37. package/assets/generated/core/core/skills/production-readiness/SKILL.md +357 -0
  38. package/assets/generated/core/core/skills/pull-latest/SKILL.md +166 -0
  39. package/assets/generated/core/core/skills/refine-requirements/SKILL.md +207 -0
  40. package/assets/generated/core/core/skills/start-work/SKILL.md +178 -0
  41. package/assets/generated/core/core/skills/tear-down/SKILL.md +138 -0
  42. package/assets/generated/core/core/skills/upstream-fix/SKILL.md +206 -0
  43. package/assets/generated/core/core/skills/wait-what/SKILL.md +86 -0
  44. package/assets/generated/core/core/templates/FEATURE_BRIEF_TEMPLATE.md +27 -0
  45. package/assets/generated/core/core/templates/PRODUCT_BRIEF_TEMPLATE.md +27 -0
  46. package/assets/generated/core/core/templates/PULL_REQUEST_TEMPLATE.md +37 -0
  47. package/assets/generated/core/core/templates/REQUIREMENTS_TEMPLATE.md +17 -0
  48. package/assets/generated/core/profiles/greenfield/lean-workspace.json +12 -0
  49. package/assets/generated/core/tools/package/check_baseline.py +102 -0
  50. package/assets/generated/core/tools/package/check_upstream.py +171 -0
  51. package/assets/generated/deployment/distribution/lean-poc-deploy.py +8 -0
  52. package/assets/generated/deployment/src/lean_poc_deployment/__init__.py +3 -0
  53. package/assets/generated/deployment/src/lean_poc_deployment/__main__.py +3 -0
  54. package/assets/generated/deployment/src/lean_poc_deployment/app_cli.py +140 -0
  55. package/assets/generated/deployment/src/lean_poc_deployment/app_runtime.py +455 -0
  56. package/assets/generated/deployment/src/lean_poc_deployment/app_runtime_remote.py +416 -0
  57. package/assets/generated/deployment/src/lean_poc_deployment/box_platform.py +208 -0
  58. package/assets/generated/deployment/src/lean_poc_deployment/box_platform_assets.py +100 -0
  59. package/assets/generated/deployment/src/lean_poc_deployment/box_platform_remote.py +271 -0
  60. package/assets/generated/deployment/src/lean_poc_deployment/cli.py +437 -0
  61. package/assets/generated/deployment/src/lean_poc_deployment/doctor.py +121 -0
  62. package/assets/generated/deployment/src/lean_poc_deployment/entrypoint.py +25 -0
  63. package/assets/generated/deployment/src/lean_poc_deployment/errors.py +5 -0
  64. package/assets/generated/deployment/src/lean_poc_deployment/keys.py +171 -0
  65. package/assets/generated/deployment/src/lean_poc_deployment/profiles.py +204 -0
  66. package/assets/generated/deployment/src/lean_poc_deployment/route_registry.py +367 -0
  67. package/assets/generated/deployment/src/lean_poc_deployment/route_registry_remote.py +443 -0
  68. package/assets/generated/deployment/src/lean_poc_deployment/security.py +290 -0
  69. package/assets/generated/deployment/src/lean_poc_deployment/sqlite_adapter.py +335 -0
  70. package/assets/generated/deployment/src/lean_poc_deployment/sqlite_adapter_remote.py +340 -0
  71. package/assets/generated/deployment/src/lean_poc_deployment/sqlite_cli.py +86 -0
  72. package/assets/generated/deployment/src/lean_poc_deployment/sqlite_import_recovery.py +437 -0
  73. package/assets/generated/deployment/src/lean_poc_deployment/ssh.py +118 -0
  74. package/assets/generated/deployment/src/lean_poc_deployment/teardown.py +286 -0
  75. package/assets/generated/deployment/src/lean_poc_deployment/teardown_cli.py +120 -0
  76. package/assets/generated/deployment/src/lean_poc_deployment/teardown_remote.py +100 -0
  77. package/assets/generated/deployment/src/lean_poc_deployment/trust.py +278 -0
  78. package/bin/lean.mjs +9 -0
  79. package/package.json +31 -4
  80. package/src/cli.mjs +131 -0
  81. package/src/engine.mjs +243 -0
  82. package/src/package-data.mjs +18 -0
@@ -0,0 +1,197 @@
1
+ ---
2
+ name: code-walkthrough
3
+ description: "Read-only guided walkthrough of an implementation diff, explaining changed files functionally and technically with optional deeper coaching, tracing, diagrams, quizzes, debugging discussion, and interview practice."
4
+ argument-hint: "[work-item|PR|commit|current] [light|focused|deep]"
5
+ user-invocable: true
6
+ disable-model-invocation: true
7
+ ---
8
+
9
+ # Code Walkthrough
10
+
11
+ Purpose: help the developer understand an actual implementation by walking through the changed files in a sensible order and connecting functional behavior to technical design.
12
+
13
+ `/code-walkthrough` is optional, read-only, and never blocks review, delivery, merge, or work-item completion.
14
+
15
+ ## 1. Boundaries
16
+
17
+ - Do not edit production code or tests.
18
+ - Do not implement fixes during the walkthrough.
19
+ - Do not commit, push, merge, or modify a PR.
20
+ - Do not update learning-progress files unless the human explicitly chooses that after the walkthrough.
21
+ - Do not invoke subagents.
22
+ - Do not silently broaden the implementation scope.
23
+ - Do not pin/request/switch to a premium model automatically.
24
+ - Distinguish observed implementation evidence from assumptions.
25
+ - Distinguish AI-generated code, developer-reviewed understanding, study, and actual implementation experience when credibility matters.
26
+
27
+ If a bug, design concern, or missing test is discovered, explain it and offer a return to the normal implementation/review workflow. Do not fix it while in walkthrough mode.
28
+
29
+ ## 2. Resolve the change set
30
+
31
+ Use Git/GitHub evidence as the source of truth. VS Code Source Control/diff views are visual aids, not workflow state.
32
+
33
+ Resolve in this order when possible:
34
+
35
+ ```text
36
+ explicit PR / commit / ref
37
+ → work-item-associated branch or PR supported by evidence
38
+ → current feature branch versus the merge-base of the configured default branch
39
+ → current staged/unstaged tracked changes
40
+ → ask one concise scope question when materially ambiguous
41
+ ```
42
+
43
+ For an explicit PR, use the PR base/head change set and do not silently mix unrelated local changes.
44
+
45
+ For an active feature branch, prefer the branch change from the default-branch merge base. Identify relevant tracked working changes and call out untracked files explicitly rather than silently omitting them.
46
+
47
+ For merged work, use the PR, merge commit, or explicit historical commit range.
48
+
49
+ Never invent branch, work-item, PR, or commit associations.
50
+
51
+ ## 3. Depth
52
+
53
+ ```text
54
+ Light — what changed, why, and major connections
55
+ Focused — default; behavior, important mechanics, relationships, tests, and learning hooks
56
+ Deep — important methods/blocks, state/data flow, dependencies, edge cases, failure modes, tests, and tradeoffs
57
+ ```
58
+
59
+ Depth may vary by file. Treat trivial configuration lightly unless it materially affects behavior; spend more depth on implementation anchors.
60
+
61
+ ## 4. Build the walkthrough plan
62
+
63
+ Before explaining the first file:
64
+
65
+ 1. identify the changed files and change types,
66
+ 2. read only enough work-item/requirements context to understand intended behavior,
67
+ 3. identify likely implementation anchors and relationships,
68
+ 4. order files for understanding rather than alphabetically,
69
+ 5. present a concise plan and start with the first meaningful file.
70
+
71
+ Use repository architecture rather than a fixed stack assumption. A common web-application order may be:
72
+
73
+ ```text
74
+ domain/data model
75
+ → persistence
76
+ → service/business logic
77
+ → API/controller
78
+ → client model/service/state
79
+ → UI/component
80
+ → tests near the behavior they verify
81
+ → configuration/operational files
82
+ ```
83
+
84
+ An event-driven or systems repository may require a different path. Infer from actual imports, references, paths, changed symbols, tests, and architecture.
85
+
86
+ ## 5. Per-file walkthrough
87
+
88
+ For each meaningful changed file, cover only what is useful:
89
+
90
+ ```text
91
+ FILE <n> OF <total>
92
+ <path>
93
+
94
+ ROLE
95
+ Why this file exists in the system.
96
+
97
+ FUNCTIONAL CHANGE
98
+ What behavior or capability changed.
99
+
100
+ TECHNICAL CHANGE
101
+ Important classes/functions/data structures/framework mechanisms and how they changed.
102
+
103
+ HOW THIS CONNECTS
104
+ Upstream/downstream callers, data flow, state flow, persistence, UI, events, or other dependencies.
105
+
106
+ WHY THIS DESIGN
107
+ Important choice, convention, or tradeoff when evidence supports it.
108
+
109
+ TESTING
110
+ Relevant tests/evidence and what they do or do not prove. Never claim a test passed unless execution evidence was observed.
111
+
112
+ LEARNING HOOKS
113
+ Concepts worth understanding more deeply.
114
+ ```
115
+
116
+ For change types:
117
+ - new file: explain why the responsibility now exists;
118
+ - modified file: explain meaningful before-versus-after behavior;
119
+ - deleted file: explain what responsibility disappeared or moved;
120
+ - renamed/moved file: distinguish structural movement from behavioral change.
121
+
122
+ Group trivial generated/configuration changes when that improves learning, but do not hide behaviorally important files.
123
+
124
+ ## 6. Guided navigation
125
+
126
+ Default to one file or one tightly related file group at a time. Do not dump the whole implementation at once.
127
+
128
+ At a natural file boundary, show a compact navigation cue such as:
129
+
130
+ ```text
131
+ NEXT: <suggested file>
132
+ Use: next | deeper | explain this | trace | why this design | diagram | quiz | debug | interview | skip | stop
133
+ ```
134
+
135
+ Interpret these naturally:
136
+ - `next` — continue to the suggested next file;
137
+ - `deeper` — increase depth for the current file/topic;
138
+ - `explain this` — focus on the selected/current method, block, symbol, or diff hunk;
139
+ - `trace` — follow request/data/state/event flow across files;
140
+ - `why this design` — discuss alternatives and tradeoffs grounded in repository context;
141
+ - `diagram` — use an ephemeral Mermaid diagram when useful;
142
+ - `quiz` — briefly switch to adaptive Coach-style understanding questions;
143
+ - `debug` — discuss likely failure modes, evidence, and debugging approach without implementing a fix;
144
+ - `interview` — practice explaining or defending the implementation credibly;
145
+ - `skip` — cover the current file lightly and move on;
146
+ - `stop` — end without affecting engineering status.
147
+
148
+ Do not repeatedly ask whether to continue when the next action is obvious.
149
+
150
+ ## 7. Tracing and learning depth
151
+
152
+ When tracing, connect actual call/data/state flow. Example shape only:
153
+
154
+ ```text
155
+ UI/input
156
+ → client/service
157
+ → API/handler
158
+ → application/service logic
159
+ → persistence/event/system boundary
160
+ → response/result
161
+ ```
162
+
163
+ Map deeper exploration to the shared learning levels when useful:
164
+
165
+ ```text
166
+ L1 Recognize
167
+ L2 Explain
168
+ L3 Trace
169
+ L4 Apply / Debug
170
+ L5 Defend / Design
171
+ L6 Interview Ready
172
+ ```
173
+
174
+ Use `/coach` for broader concept learning and `/learning-review` for structured assessment after the walkthrough.
175
+
176
+ ## 8. Completion
177
+
178
+ When the planned change set is covered or the human stops, summarize:
179
+
180
+ - end-to-end implementation flow,
181
+ - major functional changes,
182
+ - important technical decisions and connections,
183
+ - concepts explored deeply versus lightly,
184
+ - tests/evidence actually observed,
185
+ - learning gaps or topics worth revisiting,
186
+ - optional next learning actions.
187
+
188
+ Offer only relevant next choices, such as:
189
+
190
+ ```text
191
+ 1. /learning-review <same scope> [READ ONLY]
192
+ 2. /coach <specific concept> [READ ONLY]
193
+ 3. Return to engineering workflow [NO ACTION]
194
+ 4. Stop [NO ACTION]
195
+ ```
196
+
197
+ Do not create a new engineering state such as `CODE_WALKTHROUGH_PENDING`. Walkthrough completion is learning evidence, not a delivery gate.
@@ -0,0 +1,220 @@
1
+ ---
2
+ name: core-sync
3
+ description: Guided Core-to-consumer synchronization that uses a safe local Core checkout when available and otherwise uses configured remote orchestration without requiring a Core clone.
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` updates a consumer repository to a newer accepted Lean Agentic Core baseline while preserving consumer-owned content and the Human-in-the-Loop delivery boundary.
12
+
13
+ A local Core checkout is an optimization, not a prerequisite. Do not clone Core merely to satisfy `/core-sync`.
14
+
15
+ Invocation starts read-only. One explicit sync choice may authorize the bounded mechanics needed for the selected local or remote path; merge/final acceptance remains separate.
16
+
17
+ ## 1. Establish the consumer baseline
18
+
19
+ From the consumer repository, read:
20
+
21
+ - `CORE_BASELINE.json`,
22
+ - `.github/lean-workspace.json` when present,
23
+ - `.github/lean-core-sync.json` when present,
24
+ - current Git status, branch, remotes, and default branch when observable.
25
+
26
+ Run the repository-local integrity check before planning an update:
27
+
28
+ ```text
29
+ python tools/lean-core/check-core-baseline.py --root .
30
+ ```
31
+
32
+ Stop if the current managed overlay already has unexplained local drift, missing managed files, or invalid baseline metadata. Do not treat consumer edits as disposable.
33
+
34
+ Resolve from `CORE_BASELINE.json`:
35
+
36
+ - canonical Core repository,
37
+ - currently accepted Core commit/version,
38
+ - distribution name,
39
+ - managed-path ownership/hashes.
40
+
41
+ ## 2. Resolve the Core source automatically
42
+
43
+ Check local candidates in this order:
44
+
45
+ 1. an explicit Core path supplied by the human,
46
+ 2. an already-open workspace folder that unambiguously resolves to the recorded Core repository,
47
+ 3. the sibling checkout derived from the Core repository name, normally `../lean-agentic-core`.
48
+
49
+ Do not broadly scan the developer's filesystem.
50
+
51
+ A local candidate is usable only when:
52
+
53
+ - it is a Git repository,
54
+ - its configured remote resolves to the Core repository recorded in `CORE_BASELINE.json`,
55
+ - its repository state can be inspected safely.
56
+
57
+ If no usable local Core checkout exists, use the configured remote provider from `.github/lean-core-sync.json` when available. Do not ask the developer to clone Core just because the local candidate is absent.
58
+
59
+ ## 3. Classify a local Core checkout
60
+
61
+ Before modifying a local Core checkout inspect:
62
+
63
+ ```text
64
+ git -C <core-path> status --short --branch
65
+ git -C <core-path> branch --show-current
66
+ git -C <core-path> remote -v
67
+ git -C <core-path> branch -vv
68
+ ```
69
+
70
+ A local Core checkout may be automatically refreshed only when all of these are true:
71
+
72
+ - the worktree is clean,
73
+ - no merge/rebase/cherry-pick is in progress,
74
+ - the checkout is on its normal accepted/default branch,
75
+ - an unambiguous upstream exists,
76
+ - updating can be performed fast-forward-only.
77
+
78
+ Never auto-stash, merge, rebase, reset, clean, force-update, or discard Core work.
79
+
80
+ If the local Core checkout is dirty, ahead, diverged, on an intentional non-default ref, or otherwise ambiguous, preserve it unchanged. When a remote provider is configured, prefer the remote path for the consumer update. Otherwise stop with the observed local state and the missing capability; do not silently use an unaccepted local ref.
81
+
82
+ ## 4. Present one bounded sync choice
83
+
84
+ ### Safe local Core available
85
+
86
+ Present:
87
+
88
+ ```text
89
+ CORE SYNC READY
90
+
91
+ Consumer baseline: <commit/version>
92
+ Source: LOCAL <core-path>
93
+ Local Core state: CURRENT | FAST-FORWARDABLE
94
+ Distribution: <distribution>
95
+
96
+ 1. Sync to the accepted Core source [GIT + FILE WRITE] — recommended
97
+ 2. Keep inspecting only [READ ONLY]
98
+ 3. Stop [NO ACTION]
99
+ ```
100
+
101
+ Choosing option 1 authorizes only the bounded local-sync mechanics described below: safe Core refresh if needed, consumer sync-branch setup, safe Core overlay application, and verification. It does not authorize `/deliver`, merge, release publication, or production deployment.
102
+
103
+ ### No safe local Core available, remote provider configured
104
+
105
+ Present:
106
+
107
+ ```text
108
+ CORE SYNC READY
109
+
110
+ Consumer baseline: <commit/version>
111
+ Source: REMOTE PROVIDER
112
+ Local Core: NOT REQUIRED
113
+ Provider: <provider repository>
114
+
115
+ 1. Request remote Core sync [REMOTE WRITE] — recommended
116
+ 2. Keep inspecting only [READ ONLY]
117
+ 3. Stop [NO ACTION]
118
+ ```
119
+
120
+ Choosing option 1 authorizes creation of exactly the configured remote sync request for this consumer. It does not authorize merging the resulting consumer PR.
121
+
122
+ ### Neither source is usable
123
+
124
+ Report `CORE SYNC BLOCKED` with the evidence. A missing local Core checkout by itself is not an error; the blocker is the absence of both a safe local source and a configured/usable remote provider.
125
+
126
+ ## 5. Local sync path
127
+
128
+ After option 1 is selected:
129
+
130
+ 1. Refresh the local Core remote state.
131
+ 2. Reclassify the accepted/default Core branch.
132
+ 3. If behind and fast-forward-safe, update using the equivalent of:
133
+
134
+ ```text
135
+ git -C <core-path> pull --ff-only
136
+ ```
137
+
138
+ 4. If Core is ahead, diverged, dirty, or otherwise unsafe after refresh, stop without changing the consumer and prefer the configured remote provider when available.
139
+ 5. Run a Core sync preview from the refreshed checkout using the distribution recorded by the consumer baseline.
140
+ 6. Stop without apply on any unsafe sync state, including `LOCAL_DRIFT`, `CONFLICT`, `LOCAL_MISSING`, `UNTRACKED_CONFLICT`, or an unaccepted `RETIRED_PATH`.
141
+ 7. If the consumer is on its default branch, create/switch to a repository-appropriate short-lived chore branch such as `chore/sync-core-<version-or-short-sha>`. This branch setup is routine inside the selected bounded sync action.
142
+ 8. Apply only the safe Core additions/updates and refresh `CORE_BASELINE.json` using Core's canonical `tools/package/sync.py` contract.
143
+
144
+ Do not manually copy individual managed files as a substitute for the canonical sync tool.
145
+
146
+ ## 6. Remote sync path
147
+
148
+ Remote orchestration is consumer configuration, not a hardcoded Core service. Read `.github/lean-core-sync.json` and require:
149
+
150
+ ```json
151
+ {
152
+ "schemaVersion": 1,
153
+ "remote": {
154
+ "type": "github-issue-control-plane",
155
+ "repository": "owner/control-plane-repo",
156
+ "titleTemplate": "[sync-core] {owner}/{repository}",
157
+ "requireEmptyBody": true
158
+ }
159
+ }
160
+ ```
161
+
162
+ Only the placeholders `{owner}` and `{repository}` may be substituted in `titleTemplate`. Resolve them from the consumer's canonical GitHub remote. Do not put product requirements, baseline JSON, source code, secrets, or other private consumer details into the public request.
163
+
164
+ For `github-issue-control-plane`, create exactly one issue in the configured provider repository using the rendered title and an empty body. Use the environment's normal GitHub integration or CLI; never request or expose a long-lived Core credential merely to make the request.
165
+
166
+ The remote provider is expected to:
167
+
168
+ - validate requester/target authorization,
169
+ - obtain its own short-lived source/target credentials,
170
+ - resolve the accepted Core source,
171
+ - run the canonical Core sync contract against the target consumer,
172
+ - refuse unsafe consumer drift/conflicts,
173
+ - update exact Core provenance,
174
+ - publish the result on a short-lived consumer branch and PR,
175
+ - run/observe consumer CI.
176
+
177
+ If the configured provider does not support that contract, report `REMOTE SYNC UNAVAILABLE`; do not silently clone Core or invent a different synchronization mechanism.
178
+
179
+ ## 7. Verification
180
+
181
+ ### Local path
182
+
183
+ After apply, run:
184
+
185
+ ```text
186
+ python tools/lean-core/check-core-baseline.py --root .
187
+ git status --short --branch
188
+ git diff --stat
189
+ git diff -- CORE_BASELINE.json
190
+ ```
191
+
192
+ Confirm:
193
+
194
+ - managed paths match the refreshed hashes,
195
+ - consumer-owned paths were not overwritten,
196
+ - the baseline records the exact Core commit actually applied,
197
+ - only the intended sync branch changed.
198
+
199
+ Present the meaningful diff for human review. After acceptance, recommend `/deliver` for normal commit/push/PR/CI mechanics.
200
+
201
+ ### Remote path
202
+
203
+ Observe the provider result when available. Report the target branch/PR and exact Core commit applied. The human reviews the consumer PR and retains the normal explicit merge/finalize gate.
204
+
205
+ If the developer has a local consumer checkout, remind them to use `/pull-latest` after the remote sync PR is merged when their local working state is safe. Do not overwrite unrelated local work.
206
+
207
+ ## 8. Boundaries
208
+
209
+ `/core-sync` never:
210
+
211
+ - requires a local Core clone when a configured remote provider can perform the update,
212
+ - modifies a dirty/diverged/intentional local Core checkout automatically,
213
+ - uses merge/rebase/reset/force operations to refresh Core,
214
+ - treats managed consumer drift as disposable,
215
+ - overwrites consumer-owned paths merely because Core has a similarly named destination,
216
+ - publishes a Core release/tag,
217
+ - merges the consumer sync PR without the normal explicit final gate,
218
+ - deploys production.
219
+
220
+ If reusable Core content itself is wrong, fix Core canonically instead of forking the reusable file in the consumer.
@@ -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/lean-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.