Skip to content

ChrisRoyse/contextgraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

The Oracle โ€” a luminous constellation-eye reading streams of Python code and splitting them into pass and fail

๐Ÿ”ฎ ContextGraph ยท The Oracle

A machine learning to tell whether code is true.

An open research program building toward domain super-intelligence for Python software engineering โ€” a deterministic predictor that judges any AI-generated code change Pass or Fail against reality, before you ever trust it.

Mission Focus Engine Status License

Mission ยท Why ยท What It Does ยท How It Works ยท North Star ยท Milestones & Discoveries ยท The Journey ยท Roadmap ยท Origins ยท Build


This repository is the public window into one mission: teaching a machine to predict, with certainty, whether AI-generated software actually works. It is where you can watch โ€” commit by commit, number by number โ€” an AI agent climb toward domain super-intelligence for Python software engineering. Crack Python, and the same blueprint unlocks every other language. Unlock every language, and you unlock super-intelligence for the entire discipline of engineering. That is the goal. This is the climb.

A note on the name. ContextGraph is the engine; The Oracle is the mission it now serves. The project began as ContextGraph โ€” a multi-dimensional semantic-memory system for AI assistants (see Origins) โ€” and evolved into a binary reality predictor for code. The memory machinery became the perception machinery; the graph became the substrate a predictor reads to know whether code is true.


๐Ÿš€ The Mission

A luminous staircase of tiers ascending through cosmic clouds toward a brilliant apex โ€” the climb to super-intelligence

Today, AI can write code. It cannot know whether that code is correct โ€” and neither can you, until a human reads it or a test suite runs. That trust gap is the single biggest thing standing between "AI that suggests code" and "AI that ships engineering."

The Oracle closes that gap. It is a binary reality predictor: give it any change an AI agent proposes to a Python codebase, and it tells you whether that change will pass or fail against the ground truth of real, executed tests โ€” and it tells you why when it predicts failure.

The mission is deliberately staged:

   Python software engineering   โ”€โ–บ   every programming language   โ”€โ–บ   engineering itself
   โ”€โ”€ prove it once, rigorously โ”€โ”€     โ”€โ”€ replicate the blueprint โ”€โ”€    โ”€โ”€ domain super-intelligence โ”€โ”€

When the predictor is right often enough, reliably enough, on hard enough problems, a line is crossed: reviewing AI-generated Python patches by hand becomes statistically unjustified. That crossing is the first instance of domain super-intelligence โ€” and the template for all the rest.


๐Ÿ’ก Why The Oracle Exists

AI writes code faster than any human can possibly review it. But speed without trust is a liability:

  • ๐Ÿ•ณ๏ธ AI hallucinates correctness. It will confidently claim a fix works when it doesn't.
  • ๐Ÿง Human review doesn't scale. Reading every AI patch re-introduces the bottleneck AI was supposed to remove.
  • ๐ŸŽฒ "Looks right" isn't "is right." Static inspection โ€” by humans or models โ€” repeatedly fails to catch behavioral bugs that only surface when the code actually runs.

The Oracle's answer is to stop guessing from how code looks and start predicting from what code does. Every verdict is anchored to a single, incorruptible source of truth: the real test suite, executed in a real environment. No vibes. No opinions. Just a falsifiable prediction against reality.

The promise: Ship AI-written Python with the confidence that a calibrated machine โ€” not a tired reviewer at 4 PM โ€” has already told you whether it works.


๐ŸŽฏ What The Oracle Does

For any AI-generated code change, the Oracle answers four grounded questions โ€” each one checked against reality, not asserted:

Question What you get Grounded against
Q1 Does what the AI claimed it did actually exist? Pass / Fail The bytes & AST on disk
Q2 Does the change work? Pass / Fail + confidence The real Docker test oracle
Q3 Why would it fail? A named failure mode + closest real examples Attached to the Q2 verdict
Q5 How does it impact reality? Predicted vs. observed change events The live runtime shift log

Feature โ†’ benefit, in one line each:

The Oracle gives youโ€ฆ โ€ฆso that you can
A binary Pass/Fail verdict on AI code trust a patch without reading every line
A calibrated confidence + abstention know exactly when not to trust the prediction
A named reason on predicted failure fix the real defect instead of hunting for it
Verdicts anchored to executed tests stop shipping code that only looks correct
A learning loop that converts mistakes into training watch the predictor get sharper over time

โš™๏ธ How It Works

