debug-hub
Evidence-first debugging WITH MCP tools. Use when debug_hub MCP server is available. Inject log calls, collect via HTTP API (port 39200), analyze through MCP tools, clean up when done. If debug_hub MCP is unavailable, use `debug` skill (bundled Python collector) instead.
- License 许可
- MIT
- 所属仓库
- rexleimo/aios
- 最近更新
- 2026-11-07
- Stars
- ★ 62
- Forks
- 11
01 前言 Front Matter
- name
- debug-hub
- tags
- [ "general", "debug", "verification" ]
- scopes
- [ "global", "project" ]
- clients
- [ "codex", "claude", "gemini", "opencode", "hermes", "workbuddy", "pi", "zcode", "qoder" ]
- description
- Evidence-first debugging WITH MCP tools. Use when debug_hub MCP server is available. Inject log calls, collect via HTTP API (port 39200), analyze through MCP tools, clean up when done. If debug_hub MCP is unavailable, use `debug` skill (bundled Python collector) instead.
- repoTargets
- [ "codex", "claude", "gemini", "opencode", "hermes", "agents", "workbuddy", "pi", "zcode", "qoder" ]
- defaultInstall
- { "global": false, "project": false }
- installCatalogName
- debug-hub
03 SKILL.md 正文
Debug-Hub
Working directory: any (scripts run from project root by convention)
Evidence-first debugging: inject zero-dependency log calls, collect via debug-hub HTTP API, analyze through MCP tools, strip all injected code when done.
Inline Reporter
Inject once at the top of the first file you modify. Node 18+ / modern browsers, zero npm deps:
const __dh=async(m,d)=>{try{await fetch('http://127.0.0.1:39200/api/logs/single',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({id:crypto.randomUUID(),timestamp:Date.now(),level:'debug',message:m,data:d,sdk:{name:'dh',version:'1',runtime:'node'}})})}catch{}}
Python target? Use the debug skill instead — it bundles a Python collector that sends to the same debug-hub API. This applies regardless of whether debug_hub MCP is available; the __dh helper is JavaScript-only.
Marker Convention
Every injected debug line carries DH:<sessionId>. Cleanup strips any line containing this string.
__dh('DH:sess-abc user state', {user});
__dh('DH:sess-abc payment duration', {ms: Date.now()-t0});
MCP Tools
| Tool | What it does |
|---|---|
debug_hub.start_session { objective } |
Start session, returns sessionId |
debug_hub.instrument { sessionId, files: [{path, lineCount}] } |
Track files with injected debug code |
debug_hub.search_logs { keyword, level, since, traceId } |
Query collected runtime logs |
debug_hub.get_stats |
Error counts, level breakdown |
debug_hub.cleanup_instruments { sessionId, dryRun?, workspace? } |
Remove all injected debug lines |
Other tools: list_traces, get_trace, compact_context, health — see MCP tool list.
When NOT to Use This Skill
Debug-hub is for runtime bugs where you can reproduce the issue and need to observe variable state, timing, or control flow at runtime. Do NOT use debug-hub for:
- Compile-time / type errors: TypeScript type errors, syntax errors, lint failures — read the error message and fix the code directly. No runtime injection needed.
- CI/CD platform differences: Path separators, case sensitivity, missing dependencies in CI — inspect CI logs and config files, not runtime state.
- Configuration / matching rule problems: Skill trigger conflicts, wrong config values, permission misconfig — read and fix the config files directly.
- Non-JavaScript environments: The
__dhhelper requires Node 18+ or browserfetch. For Python, use thedebugskill (bundled Python collector) instead. For other languages, use platform-native debug tools.
When a bug doesn't fit debug-hub's scope, state why explicitly and switch to the appropriate approach rather than forcing the injection workflow.
Workflow
- Start:
debug_hub.start_session { objective: "..." }— note thesessionId - Hypothesize: 3-5 testable hypotheses about root cause
- Inject: write
__dhhelper + marked log calls, one per hypothesis- CRG (if codemap installed):
semantic_search_nodes(query="<error-related term>")→query_graph(pattern="callees_of", target="<suspected function>")→detect_changes(base="HEAD~5")for structural evidence before injecting
- CRG (if codemap installed):
- Record:
debug_hub.instrument { sessionId, files: [{path, lineCount}] }— use absolute paths - Reproduce: ask user to run the failing scenario
- Analyze:
debug_hub.search_logs { keyword: "<sessionId>" }→ CONFIRMED/REJECTED/INCONCLUSIVE - Fix: apply only after logs prove root cause; keep instrumentation
- Verify: user reproduces again, compare before/after
- Cleanup:
dryRun: truefirst, then executedebug_hub.cleanup_instruments { sessionId }
Cleanup has two modes:
- Explicit: uses instrument records → fast, precise
- Discovery:
{ sessionId, workspace: "/project/root" }→ greps filesystem, fallback when agent forgotinstrument
Guardrails
- MUST NOT log secrets, tokens, passwords, API keys, PII, or session cookies
- 2-10 log calls max, each mapped to a hypothesis
- MUST run
dryRun: truebefore executing cleanup - MUST NOT remove instrumentation before post-fix verification succeeds
- MUST NOT leave injected code behind; the
__dhhelper and every call site must go try/catchin__dh= target app keeps running if debug-hub is down
04 同仓库更多 Skills
versioning-by-impact
Use when completing a task and deciding whether repository changes require a semantic version bump and changelog entry before commit/push.
verification-loop
Evidence-before-assertions workflow. Use before claiming work is done, before release, and after any behavior change in scripts/skills/MCP.
typesafe-ai
Build AI-powered software with TypeSafe: small units of AI intelligence you can use like programming primitives. Its System One models, including Jev, turn natural language and application state into typed judgments and probabilities that code can combine. Use when a feature needs programmable common sense, when brainstorming what AI could make possible in an app, or when an LLM prompt-and-parse step could become a structured decision. Applications include routing, ranking, extraction, verification, and interactive experiences; these are starting points, not the limits. Read live docs and cookbooks to find useful patterns and discover new combinations.
skill-opt-lite
Train and optimize skill documents using the SkillOpt methodology — the agent acts as both target and optimizer, running tasks, reflecting on failures, proposing edits, and validating improvements in a self-contained training loop. TRIGGER: optimize skill, train skill, improve skill, skill training, skill optimization, SkillOpt, skill evolution, skill iteration loop, skill feedback loop, skill tuning.
skill-constraints
Enforce browser automation safety constraints — tool usage order, anti-detection rules, screenshot discipline, and human-in-the-loop checks. Use when setting up or verifying browser/MCP tool operations, NOT for every skill execution.
seo-geo-page-optimization
Use when improving a single page for SEO and AI answer-engine visibility (GEO), especially when you need faster first-screen conversion and clearer traffic funnels.