{"slug": "show-hn-agent-debugger-local-first-failure-debugger-for-ai-agents", "title": "Show HN: Agent Debugger – local-first failure debugger for AI agents", "summary": "A developer released Agent Debugger, a local-first open-source tool that turns a failed AI agent trace into a \"Cause Package\" of observed evidence, rule-based cause candidates each paired with a falsifier, reproduction steps, and a handoff pointer to the developer's existing debugger. The tool, installable via git clone and npm run dev, imports NDJSON/JSON traces into a versioned event schema (schemaVersion: 2), runs entirely on the user's machine with no account, cloud, or external AI service, and applies redaction on ingest, stream, export, and bundle creation. Its author positions it as a narrow complement to observability platforms such as Langfuse, Phoenix, and LangSmith rather than a replacement, explicitly excluding evals, datasets, scores, live pause/inject, and cloud sync.", "body_md": "*Failed agent trace → evidence → reproduction → debugger handoff.*\n\nAgent Debugger is a local-first developer tool for investigating **failed** agent runs. It does not try to replace observability platforms such as Langfuse, Phoenix, or LangSmith. Instead, it takes a trace you already have and builds a **Cause Package**:\n\n- **Observed evidence** — directly visible facts with event IDs\n- **Cause candidates** — rule-based hypotheses, each with a falsifier\n- **Reproduction steps** — what to replay and what to compare\n- **Next debugger action** — where to stop and what to inspect in your existing debugger\n\nEverything runs on your machine. No account, no cloud, no external AI service.\n\n| This build | Not included | \n|---|---|\n| Versioned event schema ( `schemaVersion: 2` ) | Live pause / inject | \n| NDJSON / JSON trace import | Evals, datasets, scores | \n| File-backed local event store | Cloud sync or accounts | \n| Deterministic, rule-only Cause Package | External AI explanations | \n| Portable redacted Cause Package bundles | Custom DAP/debugger implementation | \n| Case comparison across two local traces | Cloud case storage | \n| Browser-based local desktop shell | Native Electron/Tauri binary | \n\nCause candidates are **hypotheses derived from rules**, not verified root causes. The UI keeps observed facts, rule flags, hypotheses, reproduction steps, and handoff suggestions in separate sections.\n\nMost agent observability tools answer *what happened*. Agent Debugger answers the narrower question a developer has when a run fails: **what should I inspect next, and how can I prove that hypothesis wrong?**\n\n- Evidence is separated from interpretation. A rule flag never becomes a root cause on its own.\n- Every cause candidate carries a falsifier, so a hypothesis can be challenged instead of trusted.\n- The handoff step points at your existing debugger and source location. This project does not invent another debug protocol.\n- Privacy is structural: redaction runs on ingest, stream, export, and bundle creation, and usage data is allowlist-sanitized before it reaches disk.\n- The scope is intentionally narrow: one failed run, compared against another when useful, then handed off.\n\nIf you need dashboards, evaluation suites, or team-wide trace retention, use an observability platform. Agent Debugger is the local step you take before or after that platform.\n\n```\ngit clone https://github.com/woxlo1/agent-debugger.git\ncd agent-debugger\nnpm install\nnpm run dev\n```\n\nThis starts:\n\n- the local API on `http://127.0.0.1:4317`\n- the Web UI on `http://localhost:5173`\n\nOpen `http://localhost:5173`. The **Cause Package** view is selected by default.\n\nFor a one-command app-style launch, use the browser-based desktop shell instead:\n\n```\nnpm run desktop\n```\n\nIt starts the local API and serves the built UI from one loopback origin, then opens your default browser. See `docs/DESKTOP_SHELL.md`.\n\nIn a second terminal while `npm run dev` is running:\n\n```\nnpm run demo\n```\n\nThe demo emits a fake failed checkout trace. Select it in the trace list and inspect its Cause Package, or switch to the **Replay** tab for the original timeline view.\n\nA checked-in version of the same failure is available at `docs/examples/failed-trace.ndjson` for repeatable procedure checks. It is synthetic and contains no real customer data.\n\n``` python\n# NDJSON / JSON Lines\nagent-debugger import failed-run.jsonl\n\n# From stdin\ncat failed-run.jsonl | agent-debugger import\n\n# Print the Cause Package as JSON\nagent-debugger analyze <traceId>\n\n# Print the AI usage ledger and privacy audit\nagent-debugger usage <traceId>\nagent-debugger privacy <traceId>\n\n# Export a redacted portable Cause Package\nagent-debugger package <traceId> failed-run.cause.json\n\n# Compare two local traces\nagent-debugger compare <traceIdA> <traceIdB>\n```\n\nYou can also paste NDJSON into the **Cause Package** view and click **Import & select**.\n\nImported records are normalized into the v2 schema. Timestamps, status fields, error payloads, source locations, and token/cost fields are preserved when present. Secret-like keys, API-key patterns, bearer tokens, and email addresses are redacted on ingest and again on export.\n\nAI usage is normalized from caller-supplied provider responses or explicit events. Values are labelled `reported`, `estimated`, or `unknown`; local estimates are excluded from billing totals unless you opt in with `--include-estimates` or the **Include estimates** checkbox.\n\n```\n# Normalize an OpenAI-style response already held by your agent\ncurl -X POST http://127.0.0.1:4317/api/usage \\\n  -H 'content-type: application/json' \\\n  -d '{\"source\":\"openai_api\",\"traceId\":\"run-1\",\"payload\":{\"id\":\"chatcmpl-1\",\"model\":\"gpt-5.6\",\"usage\":{\"prompt_tokens\":100,\"completion_tokens\":20}}}'\n```\n\nClaude Code and claude.ai Web sources require explicit consent before their values are included in totals. Redaction receipts store detector counts only, never raw values. See `docs/AI_SOURCE_MATRIX.md` for the full source policy.\n\nThe **Compare** tab diffs two traces by metrics, observed evidence, cause hypotheses, unknowns, usage totals, confidence labels, and redaction findings. It is deterministic and local-only.\n\nA **Cause Package** bundle is a single JSON file containing redacted events, rule-based analysis, the usage ledger, the privacy audit, provenance, and a SHA-256 fingerprint. Use it to hand a run to a debugger or teammate without sending raw prompts or transcripts.\n\n```\ncurl http://127.0.0.1:4317/api/traces/<traceId>/package > failed-run.cause.json\ncurl 'http://127.0.0.1:4317/api/cases/compare?a=<traceIdA>&b=<traceIdB>'\n```\n\nSee `docs/CASE_COMPARE.md` for the bundle contract and comparison rules.\n\nA local MCP server exposes the debugger over stdio JSON-RPC:\n\n```\nnpm run mcp\n```\n\nIt offers tools for listing traces, analyzing a trace, exporting a Cause Package, comparing traces, reading usage and privacy audits, importing events, and recording caller-supplied provider usage. It opens no port and calls no external service. See `docs/MCP_CLAUDE_LOCAL.md` for the client configuration and tool contract.\n\nClaude Code local transcript reading is **off by default**. It requires the process switch `AGENT_DEBUGGER_CLAUDE_LOCAL=enabled`, explicit per-request consent, an absolute path allowlist, and strict redaction before normalization. The adapter returns count-only usage and never returns transcript text or file paths. claude.ai Web remains manual-export only.\n\nThe SDK is published on npm as `agent-debugger-sdk`. Install it with `npm install agent-debugger-sdk`, or use the workspace source while developing this repository. You can also send JSON Lines from any language with the `pipe` command.\n\n``` js\nimport { setTraceId, trace } from \"agent-debugger-sdk\"\n\nsetTraceId(\"checkout-agent-run-42\")\n\nawait trace({\n  type: \"tool\",\n  name: \"charge_card\",\n  input: { amount: 4200, currency: \"JPY\" },\n  output: { success: false, error: \"declined\" },\n  status: \"error\",\n  source: { path: \"src/tools/payments.ts\", line: 88 },\n})\n```\n\n`trace()` never throws; it returns `{ ok, event, error }`. Use `traceOrThrow()` when delivery failure must stop the run.\n\n``` js\nimport { traceOrThrow } from \"agent-debugger-sdk\"\n\nawait traceOrThrow({ type: \"agent\", name: \"final_answer\", output: \"...\" })\n# stdin\npython3 your_agent.py | agent-debugger pipe\n\n# file\nagent-debugger pipe trace.jsonl\n\n# explicit trace id\nAGENT_DEBUGGER_TRACE_ID=run-42 agent-debugger pipe trace.jsonl\n```\n\nMinimum event:\n\n```\n{\"type\":\"tool\",\"name\":\"search\",\"input\":\"cats\",\"output\":\"...\"}\n```\n\nOptional v2 fields:\n\n```\n{\n  \"type\": \"tool\",\n  \"name\": \"search\",\n  \"traceId\": \"run-42\",\n  \"parentId\": \"step-7\",\n  \"status\": \"error\",\n  \"error\": { \"message\": \"timeout\" },\n  \"source\": { \"path\": \"src/search.ts\", \"line\": 31 },\n  \"durationMs\": 5200,\n  \"attributes\": { \"retry_count\": 3 }\n}\n```\n\nInvalid lines are reported by line number only; raw line content is never logged.\n\n```\ntype AgentEvent = {\n  schemaVersion: number\n  id: string\n  traceId: string\n  parentId?: string\n  type: \"user\" | \"agent\" | \"tool\" | \"reasoning\" | \"system\"\n  name: string\n  status?: \"ok\" | \"error\" | \"unknown\"\n  error?: { kind?: string; message?: string }\n  input?: unknown\n  output?: unknown\n  timestamp: number\n  durationMs?: number\n  tokens?: number\n  cost?: number\n  source?: { path?: string; line?: number; symbol?: string }\n  attributes?: Record<string, unknown>\n}\n```\n\n| Method | Path | Description | \n|---|---|---|\n| GET | `/api/health` | Health, schema version, store path | \n| POST | `/api/events` | Submit one v2 event | \n| POST | `/api/import` | Import `{ content, format?, traceId? }` or`{ events }` | \n| GET | `/api/traces` | List trace summaries | \n| GET | `/api/events?traceId=...` | List events | \n| GET | `/api/traces/:traceId/analysis` | Build the rule-based Cause Package | \n| GET | `/api/traces/:traceId/package` | Export a redacted portable Cause Package | \n| GET | `/api/cases/compare?a=...&b=...` | Compare two local traces | \n| POST | `/api/usage` | Normalize and store AI usage entries | \n| GET | `/api/traces/:traceId/usage` | Build the consent-aware usage ledger | \n| GET | `/api/traces/:traceId/privacy` | Aggregate redaction receipts and consent states | \n| GET | `/api/traces/:traceId/export` | Download redacted NDJSON | \n| POST | `/api/reset` | Clear the local store | \n| GET | `/api/stream` | SSE stream of new events | \n\n- The server binds to `127.0.0.1` by default.\n- CORS allows only `http://localhost:5173` and`http://127.0.0.1:5173` by default.\n- Set `AGENT_DEBUGGER_ALLOWED_ORIGINS` to override the browser-origin allowlist.\n- Set `AGENT_DEBUGGER_TOKEN` to require`x-agent-debugger-token` on all mutating APIs.\n- Events are stored in `.agent-debugger/events.ndjson` by default; override with`AGENT_DEBUGGER_STORE` .\n- Redaction is applied on import, event submission, SSE output, NDJSON export, and portable Cause Package export.\n- Portable bundles carry counts and placeholders only; they never include a store path or raw usage payload.\n\nFor the threat model, findings, residual risks, and CI evidence, see `docs/SECURITY_REVIEW.md`. It is a pre-release review, not an audit or production-hardening claim.\n\nThe analyzer emits evidence for:\n\n- explicit `status: \"error\"` or`error` payloads\n- tool results containing `isError` ,`success: false` , or an`error` field\n- identical tool calls repeated three or more times\n- tool calls without a captured output\n- the last known good event before the first failure\n- tool durations exceeding three times the median\n- runs ending on a reasoning step without a final answer\n\nEach candidate includes a falsifier so it can be challenged rather than trusted.\n\n```\nYour agent\n   │  trace() / JSON Lines\n   ▼\nagent-debugger server\n   ├─ importer.ts      normalize + redact\n   ├─ store.ts         local NDJSON persistence\n   └─ analyzer.ts      rule-based Cause Package\n   ▼\npackages/artifact      portable redacted bundle + fingerprint\npackages/cases         deterministic case comparison\npackages/mcp           stdio JSON-RPC tools + Claude local adapter\n   ▼\nscripts/desktop.mjs    loopback shell + /api proxy\n   ▼\nagent-debugger web\n   ├─ Cause Package view\n   ├─ Compare view\n   ├─ Usage / Privacy views\n   └─ Replay view\npackages/\n  shared/          Frozen usage, consent, and privacy contracts\n  privacy/         Count-only redaction engine\n  ingest/          AI source normalizers\n  usage/           Consent-aware usage ledger\n  artifact/        Portable Cause Package builder and verifier\n  cases/           Case comparison logic\n  mcp/             Local stdio MCP server and Claude local adapter\n  server/          Fastify API, importer, analyzer, local store, CLI\n  sdk/             TypeScript event client\n  web/             React + Vite + Tailwind UI\n  example-agent/   Demo trace emitter\nscripts/\n  desktop.mjs      Browser-based local desktop launcher\n  build-docs.mjs   Static docs site generator\n```\n\nA repeatable, dependency-free benchmark harness measures the local path against a deterministic synthetic 10,000-event trace:\n\n```\nnpm run verify\nnpm run bench\n```\n\nPublished results are in `docs/PERFORMANCE.md`; raw measurements are in `docs/benchmark-results.json`. The latest run met the import, analysis, package export, memory, and web bundle targets. Cold start to `/api/health` did **not** meet the 500 ms target because the first TypeScript transform through `tsx` dominates startup; the miss is recorded rather than hidden.\n\nTargets assume a commodity laptop and no network access. Results are local measurements, not user-study evidence.\n\n`v1.0.2` is a patch release containing the fixes listed in `CHANGELOG.md`. Tags `v1.0.0` and `v1.0.1` and their GitHub Releases remain at their original commits. The MIT license and all package names are unchanged.\n\n-  Generated docs site from `docs/`\n- Local MCP server exposing analysis and package tools\n- Browser-based desktop shell around the local UI\n- Benchmark harness and published results against the targets above\n- Final security review documented with findings and residual risks\n-  Final project structure frozen in `docs/PROJECT_STRUCTURE.md`\n-  Explicit release approval and version bump to `1.0.2`\n-  Publish-ready package build verified with `npm pack` and a clean-directory smoke test\n-  Real-user validation with consented traces and third-party ground truth (materials ready in `docs/VALIDATION_KIT.md` ; study not executed)\n\nThe `v1.0.2` tag and GitHub Release are published. Both `agent-debugger-server@1.0.2` and `agent-debugger-sdk@1.0.2` are published on npm (`latest = 1.0.2`); the SDK went live after the owner approved npm staged publishing with 2FA. CI never performs a version bump, tag, release, publish, or Hacker News post. The final Hacker News text is in `docs/HN_LAUNCH_DRAFT.md` and now references `v1.0.2`. Posting requires an authenticated HN session.\n\nThe SVGs in `docs/assets/` are the source of truth for the brand marks. See `docs/assets/README.md` for their intended uses.\n\n```\nnpm run verify\n```\n\nThis runs the JavaScript syntax checks, TypeScript checks, tests, the web build, and the static docs site build. No dependency install is performed by this repository's scripts.\n\nA browsable docs site is generated into `docs-site/` with `npm run build:docs`. Host that directory as static files or open `docs-site/index.html` locally.\n\nSee `docs/PRODUCT_BRIEF.md`, `docs/ARCHITECTURE.md`, `docs/PROJECT_STRUCTURE.md`, `docs/VALIDATION_PLAN.md`, `docs/VALIDATION_KIT.md`, `docs/SECURITY_REVIEW.md`, `docs/USAGE_PRIVACY.md`, `docs/CASE_COMPARE.md`, `docs/MCP_CLAUDE_LOCAL.md`, `docs/DESKTOP_SHELL.md`, and `docs/PERFORMANCE.md` for scope, design, final structure, validation status, security review, and current contracts. Brand assets are documented in `docs/assets/README.md`.\n\nMIT", "url": "https://wpnews.pro/news/show-hn-agent-debugger-local-first-failure-debugger-for-ai-agents", "canonical_source": "https://github.com/woxlo1/agent-debugger", "published_at": "2026-11-25 10:00:11+00:00", "updated_at": "2026-11-25 10:14:36.340163+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "ai-tools", "mlops"], "entities": ["Agent Debugger", "Langfuse", "Phoenix", "LangSmith", "woxlo1"], "also_reported_by": [], "takeaway": "Agent Debugger imports NDJSON/JSON traces into a schemaVersion 2 event store and emits a deterministic, rule-only Cause Package in which every cause candidate carries a falsifier, keeping observed evidence separate from hypotheses.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/show-hn-agent-debugger-local-first-failure-debugger-for-ai-agents", "markdown": "https://wpnews.pro/news/show-hn-agent-debugger-local-first-failure-debugger-for-ai-agents.md", "text": "https://wpnews.pro/news/show-hn-agent-debugger-local-first-failure-debugger-for-ai-agents.txt", "jsonld": "https://wpnews.pro/news/show-hn-agent-debugger-local-first-failure-debugger-for-ai-agents.jsonld"}}