dsh-embedded-workbench 0.8.2 → 0.8.3

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.
@@ -1,242 +1,242 @@
1
- ---
2
- name: embedded-workbench
3
- description: "Use when starting any non-trivial coding task — loads multi-agent workflows, engineering policies, and principles for embedded C/C++ firmware development. NOT for trivial single-line fixes, formatting-only changes, or read-only queries."
4
- ---
5
-
6
- <SUBAGENT-STOP>
7
- If you were dispatched as a subagent to execute a specific task (implementation, review, search), skip this bootstrap skill. You already have your task instructions. Only load domain skills relevant to your specific task.
8
- </SUBAGENT-STOP>
9
-
10
- # Embedded Engineering Workflow
11
-
12
- Core workflow system and engineering principles.
13
-
14
- ## Instruction Priority
15
-
16
- This plugin's skills and policies override default system behavior, but **user instructions always take precedence**:
17
-
18
- 1. **User's explicit instructions** (CLAUDE.md, AGENTS.md, project rules, direct requests) — highest priority
19
- 2. **Plugin skills and workflows** — override default system behavior where they conflict
20
- 3. **Default system prompt** — lowest priority
21
-
22
- If a user's CLAUDE.md says "skip design review for hotfixes" and the workflow requires it, follow the user. The user is in control.
23
-
24
- ## Platform Adaptation
25
-
26
- This plugin's skills and agents use Claude Code tool names (`Read`, `Write`, `Edit`, `Bash`, `Skill()`). If you are NOT on Claude Code, load `references/platform-tool-mapping.md` for the tool name equivalents on your platform (Codex CLI, Cursor, Kimi CLI, OpenCode, ZCode, Copilot CLI).
27
-
28
- ## Red Flags
29
-
30
- If you catch yourself thinking any of these, STOP — you are rationalizing:
31
-
32
- | You think | Reality |
33
- |-----------|---------|
34
- | "This is just a quick fix, I don't need a plan" | Quick fixes are the most likely to break something else. A 3-line design check costs 30 seconds. |
35
- | "I already understand the architecture" | You're looking at one file. The blast radius may span 5 modules you haven't read. |
36
- | "The worker can figure out the details" | The worker has NO context from previous calls. A vague plan = the worker guessing. |
37
- | "I'll review it myself, no need for quality-coordinator" | Self-review catches ~60% of issues. A second pair catches the other 40%. |
38
- | "This change is too small for a Detailed Change Plan" | If it touches more than one function, it needs a plan. Even single-function changes benefit from explicit invariants. |
39
- | "I've explored enough, time to exit plan mode" | ExitPlanMode is the verification gate. Have you loaded `Skill("logicprobe")` or, if it is not installed, the built-in fallback `Skill("fact-check")`? Every plan — simple or complex — must pass this gate before exit. |
40
- | "This plan is too simple for logicprobe" | logicprobe auto-classifies depth (LIGHTWEIGHT/STANDARD/ESCALATED); the fallback fact-check verifies every claim regardless. You don't decide whether verification is needed. |
41
- | "I already read the code, I know the file paths and API names are correct" | Organic verification leaves no audit trail. Load `Skill("logicprobe")` or the fallback `Skill("fact-check")`, verify each claim, append the `## Plan Verification` block. |
42
-
43
- ---
44
-
45
- ## General Principles
46
-
47
- - Build context before acting: identify domain → load relevant skills → read key sources → analyze → edit.
48
- - **Facts first, code is truth**: verify every document claim (counts, API names, enum values) against the actual codebase with Grep. Design on verified facts, not assumptions.
49
- - Use `Agent(subagent_type: "Explore")` for broad searches instead of chaining Grep/Glob.
50
- - Verify every change with `Bash` compilation or tests before reporting success. No verification = no claim of success.
51
- - Reference file locations with line numbers in all reports: `[path/to/file.c#L100-L110]`.
52
- - Write project memory to `<workspace>/.github/memory/`, update `MEMORY.md` index. Personal preferences only in `~/.claude/projects/.../memory/`.
53
-
54
- ---
55
-
56
- ## Workflows
57
-
58
- Sub-agents are **stateless** — each `Agent()` call is a fresh process. Plan-then-Implement uses two separate spawns: the first produces a Plan, the orchestrator approves it, the second implements. Only worth it when the Plan is specific enough for mechanical execution.
59
-
60
- ### Lite Workflow — Single-file fix, small bug, local refactor
61
-
62
- **When**: single file/module, known repro, no cross-module boundaries. Trivial changes (typo, constant) — fix directly.
63
-
64
- `execution-worker` → Plan → **suggest user run `design-reviewer` or `logicprobe` to verify Plan claims against codebase** → approve → `execution-worker` → implement + verify. Self-check. Uncertain → `quality-coordinator`.
65
-
66
- Escalate to Multi-Agent when cross-module or two revisions don't converge.
67
-
68
- ### Multi-Agent Workflow — Multi-module tasks, full plan/review/closure cycle
69
-
70
- **When**: cross-module, new interfaces, state ownership changes, needs design package.
71
-
72
- `architecture-steward` → design → `design-reviewer` → fact-check → per slice: `execution-worker` (Plan → approve → Implement) → `quality-coordinator` → closure (normal/failure/recovery paths).
73
-
74
- ### Framework Workflow — Platform layer, contracts, staged migration
75
-
76
- **When**: framework incubation, runtime path mounting, contract/sentinel/audit definition, old/new coexistence.
77
-
78
- Same as Multi-Agent, plus: design package includes audit matrix + rollback triggers; each slice reports audit delta; quality-coordinator checks audit ledger consistency.
79
-
80
- ### Sub-Agent Reference
81
-
82
- | Agent | Role |
83
- | ------- | ------ |
84
- | `architecture-steward` | Read-only planning: design packages, module boundaries, slice breakdown |
85
- | `design-reviewer` | Design doc fact-check: verifies claims against codebase before implementation |
86
- | `execution-worker` | Plan round → Detailed Change Plan. Implement round → edit + verify |
87
- | `quality-coordinator` | Implementation review: bugs, compliance, closure completeness |
88
-
89
- ---
90
-
91
- ## Plan Mode Integration
92
-
93
- Claude Code's built-in `EnterPlanMode` / `ExitPlanMode` maps to the **Plan phase** of the Lite and Multi-Agent workflows. Plan mode is a read-only exploration + plan-writing phase — it does NOT exempt you from embedded-workbench verification gates.
94
-
95
- ### Plan Verification Gate
96
-
97
- > **⚠️ logicprobe 已拆分为独立插件 / moved to a standalone plugin** (v0.6.0): the full verification skill (executable model checks, adversarial probing) now ships in its own plugin — <https://github.com/AmethystLuna/logicprobe>. Install it with `claude plugin install logicprobe@logicprobe` (or clone to `~/.claude/plugins/dev/logicprobe`). This plugin ships a built-in simplified fallback — `Skill("fact-check")` — for claim-by-claim verification when logicprobe is not installed; behavioral/model claims then degrade to manual confirmation.
98
-
99
- **Before calling `ExitPlanMode`**, exactly one of the following must happen:
100
-
101
- 1. **Load `Skill("logicprobe")`** (standalone plugin — install separately if missing) — the skill classifies depth (LIGHTWEIGHT / STANDARD / ESCALATED), runs verification (including executable model checks), and appends a `## Plan Verification` summary block to the plan file.
102
- 2. **Load `Skill("fact-check")`** (built-in fallback, only when logicprobe is not installed) — verifies every verifiable claim against the codebase with evidence, appends a `## Plan Verification` block marked `fact-check (fallback)`, and tells the user that state-machine/behavioral claims degrade to manual confirmation — recommend installing logicprobe.
103
- 3. **Inform the user** — if you choose not to load either skill, you MUST say: *"此计划未经核查。是否需要我在审批前运行事实核查?(This plan has not been fact-verified. Would you like me to run verification before approving?)"* The user must have the option to request verification before approving.
104
-
105
- Silent skip is not an option. Either verify, or tell the user you didn't.
106
-
107
- Plan mode permits `Read`, `Glob`, `Grep`, and `Skill` calls — all verification executes within plan mode before exit.
108
-
109
- ---
110
-
111
- ## Workflow Policies
112
-
113
- <HARD-GATE>
114
- ### Approval Gate
115
-
116
- - Implementation-bearing slices MUST produce a Detailed Change Plan before editing. No exceptions.
117
- - Plan must include: objective, entry point, intended files, change shape, invariants, risks, validation, stop conditions.
118
- - If execution reveals facts that change scope/boundaries/acceptance/verification surface, pause and require re-approval.
119
- - Do NOT skip the plan phase because "the change is obvious" or "I've done this before."
120
- </HARD-GATE>
121
-
122
- <HARD-GATE>
123
- ### Closure Gate
124
-
125
- - Slice is NOT done until: implementation intent + verification evidence + residual risks are all explicit.
126
- - Skipped checks MUST record a concrete reason. "Looks good" is not a reason.
127
- - For fault/recovery scenarios, MUST cover normal, failure, and recovery paths.
128
- - Documentation and memory updates MUST be completed or explicitly skipped with reason.
129
- - Do NOT call a slice closed if verification, documentation impact, or audit deltas are unclear.
130
- </HARD-GATE>
131
-
132
- ### Escalation Triggers
133
-
134
- - Work crosses module boundaries, public interfaces, or shared-state ownership → escalate.
135
- - Requirements conflict, acceptance unclear, or review reveals architecture drift → escalate.
136
- - Two plan revisions fail to converge → escalate.
137
-
138
- ### Context Transfer
139
-
140
- Sub-agents are **stateless with no implicit context inheritance** — each spawn only gets what's in its prompt:
141
-
142
- - **Explicit prompt construction**: put design conclusions, approved Plans, review findings directly in the prompt. Do NOT assume the agent "remembers" previous conversations.
143
- - **Plan is the key handoff artifact**: between Design → Plan round → Implement round, the Detailed Change Plan and review verdicts are the only bridge. Vague Plans = the next agent guessing.
144
- - **Pass only what's needed**: Design phase doesn't need full source code. Implement phase doesn't need the full Audit Matrix.
145
- - **Memory for cross-session persistence**: rules, pitfalls, constraints that need to survive across sessions go in `<workspace>/.github/memory/`. In-session coordination stays in chat.
146
- - **Long content via path references**: if context is too large, write long content to workspace docs and put only the path in the prompt. Let the agent Read it.
147
-
148
- ---
149
-
150
- ## Skill Types
151
-
152
- Each domain skill is classified by how strictly it should be followed:
153
-
154
- **Rigid** — follow exactly. These are rules and checklists. Don't adapt away the discipline.
155
-
156
- - `debug-methodology`: 8 iron rules are non-negotiable
157
- - `logicprobe` (external plugin): claim verification must check every claim
158
- - `fact-check` (built-in fallback): claim-by-claim verification when logicprobe is not installed
159
-
160
- **Flexible** — adapt principles to context. These are patterns and references, not commands.
161
-
162
- - `c-cpp-dev`: style and patterns adapt to existing codebase conventions
163
- - `embedded-firmware-dev`: architecture principles apply based on project scale
164
- - `state-machine-design`: implementation patterns adapt to protocol specifics
165
- - `hardfault-triage`: methodology adapts to processor architecture
166
- - `keil-mdk-build`: build diagnostics adapt to project structure
167
-
168
- If unsure, treat a skill as Rigid until you confirm otherwise.
169
-
170
- ## Skill Loading Priority
171
-
172
- When multiple skills could apply, use this order:
173
-
174
- 1. **Diagnosis skills first** — `debug-methodology`, `hardfault-triage`, `logicprobe` (external plugin; use the built-in `fact-check` fallback if logicprobe is not installed). These determine WHAT is wrong.
175
- 2. **Design skills second** — `state-machine-design`. These determine HOW to fix it.
176
- 3. **Implementation skills third** — `c-cpp-dev`, `embedded-firmware-dev`, `keil-mdk-build`. These guide execution.
177
-
178
- "HardFault crash" → hardfault-triage first, then debug-methodology if root cause is complex.
179
- "Add retry logic" → state-machine-design first, then c-cpp-dev for implementation.
180
- "Review this design" → logicprobe first (or the built-in fact-check fallback if logicprobe is not installed), then escalate findings to design-reviewer agent.
181
-
182
- **Cross-domain links**: load secondary skills ONLY when the primary skill's findings indicate they are needed. Don't pre-load. `hardfault-triage` ↔ `keil-mdk-build` (.map file bridge — load keil-mdk-build only if .map analysis is needed). `hardfault-triage` ↔ `debug-methodology` (root-cause analysis — load debug-methodology only if the fault cause is complex). `embedded-firmware-dev` ↔ `state-machine-design` (state transitions — load state-machine-design only if state logic is involved). `embedded-firmware-dev` ↔ `debug-methodology` (debugging process). `logicprobe` ↔ `design-reviewer` agent (design doc review, logic verification). `logicprobe` ↔ `state-machine-design` (behavioral claim probing). `logicprobe` ↔ `fact-check` (built-in fallback when the logicprobe plugin is not installed).
183
-
184
- ## Domain Skills
185
-
186
- Load domain-specific guidance when the task matches. Skills marked with 📚 have deep reference material in their `references/` directory.
187
-
188
- | Task | Skill | Type | Deep Refs |
189
- |------|-------|:----:|:---------:|
190
- | Debugging crashes, HardFault, logs | `Skill("debug-methodology")` | Rigid | 📚 case study |
191
- | HardFault / exception triage, fault registers, .map crash resolution | `Skill("hardfault-triage")` | Flexible | — |
192
- | C/C++ code generation or style | `Skill("c-cpp-dev")` | Flexible | — |
193
- | FreeRTOS, ISR, NVM storage, sensor drivers | `Skill("embedded-firmware-dev")` | Flexible | 📚 architecture, patterns, LVGL |
194
- | Keil MDK, ARMCLANG, build system, .map optimization | `Skill("keil-mdk-build")` | Flexible | — |
195
- | State machines, retries, timeouts | `Skill("state-machine-design")` | Flexible | — |
196
-
197
- Design doc review, claim verification, logic primitive + adversarial probing → `Skill("logicprobe")` — **standalone plugin**; when logicprobe is not installed, use the built-in `Skill("fact-check")` fallback for claim-by-claim verification (see Plan Verification Gate above).
198
-
199
- ## Templates & References
200
-
201
- This skill's `references/` directory contains document templates and platform references. Use `Read` with the skill's reference path to load the relevant file when needed:
202
-
203
- ### Platform
204
-
205
- - `platform-tool-mapping.md` — Claude Code → Codex/Cursor/Kimi/OpenCode/ZCode/Copilot tool name equivalents. **Load this immediately if you are NOT on Claude Code.**
206
-
207
- ### Workflow Templates
208
-
209
- - `detailed-change-plan.md` — Pre-edit implementation plan
210
- - `task-charter.md` — Task scope and slice roadmap
211
- - `iteration-notes.md` — Per-slice execution notes
212
- - `steward-memo.md` — Pre-execution architecture framing
213
- - `result-note.md` — Post-edit closure evidence
214
- - `final-qc.md` — Formal review verdict
215
- - `decision-log.md` — Approved decisions with rationale
216
- - `audit-ledger.md` — Recurring audit tracking (Framework Workflow)
217
- - `contract-matrix.md` — Contract-to-sentinel mapping (Framework Workflow)
218
- - `durable-requirement-notes.md` — Long-lived business invariants
219
-
220
- ---
221
-
222
- ## Proactive Suggestions
223
-
224
- When you observe any of these patterns in the user's task, **suggest the relevant feature before the user asks**. Most users don't know these capabilities exist.
225
-
226
- | Pattern You Observe | Suggest |
227
- |---------------------|--------|
228
- | User describes refactoring a state machine (splitting/merging states, changing transitions) | "Before you start, would you like me to run logic-primitive verification on the refactoring? I can extract the current state machine from code, compare it against your plan, and flag any regressions, deadlocks, or behavioral deltas before you change a single line." |
229
- | User describes a new state machine or protocol with ≥3 states | "I can run an adversarial verification on this design — 14 automated checks for deadlocks, unreachable states, race conditions, guard completeness, and invariant violations. Want me to do that before we implement?" |
230
- | User pastes or writes a state enum + switch-case dispatcher | "I notice a state machine here. Would you like me to model it and run completeness checks? I can find missing transitions, detect absorbing error loops, and verify that every state is reachable." |
231
- | User says "always" / "never" / "guaranteed" about behavior | "That's a behavioral invariant. I can model this and try to find a counter-example — the shortest event sequence that would violate 'X always happens before Y'. Want me to check?" |
232
- | User reviews a PR or diff that touches a state machine file | "This PR changes state machine logic. Would you like me to extract the before/after models and verify no regressions were introduced?" |
233
- | User debugs a crash or lockup in a stateful module | "This might be a state machine completeness issue. I can model the state machine from the code and check for deadlocks, unreachable states, or event ordering problems that could cause the lockup." |
234
- | Task would benefit from parallel execution (multiple independent modules, files, or dimensions) | "These are independent. I can dispatch parallel subagents to handle each module concurrently and synthesize the results. Want me to do that?" |
235
- | User writes a Detailed Change Plan without design review | "Before implementing, would you like the design-reviewer agent to fact-check this plan against the codebase? It catches API mismatches, missing modules, and mechanism feasibility issues before you write code." |
236
-
237
- ### Suggestion Rules
238
-
239
- - **Suggest once per task**, not repeatedly. If the user declines, don't push.
240
- - **Be specific about what the feature does** — don't just name-drop. Say "I can find deadlocks and missing transitions" not "I can run logicprobe." If logicprobe is not installed, offer the built-in fact-check skill: "I can check every claim in the plan against the codebase."
241
- - **Estimate cost**: for lightweight checks, say "this takes ~30 seconds." For Python harness runs, say "this will generate and run a verification script."
242
- - **Respect the user's decision**: if they decline, move on. The features are tools, not requirements.
1
+ ---
2
+ name: embedded-workbench
3
+ description: "Use when starting any non-trivial coding task — loads multi-agent workflows, engineering policies, and principles for embedded C/C++ firmware development. NOT for trivial single-line fixes, formatting-only changes, or read-only queries."
4
+ ---
5
+
6
+ <SUBAGENT-STOP>
7
+ If you were dispatched as a subagent to execute a specific task (implementation, review, search), skip this bootstrap skill. You already have your task instructions. Only load domain skills relevant to your specific task.
8
+ </SUBAGENT-STOP>
9
+
10
+ # Embedded Engineering Workflow
11
+
12
+ Core workflow system and engineering principles.
13
+
14
+ ## Instruction Priority
15
+
16
+ This plugin's skills and policies override default system behavior, but **user instructions always take precedence**:
17
+
18
+ 1. **User's explicit instructions** (CLAUDE.md, AGENTS.md, project rules, direct requests) — highest priority
19
+ 2. **Plugin skills and workflows** — override default system behavior where they conflict
20
+ 3. **Default system prompt** — lowest priority
21
+
22
+ If a user's CLAUDE.md says "skip design review for hotfixes" and the workflow requires it, follow the user. The user is in control.
23
+
24
+ ## Platform Adaptation
25
+
26
+ This plugin's skills and agents use Claude Code tool names (`Read`, `Write`, `Edit`, `Bash`, `Skill()`). If you are NOT on Claude Code, load `references/platform-tool-mapping.md` for the tool name equivalents on your platform (Codex CLI, Cursor, Kimi CLI, OpenCode, ZCode, Copilot CLI).
27
+
28
+ ## Red Flags
29
+
30
+ If you catch yourself thinking any of these, STOP — you are rationalizing:
31
+
32
+ | You think | Reality |
33
+ |-----------|---------|
34
+ | "This is just a quick fix, I don't need a plan" | Quick fixes are the most likely to break something else. A 3-line design check costs 30 seconds. |
35
+ | "I already understand the architecture" | You're looking at one file. The blast radius may span 5 modules you haven't read. |
36
+ | "The worker can figure out the details" | The worker has NO context from previous calls. A vague plan = the worker guessing. |
37
+ | "I'll review it myself, no need for quality-coordinator" | Self-review catches ~60% of issues. A second pair catches the other 40%. |
38
+ | "This change is too small for a Detailed Change Plan" | If it touches more than one function, it needs a plan. Even single-function changes benefit from explicit invariants. |
39
+ | "I've explored enough, time to exit plan mode" | ExitPlanMode is the verification gate. Have you loaded `Skill("logicprobe")` or, if it is not installed, the built-in fallback `Skill("fact-check")`? Every plan — simple or complex — must pass this gate before exit. |
40
+ | "This plan is too simple for logicprobe" | logicprobe auto-classifies depth (LIGHTWEIGHT/STANDARD/ESCALATED); the fallback fact-check verifies every claim regardless. You don't decide whether verification is needed. |
41
+ | "I already read the code, I know the file paths and API names are correct" | Organic verification leaves no audit trail. Load `Skill("logicprobe")` or the fallback `Skill("fact-check")`, verify each claim, append the `## Plan Verification` block. |
42
+
43
+ ---
44
+
45
+ ## General Principles
46
+
47
+ - Build context before acting: identify domain → load relevant skills → read key sources → analyze → edit.
48
+ - **Facts first, code is truth**: verify every document claim (counts, API names, enum values) against the actual codebase with Grep. Design on verified facts, not assumptions.
49
+ - Use `Agent(subagent_type: "Explore")` for broad searches instead of chaining Grep/Glob.
50
+ - Verify every change with `Bash` compilation or tests before reporting success. No verification = no claim of success.
51
+ - Reference file locations with line numbers in all reports: `[path/to/file.c#L100-L110]`.
52
+ - Write project memory to `<workspace>/.github/memory/`, update `MEMORY.md` index. Personal preferences only in `~/.claude/projects/.../memory/`.
53
+
54
+ ---
55
+
56
+ ## Workflows
57
+
58
+ Sub-agents are **stateless** — each `Agent()` call is a fresh process. Plan-then-Implement uses two separate spawns: the first produces a Plan, the orchestrator approves it, the second implements. Only worth it when the Plan is specific enough for mechanical execution.
59
+
60
+ ### Lite Workflow — Single-file fix, small bug, local refactor
61
+
62
+ **When**: single file/module, known repro, no cross-module boundaries. Trivial changes (typo, constant) — fix directly.
63
+
64
+ `execution-worker` → Plan → **suggest user run `design-reviewer` or `logicprobe` to verify Plan claims against codebase** → approve → `execution-worker` → implement + verify. Self-check. Uncertain → `quality-coordinator`.
65
+
66
+ Escalate to Multi-Agent when cross-module or two revisions don't converge.
67
+
68
+ ### Multi-Agent Workflow — Multi-module tasks, full plan/review/closure cycle
69
+
70
+ **When**: cross-module, new interfaces, state ownership changes, needs design package.
71
+
72
+ `architecture-steward` → design → `design-reviewer` → fact-check → per slice: `execution-worker` (Plan → approve → Implement) → `quality-coordinator` → closure (normal/failure/recovery paths).
73
+
74
+ ### Framework Workflow — Platform layer, contracts, staged migration
75
+
76
+ **When**: framework incubation, runtime path mounting, contract/sentinel/audit definition, old/new coexistence.
77
+
78
+ Same as Multi-Agent, plus: design package includes audit matrix + rollback triggers; each slice reports audit delta; quality-coordinator checks audit ledger consistency.
79
+
80
+ ### Sub-Agent Reference
81
+
82
+ | Agent | Role |
83
+ | ------- | ------ |
84
+ | `architecture-steward` | Read-only planning: design packages, module boundaries, slice breakdown |
85
+ | `design-reviewer` | Design doc fact-check: verifies claims against codebase before implementation |
86
+ | `execution-worker` | Plan round → Detailed Change Plan. Implement round → edit + verify |
87
+ | `quality-coordinator` | Implementation review: bugs, compliance, closure completeness |
88
+
89
+ ---
90
+
91
+ ## Plan Mode Integration
92
+
93
+ Claude Code's built-in `EnterPlanMode` / `ExitPlanMode` maps to the **Plan phase** of the Lite and Multi-Agent workflows. Plan mode is a read-only exploration + plan-writing phase — it does NOT exempt you from embedded-workbench verification gates.
94
+
95
+ ### Plan Verification Gate
96
+
97
+ > **⚠️ logicprobe 已拆分为独立插件 / moved to a standalone plugin** (v0.6.0): the full verification skill (executable model checks, adversarial probing) now ships in its own plugin — <https://github.com/AmethystLuna/logicprobe>. Install it with `claude plugin install logicprobe@logicprobe` (or clone to `~/.claude/plugins/dev/logicprobe`). This plugin ships a built-in simplified fallback — `Skill("fact-check")` — for claim-by-claim verification when logicprobe is not installed; behavioral/model claims then degrade to manual confirmation.
98
+
99
+ **Before calling `ExitPlanMode`**, exactly one of the following must happen:
100
+
101
+ 1. **Load `Skill("logicprobe")`** (standalone plugin — install separately if missing) — the skill classifies depth (LIGHTWEIGHT / STANDARD / ESCALATED), runs verification (including executable model checks), and appends a `## Plan Verification` summary block to the plan file.
102
+ 2. **Load `Skill("fact-check")`** (built-in fallback, only when logicprobe is not installed) — verifies every verifiable claim against the codebase with evidence, appends a `## Plan Verification` block marked `fact-check (fallback)`, and tells the user that state-machine/behavioral claims degrade to manual confirmation — recommend installing logicprobe.
103
+ 3. **Inform the user** — if you choose not to load either skill, you MUST say: *"此计划未经核查。是否需要我在审批前运行事实核查?(This plan has not been fact-verified. Would you like me to run verification before approving?)"* The user must have the option to request verification before approving.
104
+
105
+ Silent skip is not an option. Either verify, or tell the user you didn't.
106
+
107
+ Plan mode permits `Read`, `Glob`, `Grep`, and `Skill` calls — all verification executes within plan mode before exit.
108
+
109
+ ---
110
+
111
+ ## Workflow Policies
112
+
113
+ <HARD-GATE>
114
+ ### Approval Gate
115
+
116
+ - Implementation-bearing slices MUST produce a Detailed Change Plan before editing. No exceptions.
117
+ - Plan must include: objective, entry point, intended files, change shape, invariants, risks, validation, stop conditions.
118
+ - If execution reveals facts that change scope/boundaries/acceptance/verification surface, pause and require re-approval.
119
+ - Do NOT skip the plan phase because "the change is obvious" or "I've done this before."
120
+ </HARD-GATE>
121
+
122
+ <HARD-GATE>
123
+ ### Closure Gate
124
+
125
+ - Slice is NOT done until: implementation intent + verification evidence + residual risks are all explicit.
126
+ - Skipped checks MUST record a concrete reason. "Looks good" is not a reason.
127
+ - For fault/recovery scenarios, MUST cover normal, failure, and recovery paths.
128
+ - Documentation and memory updates MUST be completed or explicitly skipped with reason.
129
+ - Do NOT call a slice closed if verification, documentation impact, or audit deltas are unclear.
130
+ </HARD-GATE>
131
+
132
+ ### Escalation Triggers
133
+
134
+ - Work crosses module boundaries, public interfaces, or shared-state ownership → escalate.
135
+ - Requirements conflict, acceptance unclear, or review reveals architecture drift → escalate.
136
+ - Two plan revisions fail to converge → escalate.
137
+
138
+ ### Context Transfer
139
+
140
+ Sub-agents are **stateless with no implicit context inheritance** — each spawn only gets what's in its prompt:
141
+
142
+ - **Explicit prompt construction**: put design conclusions, approved Plans, review findings directly in the prompt. Do NOT assume the agent "remembers" previous conversations.
143
+ - **Plan is the key handoff artifact**: between Design → Plan round → Implement round, the Detailed Change Plan and review verdicts are the only bridge. Vague Plans = the next agent guessing.
144
+ - **Pass only what's needed**: Design phase doesn't need full source code. Implement phase doesn't need the full Audit Matrix.
145
+ - **Memory for cross-session persistence**: rules, pitfalls, constraints that need to survive across sessions go in `<workspace>/.github/memory/`. In-session coordination stays in chat.
146
+ - **Long content via path references**: if context is too large, write long content to workspace docs and put only the path in the prompt. Let the agent Read it.
147
+
148
+ ---
149
+
150
+ ## Skill Types
151
+
152
+ Each domain skill is classified by how strictly it should be followed:
153
+
154
+ **Rigid** — follow exactly. These are rules and checklists. Don't adapt away the discipline.
155
+
156
+ - `debug-methodology`: 8 iron rules are non-negotiable
157
+ - `logicprobe` (external plugin): claim verification must check every claim
158
+ - `fact-check` (built-in fallback): claim-by-claim verification when logicprobe is not installed
159
+
160
+ **Flexible** — adapt principles to context. These are patterns and references, not commands.
161
+
162
+ - `c-cpp-dev`: style and patterns adapt to existing codebase conventions
163
+ - `embedded-firmware-dev`: architecture principles apply based on project scale
164
+ - `state-machine-design`: implementation patterns adapt to protocol specifics
165
+ - `hardfault-triage`: methodology adapts to processor architecture
166
+ - `keil-mdk-build`: build diagnostics adapt to project structure
167
+
168
+ If unsure, treat a skill as Rigid until you confirm otherwise.
169
+
170
+ ## Skill Loading Priority
171
+
172
+ When multiple skills could apply, use this order:
173
+
174
+ 1. **Diagnosis skills first** — `debug-methodology`, `hardfault-triage`, `logicprobe` (external plugin; use the built-in `fact-check` fallback if logicprobe is not installed). These determine WHAT is wrong.
175
+ 2. **Design skills second** — `state-machine-design`. These determine HOW to fix it.
176
+ 3. **Implementation skills third** — `c-cpp-dev`, `embedded-firmware-dev`, `keil-mdk-build`. These guide execution.
177
+
178
+ "HardFault crash" → hardfault-triage first, then debug-methodology if root cause is complex.
179
+ "Add retry logic" → state-machine-design first, then c-cpp-dev for implementation.
180
+ "Review this design" → logicprobe first (or the built-in fact-check fallback if logicprobe is not installed), then escalate findings to design-reviewer agent.
181
+
182
+ **Cross-domain links**: load secondary skills ONLY when the primary skill's findings indicate they are needed. Don't pre-load. `hardfault-triage` ↔ `keil-mdk-build` (.map file bridge — load keil-mdk-build only if .map analysis is needed). `hardfault-triage` ↔ `debug-methodology` (root-cause analysis — load debug-methodology only if the fault cause is complex). `embedded-firmware-dev` ↔ `state-machine-design` (state transitions — load state-machine-design only if state logic is involved). `embedded-firmware-dev` ↔ `debug-methodology` (debugging process). `logicprobe` ↔ `design-reviewer` agent (design doc review, logic verification). `logicprobe` ↔ `state-machine-design` (behavioral claim probing). `logicprobe` ↔ `fact-check` (built-in fallback when the logicprobe plugin is not installed).
183
+
184
+ ## Domain Skills
185
+
186
+ Load domain-specific guidance when the task matches. Skills marked with 📚 have deep reference material in their `references/` directory.
187
+
188
+ | Task | Skill | Type | Deep Refs |
189
+ |------|-------|:----:|:---------:|
190
+ | Debugging crashes, HardFault, logs | `Skill("debug-methodology")` | Rigid | 📚 case study |
191
+ | HardFault / exception triage, fault registers, .map crash resolution | `Skill("hardfault-triage")` | Flexible | — |
192
+ | C/C++ code generation or style | `Skill("c-cpp-dev")` | Flexible | — |
193
+ | FreeRTOS, ISR, NVM storage, sensor drivers | `Skill("embedded-firmware-dev")` | Flexible | 📚 architecture, patterns, LVGL |
194
+ | Keil MDK, ARMCLANG, build system, .map optimization | `Skill("keil-mdk-build")` | Flexible | — |
195
+ | State machines, retries, timeouts | `Skill("state-machine-design")` | Flexible | — |
196
+
197
+ Design doc review, claim verification, logic primitive + adversarial probing → `Skill("logicprobe")` — **standalone plugin**; when logicprobe is not installed, use the built-in `Skill("fact-check")` fallback for claim-by-claim verification (see Plan Verification Gate above).
198
+
199
+ ## Templates & References
200
+
201
+ This skill's `references/` directory contains document templates and platform references. Use `Read` with the skill's reference path to load the relevant file when needed:
202
+
203
+ ### Platform
204
+
205
+ - `platform-tool-mapping.md` — Claude Code → Codex/Cursor/Kimi/OpenCode/ZCode/Copilot tool name equivalents. **Load this immediately if you are NOT on Claude Code.**
206
+
207
+ ### Workflow Templates
208
+
209
+ - `detailed-change-plan.md` — Pre-edit implementation plan
210
+ - `task-charter.md` — Task scope and slice roadmap
211
+ - `iteration-notes.md` — Per-slice execution notes
212
+ - `steward-memo.md` — Pre-execution architecture framing
213
+ - `result-note.md` — Post-edit closure evidence
214
+ - `final-qc.md` — Formal review verdict
215
+ - `decision-log.md` — Approved decisions with rationale
216
+ - `audit-ledger.md` — Recurring audit tracking (Framework Workflow)
217
+ - `contract-matrix.md` — Contract-to-sentinel mapping (Framework Workflow)
218
+ - `durable-requirement-notes.md` — Long-lived business invariants
219
+
220
+ ---
221
+
222
+ ## Proactive Suggestions
223
+
224
+ When you observe any of these patterns in the user's task, **suggest the relevant feature before the user asks**. Most users don't know these capabilities exist.
225
+
226
+ | Pattern You Observe | Suggest |
227
+ |---------------------|--------|
228
+ | User describes refactoring a state machine (splitting/merging states, changing transitions) | "Before you start, would you like me to run logic-primitive verification on the refactoring? I can extract the current state machine from code, compare it against your plan, and flag any regressions, deadlocks, or behavioral deltas before you change a single line." |
229
+ | User describes a new state machine or protocol with ≥3 states | "I can run an adversarial verification on this design — 14 automated checks for deadlocks, unreachable states, race conditions, guard completeness, and invariant violations. Want me to do that before we implement?" |
230
+ | User pastes or writes a state enum + switch-case dispatcher | "I notice a state machine here. Would you like me to model it and run completeness checks? I can find missing transitions, detect absorbing error loops, and verify that every state is reachable." |
231
+ | User says "always" / "never" / "guaranteed" about behavior | "That's a behavioral invariant. I can model this and try to find a counter-example — the shortest event sequence that would violate 'X always happens before Y'. Want me to check?" |
232
+ | User reviews a PR or diff that touches a state machine file | "This PR changes state machine logic. Would you like me to extract the before/after models and verify no regressions were introduced?" |
233
+ | User debugs a crash or lockup in a stateful module | "This might be a state machine completeness issue. I can model the state machine from the code and check for deadlocks, unreachable states, or event ordering problems that could cause the lockup." |
234
+ | Task would benefit from parallel execution (multiple independent modules, files, or dimensions) | "These are independent. I can dispatch parallel subagents to handle each module concurrently and synthesize the results. Want me to do that?" |
235
+ | User writes a Detailed Change Plan without design review | "Before implementing, would you like the design-reviewer agent to fact-check this plan against the codebase? It catches API mismatches, missing modules, and mechanism feasibility issues before you write code." |
236
+
237
+ ### Suggestion Rules
238
+
239
+ - **Suggest once per task**, not repeatedly. If the user declines, don't push.
240
+ - **Be specific about what the feature does** — don't just name-drop. Say "I can find deadlocks and missing transitions" not "I can run logicprobe." If logicprobe is not installed, offer the built-in fact-check skill: "I can check every claim in the plan against the codebase."
241
+ - **Estimate cost**: for lightweight checks, say "this takes ~30 seconds." For Python harness runs, say "this will generate and run a verification script."
242
+ - **Respect the user's decision**: if they decline, move on. The features are tools, not requirements.
@@ -1,40 +1,40 @@
1
- # Final QC
2
-
3
- ## Metadata
4
-
5
- - **Type:** Final QC
6
- - **Horizon:** Review
7
- - **Domain:**
8
- - **Status:**
9
- - **Owner:**
10
- - **Last Updated:**
11
- - **Related:**
12
- - **Slice ID:**
13
- - **Review Verdict:**
14
-
15
- ## Findings
16
-
17
- - **Severity:**
18
- - **Finding:**
19
- - **Evidence:**
20
- - **Recommended Action:**
21
-
22
- ## Plan Verdict
23
-
24
- ## Design Coverage
25
-
26
- ## Requirement Coverage
27
-
28
- ## Implementation Coverage
29
-
30
- ## Closure Coverage
31
-
32
- ## Document Sync
33
-
34
- ## Index Health
35
-
36
- ## Coordination Notes
37
-
38
- ## Verification Gaps
39
-
40
- ## Recommendation
1
+ # Final QC
2
+
3
+ ## Metadata
4
+
5
+ - **Type:** Final QC
6
+ - **Horizon:** Review
7
+ - **Domain:**
8
+ - **Status:**
9
+ - **Owner:**
10
+ - **Last Updated:**
11
+ - **Related:**
12
+ - **Slice ID:**
13
+ - **Review Verdict:**
14
+
15
+ ## Findings
16
+
17
+ - **Severity:**
18
+ - **Finding:**
19
+ - **Evidence:**
20
+ - **Recommended Action:**
21
+
22
+ ## Plan Verdict
23
+
24
+ ## Design Coverage
25
+
26
+ ## Requirement Coverage
27
+
28
+ ## Implementation Coverage
29
+
30
+ ## Closure Coverage
31
+
32
+ ## Document Sync
33
+
34
+ ## Index Health
35
+
36
+ ## Coordination Notes
37
+
38
+ ## Verification Gaps
39
+
40
+ ## Recommendation