Simulating cc code surgery protocols

From AndyLiuin/QEC-Autoresearch-Skills · View interactive version

Simulating cc code surgery protocols is an AI agent skill from the GitHub repository AndyLiuin/QEC-Autoresearch-Skills. Guides color-code and related surgery-protocol simulation using local surgery implementations, with explicit matrix, circuit, detector-model, and decoder validation stages.

How to use this skill

Skill file

Simulating CC Code Surgery Protocols

What This Skill Is For

Use this skill when the task is to build, inspect, or validate a surgery protocol similar to the local color-code surgery stack:

When To Use It Versus Alternatives

Use this skill when the protocol begins from matrix-level surgery design and ends in a decoded Stim workflow.

Use CODE0 when the circuit structure is already fixed.

Use CODE0 when the detector-model artifacts already exist and the task is decoder-only.

Required Artifacts And Assumptions

Expected inputs:

Expected outputs:

Assumptions to make explicit:

Standard Workflow Checklist

  1. Read CODE0 and decide whether the request is best matched by the cc_surgery lane
  2. Start at the matrix layer: pick example data or construct new H_a' and H_b'.
  3. Check commutation and measured-observable counts before generating any noisy circuit.
  4. Build the exact surgery circuit with explicit noise and round counts.
  5. Compile the detector error model and sample a decoded smoke test before any sweep.
  6. Only after the smoke path works, move to sweep.py, plot_threshold.py, or broader sinter-style batch workflows.

Validation Loop

Before closing work:

  1. confirm matrix commutation or analogous structural checks passed,
  2. confirm the exact circuit builder and noise model are named explicitly,
  3. confirm DEM extraction happened before decoder benchmarking claims,
  4. confirm the first run is a smoke test, not a threshold claim.

Common Issues And Fixes

Starting from sweeps instead of invariants

Problem: the workflow jumps directly to large runs.

Fix: run semantic and matrix checks first.

Overfitting to one private implementation

Problem: the workflow depends on details of a non-public local implementation instead of portable principles.

Fix: keep only the reusable ideas: staged validation, explicit measurement scheduling, logical deformation bookkeeping, DEM bookkeeping, and batch simulation design.

Decoder-first reasoning

Problem: BP-OSD configuration is discussed before the circuit and DEM are stable.

Fix: freeze the matrix and circuit layers first, then decode.

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.