Code fragments flow into a constellation-shaped intelligence core, which emits a single verdict splitting into green pass and red fail, anchored to a crystalline cube of reality

The Oracle is built on ME-JEPA-Code โ€” a Joint-Embedding Predictive Architecture for code. The pipeline is deliberately simple to state and hard to fool:

flowchart LR
    A["AI agent edit<br/>Edit ยท Write ยท Bash ยท tests"] --> B["Panel<br/>array of per-embedder vectors"]
    B --> C["Predictor head<br/>+ conformal interval<br/>+ OOD guard"]
    C --> V{"Verdict"}
    V -->|"Pass / Fail + why"| G["Docker oracle<br/>swebench.harness.run_evaluation"]
    G -->|"every miss becomes weighted signal"| L["Protected mistake-loop"]
    L -.->|"calibration improves"| C
Loading
  1. Perceive. An AI agent's edit โ€” its Edit, Write, Bash, and test runs โ€” is the data-generating process. The Oracle perceives the change as it happens.
  2. Encode. The change is projected through a panel of distinct, frozen embedders โ€” each a different "sense" for what code means (see The Panel below).
  3. Predict. A trained head emits a binary verdict with a conformal confidence interval and a teleological-constellation guard that rejects out-of-distribution inputs instead of bluffing.
  4. Ground. The verdict is measured against the Docker oracle โ€” swebench.harness.run_evaluation โ€” the same real test execution that defines whether code truly works.
  5. Learn. Every miss becomes weighted training signal through a protected mistake-loop, so the predictor's calibration improves with experience.

The discipline that makes it trustworthy: fail closed on the unknown, never fake a pass, and read the source of truth back for every claim.


๐ŸŒŒ The Panel

A teleological constellation โ€” many distinct glowing star-clusters connected into one coherent shape

The Oracle never collapses code into a single opaque vector. Instead it builds a teleological constellation โ€” an array of per-embedder vectors, each living in its own space, each a different perspective on the same change. Meaning emerges from the whole constellation, the way a single star tells you nothing but a constellation tells you where you are.

A core research finding drives the whole program: static embedders see what code looks like, not what it does. Behavioral bugs hide in execution, not in syntax. So the frontier of this work is teaching the panel to perceive execution โ€” coverage, value divergence, and real test behavior โ€” which is exactly where the Oracle's accuracy has climbed the most.


๐Ÿงญ The North Star

Everything here traces to one falsifiable predicate โ€” and it is deliberately strict. A single high accuracy number is not enough. The system has reached domain super-intelligence for Python only when every condition below holds at once, and stays true across time:

