Skip to content

Add codegraph: deterministic code graph, fold over git history, and Obsidian vault review - #59

Draft
mazze93 wants to merge 3 commits into
mainfrom
feat/codegraph-review
Draft

mazze93 wants to merge 3 commits into
mainfrom
feat/codegraph-review

Conversation

@mazze93

@mazze93 mazze93 commented Nov 27, 2026

Copy link
Copy Markdown
Owner

Before: there was no repeatable way to see the codebase as a graph, or to replay how it changed. Review findings rested on reading files by hand, and an earlier circuit review overstated one bug.

After: python3 tools/codegraph/codegraph.py --repo . --out codegraph-vault walks every commit and builds a graph of files, types, functions, imports, conformances, references and calls. It writes an Obsidian vault with a note per node and per commit, type, file and module matrices (Markdown plus CSV), a CycloneDX SBOM, and a graph-grounded findings page. Running it twice gives byte-identical output, and the current state equals a fold of the per-commit deltas over the log.

The vault is derived output, so it is gitignored. Only the generator, its config, its tests and the review are committed (decision appended to DECISIONS.md).

How: Python 3.7+ stdlib only, no network. It reads git objects (ls-tree, cat-file) and never the working tree. Swift parsing and the SwiftPM manifest live behind an adapter (cgcore/adapters), and all repo-specific settings are in codegraph.config.json. verify_determinism.py checks hash-seed independence, idempotence, a clean copy of the committed generator, and the fold law for every commit.

Proof (run on 61347c4):

  • python3 -m unittest discover -s tools/codegraph/tests: 14 tests OK
  • python3 tools/codegraph/verify_determinism.py: hash-seed independence (846 files), idempotence (written 0), clean copy identical, fold law 132/132 with mainline fold of 114 deltas == HEAD
  • Output is byte-identical under Python 3.9 and 3.13.

Review: docs/review/codegraph-review_v1.0.0_2026-11-27.md. It corrects the earlier claim that the hashValue schema hash fires T5 on every load (nothing reads the hash today, so it's latent). It also finds that widenUncertainty lowers the variance of the uninformed prior, that the 0.15 instability threshold and the mean-collapse test can't be reached, and that the circuit's outputs aren't wired into the weights yet.

No Swift sources change, so the macOS build and tests are unaffected.


Generated by Claude Code

…de graph and Obsidian vault

Adds tools/codegraph: Python 3.9+ stdlib scripts that project every commit
into a graph (package, targets, products, files, types, functions, framework
imports, API probe sites), diff each against its first parent, and fold the
deltas into a HEAD projection. Writes dependency matrices (modules, files,
types; Markdown + CSV), a CycloneDX SBOM, and a gitignored Obsidian vault
with one note per node and per commit.

Language-specific code sits behind an adapter boundary (Swift + SwiftPM
first); everything repo-specific is in codegraph.config.json.

Verified: fold law holds on all 129 commits; byte-identical output across
PYTHONHASHSEED 0/12345/random and across Python 3.9.25 and 3.13; a rerun
writes nothing; 14 unit and end-to-end tests pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review findings verified against the graph, the code and numeric replicas.
Corrects the earlier circuit review's claim that the hashValue schema hash
fires T5 on every load: nothing reads the hash today, so the bug is latent.
Appends the gitignored-vault decision to DECISIONS.md and documents the
function-reference resolution gap in the codegraph README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <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.

2 participants