Files
Tirth Kanani 039f231a63 docs(diagrams): correct stale and inaccurate claims across diagrams and docs
The nine diagrams had drifted from the code since they were generated. Redrew
them and brought every doc that describes them back in line.

Diagrams:
- Drop "100% recall" wording the project itself disavows (README now calls
  recall 1.0 a circular, graph-derived upper bound); lead the benchmark board
  with the ~82x median rather than the 528x best case.
- Blast radius: DEPENDS_ON is only emitted for Ansible roles and Solidity
  `using`, so a function reaching a class is CALLS. Impact propagates against
  stored dependency edges, so every node in the radius must be a caller --
  class-shaped nodes replaced with caller-shaped ones, CALLS arrowheads
  flipped to point at the changed node, and a 3-hop node re-parented inside
  the 2-hop default. 2 is the default depth, not a cap.
- Impact traversal is a weighted best-path relaxation, not BFS.
- Incremental update: unchanged dependents are hash-skipped, so only edited
  files re-parse; dependents come from graph edges, not SHA-256.
- 1,326 was the embeddings count; the node count is 1,418.
- Add CodeBuddy Code (15th platform) and correct OpenCode to opencode.jsonc.
- Add 11 missing languages; note that not every language emits all six
  extraction kinds.

Docs:
- README said dependents are found "via SHA-256 hash checks" -- they come from
  import/call edges; SHA-256 decides what to skip.
- Drop the unsupported 27,700-file monorepo claim (no benchmark backs it) and
  cite what the diagram actually measures.
- Translated READMEs still carried retracted numbers (8.2x, 4.9x-27.3x, and a
  literal "100% recall" in zh-CN) and alt text for a Next.js diagram that no
  longer exists.
- Fix Zed and Continue config paths, which pointed at project-local files the
  installer never writes.
- Document the 4 undocumented edge kinds and 3 undocumented node kinds.
- Note that the fastapi benchmark row predates its config re-pin.
- Add the Trendshift badge to all translated READMEs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JNv8JqBb46stATZYUinQtn
2026-08-02 12:48:56 +01:00

9.5 KiB

Knowledge Graph Schema

Node Types

File

Represents a source code file.

Property Type Description
name string Absolute file path
file_path string Same as name for File nodes
language string Detected language (python, typescript, go, etc.)
line_start int Always 1
line_end int Total line count
file_hash string SHA-256 of file contents (for change detection)

Class

Represents a class, struct, interface, enum, or module definition.

Property Type Description
name string Class name
file_path string File containing the class
line_start int Definition start line
line_end int Definition end line
language string Source language
parent_name string? Enclosing class (for nested classes)
modifiers string? Access modifiers (public, abstract, etc.)

Function

Represents a function, method, or constructor definition.

Property Type Description
name string Function name
file_path string File containing the function
line_start int Definition start line
line_end int Definition end line
language string Source language
parent_name string? Enclosing class (for methods)
params string? Parameter list as source text
return_type string? Return type annotation
is_test bool Whether this is a test function

Test

Same schema as Function, but kind = "Test" and is_test = true. Identified by:

  • Name starts with test_ or Test
  • Name ends with _test or _spec
  • File matches test file patterns (test_*.py, *.test.ts, *_test.go, etc.)
  • Language-specific test markers where supported, such as common Rust test attributes

Type

Represents a type alias, interface, enum, struct-like type, or parser-specific type construct where the language exposes one.

Property Type Description
name string Type name
file_path string File containing the type
line_start int Definition start line
line_end int Definition end line

Endpoint

A synthesised node representing a routed entry point, emitted by the Spring enrichment for request mappings. Linked to the method that services it by a HANDLES edge.

Scheduler

A synthesised node representing a scheduled invocation, emitted for @Scheduled methods. Linked to the method it fires by a TRIGGERS edge.

ConfigProperty

An externalised configuration key parsed out of Spring application.properties / application.yml files. Values are deliberately discarded — only the key is stored. Linked to the code that binds it by a DEPENDS_ON_CONFIG edge.

Edge Types

CALLS

A function calls another function.

Property Type Description
source string Qualified name of the caller
target string Name of the called function (may be unqualified)
file_path string File where the call occurs
line int Line number of the call

IMPORTS_FROM

A file imports from another module or file.

Property Type Description
source string Importing file path
target string Imported module/path
file_path string Same as source
line int Line number of the import

INHERITS

A class extends/inherits from another class.

Property Type Description
source string Child class qualified name
target string Parent class name
file_path string File containing the child class

IMPLEMENTS