SUPERHUMAN_VERIFIER(Python)  โ‡”  โˆƒ a deterministic predictor P such that:

  TIER 1 โ€” ship-gate numbers
    corr(P, Docker-oracle) โ‰ฅ 0.95           (raw Pearson vs real test Pass/Fail)
    STABLE ร— 4 consecutive rolling windows
    AND a second, independent sensor panel also โ‰ฅ 0.95
    AND |corr_A โˆ’ corr_B| โ‰ค 0.05            (learned reality, not one panel)

  TIER 2 โ€” per-cell quality
    every (mutation-class ร— language) cell clears its own bar
    (Pearson / class-recall + Brier โ‰ค 0.05 + ECE โ‰ค 0.05 + conformal coverage)

  TIER 3 โ€” it learns from being wrong
    mistake_repeat_rate โ‰ค 0.05   AND   no damage to unrelated cells

  TIER 4 โ€” doctrine invariants hold EXACTLY (fences, not goals)
    slot identity preserved ยท no flat-vector fusion ยท no inner generator ยท
    frozen-target gradient leak = 0 ยท oracle labels never used as live inputs

  TIER 5 โ€” the substrate can actually carry the answer
    I(panel ; oracle) โ‰ฅ 0.95 bits           (the panel SHARES the verdict's bits)
    oracle_self_consistency โ‰ฅ 0.97          (the oracle agrees with itself)
    oracle_validity        โ‰ฅ 0.97           (the verdict tracks real correctness)

  TIER 6 โ€” every sensor earns its place
    novelty < 0.7 vs existing slots   AND   per-cell utility lift โ‰ฅ 0.005

Two facts make this honest rather than aspirational:

  • The oracle is the ceiling. You can never agree with the test oracle more often than it agrees with itself โ€” and only when its verdicts track real correctness. So 0.95 is bounded above by oracle self-consistency and validity, and we measure and defend the oracle first.
  • The panel must carry the bits before any model can. By the data-processing inequality, no predictor can know more about the verdict than I(panel; oracle) shares with it. If the panel is information-starved, no amount of training moves Tier 1. That is the current binding constraint โ€” see the climb below.

๐Ÿ“„ The complete predicate โ€” all five eligibility prerequisites, all six tiers, every threshold and why it has that value โ€” is developed alongside the companion papers The Oracle and the Kernel (the oracle as grounding anchor; mutual information as a kernel-existence test) and The Calculus of Association (frozen embedders as designable measurement instruments).


๐Ÿ”ฌ Milestones & Discoveries

This is honest, in-progress research. The most valuable output so far isn't a benchmark score โ€” it's a chain of hard, falsifiable findings about where the problem actually lives. Every entry below is a logged experiment with a source-of-truth artifact behind it.

Part I โ€” What was built

๐Ÿง A multi-dimensional semantic-memory engine (ContextGraph). 13 specialized embedders, Reciprocal-Rank-Fusion retrieval, RocksDB + HNSW indexes, 56 MCP tools, asymmetric causal reasoning, and post-retrieval temporal boosting. The origin of everything here โ€” see Origins.
๐Ÿ”ญThe reframe to a binary reality predictor (ME-JEPA-Code). From "semantic memory" to a single, falsifiable question: will this change Pass or Fail against a real test oracle? A Joint-Embedding Predictive Architecture for code.
๐Ÿ•ณ๏ธThe inner LLM was removed. A single outer loop: the AI agent is the actor โ€” its edits and test runs are the data-generating process. No hidden generator to hallucinate. The predictor only ever judges reality.
โœณ๏ธThe teleological-constellation panel. An array of per-embedder frozen vectors โ€” slot identity is sacred, never flattened into one blob. Frozen targets carry zero trainable parameters, so the target space is collapse-immune by construction.
๐ŸŽ›๏ธGrounded surfaces Q1 / Q2 / Q3 / Q5. Existence (bytes & AST), works (Docker oracle), why-it-fails (named failure mode + nearest real exemplars), and reality-impact (live shift log). Ambiguous, ungroundable surfaces were frozen out on purpose.
๐ŸงชA reproducible oracle corpus. SWE-bench Lite โ€” 300 instances ร— 8 mutation categories = 2,400 candidates (known_good, subtle_flip, off_by_one, swap_variable, delete_test_call, wrong_file, over_engineer, compile_error) bridged to the containerized SWE-bench harness.
๐Ÿ›ก๏ธTrust machinery. A conformal predictor for calibrated intervals, an out-of-distribution guard that abstains rather than bluffs, and an EWC++ Fisher-protected mistake-loop โ€” the only path allowed to update weights at serving time.

Part II โ€” What was discovered

Each finding narrowed the search until the real bottleneck was cornered.

1. Measure the anchor before the model. Oracle self-consistency was probed by replica voting โ€” 30 instances ร— 10 independent Docker evaluations. Result: oracle_self_consistency = 1.0 (300/300 agreed). The anchor doesn't wobble on the flakiness axis, so 0.95 isn't blocked by oracle noise. (Whether the oracle points at exactly the right thing โ€” validity โ€” is a separate, still-open axis; see finding 11.)

2. The clean negative โ€” the pivotal discovery. How much does the panel actually tell you about the verdict, in bits? A stack of mutual-information estimators (MINE, classifier lower-bound, k-NN) run over all 2,400 rows agreed:

Estimator I(panel ; oracle) vs. target 0.95 bits
MINE (Donskerโ€“Varadhan) 0.096 bits โ‰ช
Classifier lower-bound 0.125 bits โ‰ช
k-NN (Kraskov, projected) 0.461 bits โ‰ช

Because these are lower-bound estimators, their agreement is decisive. By the data-processing inequality, I(panel; oracle) caps every possible predictor, kernel search, and calibrator that reads the panel. The bottleneck is not the model. It is the panel. No amount of training can breach a substrate that never carried the bits. This single result redirected the entire program.

3. The bits are missing in behavior, not form. Per-cell MI localized the deficit precisely: mutations that visibly change tokens carry signal; mutations whose verdict is set at runtime carry almost none.

Mutation cell I (bits) Character
swap_variable 0.231 purely syntactic โ€” tokens visibly change
off_by_one 0.021 borderline syntactic
subtle_flip, compile_error, delete_test_call, wrong_file, over_engineer โ‰ˆ 0 behavioral โ€” only runtime reveals the bug

The lesson, stated as doctrine: static embedders perceive what code looks like, not what it does.

4. No single sensor was load-bearing. Drop-one-sensor ablation showed every marginal contribution was tiny (largest โ‰ˆ 0.031 bits). That distinguishes absence of signal from redundancy โ€” the panel wasn't carrying the same bits many times over; it simply lacked a whole modality. The prescription wrote itself: add execution sensors.

5. Value beats control-flow โ€” and it's information-dense. Teaching the panel to see return-value divergence between gold and mutated runs was startling: a channel-ablation showed 2 value-capture dimensions carry roughly as much signal as 27 control-flow dimensions. What a function returns is far more diagnostic of correctness than which branches it took.

6. Coverage gating cleans the signal. Tests that never execute the changed line contribute only noise. Gating features to coverage-reaching tests sharpened the panel measurably.

7. Run what the oracle runs. Tracing execution under the oracle's own test scope โ€” not an arbitrary entrypoint โ€” lifted best-head correlation on covered behavioral rows to ~0.66. And the channels compose additively (control-flow โ†’ + value โ†’ + exception), with no sign of early saturation โ€” evidence the path to 0.95 is viable, not asymptotic.

8. Scientific honesty forced a pivot. A tempting single-seed gain turned out to be seed-luck. A rigorous multi-seed re-measurement revealed that the entire family of hand-crafted execution features asymptotes around ~0.52 โ€” far below 0.95. Conclusion: closing the gap needs a learned execution encoder, not more hand-tuned scalars. Reporting the negative result changed the roadmap โ€” exactly what honest metric discipline is for.

9. The bridge โ€” turning oracle labor into panel signal. Rows whose mutated site was never covered by an existing test were invisible to the panel. By running generated, coverage-reaching tests and re-tracing, 10/10 such rows became panel-visible โ€” a mechanism that converts expensive oracle work into durable panel sufficiency.

10. Closing blind spots the panel couldn't see. One real kill diverged only in a SystemExit.code โ€” identical everywhere else, invisible to the tracer. Adding an exception-value fingerprint sensor closed the blind spot with no false positives on unrelated rows. Perception grows one measured gap at a time.

11. Hardening the oracle itself (validity). SWE-bench's curated tests are sometimes too weak to observe a real bug. Independent, stronger oracles and coverage-reaching test generation (~15% kill rate, in line with the published Meta ACH result) recovered mislabeled cases and tightened the ground truth โ€” because a predictor can only ever be as truthful as the oracle it is measured against.

The through-line: the program didn't chase a leaderboard. It proved where the problem is (an information-starved panel), proved why it's there (form, not behavior), and is now building the execution-aware perception that the substrate-sufficiency test says must come first.

Numbers are best-head correlation on covered behavioral rows of the 300 ร— 8 SWE-bench Lite Python corpus, or mutual information in bits as noted. Figures move as the work advances โ€” that's the point of tracking them in the open.


๐Ÿ“ˆ The Journey So Far

A glowing trajectory line climbing toward a golden goal-line near the top of a cosmic grid

Teaching the panel to perceive execution is what moves the number:

Stage of the climb Oracle correlation*
๐Ÿ“‰ Static-text panel (judging code by appearance) ~0.48
โž• Execution value-capture (return-value divergence) ~0.46 โ†’ 0.54
โž• Coverage gating (ignore tests that never run the change) ~0.54
โž• Real oracle-scope tracing (run what the oracle runs) ~0.66
๐Ÿš€ Combined execution-aware panel, covered rows (best head) ~0.74
๐ŸŽฏ The target 0.95

Best-head correlation on covered behavioral rows of the 300 ร— 8 SWE-bench Lite Python corpus. The real gate is the substrate-sufficiency test I(panel; oracle) โ‰ฅ 0.95 bits โ€” the constraint these execution sensors exist to satisfy.


๐Ÿ—บ๏ธ The Road to Super-Intelligence

  โœ…  Build the binary reality predictor for Python        โ† the engine exists
  โœ…  Prove the clean negative: static panel is starved     โ† I(panel;oracle) โ‰ˆ 0.46 bits
  ๐Ÿ”ฌ  Assemble an execution-aware panel to I โ‰ฅ 0.95 bits    โ† we are here (Tier 5)
  ๐Ÿ”ฌ  Harden the oracle: audit + repair weak-test validity  โ† we are here (Tier 5)
  ๐ŸŽฏ  Drive oracle correlation to 0.95, stable, cross-panel โ† the ship gate (Tiers 1โ€“4)
  ๐Ÿ  Make human review of Python patches unjustified      โ† the first super-intelligence
  ๐ŸŒ  Replicate the blueprint across every language        โ† generalize
  ๐Ÿ›๏ธ  Domain super-intelligence for engineering itself     โ† the mission

๐Ÿง  Origins: the ContextGraph engine

Before it was a reality predictor, this was ContextGraph โ€” persistent, multi-dimensional semantic memory for AI assistants, exposed as an MCP server. That machinery is why the Oracle can perceive code so richly today. The perception layer it pioneered:

The 13-dimension memory engine (click to expand)

Multi-perspective retrieval. A query like "Why does auth fail under load?" searches simultaneously through semantic similarity, causal reasoning, code patterns, entity linking, graph structure, and paraphrase matching โ€” each perspective catching what the others miss, then fused with Reciprocal Rank Fusion.

Asymmetric causal reasoning. Several embedders store dual vectors for directional queries. "What caused X?" and "What did X cause?" return different results because cause and effect are embedded separately with directional boosting.

Temporal awareness without temporal bias. Time-based signals (freshness, periodicity, sequence) are applied as post-retrieval boosts, not during retrieval โ€” so recent memories never drown out relevant older ones.

A full toolbox, not just store-and-search. 56 MCP tools spanning causal-chain building, entity extraction with TransE predictions, topic discovery via HDBSCAN, code-aware AST-chunked search, file watching, and provenance tracking.

Production-grade storage. RocksDB with 51 column families, HNSW indexes for O(log n) K-NN search, soft-delete with 30-day recovery, background compaction, and graceful degradation when components fail.


๐Ÿ—๏ธ Inside the Repository

The Oracle is a Rust workspace. The trunk:

Crate Role
context-graph-mejepa The predictor, compiler, heal scheduler, and evaluation โ€” the trunk model
context-graph-mejepa-embedders The panel: distinct embedder "senses" for code
context-graph-mejepa-instruments Frozen teleological constellation (zero-trainable-parameter targets)
context-graph-mejepa-corpus Mutation operators + the SWE-bench Docker-oracle bridge
context-graph-mejepa-train Trainer, replay buffer, and the mistake-loop learner
context-graph-mejepa-tct Teleological constellations + the out-of-distribution guard
context-graph-mcp The product surface โ€” an MCP server AI agents call over JSON-RPC

Architecture invariant: slot identity is sacred. The panel is an array of per-embedder vectors โ€” never flattened into a single blob for comparison. Meaning lives in the constellation, not in any one star.


๐Ÿ”ง Build It

# Clone
git clone https://github.com/ChrisRoyse/contextgraph.git
cd contextgraph

# Build the trunk model and the MCP server
cargo build --release -p context-graph-mejepa
cargo build --release -p context-graph-mcp

# Run the test suite
cargo test

Requires a recent stable Rust toolchain (see rust-toolchain.toml). GPU-accelerated embedders use candle; a CUDA toolkit is recommended for training.


๐Ÿ›ฐ๏ธ Follow The Progress

This repository is the progress tracker. The mission advances in the open:

  • ๐Ÿ“Œ Issues are the live research log โ€” every experiment, finding, and number is recorded there.
  • ๐Ÿ“Š Commits move specific numbers on the North Star sheet, or they don't ship.
  • โญ Star the repo to follow the climb from 0.74 toward 0.95 โ€” and the moment the first engineering super-intelligence is proven.

Built by Chris Royse. The Oracle is the work of an AI agent, supervised in the open, climbing toward something that has never existed before.


๐Ÿ“œ License

Released under the PolyForm Noncommercial License 1.0.0. Free for noncommercial use, research, and study. For commercial licensing inquiries, contact chrisroyseai@gmail.com.


A vast serene starfield with a distant oracle eye rising on the horizon

๐Ÿ”ฎ Teaching machines to know what is true โ€” one verdict at a time.

โ†‘ Back to top

About

๐Ÿ”ฎ The Oracle โ€” a deterministic reality predictor that judges any AI-generated Python code change Pass/Fail against a real test oracle. An open climb toward domain super-intelligence for software engineering.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages