Skip to content

fix(pdca): complete predecessor phase Task before advancing (#137, v2.1.29)#138

Merged
agent-kay-it merged 1 commit into
mainfrom
feat/v2.1.29-issue-137
Jul 6, 2026
Merged

fix(pdca): complete predecessor phase Task before advancing (#137, v2.1.29)#138
agent-kay-it merged 1 commit into
mainfrom
feat/v2.1.29-issue-137

Conversation

@agent-kay-it

Copy link
Copy Markdown
Contributor

Summary

Fixes #137 (@hslee-cmyk, low-priority/cosmetic, reported with a full reproduction).

The pdca skill chains phase Tasks via blockedBy ([Plan]→[Design]→[Do]→[Check]→…), but skills/pdca/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] for the entire 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, 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/additionalContext only and cannot call TaskUpdate — only the model can. TaskCreated/TaskCompleted are 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; archive completes the terminal [Report] Task; plan completes an optional [PM] Task.
  • New ### Phase Transition Rule (task completion) subsection under ## Task Integration states the general rule (complete every prior in_progress [Phase] {feature} Task) and 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. Related skills carry no multi-phase blockedBy chain: plan-plus creates a single [Plan] Task (completed by pdca design's new step), cc-version-analysis uses a single Task with subtask tracking, sprint uses per-feature Tasks.

Verification

  • New test/regression/issue-137-predecessor-task-completion.test.js25/25 assertions (guards the Phase Transition Rule + each per-transition completion instruction; fails if any is removed).
  • All static + contract gates green: 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-runtime 23/23, l2-smoke 105/105, l2-hook-attribution 13/13, invocation-inventory 213/213, docs-code-sync.test 36/36, bkit-full-system 36/36.
  • Zero new regressions vs main — qa-aggregate failing-file set is identical to the pre-existing main baseline (13 files).
  • Live QA: fresh claude -p … --plugin-dir . process loads the updated skill and reads the new instruction + Phase Transition Rule heading.
  • No architecture-count or runtime-behavior change (44 skills / 34 agents / 22 hook events / 195 lib modules unchanged). Version 2.1.28 → 2.1.29; CHANGELOG ## [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

….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
@agent-kay-it
agent-kay-it merged commit 76bd1af into main Jul 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant