Skip to content

feat(knowledge): Phase 5 — skill integration#254

Open
leeovery wants to merge 15 commits intomainfrom
feat/knowledge-base-phase-5
Open

feat(knowledge): Phase 5 — skill integration#254
leeovery wants to merge 15 commits intomainfrom
feat/knowledge-base-phase-5

Conversation

@leeovery
Copy link
Copy Markdown
Owner

Summary

  • Integrates the Phase 4 knowledge CLI into the workflow skill system: Step 0 gate (check → hard stop or compact → proceed) across all 11 entry-point skills, automatic indexing at phase completion for the 5 indexed phases, lifecycle removals on cancellation / supersession / promotion, and completed_at tracking on every work-unit completion path
  • Covers every lifecycle path that moves, deletes, cancels, or reactivates knowledge-indexed artifacts — including feature-to-epic pivot, feature absorption into epics, epic topic cancel/reactivate, work-unit cancel/reactivate, and cross-cutting spec promotion. A shared reindex-work-unit.md reference consolidates the re-indexing pattern used by reactivation and pivot
  • One JS fix: discoverArtifacts now filters out cancelled work units so bulk index can't silently undo a cancellation. CLI test 80 added to prevent regression

Test plan

  • test-knowledge-cli.sh — 127/127 pass (was 126, added test 80)
  • test-workflow-manifest.sh — 176/176 pass
  • Exercise the hard stop path manually: invoke a /start-* or /continue-* skill on a project without the knowledge base set up → verify the "Knowledge Base Not Ready" block appears and workflow stops
  • Complete a discussion end-to-end → verify chunks appear via knowledge status
  • Cancel a work unit via the manage menu → verify chunks removed via knowledge status; reactivate → verify chunks restored
  • Pivot a feature with completed discussion to an epic → verify chunks re-indexed with work_type: epic
  • Supersede and promote specs in an epic → verify only the affected topic's spec chunks are removed; other topics and non-spec phases survive

🤖 Generated with Claude Code

leeovery and others added 15 commits April 16, 2026 21:14
Create shared reference knowledge-check.md that gates all workflow
entry points on knowledge base readiness (check → hard stop or
compact → proceed). Load it in Step 0 of all 11 entry-point skills
after migrations. Add allowed-tools for knowledge.cjs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add knowledge index calls at phase completion in 5 processing skills
(research, discussion, investigation, specification, scoping). Index
failure displays warning but does not block — artifact is already saved.

Add completed_at alongside every work-unit-level status:completed set
(5 bridge continuations, manage-work-unit, promote-to-cross-cutting).

Add allowed-tools for knowledge.cjs to 5 processing skills.

Files modified for completed_at:
- skills/workflow-bridge/references/{feature,bugfix,epic,cross-cutting,quickfix}-continuation.md
- skills/workflow-start/references/manage-work-unit.md
- skills/workflow-specification-process/references/promote-to-cross-cutting.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…n + promotion

Add knowledge remove to manage menu cancellation (removes all work
unit chunks), spec supersession (removes only superseded topic's spec
chunks), and spec promotion (removes promoted topic's spec chunks from
original work unit). All removals are non-blocking on failure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
No automatic catch-up for failed knowledge remove calls — unlike
indexing which has a pending queue. Stale chunks persist until
manual retry. Logged for future mitigation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Issue 2: Promoted spec permanently lost from knowledge base — the
cc work unit is born completed so no future completion event fires.
Add knowledge index after spec move in promote-to-cross-cutting.

Issue 3: Feature absorption orphans knowledge base chunks — moved
files were never re-indexed under the epic, and the deleted feature's
chunks were never removed. Add index for moved completed artifacts
and remove for the old feature work unit in absorb-into-epic.

Issue 4: Epic topic cancellation leaves stale chunks — add knowledge
remove on cancel, knowledge index on reactivate (completed indexed
phases only).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ation

