Skip to content

inception(phase-8): imports — copy + manifest + KB index, blank feature research#273

Open
leeovery wants to merge 22 commits into
idea/inception-pr-7-self-healingfrom
idea/inception-pr-8-imports
Open

inception(phase-8): imports — copy + manifest + KB index, blank feature research#273
leeovery wants to merge 22 commits into
idea/inception-pr-7-self-healingfrom
idea/inception-pr-8-imports

Conversation

@leeovery
Copy link
Copy Markdown
Owner

Summary

Phase 8 of the inception/discovery-map initiative. Unifies and completes the imports machinery so that imports become a first-class indexed phase that surfaces via the existing contextual KB query at session start, instead of being dumped verbatim into research files.

  • Symmetry/start-epic and /start-feature i/import flows now share a single workflow-shared/references/import-files.md reference: validate paths, normalise filenames, copy to .workflows/{wu}/imports/, push manifest entry, KB-index. The asymmetry of "epic uses imports/, feature merges into research" goes away.
  • Behaviour change for features — research file starts from the standard template (blank Starting Point). The source=import dump branch in workflow-research-process/initialize-research.md is gone.
  • KB indexingimports is now in INDEXED_PHASES. New chunking config at skills/workflow-knowledge/chunking/imports.json (low confidence, mirrors research). deriveIdentity parses .workflows/{wu}/imports/{filename}.mdtopic = filename. Bundle rebuilt and committed.
  • Displaycontinue-epic shows · N imported seed(s) under the Discovery Map summary line when manifest.imports[] is non-empty. discovery.cjs exposes imports_count.
  • Out of scope (per discovery-map/phase-08-imports.md): auto-split imports at import time (rejected); refinement-driven import removal (deferred — knowledge.cjs remove --phase imports --topic X works, no UI yet); legacy merged-import migration (legacy stays); continue-feature display of imports.

Stacked on PR #272 (Phase 7) — base branch idea/inception-pr-7-self-healing. No merge to main until the initiative completes.

Test plan

  • bash tests/scripts/test-knowledge-cli.sh — 186 pass (added 4 imports tests: index, query provenance, remove, re-index idempotency)
  • node --test tests/scripts/test-knowledge-store.cjs — 50 pass (added phase=imports identity round-trip)
  • node --test tests/scripts/test-knowledge-chunker.cjs — 49 pass (imports.json in phases array, low tier, multi-section chunking)
  • node --test tests/scripts/test-discovery-for-continue-epic.cjs — 76 pass (added imports_count: zero / missing / positive / format-output)
  • bash tests/scripts/test-knowledge-build.sh — 5 pass (bundle still rebuilds cleanly)
  • bash tests/scripts/test-workflow-manifest.sh — 214 pass (no schema changes)
  • node --test tests/scripts/test-knowledge-{retry,integration,config,embeddings,openai}.cjs — all green
  • node --test tests/scripts/test-discovery-{utils,...all variants}.cjs — 315 pass

Verification follow-ups (manual smoke)

  • /start-epici/import → file copies to imports/, manifest tracks, KB indexes; inception reads imports as launchpad; /continue-epic shows · 1 imported seed.
  • /start-featurei/import → file copies, manifest tracks, KB indexes; research session opens with blank Starting Point (regression check); contextual-query surfaces imported chunks.
  • knowledge.cjs query "<topic>" --boost:work-unit {wu} returns chunks with [imports | wu/filename | low | <date>] provenance line.
  • Re-import idempotency: import the same file twice; second run replaces chunks (no duplicates).
  • Legacy regression: pre-Phase-8 feature epic with merged-import research stays as-is; no migration runs.

🤖 Generated with Claude Code

leeovery added a commit that referenced this pull request May 10, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
leeovery and others added 22 commits May 11, 2026 22:18
…d deriveIdentity branch and imports.json chunking config

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

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

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…copy + manifest push + KB index

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

knowledge.cjs already declared in SKILL.md allowed-tools; the shared
import-files reference inherits that whitelist when invoked.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…t-import.md with shared reference

knowledge.cjs already declared in SKILL.md allowed-tools; the shared
import-files reference inherits that whitelist when invoked.

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

Feature research now starts from the standard template with a blank
Starting Point. Imports stay under imports/ as the source of truth and
surface via the contextual KB query at session start.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…both feature and epic flow through standard initialize path

Drop the special epic exploration filename mapping and trim the import
handoff to drop the verbatim file list (manifest tracks it now).
Source field stays informational; the invoke handoff still surfaces
'Source: import' for visibility.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…render N imported seed(s) line in epic-display-and-menu

Imports callout sits under the Discovery Map summary line, above the
convergence callout. format() also surfaces imports_count when non-zero
for parity with other detail fields.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…dge-store, knowledge-chunker; add imports_count to continue-epic discovery tests

knowledge-cli: index/query/remove round-trip on imports, idempotent
re-index check.
knowledge-store: identity round-trip with phase: imports.
knowledge-chunker: imports.json present in phases array, low confidence
tier, multi-section seed file produces per-section chunks.
continue-epic discovery: imports_count returns zero when missing,
positive when manifest.imports[] has entries; format() includes
imports_count line only when non-zero.

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

