agentleFS
BuilderIOBuilderIO/agent-native/.agents/skills/debug-runs/SKILL.md

debug-runs

Skill7.6k starsChanged 5 months agoMITView on GitHub

Find and read the agent chat runs behind a run id, a user's email, or an object id or link (deck, design, dashboard, document, plan, recording, …) in any app, then work out what failed or why the object looks the way it does. Use when someone reports a broken chat, a failed run, or a bad result and gives you any of those instead of a thread.

  • Reads credentials

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Prefer the link over a bare id: it searches one app and also scans that app's audit log even when the object was deleted.

    line 38
  2. Very specific:

    What failed: Start at the failed run's error, then the last tool call before it.

    line 69

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Debug Runs

scripts/debug-runs.ts reads production app databases (read-only, one transaction per query) and turns a run id, email, or object id into the chats and runs that touched it, with the full conversation.

It needs <APP>_DATABASE_URL entries in the repo-root .env or DATABASE_URL in templates/<app>/.env. A worktree without its own .env falls back to the main checkout's. An app whose credentials fail shows up as an error entry; it was not searched, which is not the same as "nothing found".

1. Find the runs

pnpm exec tsx scripts/debug-runs.ts find <input> [--app NAME] [--days 30] [--limit 20]
InputExampleHow it is matched
Run idrun-1700000000000-examplelive agent_runs/traces, else the thread active at the timestamp inside the id
Emailuser@example.comthreads they own, plus their MCP/A2A calls
Object linkhttps://slides.agent-native.com/deck/EXAMPLE_deck1app from the host, id from the path
Bare object idEXAMPLE_design1every app: thread scope, owner lookup, owner's threads, audit inputs

Prefer the link over a bare id: it searches one app and also scans that app's audit log even when the object was deleted. --app does the same for a bare id.

Each results[] entry is one app:

  • owners: the table the object lives in and its owner.
  • threads[]: matchedBy, title, owner, scope, and runs[] with status, error, model, and timing.
  • externalAgentSessions: calls from Claude Code, Codex, ChatGPT, and other MCP/A2A clients, grouped by client with 30-minute gaps. Their conversation lives in that client; only the calls reached us.
  • uiSessions: audited UI edits to the object outside any chat.
  • auditError: the audit scan timed out; rerun with a smaller --days.

2. Read a thread

pnpm exec tsx scripts/debug-runs.ts show <runId | threadId> [--app NAME]

This writes .tmp/debug-runs/<app>-<threadId>.md and a .json beside it. The .md has the run list, live run rows, terminal run events, failed trace spans, versions the thread wrote, audited actions, and the transcript: user messages, assistant text, reasoning, and every tool call with its arguments and result. Long values are capped in the .md; the .json has them whole, plus the raw thread_data, including _debugPrompts, the system prompt of each run.

3. Diagnose

What failed. Start at the failed run's error, then the last tool call before it. result: (none recorded…) means the run died inside that call. Then check the terminal event and failed spans, if they are still retained. A runs[].screen value is what the user was looking at when the run started. For a provider ERROR ID, search Sentry (the sentry-cli skill) by the user's email and the run's time window; run and thread ids sit in event extras, not tags.

Why it looks like this. The "versions written by this thread" section links each saved version to its runId/turnId, in apps that keep versions (Analytics, Content, Design, Plan, Slides). Diff the version before and after the run in that app's versions table. Elsewhere, follow the mutating tool calls on the object in order. uiSessions and externalAgentSessions show edits that came from outside this chat.

Retention

DataKept
chat_threads.thread_data (the full conversation)until the user deletes the chat
agent_runs, agent_run_events24h after success, 7 days after an error
agent_trace_spans, agent_trace_summaries30 days
agent_audit_log365 days

A deleted chat is gone; its audit rows remain. Threads created before May 2026 have no run ids, so runs[] is empty and only the transcript is available.

Rules

  • This is customer data. Keep it in .tmp/. Never paste transcripts, emails, or object contents into GitHub, Slack, Jira, or commits; summarize the cause and cite ids.
  • For ad-hoc SQL beyond the script, stay read-only and never LIKE across chat_threads.thread_data without an owner_email or time filter. Design's table alone is over 1 GB, and an unfiltered scan times out against production.

Download now (ZIP)

Trending

More talk lately.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 5 mentionsJul 2026: 1 mentionAug 2026: 0 mentionsSep 2026: 4 mentionsOct 2026: 51 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the BuilderIO/agent-native repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about BuilderIO/agent-native

The biggest 5 of 61 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 61

Talked about on GitHub and Bluesky (61 times).

On GitHub · 50

45 more on GitHub

On Bluesky · 11

6 more on Bluesky

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.