Skip to content
Agentmart
Submit a tool

kha-debug

Systematic debugging with persistent state across context resets.

Skill by trevi00

IndexedMIT★ 1
Write a review

Chalk Labs

Need help deploying kha-debug?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/trevi00-kha-debug

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Systematic debugging with persistent state across context resets. Default to diagnose-only investigation; use --fix --hypothesis-id <id> for a single atomic fix attempt or --interactive to review hypotheses one at a time.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/kha-debug

What's inside

Skill name
kha-debug
Description
Systematic debugging with persistent state across context resets. Default to diagnose-only investigation; use --fix --hypothesis-id <id> for a single atomic fix attempt or --interactive to review hypotheses one at a time.
License
MIT
Instructions
279 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • allowed-tools: must be a space-separated string

Files (1)

  • SKILL.md

SKILL.md (first lines)

<objective>
Debug issues using scientific method with subagent isolation.

**Orchestrator role:** Gather symptoms, spawn kha-debugger agent, handle checkpoints, and keep each diagnosis or fix attempt isolated.

**Why subagent:** Investigation burns context fast (reading files, forming hypotheses, testing). Fresh 200k context per investigation. Main context stays lean for user interaction.
</objective>

## Modes

### Default: diagnose-only (no mutation)
- Reads logs, traces, recent commits, runs read-only tools.
- Output: `.planning/debug/<session>/HYPOTHESIS.md` with prioritized
  hypotheses and the evidence for each.
- Side effects: NONE on user code. NONE on .planning state beyond the
  HYPOTHESIS.md write.

### Opt-in: --fix mode
- After diagnose-only run, user reviews HYPOTHESIS.md and explicitly
  invokes with `--fix --hypothesis-id <id>` to attempt the chosen fix.
- Single-hypothesis fix per invocation (no batch).
- Atomic commit per fix attempt; revertable.

### Opt-in: --interactive mode
- Walk through hypotheses one at a time, ask user to accept/reject each.
- Same single-fix-per-acceptance contract as --fix.

## Why default-diagnose-only

- Bug analysis benefits from human review before code changes
- Premature mutation may mask the actual root cause
- Atomic per-fix invocation gives clean git history for each attempt

## Stability

- `--fix` mode follows the standard atomic-commit-per-mutation contract and is rollback-friendly.

<available_agent_types>
Valid GSD subagent types (use exact names - do not fall back to 'general-purpose'):
- kha-debugger - Diagnoses issues and can apply a single hypothesis-scoped fix when explicitly instructed
</available_agent_types>

<context>
User's issue: $ARGUMENTS

Parse flags from $ARGUMENTS:
- Default to `mode=diagnose`.
- If `--fix` is present, require `--hypothesis-id <id>`, set `mode=fix`, and remove both from the issue description.
- If `--interactive` is present, set `mode=interactive` and remove the flag from the issue description.
- Reject `--fix` combined with `--interactive`.
- Reject `--hypothesis-id` unless `--fix` is present.

Check for active sessions:
```bash
ls .planning/debug/*/HYPOTHESIS.md 2>/dev/null | head -5
```
</context>

<process>

## 0. Initialize Context

```bash
INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state load)
if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
```

Extract `commit_docs` from init JSON. Resolve debugger model:
```bash
debugger_model=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" resolve-model kha-debugger --raw)
```

## 1. Check Active Sessions

If active sessions exist AND no issue description AND `mode=diagnose`:
- List sessions with status, top hypotheses, and next action
- User picks number to resume OR describes new issue

If `mode=fix` or `mode=interactive`:
- Resolve the target session from the issue description if supplied; otherwise use the most recent unresolved session and ask the user to confirm if multiple candidates exist
- Require `.planning/debug/{session}/HYPOTHESIS.md`
- Refuse to continue if no hypothesis report exists for the selected session

If issue description is provided OR user describes a new issue:
- Continue to symptom gathering for diagnose mode
- Continue to hypothesis review for fix or interactive mode

## 2. Gather Symptoms (diagnose mode only)

Use AskUserQuestion for each:

1. **Expected behavior** - What should happen?
2. **Actual behavior** - What happens instead?
3. **Error messages** - Any errors? (paste or describe)
4. **Timeline** - When did this start? Ever worked?
5. **Reproduction** - How do you trigger it?

After all gathered, confirm ready to investigate.

## 3. Spawn kha-debugger Agent

### Diagnose-only mode

Fill prompt and spawn:

```markdown
<objective>
Investigate issue: {session}

**Summary:** {trigger}
</objective>

<symptoms>
expected: {expected}
actual: {actual}
errors: {errors}
reproduction: {reproduction}
timeline: {timeline}
</symptoms>

From trevi00/khaness, MIT.

More from trevi00/khaness

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
Jun 21, 2026 (4 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from trevi00

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get kha-debug running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying kha-debug?

CallGet help
Cite this page

kha-debug skill. Agent Mart. https://agentmart.dev/skills/trevi00-kha-debug (last updated 2026-10-24)