Skip to content

Commit 1a01c94

Browse files
committed
chore: update version to 0.8.6 and enhance documentation in SKILL.md
1 parent 67dc29c commit 1a01c94

3 files changed

Lines changed: 76 additions & 4 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "uv_build"
44

55
[project]
66
name = "pb-spec"
7-
version = "0.8.5"
7+
version = "0.8.6"
88
description = "Plan-Build Spec (pb-spec): A CLI tool for managing AI coding assistant skills"
99
readme = "README.md"
1010
license = "Apache-2.0"

src/pb_spec/templates/skills/pb-build/SKILL.md

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,28 @@ Extract the full task block from `tasks.md` — including Context, Scenario Cove
100100
- Identify files most relevant to this task.
101101
- Record a pre-task workspace snapshot (`git status --porcelain` + tracked/untracked file lists). This baseline is used for safe recovery if the task fails.
102102

103+
#### 3b-i. Pre-Spawn State Gate (Mandatory)
104+
105+
Before spawning a subagent for the current task, **verify that all previously processed tasks are properly marked in `tasks.md`**. This catches any state drift carried over from earlier iterations.
106+
107+
1. Re-read `tasks.md` and scan all `### Task X.Y:` blocks that precede the current task.
108+
2. For each previously processed task, confirm:
109+
- If it was reported as completed: Status is `🟢 DONE` and all evidence checkboxes are `- [x]`.
110+
- If it was reported as skipped: Status is `⏭️ SKIPPED`.
111+
- If it was reported as DCR-blocked: Status is `🔄 DCR`.
112+
3. **If any discrepancy is found** — a task was processed but not properly marked:
113+
- Apply the correct mark immediately (update Status and checkboxes).
114+
- Run `pb-spec sync specs/<spec-dir>`.
115+
- Log the fix:
116+
117+
```text
118+
🔧 Auto-fixed: Task X.Y status was [old state], corrected to [new state].
119+
```
120+
121+
4. Only proceed to spawn the subagent after all prior tasks are in consistent state.
122+
123+
> **Why this gate exists:** If a previous subagent completed but the orchestrator failed to mark it (due to context loss, edit failure, etc.), this gate catches it before the next subagent starts. It ensures the orchestrator always has an accurate view of what's done.
124+
103125
#### 3c. Spawn Subagent
104126
105127
Create a **fresh subagent** for this task. Pass it the implementer prompt template from `references/implementer_prompt.md`, filled with:
@@ -168,6 +190,28 @@ The sync command will:
168190
- Update Status to `🟡 IN PROGRESS` if some steps are checked
169191
- Report any changes made
170192

193+
#### 3e-i. Post-Mark Verification (Mandatory)
194+
195+
After updating `tasks.md` and running `pb-spec sync`, **verify the mark actually took effect** before proceeding to the next task. This prevents silent state drift where the orchestrator believes it updated the file but the edit did not persist.
196+
197+
1. **Re-read** the specific `### Task X.Y` block from `tasks.md`.
198+
2. **Confirm** that:
199+
- The Status line shows `🟢 DONE` (not `🔴 TODO` or `🟡 IN PROGRESS`).
200+
- All `- [ ]` evidence checkboxes in the block are now `- [x]`.
201+
3. **If verification fails** — the task subagent reported success but `tasks.md` was not updated:
202+
- Apply the mark immediately: update Status to `🟢 DONE` and all checkboxes to `- [x]`.
203+
- Re-run `pb-spec sync specs/<spec-dir>`.
204+
- Re-verify.
205+
- If it still fails after a second attempt, report the discrepancy and halt:
206+
207+
```text
208+
⚠️ Task State Drift — Task X.Y
209+
Subagent reported success but tasks.md was not updated.
210+
Auto-fix applied. If this recurs, inspect the file for write conflicts.
211+
```
212+
213+
> **Why this step exists:** Long-running orchestrator sessions can lose track of whether they actually wrote the mark. This verification step closes the loop by checking disk state, not memory state.
214+
>
171215
> **⚠️ Context Reset:** After completing all tasks (or when context grows large), output: "Recommend starting a fresh session. Run `/pb-build <feature-name>` again to continue from where you left off."
172216
173217
### Step 4: Handle Failures (The Recovery Loop)
@@ -242,9 +286,37 @@ If during implementation a subagent discovers that the design is **infeasible or
242286
- **Override** — user provides an alternative approach.
243287
- **Abort** — stop the build.
244288

245-
### Step 5: Output Completion Summary
289+
### Step 5: Final State Verification & Output Completion Summary
290+
291+
#### 5a. Final State Sweep (Mandatory)
292+
293+
Before outputting the summary, perform a **full reconciliation** of `tasks.md` against the build session's execution log. This catches any tasks that were processed but never marked.
294+
295+
1. Re-read the entire `tasks.md`.
296+
2. Cross-check each `### Task X.Y:` block against the orchestrator's session record:
297+
- If the session shows a task was **completed** (subagent reported success, tests passed) but `tasks.md` still shows `🔴 TODO` or `🟡 IN PROGRESS` with unchecked steps → **auto-fix**: update Status to `🟢 DONE`, mark all checkboxes `- [x]`.
298+
- If the session shows a task was **skipped** but `tasks.md` does not show `⏭️ SKIPPED`**auto-fix**: update Status to `⏭️ SKIPPED`.
299+
- If the session shows a task triggered a **DCR** but `tasks.md` does not show `🔄 DCR`**auto-fix**: update Status to `🔄 DCR`.
300+
3. Run `pb-spec sync specs/<spec-dir>` after all fixes to ensure Status fields are consistent.
301+
4. Report any auto-fixes applied:
302+
303+
```text
304+
🔧 Final Sweep Auto-Fixes:
305+
- Task X.Y: Status [old] → 🟢 DONE (subagent completed, mark was missing)
306+
- Task A.B: Status [old] → ⏭️ SKIPPED (mark was missing)
307+
```
308+
309+
5. If no fixes were needed, report:
310+
311+
```text
312+
✅ Final Sweep: All task states in tasks.md are consistent with execution log.
313+
```
314+
315+
> **Why this sweep exists:** Even with per-task verification (Step 3e-i) and pre-spawn gates (Step 3b-i), edge cases can still cause drift (e.g., context truncation, partial edits, session interruptions). This final sweep is the last line of defense before the user sees the summary.
316+
317+
#### 5b. Output Completion Summary
246318

247-
After all tasks are processed, output:
319+
After all tasks are processed and the final sweep is complete, output:
248320

249321
```text
250322
📊 pb-build Summary: specs/<spec-dir>/

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)