Promote-to-cross-cutting section C: index discussions at new cc
location and remove old chunks from the epic. Previously only the
spec move was handled — discussions were orphaned.

View-completed reactivation: re-index all completed indexed-phase
artifacts when reactivating a cancelled work unit. Cancellation
removes all chunks, so reactivation must restore them.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
BUG 1: reactivation loop crashed when phases didn't exist. Extract
a shared reference that guards each indexed phase with an exists
check before querying for completed items.

BUG 2: bulk index re-added chunks from cancelled work units because
discoverArtifacts didn't filter by status. Filter out cancelled
work units at discovery time. Adds CLI test 80 to prevent regression.

BUG 3: feature-to-epic pivot left stale work_type in chunk metadata.
Re-index all completed artifacts after pivot so chunks pick up the
new work_type.

The shared reference skills/workflow-shared/references/reindex-work-unit.md
is reused by reactivation and pivot paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tighten the reactivation conditional in view-completed.md with an
explicit Otherwise branch so the closure/return scope is unambiguous.

Add a standard ## Parameters section to reindex-work-unit.md to match
the convention in convergence-analysis.md.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Hard violations:
- reindex-work-unit.md used the forbidden '→ Continue to' verb for
  loop iteration. Restructure to prose iteration with a single
  '→ Return to caller' exit.
- view-completed.md bold conditional branches left shared closure
  code un-routed. Collapse to an inline prose conditional so the
  single exit arrow covers the whole block.

Advisories:
- epic-display-and-menu.md conditional listed phases with commas;
  rephrase as 'one of the indexed phases (...)'.
- 5 conclusion files embedded rendering-instruction blockquotes
  inside numbered-list continuations. Break the failure-handling
  blocks out of the list (matching the existing 'Closure signpost:'
  pattern) so renderers don't mis-handle the blockquote inside a
  list item.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…Step 0

Document a new sub-step convention in CLAUDE.md scoped to early setup
steps (typically Step 0). Sub-steps use H3 with decimal numbering
('### Step 0.1: Name') and allow conditional branches inside one
sub-step to route to the next sub-step by name without duplicating
shared downstream content. Later steps must continue to use reference
files + progressive disclosure; sub-steps are not a general pattern.

Remove the `### 6a:` example from the heading hierarchy — it was
never an approved convention and was unused in the codebase.

Apply the new convention to all 11 entry-point skills: Step 0 now
decomposes into Step 0.1 (casing conventions), Step 0.2 (migrations),
Step 0.3 (knowledge check). This removes the previous duplication
where knowledge-check was loaded inside both branches of the
migration conditional. For start-* skills the phase title + signpost
move into Step 0.3 so they display once after migrations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The previous wording implied compaction is contingent on readiness
when it's actually a routine maintenance step that simply requires
the store to exist. Reframe as a gate + maintenance pair.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The summary sentence just restated what the A/B section headings
already convey. Structure is self-documenting.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…n view-completed

The previous wording 'If selected.status was cancelled, ...' was
inline-prose conditional, which isn't a CLAUDE.md convention. Split
into two H4 branches ('reactivate and cancelled' / 'reactivate and
completed'), each self-contained with its own body and routing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…check

Previous commit promoted both branches to H4, but the status-based
decision is nested inside the reactivate action. CLAUDE.md's nested
conditional example uses bold **If X:** for this case. Restore the
H4 'If user chose reactivate' as the top level, put the shared
status-setting command after it, then branch on previous status via
bold conditionals with each branch self-contained.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Migration 036 landed in Phase 4 and ran once. Phase 5 is what adds
the skill-code that sets completed_at at completion time. Between the
two PRs, any work unit that reached status=completed on main will
have no completed_at — invisible to compaction (silent non-compaction).

Migration 037 re-runs the same idempotent backfill logic under a new
migration ID so it fires once after Phase 5 lands, catching any work
units that slipped through the gap. Identical logic to 036; separated
only to give the migration orchestrator a reason to run it again.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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