feat(graph): knowledge base — deterministic csdd graph + LLM-authored wiki#46
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements
docs/plans/PLAN-knowledge-base.mdend-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-freeMatches/Extract) over specs,.claude/,CLAUDE.md,.mcp.json,docs/wiki/,docs/raw/,docs/stack.md, and Go source (go/parser, syntax-only)._→ casefold), confidence tiers (EXTRACTED/INFERRED/AMBIGUOUS), NetworkX node-link JSON.log.md; incremental builds byte-identical to a full rebuild.analyze: spec traceability gaps + wiki lints + tech-contract lints.path(BFS) andexplain; self-contained HTML export.CLI
csdd graph build|query|path|explain|analyze|exportandcsdd wiki init|lint.analyze --strictgates non-zero for CI..csdd/with legacy.claude/upgrade guidance; manifest migrates.claude/.csdd-manifest.json→.csdd/manifest.jsonwith read-fallback.Web — read-only Graph tab reading
docs/graph/graph.jsonthrough the existing hardened/api/fileroute (host guard + auth), with a backend test asserting a foreignHostis 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 inCLAUDE.md.csdd initlays down the fulldocs/+.csdd/layout.Verification
go test -race ./internal/... ./cmd/...clean.go vetclean; all six release targets build withCGO_ENABLED=0.vite build(frontend) succeeds →make web-buildpasses in CI.@monaco-editor/reactvsreact).Notes
docs/and.csdd/are intentionally left untracked (maintainer's local workspace, like/.claude/); the templates generate those scaffolds in user workspaces.