Skip to main content

victor-codegraph

Shared repository → Code Semantic Graph compiler: symbol and relation extraction, hard-bounded embeddable chunks, repository-wide resolution/deltas, diagnostics, and a ProximaRecord projection. One compiler, three consumers — Victor (owner), the ProximaDB SDK ([codegraph] extra), and AnvaiOps (SaaS code-graph vertical).

Design: ProximaDB ADR-029 (authoritative) · Victor ADR-014 (owner/donor) · AnvaiOps ADR-0018 (consumer). This package is the TD-CG1 scaffold.

Why

The same tree-sitter code→symbol+relation chunker existed twice (ProximaDB SDK code.py and Victor victor-coding) and was about to be written a third time in AnvaiOps. This package is the single neutral home. It merges the best of both donors and fixes their two gaps:

  • Size-capping — ProximaDB's code.py emitted one chunk per symbol with no size bound (a huge function became a huge chunk). Here, oversized symbols are body-split with overlap (LlamaIndex CodeSplitter discipline). See sizing.py.
  • Real JS/TS — the donor JS/TS parser was a stub returning no symbols. Here JS/TS get a real tree-sitter extractor (functions, classes, methods, const … = () =>, imports).

Install

Published on PyPI as victor-codegraph. This source tree is version 0.9.0; consumers should use a compatible <1.0 pin.

# from PyPI
pip install victor-codegraph                 # Python-only (stdlib ast) path, zero native deps
pip install "victor-codegraph[treesitter]"   # + multi-language tree-sitter grammars

# dev (monorepo): editable, with tree-sitter grammars + test tooling
make -C victor-codegraph dev          # = pip install -e ../victor-contracts && pip install -e ".[dev]"
pip install -e ./victor-codegraph     # minimal editable install

Releasing

CI: .github/workflows/ci-codegraph.yml runs the suite (editable install, grammars on) for every PR touching victor-codegraph/**. Publishing: push a tag victor-codegraph-v0.1.0 to trigger .github/workflows/release-codegraph.yml, which builds and publishes via PyPI Trusted Publishing (OIDC — no API token). Configure the publisher once on PyPI (owner vjsingh1984, repo victor, workflow release-codegraph.yml, environments pypi / testpypi); see the header of that workflow.

0.9 consumer qualification and migration

Surface Contract / limit
Python references Exact import aliases and dotted modules; lexical scope precedes arity. Unknown receivers, wildcard ambiguity and shadowed bindings remain explicit unresolved references. No runtime execution/type inference.
ES modules Relative named/default/namespace imports, explicit named re-exports and exported arrow functions. Type-only imports produce dependencies, never runtime call evidence. Re-export traversal is cycle-safe and bounded to 64 bindings. Package/tsconfig aliases, star exports and dynamic exports remain unresolved.
Object-literal identity Methods include structural object scopes, including anonymous callback ancestry. Whitespace/comments and checkout root do not affect IDs; inserting/reordering anonymous siblings can change structural ordinals.
Source evidence Python call spans include UTF-8 byte offsets/lengths and end coordinates. New binding metadata is diagnostic evidence, not runtime authorization or a complete language semantic model.
Victor persistence The canonical snapshot supplies symbols. CLI distinguishes attempted upserts from persisted totals, exposes partial parses and accepts exact opaque IDs; ambiguous display names are not chosen arbitrarily. Default file exclusions can differ from the package walker.

Rebuild derived indexes after upgrading from older parser versions; an unchanged source hash alone does not migrate older IDs/edges. Victor users can run victor graph index --force --no-ccg --no-embeddings. Consumers must stage a new complete generation and switch readers after validation; never mix old and new symbol identities. The AnvaiOps adapter/generation migration remains consumer-owned. The package adds no commercial runtime, account, entitlement or billing dependency.

Use

from victor_codegraph import chunk, parse, parse_repo, to_proxima_records, ChunkConfig

# Size-capped, embeddable chunks:
chunks = chunk(source, file_path="app/service.py", config=ChunkConfig(max_chunk_tokens=512))

# Symbols + relations:
parsed = parse(source, file_path="app/service.py")

# Project to the ProximaDB substrate-keystone record shape (one symbol = row+node+vector):
records = to_proxima_records(parsed, repo_graph_id="myrepo", branch_id="main",
                             embedder=my_embed_fn)  # embedder optional

# Repository-wide resolution + file/import/containment graph:
repository = parse_repo(".", repo_id="myrepo")
records = to_proxima_records(repository, repo_graph_id="myrepo")

Design principles (the "best posture" this encodes)

  1. Chunk at symbol granularity (not statement, not fixed-size).
  2. Newline-preferred and hard-bounded — forced character splits are explicit; an optional tokenizer callback enforces the real model limit.
  3. Extract a Code Semantic Graph (CALLS/EXTENDS/IMPLEMENTS/CONTAINS/IMPORTS). Full intra-procedural CFG/CDG/DDG is a separate optional layer, not implied here.
  4. One structural v2 ID across symbols, chunks, relations, and records; line IDs remain aliases.
  5. Deletion-complete deltas — incremental output can be checked against a full rebuild.
  6. Observable fallback — every parse reports status, capability tier, and diagnostics.
  7. Explicit uncertainty — unresolved targets become structured external-reference nodes.

Status

0.9.0 source version. Python (ast) is the full, offline frontend. JS/TS, Go, Rust, Java, C, and C++ have conformance fixtures; other mapped tree-sitter languages report symbols-tier or fallback status rather than implying full fidelity.

Rust graph fidelity

Rust indexing retains inline module scopes and discriminates same-named trait implementations and conditional definitions in stable identities. Repository resolution follows declared library modules and explicit top-level use paths, including grouped imports, aliases, and local Cargo path dependencies. Hyphenated Cargo dependency names are normalized to their Rust underscore names.

Binary-owned or ambiguous files, conditional items/imports, #[path] overrides, workspace-inherited dependencies, re-export chains, macros and unknown receiver types retain unresolved references. Glob imports retain a module dependency but do not guess call targets. This is a conservative static graph, not rustc name resolution or evidence that a call executes. Publish this package before a Victor release that requires its 0.9.0 repository graph contract.

Metadata

Release files for victor-codegraph 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for victor-codegraph 0.9.0
File Size Uploaded
victor_codegraph-0.9.0.tar.gz 68.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for victor-codegraph 0.9.0
File Interpreter ABI Platform
victor_codegraph-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 120.7 kB

Release files / victor_codegraph-0.9.0.tar.gz

Download URL victor_codegraph-0.9.0.tar.gz
Size 68.1 kB
Tags Source
SHA-256 checksum
How to use checksums
18d098f6a038fa174449d4ac9568613340ff763b6c8f3c3c4204d1bb10d0ad52
BLAKE2b-256 checksum
How to use checksums
30cf918c80fe39f530ade5d5ea0b3ad8e896719226b9faa120be2a3ff998e8ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Release files / victor_codegraph-0.9.0-py3-none-any.whl

Download URL victor_codegraph-0.9.0-py3-none-any.whl
Size 52.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c34f957bc8874f042133665fc5261d47458e6839f0ce6ba88c1683da5ab0a808
BLAKE2b-256 checksum
How to use checksums
a673a36c0e04529d7d58a66ec244337c2d5f58333a332a5361270f951b41bd56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Release history Release notifications | RSS feed

0.10.3

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.10.0

2 release files

This release

0.9.0 This release

2 release files

0.8.1

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page