fix(pdca): complete predecessor phase Task before advancing (#137, v2.1.29)#138
Merged
Conversation
….1.29) The `pdca` skill chains phase Tasks via `blockedBy` ([Plan]->[Design]->[Do]->[Check]->...), but SKILL.md documented Task *creation* only. No step ever told the model to mark the *predecessor* phase Task `completed` when advancing, and no hook did it either. A predecessor left `in_progress` (e.g. [Design] during the whole Do phase) leaked a stale phase into Claude Code's ambient prompt context every turn, disagreeing with `.bkit/state/pdca-status.json`'s `phase` field (the phase source of truth, correct throughout). Cosmetic/informational, reported by @hslee-cmyk with a full reproduction. The issue's Option 2 (a hook auto-completing the predecessor) is technically infeasible: per the official CC hooks guide, command hooks communicate via stdout/stderr/exit-code/additionalContext only and cannot call TaskUpdate -- only the model can. TaskCreated/TaskCompleted fire, but a handler could at most emit a reminder that STILL relies on the model acting -- no more deterministic than an explicit skill step, and noisier. Option 1 is therefore strictly better. Fix (Option 1, deterministic, model-executed): - skills/pdca/SKILL.md: each advancing action (design/do/analyze/ iterate/qa/report) embeds a "Complete predecessor Task first" step before its Create-Task step; archive completes the terminal [Report] Task; plan completes an optional [PM] Task. - New "### Phase Transition Rule (task completion)" subsection in ## Task Integration states the general rule (complete every prior in_progress [Phase] {feature} Task) + the two-sources-of-truth rationale. Branch-safe for the qa/act parts of the 9-phase lifecycle. - Uses the TaskList/TaskUpdate tools the skill already grants -- no hook change, no new runtime surface, no dead code. Scope: pdca only. plan-plus (single [Plan] Task, completed by pdca design's new step), cc-version-analysis (subtask tracking) and sprint (per-feature Tasks) carry no multi-phase blockedBy chain. Regression guard: test/regression/issue-137-predecessor-task-completion.test.js (25 assertions) asserts the Phase Transition Rule and each per-transition completion instruction; fails if any is removed. No architecture-count or runtime-behavior change (44 skills / 34 agents / 22 hook events / 195 lib modules unchanged). Zero new regressions vs main (identical failing-file set). Version 2.1.28 -> 2.1.29; CHANGELOG [2.1.29]. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W1jmB5L36rnEGjQtH5St9H
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #137 (@hslee-cmyk, low-priority/cosmetic, reported with a full reproduction).
The
pdcaskill chains phase Tasks viablockedBy([Plan]→[Design]→[Do]→[Check]→…), butskills/pdca/SKILL.mddocumented Task creation only — no step ever told the model to mark the predecessor phase Taskcompletedwhen advancing, and no hook did it either. A predecessor leftin_progress(e.g.[Design]for the entireDophase) leaked a stale phase into Claude Code's ambient prompt context every turn, disagreeing with.bkit/state/pdca-status.json'sphasefield — the phase source of truth, which was correct throughout.Root cause & why Option 2 was rejected (infeasible)
The issue offered two fixes. Option 2 (a hook auto-completing the predecessor) is technically infeasible: per the official Claude Code hooks guide, command hooks communicate via stdout/stderr/exit-code/
additionalContextonly and cannot callTaskUpdate— only the model can.TaskCreated/TaskCompletedare real firing events, but a handler could at most emit a reminder that still relies on the model acting — no more deterministic than an explicit skill step, and noisier. Option 1 is therefore strictly better. (Verified against CC docs — not assumed.)Fix (Option 1 — deterministic, model-executed)
skills/pdca/SKILL.md: each advancing action (design/do/analyze/iterate/qa/report) embeds a "Complete predecessor Task first" step immediately before its Create-Task step;archivecompletes the terminal[Report]Task;plancompletes an optional[PM]Task.### Phase Transition Rule (task completion)subsection under## Task Integrationstates the general rule (complete every priorin_progress[Phase] {feature}Task) and the two-sources-of-truth rationale. Branch-safe for theqa/actparts of the 9-phase lifecycle.TaskList/TaskUpdatetools the skill already grants — no hook change, no new runtime surface, no dead code.Scope
pdcaonly. Related skills carry no multi-phaseblockedBychain:plan-pluscreates a single[Plan]Task (completed bypdca design's new step),cc-version-analysisuses a single Task with subtask tracking,sprintuses per-feature Tasks.Verification
test/regression/issue-137-predecessor-task-completion.test.js— 25/25 assertions (guards the Phase Transition Rule + each per-transition completion instruction; fails if any is removed).check-skill-frontmatter,lint-skill-md,check-deadcode(195/0),docs-code-sync(2.1.29 invariant),validate-plugin --strict(0 err), Contract L1/L4 vs v2.1.9 (222) & v2.1.16 (243),integration-runtime23/23,l2-smoke105/105,l2-hook-attribution13/13,invocation-inventory213/213,docs-code-sync.test36/36,bkit-full-system36/36.main— qa-aggregate failing-file set is identical to the pre-existingmainbaseline (13 files).claude -p … --plugin-dir .process loads the updated skill and reads the new instruction + Phase Transition Rule heading.## [2.1.29].Docs = Code
Bilingual PDCA docs (plan/design/analysis/report
.en+.ko) + CHANGELOG + marketplace description synced.🤖 Generated with Claude Code
https://claude.ai/code/session_01W1jmB5L36rnEGjQtH5St9H