Skip to content

feat(graph): knowledge base — deterministic csdd graph + LLM-authored wiki#46

Merged
protonspy merged 2 commits into
mainfrom
feat/knowledge-base
Jul 6, 2026
Merged

feat(graph): knowledge base — deterministic csdd graph + LLM-authored wiki#46
protonspy merged 2 commits into
mainfrom
feat/knowledge-base

Conversation

@protonspy

Copy link
Copy Markdown
Owner

Implements docs/plans/PLAN-knowledge-base.md end-to-end (R1–R17, M1–M6): a persistent, deterministic knowledge graph over the workspace plus an LLM-authored wiki, both driven through the CLI as the single mutation path.

What's in it

internal/graph/ — pure Go, cgo-free

  • Extractor contract (Matches/Extract) over specs, .claude/, CLAUDE.md, .mcp.json, docs/wiki/, docs/raw/, docs/stack.md, and Go source (go/parser, syntax-only).
  • Canonical node IDs (NFKC → non-word→_ → casefold), confidence tiers (EXTRACTED/INFERRED/AMBIGUOUS), NetworkX node-link JSON.
  • Byte-stable assembly + append-only log.md; incremental builds byte-identical to a full rebuild.
  • analyze: spec traceability gaps + wiki lints + tech-contract lints.
  • Query engine: tier×IDF ranking, super-hub gating, token budget; path (BFS) and explain; self-contained HTML export.

CLI

  • csdd graph build|query|path|explain|analyze|export and csdd wiki init|lint.
  • analyze --strict gates non-zero for CI.
  • Workspace marker moves to .csdd/ with legacy .claude/ upgrade guidance; manifest migrates .claude/.csdd-manifest.json.csdd/manifest.json with read-fallback.

Web — read-only Graph tab reading docs/graph/graph.json through the existing hardened /api/file route (host guard + auth), with a backend test asserting a foreign Host is rejected.

Templates / agent layer — graph/wiki/stack skills, /csdd-graph-* /csdd-wiki-* /csdd-stack-* slash commands, a knowledge-base steering rule, the wiki scaffold, and a managed Knowledge base section in CLAUDE.md. csdd init lays down the full docs/ + .csdd/ layout.

Verification

  • Unit + CLI + web + E2E golden-path tests; go test -race ./internal/... ./cmd/... clean.
  • go vet clean; all six release targets build with CGO_ENABLED=0.
  • vite build (frontend) succeeds → make web-build passes in CI.
  • Dogfooded on this repo (1481-node graph): graph is byte-stable (full == incremental). Fixed two determinism bugs found this way — self-referential citations to generated paths, and npm scoped-package key collisions (@monaco-editor/react vs react).

Notes

  • docs/ and .csdd/ are intentionally left untracked (maintainer's local workspace, like /.claude/); the templates generate those scaffolds in user workspaces.

protonspy added 2 commits July 6, 2026 19:59
… wiki

Implements docs/plans/PLAN-knowledge-base.md end-to-end (R1–R17): a
persistent, deterministic knowledge graph over the workspace plus an
LLM-authored wiki, both driven through the CLI as the single mutation path.

internal/graph/ (pure Go, cgo-free):
- Extractor contract (Matches/Extract) over specs, .claude, CLAUDE.md,
  .mcp.json, docs/wiki, docs/raw, docs/stack.md, and Go source (go/parser).
- Canonical node IDs (NFKC → non-word→_ → casefold), confidence tiers
  (EXTRACTED/INFERRED/AMBIGUOUS), node-link JSON (NetworkX-compatible).
- Byte-stable assembly with deterministic ordering; append-only log.md;
  incremental builds byte-identical to a full rebuild.
- analyze: traceability gaps (untested criteria, orphan tasks, unimplemented
  components, pending refs, range shorthand, dependency cycles) + wiki lints
  (broken wikilinks, orphan pages, index/log desync, unprocessed sources) +
  tech-contract lints (undeclared/phantom/unrefined, no-contract).
- Query engine: tier×IDF ranking, super-hub gating, token budget; path (BFS)
  and explain; self-contained HTML export.

CLI: csdd graph build|query|path|explain|analyze|export and
csdd wiki init|lint. --strict gates analyze non-zero for CI. Workspace marker
moves to .csdd/ with legacy .claude/ upgrade guidance; manifest migrates from
.claude/.csdd-manifest.json to .csdd/manifest.json with read-fallback.

Web: read-only Graph tab (docs/graph/graph.json) served through the existing
hardened /api/file route (host guard + auth).

Templates/agent layer: graph/wiki/stack skills, /csdd-graph-*, /csdd-wiki-*,
/csdd-stack-* slash commands, knowledge-base steering rule, wiki scaffold, and
a managed Knowledge base section in CLAUDE.md. csdd init lays down the full
docs/ + .csdd/ layout.

Tested: unit + CLI + web + E2E golden-path; -race clean; go vet clean; all six
release targets build with CGO_ENABLED=0; graph byte-stable on this repo.
Lowercase/de-punctuate the workspace-guard and same-node path errors, fold a
range-append loop and an unconditional TrimPrefix, and drop the unused
criterion-ref helpers (reCriterionRef, isValidCriterionRef, requirementRefParts)
and the now-orphan strconv import. No behavior change.
@protonspy protonspy merged commit 17cbb64 into main Jul 6, 2026
6 checks passed
@protonspy protonspy deleted the feat/knowledge-base branch July 6, 2026 23:17
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