sdtk-spec-kit 0.7.0 → 0.8.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.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  It exposes the `sdtk-spec` CLI as the primary upstream command surface.
6
6
 
7
- Package version in this source snapshot: `0.7.0`
7
+ Package version in this source snapshot: `0.8.1`
8
8
  Full usage guide: `products/sdtk-spec/governance/SDTK_SPEC_USAGE_GUIDE.md`
9
9
 
10
10
  Wraps the `SDTK-SPEC` PowerShell toolkit for portable, reproducible feature documentation scaffolding.
@@ -1,12 +1,12 @@
1
1
  {
2
- "version": "0.6.1",
3
- "sourceCommit": "958c734ede338089150af3f802b3e2a407c78748",
2
+ "version": "0.8.1",
3
+ "sourceCommit": "12c007b7b4588c7cf1bf13a34ebee83bb9d2e40b",
4
4
  "fileCount": 100,
5
5
  "files": [
6
6
  {
7
7
  "path": "toolkit/AGENTS.md",
8
- "sha256": "0871c6d46c64a093fc5f9d06af373db8143943cd27f144957dad0cc86893dc62",
9
- "size": 15069
8
+ "sha256": "5c76955ecabfae64759c11a3ee0fa777b1e0c0f78bdd177ae8f04340cd572e4b",
9
+ "size": 16469
10
10
  },
11
11
  {
12
12
  "path": "toolkit/install.ps1",
@@ -20,13 +20,13 @@
20
20
  },
21
21
  {
22
22
  "path": "toolkit/runtimes/claude/CLAUDE_TEMPLATE.md",
23
- "sha256": "5b013dde057ed5487b3c9859775bf751306123a4af30e7077811271aa1a1b842",
24
- "size": 6486
23
+ "sha256": "301a604b2daa39f85a7b9cbf4b634df5dafd16f84622ad188bc214b34da226d7",
24
+ "size": 3501
25
25
  },
26
26
  {
27
27
  "path": "toolkit/runtimes/codex/CODEX_TEMPLATE.md",
28
- "sha256": "17420748e1812278fe31a82a5df366dad67331363daf3b250c79af0f5358de2b",
29
- "size": 4841
28
+ "sha256": "6f1fd656e95906a054299312d44e63a28d948c634b6534089db3eeca9936bf70",
29
+ "size": 2853
30
30
  },
31
31
  {
32
32
  "path": "toolkit/scripts/agents/run-claude-task.ps1",
@@ -80,13 +80,13 @@
80
80
  },
81
81
  {
82
82
  "path": "toolkit/sdtk-spec.config.json",
83
- "sha256": "ce760f639a09913b236be6dde6c692ea19ee92eb1d9e63d10dcdeb398e7ed2fb",
84
- "size": 1209
83
+ "sha256": "712382d838a18b6cc6a5285b3c536fac74138c752a3fa1fd318828b19ece6b8f",
84
+ "size": 1231
85
85
  },
86
86
  {
87
87
  "path": "toolkit/sdtk-spec.config.profiles.example.json",
88
- "sha256": "e04ea5e3f72510e569ab849ebef3dea4a8728c2996c485e997d3e13a6c4f1f86",
89
- "size": 1495
88
+ "sha256": "2a306c1609499fb4910b86d5ec6e8c796e0cdf72c5f97fe3df9c1388ac62b913",
89
+ "size": 2134
90
90
  },
91
91
  {
92
92
  "path": "toolkit/session/SDTK_ACTIVE_BOOTSTRAP.md",
@@ -140,8 +140,8 @@
140
140
  },
141
141
  {
142
142
  "path": "toolkit/skills-claude/evolve/SKILL.md",
143
- "sha256": "d345ac17251f28a3a7b428a20aa8d6a8675bf8c2cfd1c03c5ca35e22fb8f0041",
144
- "size": 7660
143
+ "sha256": "caab483c02ff355634dd3e94c2d3d585ba6469c092ce5ab4bee97357da40be99",
144
+ "size": 7532
145
145
  },
146
146
  {
147
147
  "path": "toolkit/skills-claude/mailbox-dispatch/SKILL.md",
@@ -240,8 +240,8 @@
240
240
  },
241
241
  {
242
242
  "path": "toolkit/skills/sdtk-evolve/SKILL.md",
243
- "sha256": "6fe9b6657f11dd4b9a9ecf2a40a1fefab80b9a743e1c1af057ca541be390421a",
244
- "size": 7987
243
+ "sha256": "691e7a0dd50262f247ad8a4c8ca05892c1240245de20580cc411c2d063bf9a1f",
244
+ "size": 7861
245
245
  },
246
246
  {
247
247
  "path": "toolkit/skills/sdtk-mailbox-dispatch/SKILL.md",
@@ -490,8 +490,8 @@
490
490
  },
491
491
  {
492
492
  "path": "toolkit/templates/QUALITY_CHECKLIST.md",
493
- "sha256": "dcf24e54455bf59becceae0dad8c517b2038037a6790dbda8ca9aa47c7633942",
494
- "size": 6854
493
+ "sha256": "1cc6c9e0fbbbd545da9750e6f13e09ad968d9b23bff3a69a36a46a2be57d5ea2",
494
+ "size": 7039
495
495
  },
496
496
  {
497
497
  "path": "toolkit/templates/README.md",
@@ -1,8 +1,8 @@
1
- 0871c6d46c64a093fc5f9d06af373db8143943cd27f144957dad0cc86893dc62 toolkit/AGENTS.md
1
+ 5c76955ecabfae64759c11a3ee0fa777b1e0c0f78bdd177ae8f04340cd572e4b toolkit/AGENTS.md
2
2
  52bdc750984ee3c3598c1f1838cf3d72b2fc0ed06fca173ec3da79929b10f20c toolkit/install.ps1
3
3
  0218dea84f0f9a25ddd2e68c6ae9995685ec471ff0950bd17d1eddcaa99f3e0e toolkit/README.md
4
- 5b013dde057ed5487b3c9859775bf751306123a4af30e7077811271aa1a1b842 toolkit/runtimes/claude/CLAUDE_TEMPLATE.md
5
- 17420748e1812278fe31a82a5df366dad67331363daf3b250c79af0f5358de2b toolkit/runtimes/codex/CODEX_TEMPLATE.md
4
+ 301a604b2daa39f85a7b9cbf4b634df5dafd16f84622ad188bc214b34da226d7 toolkit/runtimes/claude/CLAUDE_TEMPLATE.md
5
+ 6f1fd656e95906a054299312d44e63a28d948c634b6534089db3eeca9936bf70 toolkit/runtimes/codex/CODEX_TEMPLATE.md
6
6
  8616291be4aaa4fb5cb0f1f4c738c108ab79090bf767ee2b4403d6d582c150c7 toolkit/scripts/agents/run-claude-task.ps1
7
7
  4996e8e7aa50283dbf52c473c4e315af7ee951ebddb671ff59cc4bcde9843907 toolkit/scripts/agents/run-codex-task.ps1
8
8
  6bcebe5fdb87451a7260101eaed32c6b61a2cf07832be754790f5432e028a503 toolkit/scripts/agents/validate-mailbox-formal-artifact.py
@@ -13,8 +13,8 @@ b9bdb2489c2881d03e965c7dd849468f797e2070d30e6730ab9ddf37b54b7879 toolkit/script
13
13
  f925a58e0cc92addc542762c2bf5f60be2d538dcca88e15de0b628b3a57048b1 toolkit/scripts/uninstall-claude-skills.ps1
14
14
  db0e580a20b43bb0af399ff3e4f7f2d826423d67bd2fa9a8121a384337a47de1 toolkit/scripts/uninstall-codex-skills.ps1
15
15
  dec335148e1bc721eee6ddae82417f344cc74345771da1328c7af54deee0c812 toolkit/SDTK_TOOLKIT.md
16
- ce760f639a09913b236be6dde6c692ea19ee92eb1d9e63d10dcdeb398e7ed2fb toolkit/sdtk-spec.config.json
17
- e04ea5e3f72510e569ab849ebef3dea4a8728c2996c485e997d3e13a6c4f1f86 toolkit/sdtk-spec.config.profiles.example.json
16
+ 712382d838a18b6cc6a5285b3c536fac74138c752a3fa1fd318828b19ece6b8f toolkit/sdtk-spec.config.json
17
+ 2a306c1609499fb4910b86d5ec6e8c796e0cdf72c5f97fe3df9c1388ac62b913 toolkit/sdtk-spec.config.profiles.example.json
18
18
  ab376df00d0fe92307ff862bac0ffe431254903cf9ccac00117d979ddc9c7f88 toolkit/session/SDTK_ACTIVE_BOOTSTRAP.md
19
19
  fba56394ff7cae3ab8cd510b4bfb5b299df9f4f1a3e59be9bbcd573e3df477ae toolkit/session/SDTK_AGENT_WORKING_RULES.md
20
20
  c17bb4faff318032ee99ead56e5fa182811c7bcaa176e463d0377cefde213ac1 toolkit/skills-claude/api-design-spec/SKILL.md
@@ -25,7 +25,7 @@ c17bb4faff318032ee99ead56e5fa182811c7bcaa176e463d0377cefde213ac1 toolkit/skills
25
25
  b4de86bc4730c4fcfe4f1bde8f9f64f03fd517825bb699e911199825cc3d4249 toolkit/skills-claude/dev-backend/SKILL.md
26
26
  37b3ae11db18bc3f64a76b22bca95cea778d6cfbb8b038d46851bd44ff8ff8f1 toolkit/skills-claude/dev-frontend/SKILL.md
27
27
  a4f326e2cafff865aaaed8f8de9407f3baa3cfebe33979528a15eb26d2e8482b toolkit/skills-claude/dev/SKILL.md
28
- d345ac17251f28a3a7b428a20aa8d6a8675bf8c2cfd1c03c5ca35e22fb8f0041 toolkit/skills-claude/evolve/SKILL.md
28
+ caab483c02ff355634dd3e94c2d3d585ba6469c092ce5ab4bee97357da40be99 toolkit/skills-claude/evolve/SKILL.md
29
29
  6fa2283aa1ebb7bf5b6e84d5d5d9d9ddf71082091b108bd46895923a5fca3e09 toolkit/skills-claude/mailbox-dispatch/SKILL.md
30
30
  aa086be1038e34b1b29f7f65bacf254b5c1bfdc1203bd3e643c27acca4f9c2fa toolkit/skills-claude/orchestrator/SKILL.md
31
31
  e9e346ff0e1fc66236ceabf64a043c9a28926e7ff06296b26dd5836cf045802a toolkit/skills-claude/pm/SKILL.md
@@ -45,7 +45,7 @@ ce5af79e5c4902b9c8ceb7e8dae848a6a5a26d5b845eee94ee8aafff88990256 toolkit/skills
45
45
  6c866b7f8dec193a4c26066e8ac43004ff809f6407ead467a3cb72d90425af52 toolkit/skills/sdtk-dev/prompts/implementer.md
46
46
  55dd53b1ccbedd271ad23ca8df01afc317eced27ee17af3b37f31f0b9176ca8b toolkit/skills/sdtk-dev/prompts/spec-reviewer.md
47
47
  749f0ff0865d8940cec9b16859706fd46f111a4d9bf54b6ccba381fe9db7a90e toolkit/skills/sdtk-dev/SKILL.md
48
- 6fe9b6657f11dd4b9a9ecf2a40a1fefab80b9a743e1c1af057ca541be390421a toolkit/skills/sdtk-evolve/SKILL.md
48
+ 691e7a0dd50262f247ad8a4c8ca05892c1240245de20580cc411c2d063bf9a1f toolkit/skills/sdtk-evolve/SKILL.md
49
49
  df593d5ab4e7c5f4b05ac9ddb5078189b25bd954e546ab65c0147d024e4f4d59 toolkit/skills/sdtk-mailbox-dispatch/SKILL.md
50
50
  66ddb66fee3b12b008ea269baa57acde77f8614ac15a9f87cc994eae64ca63dc toolkit/skills/sdtk-orchestrator/SKILL.md
51
51
  ae53d96b6a4fb4ea60fb5de6578b2620c3adb43e1d722a0469cdfa5a90b92903 toolkit/skills/sdtk-pm/SKILL.md
@@ -95,6 +95,6 @@ e65192c4e72d86d27452c89f7be2d3bfe1118af550f71e3eee9db92e20f96cea toolkit/templa
95
95
  6ee91d4307ec0fc6dbdee281f2a3f99efa552de55b535ff46cf498689572f9f7 toolkit/templates/handoffs/QA_RELEASE_DECISION.md
96
96
  54ae1612b6e95af0f19bd0ea897ceb1df72d366dc20485c91ba3261484e88cf2 toolkit/templates/mailbox/AGENT_REPORT_TEMPLATE.md
97
97
  3fd748061615802c8cd5a4978396a782f59404662339ee18f732352cb79b4f84 toolkit/templates/mailbox/AGENT_TASK_TEMPLATE.md
98
- dcf24e54455bf59becceae0dad8c517b2038037a6790dbda8ca9aa47c7633942 toolkit/templates/QUALITY_CHECKLIST.md
98
+ 1cc6c9e0fbbbd545da9750e6f13e09ad968d9b23bff3a69a36a46a2be57d5ea2 toolkit/templates/QUALITY_CHECKLIST.md
99
99
  2ba15299f149dca87d182ca65d8dccc3b27335c6ac31e01cc42afd02476d5dad toolkit/templates/README.md
100
100
  bc778c499c534c3a0c4547c35d2fed02e745cefe743c1ed8a1074e1e0a88a8b2 toolkit/templates/SHARED_PLANNING.md
@@ -1,5 +1,10 @@
1
1
  # SDTK Orchestrator Routing Contract
2
2
 
3
+ Version: 2.0
4
+ Last Updated: 2026-07-14
5
+
6
+ This file is the single source of the SDTK routing contract. `CLAUDE.md` and `CODEX.md` are thin runtime adapters that defer to it; when they appear to disagree with this file, this file wins.
7
+
3
8
  Goal: use the SDTK Suite as a coordinated operating model:
4
9
  - `SDTK-SPEC` governs upstream discovery, planning, design, traceability, and release gates.
5
10
  - `SDTK-CODE` is the default downstream system for implementation, bug fixing, refactoring, verification, and ship-ready code changes.
@@ -19,16 +24,21 @@ Orchestrator Intake is the always-winning front door for every unprefixed reques
19
24
  - Read stack and command configuration from `sdtk-spec.config.json` in the project root.
20
25
  - For VI/JP source requirements, keep original text in an appendix and add literal English translation for traceability.
21
26
  - `/dev` stops at `FEATURE_IMPL_PLAN + CODE_HANDOFF`; SDTK-CODE is the default downstream coding system.
22
- - Verification-before-completion: no phase may declare done, pass, or handoff-ready without fresh command evidence per `governance/ai/core/SDTK_VERIFICATION_BEFORE_COMPLETION_POLICY.md`.
27
+ - Verification-before-completion: no phase may declare done, pass, or handoff-ready without fresh command evidence — run the relevant verification commands in this session and quote their real output in the phase artifact; assumed, remembered, or stale results do not count.
23
28
  - `toolkit/skills/skills.catalog.yaml` is the inventory source of truth for the 14 core SDTK-SPEC skills, including the bounded `mailbox-dispatch` controller skill.
24
29
 
25
30
  ## 2) Session Bootstrap Protocol
26
31
  When starting a new session, read context in this order when the files exist:
27
32
  1. `AGENTS.md`
28
- 2. `governance/ai/session/SDTK_ACTIVE_BOOTSTRAP.md`
29
- 3. `governance/ai/session/SDTK_AGENT_WORKING_RULES.md`
30
- 4. `governance/ai/core/IMPROVEMENT_BACKLOG.md`
31
- 5. issue-specific controller spec and implementation plan
33
+ 2. `.sdtk/evolve/LEARNED.md` — locally learned, owner-approved lessons (managed by the evolve skill + `sdtk evolve`; never edit it directly)
34
+ 3. `governance/ai/session/SDTK_ACTIVE_BOOTSTRAP.md`
35
+ 4. `governance/ai/session/SDTK_AGENT_WORKING_RULES.md`
36
+ 5. `governance/ai/core/IMPROVEMENT_BACKLOG.md`
37
+ 6. issue-specific controller spec and implementation plan
38
+
39
+ Orientation and health:
40
+ - If `.sdtk/wiki/` exists, it is the project's committed memory layer: orient with `sdtk-wiki search "<topic>"` (entry points: `.sdtk/wiki/pages/_index.md`, the atlas summary) before falling back to repo-wide searching.
41
+ - If any `sdtk-*` CLI behaves unexpectedly (missing verbs, stale help, wrong version), run `sdtk doctor` to detect version fragmentation before debugging further.
32
42
 
33
43
  Do not read the entire historical session archive by default. Use `SDTK_SESSION_MEMORY_*.md` only when chronology or past acceptance details are required.
34
44
 
@@ -60,9 +70,11 @@ Use this compact matrix during intake so the agent picks the smallest sufficient
60
70
  | Formal feature delivery | `SDTK-SPEC` pipeline | PM -> BA -> ARCH -> DEV planning -> CODE handoff -> QA |
61
71
  | Build, fix, or refactor implementation | `SDTK-CODE` | code-brainstorm (when slice is ambiguous) -> start -> plan -> build -> verify -> ship |
62
72
  | Debug failure or unexpected behavior | `SDTK-CODE` debug | Root cause, bounded fix, regression verification |
73
+ | Screen/layout design, visual tokens, or prototype evidence before coding | `SDTK-DESIGN` | Reviewable screens/prototype plus a design handoff into SDTK-CODE |
63
74
  | Deployment, release, infra, or CI/CD work | `SDTK-OPS` | ops-plan -> ops-deploy/ops-incident/ops-monitor -> ops-verify |
64
75
  | Code review or spec review | Review / QA workflow | Findings, risks, blockers, acceptance signal |
65
76
  | Atlas graph build or viewer work | `sdtk-spec atlas` compatibility workflow or `sdtk-wiki atlas` for canonical SDTK-WIKI work | Local `.sdtk/atlas` compatibility graph or `.sdtk/wiki` SDTK-WIKI result |
77
+ | Question about existing project knowledge or docs | `sdtk-wiki search` (free) or `sdtk-wiki ask` when available | Grounded answer citing project pages before any repo-wide scan |
66
78
  | SDTK-WIKI Ask | `sdtk-wiki ask` | Grounded answer when `.sdtk/wiki/graph` plus `wiki.ask` entitlement/runtime preconditions are present, otherwise explicit blocker |
67
79
  | Existing project scan: project ingest, project refresh, or project audit | Matching premium project workflow | Project-local foundation, refresh, or audit result without overclaiming entitlement |
68
80
  | Multi-step durable workflow: 3+ dependent steps, human gates between steps, must survive a pause, or spans multiple lanes/sessions | Propose `sdtk-agent` orchestration (opt-in, token-aware, see the orchestration cost gate in section 5) | `.sdtk/agent-runtime/runs/<run_id>/` ledger plus `reports/final_report.md` |
@@ -165,7 +177,7 @@ Cross-cutting capabilities (not a linear lane; usable across every phase):
165
177
  - surface: `sdtk-agent run start|continue|status|report`, `gate approve|reject`, `workflow validate`, `adapter hermes-kanban plan`
166
178
  - use only when a workflow has 3+ dependent steps, needs human gates between steps, or must survive a pause; otherwise route straight to a lane
167
179
  - opt-in and token-aware: always propose-then-confirm before dispatch (see the orchestration cost gate in section 5)
168
- - the CLI is runtime-neutral and installs no skills; the engine is Free, and live external dispatch is not part of this release (hermes-kanban is dry-run only)
180
+ - the CLI is runtime-neutral and installs no skills; the engine is Free; the hermes-kanban adapter defaults to dry-run and live dispatch stays fail-closed behind explicit configuration plus per-run confirmation
169
181
 
170
182
  If the current project only has `SDTK-SPEC` runtime assets installed:
171
183
  - keep `/dev` bounded to planning and `CODE_HANDOFF`
@@ -186,7 +198,7 @@ If the current project only has `SDTK-SPEC` runtime assets installed:
186
198
  - For Codex runtimes: project-local skills require the explicit local `CODEX_HOME=<project>/.codex` contract; native `.codex/skills` auto-discovery is not claimed.
187
199
  - Use `ops-parallel` or `code-parallel` only for truly independent slices. If parallel dispatch is unavailable in the active runtime, execute them sequentially in one controller session.
188
200
  - `SDTK-AGENT` is runtime-neutral: it installs no skills and behaves identically on Claude and Codex. It is CLI-only, so do not invent a slash command for it.
189
- - The `sdtk-agent` hermes-kanban adapter is dry-run only in this release; it never calls a live gateway or creates a real card. Live dispatch is a future Pro capability, so do not claim it.
201
+ - The `sdtk-agent` hermes-kanban adapter defaults to dry-run. Live dispatch exists but is fail-closed behind explicit adapter configuration (`mode: live` plus `live_ack`) and a per-run `--confirm`, and it remains an attended, validation-gated capability. Never claim, enable, or attempt live dispatch on the user's behalf.
190
202
 
191
203
  ## 11) Discovery And PM Readiness
192
204
  - PM initiation starts only after `docs/discovery/REQUIREMENT_[FEATURE_KEY].md` is marked `READY_FOR_PM_INITIATION`.
@@ -1,80 +1,30 @@
1
1
  # CLAUDE.md
2
2
 
3
- Version: 2.3
4
- Last Updated: 2026-07-01
3
+ Version: 3.0
4
+ Last Updated: 2026-07-14
5
5
  Owner: SDTK-SPEC Core Team
6
6
 
7
- This file defines runtime guidance for Claude Code sessions in projects using the SDTK Suite.
7
+ Runtime adapter for Claude Code sessions in projects using the SDTK Suite. The full routing contract — lanes, intake protocol, intent-to-skill matrix, proceed-vs-ask rules, quality gates, orchestration cost gate — lives in `AGENTS.md` (single source). This file only adds what is specific to the Claude runtime.
8
8
 
9
+ <!-- SDTK:SHARED:BEGIN (keep byte-identical with the CODEX runtime adapter; the routing contract itself lives in AGENTS.md) -->
9
10
  ## 1) Rule Priority
10
11
  1. Explicit user request
11
- 2. `AGENTS.md` (project root)
12
- 3. Installed skill content (`.claude/skills/*/SKILL.md`)
13
- 4. This file (`CLAUDE.md`)
12
+ 2. `AGENTS.md` (project root) — the single source of the SDTK routing contract
13
+ 3. Installed skill content of the active runtime
14
+ 4. This runtime adapter file
14
15
  5. `sdtk-spec.config.json`
15
16
 
16
- ## 2) Runtime Model
17
- - Suite routing (lanes, by task intent):
18
- - `SDTK-SPEC`: orchestration, specs, planning, architecture, QA artifacts
19
- - `SDTK-DESIGN`: screen/layout design, visual tokens, prototype evidence, design handoff before coding
20
- - `SDTK-CODE`: implementation, bug fixing, refactoring, verification, ship flow; workflow `start->plan->build->verify->ship`; entry for ambiguous slices: `code-brainstorm`
21
- - `SDTK-OPS`: deploy, infra, CI/CD, monitoring, incident, ops verification
22
- - Cross-cutting capabilities (not a lane; usable across every phase):
23
- - `SDTK-WIKI`: memory layer — knowledge graph, docs view, grounded `sdtk-wiki ask`
24
- - `SDTK-AGENT`: orchestration layer — a durable, file-driven DAG controller above `sdtk-code` agent-team; chains multi-step runs with human gates. CLI-only (installs no skills, no slash command). Opt-in and token-aware: a run can spawn many sub-agents, so always propose-then-confirm before dispatch; never auto-start a run. See the orchestration cost gate in `AGENTS.md`.
25
- - Default unprefixed entry point: Orchestrator Intake.
26
- - Orchestrator classifies the user request before selecting a role, product lane, or skill.
27
- - `SDTK-SPEC` phase workflow remains: PM -> BA -> ARCH -> DEV -> QA after intake decides formal feature delivery is ready.
28
- - Entry point command: `/orchestrator` (recommended). Use `/pm` only for formal product initiation.
29
- - Role commands: `/pm`, `/ba`, `/arch`, `/dev`, `/qa`
30
- - Sub-skill commands: `/api-doc`, `/api-design-spec`, `/screen-design-spec`, `/design-layout`, `/test-case-spec`, `/dev-backend`, `/dev-frontend`
31
- - SDTK-CODE workflow commands: `start`, `plan`, `build`, `verify`, `ship`
32
- - Shared state files:
33
- - `SHARED_PLANNING.md`
34
- - `QUALITY_CHECKLIST.md`
17
+ ## 2) Session Contract
18
+ 1. Read `AGENTS.md` first and follow its Session Bootstrap Protocol (section 2) — including `.sdtk/evolve/LEARNED.md`, the `.sdtk/wiki` memory-layer orientation, and the active `sdtk-agent` run check.
19
+ 2. Default unprefixed entry point is Orchestrator Intake: classify intent, then route with the Intent-To-Skill matrix (`AGENTS.md` section 4) and the Proceed-Vs-Ask rules (section 5), always choosing the smallest sufficient workflow.
20
+ 3. Raw ideas go through `docs/discovery/REQUIREMENT_[FEATURE_KEY].md`; PM initiation starts only at `READY_FOR_PM_INITIATION`. Use `NEEDS_MORE_DISCOVERY` or `NOT_ACTIONABLE_YET` when the request is not ready.
21
+ 4. `sdtk-agent` orchestration is opt-in and token-aware behind the cost gate (`AGENTS.md` section 5.1): propose-then-confirm, never auto-start a run.
22
+ 5. Route only to products whose runtime assets are installed; do not overclaim (`AGENTS.md` sections 8 and 10).
23
+ 6. If any `sdtk-*` CLI behaves unexpectedly (missing verbs, stale help, wrong version), run `sdtk doctor` before debugging further.
24
+ <!-- SDTK:SHARED:END -->
35
25
 
36
- ## 2.1) Claude Session Start Checklist
37
- Read these in order when they exist:
38
- 1. `AGENTS.md`
39
- 2. `.sdtk/evolve/LEARNED.md` — locally learned, owner-approved lessons (managed by `/evolve` + `sdtk evolve`; never edit it directly)
40
- 3. `governance/ai/session/SDTK_ACTIVE_BOOTSTRAP.md`
41
- 4. `governance/ai/session/SDTK_AGENT_WORKING_RULES.md`
42
- 5. issue-specific controller spec and implementation plan
43
-
44
- Routing rules:
45
- - Raw idea -> brainstorm / requirement clarification, then create or update `docs/discovery/REQUIREMENT_[FEATURE_KEY].md` before PM initiation
46
- - Formal feature delivery and approved planning work -> `SDTK-SPEC`
47
- - build feature, fix code, refactor, or debug failure -> `SDTK-CODE` when available; use `code-brainstorm` when the slice is ambiguous
48
- - deploy/release/infra/ops -> `SDTK-OPS` when available
49
- - Atlas graph/viewer, SDTK-WIKI Ask boundary, project ingest, project refresh, and project audit -> matching SDTK command or workflow
50
- - "what should we do next" -> Orchestrator state review using the smallest sufficient workflow
51
-
52
- Active orchestration check:
53
- - If `.sdtk/agent-runtime/runs/` holds a run whose state is not terminal (`running` or `waiting_for_approval`), surface it in one line (run id plus the blocking gate, if any) and offer `sdtk-agent run continue` before starting unrelated work.
54
-
55
- Proceed-vs-ask summary:
56
- - Ask clarification when the outcome is ambiguous, the target path/repo is missing, there is no acceptance boundary for implementation, the next step could mutate external state, or the next step would spawn multiple sub-agents / incur significant token cost (such as dispatching an `sdtk-agent` run).
57
- - Proceed when intent and target are clear, the task is read-only analysis, the plan/spec is already approved, or the change is bounded and verifiable.
58
-
59
- If only SPEC runtime assets are installed:
60
- - keep `/dev` bounded to planning and `CODE_HANDOFF`
61
- - do not claim that SDTK-CODE or SDTK-OPS runtime assets are already installed
62
-
63
- Discovery artifact rule:
64
- - PM initiation starts only after `docs/discovery/REQUIREMENT_[FEATURE_KEY].md` is marked `READY_FOR_PM_INITIATION`.
65
- - Use `NEEDS_MORE_DISCOVERY` or `NOT_ACTIONABLE_YET` when the request is not ready.
66
- - The discovery artifact is a pre-PM clarification bridge, not a PRD or BA replacement.
67
-
68
- ## 3) Minimal Session Flow
69
- 1. Start with Orchestrator Intake unless the user explicitly selects a role.
70
- 2. Classify intent and choose the smallest sufficient SDTK workflow.
71
- 3. For raw ideas, finish discovery and readiness in `docs/discovery/REQUIREMENT_[FEATURE_KEY].md` before PM initiation.
72
- 4. For formal feature delivery, move PM -> BA -> ARCH -> DEV -> QA without skipping gates.
73
- 5. Keep traceability from requirements to design, implementation, and tests.
74
- 6. Require code review completion before QA release decision.
75
-
76
- ## 4) Installed Skills
77
- Skills are installed at `.claude/skills/` and provide slash commands:
26
+ ## 3) Claude Runtime Specifics
27
+ Skills are installed at `.claude/skills/` and surface as slash commands. Rows apply only when the owning kit's runtime assets are installed:
78
28
 
79
29
  | Command | Purpose |
80
30
  |---------|---------|
@@ -82,7 +32,7 @@ Skills are installed at `.claude/skills/` and provide slash commands:
82
32
  | `/pm` | PM initiation + planning |
83
33
  | `/ba` | Business analysis |
84
34
  | `/arch` | Solution architecture |
85
- | `/dev` | Development + code review |
35
+ | `/dev` | Development planning + code handoff |
86
36
  | `/qa` | QA testing + release decision |
87
37
  | `/api-doc` | OpenAPI YAML + flow diagrams |
88
38
  | `/api-design-spec` | API design detail spec |
@@ -98,9 +48,9 @@ Specialist rule reference files are installed inside each skill directory when t
98
48
 
99
49
  `sdtk-agent` is CLI-only: it installs no skill and has no slash command. Drive it through the `sdtk-agent` CLI (`run start|continue|status|report`, `gate approve|reject`, `workflow validate`), never a `/agent` command.
100
50
 
101
- ## 5) References
51
+ ## 4) References
52
+ - `AGENTS.md` (routing contract — single source)
102
53
  - `sdtk-spec.config.json`
103
54
  - `governance/ai/session/SDTK_ACTIVE_BOOTSTRAP.md`
104
55
  - `governance/ai/session/SDTK_AGENT_WORKING_RULES.md`
105
- - `governance/ai/core/SDTK_WORKSPACE_LAYOUT_CONTRACT.md`
106
56
  - `.claude/skills/<skill>/references/` (skill-local rule files when required)
@@ -1,79 +1,36 @@
1
1
  # CODEX.md
2
2
 
3
- Version: 1.3
4
- Last Updated: 2026-07-01
3
+ Version: 2.0
4
+ Last Updated: 2026-07-14
5
5
  Owner: SDTK-SPEC Core Team
6
6
 
7
- This file defines runtime guidance for Codex sessions in projects using the SDTK Suite.
7
+ Runtime adapter for Codex sessions in projects using the SDTK Suite. The full routing contract — lanes, intake protocol, intent-to-skill matrix, proceed-vs-ask rules, quality gates, orchestration cost gate — lives in `AGENTS.md` (single source). This file only adds what is specific to the Codex runtime.
8
8
 
9
+ <!-- SDTK:SHARED:BEGIN (keep byte-identical with the CODEX runtime adapter; the routing contract itself lives in AGENTS.md) -->
9
10
  ## 1) Rule Priority
10
11
  1. Explicit user request
11
- 2. `AGENTS.md` (project root)
12
- 3. `toolkit/AGENTS.md`
13
- 4. This file (`CODEX.md`)
14
- 5. Other supporting docs
15
-
16
- ## 2) Runtime Model
17
- - Suite routing (lanes, by task intent):
18
- - `SDTK-SPEC`: orchestration, specs, planning, architecture, QA artifacts
19
- - `SDTK-DESIGN`: screen/layout design, visual tokens, prototype evidence, design handoff before coding
20
- - `SDTK-CODE`: implementation, bug fixing, refactoring, verification, ship flow; workflow `start->plan->build->verify->ship`; entry for ambiguous slices: `code-brainstorm`
21
- - `SDTK-OPS`: deploy, infra, CI/CD, monitoring, incident, ops verification
22
- - Cross-cutting capabilities (not a lane; usable across every phase):
23
- - `SDTK-WIKI`: memory layer — knowledge graph, docs view, grounded `sdtk-wiki ask`
24
- - `SDTK-AGENT`: orchestration layer — a durable, file-driven DAG controller above `sdtk-code` agent-team; chains multi-step runs with human gates. Runtime-neutral and CLI-only (installs no skills, no slash command). Opt-in and token-aware: a run can spawn many sub-agents, so always propose-then-confirm before dispatch; never auto-start a run. See the orchestration cost gate in `AGENTS.md`.
25
- - Default unprefixed entry point: Orchestrator Intake.
26
- - Orchestrator classifies the user request before selecting a role, product lane, or skill.
27
- - `SDTK-SPEC` phase workflow remains: PM -> BA -> ARCH -> DEV -> QA after intake decides formal feature delivery is ready.
28
- - Role tags: `/pm`, `/ba`, `/arch`, `/dev`, `/qa`
29
- - SDTK-CODE workflow: `start -> plan -> build -> verify -> ship`
30
- - Shared state files:
31
- - `SHARED_PLANNING.md`
32
- - `QUALITY_CHECKLIST.md`
33
-
34
- ## 2.1) Codex Session Start Checklist
35
- Read these in order when they exist:
36
- 1. `AGENTS.md`
37
- 2. `.sdtk/evolve/LEARNED.md` — locally learned, owner-approved lessons (managed by the `sdtk-evolve` skill + `sdtk evolve`; never edit it directly)
38
- 3. `governance/ai/session/SDTK_ACTIVE_BOOTSTRAP.md`
39
- 4. `governance/ai/session/SDTK_AGENT_WORKING_RULES.md`
40
- 5. issue-specific controller spec and implementation plan
41
-
42
- Routing rules:
43
- - Raw idea -> brainstorm / requirement clarification, then create or update `docs/discovery/REQUIREMENT_[FEATURE_KEY].md` before PM initiation
44
- - Formal feature delivery and approved planning work -> `SDTK-SPEC`
45
- - build feature, fix code, refactor, or debug failure -> `SDTK-CODE` when available; use `code-brainstorm` when the slice is ambiguous
46
- - deploy/release/infra/ops -> `SDTK-OPS` when available
47
- - Atlas graph/viewer, SDTK-WIKI Ask boundary, project ingest, project refresh, and project audit -> matching SDTK command or workflow
48
- - "what should we do next" -> Orchestrator state review using the smallest sufficient workflow
49
-
50
- Active orchestration check:
51
- - If `.sdtk/agent-runtime/runs/` holds a run whose state is not terminal (`running` or `waiting_for_approval`), surface it in one line (run id plus the blocking gate, if any) and offer `sdtk-agent run continue` before starting unrelated work.
52
-
53
- Proceed-vs-ask summary:
54
- - Ask clarification when the outcome is ambiguous, the target path/repo is missing, there is no acceptance boundary for implementation, the next step could mutate external state, or the next step would spawn multiple sub-agents / incur significant token cost (such as dispatching an `sdtk-agent` run).
55
- - Proceed when intent and target are clear, the task is read-only analysis, the plan/spec is already approved, or the change is bounded and verifiable.
56
-
57
- If only SPEC runtime assets are installed:
58
- - keep `/dev` bounded to planning and `CODE_HANDOFF`
59
- - do not claim that SDTK-CODE or SDTK-OPS runtime assets are already installed
60
-
61
- Discovery artifact rule:
62
- - PM initiation starts only after `docs/discovery/REQUIREMENT_[FEATURE_KEY].md` is marked `READY_FOR_PM_INITIATION`.
63
- - Use `NEEDS_MORE_DISCOVERY` or `NOT_ACTIONABLE_YET` when the request is not ready.
64
- - The discovery artifact is a pre-PM clarification bridge, not a PRD or BA replacement.
65
-
66
- ## 3) Minimal Session Flow
67
- 1. Start with Orchestrator Intake unless the user explicitly selects a role.
68
- 2. Classify intent and choose the smallest sufficient SDTK workflow.
69
- 3. For raw ideas, finish discovery and readiness in `docs/discovery/REQUIREMENT_[FEATURE_KEY].md` before PM initiation.
70
- 4. For formal feature delivery, move PM -> BA -> ARCH -> DEV -> QA without skipping gates.
71
- 5. Keep traceability from requirements to design, implementation, and tests.
72
- 6. Require code review completion before QA release decision.
12
+ 2. `AGENTS.md` (project root) — the single source of the SDTK routing contract
13
+ 3. Installed skill content of the active runtime
14
+ 4. This runtime adapter file
15
+ 5. `sdtk-spec.config.json`
16
+
17
+ ## 2) Session Contract
18
+ 1. Read `AGENTS.md` first and follow its Session Bootstrap Protocol (section 2) — including `.sdtk/evolve/LEARNED.md`, the `.sdtk/wiki` memory-layer orientation, and the active `sdtk-agent` run check.
19
+ 2. Default unprefixed entry point is Orchestrator Intake: classify intent, then route with the Intent-To-Skill matrix (`AGENTS.md` section 4) and the Proceed-Vs-Ask rules (section 5), always choosing the smallest sufficient workflow.
20
+ 3. Raw ideas go through `docs/discovery/REQUIREMENT_[FEATURE_KEY].md`; PM initiation starts only at `READY_FOR_PM_INITIATION`. Use `NEEDS_MORE_DISCOVERY` or `NOT_ACTIONABLE_YET` when the request is not ready.
21
+ 4. `sdtk-agent` orchestration is opt-in and token-aware behind the cost gate (`AGENTS.md` section 5.1): propose-then-confirm, never auto-start a run.
22
+ 5. Route only to products whose runtime assets are installed; do not overclaim (`AGENTS.md` sections 8 and 10).
23
+ 6. If any `sdtk-*` CLI behaves unexpectedly (missing verbs, stale help, wrong version), run `sdtk doctor` before debugging further.
24
+ <!-- SDTK:SHARED:END -->
25
+
26
+ ## 3) Codex Runtime Specifics
27
+ - Project-local skills require the explicit local runtime home contract: launch Codex with `CODEX_HOME=<project>/.codex`. Native `.codex/skills` auto-discovery is not claimed.
28
+ - Roles are addressed with message prefixes (`/pm`, `/ba`, `/arch`, `/dev`, `/qa`, `/orchestrator`) interpreted per `AGENTS.md` section 7 — they are role tags in the message, not installed slash commands.
29
+ - SDTK-CODE workflow phases (`start -> plan -> build -> verify -> ship`) and specialist skills apply as described in `AGENTS.md` section 8 when the owning kit's runtime assets are installed.
30
+ - `sdtk-agent` is CLI-only and runtime-neutral: drive it through the `sdtk-agent` CLI (`run start|continue|status|report`, `gate approve|reject`, `workflow validate`); it behaves identically on Claude and Codex.
73
31
 
74
32
  ## 4) References
75
- - `toolkit/SDTK_TOOLKIT.md`
76
- - `toolkit/AGENTS.md`
33
+ - `AGENTS.md` (routing contract — single source)
34
+ - `sdtk-spec.config.json`
77
35
  - `governance/ai/session/SDTK_ACTIVE_BOOTSTRAP.md`
78
36
  - `governance/ai/session/SDTK_AGENT_WORKING_RULES.md`
79
- - `sdtk-spec.config.json`
@@ -1,7 +1,8 @@
1
1
  {
2
+ "schemaVersion": 1,
2
3
  "docs": {
3
4
  "artifactsLanguage": "EN",
4
- "guidanceLanguage": "VI",
5
+ "guidanceLanguage": "EN",
5
6
  "preserveOriginalInput": true,
6
7
  "appendixIncludeEnglishTranslation": true,
7
8
  "aiPeerReviewAllowed": true
@@ -1,5 +1,26 @@
1
1
  {
2
2
  "profiles": {
3
+ "php-laravel": {
4
+ "orchestration": {
5
+ "apiDesignDetailMode": "auto",
6
+ "testCaseSpecMode": "auto"
7
+ },
8
+ "stack": {
9
+ "backend": "PHP 8.3 + Laravel 11",
10
+ "frontend": "Blade + Vite (or Livewire)",
11
+ "mobile": "N/A",
12
+ "database": "MySQL 8",
13
+ "auth": "Laravel Sanctum"
14
+ },
15
+ "commands": {
16
+ "backendTests": "php artisan test",
17
+ "backendTypecheck": "vendor/bin/phpstan analyse",
18
+ "backendLint": "vendor/bin/pint --test",
19
+ "frontendTests": "npm run test",
20
+ "frontendLint": "npm run lint",
21
+ "e2eTests": "npm run e2e"
22
+ }
23
+ },
3
24
  "django-react": {
4
25
  "orchestration": {
5
26
  "apiDesignDetailMode": "auto",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sdtk-evolve
3
- description: "Local self-improvement loop for SDTK (BK-316). Harvest the operator's own past agent sessions for recurring friction, score adopted lessons by recurrence, and stage at most 4 bounded, evidence-backed lesson edits to .sdtk/evolve/LEARNED.md for explicit human adoption. Use at the end of a substantial work session, when the same correction keeps repeating, or when the operator asks to evolve/learn from this."
3
+ description: "Local self-improvement loop for SDTK. Harvest your own past agent sessions for recurring friction and stage at most 4 bounded, evidence-backed lesson edits to .sdtk/evolve/LEARNED.md for explicit human adoption. Use at the end of a substantial session or when the same correction keeps repeating."
4
4
  ---
5
5
 
6
6
  # SDTK Evolve — learn from your own sessions, behind a human gate
@@ -63,5 +63,5 @@ Every turn produced while executing this skill is part of an evolve cycle. Begin
63
63
  ## Runtime Entrypoint Truth (Codex)
64
64
  - Project-local Codex support is bounded to explicit `CODEX_HOME=<project>/.codex`; presence of `sdtk-evolve` under `.codex/skills` does not prove direct built-in exposure. Invoke via "Use the sdtk-evolve skill." when no direct syntax is validated.
65
65
 
66
- ## Effectiveness discipline (BK-316 §8)
66
+ ## Effectiveness discipline
67
67
  The loop measures itself: recurrence verdicts are the metric, FAILING lessons get culled, and `sdtk evolve status` reminds the operator when the dogfood checkpoint (4 weeks / 20 sessions) is due. Never claim a lesson "works" without the recurrence evidence — flat/noisy results are reported as exactly that.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: evolve
3
- description: Local self-improvement loop for SDTK (BK-316). Harvest the operator's own past agent sessions for recurring friction, score adopted lessons by recurrence, and stage at most 4 bounded, evidence-backed lesson edits to .sdtk/evolve/LEARNED.md for explicit human adoption. Use at the end of a substantial work session, when the same correction keeps repeating, or when the operator asks to "evolve"/"learn from this".
3
+ description: "Local self-improvement loop for SDTK. Harvest your own past agent sessions for recurring friction and stage at most 4 bounded, evidence-backed lesson edits to .sdtk/evolve/LEARNED.md for explicit human adoption. Use at the end of a substantial session or when the same correction keeps repeating."
4
4
  ---
5
5
 
6
6
  # SDTK Evolve — learn from your own sessions, behind a human gate
@@ -60,5 +60,5 @@ Every turn produced while executing this skill is part of an evolve cycle. Begin
60
60
  - It is **not** yours to edit directly, not a scratchpad, not a place for secrets or project data — lessons are about *how to work*, not *what the code is*.
61
61
  - Git posture is the operator's choice (commit to share with a team, ignore for personal habits); `sdtk evolve status` shows the current posture.
62
62
 
63
- ## Effectiveness discipline (BK-316 §8)
63
+ ## Effectiveness discipline
64
64
  The loop measures itself: recurrence verdicts are the metric, FAILING lessons get culled, and `sdtk evolve status` reminds the operator when the dogfood checkpoint (4 weeks / 20 sessions) is due. Never claim a lesson "works" without the recurrence evidence — flat/noisy results are reported as exactly that.
@@ -74,7 +74,8 @@
74
74
  | 4 | Test obligations are explicit enough for downstream verification | [ ] Pending | Dev Agent | | |
75
75
  | 5 | Readiness decision is explicit (`READY_FOR_SDTK_CODE` or `BLOCKED_FOR_SDTK_CODE`) | [ ] Pending | Dev Agent | | |
76
76
  | 6 | `CODE_HANDOFF_[FEATURE_KEY].json` generated or validated successfully | [ ] Pending | Dev Agent | | |
77
- | **7** | **DEV READY FOR SDTK-CODE** | [ ] Pending | **Dev Gate** | **If ready: suggest `sdtk-code start ...`; if blocked: keep blockers visible** | |
77
+ | 7 | `sdtk-spec config check` passes (no UPDATE_ME placeholders - stack/test commands are real) | [ ] Pending | Dev Agent | Run `sdtk-spec config apply-profile <name>` if unfilled | |
78
+ | **8** | **DEV READY FOR SDTK-CODE** | [ ] Pending | **Dev Gate** | **If ready: suggest `sdtk-code start ...`; if blocked: keep blockers visible** | |
78
79
 
79
80
  ---
80
81
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdtk-spec-kit",
3
- "version": "0.7.0",
3
+ "version": "0.8.1",
4
4
  "description": "SDTK-SPEC CLI toolkit for deterministic software documentation workflows via the sdtk-spec command",
5
5
  "bin": {
6
6
  "sdtk-spec": "bin/sdtk.js"
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+
3
+ // `sdtk-spec config` — project configuration helpers (BK-344).
4
+ //
5
+ // C-1: the profiles example shipped with zero code consumers — users had to
6
+ // hand-copy JSON blocks. C-3: UPDATE_ME placeholders had no enforcement, so
7
+ // delivery gates could run with literal "UPDATE_ME: ..." as a test command.
8
+
9
+ const fs = require("fs");
10
+ const path = require("path");
11
+ const { ValidationError } = require("../lib/errors");
12
+
13
+ const CONFIG_FILE = "sdtk-spec.config.json";
14
+ const PROFILES_FILE = "sdtk-spec.config.profiles.example.json";
15
+
16
+ // String values that mean "this was never filled in".
17
+ const PLACEHOLDER_PATTERNS = [/UPDATE_ME/, /^Set your /];
18
+
19
+ const HELP = `sdtk-spec config — project configuration helpers
20
+
21
+ Usage:
22
+ sdtk-spec config apply-profile <name> [--project-path <path>] [--json]
23
+ sdtk-spec config check [--project-path <path>] [--json]
24
+
25
+ Subcommands:
26
+ apply-profile <name> Merge a stack profile from ${PROFILES_FILE}
27
+ into ${CONFIG_FILE}. Overwrites the profile-owned
28
+ sections (orchestration, stack, commands) while
29
+ preserving docs, schemaVersion, and stack.detection.
30
+ check Scan ${CONFIG_FILE} for unfilled placeholders
31
+ (UPDATE_ME / "Set your ..."). Exits 1 when any
32
+ remain — wire it into delivery gates.
33
+
34
+ Flags:
35
+ --project-path <path> Project root containing ${CONFIG_FILE} (default: cwd)
36
+ --json Machine-readable output
37
+ `;
38
+
39
+ function parseFlags(args) {
40
+ const flags = { projectPath: process.cwd(), json: false, help: false, positional: [] };
41
+ for (let i = 0; i < args.length; i++) {
42
+ const a = args[i];
43
+ if (a === "--help" || a === "-h") {
44
+ flags.help = true;
45
+ } else if (a === "--project-path") {
46
+ const value = args[++i];
47
+ if (!value) throw new ValidationError("--project-path requires a value");
48
+ flags.projectPath = path.resolve(value);
49
+ } else if (a === "--json") {
50
+ flags.json = true;
51
+ } else if (a.startsWith("--")) {
52
+ throw new ValidationError(`Unknown flag for "config": ${a}. Run "sdtk-spec config --help".`);
53
+ } else {
54
+ flags.positional.push(a);
55
+ }
56
+ }
57
+ return flags;
58
+ }
59
+
60
+ function readJson(filePath, label) {
61
+ if (!fs.existsSync(filePath)) {
62
+ throw new ValidationError(`${label} not found: ${filePath}`);
63
+ }
64
+ try {
65
+ return JSON.parse(fs.readFileSync(filePath, "utf8"));
66
+ } catch (err) {
67
+ throw new ValidationError(`${label} is not valid JSON: ${filePath} (${err.message})`);
68
+ }
69
+ }
70
+
71
+ function isPlaceholder(value) {
72
+ return typeof value === "string" && PLACEHOLDER_PATTERNS.some((re) => re.test(value));
73
+ }
74
+
75
+ function collectPlaceholders(node, trail, findings) {
76
+ if (typeof node === "string") {
77
+ if (isPlaceholder(node)) findings.push({ path: trail.join("."), value: node });
78
+ return;
79
+ }
80
+ if (Array.isArray(node)) {
81
+ node.forEach((item, i) => collectPlaceholders(item, trail.concat(String(i)), findings));
82
+ return;
83
+ }
84
+ if (node && typeof node === "object") {
85
+ for (const [key, value] of Object.entries(node)) {
86
+ collectPlaceholders(value, trail.concat(key), findings);
87
+ }
88
+ }
89
+ }
90
+
91
+ function cmdApplyProfile(flags) {
92
+ const name = flags.positional[0];
93
+ if (!name) {
94
+ throw new ValidationError('config apply-profile requires a profile name. Run "sdtk-spec config --help".');
95
+ }
96
+ const configPath = path.join(flags.projectPath, CONFIG_FILE);
97
+ const profilesPath = path.join(flags.projectPath, PROFILES_FILE);
98
+ const config = readJson(configPath, "Project config");
99
+ const profilesDoc = readJson(profilesPath, "Config profiles file");
100
+ const profiles = profilesDoc.profiles || {};
101
+ const available = Object.keys(profiles);
102
+ if (!Object.prototype.hasOwnProperty.call(profiles, name)) {
103
+ throw new ValidationError(
104
+ `Unknown profile "${name}". Available profiles: ${available.join(", ") || "(none)"}`
105
+ );
106
+ }
107
+ const profile = profiles[name];
108
+
109
+ // The profile owns orchestration/stack/commands; everything else in the
110
+ // config (docs, schemaVersion, unknown future keys) is preserved.
111
+ // stack.detection is detector-owned state and always survives.
112
+ const detection = config.stack && config.stack.detection ? config.stack.detection : undefined;
113
+ if (profile.orchestration) config.orchestration = { ...config.orchestration, ...profile.orchestration };
114
+ if (profile.stack) config.stack = { ...profile.stack };
115
+ if (detection !== undefined) {
116
+ config.stack = config.stack || {};
117
+ config.stack.detection = detection;
118
+ }
119
+ if (profile.commands) config.commands = { ...profile.commands };
120
+
121
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n", "utf8");
122
+
123
+ const findings = [];
124
+ collectPlaceholders(config, [], findings);
125
+ if (flags.json) {
126
+ console.log(JSON.stringify({ ok: true, profile: name, remainingPlaceholders: findings.length }, null, 2));
127
+ } else {
128
+ console.log(`Applied profile "${name}" to ${configPath}`);
129
+ console.log(` stack.detection: ${detection !== undefined ? "preserved" : "not present"}`);
130
+ console.log(` remaining placeholders: ${findings.length}`);
131
+ if (findings.length > 0) {
132
+ console.log(' Run "sdtk-spec config check" to list them.');
133
+ }
134
+ }
135
+ return 0;
136
+ }
137
+
138
+ function cmdCheck(flags) {
139
+ const configPath = path.join(flags.projectPath, CONFIG_FILE);
140
+ const config = readJson(configPath, "Project config");
141
+ const findings = [];
142
+ collectPlaceholders(config, [], findings);
143
+ const ok = findings.length === 0;
144
+ if (flags.json) {
145
+ console.log(JSON.stringify({ ok, findings }, null, 2));
146
+ } else if (ok) {
147
+ console.log(`OK — ${CONFIG_FILE} has no unfilled placeholders.`);
148
+ } else {
149
+ console.log(`${findings.length} unfilled placeholder(s) in ${configPath}:`);
150
+ for (const f of findings) {
151
+ console.log(` - ${f.path}: ${f.value}`);
152
+ }
153
+ console.log('Fill them (or run "sdtk-spec config apply-profile <name>") before running delivery gates.');
154
+ }
155
+ return ok ? 0 : 1;
156
+ }
157
+
158
+ function cmdConfig(args) {
159
+ const flags = parseFlags(args);
160
+ const sub = flags.positional.shift();
161
+ if (flags.help || !sub) {
162
+ console.log(HELP);
163
+ return 0;
164
+ }
165
+ switch (sub) {
166
+ case "apply-profile":
167
+ return cmdApplyProfile(flags);
168
+ case "check":
169
+ return cmdCheck(flags);
170
+ default:
171
+ throw new ValidationError(`Unknown config subcommand: "${sub}". Run "sdtk-spec config --help".`);
172
+ }
173
+ }
174
+
175
+ module.exports = { cmdConfig };
@@ -17,6 +17,14 @@ function cmdHelp() {
17
17
  " entitlement Inspect local entitlement and capability state",
18
18
  " generate Create the standard 17-file feature scaffold from templates",
19
19
  " analyze Preserve requirement source, bootstrap scaffold, and create an agent task packet",
20
+ " config Project config helpers: apply a stack profile, check for unfilled placeholders",
21
+ "",
22
+ "Config subcommands:",
23
+ " sdtk-spec config apply-profile <name> [--project-path <path>] [--json]",
24
+ " sdtk-spec config check [--project-path <path>] [--json]",
25
+ " apply-profile merges a profile from sdtk-spec.config.profiles.example.json into",
26
+ " sdtk-spec.config.json (orchestration/stack/commands), preserving docs, schemaVersion,",
27
+ " and stack.detection. check exits 1 while UPDATE_ME placeholders remain — wire it into gates.",
20
28
  "",
21
29
  "Init options:",
22
30
  " --runtime <codex|claude> Runtime adapter (default: codex)",
@@ -129,6 +129,19 @@ async function cmdInit(args) {
129
129
  if (s.unknown.length) {
130
130
  console.log(` Could not detect (please set manually): ${s.unknown.join(", ")}.`);
131
131
  }
132
+ // BK-346: close the loop from detection into a gate-ready config.
133
+ const profileHint = d.framework === "laravel" || d.language === "php"
134
+ ? "php-laravel"
135
+ : d.framework === "django"
136
+ ? "django-react"
137
+ : d.framework === "nextjs" || d.framework === "next"
138
+ ? "node-nextjs"
139
+ : null;
140
+ if (profileHint) {
141
+ console.log(` Tip: run "sdtk-spec config apply-profile ${profileHint}" to fill stack + gate commands, then verify with "sdtk-spec config check".`);
142
+ } else {
143
+ console.log(' Tip: fill the remaining values with "sdtk-spec config apply-profile <name>" (see sdtk-spec.config.profiles.example.json), then verify with "sdtk-spec config check".');
144
+ }
132
145
  console.log("");
133
146
  }
134
147
 
package/src/index.js CHANGED
@@ -11,6 +11,7 @@ const { cmdRuntime } = require("./commands/runtime");
11
11
  const { cmdUpdate } = require("./commands/update");
12
12
  const { cmdAtlas } = require("./commands/atlas");
13
13
  const { cmdProject } = require("./commands/project");
14
+ const { cmdConfig } = require("./commands/config");
14
15
  const { ValidationError, CliError } = require("./lib/errors");
15
16
 
16
17
  function getVersion() {
@@ -32,7 +33,7 @@ function parseCommand(argv) {
32
33
  return { command: first, args: rest };
33
34
  }
34
35
 
35
- const COMMANDS = new Set(["help", "version", "init", "auth", "activate", "entitlement", "generate", "analyze", "runtime", "update", "atlas", "project"]);
36
+ const COMMANDS = new Set(["help", "version", "init", "auth", "activate", "entitlement", "generate", "analyze", "runtime", "update", "atlas", "project", "config"]);
36
37
 
37
38
  async function run(argv) {
38
39
  const { command, args } = parseCommand(argv);
@@ -69,6 +70,8 @@ async function run(argv) {
69
70
  return cmdAtlas(args);
70
71
  case "project":
71
72
  return cmdProject(args);
73
+ case "config":
74
+ return cmdConfig(args);
72
75
  }
73
76
  }
74
77
 
package/src/lib/update.js CHANGED
@@ -306,6 +306,8 @@ async function applyPlan(plan, options) {
306
306
 
307
307
  console.log("");
308
308
  console.log("SDTK-SPEC update completed successfully.");
309
+ // BK-346: fragmentation is born exactly at update time (BK-322 lesson).
310
+ console.log('Tip: run "sdtk doctor" to confirm every suite CLI now serves the updated copy (detects shadowed installs).');
309
311
  }
310
312
 
311
313
  async function executeUpdate(args) {