Skip to content

feat(knowledge): Phase 6 — retrieval integration#255

Open
leeovery wants to merge 9 commits intofeat/knowledge-base-phase-5from
feat/knowledge-base-phase-6
Open

feat(knowledge): Phase 6 — retrieval integration#255
leeovery wants to merge 9 commits intofeat/knowledge-base-phase-5from
feat/knowledge-base-phase-6

Conversation

@leeovery
Copy link
Copy Markdown
Owner

Summary

Phase 6 wires the knowledge CLI into the skill system as a queryable resource — when and how skills reach into the knowledge base for context during a phase. Three-layer integration per the design doc.

  • Layer 1 — Knowledge skill (skills/workflow-knowledge/SKILL.md): API docs for the query layer — commands, flags, output format, confidence tiers, two-step retrieval, do-nots.
  • Layer 2 — Per-phase usage + contextual query: shared references (knowledge-usage.md, contextual-query.md) loaded early in all processing skills except specification. Research, discussion, and investigation also run a single contextual query at phase start.
  • Layer 3 — Inline callouts + planning-entry cross-cutting query: short nudges at high-value moments in all processing skills except specification. Planning entry's manual cross-cutting reader is replaced with a targeted semantic query filtered to work_type: cross-cutting.

Query failures pause the workflow with retry/skip options per design doc guidance (silent skips would erase the knowledge base's value). allowed-tools entries for knowledge.cjs added to planning, implementation, review, and planning-entry.

Stacked on feat/knowledge-base-phase-5 — PR base is the phase-5 branch, not main.

Test plan

  • bash tests/scripts/test-knowledge-cli.sh — 127/127 pass
  • bash tests/scripts/test-workflow-manifest.sh — 176/176 pass
  • All 37 migration tests pass
  • Every modified SKILL.md declares Bash(node .claude/skills/workflow-knowledge/scripts/knowledge.cjs) in allowed-tools
  • Step renumbering is internally consistent across SKILL.md + references for each processing skill
  • Manual: start a discussion in a project with indexed knowledge, verify contextual query surfaces prior work
  • Manual: start a specification, verify no contextual query runs
  • Manual: simulate a failed query, verify workflow pauses with retry/skip options

🤖 Generated with Claude Code

leeovery and others added 9 commits April 18, 2026 20:01
Documents the knowledge CLI as the API reference loaded by Layer 2
per-phase usage guides. Covers query (single + batch), flags, search
modes, output format, confidence tiers, two-step retrieval, and what
not to do.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds shared references for autonomous knowledge querying:
- knowledge-usage.md: trigger heuristics, query construction, failure
  handling (pause-with-options), phase-specific notes
- contextual-query.md: single query at research/discussion/
  investigation phase start

Wires the refs into all processing skills (except specification —
explicitly excluded from automatic retrieval). Adds
knowledge.cjs to allowed-tools on planning, implementation, and
review. Renumbers downstream steps and internal routing.

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

Adds short inline nudges at high-value moments in all processing
skills except specification (research, discussion, investigation,
scoping, planning, implementation, review) — brief reminders to
query the knowledge base at decision points, root cause synthesis,
task entry, etc. Not new steps; embedded at step boundaries.

Replaces planning-entry's manual cross-cutting spec reader with a
targeted semantic query (--work-type cross-cutting --phase
specification), keeping the in-progress-cross-cutting warning
intact. Query text is built from the topic's spec summary, not
the slug. Adds knowledge.cjs to planning-entry allowed-tools.

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

Moves knowledge-check, reindex-work-unit, knowledge-usage, and
contextual-query from skills/workflow-shared/references/ into
skills/workflow-knowledge/references/ so the knowledge skill owns
its domain references. workflow-shared/references/ now holds only
truly cross-domain protocols (casing, compliance, background-agents,
natural-breaks, convergence).

Updates all 22 caller Load directives and attribution headers. No
behavioural changes — structural reorganisation only.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
SKILL.md is now the single source for query construction examples
and two-step retrieval. knowledge-usage.md keeps the context-level
principles (short) and points to SKILL.md for examples and the flag
table. contextual-query.md defers to knowledge-usage.md B for
construction rules (same deferral pattern it already uses for D
failure handling).

No behavioural change — removes verbatim duplication so future
guidance updates land in one place.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- knowledge-usage.md D: both retry/skip branches now end with explicit
  → Return to caller
- contextual-query.md B: adds explicit routing for both non-zero and
  exit-0 branches, with post-D skip vs retry-succeeded sub-routing
- cross-cutting-context.md B: restructures in-progress sub-branches
  to use bold nested conditionals with explicit Proceed/Return routing
- cross-cutting-context.md C: adds post-D routing (skip vs retry) so
  every branch is self-contained per CLAUDE.md convention

No behavioural change — makes the control flow explicit where it
previously relied on implicit fall-through.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Research Step 6 is terminal (Research Session) — there is no backbone
step after it. The "returns to the backbone to proceed toward
conclusion" phrasing was copy-pasted from discussion's final-review.md
where Step 6 IS a backbone step with Step 7+ after. Narrative now
describes the actual control flow: return to topic-completion which
runs document review, compliance, and the conclude menu.

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

Planning-time KB queries create an escape hatch that undermines the
spec's golden-doc status. The pipeline already captures context via
discussion → spec; spec gaps are blockers, not KB-fill opportunities.

- knowledge-usage.md E:
  - Planning: do not query. Spec is golden; gaps go back to the user.
    Cross-cutting stays at entry only (existing mechanism).
  - Implementation: code is source of truth for *what*; KB is only
    for *why* context behind existing patterns (rare).
  - Review: cross-work-unit consistency checks only.
- planning SKILL.md: remove inline callout (encouraged anti-pattern).
- implementation SKILL.md: narrow inline callout to why-only usage.
- review SKILL.md: narrow inline callout to cross-work-unit checks.

Research, discussion, investigation, scoping callouts unchanged —
autonomous querying is legitimate there (exploring, deciding,
diagnosing).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The "previously this loaded every spec..." paragraph documented what
the file used to do, not what it does. Rot magnet. Replaced with a
description of current behaviour only.

Co-Authored-By: Claude Opus 4.7 (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