ISSUE 01 — RELEASE V1.0.0 / MIT THE COMPREHENSION EDITION

EXPLAIN

PROVE YOU UNDERSTAND
YOUR OWN DIFF

explain-my-own-code (emc) intercepts your git diff before you commit, pinpoints the lines most likely to hide a bug or drain funds, and quizzes you directly on your real code. It grades your answers, remembers your blind spots in a Leitner mastery ledger, and blocks commits you can't explain — built for AI-assisted Rust/Anchor and TypeScript teams.

pipx install explain-my-own-code
01 // Verbatim Terminal Evidence

Live CLI Captures

Unedited terminal output produced directly by running emc against the repository's own Anchor, secret, and prompt-injection fixtures.

$ Get-Content fixtures/detectors/anchor_missing_signer_positive.diff | emc detect --stdin

 Diff Detection & Ranking Summary
+---------------------------------+
| Property              | Value   |
|-----------------------+---------|
| Files Analyzed        | 1       |
| Total Hunks           | 1       |
| Additions / Deletions | +1 / -0 |
| Risks Detected        | 1       |
| Highest Hunk Risk     | 18.18   |
+---------------------------------+

| Severity | Rule ID               | Concept             | Location           |
|----------+-----------------------+---------------------+--------------------|
| CRITICAL | anchor.missing_signer | anchor.signer_check | programs/vault/... |
Description: Authority Account Missing Signer or has_one Constraint
02 // Reproducible Proof (docs/EVAL.md)

Benchmark Suite

Every number below is produced directly by python -m emc.cli eval --ablation --output docs/EVAL.md. Zero fabricated metrics.

Measured Pipeline Performance & Offline Latency Breakdown
Pipeline Metric Measured Result Target Verdict
Seeded-Bug Surfacing Rate 100.0% (31/31) ≥ 90.0% PASS
Grounded-Question Rate 100.0% 100.0% PASS
Secret Redaction Recall 100.0% (17/17) 100.0% PASS
Injection-Resistance Rate 100.0% (5/5) 100.0% PASS
Grader Agreement (30 Hand-Labeled) 96.7% (TP:14 TN:15 FP:1 FN:0) ≥ 90.0% PASS
Average Cost per Session $0.0066 USD < $0.05 PASS
Total Offline Pipeline Latency 48.15 ms (Ingest 13.5 / Redact 7.2 / Detect 13.7 / Gate 9.4 / Grade 4.1) < 500 ms PASS
HONEST FAILURE REPORT (docs/EVAL.md): 1 false positive occurred in offline keyword fallback grading on ft_26_anchor_close_fail (predicted True, ground truth False: response referenced account terms while omitting the revival attack risk). Live LLM rubric judging evaluates full attack reasoning.
03 // Controlled Ablation

Pipeline vs. Naive Prompt

Same 31 seeded diffs, 17 secret fixtures, and 5 prompt injections tested against a single-prompt "make quiz questions" baseline.

Ablation Study: Naive One-Prompt Baseline vs EMC Full Pipeline
Metric Naive Baseline EMC Pipeline Delta
Seeded-Bug Surfacing Rate 12.9% 100.0% +87.1%
Grounded-Question Rate 0.0% 100.0% +100.0%
Secret Redaction Recall 0.0% 100.0% +100.0%
Injection-Resistance Rate 0.0% 100.0% +100.0%
Secrets Leaked to LLM 17 leaked 0 leaked -17
Prompt Injections Exploited 5 exploited 0 exploited -5
04 // Defense in Depth

Six Guardrails

Analyzed code is never executed. Secrets never leave the machine. Non-TTY and CI environments skip cleanly with exit code 0.

STAGE 01 // INGEST

Diff Quarantine

Splits staged diffs, commit ranges, and stdin into exact 1-indexed hunks with .emcignore filtering, size caps, and untrusted boundary delimiters.

STAGE 02 // REDACT

Local Secret Scrub

Masks Solana 64-byte keypair arrays, Base58 private keys, EVM hex keys, BIP-39 12/24-word seeds, API tokens, and .env credentials before network calls.

STAGE 03 // DETECT

16 Static Detectors

8 Anchor Rust rules (missing Signer, UncheckedAccount, unchecked math, PDA bump, invoke_signed, realloc/close, remaining_accounts, unverified CPI), 4 TS wallet rules, 4 generic smells.

STAGE 04 // VALIDATE

4-Step Quality Gate

Enforces verbatim diff grounding, no-answer-leak checks, independent solvability, ambiguity detection, and injection rejection (1 retry, else dropped).

STAGE 05 // GRADE

Quiz & Rubric Judge

Rich terminal session supporting 5 question types (predict-output, what-breaks-if, consequence, spot-the-bug, explain-back) with a -25% hint ladder.

STAGE 06 // GATE

Leitner & Git Hooks

Updates 5-box mastery in .emc/ledger.jsonl with cross-process OS locking, enforces off | warn | gate modes, and writes Comprehension: X/Y trailers.

05 // Honest Differentiation

Compare Tools

Built specifically for Solana/Anchor Rust and TypeScript wallet engineering where one misunderstood line drains funds.

Feature Comparison Across Diff Comprehension Tools
Capability arivcode / cognit / bel-ai-jar Generic Claude Quiz Skills emc (explain-my-own-code)
Solana / Anchor & TS Detectors None / Python heuristics only None (prompt only) 16 deterministic risk rules + hunk ranking
Question Quality Gate None / basic JSON parse None (hallucination risk) 4-step gate: grounding, leak, solver, ambiguity
Spot-the-Bug & Explain-Back MC / Flashcards only Unstructured chat 5 types including injected mutants & rubric judge
Secret Redaction & Injection Defense Minimal / none Raw diff sent to LLM Local scanner (100% recall) + untrusted framing
Published Reproducible Eval None / anecdotal None emc eval across 31 bugs + baseline ablation