A class implements an interface (Java, C#, TypeScript, Go).

Property Type Description
source string Implementing class
target string Interface name

CONTAINS

Structural containment: a file contains a class, a class contains a method.

Property Type Description
source string Container (file path or class qualified name)
target string Contained node qualified name

TESTED_BY

A function is tested by a test function.

Property Type Description
source string Function being tested
target string Test function qualified name

DEPENDS_ON

General dependency relationship (used for non-specific dependencies).

REFERENCES

A value-level reference to another symbol, often used for function-as-value patterns such as callback maps, arrays, or assignment.

INJECTS

A dependency-injection relationship, currently used by Java/Spring enrichment for injected fields and constructor parameters.

CONSUMES / PRODUCES

Data or event flow relationships emitted by specialised parsers when a source consumes or produces a named resource.

TEMPORAL_STUB

Temporal dependency placeholder emitted by specialised parsers when a time/order relationship is detected but cannot be resolved to a stronger edge type.

DEPENDS_ON_CONFIG

A binding from code to externalised configuration, emitted by the Spring enrichment for @ConfigurationProperties classes and the ConfigProperty nodes parsed out of application.properties / application.yml.

HANDLES

A handler relationship between a dispatch point and the method that services it — Spring request mappings binding an Endpoint node to its controller method, and @EventListener methods binding to the event they consume.

TRIGGERS

A scheduled invocation, emitted for @Scheduled methods to link the synthesised Scheduler node to the method it fires.

PUBLISHES

An event-publication relationship, emitted where code publishes a Spring application event.

OVERRIDES appears in the impact-scoring tables (constants.py) but is not emitted by any parser today.

Qualified Name Format

Nodes are uniquely identified by qualified names:

# File node
/absolute/path/to/file.py

# Top-level function
/absolute/path/to/file.py::function_name

# Method in a class
/absolute/path/to/file.py::ClassName.method_name

# Nested class method
/absolute/path/to/file.py::OuterClass.InnerClass.method_name

SQLite Tables

-- Nodes table
CREATE TABLE nodes (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    kind TEXT NOT NULL,
    name TEXT NOT NULL,
    qualified_name TEXT NOT NULL UNIQUE,
    file_path TEXT NOT NULL,
    line_start INTEGER,
    line_end INTEGER,
    language TEXT,
    parent_name TEXT,
    params TEXT,
    return_type TEXT,
    modifiers TEXT,
    is_test INTEGER DEFAULT 0,
    file_hash TEXT,
    extra TEXT DEFAULT '{}',
    community_id INTEGER,
    updated_at REAL NOT NULL
);

-- Edges table
CREATE TABLE edges (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    kind TEXT NOT NULL,
    source_qualified TEXT NOT NULL,
    target_qualified TEXT NOT NULL,
    file_path TEXT NOT NULL,
    line INTEGER DEFAULT 0,
    extra TEXT DEFAULT '{}',
    confidence REAL DEFAULT 1.0,
    confidence_tier TEXT DEFAULT 'EXTRACTED',
    updated_at REAL NOT NULL
);

-- Metadata table
CREATE TABLE metadata (
    key TEXT PRIMARY KEY,
    value TEXT NOT NULL
);

-- Flows table (v2.0)
CREATE TABLE flows (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT NOT NULL,
    entry_point_id INTEGER NOT NULL,
    depth INTEGER NOT NULL,
    node_count INTEGER NOT NULL,
    file_count INTEGER NOT NULL,
    criticality REAL NOT NULL DEFAULT 0.0,
    path_json TEXT NOT NULL,
    created_at TEXT NOT NULL DEFAULT (datetime('now')),
    updated_at TEXT NOT NULL DEFAULT (datetime('now'))
);

-- Flow memberships table (v2.0)
CREATE TABLE flow_memberships (
    flow_id INTEGER NOT NULL,
    node_id INTEGER NOT NULL,
    position INTEGER NOT NULL,
    PRIMARY KEY (flow_id, node_id)
);

-- Communities table (v2.0)
CREATE TABLE communities (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT NOT NULL,
    level INTEGER NOT NULL DEFAULT 0,
    parent_id INTEGER,
    cohesion REAL NOT NULL DEFAULT 0.0,
    size INTEGER NOT NULL DEFAULT 0,
    dominant_language TEXT,
    description TEXT,
    created_at TEXT NOT NULL DEFAULT (datetime('now'))
);

-- Full-text search virtual table (v2.0)
CREATE VIRTUAL TABLE nodes_fts USING fts5(
    name, qualified_name, file_path, signature,
    content='nodes', content_rowid='rowid',
    tokenize='porter unicode61'
);

-- Token-efficient summary tables (v6)
CREATE TABLE community_summaries (
    community_id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    purpose TEXT DEFAULT '',
    key_symbols TEXT DEFAULT '[]',
    risk TEXT DEFAULT 'unknown',
    size INTEGER DEFAULT 0,
    dominant_language TEXT DEFAULT ''
);

CREATE TABLE flow_snapshots (
    flow_id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    entry_point TEXT NOT NULL,
    critical_path TEXT DEFAULT '[]',
    criticality REAL DEFAULT 0.0,
    node_count INTEGER DEFAULT 0,
    file_count INTEGER DEFAULT 0
);

CREATE TABLE risk_index (
    node_id INTEGER PRIMARY KEY,
    qualified_name TEXT NOT NULL,
    risk_score REAL DEFAULT 0.0,
    caller_count INTEGER DEFAULT 0,
    test_coverage TEXT DEFAULT 'unknown',
    security_relevant INTEGER DEFAULT 0,
    last_computed TEXT DEFAULT ''
);

-- Embeddings table, stored in the embeddings database
CREATE TABLE embeddings (
    qualified_name TEXT PRIMARY KEY,
    vector BLOB NOT NULL,
    text_hash TEXT NOT NULL,
    provider TEXT NOT NULL DEFAULT 'unknown'
);

Indexes include qualified-name, file-path, node-kind, edge source/target/kind, community, flow criticality, risk score, compound edge lookup indexes, and the composite edge upsert index.