debuganything 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/.claude-plugin/plugin.json +15 -0
  2. package/DISCLAIMER.md +101 -0
  3. package/GEMINI.md +97 -0
  4. package/LICENSE +21 -0
  5. package/README.md +283 -2
  6. package/assets/README.md +9 -0
  7. package/assets/debuganything-logo.png +0 -0
  8. package/assets/debuganything-mark-512.png +0 -0
  9. package/dist/chunk-32IDKAZK.js +9 -0
  10. package/dist/chunk-32IDKAZK.js.map +1 -0
  11. package/dist/chunk-5BXTDASF.js +135 -0
  12. package/dist/chunk-5BXTDASF.js.map +1 -0
  13. package/dist/chunk-5RAKTYW5.js +292 -0
  14. package/dist/chunk-5RAKTYW5.js.map +1 -0
  15. package/dist/chunk-7MMXFUUN.js +79 -0
  16. package/dist/chunk-7MMXFUUN.js.map +1 -0
  17. package/dist/chunk-D742WJPT.js +436 -0
  18. package/dist/chunk-D742WJPT.js.map +1 -0
  19. package/dist/chunk-EMR42ZJQ.js +102 -0
  20. package/dist/chunk-EMR42ZJQ.js.map +1 -0
  21. package/dist/chunk-MLDOO673.js +1416 -0
  22. package/dist/chunk-MLDOO673.js.map +1 -0
  23. package/dist/chunk-NFL22T3H.js +309 -0
  24. package/dist/chunk-NFL22T3H.js.map +1 -0
  25. package/dist/chunk-STFC7C5C.js +245 -0
  26. package/dist/chunk-STFC7C5C.js.map +1 -0
  27. package/dist/chunk-VGYXHXTY.js +1015 -0
  28. package/dist/chunk-VGYXHXTY.js.map +1 -0
  29. package/dist/chunk-YY6M5RIJ.js +215 -0
  30. package/dist/chunk-YY6M5RIJ.js.map +1 -0
  31. package/dist/cli.js +254 -0
  32. package/dist/cli.js.map +1 -0
  33. package/dist/docker-ORXYMES4.js +23 -0
  34. package/dist/docker-ORXYMES4.js.map +1 -0
  35. package/dist/hook-QYLLBUNK.js +14 -0
  36. package/dist/hook-QYLLBUNK.js.map +1 -0
  37. package/dist/import-CT55AEEE.js +268 -0
  38. package/dist/import-CT55AEEE.js.map +1 -0
  39. package/dist/investigate-2GFD6EWB.js +102 -0
  40. package/dist/investigate-2GFD6EWB.js.map +1 -0
  41. package/dist/lsof-GBLZJBJR.js +22 -0
  42. package/dist/lsof-GBLZJBJR.js.map +1 -0
  43. package/dist/psmem-UB3VCMG3.js +20 -0
  44. package/dist/psmem-UB3VCMG3.js.map +1 -0
  45. package/dist/report_html-2ENM7HLC.js +99 -0
  46. package/dist/report_html-2ENM7HLC.js.map +1 -0
  47. package/dist/server.js +190 -0
  48. package/dist/server.js.map +1 -0
  49. package/dist/setup-NTPRUTMT.js +265 -0
  50. package/dist/setup-NTPRUTMT.js.map +1 -0
  51. package/dist/target-WJE4WFYA.js +36 -0
  52. package/dist/target-WJE4WFYA.js.map +1 -0
  53. package/gemini-extension.json +9 -0
  54. package/hooks/debuganything-hook.mjs +36 -0
  55. package/hooks/hooks.json +10 -0
  56. package/package.json +85 -3
  57. package/server.json +30 -0
  58. package/skills/debug-anything/SKILL.md +102 -0
  59. package/skills/inspect-product/SKILL.md +138 -0
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "debuganything",
3
+ "version": "0.3.0",
4
+ "description": "Debug Anything: let your agent observe any running process (strace, py-spy, perf, lsof, tcpdump, gdb/lldb, heap snapshots) and get evidence-backed findings. Read-only, no sudo, no telemetry.",
5
+ "author": { "name": "Shreyas Sawant", "url": "https://github.com/shreyassaw5394" },
6
+ "homepage": "https://debuganything.dev",
7
+ "repository": "https://github.com/shreyassaw5394/debuganything",
8
+ "license": "MIT",
9
+ "keywords": ["debugging", "observability", "profiling", "strace", "py-spy", "perf", "tcpdump", "memory-leak", "deadlock", "mcp"],
10
+ "mcpServers": {
11
+ "debuganything": { "command": "npx", "args": ["-y", "debuganything@latest", "serve"] }
12
+ },
13
+ "skills": "./skills",
14
+ "hooks": "./hooks/hooks.json"
15
+ }
package/DISCLAIMER.md ADDED
@@ -0,0 +1,101 @@
1
+ # Disclaimer
2
+
3
+ **By downloading, installing, or using DEA ("Debug Anything"), you accept this
4
+ disclaimer in full. If you do not agree with it, do not use Debug Anything.**
5
+
6
+ Debug Anything is a free, open-source diagnostic tool distributed under the
7
+ [MIT License](LICENSE). This page restates and supplements the license's
8
+ warranty and liability terms in plain language. Nothing here grants rights
9
+ beyond the license.
10
+
11
+ ## 1. No warranty
12
+
13
+ Debug Anything is provided **"as is" and "as available"**, without warranty of any kind,
14
+ express or implied, including but not limited to the warranties of
15
+ merchantability, fitness for a particular purpose, accuracy, reliability,
16
+ availability, and non-infringement. No oral or written information or advice
17
+ given by the authors, contributors, or community creates any warranty.
18
+
19
+ ## 2. Limitation of liability
20
+
21
+ To the maximum extent permitted by applicable law, **the authors, maintainers,
22
+ and contributors of Debug Anything shall not be liable for any claim, damages, or other
23
+ liability** — whether in an action of contract, tort, or otherwise — arising
24
+ from, out of, or in connection with Debug Anything or its use, including but not limited
25
+ to: service outages or degraded performance of observed systems; crashes or
26
+ corruption of target processes; loss or exposure of data (including secrets
27
+ captured in artifacts); lost profits, revenue, or business interruption; costs
28
+ of substitute services; or any legal or regulatory consequences of your use.
29
+ This applies even if advised of the possibility of such damage.
30
+
31
+ ## 3. You are solely responsible for your use
32
+
33
+ Debug Anything attaches observation tools (`strace`, `py-spy`, `perf`, `lsof`, `tcpdump`,
34
+ `gdb`, `lldb`, heap snapshots, and others) to running software. **You alone
35
+ decide what to observe, where, and when — and you bear all risk and
36
+ responsibility for those decisions and their consequences.** Exercise the same
37
+ care you would running these tools by hand, and prefer testing on
38
+ non-production systems first.
39
+
40
+ ## 4. Authorized systems only
41
+
42
+ **Only observe systems you own or are explicitly authorized to debug.**
43
+ Attaching a tracer, profiler, debugger, or packet capture to a process you are
44
+ not authorized to inspect may violate computer-misuse, wiretapping, or privacy
45
+ laws in your jurisdiction, and may violate your employer's or provider's
46
+ policies and agreements. You are solely responsible for obtaining
47
+ authorization before running Debug Anything and for complying with all applicable laws,
48
+ regulations, contracts, and policies. Debug Anything is intended for lawful, authorized
49
+ debugging only; the authors do not condone and are not responsible for any
50
+ unauthorized or unlawful use.
51
+
52
+ ## 5. Observation has costs, artifacts are sensitive
53
+
54
+ - `ptrace`-based tools (`strace`, `gdb`, `py-spy` in some modes) pause the
55
+ target for short periods and can slow it down measurably.
56
+ - Packet captures, heap snapshots, and raw logs can contain secrets, personal
57
+ data, and other sensitive information. Debug Anything redacts obvious tokens in the
58
+ excerpts it returns to the agent, but **raw artifacts on disk are not
59
+ redacted**. Treat `~/.debuganything/sessions/` as sensitive; securing, retaining, and
60
+ deleting that data is your responsibility.
61
+
62
+ ## 6. Output is not professional advice
63
+
64
+ Debug Anything's findings are automated diagnostics derived from tool output. They may be
65
+ incomplete, outdated, or wrong. They are **not** professional, engineering,
66
+ security, compliance, or legal advice, and must not be relied on as the sole
67
+ basis for operational decisions. Verify findings independently before acting
68
+ on them.
69
+
70
+ ## 7. Third-party tools
71
+
72
+ Debug Anything orchestrates independent third-party tools (`strace`, `py-spy`, `perf`,
73
+ `tcpdump`, `gdb`, `lldb`, and others). Those tools are developed and licensed
74
+ by their respective owners, are governed by their own licenses and terms, and
75
+ their behavior is outside the authors' control. No affiliation with or
76
+ endorsement by those projects is implied.
77
+
78
+ ## 8. Personal, independent project
79
+
80
+ Debug Anything is developed and maintained by its contributors **in their personal,
81
+ individual capacities** as an open-source project. It is not affiliated with,
82
+ sponsored by, or endorsed by any employer, company, or organization of any
83
+ contributor, and no such entity bears any responsibility for it.
84
+
85
+ ## 9. No obligation of support or continuity
86
+
87
+ Debug Anything may change, break, or be discontinued at any time without notice. Nothing
88
+ creates an obligation to provide maintenance, support, updates, or fixes.
89
+
90
+ ## 10. Safety guards are best-effort
91
+
92
+ Debug Anything is read-only by default and never escalates privileges on its own
93
+ (see [docs/safety.md](docs/safety.md)). These guards are engineering
94
+ safeguards, not guarantees, and do not shift any responsibility described
95
+ above.
96
+
97
+ ---
98
+
99
+ *Summary (not a substitute for the above): free tool, no warranty, no
100
+ liability, observe only what you're authorized to observe, your systems and
101
+ data are your responsibility.*
package/GEMINI.md ADDED
@@ -0,0 +1,97 @@
1
+ # Debug Anything
2
+
3
+ Debug Anything gives you eyes on running software: syscalls, CPU profiles, thread stacks,
4
+ sockets, file descriptors, packets, heap retainers, container state. Every
5
+ tool returns the same `ToolResult` with `findings` that cite `evidence` ids.
6
+ You only get to claim what the evidence supports.
7
+
8
+ ## Use it without being asked
9
+
10
+ You are equipped with Debug Anything. Reach for it on your own when you see any of these;
11
+ do not wait for the user to say "debug this" and do not ask permission for
12
+ read-only observation (only `capture_traffic` needs consent):
13
+
14
+ | Signal | First move |
15
+ |---|---|
16
+ | A command you ran hangs, or a test times out and the process is still alive | `attach` it, `dump_stacks` |
17
+ | `EADDRINUSE` / "port already in use" | `debuganything port <n>` or `inspect_sockets`; report the pid, do not kill it |
18
+ | `ECONNREFUSED`, `ETIMEDOUT`, `socket hang up` | `inspect_sockets`, `trace_syscalls` (network) on the client |
19
+ | `EMFILE` / too many open files | `inspect_files` (growth, deleted-but-open), `inspect_sockets` (CLOSE_WAIT) |
20
+ | exit 137, `OOMKilled`, "JavaScript heap out of memory" | `container_info`, then `snapshot_memory` ×2 + `diff_runs` |
21
+ | Segfault / exit 139 / crash loop | `container_info`; if it restarted, `dump_stacks` + `profile_cpu` to catch the lead-up |
22
+ | The user says slow / p99 / CPU pegged | `profile_cpu`, then `trace_syscalls` (file,network) |
23
+ | The user says hang / stuck / frozen / deadlock | `dump_stacks` twice |
24
+ | The user says leak / memory keeps growing | `snapshot_memory`, load, `snapshot_memory`, `diff_runs` |
25
+ | You started a long-running service to test something | consider `attach --kind command` so its output and fds are captured from the start |
26
+ | You just changed performance-sensitive code | measure before and after with the same tool and `diff_runs`; put the evidence ids in the PR |
27
+
28
+ Keep it proportionate: `readiness` once per session, `attach`, one or two
29
+ tools, `detach`. Only attach to processes that belong to the user's project or
30
+ that they pointed you at. Say what you observed and what you could not
31
+ (`limitations`) in one short paragraph with evidence ids.
32
+
33
+ ## Session protocol
34
+
35
+ 1. **Always call `readiness` first** in a session. Read `tools_available` and
36
+ `tools_unavailable`; do not call tools that are unavailable, tell the user
37
+ what is missing and the install hint instead.
38
+ 2. **Always `attach` before any other tool.** Pass a pid, container name, pod
39
+ (`namespace/name`) or a command (`kind: "command"` spawns it under
40
+ capture). Use the returned `session_id` for everything.
41
+ 3. **Always `detach` at the end.** It stops captures and writes the report.
42
+ 4. Prefer each result's `suggested_next`. Stop when the evidence answers the
43
+ question.
44
+
45
+ ## Investigation orders
46
+
47
+ **Slow** (`dea_slow`): `profile_cpu` → `trace_syscalls` (network,file) →
48
+ `inspect_sockets` → `report`. CPU-bound if a few frames dominate self time;
49
+ otherwise look at blocked syscalls and remote hosts.
50
+
51
+ **Leak** (`dea_leak`): `snapshot_memory` → exercise the target → `snapshot_memory`
52
+ → `diff_runs a=snapshot_memory#1 b=snapshot_memory#2` → `report`. The top
53
+ grower in retained size is the suspect. RSS up without heap up → native memory.
54
+
55
+ **Hang** (`dea_hang`): `dump_stacks` → `inspect_sockets` → `trace_syscalls`
56
+ (5 s) → `report`. Two threads each waiting on the other's lock = deadlock
57
+ (look for `lock_wait` evidence). One thread in a socket read = waiting on a
58
+ remote.
59
+
60
+ **Crash** (`dea_crash`): `container_info` (OOMKilled, exit code, restarts,
61
+ cgroup limits, log tail) → `report`. Exit 137 = SIGKILL (often OOM),
62
+ 139 = SIGSEGV, 143 = SIGTERM.
63
+
64
+ **Port busy** (`dea_port_busy`): CLI `debuganything port <port>` or `attach` candidates
65
+ and `inspect_sockets`; report pid + command line. Never kill it yourself.
66
+
67
+ ## Evidence rules
68
+
69
+ - **Never state a root cause without citing an evidence id** from a tool
70
+ result, e.g. "readFileSync dominates CPU (profile_cpu#1/e2)".
71
+ - Phrase unsupported ideas as hypotheses and name the tool that would test
72
+ them: "Hypothesis: downstream latency. Test: trace_syscalls network."
73
+ - Respect `confidence`: "observed" is read from tool output; "inferred" is a
74
+ reasoning step — say which is which.
75
+ - Read `limitations`. "sampled 10 s", "no symbols", "ran without root" change
76
+ what you may conclude.
77
+
78
+ ## Consent and safety
79
+
80
+ - `capture_traffic` requires `consent: true`. **Ask the user before passing
81
+ it.** Packet captures can contain secrets.
82
+ - Debug Anything is read-only and never escalates privileges. If a tool returns
83
+ `ok: false` with a sudo command in `limitations`, show the user that command;
84
+ do not try to run it yourself.
85
+ - Payloads are redacted; raw artifacts under `~/.debuganything/sessions/` are not.
86
+
87
+ ## After a fix
88
+
89
+ Re-run the same measuring tool and call `diff_runs` on the before/after run
90
+ ids to prove the fix. Put the diff's evidence ids in your summary.
91
+
92
+ ## Handoffs
93
+
94
+ - **Step debugger.** When Debug Anything localizes a problem to a function or thread,
95
+ suggest attaching a step debugger (e.g. mcp-debugger) at `<file:function>`.
96
+ Debug Anything tells you where to look; a step debugger lets you look inside.
97
+ - **Static analysis.** When Debug Anything names a native symbol, shared library or binary you cannot read (a hot frame in `libfoo.so`, a thread parked in `pthread_mutex_lock` under `worker_b`), hand that symbol to a decompiler / static-analysis tool to see what it does; cite Debug Anything's evidence for the runtime facts and the static tool's for the code facts.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shreyas Sawant and DEA contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,284 @@
1
- # Temporary Holding Version
1
+ <p align="center"><a href="https://debuganything.dev"><img src="https://raw.githubusercontent.com/shreyassaw5394/debuganything/main/assets/debuganything-logo.png" alt="Debug Anything" width="640"></a></p>
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ # Debug Anything
4
+
5
+ **Observe any running process. No breakpoints, no restarts, no instrumentation.**
6
+
7
+ One MCP server and CLI that gives any coding agent — Claude Code, Codex, Cursor, Gemini CLI — eyes on running software: syscalls, CPU flamegraphs, thread stacks, sockets and file descriptors, packets, heap retainers, container state. Battle-tested local tools (`strace`, `py-spy`, `perf`, `lsof`, `tcpdump`, `gdb`/`lldb`, Node's inspector) do the observing; Debug Anything turns their output into **structured evidence** an agent can reason about and a human can audit.
8
+
9
+ [![npm](https://img.shields.io/npm/v/debuganything.svg)](https://www.npmjs.com/package/debuganything)
10
+ [![MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
11
+ [![MCP](https://img.shields.io/badge/MCP-server-8A2BE2)](server.json)
12
+ [![Node](https://img.shields.io/badge/node-%E2%89%A522-339933)](package.json)
13
+ [![npm downloads](https://img.shields.io/npm/dm/debuganything.svg?label=npm%20downloads)](https://www.npmjs.com/package/debuganything)
14
+ [![PyPI downloads](https://img.shields.io/pypi/dm/debuganything.svg?label=pypi%20downloads)](https://pypi.org/project/debuganything/)
15
+ [![GitHub stars](https://img.shields.io/github/stars/shreyassaw5394/debuganything.svg?style=flat&label=stars)](https://github.com/shreyassaw5394/debuganything/stargazers)
16
+ [![Discord](https://img.shields.io/badge/discord-join-5865F2)](https://discord.gg/htPuQ5grg)
17
+
18
+ [Quick start](#quick-start) · [How Debug Anything works](#how-debug-anything-works) · [What you can observe](#what-you-can-observe) · [Showcases](#showcases) · [Workflows](docs/workflows.md) · [Python / LangChain / CrewAI](#python-langchain-llamaindex-crewai) · [Safety](#safety) · [FAQ](#faq) · [Roadmap](#roadmap) · [Community](#community)
19
+
20
+ ```bash
21
+ npx debuganything why <pid> # or: why api-container --symptom leak
22
+ ```
23
+
24
+ One command against any pid, container or pod: attach → the right tools for the symptom (`slow` / `leak` / `hang` / `crash` / `triage`) → **ranked findings, every one citing evidence ids** → detach. Hooking it to your agent instead: `npx debuganything setup`. No install at all? [Paste tool output in the browser](https://debuganything.dev/analyze).
25
+
26
+ ![Debug Anything finding a Node.js leak: two memory snapshots, a diff, and the retainer named with evidence ids](docs/demo.gif)
27
+
28
+ > Website: <https://debuganything.dev> · Community: [Discord](https://discord.gg/htPuQ5grg) · [Discussions](https://github.com/shreyassaw5394/debuganything/discussions) · Only ever download Debug Anything from this repo, the `debuganything` npm/PyPI packages, or that site.
29
+
30
+ ## Where Debug Anything sits
31
+
32
+ Step-through debuggers over MCP already exist and are good: [debugmcp/mcp-debugger](https://github.com/debugmcp/mcp-debugger) (7 languages), [microsoft/DebugMCP](https://github.com/microsoft/DebugMCP) (VS Code), [jdwp-mcp](https://github.com/search?q=jdwp-mcp) (Java), [jkolo/debug-mcp](https://github.com/jkolo/debug-mcp) (.NET), [pprof-mcp-agent](https://github.com/search?q=pprof-mcp-agent) (Go). They need a debug adapter, a debug port, or an instrumented/restarted target, and they assume you already know where to put the breakpoint.
33
+
34
+ Debug Anything is the layer before that: black-box observation of any pid, container or pod with zero instrumentation, turned into evidence.
35
+
36
+ > **mcp-debugger is for when you know where to put the breakpoint. Debug Anything is for when you don't.**
37
+
38
+ They are complementary. When Debug Anything localizes a problem to a function or thread, its `suggested_next` includes the handoff: *"attach a step debugger (e.g. mcp-debugger) at `file:function`"* — and, for native symbols, *"decompile `parse_frame` in `libfoo.so` with your static-analysis tool"*. More situations: [docs/examples.md](docs/examples.md).
39
+
40
+ ## Why this exists
41
+
42
+ Software is written once and runs forever, and most engineering pain is in the running part. Agents just got very good at the writing part. They are still blind to the running part — an agent can read every line of your code and still cannot tell you why the process in front of it is eating 4 GB. Observability vendors solved this for humans with dashboards. Nobody has solved it for agents.
43
+
44
+ Debug Anything is a sensory layer for software agents. The plan:
45
+
46
+ 1. **Local** — one MCP, one laptop, one process. Evidence over guesses. *(this release)*
47
+ 2. **Anywhere** — containers, pods, remote hosts over SSH, fleets. Same tools, same contracts.
48
+ 3. **Always-on** — agents that watch production, notice the regression at 3 am, attach, diagnose, and open the PR with the flamegraph attached, paging a human only with proof.
49
+ 4. **The standard** — the evidence contract (findings must cite evidence) becomes how any tool reports to any agent, so a human can audit an agent's claim in one click.
50
+
51
+ Every interface is designed so step-1 code survives to step 4: targets are abstract (`pid` today, `container` and `pod` now, `host` next), adapters are pluggable, and every result has the same evidence schema. Nothing assumes localhost.
52
+
53
+ ## Quick start
54
+
55
+ ### 0. The one-liner
56
+
57
+ ```bash
58
+ npx debuganything why <pid|container|pod> # symptom flags: --symptom slow|leak|hang|crash
59
+ ```
60
+
61
+ `why` is the whole product in one command: it runs readiness, attaches, picks the right observation battery for the symptom, and prints ranked findings with the evidence ids to back them. Everything below is that same engine, wired into your agent.
62
+
63
+ ### 1. Set up your agent
64
+
65
+ ```bash
66
+ npx debuganything setup
67
+ ```
68
+
69
+ Detects Claude Code, Codex, Cursor and Gemini CLI, shows the exact config entry it will add, backs up the file, writes it, and installs the `debug-anything` skill where the agent supports skills. Then restart your agent.
70
+
71
+ **One-click installs:** [![Install MCP Server in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=debuganything&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImRlYS1hZ2VudHNAbGF0ZXN0Iiwic2VydmUiXX0=) [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_DEA-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect/mcp/install?name=debuganything&config=%7B%22name%22%3A%22dea%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22debuganything%40latest%22%2C%22serve%22%5D%7D) [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_DEA-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=debuganything&config=%7B%22name%22%3A%22dea%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22debuganything%40latest%22%2C%22serve%22%5D%7D)
72
+
73
+ Claude Code plugin: `/plugin marketplace add shreyassaw5394/debuganything` then `/plugin install debuganything@debuganything` · Gemini CLI: `gemini extensions install https://github.com/shreyassaw5394/debuganything` · Skill: `npx skills add shreyassaw5394/debuganything`
74
+
75
+
76
+ ### 2. Ask your agent
77
+
78
+ > *My API gets slow after a few minutes — attach to it and tell me why, with evidence.*
79
+
80
+ > *Something is holding port 8080. Who?*
81
+
82
+ > *This Python worker hangs after ~20 requests. Find out what it is waiting on.*
83
+
84
+ The agent calls `readiness`, `attach`, then the right tools, and answers with findings that cite evidence ids — or tells you what it could not observe and why.
85
+
86
+ ### 3. No agent? One command
87
+
88
+ ```bash
89
+ npx -y debuganything@latest why 12345 --symptom leak # or: slow | hang | crash | triage
90
+ debuganything why my-container --symptom crash
91
+ debuganything why -- node server.js # spawn it under observation
92
+ ```
93
+
94
+ `why` attaches, runs the right tools for the symptom, prints each result, and
95
+ ends with a ranked summary and the report path. Skips tools `readiness` says
96
+ you cannot run instead of failing.
97
+
98
+ ### 4. Or step by step
99
+
100
+ ```bash
101
+ npx -y debuganything@latest readiness
102
+ debuganything ps --filter node
103
+ S=$(debuganything attach 12345 --json | jq -r .session_id)
104
+ debuganything profile --session $S --duration 10
105
+ debuganything sockets --session $S
106
+ debuganything report --session $S --md report.md
107
+ debuganything detach --session $S
108
+ debuganything port 8080 # who holds a port — no session needed
109
+ ```
110
+
111
+ Every command takes `--json` and prints the exact `ToolResult`. See [docs/cli.md](docs/cli.md).
112
+
113
+ ### 5. Set up a repo for the whole team
114
+
115
+ ```bash
116
+ cd my-project && debuganything init # .mcp.json + .cursor/mcp.json + a rule in AGENTS.md/CLAUDE.md — commit them
117
+ ```
118
+
119
+ Every teammate's Claude Code and Cursor now gets Debug Anything from the repo, with the rule telling agents when to use it. Adoption flow day by day: [docs/workflows.md](docs/workflows.md).
120
+
121
+ ### 6. Install as an agent skill
122
+
123
+ The `debug-anything` skill (investigation orders, evidence rules, consent
124
+ etiquette) is installed by `setup` for Claude Code, Codex and Gemini CLI, and
125
+ is also available through [skills.sh](https://skills.sh):
126
+
127
+ ```bash
128
+ npx skills add shreyassaw5394/debuganything
129
+ ```
130
+
131
+ ### 7. Update
132
+
133
+ ```bash
134
+ debuganything update # or: npx debuganything@latest setup
135
+ ```
136
+
137
+ ## How Debug Anything works
138
+
139
+ ```
140
+ agent ──MCP──▶ Debug Anything server ──▶ dispatcher ──▶ adapter (strace | py-spy | perf | lsof | tcpdump | gdb/lldb | inspector | docker)
141
+ │ │ build command → run with caps → write raw artifact → parse → aggregate
142
+ ▼ ▼
143
+ ToolResult { findings[] ──cite──▶ evidence[] ──point──▶ artifacts[] } + limitations + suggested_next
144
+ ```
145
+
146
+ - **Sessions.** `attach` resolves a target (pid, container, pod, or a command spawned under capture) into `~/.debuganything/sessions/<id>/`. Every tool result is saved as a run (`profile_cpu#2`), so `diff_runs` can compare before/after and `report` can assemble the whole investigation.
147
+ - **Evidence contract.** A `Finding` without `evidence_ids` is rejected by the schema. `confidence: "inferred"` is allowed but must be stated. Agents only get to claim what the evidence supports. Full schemas: [docs/mcp-contracts.md](docs/mcp-contracts.md).
148
+ - **Adapters.** Each declares platforms, required binaries and the tools it serves; `readiness` computes what works on this machine. Parsers are pure functions tested on real captured output. Adding one takes ~80 lines: [CONTRIBUTING.md](CONTRIBUTING.md).
149
+ - **Prompts.** `dea_slow`, `dea_leak`, `dea_hang`, `dea_crash`, `dea_port_busy` are guided investigations: the order of tools, what to look for, and the rule to never state a cause without an evidence id.
150
+
151
+ ## What you can observe
152
+
153
+ New in 0.4: Java thread dumps (`jstack`, live or imported), Go goroutine dumps, a [paste-in browser analyzer](https://debuganything.dev/analyze), shareable HTML reports (`debuganything report --html`), cross-session baseline diffs (`debuganything diff --session now '<baseline>:<run>' <run>`), and [CI hang forensics as a GitHub Action](https://github.com/shreyassaw5394/debuganything-action).
154
+
155
+
156
+ | Target | What Debug Anything returns | Requirements |
157
+ |---|---|---|
158
+ | **Any process: sockets** (`inspect_sockets`) | listening ports, connections grouped by remote, CLOSE_WAIT / TIME_WAIT / SYN_SENT pileups, fd count vs ulimit | `lsof` — Linux, macOS; no root for your own processes |
159
+ | **Any process: files** (`inspect_files`) | fds by type, fd growth over a window, largest open files, deleted-but-open files holding disk | `lsof` — Linux, macOS (deleted-but-open: Linux only) |
160
+ | **Any process: memory** (`snapshot_memory`) | RSS/VSZ series, `/proc` status (anon/file/swap/threads) | `ps` — Linux, macOS |
161
+ | **Node.js: heap** (`snapshot_memory`) | V8 heap snapshot, bytes by type and constructor, top retainers by retained size with retaining path (`Context.retained`, `Map.table`…) | Node's inspector (enabled via `SIGUSR1` if needed) — Linux, macOS |
162
+ | **Node.js: JS stack** (`dump_stacks`) | main-thread JS call frames, idle vs blocked event loop | Node's inspector — Linux, macOS |
163
+ | **Python: CPU** (`profile_cpu`) | top frames by self/total time, hottest stacks, `flamegraph.svg` | `py-spy` — Linux (`ptrace_scope=0` or root), macOS (sudo) |
164
+ | **Python: threads** (`dump_stacks`) | every thread's stack, blocked threads classified as lock / join / sleep / I/O using the source line (`with lock_b:`), deadlock detection | `py-spy` — Linux, macOS (sudo) |
165
+ | **macOS: file + network syscalls** (`trace_syscalls`) | per-call timing, blocked calls, errno (ENOENT, ECONNREFUSED…) via `fs_usage`; needs root, so Debug Anything prints the sudo command and you `debuganything import fs_usage <file>` | `fs_usage` — macOS, preinstalled |
166
+ | **Anything you captured yourself** (`debuganything import`) | strace, fs_usage, perf script, py-spy, sample, gdb/lldb, lsof, tcpdump text → same evidence and findings as a live run. The answer to "needs root" | — |
167
+ | **Linux: syscalls** (`trace_syscalls`) | top syscalls by total time and count, slowest calls with paths/addresses, error counts (ENOENT, EAGAIN, ECONNREFUSED…), share of time in blocking waits | `strace` — Linux; `ptrace_scope=0` or root |
168
+ | **Native / Node / Go / Java: CPU** (`profile_cpu`) | perf sampling → folded stacks → `flamegraph.svg` (no Perl), idle vs work split | `perf` — Linux (`perf_event_paranoid ≤ 1` or root); Node needs `--perf-basic-prof` for JIT names |
169
+ | **Native / Node: CPU on macOS** (`profile_cpu`) | `sample` call graph → folded stacks → flamegraph | `sample` — macOS, preinstalled |
170
+ | **Native / Node / Go / Java: threads** (`dump_stacks`) | all thread backtraces, threads in mutex waits vs condition waits vs blocking I/O, deadlock heuristic | `gdb` — Linux; `lldb` — macOS |
171
+ | **Network** (`capture_traffic`, consent) | per-remote packets/bytes, RSTs, unanswered SYNs, probable retransmits, DNS queries, `.pcap` artifact; filter derived from the target's own ports, never unbounded | `tcpdump` — Linux, macOS; root / `CAP_NET_RAW` / `access_bpf` |
172
+ | **Docker container** (`container_info`) | state, OOMKilled, exit code, restarts, memory/CPU limits vs usage, cgroup throttling and OOM events, published ports, error lines in the log tail; container → host pid mapping for every other tool | `docker` — Linux (host pid visible), macOS (`container_info` only) |
173
+ | **Kubernetes pod** (`attach ns/pod`) | resolves the pod's container to a local pid when the kubelet runs on this host (kind, minikube, k3s) | `kubectl` — experimental |
174
+ | **Port in use** (`debuganything port N`) | pid, command line and user holding the port, or TIME_WAIT/CLOSE_WAIT leftovers | `lsof` |
175
+ | **Before/after** (`diff_runs`) | what grew, shrank, appeared or disappeared between two runs of the same tool | — |
176
+ | Windows | not yet — `readiness` says so | planned: ETW, procdump |
177
+
178
+ Honest status: everything above was run live on Linux (Debian 12 container, root) and macOS 15 (own processes, no sudo) against the example apps. `bpftrace` scripts are staged but not wired to a tool yet. Install commands per OS: [docs/providers.md](docs/providers.md).
179
+
180
+ ## Examples
181
+
182
+ **Real-world situations** — CLOSE_WAIT pileups and EMFILE, disk full but `du` disagrees, Postgres pool exhaustion, a Celery deadlock, a blocked Node event loop, OOMKilled pods, DNS on every request, EADDRINUSE after a crash, a native hot spot you cannot read — each with the session, the evidence and the fix: [docs/real-world.md](docs/real-world.md).
183
+
184
+ Ten copy-paste situations — slow API, leak, hang, port in use, container crash, spawn-under-observation, prove-the-fix, CI regression gate, consented packet capture, Python agents — are in [docs/examples.md](docs/examples.md).
185
+
186
+ ## Showcases
187
+
188
+ Reproducible with `examples/`. Full transcripts in [docs/showcases.md](docs/showcases.md); a complete report Debug Anything wrote itself is in [docs/example-report-leaky-node.md](docs/example-report-leaky-node.md).
189
+
190
+ **leaky-node** — HTTP server that keeps every request body alive in a module-level array, plus a `/slow` route doing `readFileSync` in a loop and an 800 ms timer.
191
+ `snapshot_memory` ×2 + `diff_runs`: RSS 85 → 172 MB (+102 %), heap 37 → 97 MB, the top retainer is an `Array` whose retained size grew 17 → 47 MB. `trace_syscalls` (8 s): 5 600 `openat`/`statx` lookups and 3 314 `read()` calls — "sync I/O in a loop", and `epoll_pwait` sleeping ~800 ms at a time.
192
+
193
+ **deadlock-py** — threaded server that takes two locks in opposite order after request 20.
194
+ `dump_stacks`: `worker-ab-20` blocked at `app.py:26` `[with lock_b:]`, `worker-ba-20` blocked at `app.py:33` `[with lock_a:]`, eight request threads joined on them, no thread running → "likely deadlock", with the handoff to a step debugger at `worker_ab`.
195
+
196
+ **busy-port** — a process holding `:8080` and a script failing with `EADDRINUSE`.
197
+ `debuganything port 8080`: `port 8080 is held by pid 47508 (node, user shreyassawant) in LISTEN — command: node server.js. Debug Anything will not kill it; decide yourself.`
198
+
199
+ ## Agents use it without being asked
200
+
201
+ Once installed, agents are told to reach for Debug Anything on their own: when a command they ran hangs, a test times out, output shows `EADDRINUSE` / `ECONNREFUSED` / `EMFILE` / exit 137 / OOM / segfault, a server they started does not respond, or you mention slow, hang, leak or crash. For Claude Code, `setup` also installs a tiny hook that spots those signals in command output and prompts and nudges the model toward the right Debug Anything tool. Read-only observation needs no permission; `capture_traffic` always does. Details and the off switch (`--no-hooks`): [docs/proactive.md](docs/proactive.md).
202
+
203
+ ## Python, LangChain, LlamaIndex, CrewAI
204
+
205
+ ```bash
206
+ pip install debuganything # plain client (no deps; uses npx under the hood)
207
+ pip install 'debuganything[langchain]' # debuganything.langchain.dea_tools()
208
+ pip install 'debuganything[llamaindex]' # debuganything.llamaindex.dea_tools()
209
+ pip install 'debuganything[crewai]' # debuganything.crewai.dea_tools()
210
+ ```
211
+
212
+ ```python
213
+ from debuganything import DebugAnything
214
+ debuganything = DEA()
215
+ s = da.attach(12345)
216
+ print(da.findings(da.profile_cpu(s, duration_s=10)))
217
+ da.detach(s)
218
+ ```
219
+
220
+ Each adapter exposes the same 14 tools with the same `ToolResult`. Frameworks
221
+ with native MCP support can skip the package and run `npx -y debuganything serve`.
222
+ Details: [python/README.md](python/README.md).
223
+
224
+ ## Why not just ask the agent to debug?
225
+
226
+ Because today it cannot. Agents cannot attach to a process; they fumble `strace`/`perf`/`lsof` syntax and flags; a 10 s strace is 1.5 MB of text that blows the context window; and when they cannot measure, they guess — confidently. Debug Anything gives them eyes (the right tool, the right flags, inside hard caps) and evidence (summaries that point to raw artifacts, findings that must cite them). You get a diagnosis you can audit instead of a plausible story.
227
+
228
+ ## Safety
229
+
230
+ - **Read-only.** v0 tools only observe. No kill, no breakpoints, no probes that modify behavior. Documented exception: Node targets may receive `SIGUSR1` to enable the inspector.
231
+ - **Consent.** `capture_traffic` requires `consent: true`; the skill tells agents to ask you first.
232
+ - **Hard caps.** 60 s per tool (30 s for captures), 50 MB raw output on disk, 16 KB returned to the agent (summaries + pointers; cited evidence is never dropped). Every child is killed with SIGTERM then SIGKILL.
233
+ - **No sudo, ever.** If a tool needs root you get `ok: false` and the exact command you could run yourself. `readiness` reports `ptrace_scope`, `perf_event_paranoid`, SIP and `sudo -n` status up front.
234
+ - **Scoped.** Adapters touch only the attached pid tree or container. Captures are filtered to the target's ports and refuse to run unbounded.
235
+ - **Secrets.** Bearer tokens, AWS keys, JWTs, `password=`, API keys, private keys and `user:pass@` URLs are redacted in everything returned to the agent. **Raw artifacts on disk are not redacted** — treat `~/.debuganything/sessions/` as sensitive.
236
+ - **No cloud. No telemetry.** Debug Anything makes no network calls of its own. Everything stays on your machine.
237
+
238
+ Details: [docs/safety.md](docs/safety.md) · [DISCLAIMER.md](DISCLAIMER.md) · [SECURITY.md](SECURITY.md)
239
+
240
+ ## FAQ
241
+
242
+ **Which agents work?** Anything that speaks MCP over stdio. `setup` knows Claude Code, Codex, Cursor and Gemini CLI; for others add `{"command":"npx","args":["-y","debuganything@latest","serve"]}` to the MCP config ([docs/installation.md](docs/installation.md)).
243
+
244
+ **Do I need to install strace / perf / py-spy?** Only for the tools you want. `readiness` lists what is usable and prints install hints. `lsof`, `ps` and Node's inspector work out of the box on Linux and macOS.
245
+
246
+ **Does it need root?** Not for your own processes on macOS (`lsof`, `sample`, `lldb`, inspector) or on Linux with `ptrace_scope=0`. `py-spy` and `fs_usage` on macOS and `tcpdump` everywhere do; Debug Anything prints the exact `sudo` command, you run it, and `debuganything import <tool> <file>` analyzes the output with the same parsers.
247
+
248
+ **What can't it see on macOS?** There is no strace or perf. `fs_usage` (via import) covers file and network calls; `sample`, `lldb`, `lsof` and the Node inspector cover the rest. For the full syscall and kernel-time picture, run the target in a Linux container (`docker/linux-lab`).
249
+
250
+ **Does Debug Anything upload anything?** No. No network calls, no telemetry, no update checks except the explicit `debuganything update`.
251
+
252
+ **Can it debug a Docker container?** On Linux, yes — attach by container name and every tool works through the host pid. On macOS the Docker VM hides pids, so only `container_info` works from the host; run Debug Anything inside the container instead (`docker/linux-lab` has an image with every provider).
253
+
254
+ **How is this different from a step debugger?** Debug Anything never stops your program at a line. It samples, traces and snapshots a running process and tells you *where* to look. Then hand off to `mcp-debugger` or your IDE to look *inside*.
255
+
256
+ **Where are the artifacts?** `~/.debuganything/sessions/<id>/` (`DEA_HOME` to override). `debuganything sessions list` / `debuganything sessions prune`.
257
+
258
+ ## Roadmap
259
+
260
+ bpftrace canned scripts · Kubernetes pods via ephemeral debug containers · Windows (ETW, procdump) · Java (async-profiler, `jcmd Thread.print`) · Go (`pprof`, delve goroutine dumps) · Rust/C++ DWARF unwinding · eBPF-first tracing on Linux · Python `tracemalloc`/`memray` · Node CPU via inspector `Profiler` · lock-owner graphs · remote agent mode over SSH. Full list: [docs/roadmap.md](docs/roadmap.md).
261
+
262
+ ## Community
263
+
264
+ - **Discord:** <https://discord.gg/htPuQ5grg> — questions, show-and-tell, help reading a session.
265
+ - **Discussions:** <https://github.com/shreyassaw5394/debuganything/discussions> — longer-form ideas and RFCs.
266
+ - **Issues:** bugs and adapter requests via the templates. **Discussions** for ideas.
267
+ - **Security:** private advisories only, see [SECURITY.md](SECURITY.md).
268
+
269
+ ## Contributing
270
+
271
+ `main` is protected: every change is a pull request reviewed by a code owner.
272
+ An adapter is ~80 lines: declare `platforms`/`requires`/`tools`, build the command, run it through `runCapped`, parse with a pure function, emit evidence and findings through `ResultBuilder` (which refuses findings without evidence). Capture the real tool output once into `tests/fixtures/` and test the parser on it. Recipe in [CONTRIBUTING.md](CONTRIBUTING.md).
273
+
274
+ ## Contributors
275
+
276
+ Everyone who has landed a pull request. Add an adapter, a fixture or a doc and your face shows up here.
277
+
278
+ <a href="https://github.com/shreyassaw5394/debuganything/graphs/contributors"><img src="https://contrib.rocks/image?repo=shreyassaw5394/debuganything" alt="contributors"></a>
279
+
280
+ Numbers across npm, PyPI, GitHub and the MCP Registry: `bash scripts/stats.sh`.
281
+
282
+ ## License and disclaimer
283
+
284
+ MIT — see [LICENSE](LICENSE). Debug Anything is provided **"as is", without warranty of any kind**; the authors and contributors accept **no liability** for outages, data exposure, or any other damage arising from its use. Debug Anything attaches observation tools to running software: **only observe systems you own or are explicitly authorized to debug** — you are solely responsible for authorization and for complying with applicable laws and policies. Observation is not free (ptrace pauses targets; captures and heap dumps can contain secrets), findings are automated diagnostics rather than professional advice, and Debug Anything is an independent project developed by its contributors in their personal capacities, unaffiliated with any employer or with the third-party tools it orchestrates. Full terms: [DISCLAIMER.md](DISCLAIMER.md).
@@ -0,0 +1,9 @@
1
+ # Brand assets
2
+
3
+ - `debuganything-mark.svg` / `debuganything-mark-512.png` / `debuganything-mark-1024.png` — square mark (Discord server icon, favicon, avatars)
4
+ - `debuganything-logo.svg` / `debuganything-logo.png` — horizontal lockup, dark
5
+ - `debuganything-logo-light.svg` / `debuganything-logo-light.png` — horizontal lockup, light backgrounds
6
+ - `debuganything-social.svg` / `debuganything-social.png` — 1200×630 social preview (LinkedIn, X, OpenGraph)
7
+
8
+ The mark is a lens over a live process trace: observe what is running, cite what you saw.
9
+ Colors: ink `#0b0d12`, lens `#7cc4ff → #5aa9f0`, trace `#ffb86b`. Use freely for anything about DEA (MIT).
Binary file
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/version.ts
4
+ var VERSION = "1.0.0";
5
+
6
+ export {
7
+ VERSION
8
+ };
9
+ //# sourceMappingURL=chunk-32IDKAZK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/version.ts"],"sourcesContent":["export const VERSION = \"1.0.0\";\n"],"mappings":";;;AAAO,IAAM,UAAU;","names":[]}