epic-display-and-menu.md: replace nested @if pluralisation with two
explicit @if blocks (one for count==1, one for count>1) — clearer and
matches the if/else style used by the convergence callout.

import-files.md: extend collision check in B. Normalise Filenames to
include destinations chosen earlier in the same batch. Without it, the
user providing the same source path twice in one prompt would cause the
second copy to silently overwrite the first.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…o rebuild and bulk index process them

discoverArtifacts() iterated INDEXED_PHASES against wu.phases[phase].items,
which works for the four phase items but skips imports — those live at
top-level wu.imports[]. Without this branch, knowledge rebuild would
permanently drop imports chunks (the rebuild wipes the store and re-
indexes only what discoverArtifacts returns). Bulk index (no args) and
status's unindexed-artifact check were similarly blind to imports.

Add a separate traversal: read wu.imports[], resolve each path relative
to .workflows/{work_unit}/, derive topic from basename (mirroring
deriveIdentity), and emit { file, workUnit, phase: imports, topic }.

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

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

reindex-work-unit.md is loaded by feature-to-epic pivot (to refresh
work_type metadata on chunks) and by cancelled-work-unit reactivation
(to restore chunks). It iterated four phase items only — without an
imports pass, a feature with imports pivoted to epic would leave its
imports chunks tagged work_type=feature, and a reactivated cancelled
work unit would never restore its imports chunks. Add a B section that
reads wu.imports[] and re-indexes each entry.

SKILL.md description: mention imports alongside the four completed-
artifact phases so the high-level paragraph matches the What is indexed
list below it.

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

Pairs with the discoverArtifacts imports branch — confirms a no-args
bulk index picks up imports tracked on the manifest and writes their
chunks (queryable with [imports | wu/topic] provenance afterwards).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…— path validation + topic dedup

Previously trusted manifest.imports[] entry.path as-is. A tampered or
malformed entry (path-traversal "..", subdirectory, dotfile basename)
would have been resolved relative to .workflows/{wu}/ and indexed —
poisoning the store with chunks pointing outside the imports/ tree.

Now require entry.path to match imports/{filename}.md exactly: no
subdirectories, no .. segments, no dotfile basenames. Mirrors the
checks deriveIdentity already performs for the per-file index path.

Also dedupe by topic identity (work_unit + imports + basename) within
the loop. Re-imports legitimately push duplicate manifest entries (the
plan accepts this as minor noise), but bulk index should still process
each identity once.

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

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ion + clarify SKILL.md

reindex-work-unit.md Section B now uses the exists-then-get pattern
(exists exits 0/false vs get exits 2 when the field is absent — the
caller-blocking failure-mode footgun). Documents the imports/{filename}.md
shape requirement so the model skips malformed entries inline rather
than letting them flow to the index call.

SKILL.md confidence-tier table: low row now lists Research OR Imports
(disambiguated by phase field on the provenance line) — previously read
as Research-only, which was wrong post-Phase-8.

SKILL.md rebuild description: replaces "all completed artifacts" with
the explicit list (the four phase artefacts plus imports[]) so users
understand imports survive rebuild.

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

workflow-inception-entry/gather-context.md: comment said KB indexing of
imports lands in a later phase. Phase 8 IS that phase — files were
already copied + indexed at start-epic. Comment now describes the read
as a handoff-surface concern, not a placeholder.

start-feature/research-gating.md: import option said "Import existing
research files verbatim". Post-Phase-8, imports stay under imports/ as
seed material — they don't become research files. Updated to reflect
the new behaviour (research starts blank; imports surface via KB
retrieval).

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

87b — bulk index ignores tampered manifest.imports[] entries (path-
traversal, dotfile, subdirectory). Confirms the new validation in
discoverArtifacts rejects malformed paths before reading the file.

87c — bulk index dedupes duplicate manifest entries (re-import pushes
the same path twice; should still produce one index call).

87d — work-unit-level remove (--work-unit alone, no --phase) clears
imports chunks alongside phase-artefact chunks. Pairs with the
cancellation flow that uses this same shape.

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

Captures four items surfaced during Phase 8 audit that didn't fit the
parent phase's scope:

1. Feature absorption silently deletes imports/. Pre-Phase-8 there was
   nothing to delete; post-Phase-8 the absorb flow needs to either
   carry imports forward or warn before deleting.
2. continue-feature lacks the imported-seed callout (Phase 8 doc
   explicitly limited the display surface to continue-epic).
3. cmdRebuild error message wording references "completed artifacts"
   but rebuild now also pulls in imports[] entries.
4. Inception subsequent sessions and refinement entry don't query the
   knowledge base at session start. Design says they should ("KB
   retrieval, no auto-read") — pre-existing gap from Phase 4 that
   Phase 8's KB indexing of imports makes more visible.

INDEX.md updated: Phase 14 row, dependency arrow Phase 13 → Phase 14,
branch table entry. None of the four items have ordering dependencies
on each other — implementer can pick them off independently.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@leeovery leeovery force-pushed the idea/inception-pr-8-imports branch from 43b8c59 to bfc8062 Compare May 11, 2026 21:18
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