Skip to content

feat(kb): hierarchical org Phase 2 — maintainer/dream migrate old→new — 0.23.1#12

Merged
Cain-Ish merged 1 commit into
mainfrom
feat/kb-org-phase2-maintainer-migration
Jun 2, 2026
Merged

feat(kb): hierarchical org Phase 2 — maintainer/dream migrate old→new — 0.23.1#12
Cain-Ish merged 1 commit into
mainfrom
feat/kb-org-phase2-maintainer-migration

Conversation

@Cain-Ish

@Cain-Ish Cain-Ish commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Why

Phase 1 (0.23.0) gave the projection machinery; this teaches the editing skills to use + maintain it — the "fix old→new" capability — and was verified end-to-end on the live KB.

What

  • knowledge-maintainer Phase 3 gains a project-structure reconciliation step: read project-registry.jsonl, run kb-project-backfill.sh for part_of trees (deterministic), and for unlabeled pages get a reproducible suggestion from new kb-project-suggest.sh (plurality of edge-neighbours' project: facets). Additive assign + log; re-parent stages; closed vocabulary; never tags generated projects//themes/ pages. Budget-priority guard updated to rank it below the conflict drain.
  • dream (runner + SKILL) is surface-only: knows project MOCs exist + are excluded from clustering input, surfaces ungrouped-project suggestions for the maintainer, and never assigns project: on the live path (test-guarded).
  • knowledge-validate broken-link check splits [[target|alias]] before resolving (was a false-positive on every valid aliased link — same alias rule as the 0.22.4 graph-migrate fix). MCP server → 2.4.1.

Verified on the LIVE KB

Seeded registry (kiri-redesign→kiri) → backfill tagged the 14-member kiri tree → assigned cainish-bridge (3, no part_of) → reindex projected wiki/projects/{kiri,cainish-bridge}.md + the de-hubbed two-tier index → drained 7 dangling/junk migration:v1 edges → validate reports 0 issues.

Release-gate review

Unit + history lenses, 0 false positives. Fixed: budget-guard (4 jobs, project ranks below conflict-drain), KNOWLEDGE_DIR fallback in both helpers, surface-only test now asserts the real "does not assign on the live path" prohibition. New guards: test-kb-project-suggest.sh, test-kb-skill-awareness.sh, validate alias-split test.

Verification

Full suite green (63 shell + 291 vitest, 0 fail); lockstep 0.23.1 / MCP 2.4.1; validate + migration-row gates; pre-push hook green.

🤖 Generated with Claude Code

… — 0.23.1

Teaches the editing skills to USE + MAINTAIN the 0.23.0 structure (the "fix old
into new" capability), and fixes a validate false-positive surfaced while verifying
on the live KB:

- knowledge-maintainer Phase 3 gains a project-structure reconciliation step:
  read project-registry.jsonl, run kb-project-backfill.sh for part_of trees, and
  for unlabeled pages get a reproducible suggestion from new kb-project-suggest.sh
  (plurality of edge-neighbours' project: facets). Additive assign + log; re-parent
  stages; closed vocabulary; never tags generated projects/themes pages.
- dream-runner + dream SKILL.md are surface-only: they know project MOCs exist +
  are excluded from clustering input, and surface ungrouped-project suggestions for
  the maintainer (never assign on the live path).
- knowledge-validate broken-link check splits [[target|alias]] before resolving
  (was a false-positive on every valid aliased link — same alias rule as the 0.22.4
  graph-migrate fix). MCP server -> 2.4.1.

New guards: kb-project-suggest test, kb-skill-awareness test, validate alias-split
test. Version 0.23.0 -> 0.23.1 lockstep + migration row. Full suite green (63 shell
+ 291 vitest).

Verified end-to-end on the LIVE KB: seeded registry (kiri-redesign->kiri), backfill
tagged the 14-member kiri tree, assigned cainish-bridge (3, no part_of), reindex
projected wiki/projects/{kiri,cainish-bridge}.md + the de-hubbed two-tier index;
drained 7 dangling/junk migration:v1 edges; validate now reports 0 issues.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 2, 2026 14:50
@Cain-Ish Cain-Ish merged commit e8d66af into main Jun 2, 2026
1 check passed
@Cain-Ish Cain-Ish deleted the feat/kb-org-phase2-maintainer-migration branch June 2, 2026 14:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR advances the KB hierarchical organization work by adding “Phase 2” maintainer/dream awareness + reconciliation tooling, plus a validation fix for aliased wiki links. It introduces a deterministic project: suggestion helper, updates maintainer/dream guidance to keep “dream” surface-only for live project: assignment, and bumps plugin/MCP versions.

Changes:

  • Add kb-project-suggest.sh (plurality vote over neighbors’ project: facets) and new shell guards to lock in maintainer/dream awareness.
  • Fix knowledge-validate broken-link false positives by resolving [[target|alias]] to target.
  • Bump plugin version to 0.23.1 and MCP server version to 2.4.1 (plus rebuilt dist artifacts).

Reviewed changes

Copilot reviewed 13 out of 22 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/test-kb-skill-awareness.sh New guard ensuring maintainer/dream docs retain project/MOC awareness + dream “surface-only” prohibition.
tests/test-kb-project-suggest.sh New integration test for deterministic plurality output (and empty output on no-signal).
skills/upgrade/SKILL.md Adds the 0.23.1 migration registry entry documenting Phase 2 behavior.
skills/dream/SKILL.md Documents project MOCs and explicitly forbids live project: assignment by dream.
scripts/kb-project-suggest.sh New deterministic helper to suggest project: based on edge-neighbor plurality.
scripts/kb-project-backfill.sh Updates knowledge-dir fallback to include KNOWLEDGE_DIR.
mcp/src/tools/knowledge-validate.ts Splits rawRef on `
mcp/src/tools/knowledge-validate.test.ts Adds regression test for [[target|alias]] not being flagged broken.
mcp/src/server.ts Bumps MCP server version string to 2.4.1.
mcp/dist/tools/knowledge-validate.test.js.map Rebuilt dist sourcemap reflecting the new validate test.
mcp/dist/tools/knowledge-validate.test.js Rebuilt dist test JS reflecting the new validate test.
mcp/dist/tools/knowledge-validate.js.map Rebuilt dist sourcemap reflecting alias-split logic.
mcp/dist/tools/knowledge-validate.js Rebuilt dist JS reflecting alias-split logic.
mcp/dist/tools/knowledge-validate.d.ts.map Rebuilt dist d.ts sourcemap.
mcp/dist/tools/knowledge-validate.bundle.js Rebuilt bundle reflecting alias-split logic.
mcp/dist/tools/knowledge-reindex.bundle.js Rebuilt bundle (includes embedded validate logic).
mcp/dist/server.js Rebuilt dist server JS version bump.
mcp/dist/server.bundle.js Rebuilt dist server bundle version bump.
agents/knowledge-maintainer.md Adds project reconciliation/backfill/suggest responsibilities + budget priority update.
agents/dream-runner.md Adds project MOC awareness + explicit “surface-only” guidance for live project:.
.claude-plugin/plugin.json Plugin version bump to 0.23.1.
.claude-plugin/marketplace.json Marketplace version bump to 0.23.1.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +10 to +16
while [ $# -gt 0 ]; do
case "$1" in
--knowledge-dir) KDIR="${2:-}"; shift 2 ;;
--slug) SLUG="${2:-}"; shift 2 ;;
*) shift ;;
esac
done
Comment on lines +24 to +26
NBRS=$(jq -rn --arg s "$SLUG" 'reduce inputs as $r ({}; .[([$r.from,$r.type,$r.to]|tojson)]=$r) | [.[]]
| map(select(.valid_to==null and (.from==$s or .to==$s)))
| .[] | (if .from==$s then .to else .from end)' < "$EDGES" 2>/dev/null | sort -u)
Comment on lines +29 to +32
proj_of() { # <slug> → its project: facet (empty if none)
local f; f=$(find "$WIKI" -name "$1.md" -type f ! -name 'index.md' 2>/dev/null | sort | head -1)
[ -n "$f" ] || return 0
awk -F': *' '/^project:/ { gsub(/["[:space:]]/,"",$2); print $2; exit }' "$f"
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.

2 participants