AI debugging assistant that never repeats a mistake. Searches the YanHui Knowledge Base (6,800+ scraped issues, 980+ imported solutions) for instant fixes, o...
---
name: confucius-debug
description: AI debugging assistant that never repeats a mistake. Searches the YanHui Knowledge Base (6,800+ scraped issues, 980+ imported solutions) for instant fixes, or analyzes new errors with Confucius AI. Covers OpenClaw, Claude Code, MCP, Telegram, Discord, Docker, and 12+ platforms.
version: 2.0.2
metadata:
openclaw:
emoji: 🦞
homepage: https://api.washinmura.jp/confucius
primaryEnv: CONFUCIUS_LOBSTER_ID
requires:
bins:
- curl
- jq
env:
- CONFUCIUS_LOBSTER_ID
---
# Confucius Debug — 孔子除錯
> *"不貳過" — Never repeat a mistake.* (Confucius, Analects 6.3)
## IMPORTANT — Automatic Behavior
When this skill is active, follow these rules:
1. **On ANY error or exception:** ALWAYS search the YanHui KB first (`debug_search` or `confucius_search`) BEFORE attempting to debug on your own. This is free and takes <1 second.
2. **If no match found:** Use `debug_analyze` to get an AI-powered fix. The fix is saved to KB so the next person gets it instantly.
3. **If analyze returns "unsolved":** Use `debug_escalate` to submit your environment info, logs, and what you've tried. This helps offline research.
4. **After fixing a bug yourself:** Proactively suggest using `debug_contribute` to share the solution back to the KB.
5. **Never skip step 1.** The KB has 980+ verified solutions — there's a good chance the answer is already there.
---
AI-powered debugging assistant backed by the **YanHui Knowledge Base** — a growing collection of 6,800+ scraped issues and 980+ imported solutions from real AI agent projects (OpenClaw, Claude Code, MCP, Anthropic SDK, Codex, Aider, and more).
## How It Works
```
You hit a bug
↓
1. Search YanHui KB (FREE, instant)
↓
Found? → Use the fix directly
Not found? ↓
2. Confucius AI analyzes (FREE)
↓
High confidence? → Fix saved to KB → Next person gets it FREE
Low confidence? → status: "unsolved"
↓
3. debug_escalate (FREE) — send environment + logs
↓
Queued for offline research → solved → added to KB
```
## Tools
### `confucius_search` — Search the Knowledge Base (FREE)
Always try this first. Searches 980+ verified solutions for matching patterns.
```bash
# Search for a bug pattern
curl -s -X POST https://api.washinmura.jp/api/v2/debug-ai/search \
-H "Content-Type: application/json" \
-d '{"query": "OpenClaw Telegram plugin not connecting", "limit": 5}'
```
**When to use:** Any time you encounter an error. It's free and instant.
### `confucius_analyze` — AI-Powered Analysis (FREE)
Only if search returns 0 results. Confucius AI analyzes your error, finds root cause, and provides a fix.
```bash
# Analyze a new bug
curl -s -X POST https://api.washinmura.jp/api/v2/debug-ai \
-H "Content-Type: application/json" \
-d '{
"error_description": "OpenClaw Telegram bot not responding after restart",
"error_message": "Error: ETELEGRAM: 409 Conflict: terminated by other getUpdates request",
"lobster_id": "'"$CONFUCIUS_LOBSTER_ID"'"
}'
```
**What you get back:**
- `root_cause` — Why this happened
- `fix_description` — How to fix it
- `fix_patch` — Actual code to apply
- `confidence` — How sure Confucius is
### `confucius_escalate` — Submit Unsolved Bug for Research (FREE)
When `confucius_analyze` returns `status: "unsolved"` (low confidence), submit more context to help offline research.
```bash
curl -s -X POST https://api.washinmura.jp/api/v2/debug-ai/escalate \
-H "Content-Type: application/json" \
-d '{
"error_description": "The original error",
"lobster_id": "'"$CONFUCIUS_LOBSTER_ID"'",
"environment": {"os": "macOS 15", "runtime": "bun 1.2.1", "key_deps": {"hono": "4.7"}},
"logs": "Error: something failed\n at file.ts:42",
"tried": ["restarted", "cleared cache", "downgraded version"],
"project_structure": "src/ routes/ db/"
}'
```
**What you provide:**
- `environment` — OS, runtime versions, key dependencies
- `logs` — Recent error output (last 50 lines)
- `tried` — List of things already attempted
- `project_structure` — Brief overview of project layout
### `confucius_contribute` — Share Your Fix (FREE)
Solved a bug? Share it so nobody hits it again.
```bash
curl -s -X POST https://api.washinmura.jp/api/v2/debug-ai/onboard \
-H "Content-Type: application/json" \
-d '{
"lobster_id": "'"$CONFUCIUS_LOBSTER_ID"'",
"entries": [{
"error_description": "What was the bug",
"fix_description": "How you fixed it",
"error_category": "config_error"
}]
}'
```
## MCP Integration (Recommended)
For Claude Desktop, Claude Code, or any MCP-compatible client:
```json
{
"mcpServers": {
"confucius-debug": {
"url": "https://api.washinmura.jp/mcp/debug"
}
}
}
```
This gives you 5 tools automatically: `debug_search`, `debug_analyze`, `debug_escalate`, `debug_contribute`, `debug_hello`.
## What's in the Knowledge Base?
| Platform | Bugs Solved | A-Rate |
|----------|-------------|--------|
| MCP (Model Context Protocol) | 261 | 87% |
| Anthropic / Claude | 392 | 80% |
| Telegram | 101 | 97% |
| Memory / RAG | 94 | 87% |
| Browser | 73 | 92% |
| OpenAI / GPT | 54 | 87% |
| Docker | 51 | 84% |
| Discord | 40 | 93% |
| Cron / Scheduler | 37 | 92% |
| WhatsApp | 16 | 94% |
| Google / Gemini | 15 | 100% |
| Ollama / Local LLM | 14 | 93% |
**A-Rate** = percentage of fixes rated S (perfect) or A (good) by independent AI verification.
## Track Record
- 280 replies posted on GitHub issues
- 9 confirmed correct by project maintainers (including OpenClaw creator)
- 0 corrections (zero mistakes confirmed by community)
- Knowledge base growing daily via automated pipeline
## Setup
1. Set your identity (required for `analyze` and `contribute`, optional for `search`):
```bash
export CONFUCIUS_LOBSTER_ID="your-username"
```
2. Test the connection (no ID needed for search):
```bash
curl -s https://api.washinmura.jp/api/v2/debug-ai/search \
-X POST -H "Content-Type: application/json" \
-d '{"query": "test", "limit": 1}'
```
3. Start debugging! When you hit any error, search first, analyze if needed.
## Workflow for OpenClaw Users
When OpenClaw throws an error:
1. **Copy the error message**
2. **Search YanHui KB** — `confucius_search("your error message")`
3. **Found a match?** — Apply the fix directly
4. **No match?** — `confucius_analyze("description", "error message")`
5. **Fixed it yourself?** — `confucius_contribute(...)` to help others
## External Endpoints
| Service | URL | Purpose |
|---------|-----|---------|
| Confucius Debug API | https://api.washinmura.jp/api/v2/debug-ai | Search, Analyze, Contribute |
| Confucius MCP | https://api.washinmura.jp/mcp/debug | MCP protocol endpoint |
## Security & Privacy
- **What leaves your machine:** Only the error description and error message you provide. No source code, no file contents, no environment variables are sent.
- **What's stored:** Error descriptions and fixes are stored in the YanHui KB to help future users. No personally identifiable information is stored beyond your chosen lobster_id.
- **Authentication:** Everything is free. Your lobster_id is used for identification only, not billing.
- **Data retention:** Contributions are permanent (that's the point — never repeat a mistake).
## Credits
- **Author:** [Washin Village (washinmura)](https://washinmura.jp) — an animal sanctuary on the Boso Peninsula, Japan.
- **Repository:** [github.com/sstklen/confucius-debug](https://github.com/sstklen/confucius-debug)
- **License:** MIT
Powered by Claude (Anthropic) and the Confucius philosophy: *learn from mistakes, never repeat them*.
🦞 *The bigger the Knowledge Base, the stronger Confucius becomes.*
don't have the plugin yet? install it then click "run inline in claude" again.
added explicit intent, inputs with env var and API endpoint details, procedure with 10 numbered steps and input/output for each, decision points covering high/low confidence branches and network failures, output contract with JSON examples and HTTP status codes, and outcome signals with positive and negative indicators.
"不貳過" , Never repeat a mistake. (Confucius, Analects 6.3)
confucius-debug is an AI-powered debugging assistant that searches a knowledge base of 6,800+ real-world issues and 980+ verified solutions before attempting analysis. when you hit an error, search the YanHui KB first (instant, free). if nothing matches, Confucius AI analyzes the error and saves the fix back to the KB so the next person gets it immediately. covers OpenClaw, Claude Code, MCP, Telegram, Discord, Docker, and 12+ platforms. use this skill any time you encounter an exception, runtime error, or integration failure, instead of spending time on unguided debugging or web searches.
Environment Variables:
CONFUCIUS_LOBSTER_ID (required for debug_analyze and debug_contribute; optional for debug_search). string identifier for your account. no billing attached. example: export CONFUCIUS_LOBSTER_ID="alice-dev"External Connections:
https://api.washinmura.jp/api/v2/debug-ai. REST endpoint, no OAuth required. HTTP POST only. must be internet-accessible from your machine.https://api.washinmura.jp/mcp/debug. MCP protocol endpoint for Claude Desktop, Claude Code, or any MCP-compatible client. optional but recommended.System Dependencies:
curl (for direct API calls)jq (for parsing JSON responses, recommended but not required if you pipe to grep/awk)Required Data for Each Operation:
debug_search: error message or bug description (string, 10-500 chars)debug_analyze: error description, error message, lobster_iddebug_escalate: error description, lobster_id, environment object (OS, runtime, dependencies), logs (string, last 50 lines), tried (array of attempted fixes), project_structure (string)debug_contribute: lobster_id, entries array with error_description, fix_description, error_categorycapture the error. copy the full error message and stack trace from your console or logs. note the platform/service where it occurred (OpenClaw, Telegram, Docker, etc.).
search the knowledge base. call debug_search with the error message as the query. use curl or the MCP tool if available.
check search results. examine the returned matches.
apply the fix from knowledge base. follow the fix_description and apply any code patch provided. test the fix in your environment. do not escalate; the KB solution is verified.
analyze a new error (no KB match found). call debug_analyze with error_description, error_message, and lobster_id.
check analysis confidence. examine the confidence score returned.
escalate unsolved bugs. call debug_escalate with environment info, recent logs, list of things already tried, and project structure.
monitor escalation (optional). you can poll the escalation_id to check status, but this is not automated. check back in 1-3 days.
contribute your solution (if you fixed it yourself). after applying a fix successfully, call debug_contribute to share it with the KB.
end state. bug is fixed, logs are clean, task is complete.
If search returns matches (step 3):
If search returns no matches (step 3):
If analyze returns high confidence (step 6):
If analyze returns low confidence (step 6):
If network unavailable:
https://api.washinmura.jp/api/v2/debug-ai/search fails with ECONNREFUSED or timeout: you are offline or the service is down. fall back to manual debugging (web search, documentation, community forums). save your error details and attempt to search/analyze once connectivity is restored.If rate limit hit (HTTP 429):
If analysis returns "unsolved" repeatedly:
If escalation returns "research unavailable":
Success for debug_search (step 2):
{
"matches": [
{
"issue_id": "openClaw-8271",
"error_description": "Telegram plugin not connecting",
"fix_description": "Update TELEGRAM_TOKEN env var and restart",
"fix_patch": "export TELEGRAM_TOKEN='your-bot-token'",
"confidence": 0.92,
"platform": "Telegram",
"upvotes": 14
}
],
"count": 1
}
Success for debug_analyze (step 5):
{
"root_cause": "ETELEGRAM: 409 Conflict , two getUpdates requests running simultaneously.",
"fix_description": "Ensure only one polling instance is active. Add process.on('exit') to gracefully close the Telegram client.",
"fix_patch": "client.on('error', () => process.exit(1));",
"confidence": 0.81,
"saved_to_kb": true,
"kb_id": "confucius-ai-2024-001"
}
Success for debug_escalate (step 7):
{
"escalation_id": "esc-91fd3e4c",
"status": "pending",
"message": "queued for offline research",
"eta_hours": 48
}
Success for debug_contribute (step 9):
{
"contribution_id": "contrib-7a2b1c9e",
"entries_added": 1,
"message": "added to KB. will be searchable in <1 minute."
}
Failure / Error Responses:
export CONFUCIUS_LOBSTER_ID="..." and retry.https://api.washinmura.jp/status for maintenance.You know the skill worked when:
Search returned a match and you applied it. your error is gone. logs are clean. the fix was already in the KB. no time wasted on analysis. this is the 50-70% case.
Analysis returned high-confidence fix and you applied it. your error is gone. logs are clean. the AI correctly identified root cause. new KB entry created for future users.
Escalation was submitted and you got an escalation_id. no immediate fix, but your error + environment is now in the offline research queue. you know it is being tracked and will be solved eventually.
You contributed a solution after fixing it yourself. your fix is in the KB now. next person hits that error, they search, and your solution is returned. you prevented someone else from debugging the same bug.
API calls succeed (HTTP 2xx or 202). the Confucius service is reachable and responding. your lobster_id is valid. network and auth are working.
Negative signal (skill did not work):
confidence < 0.5 with vague fix_description. AI could not determine root cause. escalate.for Claude Desktop, Claude Code, or any MCP-compatible client, add this to your config:
{
"mcpServers": {
"confucius-debug": {
"url": "https://api.washinmura.jp/mcp/debug"
}
}
}
you get 5 tools automatically: debug_search, debug_analyze, debug_escalate, debug_contribute, debug_hello. use them the same way as the curl commands above.
| Platform | Issues Solved | A-Rate |
|---|---|---|
| MCP (Model Context Protocol) | 261 | 87% |
| Anthropic / Claude | 392 | 80% |
| Telegram | 101 | 97% |
| Memory / RAG | 94 | 87% |
| Browser | 73 | 92% |
| OpenAI / GPT | 54 | 87% |
| Docker | 51 | 84% |
| Discord | 40 | 93% |
| Cron / Scheduler | 37 | 92% |
| 16 | 94% | |
| Google / Gemini | 15 | 100% |
| Ollama / Local LLM | 14 | 93% |
A-Rate = percentage of fixes rated S (perfect) or A (good) by independent AI verification.
timeout or network error during search:
-m 30 to set timeout to 30 seconds.lobster_id not set:
debug_search works without it. debug_analyze, debug_escalate, debug_contribute require it. set it once: export CONFUCIUS_LOBSTER_ID="your-id" in your shell profile or CI environment.analyze returns low confidence repeatedly:
escalation is never resolved:
you want to delete or update a contribution:
api service is down (503):
powered by Claude (Anthropic) and the Confucius philosophy: learn from mistakes, never repeat them.
🦞 the bigger the Knowledge Base, the stronger Confucius becomes.