This section maps Claude Code plugin tool references to Codex behavior.
Only this block is managed automatically.
Tool mapping:
Read: use shell reads (cat/sed) or rg
Write: create files via shell redirection or apply_patch
Edit/MultiEdit: use apply_patch
Bash: use shell_command
Grep: use rg (fallback: grep)
Glob: use rg --files or find
LS: use ls via shell_command
WebFetch/WebSearch: use curl or Context7 for library docs
AskUserQuestion/Question: present choices as a numbered list in chat and wait for a reply number. For multi-select (multiSelect: true), accept comma-separated numbers. Never skip or auto-configure — always wait for the user's response before proceeding.
TaskCreate/TaskUpdate/TaskList/TaskGet/TaskStop/TaskOutput (Claude Code task-tracking, current): use update_plan (Codex's task-tracking primitive)
TodoWrite/TodoRead (Claude Code task-tracking, legacy — deprecated, replaced by Task* tools): use update_plan
Skill: open the referenced SKILL.md and follow it
ExitPlanMode: ignore
--- project-doc ---
AGENTS.md
This file contains local project instructions for AI agents working in this
checkout.
Changelog Discipline
CHANGELOG.md is the source of truth for release notes.
For every user-facing code, behavior, documentation, packaging, installer,
workflow, or compatibility change, update CHANGELOG.md in the same turn.
Add new work under ## Unreleased first. Use the existing categories:
Added, Changed, Fixed, Performance, Security, Removed, and
Notes.
Do not add empty categories. Create a category only when it has at least one
bullet.
Keep entries user-facing and specific. Avoid commit-log noise such as
"bump version," "prepare release," or "apply formatting," unless that is the
only release-relevant change.
When preparing a release, move the relevant Unreleased entries into a
## X.Y.Z - YYYY-MM-DD section, leave a fresh Unreleased section at the
top, and verify the version matches Cargo.toml and the vX.Y.Z tag.
Before tagging a release, confirm that CHANGELOG.md includes the version
section that GitHub release notes will use.
Automation: SIFS bug finder
Automation ID: sifs-bug-finder
Automation memory: $CODEX_HOME/automations/sifs-bug-finder/memory.md
Last run: 2026-05-08T23:01:59.216Z (1778281319216)
Find a bug, implement a minimal fix (ideally a red green test), test it, update the changelog, commit, and push.
Use $ce-debug
User
Debug and Fix
Find root causes, then fix them. This skill investigates bugs systematically — tracing the full causal chain before proposing a fix — and optionally implements the fix with test-first discipline.
<bug_description> #$ARGUMENTS </bug_description>
Core Principles
These principles govern every phase. They are repeated at decision points because they matter most when the pressure to skip them is highest.
Investigate before fixing. Do not propose a fix until you can explain the full causal chain from trigger to symptom with no gaps. "Somehow X leads to Y" is a gap.
Predictions for uncertain links. When the causal chain has uncertain or non-obvious links, form a prediction — something in a different code path or scenario that must also be true. If the prediction is wrong but a fix "works," you found a symptom, not the cause. When the chain is obvious (missing import, clear null reference), the chain explanation itself is sufficient.
One change at a time. Test one hypothesis, change one thing. If you're changing multiple things to "see if it helps," stop — that is shotgun debugging.
When stuck, diagnose why — don't just try harder.
Execution Flow
Phase
Name
Purpose
0
Triage
Parse input, fetch issue if referenced, proceed to investigation
1
Investigate
Reproduce the bug, trace the code path
2
Root Cause
Form hypotheses with predictions for uncertain links, test them, causal chain gate, smart escalation
3
Fix
Only if user chose to fix. Test-first fix with workspace safety checks
4
Handoff
Structured summary, then prompt the user for the next action
All phases self-size — a simple bug flows through them in seconds, a complex bug spends more time in each naturally. No complexity classification, no phase skipping.
Phase 0: Triage
Parse the input and reach a clear problem statement.
If the input references an issue tracker, fetch it:
GitHub (#123, org/repo#123, github.com URL): Parse the issue reference from <bug_description> and fetch with gh issue view <number> --json title,body,comments,labels. For URLs, pass the URL directly to .
Assistant
I’ll use ce-debug for the bug hunt and start by reading the automation memory plus the current repo state, so I don’t repeat the last run or accidentally absorb unrelated work.
Assistant
The worktree is already on a bug-finder branch with unrelated local changes in docs/ideation/oracle-ideas.md, .codex/, and .entire/. I’ll leave those alone and look for a narrow bug in code/tests/changelog only.
Assistant
I’ve started a read-only explorer in parallel for candidate bug surfaces. Locally I’m going to inspect the CLI and existing tests so the next step can be a concrete red test, not a speculative patch.
Assistant
I found a concrete bug candidate in the daemon search path: the CLI accepts sifs search --explain, and direct search sets SearchOptions.explain, but the daemon-backed path builds a fresh SearchOptions and never copies command.explain before serializing the request. I’m adding a daemon regression test that should fail first by showing JSON results without explanation evidence.
Assistant
The regression test fails for the expected reason: daemon-backed JSON results have no explanation object even though --explain was passed. I’m now making the one-line fix that preserves the flag in the daemon request and adding the changelog entry under Unreleased / Fixed.
Assistant
The focused test is green after the fix. I’m running formatting/lint/test gates next, and I’ll only stage the three intended files so the existing unrelated worktree changes stay out of the commit.
User
Phase 4: Handoff
Structured summary — always write this first:
code
## Debug Summary
**Problem**: [What was broken]
**Root Cause**: [Full causal chain, with file:line references]
**Recommended Tests**: [Tests to add/modify to prevent recurrence, with specific file and assertion guidance]
**Fix**: [What was changed — or "diagnosis only" if Phase 3 was skipped]
**Prevention**: [Test coverage added; defense-in-depth if applicable]
**Confidence**: [High/Medium/Low]
If Phase 3 was skipped (user chose "Diagnosis only" in Phase 2), stop after the summary — the user already told you they were taking it from here. Do not prompt.
If Phase 3 ran, the next move depends on whether the skill created the branch in Phase 3.
Skill-owned branch (created in Phase 3): default to commit-and-PR without prompting
Check for contextual overrides first. Look at the user's original prompt, loaded memories, and the user/repo AGENTS.md or CLAUDE.md for preferences that conflict with auto commit-and-PR — for example, "always review before pushing", "open PRs as drafts", or "don't open PRs from skills". A signal must be an explicit instruction or a clearly applicable rule, not a vague tonal cue. If any apply, honor them — switch to the pre-existing-branch menu below, or skip the PR step entirely, whichever matches the user's stated preference.
Briefly preview what will happen — what will be committed, on what branch, and that a PR will be opened — then proceed without waiting for confirmation. The preview exists so the user can interrupt; it is not a blocking question. Format and length are your call; keep it scannable.
Run the ce-commit-push-pr skill. When the entry came from an issue tracker, include the appropriate auto-close syntax for that tracker in the location it requires — most trackers parse PR descriptions (e.g., Fixes #N for GitHub, Closes ABC-123 for Linear), but some only parse commit messages (e.g., Jira Smart Commits) — so the diagnosis and fix flow back to the issue and it closes on merge. Surface the resulting PR URL.
Pre-existing branch (skill did not create it): ask the user
Use the platform's blocking question tool (AskUserQuestion in Claude Code, in Codex, in Gemini, in Pi (requires the extension)). In Claude Code, call with first if its schema isn't loaded — a pending schema load is not a reason to fall back. Fall back to numbered options in chat only when no blocking tool exists in the harness or the call errors. Never end the phase without collecting a response.
User
Phase 3: Fix
Reminder: one change at a time. If you are changing multiple things, stop.
If the user chose "Diagnosis only" at the end of Phase 2, skip this phase and go straight to Phase 4 for the summary — the skill's job was the diagnosis. If they chose "Rethink the design", control has transferred to the ce-brainstorm skill and this skill ends.
Workspace and branch check: Before editing files:
Check for uncommitted changes (git status). If the user has unstaged work in files that need modification, confirm before editing — do not overwrite in-progress changes.
If the current branch is the default branch, ask whether to create a feature branch first using the platform's blocking question tool (see Phase 2 for the per-platform names). To detect the default branch, compare against main, master, or the value of git rev-parse --abbrev-ref origin/HEAD with its origin/ prefix stripped (the raw output is origin/<name>, so an unstripped comparison will never match the local branch name). Default to creating one; derive a name from the bug and run git checkout -b <name>. On any other branch, proceed.
Test-first:
Write a failing test that captures the bug (or use the existing failing test)
Verify it fails for the right reason — the root cause, not unrelated setup
Implement the minimal fix — address the root cause and nothing else
Verify the test passes
Run the broader test suite for regressions
3 failed fix attempts = smart escalation. Diagnose using the same table from Phase 2. If fixes keep failing, the root cause identification was likely wrong. Return to Phase 2.
Conditional defense-in-depth (trigger: grep for the root-cause pattern found it in 3+ other files, OR the bug would have been catastrophic if it reached production): Read references/defense-in-depth.md for the four-layer model (entry validation, invariant check, environment guard, diagnostic breadcrumb) and choose which layers apply. Skip when the root cause is a one-off error with no realistic recurrence path.
Conditional post-mortem (trigger: the bug was in production, OR the pattern appears in 3+ locations):
Analyze how this was introduced and what allowed it to survive. Note any systemic gap or repeated pattern found — it informs Phase 4's decision on whether to offer learning capture.
User
Phase 2: Root Cause
Reminder: investigate before fixing. Do not propose a fix until you can explain the full causal chain from trigger to symptom with no gaps.
Read references/anti-patterns.md before forming hypotheses.
Assumption audit (before hypothesis formation): List the concrete "this must be true" beliefs your understanding depends on — the framework behaves as expected here, this function returns what its name implies, the config loads before this runs, the caller passes a non-null value, the database is in the state the test implies. For each, mark verified (you read the code, checked state, or ran it) or assumed. Assumptions are the most common source of stuck debugging. Many "wrong hypotheses" are actually correct hypotheses tested against a wrong assumption.
Form hypotheses ranked by likelihood. For each, state:
What is wrong and where (file:line)
The causal chain: how the trigger leads to the observed symptom, step by step
For uncertain links in the chain: a prediction — something in a different code path or scenario that must also be true if this link is correct
When the causal chain is obvious and has no uncertain links (missing import, clear type error, explicit null dereference), the chain explanation itself is the gate — no prediction required. Predictions are a tool for testing uncertain links, not a ritual for every hypothesis.
Before forming a new hypothesis, review what has already been ruled out and why.
Causal chain gate: Do not proceed to Phase 3 until you can explain the full causal chain — from the original trigger through every step to the observed symptom — with no gaps. The user can explicitly authorize proceeding with the best-available hypothesis if investigation is stuck.
Reminder: if a prediction was wrong but the fix appears to work, you found a symptom. The real cause is still active.
Present findings
Once the root cause is confirmed, present:
The root cause (causal chain summary with file:line references)
The proposed fix and which files would change
Which tests to add or modify to prevent recurrence (specific test file, test case description, what the assertion should verify)
Whether existing tests should have caught this and why they did not
Then offer next steps.
Use the platform's blocking question tool (AskUserQuestion in Claude Code, request_user_input in Codex, ask_user in Gemini, ask_user in Pi (requires the pi-ask-user extension)). In Claude Code, call with first if its schema isn't loaded — a pending schema load is not a reason to fall back. Fall back to numbered options in chat only when no blocking tool exists in the harness or the call errors (e.g., Codex edit modes). Never silently skip the question.
User
Phase 1: Investigate
1.1 Reproduce the bug
Confirm the bug exists and understand its behavior. Run the test, trigger the error, follow reported reproduction steps — whatever matches the input.
Browser bugs: Prefer agent-browser if installed. Otherwise use whatever works — MCP browser tools, direct URL testing, screenshot capture, etc.
Manual setup required: If reproduction needs specific conditions the agent cannot create alone (data states, user roles, external services, environment config), document the exact setup steps and guide the user through them. Clear step-by-step instructions save significant time even when the process is fully manual.
Does not reproduce after 2-3 attempts: Read references/investigation-techniques.md for intermittent-bug techniques.
Cannot reproduce at all in this environment: Document what was tried and what conditions appear to be missing.
1.2 Verify environment sanity
Before deep code tracing, confirm the environment is what you think it is:
Correct branch checked out; no unintended uncommitted changes
Dependencies installed and up to date (bun install, npm install, bundle install, etc.) — stale node_modules/vendor is a frequent false lead
Expected interpreter or runtime version (check .tool-versions, .nvmrc, Gemfile, etc. against what's actually active)
Required env vars present and non-empty
No stale build artifacts (dist/, .next/, compiled binaries from an earlier branch)
Dependent local services (database, cache, queue) running at expected versions when the bug plausibly involves them
1.3 Trace the code path
Read the relevant source files. Follow the execution path from entry point to where the error manifests. Trace backward through the call chain:
Start at the error
Ask "where did this value come from?" and "who called this?"
Keep going upstream until finding the point where valid state first became invalid
Do not stop at the first function that looks wrong — the root cause is where bad state originates, not where it is first observed
As you trace:
Check recent changes in files you are reading: git log --oneline -10 -- [file]
If the bug looks like a regression ("it worked before"), use git bisect (see references/investigation-techniques.md)
Check the project's observability tools for additional evidence:
Each project has different systems available; use whatever gives a more complete picture
User
Phase 0: Triage
Parse the input and reach a clear problem statement.
If the input references an issue tracker, fetch it:
GitHub (#123, org/repo#123, github.com URL): Parse the issue reference from <bug_description> and fetch with gh issue view <number> --json title,body,comments,labels. For URLs, pass the URL directly to gh.
Other trackers (Linear URL/ID, Jira URL/key, any tracker URL): Attempt to fetch using available MCP tools or by fetching the URL content. If the fetch fails — auth, missing tool, non-public page — ask the user to paste the relevant issue content. Ensure the fetch includes the full comment thread, not just the opening description.
Read the full conversation — the original description AND every comment, with particular attention to the latest ones. Comments frequently contain updated reproduction steps, narrowed scope, prior failed attempts, additional stack traces, or a pivot to a different suspected root cause; treating the opening post as the whole picture often sends the investigation in the wrong direction. Extract reported symptoms, expected behavior, reproduction steps, and environment details from the combined thread. Then proceed to Phase 1.
Everything else (stack traces, test paths, error messages, descriptions of broken behavior): Proceed directly to Phase 1.
Questions:
Do not ask questions by default — investigate first (read code, run tests, trace errors)
Only ask when a genuine ambiguity blocks investigation and cannot be resolved by reading code or running tests
When asking, ask one specific question
Prior-attempt awareness: If the user indicates prior failed attempts ("I've been trying", "keeps failing", "stuck"), ask what they have already tried before investigating. This avoids repeating failed approaches and is one of the few cases where asking first is the right call.
User
<subagent_notification>
{"agent_path":"019e0ef8-d675-7653-93f4-e37566e7744d","status":{"completed":"Candidate Bug\n\n--filter-path normalization is applied by the actual search selector, but not by the CLI warning generator. That means a valid normalized path like ./src/lib.rs returns matching results and still emits a misleading warning saying the file did not exactly match.\n\nI reproduced this read-only with the existing target/debug/sifs binary against a temporary /tmp fixture:\n\nsh\ntmp=$(mktemp -d /tmp/sifs-repro.XXXXXX)\nmkdir -p \"$tmp/src\"\nprintf 'pub fn token_validation() -> bool {\\n true\\n}\\n' > \"$tmp/src/lib.rs\"\n\ntarget/debug/sifs search token \\\n --source \"$tmp\" \\\n --mode bm25 \\\n --filter-path ./src/lib.rs \\\n --no-cache \\\n --json\n\nrm -rf \"$tmp\"\n\n\nObserved behavior: the JSON includes a real result for src/lib.rs, but also includes:\n\njson\n\"warnings\": [\n \"No indexed file exactly matched filter-path \\\"./src/lib.rs\\\". Did you mean \\\"src/lib.rs\\\"?\"\n]\n\n\nThe same command with --filter-path src/lib.rs returns the same result with no warning, so this looks like a false positive warning rather than a search failure.\n\nLikely Files\n\n- src/main.rs: CLI search computes warnings before running index.search_with.\n- src/main.rs: search_warnings compares raw filter_paths against index.indexed_files(), then only uses strip_prefix(\"./\") for suggestions.\n- src/index.rs: selector normalizes each filter path before matching, so search succeeds.\n- src/index.rs: normalize_filter_path is the behavior warning generation should probably share.\n- tests/cli.rs: existing CLI coverage tests only the canonical src/lib.rs path, not ./src/lib.rs.\n- src/mcp.rs: MCP warning logic appears to have the same raw-path comparison pattern.\n\n\n\nAdd a focused CLI regression next to :\n\n\n\nA matching unit-level fix would likely normalize the warning-side path before checking , or expose/reuse outside .\n\n\n\nHigh. I verified the inconsistent behavior with a live CLI repro and found the exact split: normalizes for search matching, while warning generation compares the raw flag value. The only caveat is that I used the already-built binary to avoid building or modifying repo files; the source code inspection matches the observed output.\n\n::inbox-item{title="SIFS false path-filter warning" summary="Read-only bug candidate ready for regression test"}"}}
</subagent_notification>
Assistant
The parallel explorer found a different valid bug candidate, but the daemon --explain regression is already fixed, red-green verified, and narrower to commit now. I’m checking the exact staged surface before committing.
Assistant
Verification passed: cargo fmt --check, full cargo test, cargo clippy --all-targets --all-features -- -D warnings, and git diff --check are clean. I’m staging only CHANGELOG.md, src/main.rs, and tests/cli.rs for the commit.
Assistant
The scoped commit is created. I’m pushing this branch now, then I’ll update the automation memory with the bug, tests, commit, and leftover unrelated worktree state.
Assistant
Debug Summary
Problem: Daemon-backed sifs search --explain --json silently dropped ranking evidence when a running daemon handled the search.
Root Cause: Direct CLI search carries SearchOptions.explain, but the daemon path rebuilt a fresh SearchOptions in src/main.rs and copied only mode, language filters, and path filters. Because command.explain was not copied into the daemon request, src/daemon/runtime.rs searched with explain = false, so src/main.rs had no explanation field to serialize.
Recommended Tests: Added daemon_search_honors_explain_flag in tests/cli.rs. It starts a real daemon, runs sifs search --mode bm25 --explain --json, and asserts the returned result includes explanation.bm25_rank and explanation.final_score.
Fix: Preserved command.explain in the daemon request construction in src/main.rs. Updated CHANGELOG.md under Unreleased / Fixed.
Prevention: Verified red/green behavior. The focused test failed before the fix and passed after it. Full verification also passed:
cargo test daemon_search_honors_explain_flag --test cli, cargo fmt --check, cargo test, cargo clippy --all-targets --all-features -- -D warnings, and git diff --check -- src/main.rs tests/cli.rs CHANGELOG.md.
Confidence: High.
Committed and pushed 8631889 Fix daemon search explain flag to fix/bug-finder-20260509-010228. The repo still has pre-existing unrelated local changes in docs/ideation/oracle-ideas.md, plus untracked and ; I left those untouched.
Other trackers (Linear URL/ID, Jira URL/key, any tracker URL): Attempt to fetch using available MCP tools or by fetching the URL content. If the fetch fails — auth, missing tool, non-public page — ask the user to paste the relevant issue content. Ensure the fetch includes the full comment thread, not just the opening description.
Read the full conversation — the original description AND every comment, with particular attention to the latest ones. Comments frequently contain updated reproduction steps, narrowed scope, prior failed attempts, additional stack traces, or a pivot to a different suspected root cause; treating the opening post as the whole picture often sends the investigation in the wrong direction. Extract reported symptoms, expected behavior, reproduction steps, and environment details from the combined thread. Then proceed to Phase 1.
Everything else (stack traces, test paths, error messages, descriptions of broken behavior): Proceed directly to Phase 1.
Questions:
Do not ask questions by default — investigate first (read code, run tests, trace errors)
Only ask when a genuine ambiguity blocks investigation and cannot be resolved by reading code or running tests
When asking, ask one specific question
Prior-attempt awareness: If the user indicates prior failed attempts ("I've been trying", "keeps failing", "stuck"), ask what they have already tried before investigating. This avoids repeating failed approaches and is one of the few cases where asking first is the right call.
Phase 1: Investigate
1.1 Reproduce the bug
Confirm the bug exists and understand its behavior. Run the test, trigger the error, follow reported reproduction steps — whatever matches the input.
Browser bugs: Prefer agent-browser if installed. Otherwise use whatever works — MCP browser tools, direct URL testing, screenshot capture, etc.
Manual setup required: If reproduction needs specific conditions the agent cannot create alone (data states, user roles, external services, environment config), document the exact setup steps and guide the user through them. Clear step-by-step instructions save significant time even when the process is fully manual.
Does not reproduce after 2-3 attempts: Read references/investigation-techniques.md for intermittent-bug techniques.
Cannot reproduce at all in this environment: Document what was tried and what conditions appear to be missing.
1.2 Verify environment sanity
Before deep code tracing, confirm the environment is what you think it is:
Correct branch checked out; no unintended uncommitted changes
Dependencies installed and up to date (bun install, npm install, bundle install, etc.) — stale node_modules/vendor is a frequent false lead
Expected interpreter or runtime version (check .tool-versions, .nvmrc, Gemfile, etc. against what's actually active)
Required env vars present and non-empty
No stale build artifacts (dist/, .next/, compiled binaries from an earlier branch)
Dependent local services (database, cache, queue) running at expected versions when the bug plausibly involves them
1.3 Trace the code path
Read the relevant source files. Follow the execution path from entry point to where the error manifests. Trace backward through the call chain:
Start at the error
Ask "where did this value come from?" and "who called this?"
Keep going upstream until finding the point where valid state first became invalid
Do not stop at the first function that looks wrong — the root cause is where bad state originates, not where it is first observed
As you trace:
Check recent changes in files you are reading: git log --oneline -10 -- [file]
If the bug looks like a regression ("it worked before"), use git bisect (see references/investigation-techniques.md)
Check the project's observability tools for additional evidence:
Each project has different systems available; use whatever gives a more complete picture
Phase 2: Root Cause
Reminder: investigate before fixing. Do not propose a fix until you can explain the full causal chain from trigger to symptom with no gaps.
Read references/anti-patterns.md before forming hypotheses.
Assumption audit (before hypothesis formation): List the concrete "this must be true" beliefs your understanding depends on — the framework behaves as expected here, this function returns what its name implies, the config loads before this runs, the caller passes a non-null value, the database is in the state the test implies. For each, mark verified (you read the code, checked state, or ran it) or assumed. Assumptions are the most common source of stuck debugging. Many "wrong hypotheses" are actually correct hypotheses tested against a wrong assumption.
Form hypotheses ranked by likelihood. For each, state:
What is wrong and where (file:line)
The causal chain: how the trigger leads to the observed symptom, step by step
For uncertain links in the chain: a prediction — something in a different code path or scenario that must also be true if this link is correct
When the causal chain is obvious and has no uncertain links (missing import, clear type error, explicit null dereference), the chain explanation itself is the gate — no prediction required. Predictions are a tool for testing uncertain links, not a ritual for every hypothesis.
Before forming a new hypothesis, review what has already been ruled out and why.
Causal chain gate: Do not proceed to Phase 3 until you can explain the full causal chain — from the original trigger through every step to the observed symptom — with no gaps. The user can explicitly authorize proceeding with the best-available hypothesis if investigation is stuck.
Reminder: if a prediction was wrong but the fix appears to work, you found a symptom. The real cause is still active.
Present findings
Once the root cause is confirmed, present:
The root cause (causal chain summary with file:line references)
The proposed fix and which files would change
Which tests to add or modify to prevent recurrence (specific test file, test case description, what the assertion should verify)
Whether existing tests should have caught this and why they did not
Then offer next steps.
Use the platform's blocking question tool (AskUserQuestion in Claude Code, request_user_input in Codex, ask_user in Gemini, ask_user in Pi (requires the pi-ask-user extension)). In Claude Code, call ToolSearch with select:AskUserQuestion first if its schema isn't loaded — a pending schema load is not a reason to fall back. Fall back to numbered options in chat only when no blocking tool exists in the harness or the call errors (e.g., Codex edit modes). Never silently skip the question.
Options to offer:
Fix it now — proceed to Phase 3
Diagnosis only — I'll take it from here — skip the fix, proceed to Phase 4's summary, and end the skill
Rethink the design (the ce-brainstorm skill) — only when the root cause reveals a design problem (see below)
Do not assume the user wants action right now. The test recommendations are part of the diagnosis regardless of which path is chosen.
When to suggest brainstorm: Only when investigation reveals the bug cannot be properly fixed within the current design — the design itself needs to change. Concrete signals observable during debugging:
The root cause is a wrong responsibility or interface, not wrong logic. The module should not be doing this at all, or the boundary between components is in the wrong place. (Observable: the fix requires moving responsibility between modules, not correcting code within one.)
The requirements are wrong or incomplete. The system behaves as designed, but the design does not match what users actually need. The "bug" is really a product gap. (Observable: the code is doing exactly what it was written to do — the spec is the problem.)
Every fix is a workaround. You can patch the symptom, but cannot articulate a clean fix because the surrounding code was built on an assumption that no longer holds. (Observable: you keep wanting to add special cases or flags rather than a direct correction.)
Do not suggest brainstorm for bugs that are large but have a clear fix — size alone does not make something a design problem.
Smart escalation
If 2-3 hypotheses are exhausted without confirmation, diagnose why:
Pattern
Diagnosis
Next move
Hypotheses point to different subsystems
Architecture/design problem, not a localized bug
Present findings, suggest the ce-brainstorm skill
Evidence contradicts itself
Wrong mental model of the code
Step back, re-read the code path without assumptions
Works locally, fails in CI/prod
Environment problem
Focus on env differences, config, dependencies, timing
Fix works but prediction was wrong
Symptom fix, not root cause
The real cause is still active — keep investigating
Parallel investigation option: When hypotheses are evidence-bottlenecked across clearly independent subsystems, dispatch read-only sub-agents in parallel, each with an explicit hypothesis and structured evidence-return format. No code edits by sub-agents, and skip this when hypotheses depend on each other's outcomes. If the platform does not support parallel sub-agent dispatch, run the same hypothesis probes sequentially in ranked-likelihood order instead — the parallelism is a latency optimization, not a correctness requirement.
Present the diagnosis to the user before proceeding.
Phase 3: Fix
Reminder: one change at a time. If you are changing multiple things, stop.
If the user chose "Diagnosis only" at the end of Phase 2, skip this phase and go straight to Phase 4 for the summary — the skill's job was the diagnosis. If they chose "Rethink the design", control has transferred to the ce-brainstorm skill and this skill ends.
Workspace and branch check: Before editing files:
Check for uncommitted changes (git status). If the user has unstaged work in files that need modification, confirm before editing — do not overwrite in-progress changes.
If the current branch is the default branch, ask whether to create a feature branch first using the platform's blocking question tool (see Phase 2 for the per-platform names). To detect the default branch, compare against main, master, or the value of git rev-parse --abbrev-ref origin/HEAD with its origin/ prefix stripped (the raw output is origin/<name>, so an unstripped comparison will never match the local branch name). Default to creating one; derive a name from the bug and run git checkout -b <name>. On any other branch, proceed.
Test-first:
Write a failing test that captures the bug (or use the existing failing test)
Verify it fails for the right reason — the root cause, not unrelated setup
Implement the minimal fix — address the root cause and nothing else
Verify the test passes
Run the broader test suite for regressions
3 failed fix attempts = smart escalation. Diagnose using the same table from Phase 2. If fixes keep failing, the root cause identification was likely wrong. Return to Phase 2.
Conditional defense-in-depth (trigger: grep for the root-cause pattern found it in 3+ other files, OR the bug would have been catastrophic if it reached production): Read references/defense-in-depth.md for the four-layer model (entry validation, invariant check, environment guard, diagnostic breadcrumb) and choose which layers apply. Skip when the root cause is a one-off error with no realistic recurrence path.
Conditional post-mortem (trigger: the bug was in production, OR the pattern appears in 3+ locations):
Analyze how this was introduced and what allowed it to survive. Note any systemic gap or repeated pattern found — it informs Phase 4's decision on whether to offer learning capture.
Phase 4: Handoff
Structured summary — always write this first:
code
## Debug Summary
**Problem**: [What was broken]
**Root Cause**: [Full causal chain, with file:line references]
**Recommended Tests**: [Tests to add/modify to prevent recurrence, with specific file and assertion guidance]
**Fix**: [What was changed — or "diagnosis only" if Phase 3 was skipped]
**Prevention**: [Test coverage added; defense-in-depth if applicable]
**Confidence**: [High/Medium/Low]
If Phase 3 was skipped (user chose "Diagnosis only" in Phase 2), stop after the summary — the user already told you they were taking it from here. Do not prompt.
If Phase 3 ran, the next move depends on whether the skill created the branch in Phase 3.
Skill-owned branch (created in Phase 3): default to commit-and-PR without prompting
Check for contextual overrides first. Look at the user's original prompt, loaded memories, and the user/repo AGENTS.md or CLAUDE.md for preferences that conflict with auto commit-and-PR — for example, "always review before pushing", "open PRs as drafts", or "don't open PRs from skills". A signal must be an explicit instruction or a clearly applicable rule, not a vague tonal cue. If any apply, honor them — switch to the pre-existing-branch menu below, or skip the PR step entirely, whichever matches the user's stated preference.
Briefly preview what will happen — what will be committed, on what branch, and that a PR will be opened — then proceed without waiting for confirmation. The preview exists so the user can interrupt; it is not a blocking question. Format and length are your call; keep it scannable.
Run the ce-commit-push-pr skill. When the entry came from an issue tracker, include the appropriate auto-close syntax for that tracker in the location it requires — most trackers parse PR descriptions (e.g., Fixes #N for GitHub, Closes ABC-123 for Linear), but some only parse commit messages (e.g., Jira Smart Commits) — so the diagnosis and fix flow back to the issue and it closes on merge. Surface the resulting PR URL.
Pre-existing branch (skill did not create it): ask the user
Use the platform's blocking question tool (AskUserQuestion in Claude Code, request_user_input in Codex, ask_user in Gemini, ask_user in Pi (requires the pi-ask-user extension)). In Claude Code, call ToolSearch with select:AskUserQuestion first if its schema isn't loaded — a pending schema load is not a reason to fall back. Fall back to numbered options in chat only when no blocking tool exists in the harness or the call errors. Never end the phase without collecting a response.
Options:
Commit and open a PR (the ce-commit-push-pr skill) — default for most cases
Commit the fix (the ce-commit skill) — local commit only
Stop here — user takes it from there
After a PR is open (either path): consider offering learning capture
Most bugs are localized mechanical fixes (typo, missed null check, missing import) where the only "lesson" is the bug itself. Compounding those clutters docs/solutions/ without adding value. Decide which path applies:
Skip silently when the fix is mechanical and there's no generalizable insight. Default to this when in doubt.
Offer neutrally when the lesson can be stated in one sentence — e.g., "X.foo() returns T | undefined when Y, not just T", or "the diagnostic path was non-obvious and worth recording." If you cannot articulate the lesson, skip rather than offer.
Lean into the offer when the pattern appears in 3+ locations OR the root cause reveals a wrong assumption about a shared dependency, framework, or convention that other code is likely to repeat.
When offering, use the blocking question tool described above. If the user accepts, run the ce-compound skill, then commit the resulting learning doc to the same branch and push so the open PR picks up the new commit.
request_user_input
ask_user
ask_user
pi-ask-user
ToolSearch
select:AskUserQuestion
Options:
Commit and open a PR (the ce-commit-push-pr skill) — default for most cases
Commit the fix (the ce-commit skill) — local commit only
Stop here — user takes it from there
After a PR is open (either path): consider offering learning capture
Most bugs are localized mechanical fixes (typo, missed null check, missing import) where the only "lesson" is the bug itself. Compounding those clutters docs/solutions/ without adding value. Decide which path applies:
Skip silently when the fix is mechanical and there's no generalizable insight. Default to this when in doubt.
Offer neutrally when the lesson can be stated in one sentence — e.g., "X.foo() returns T | undefined when Y, not just T", or "the diagnostic path was non-obvious and worth recording." If you cannot articulate the lesson, skip rather than offer.
Lean into the offer when the pattern appears in 3+ locations OR the root cause reveals a wrong assumption about a shared dependency, framework, or convention that other code is likely to repeat.
When offering, use the blocking question tool described above. If the user accepts, run the ce-compound skill, then commit the resulting learning doc to the same branch and push so the open PR picks up the new commit.
ToolSearch
select:AskUserQuestion
Options to offer:
Fix it now — proceed to Phase 3
Diagnosis only — I'll take it from here — skip the fix, proceed to Phase 4's summary, and end the skill
Rethink the design (the ce-brainstorm skill) — only when the root cause reveals a design problem (see below)
Do not assume the user wants action right now. The test recommendations are part of the diagnosis regardless of which path is chosen.
When to suggest brainstorm: Only when investigation reveals the bug cannot be properly fixed within the current design — the design itself needs to change. Concrete signals observable during debugging:
The root cause is a wrong responsibility or interface, not wrong logic. The module should not be doing this at all, or the boundary between components is in the wrong place. (Observable: the fix requires moving responsibility between modules, not correcting code within one.)
The requirements are wrong or incomplete. The system behaves as designed, but the design does not match what users actually need. The "bug" is really a product gap. (Observable: the code is doing exactly what it was written to do — the spec is the problem.)
Every fix is a workaround. You can patch the symptom, but cannot articulate a clean fix because the surrounding code was built on an assumption that no longer holds. (Observable: you keep wanting to add special cases or flags rather than a direct correction.)
Do not suggest brainstorm for bugs that are large but have a clear fix — size alone does not make something a design problem.
Smart escalation
If 2-3 hypotheses are exhausted without confirmation, diagnose why:
Pattern
Diagnosis
Next move
Hypotheses point to different subsystems
Architecture/design problem, not a localized bug
Present findings, suggest the ce-brainstorm skill
Evidence contradicts itself
Wrong mental model of the code
Step back, re-read the code path without assumptions
Works locally, fails in CI/prod
Environment problem
Focus on env differences, config, dependencies, timing
Fix works but prediction was wrong
Symptom fix, not root cause
The real cause is still active — keep investigating
Parallel investigation option: When hypotheses are evidence-bottlenecked across clearly independent subsystems, dispatch read-only sub-agents in parallel, each with an explicit hypothesis and structured evidence-return format. No code edits by sub-agents, and skip this when hypotheses depend on each other's outcomes. If the platform does not support parallel sub-agent dispatch, run the same hypothesis probes sequentially in ranked-likelihood order instead — the parallelism is a latency optimization, not a correctness requirement.
Present the diagnosis to the user before proceeding.
Test Idea
search_filters_by_language_and_path
rust\n#[test]\nfn search_filter_path_with_dot_prefix_does_not_warn_when_it_matches() {\n let dir = fixture();\n let output = sifs()\n .args([\n \"search\",\n \"token\",\n \"--source\",\n dir.path().to_str().unwrap(),\n \"--mode\",\n \"bm25\",\n \"--filter-path\",\n \"./src/lib.rs\",\n \"--json\",\n ])\n .output()\n .unwrap();\n\n assert!(\n output.status.success(),\n \"stderr: {}\",\n String::from_utf8_lossy(&output.stderr)\n );\n\n let value: Value = serde_json::from_slice(&output.stdout).unwrap();\n let results = value[\"results\"].as_array().unwrap();\n assert!(!results.is_empty());\n assert!(results.iter().all(|result| result[\"file_path\"] == \"src/lib.rs\"));\n assert!(value[\"warnings\"].as_array().unwrap().is_empty());\n}\n
indexed_files
normalize_filter_path
src/index.rs
Confidence
src/index.rs
src/main.rs
target/debug/sifs
/.codex
/.entire
The automation memory is updated at /Users/tristan/.codex/automations/sifs-bug-finder/memory.md. The explorer also found a good next candidate: normalized --filter-path ./src/lib.rs can return matching results while still emitting a false-positive warning.
::inbox-item{title="Daemon explain flag fixed" summary="Committed and pushed; next candidate is path-filter warnings"}