parity
Skill94 starsChanged 3 months agoApache-2.0View on GitHub
Audit WASM/native engine correctness parity across all resolution fixtures and fix any divergence at the root cause — both engines must produce identical graphs
1 other project uses a version of this.
Adopted by
Most recently taken up by
- youknowone/pyretheir own version, first seen Oct 9, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- youknowone/pyre★ 6same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository22 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- architectSkill
- bench-checkSkill
- create-skillSkill
- deps-auditSkill
- dogfoodSkill
- fixerSkill
- housekeepSkill
- overseeSkill
- releaseSkill
- resolveSkill
- sweepSkill
- test-healthSkill
- titan-closeSkill
- titan-forgeSkill
- titan-gateSkill
- titan-gauntletSkill
- titan-grindSkill
- titan-reconSkill
- titan-resetSkill
- titan-runSkill
- titan-syncSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 6 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 30
No arguments — full audit across all fixtures, then fix divergences
- Distinctive: line 34
All steps run from the repo root.
- Distinctive: line 43
Ensure the native addon reflects the local Rust source:
- Distinctive: line 52
Verify the loader picks up the locally built binary, not the published package.
- Very specific: line 61
If the resolved path points to node_modules/@optave/codegraph-<platform>-<arch>/codegraph-core.node (the installed package), copy your …
- Very specific: line 71
If false, stop and report — auditing parity without the native engine is meaningless.
- Very specific: line 76
Run the comparison (pass through --langs / --hybrid from $ARGUMENTS):
- Very specific: line 90
If --audit-only was passed: report the diffs (Phase 4 format) and stop.
- Very specific: line 121
Add a focused unit test next to the fix (Rust #[cfg(test)] or vitest) that pins the behavior.
- Distinctive: line 154
If any verification step cannot run, STOP and report it — never proceed with unverified changes.
- Distinctive: line 170
If divergences were found and fixed, list each root cause in one line — which engine was wrong, which layer, what semantic was mismatched.
- Very specific: line 172
If --audit-only: list divergences grouped by fixture with the wasm/hybrid/native localization table applied.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
/parity — Engine Correctness Parity Audit & Fix
Codegraph has two engines that MUST produce identical results (see CLAUDE.md):
- wasm — JS pipeline + JS extractors + JS edge resolution
- native — full Rust orchestrator (
crates/codegraph-core/src/domain/graph/builder/pipeline.rs) - hybrid — JS pipeline + napi
buildCallEdges(the fallback when the orchestrator is skipped: forced full rebuilds, older addons)
This skill runs scripts/parity-compare.mjs, which builds every
resolution-benchmark fixture with each engine and compares the full node and
edge multisets (kind, name, file, line, confidence, dynamic flag). Any
difference is a bug in the less-accurate engine — never an acceptable gap, and
never something to document as expected. The skill finds the root cause, fixes
it, and re-verifies until the audit is clean.
Arguments
$ARGUMENTSmay contain:--langs a,b,c— restrict to specific fixture names (e.g.javascript,pts-javascript)--hybrid— also audit the hybrid path (recommended; slower)--audit-only— report divergences without fixing them- No arguments — full audit across all fixtures, then fix divergences
Phase 0 — Pre-flight
All steps run from the repo root.
- Confirm
scripts/parity-compare.mjsexists. If not, this repo doesn't have the parity tooling — stop and report. - Build the TypeScript dist (the script imports
dist/index.js, and extractor changes insrc/are invisible until rebuilt):npm run build - Ensure the native addon reflects the local Rust source:
On macOS, locally built binaries must be re-signed or Node kills the process (exit 137):cd crates/codegraph-core && npx napi build --platform --release && cd ../..codesign --sign - --force crates/codegraph-core/*.node - Verify the loader picks up the locally built binary, not the published
package. First check which path is actually resolved:
If the resolved path points tonode -e " const { createRequire } = require('node:module'); const r = createRequire(require.resolve('./dist/index.js')); try { console.log(r.resolve('codegraph-core')); } catch { console.log('not found via require'); } "node_modules/@optave/codegraph-<platform>-<arch>/codegraph-core.node(the installed package), copy your freshly built binary over it:
Then confirm the loader picks it up:cp crates/codegraph-core/*.node node_modules/@optave/codegraph-<platform>-<arch>/codegraph-core.node
Ifnode -e "import('./dist/infrastructure/native.js').then(m => console.log(m.isNativeAvailable()))"false, stop and report — auditing parity without the native engine is meaningless.
Phase 1 — Audit
Run the comparison (pass through --langs / --hybrid from $ARGUMENTS):
node scripts/parity-compare.mjs [--langs ...] [--hybrid] 2>/dev/null- Exit 0 → parity holds. Skip to Phase 4 and report a clean audit.
- Exit 1 → divergences or fixture build failures. Collect every
[node]/[edge]diff line and anyBUILD FAILEDfixtures. - Exit 2 → pre-flight failure; go back to Phase 0.
For machine-readable output (useful when many fixtures diverge), re-run with
--json and parse fixtures[].comparisons[].nodeDiffs/edgeDiffs.
If --audit-only was passed: report the diffs (Phase 4 format) and stop.
Phase 2 — Root-cause and fix
For each divergence, identify which engine is wrong — the one missing edges or producing lower-quality resolution is usually the buggy one, but verify by reading the fixture source and deciding what the correct graph is.
Localize the bug by which paths disagree:
| wasm | hybrid | native | Bug location |
| A | A | B | Rust pipeline prep (pipeline.rs) or Rust extractor (crates/.../extractors/) — the napi solver gets correct input from JS but the orchestrator's own input differs |
| A | B | B | Rust build_edges.rs solver (shared by hybrid + native) |
| A | B | A | JS↔napi boundary: NativeFileEntry plumbing in build-edges.ts or the wasm-worker protocol |
| B | A | A | JS extractor or JS resolution (src/extractors/, src/domain/graph/builder/stages/build-edges.ts) |
Fix rules (from CLAUDE.md — non-negotiable):
- Fix the extraction/resolution layer that produces incorrect results. Never add comments, tests, or fixture exclusions that frame wrong output as expected.
- Changes may land in either language or both — create the best version based on both implementations, don't restrict the fix to one side.
- The module layout is mirrored between
src/andcrates/codegraph-core/src/— read the TS and Rust counterparts side by side (e.g.src/domain/graph/builder/stages/build-edges.ts↔crates/.../domain/graph/builder/stages/build_edges.rs). - Mirror semantics exactly: confidence constants, hop penalties, tie-breaking order, first-wins vs highest-wins rules. A 0.05 confidence difference is a parity failure.
- Add a focused unit test next to the fix (Rust
#[cfg(test)]or vitest) that pins the behavior.
Gotchas that mask fixes:
src/changes neednpm run buildbefore the script (which imports dist) sees them.- Rust changes need the napi rebuild + macOS codesign from Phase 0.
- New
ExtractorOutputfields must be added toSerializedExtractorOutputinsrc/domain/wasm-worker-{protocol,entry,pool}.tsor they are silently dropped at the Worker-thread boundary. - New per-file fields crossing the napi boundary need: the
FileSymbols/FileEdgeInputstructs incrates/.../types.rs&build_edges.rs, theNativeFileEntryassembly inbuild-edges.ts, and the orchestrator's own assembly inpipeline.rs(build_and_insert_call_edges). Missing the last one produces hybrid-OK/native-broken splits. - Out-of-scope findings discovered along the way (pre-existing bugs, refactor
opportunities) →
gh issue createimmediately, then continue.
Phase 3 — Verify
Repeat until the audit is clean — never stop at "fewer diffs than before":
- Rebuild whichever side changed (
npm run build/ napi build + codesign). - Re-run the Phase 1 audit command. Any remaining divergence → back to Phase 2.
- Once clean, run the full verification suite — all must pass:
(From acargo test --manifest-path crates/codegraph-core/Cargo.toml npm test npx vitest run tests/benchmarks/resolution/resolution-benchmark.test.ts.claudeworktree, vitest needs the worktree override config — check memory/project notes if no tests are found.) - If any verification step cannot run, STOP and report it — never proceed with unverified changes.
Phase 4 — Report
Print a summary:
PARITY AUDIT — <date>
Fixtures audited: N (wasm vs native[, hybrid])
Divergences found: M
Fixed: <file:line summary per fix, with engine + root cause>
Verification: cargo test ✓ | npm test ✓ | resolution benchmark ✓
Issues filed: #NNN (out-of-scope findings)- If divergences were found and fixed, list each root cause in one line — which engine was wrong, which layer, what semantic was mismatched.
- If
--audit-only: list divergences grouped by fixture with the wasm/hybrid/native localization table applied. - Suggest committing engine fixes separately from unrelated work (one PR = one concern).
Rules
- Zero divergence is the only passing state — a single edge differing in confidence is a failure.
- Never exclude a fixture or file to make the audit pass.
- Never run the audit against a stale dist or stale native binary — Phase 0 is mandatory after any code change.
- The wasm/hybrid/native disagreement pattern localizes the bug — use the table before reading code.
- Both engines evolve together: a feature added to one engine without the
other is a parity bug from day one. New resolution techniques must land in
src/andcrates/codegraph-core/src/in the same PR.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

