Expand description
The knowledge graph behind review and self-improvement: one SQLite store for every repository Ultron works in.
The code layer records what each file is made of, keyed by git blob: constructs (a BEFORE UPDATE trigger, a
@Controller decorator, a call to runWithBypass), the symbols it defines, its calls and its imports, the graph
an investigator queries in SQL. A blob’s constructs never change,
so indexing a new revision only reads the blobs the store has not seen, and reviews of different revisions of
one repository never disturb each other: each revision’s tree is its own path-to-blob table.
The relation layer (relations) is read on demand: a task asks for the relations among some files (which code
reads which configuration key, which handler serves which route, which code touches which table, which test
exercises which file); plain code proposes and prunes them, the judge settles what plain code cannot, and both
are cached by blob.
This crate only writes. The kernel reads the same file with Python’s sqlite3 (rlm/knowledge_api.py), read-only,
and refuses a schema version it does not know.
Modules§
- relations
- Relations across files, read on demand for a task: which code reads which configuration key, which handler serves which route, which code touches which table, which test exercises which file.
Structs§
- Index
Stats - Note
- A review comment, as
Store::record_noteskeeps it. - Relations
- The relations a task asked for at one revision (
relations). - Rule
Credit - A rule (a person’s addressed review comment) with the fates of the findings that cited it.
- Settlement
Store::settle_relations: one relation’s verdict and who gave it.- Store
Enums§
- Settled
- The judge’s verdict on a relation.
Constants§
- MAX_
RELATION_ FILES - Files read for relations in one call, at most: a bound on a monorepo asked about as a whole.
- SCHEMA_
VERSION - The schema the kernel reader (
rlm/knowledge_api.py) is written against. Bump it with every change to a table the reader uses, and teach the reader the new version in the same change.
Functions§
- default_
path - The store under the agent directory, shared by reviews and the REPL’s
knowledgeAPI. - index_
tree - Indexes
repo(a stable name such asgithub.com/owner/name) atrevof the git checkoutrepo_dirinto the store atdb. Indexing the same revision again only refreshes its tree. - relations
- The relations of
kinds(all when empty) among the files underscopeofrepoatrevof the git checkoutrepo_dir: the revision is indexed first (only blobs the store has not seen are read), the proposer reads only blobs it has not read atRELATIONS_VERSION, and the result is pruned for the task. Verdicts the judge gave earlier come back with their relations.