debug-task

A debugging guide for autonomous coding tasks that query task state, phase details, costs, tool decisions, messages, and application logs. It uses task IDs to trace what happened.

In plain words
What is it for?
Investigating task runs, checking phase errors and outcomes, tracing tool approvals or denials, reading agent messages, and finding application-log errors.
Why use it?
It brings evidence from several records together when a task fails, stalls, escalates, or behaves unexpectedly. It also explains where the centralized audit log is stored.

Skill for Claude CodeCodex

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 skills/vmehera123/leashd/debug-task
Any agent
npx skills add vmehera123/leashd --skill debug-task
Clone the repo
git clone --depth 1 https://github.com/vmehera123/leashd

Made for: Claude Code, Codex.

Per session 51 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,370 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.00051 $0.05370
Opus 5 $0.00026 $0.02685
Sonnet 5 $0.00010 $0.01074
Haiku 4.5 $0.00005 $0.00537

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

Security

Grade A, and why

debug-task 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.

.claude/skills/debug-task/SKILL.md · 474 lines

How it starts

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

Debugging Autonomous Tasks

Data sources

Surface Location Content
Task runs ~/.leashd/sessions.dbtask_runs table Phase state, outcome, costs, context, pipeline, timestamps (24 columns)
Sessions ~/.leashd/sessions.dbsessions table mode, task_run_id link back to task_runs
Audit log <approved_directories[0]>/.leashd/audit.jsonl (pinned/centralized) Tool-gating decisions (allow/deny/require_approval), all sessions
App logs {working_directory}/.leashd/logs/app.log Structured events: task_phase_changed, task_phase_error, task_terminal, etc.
Messages ~/.leashd/messages.db (centralized) Agent messages during the task's session

audit.jsonl is centralized, not per-working-directory. Since v0.9.0 it is pinned to approved_directories[0] (the first entry in ~/.leashd/config.yaml) — NOT {working_directory}/.leashd/audit.jsonl, which will look stale for any task that ran outside that dir. The audit queries below resolve the pinned path automatically.

$ARGUMENTS is the task_id — full 16-char hex or first 8 chars from /tasks output.

Tasks may have run under v2 (LLM-driven think-act-observe, phases include explore/plan/retry) or v3 (linear plan → implement → verify → review). Check phase_pipeline in Step 1 to tell which.

Quick diagnosis (run all 5 steps)

Step 1: Load task state

Query task_runs by run_id. Try exact match first, then prefix match.

uv run python -c "
import sqlite3, pathlib, sys, json
db = pathlib.Path.home() / '.leashd' / 'sessions.db'
if not db.exists():
    print('ERROR: sessions.db not found at', db)
    sys.exit(1)
conn = sqlite3.connect(str(db))
conn.row_factory = sqlite3.Row
tid = '$ARGUMENTS'.strip()
if not tid:
    print('No task_id provided. Listing recent tasks...')
    for r in conn.execute('SELECT run_id, phase, outcome, task, created_at, total_cost FROM task_runs ORDER BY created_at DESC LIMIT 20'):
        d = dict(r)
        d['task'] = d['task'][:80]
        print(d)
    sys.exit(0)
# Exact match
row = conn.execute('SELECT * FROM task_runs WHERE run_id = ?', (tid,)).fetchone()
if not row:
    # Prefix match
    row = conn.execute('SELECT * FROM task_runs WHERE run_id LIKE ?', (tid + '%',)).fetchone()
if not row:
    print(f'No task found matching: {tid}')
    sys.exit(1)
d = dict(row)
# Pretty-print key fields
for k in ['run_id','phase','previous_phase','outcome','error_message','retry_count','max_retries',
          'created_at','started_at','phase_started_at','completed_at','last_updated',
          'total_cost','working_directory','session_id','user_id','chat_id','task']:
    print(f'{k:>20}: {d.get(k)}')
print(f\"{'phase_pipeline':>20}: {json.loads(d.get('phase_pipeline','[]'))}\")
print(f\"{'phase_costs':>20}: {json.loads(d.get('phase_costs','{}'))}\")
"

Read the full file on GitHub · 474 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 · 474 lines · 51 tokens per session scan A ef8ddbc56ad1

Subscribe to this mod's changes

debug-task is a skill published in the GitHub repository vmehera123/leashd (5 stars, last pushed 7d ago), licensed Apache-2.0. It adds 51 tokens to every session and 5,370 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.

Related

Other skills, from other repositories

orloj-generator

Interactive scaffold generator for Orloj multi-agent systems. Use this skill whenever someone wants to create, set up, scaffold, bootstrap, or generate an Orloj agent system, pipeline, swarm, or hierarchy. Also trigger when users mention "orlojctl init", ask how to get started with Orloj, want to build a multi-agent…

OrlojHQ/orloj · 168 tokens

air-blackbox-sales-agent

AIR Blackbox's autonomous sales prospecting agent. Finds Python AI projects on GitHub that need EU AI Act compliance, identifies the right person to contact (CEO, CTO, lead maintainer), runs a free compliance scan, and drafts personalized outreach emails that convert to engagement. The sales flow: free scan as the…

airblackbox/airblackbox · 248 tokens

interpret-results

Interprets AIR Blackbox scan results and maps findings to specific EU AI Act articles, recitals, and remediation steps. Use when the user has scan output and wants to understand what to fix, why it matters, or how to prioritize.

airblackbox/airblackbox · 49 tokens

compliance-scan

Scans a Python AI project for EU AI Act compliance gaps using AIR Blackbox. Use when the user asks to check compliance, scan their code, audit their AI project, or mentions EU AI Act, Articles 9-15, or compliance checking.

airblackbox/airblackbox · 51 tokens

writing-plan-docs

Write planning documents for new permit0 features, integrations, or significant changes. Use when the user asks to plan, design, spec, or write a plan for a new integration, pack, feature, or architectural change in the permit0 repository.

permit0-ai/permit0 · 54 tokens

reviewing-plan-docs

Review planning documents by reading the plan docs and doing a thorough codebase walkthrough, then writing detailed review docs. Use when the user asks to review, audit, critique, or validate a plan, design doc, or spec in the permit0 repository.

permit0-ai/permit0 · 56 tokens