rca-core
Shared hypothesis-driven root cause analysis core for stabilize, debug, and dev-time entry points. Use when forming or refuting RCA hypotheses before routing fixes. Does not patch code or merge.
- License 许可
- MIT
- 最近更新
- 2026-11-03
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- rca-core
- description
- Shared hypothesis-driven root cause analysis core for stabilize, debug, and dev-time entry points. Use when forming or refuting RCA hypotheses before routing fixes. Does not patch code or merge.
02 资源文件 3
- 参考文档references/debug-inputs.md1.3 KB
- 参考文档references/fan-out-schema.json750 B
- 参考文档references/fan-out.md2.7 KB
03 SKILL.md 正文
RCA core (shared)
Single analysis discipline with three entry points (R35). All use the same hypothesis ranking, causal-chain gate, explicit invalidation, reproduction-first where applicable, and hard stops — different inputs and downstream routing only.
| Entry | Inputs | Downstream |
|---|---|---|
stabilize |
Gate failures + normalized review findings | /sw-stabilize → push → /sw-watch-ci |
debug |
Production signals (Sentry / deploy log / user report) | /sw-debug routing → 003 or 002 |
dev-time |
Local test/build/verify failures | /sw-debug → worktree + /sw-start or escalate |
Model tier: build — resolve via python3 scripts/sw_bootstrap.py resolve-model-tier.py -- --skill rca-core. When using the Task tool for subagent dispatch, resolve concrete model IDs from models.tiers in config (never semantic tier names in subagent model: frontmatter).
Shared discipline
- Rank hypotheses — most likely first; evidence for and against each.
- Reproduction-first gate — before a scoped fix, establish a reliable repro or log inability to reproduce with evidence (what was tried, what blocked). Dev-time entry treats this as strict; debug entry attempts repro-from-context but may proceed when blocked; stabilize uses failing checks as repro.
- Causal-chain gate — do not propose a fix until trigger → symptom chain is complete, or the user explicitly authorizes a best-available hypothesis.
- Failing-regression-test gate (dev-time + scoped fixes) — when the failure is test-shaped, require a test that fails before the fix and passes after; do not rewrite the test to match broken behavior.
- Invalidate explicitly — a rejected hypothesis is marked invalid; do not retry variants of it.
- Hard stops (R29) — stop when any applies:
maxIterations(default 5) reached- No progress — same top hypothesis + same evidence set on two consecutive iterations
- Rule-of-three — three identical failed fix attempts (same hypothesis + same evidence signature) → escalate to architecture review; maps to the R29 circuit breaker
- Human decision — scope/architecture ambiguity blocks a minimal fix
- Output shape — see below; debug adds
routingHintafter fix-size classification.
Fan-out mode (PRD 064 R1/R2, opt-in)
Default path remains the single-context shared discipline above. When rca.fanout.enabled is true and
D5 gating fires (scripts/rca_fanout.py should-fanout), partition evidence across at most four clean-context
generators (logs, diff, data, config) — see references/fan-out.md.
- D5 gate —
enabledplus ambiguity trigger, below-min_hypotheses, or multi-evidence-class; otherwise single-context. - Generator fan-out — one fresh
sw-rca-hypothesis-generatorTask per partition (readonly: true, cheap tier). Generators never share context or orchestrator transcript. - Synthesize —
python3 scripts/rca_fanout.py synthesizededupes and ranks merged hypotheses. - Refuter panel — each survivor routes to a separate
sw-rca-hypothesis-refuterTask before route decisions. Refuters never receive generator transcripts (generation and judging never share a context). - Causal-chain gate — refuter must return
surviveswithcausalChainComplete: true; otherwise hypothesis is refuted or inconclusive. - Fallback — when fan-out is disabled or D5 not met, use the single-context loop unchanged.
Dispatch recipes: rules/sw-subagent-dispatch.mdc RCA fan-out dispatch. Status schema:
references/fan-out-schema.json.
Stabilize entry procedure
Single pass only — runs once per /sw-stabilize invocation. Does not iterate; stabilize-loop
owns the R29 budget (maxIterations, no-progress, human decision). Do not re-run this entry in a loop
inside one stabilize pass.
Consume harvested artifacts (collection happens in /sw-stabilize preconditions — do not re-fetch):
| Artifact | Path |
|---|---|
| Review threads | /tmp/sw-stabilize-threads.json |
| Non-inline findings | /tmp/sw-stabilize-noninline.md |
| Gate verdict | /tmp/sw-stabilize-gate.json (scripts/check-gate.py stdout) |
- Parse failing check names + logs from
/tmp/sw-stabilize-gate.json. - Parse normalized findings from threads JSON + non-inline markdown.
- Run the shared discipline (hypotheses → causal-chain gate) on
fix-nowcandidates only. Items destined forresolve-with-evidence,already-fixed-with-evidence, or defer buckets bypass the causal-chain gate — classify them straight into the ledger without forcing a trigger→symptom chain. - Propose minimal fix per top surviving
fix-nowhypothesis; verify against frozen spec / PRD amendments union. - Hand off to
/sw-stabilizeledger + fix procedure. Gate green is determined bycheck-gate.pyon the next pass — this entry does not declare success alone.
Debug entry procedure
Inputs: normalized signal per references/debug-inputs.md + optional repo context.
- Redact all signal text through
python3 scripts/sw_bootstrap.py memory-redact.pybefore analysis or memory. memory-preflightread: priordebugmemories forrelatedFiles/ failing area.- Enrich Sentry signals per
skills/debug/references/sentry.mdwhentype == sentry. - Form ranked hypotheses from signal evidence (stack, breadcrumbs, log excerpt, user report).
- Run the shared discipline — attempt repro-from-context but proceed without local repro if blocked.
- Emit root cause + proposed fix + verification plan.
- Do not implement or merge — hand off to
/sw-debugrouting (scoped phase vs brainstorm/amendment).
Cross-run recurrence escalation (PRD 041 R23/R24)
When scripts/failure-signature-escalate.py scan fires (config recurrence.threshold, count across ≥2
distinct runs), this skill's debug entry procedure applies to redacted failure text from the
host-attested signature store — not agent-authored free text. The escalate helper captures a root-cause
record in ${GIT_DIR}/shipwright-root-cause-records.json with distinct status + signatureClass
(flake | regression | infra).
- Flakes require a human-acknowledged waiver (
failure-signature-escalate.py ack-flake-waiver) beforeloopClosedis true. - Consult
core/sw-reference/anomaly-patterns.jsonto recognize known workflow classes and annotate the record only — never auto-act. Test-tampering defers to PRD A R9; annotate only when A's flags exist. - This layer sits above in-run
rca-coreand the conductor circuit breaker — neither is replaced.
Dev-time entry procedure
Inputs: failing test output, build error, or /tmp/sw-verify.status.json + relevant log excerpt from local
dev (not production signals).
-
Redact failure text through
python3 scripts/sw_bootstrap.py memory-redact.py. -
memory-preflightread for priordebug/learningmemories on the failing area. -
Reproduction-first (strict) — reproduce via the narrowest command (single test, build target, or verify key). If blocked, log what was tried and stop at human-decision hard stop — do not guess-fix.
-
Form ranked hypotheses from stack trace / assertion / build output.
-
Run shared discipline including failing-regression-test gate before fix proposal.
-
Optional git bisect for regressions when history is suspected:
# Wrapper: exit 0=good, 1=bad, 125=skip (git bisect convention) git bisect run bash -c '<repro command>; ec=$?; [[ $ec -eq 0 ]] && exit 0 || exit 1' -
Emit root cause + proposed fix + verification plan (test command that must flip red→green).
-
Hand off to
/sw-debugdev-time routing →/sw-worktree+/sw-startwhen fix is small; escalate on rule-of-three or substantial scope.
Entry comparison
| Stabilize | Debug | Dev-time | |
|---|---|---|---|
| Trigger | In-loop CI/review on a PR | Post-ship production signal | Local test/build/verify failure |
| Repro | Via failing checks/tests | Attempted; optional if blocked | Required or logged inability |
| Regression test | Via verify re-run | N/A at RCA stage | Required before fix |
| Fix execution | In-loop commit/push | Routed to 003/002 |
Routed to worktree + phase loop |
Output shape
## Hypotheses
1. [hypothesis] — evidence for / against (invalidated hypotheses marked)
## Causal chain
trigger → … → symptom
## Root cause
[one sentence]
## Recommended fix
[minimal change — scope estimate for routing]
## Verification
[how to confirm in prod/staging]
## Routing hint (debug only)
small | substantial — rationale
04 同仓库更多 Skills
wrong-name
Missing use when phrase and wrong directory name for critical lint failure.
demo-skill
Demo workflow pack skill fixture. Use when validating workflow-pack-sdk golden paths in CI.
good-skill
Validates Agent Skills spec conformance for fixture trees. Use when testing skills-spec-guard pass paths across core and dist mirrors. Does not ship production skills.
wrong-name
Fixture with name/dir mismatch for guard failure tests. Use when verifying skills-spec-guard rejects invalid identity. Does not ship production skills.
bad-description
Missing the required when trigger phrase in this fixture skill.
dropin-demo
暂无简介