agentleFS
Echo-ScionEcho-Scion/orioncortex/.agents/skills/systematic-debugging/SKILL.md

systematic-debugging

Skill2 starsChanged 5 days agoMITView on GitHub

Use when investigating runtime bugs, failing tests, unexpected behaviors, or system crashes before modifying implementation code.

191 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use chinese-code-review, chinese-commit-conventions and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Leodorareluctant259Skill

    chinese-code-review

    中文代码审查规范——在保持专业严谨的同时,用符合国内团队文化的方式给出有效反馈

    Also in 8 projects that use this

  • Leodorareluctant259Skill

    chinese-commit-conventions

    中文 Git 提交规范 — 适配国内团队的 commit message 规范和 changelog 自动化

    Also in 8 projects that use this

  • obraSkill

    diagnosing-superpowers

    Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.

    Also in 20 projects that use this

  • mjunaidcaSkill

    building-chatgpt-apps

    Guides creation of ChatGPT Apps with interactive widgets using OpenAI Apps SDK and MCP servers. Use when building ChatGPT custom apps with visual UI components, embedded widgets, or rich interactive experiences. Covers widget architecture, MCP server setup with FastMCP, response metadata, and Developer Mode configuration. NOT when building standard MCP servers without widgets (use building-mcp-servers skill instead).

    Also in 4 projects that use this

  • mjunaidcaSkill

    building-chat-interfaces

    Build AI chat interfaces with custom backends, authentication, and context injection. Use when integrating chat UI with AI agents, adding auth to chat, injecting user/page context, or implementing httpOnly cookie proxies. Covers ChatKitServer, useChatKit, and MCP auth patterns. NOT when building simple chatbots without persistence or custom agent integration.

    Also in 4 projects that use this

  • +2 more from Leodorareluctant259
  • +5 more from mjunaidca

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. 0 are common, 11 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 177 edited versions we read keep these.

  • 11

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use python .agents/scripts/orion.py sandbox or SovereignSandbox.execute_snippet() for isolated reproduction snippets before modifying …

    line 9
  2. Distinctive:

    Zero Production Mutation: NEVER modify production source code or persistent database tables just to probe or reproduce a bug.

    line 21
  3. Distinctive:

    When issues span boundaries (API -> Service -> DB, CLI -> Subprocess), add temporary diagnostic logs at each boundary (input data, output …

    line 25
  4. Distinctive:

    Dependency & Environment Verification: Check active configuration, environment variables, and state assumptions.

    line 30
  5. Distinctive:

    Write a single-sentence hypothesis: *"Condition X causes invariant Y to fail because of state Z."*

    line 34
  6. Distinctive:

    Test the hypothesis by changing ONE variable at a time.

    line 36
  7. Distinctive:

    If reproduction test passes, advance to Phase 4.

    line 39
  8. Distinctive:

    If test still fails, discard hypothesis immediately.

    line 40
  9. Distinctive:

    If 2 consecutive hypotheses fail, document root-cause analysis before attempting Hypothesis 3.

    line 42
  10. Very specific:

    Verify reproduction test exits with Exit Code 0.

    line 47
  11. Very specific:

    Run the full project test suite to prove zero regression (Exit Code 0).

    line 48
  12. Distinctive:

    If 3 consecutive fix attempts fail, STOP calling tools immediately.

    line 50
  13. Very specific:

    Write reproduce_bug.<ext> or <feature>_test.<ext> (e.g.

    line 56
  14. Distinctive:

    If script succeeds (no bug found), STOP fix.

    line 58
  15. Distinctive:

    If script fails (bug proven), proceed with implementation.

    line 59
  16. Very specific:

    Test Pollution Bisector: Run python .agents/scripts/orion.py polluter <leak_target> <test_pattern> to isolate tests that leak state or …

    line 64

“Common” is measured: kept by at least 6 in 10 of the 177 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

🌲 Systematic Debugging Protocol (Scientific Root-Cause Discipline)

Use python .agents/scripts/orion.py sandbox or SovereignSandbox.execute_snippet() for isolated reproduction snippets before modifying production code.

The Iron Law: NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.
If you have not deterministically proven the root cause, you are FORBIDDEN from modifying implementation code.

Execute these four phases sequentially for ANY bug, test failure, crash, or unexpected behavior:

Phase 1: Root Cause Investigation

  1. Read Error Messages & Stack Traces Completely:
    • Note exact file paths, line numbers, and error codes. Do NOT skim or jump to assumptions.
  2. Deterministic Minimal Reproduction (Scratchpad Isolation Gate):
    • Formulate exact reproduction steps. Create a standalone reproduction test case in a temporary scratch script (e.g., scratch/repro_<issue>.<ext>) or ephemeral test that exits with Exit Code > 0.
    • Zero Production Mutation: NEVER modify production source code or persistent database tables just to probe or reproduce a bug. Reproduction must remain completely isolated in the scratchpad harness.
  3. Trace Data Flow Backward:
    • Trace backwards from the symptom or bad value to the exact origin in the call stack. Fix at the source, never at the symptom.
  4. Multi-Component Diagnostic Logging:
    • When issues span boundaries (API -> Service -> DB, CLI -> Subprocess), add temporary diagnostic logs at each boundary (input data, output data, state). Pinpoint precisely which layer breaks before touching logic.

Phase 2: Pattern Analysis

  1. Find Working Examples: Locate similar working implementations in the same codebase.
  2. Differential Analysis: Compare the working code against the broken code line-by-line. List every difference without assuming "that can't matter."
  3. Dependency & Environment Verification: Check active configuration, environment variables, and state assumptions.

Phase 3: Single Hypothesis & Minimal Testing

  1. Formulate Explicit Hypothesis:
    • Write a single-sentence hypothesis: "Condition X causes invariant Y to fail because of state Z."
  2. Minimal Single-Variable Modification:
    • Test the hypothesis by changing ONE variable at a time.
    • Strictly forbid bundled refactoring, formatting cleanup, or "while I'm here" modifications during debugging.
  3. Evaluate Outcome & Mandatory Rollback:
    • If reproduction test passes, advance to Phase 4.
    • If test still fails, discard hypothesis immediately.
    • Mandatory Rollback Gate: You MUST execute git stash push --include-untracked -m "debug-hypothesis-rollback" -- <target_file> to revert modifications non-destructively before testing the next hypothesis. Speculative changes MUST NEVER accumulate across hypotheses (Anti-Shotgun Rule).
    • If 2 consecutive hypotheses fail, document root-cause analysis before attempting Hypothesis 3.

Phase 4: Implementation, Survivor Verification & Circuit Breaker

  1. Targeted Root Cause Fix: Apply the surgical fix directly addressing the proven root cause.
  2. Survivor Verification:
    • Verify reproduction test exits with Exit Code 0.
    • Run the full project test suite to prove zero regression (Exit Code 0).
  3. The 3-Attempt Circuit Breaker:
    • If 3 consecutive fix attempts fail, STOP calling tools immediately.
    • Repeated failure indicates an architectural flaw or wrong pattern, NOT a missing tweak.
    • Acknowledge the pattern failure, output error analysis, and consult user before attempting further fixes.

🔒 Causal Enforcement (The "No-Fix" Policy)

  • Protocol:
    1. Write reproduce_bug.<ext> or <feature>_test.<ext> (e.g. .py, .ts, .go, .dart).
    2. Run the script.
    3. If script succeeds (no bug found), STOP fix.
    4. If script fails (bug proven), proceed with implementation.

📚 Specialized References & Tooling

  • Condition-Based Waiting: references/condition-based-waiting.md (Eliminate flaky sleeps in async tests).
  • 4-Layer Defense-in-Depth: references/defense-in-depth.md (Entry, Domain, Sandbox, and Telemetry layers).
  • Test Pollution Bisector: Run python .agents/scripts/orion.py polluter <leak_target> <test_pattern> to isolate tests that leak state or files.

💡 Continuous Learnings

<!-- LEARNED_START -->
  • Recurring Mechanical Catch in scanner.py:ast_symbol_cache_read: Enforce boundary invariant guard on scanner.py:ast_symbol_cache_read
  • Recurring Mechanical Catch in generate_completion:openai:qwen2.5-coder:3b-lite: Enforce boundary invariant guard on generate_completion:openai:qwen2.5-coder:3b-lite
  • Recurring Mechanical Catch in orion:record_tool_quantum: Enforce boundary invariant guard on orion:record_tool_quantum
  • Recurring Mechanical Catch in capabilities:record_tool_call: Enforce boundary invariant guard on capabilities:record_tool_call
  • Recurring Mechanical Catch in packer.py:_call_local_llm_for_taxonomy: Enforce boundary invariant guard on packer.py:_call_local_llm_for_taxonomy
  • Recurring Mechanical Catch in pre_wake:record_turn: Enforce boundary invariant guard on pre_wake:record_turn
  • Recurring Mechanical Catch in multi_layer_memory_pre_wake: Enforce boundary invariant guard on multi_layer_memory_pre_wake
  • Recurring Mechanical Catch in brain.py:gc_ep_file:session_20261019_160740.md: Enforce boundary invariant guard on brain.py:gc_ep_file:session_20261019_160740.md
  • Recurring Mechanical Catch in brain.py:gc_obs_rollover: Enforce boundary invariant guard on brain.py:gc_obs_rollover
  • Recurring Mechanical Catch in rag:filter_overlapping_context: Enforce boundary invariant guard on rag:filter_overlapping_context
  • Recurring Mechanical Catch in probe_local_ollama_for_vision: Enforce boundary invariant guard on probe_local_ollama_for_vision
  • Recurring Mechanical Catch in brain.py:classify_file:dna: Enforce boundary invariant guard on brain.py:classify_file:dna
  • Recurring Mechanical Catch in auto_sync_compile: Enforce boundary invariant guard on auto_sync_compile
  • Graduated Observation: Verify gate failure: GHOST - Invalid orion CLI subcommand: 'debug': Enforce deterministic verifier for Verify gate failure: GHOST - Invalid orion CLI sub
<!-- LEARNED_END -->

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.