Trace root causes of confirmed failures with formal logic
A Logic-Lens skill locating the root cause of a confirmed failure via backward-then-forward semi-formal tracing.
Why it matters
Locate the exact source of bugs and crashes by performing backward-then-forward semi-formal tracing from a confirmed failure (stack trace, failing test, or wrong value) to the root divergence point.
Outcomes
What it gets done
Walk backward from failure symptoms through each value and state change to identify the origin
Trace forward from suspected root causes to confirm they produce the observed failure
Perform interprocedural analysis across function calls with depth limits and confidence scoring
Generate structured fault reports with premises, divergence points, L-codes, and minimal remedies
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/ag-logic-locate | bash Overview
Logic-Lens - Fault Locate
This Logic-Lens skill locates the root cause of a confirmed failure by tracing backward from the symptom to its origin and forward to confirm, reporting a single Primary Fault with a Fault Confidence rating. Use it when a user has a concrete, reproducible failure - a stack trace, failing assertion, or wrong value. Hands off to logic-review when only a suspicion exists.
What it does
A Logic-Lens skill for fault location: finding the root cause of a CONFIRMED failure via backward-then-forward semi-formal tracing. It triggers on a stack trace, failing assertion, error message, or specific wrong-value observation - phrases like "find the bug", "this test is failing", "track down this crash". It uses lazy loading of shared reference docs (common.md for language, Iron Law, Fault Confidence, scope routing, Remedy discipline, config fields, and loading budget; logic-locate-guide.md loaded step by step; logic-risks.md, semiformal-guide.md, semiformal-checklist.md, and report-template.md loaded on demand). The process runs eight steps: Step 0 detects language and confirms a concrete failure exists, switching to logic-review if there is only a suspicion rather than a confirmed failure. Step 1 establishes observed behavior, expected behavior, and the reproduction path. Step 2 identifies the entry point - the failing test, outermost application frame, or request handler closest to the failure - and stays inside the "failure cone" first: stack frames, the failing test fixture, directly called local functions, and config/env values read on that path, without scanning unrelated modules unless the trace crosses into them. Step 3 traces backward from the failure point, walking each value and state back to its origin and building premises at every hop. Step 4 traces forward from the suspected root to verify the trace reaches the observed symptom. Step 5 performs interprocedural tracing if a callee is implicated - tracing into the callee, checking return values, unhandled exceptions, and shared-state mutation - applying a depth limit and the Call-Chain Context Label format, and downgrading to Medium confidence when the limit is hit and the remaining callee path is stated as a premise assumption instead of traced. Step 6 identifies the root divergence and classifies it: the exact line/expression, the violated premise, the actual behavior, the propagation chain to the symptom, and an L-code. Step 7 outputs a focused report with a Fault Confidence line (High/Medium/Low), a single Primary Fault five-field finding, optional Contributing Factors, and a minimal Remedy. Formatting is mandatory even for simple one-function bugs - the labeled Premises/Trace/Divergence/Trigger/Remedy fields and the Fault Confidence line must always appear, never a plain fix suggestion. The mode line reads "Fault Locate" (故障定位 in Chinese), and unlike logic-review's Critical/Warning/Suggestion split, the Findings section here has exactly one Primary Fault, with the Logic Score line replaced by Fault Confidence.
When to use - and when NOT to
Use it when a user provides a stack trace, failing assertion, error message, or specific wrong-value observation and wants the root cause found. Switch to logic-review instead if there is only a suspicion of a problem without a confirmed, reproducible failure.
Inputs and outputs
Input is a confirmed failure - a stack trace, failing assertion, error message, or wrong-value observation. Output is a focused report: a Fault Confidence line (High/Medium/Low), a single Primary Fault finding with all five labeled fields and an L-code, optional Contributing Factors, and a minimal Remedy.
Integrations
Part of the Logic-Lens skill family, sharing ../_shared/common.md, ../_shared/logic-risks.md, ../_shared/semiformal-guide.md, ../_shared/semiformal-checklist.md, and ../_shared/report-template.md with sibling skills logic-review, logic-diff, and logic-explain, and handing off to logic-review when the user only has a suspicion rather than a confirmed failure.
Who it's for
Developers debugging a confirmed, reproducible failure - a crash, failing test, or wrong output - who need the root cause traced back through the failure cone rather than a broad, unscoped code review.
Source README
Logic-Lens - Fault Locate
When to Use
Use this skill when you need locate the root cause of a CONFIRMED failure via backward-then-forward semi-formal tracing. Trigger when the user provides a stack trace, failing assertion, error message, or specific wrong-value observation - "find the bug", "this test is failing", "track down this crash", "why is...
Setup
Use lazy loading per ../_shared/common.md §13:
- Read
../_shared/common.mdonly for language, Iron Law, Fault Confidence, scope routing, Remedy discipline, config fields, and loading budget. - Read only the relevant step in
logic-locate-guide.mdas you reach it. - Load
../_shared/logic-risks.md,../_shared/semiformal-guide.md,../_shared/semiformal-checklist.md, and../_shared/report-template.mdon demand when the current step needs them.
Process
Step 0. Language + scope routing. Detect language per common.md §1. Confirm a concrete failure exists (stack trace, failing assertion, specific wrong value). If only a suspicion, switch to logic-review.
Step 1. Understand the failure (guide Step 1) - observed behavior, expected behavior, reproduction path.
Step 2. Identify the entry point (guide Step 2) - failing test, outermost application frame, or request handler - whichever is closest to the failure. Stay inside the failure cone first: stack frames, failing test fixture, directly called local functions, and config/env values read on that path. Do not scan unrelated modules unless the trace crosses into them.
Step 3. Trace backward from the failure point (guide Step 3) - walk each value and state back to its origin, building premises at every hop.
Step 4. Trace forward to confirm (guide Step 4) - from the suspected root, verify the trace reaches the observed symptom.
Step 5. Interprocedural tracing if a callee is implicated (guide Step 5) - trace into the callee; check return values under observed conditions, unhandled exceptions, shared-state mutation. Apply the depth limit and Call-Chain Context Label format defined in semiformal-guide.md §Call-Chain Context Labels; at the limit, state the remaining callee path as a premise assumption and downgrade to Medium confidence (per common.md §7).
Step 6. Identify the root divergence and classify (guide Step 6) - state the exact line/expression, the violated premise, the actual behavior, the propagation chain to the symptom; pick the L-code.
Step 7. Output the focused report (guide Step 7) - Fault Confidence (High/Medium/Low, per common.md §7); Primary Fault (single five-field finding); optionally Contributing Factors; a minimal Remedy per common.md §10. Format is mandatory even for simple one-function bugs: always emit the labeled Premises / Trace / Divergence / Trigger / Remedy fields and the Fault Confidence line. Never answer with a plain fix suggestion.
Mode line in report: Fault Locate (Chinese: 故障定位).
Output format: the Findings section has ONE Primary Fault, not a full Critical/Warning/Suggestion split. The Logic Score line is replaced by Fault Confidence: High / Medium / Low.
Limitations
- Use this skill only when the task clearly matches its upstream source and local project context.
- Verify commands, generated code, dependencies, credentials, and external service behavior before applying changes.
- Do not treat examples as a substitute for environment-specific tests, security review, or user approval for destructive or costly actions.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.