debug

A structured debugging workflow that investigates the root cause before changing code. TDD, or test-driven development, means using a test to describe the expected fix and protect it from breaking again.

In plain words
What is it for?
Use it for hard bugs, failing tests, and failures that may originate in another repository, with an optional link to a Jira ticket.
Why use it?
It prevents guessing at fixes for difficult or unexpected failures. The diagnosis and regression test are saved in session state so the work can be resumed.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/higoralves/orc/debug
Clone the repo
git clone --depth 1 https://github.com/HigorAlves/orc
Per session 53 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,168 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00053 $0.02168
Opus 5 $0.00026 $0.01084
Sonnet 5 $0.00011 $0.00434
Haiku 4.5 $0.00005 $0.00217

Measured 2d ago against content hash dfef57d8dfee, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

debug scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

orc/commands/debug.md · 139 lines

How it starts

The opening of the file, as written. The whole thing — 139 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/orc:debug

Hard bugs and unexpected failures get the systematic-debugging discipline. NO FIXES WITHOUT A ROOT CAUSE.

Arguments

  • --jira <KEY> — link a Jira ticket key (e.g. BUG-42) to this session silently. Suppresses the Phase 1 link prompt.
  • The bug description / failing test name is the rest of the argument string.

Workflow

Phase 0 — Detect context

!orc-workspace-detect --banner

Context is injected above (ORC_* vars are exported for any Bash you run — do not re-run detection).

In workspace mode, resolve targetRepos from flags or via AskUserQuestion. The default is the symptom-repo (the repo where the bug surfaces) plus any sibling repos the user suspects might be the actual cause — the investigator reads across all of them. Iron rule: no silent broadcast — confirm.

Phase 1 — Initialize workspace + link

  1. Determine the current branch: git branch --show-current (in workspace mode, prompt the user since cwd has no branch). Sanitize (/-).
  2. Create ${ORC_STATE_DIR}/<sanitized-branch>/files/ if it doesn't exist. In workspace mode, also create per-repo <workspaceRoot>/<repo>/.orc/<sanitized-branch>/ with workspace-link.json back-pointers for each target repo (the diagnosis is workspace-level; remediation slices land per repo).
  3. Resolve the Jira link.
    • If --jira <KEY> was passed: validate against ^[A-Z][A-Z0-9_]*-\d+$. Reject and stop on mismatch.
    • Otherwise: ask via AskUserQuestion"Link a Jira ticket to this session?" with options: Paste a key / Skip — I'll bind later via /orc:jira bind / No ticket — this work has no tracker entry.
  4. Register state: orc-state init --command debug --total-phases 7 [--jira <KEY>]. Defer to orc:state-protocol for schema and rules; per phase, orc-state phase set <n> + orc-state digest write -.

Phase 2 — Investigate (no fixes)

Prime code discovery first (optional, non-blocking). Follow orc:code-discovery: if graphify is installed, ensure a fresh graph on the buggy branch before dispatching — build if missing (graphify extract . --code-only) or refresh if stale (graphify update .), so the investigator queries the graph from turn one instead of discovering staleness mid-investigation. Skip silently if graphify is absent or the build fails.

Read the full file on GitHub · 139 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 139 lines · 53 tokens per session scan A dfef57d8dfee

Subscribe to this mod's changes

debug is a command published in the GitHub repository HigorAlves/orc (6 stars, last pushed 5d ago), licensed MIT. It adds 53 tokens to every session and 2,168 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.