<!-- Pi platform guidance -->
<!-- Use installed tool names. Discover callable tools before batching independent calls in codemode; model-only UI/orchestration tools must be called directly. -->
<!-- Read required skill/instruction files through direct read when exposed or through Code Mode. If an optional pruning extension is installed, verify its output protection semantics; do not assume nested-path protection. Code Mode composes calls; subagents or controllers own durable workflows. Async subagents notify natively: yield rather than poll. -->
Fix and Diagnose Code
Fix the requested defect or failing gate, one verified root cause at a time.
Use the matching writing-<lang> skill for toolchain commands. The optional
coding-posture plugin owns general debugging and fix procedure; this skill owns
the defect evidence and regression contract. Do not load both just to repeat
process steps.
Without write access, return proposed changes (file, change, reason) instead of
applying them.
Hard rules
- Reproduce the failure when feasible. If it cannot be reproduced, patch only an evidenced contract violation; add regression coverage and report the reproduction gap. Otherwise ask for the missing artifact rather than patching a guess. Ask before adding temporary instrumentation.
- No destructive git (hard reset, clean, force push, checkout over local changes) and no
--no-verify. - Never disable assertions, skip fast tests, lower lint severity, or ignore files to make a check pass or run faster. Clear caches only when a stale cache is the diagnosed cause.
- Fix the requested failure first; ask before expanding to unrelated failures.
Outcome
- Repro: the fastest reliable failing signal, best a failing test at the behavior seam; otherwise a script, replayed payload, or small harness around the real path. If unavailable, report the gap and use evidenced contract violations instead.
- Root cause: traced from the failing boundary to the first bad state or contract mismatch, with evidence (
file:line, symptom, tool). - Regression test at the seam where the user saw the bug. If only a shallow seam exists, say so rather than adding a fake-confidence helper test.
- Remove temporary probes or promote them to regression tests.
- Browser-only symptoms go to browser-automation unless a cheaper CLI or unit signal exists.
- If a code-graph tool (GitNexus, codegraph) is installed and fresh, use it to find callers or impact before changing widely used code.
Done when the original repro passes, or its absence is reported with the
contract evidence and a passing regression test. Report a missing test seam;
without a repro, stop rather than patch when regression coverage is unavailable.
Relevant build/test/lint checks must pass, or each check that did not run must
be named with its reason.
Report
Root cause with evidence, changes (path:line — fix), and each check with
pass, fail, or skipped and why. If blocked, name the missing artifact, access,
or approval.
Platform additions
No target-specific additions.