Install
openclaw skills install mulch-self-improving-agentMulch Self Improver β Let your agents grow π±. Captures learnings with Mulch so expertise compounds across sessions. Use when: command/tool fails, user corrects you, missing feature, API fails, knowledge was wrong, or better approach found. Run mulch prime at session start; mulch record before finishing. Benefits: better and more consistent coding, improved experience, less hallucination.
openclaw skills install mulch-self-improving-agentStructured expertise that accumulates over time, lives in git, and works with any agent. Agents start each session from zero; the pattern discovered yesterday is forgotten today. This skill uses Mulch: agents call mulch record to write learnings and mulch query to read them. Expertise compounds across sessions, domains, and teammates. Mulch is a passive layer β it does not contain an LLM. Agents use Mulch; Mulch does not use agents.
Benefits: Better and more consistent coding Β· Improved experience Β· Less hallucination (grounding in project expertise)
When to use: Command/tool fails, user corrects you, user wants a missing feature, your knowledge was wrong, or you found a better approach β record with Mulch and promote proven patterns to project memory. Auto-detection: The hook now detects errors and corrections automatically and prompts to record.
Mechanics: One learning store β .mulch/ (append-only JSONL, git-tracked, queryable). Session start: mulch prime. Recording: mulch record <domain> --type <type> .... No .learnings/ markdown files.
Qualification (features, benefits, pain points): See QUALIFICATION.md. Benchmark (token efficiency, troubleshooting skill improvement): See BENCHMARK.md β e.g. ~54% fewer chars to get same resolutions; find rate same or better; less context β fewer tokens, less noise, lower risk of wrong fix.
The hook now automatically detects learning moments:
The agent will prompt: "Want me to record this for next time?"
24 preset domains included in config/domains.json:
api, database, testing, frontend, backend, infra, docs, config,
security, performance, deployment, auth, errors, debugging,
workflow, customer, system, marketing, sales, content,
competitors, crypto, automation, openclaw
When a learning is recorded, you're notified via Telegram.
| Situation | Action |
|---|---|
| Command/operation or API fails | mulch record <domain> --type failure --description "..." --resolution "..." |
| User corrects you / knowledge was wrong | mulch record <domain> --type convention "..." or --type pattern --name "..." --description "..." |
| Found better approach, best practice | mulch record <domain> --type convention "..." or --type guide --name "..." --description "..." |
| Architectural or tech decision | mulch record <domain> --type decision --title "..." --rationale "..." |
| Feature request (tracking) | mulch record <domain> --type decision --title "..." --rationale "..." |
| Key file/endpoint to remember | mulch record <domain> --type reference --name "..." --description "..." |
| Similar to existing record | Use --relates-to <domain>:<id> or --supersedes; run mulch search "..." first |
| Broadly applicable pattern | Promote to CLAUDE.md, AGENTS.md, SOUL.md, TOOLS.md; use mulch onboard for snippets |
| Session start (project has .mulch/) | Run mulch prime to load expertise into context |
Install (optional; npx works without install):
npm install -g mulch-cli
# or: npx mulch-cli <command>
Initialize in project:
mulch init
# Quick: add all preset domains at once
cat config/domains.json | jq -r '.domains[].name' | xargs -I {} mulch add {}
# Or add individually:
mulch add api
mulch add database
mulch add testing
# add domains that match your areas: frontend, backend, infra, docs, config
Provider hooks (remind agent to record):
mulch setup cursor # or: claude, codex, gemini, windsurf, aider
Onboarding snippet for AGENTS.md/CLAUDE.md:
mulch onboard
| Type | Required | Use Case |
|---|---|---|
failure | description, resolution | What went wrong and how to avoid it |
convention | content | "Use pnpm not npm"; "Always WAL mode for SQLite" |
pattern | name, description | Named patterns, optional --file |
decision | title, rationale | Architecture, tech choices, feature tracking |
reference | name, description | Key files, endpoints, resources |
guide | name, description | Step-by-step procedures |
Optional on any record: --classification (foundational | tactical | observational), --tags, --relates-to, --supersedes, --evidence-commit, --evidence-file, --outcome-status (success | failure).
.mulch/ exists, run mulch prime (or mulch prime <domain> for focus).mulch record <domain> --type <type> ....mulch record.mulch onboard to generate snippets.mulch status or mulch query --all.mulch learn to get domain suggestions from changed files.api, database, testing, frontend, backend, infra, docs, config.mulch search "keyword" or mulch query <domain>.mulch record ... --relates-to <domain>:<id> or --supersedes <domain>:<id>.For candidates from the simplify-and-harden skill:
pattern_key as a stable tag: mulch record <domain> --type pattern --name "<pattern_key>" --description "..." --tags "simplify-and-harden".mulch search "<pattern_key>"; if found, use --relates-to or add to existing via mulch edit if needed.mulch status, mulch ready --since 7d, mulch query --all.mulch prune for stale tactical/observational entries if desired; mulch doctor --fix for health.| Learning Type | Promote To |
|---|---|
| Behavioral patterns | SOUL.md (OpenClaw workspace) |
| Workflow improvements | AGENTS.md |
| Tool gotchas | TOOLS.md (OpenClaw workspace) |
| Project facts, conventions | CLAUDE.md |
| Copilot context | .github/copilot-instructions.md |
Use mulch onboard to generate AGENTS.md/CLAUDE.md snippets.
Record when you notice:
OpenClaw injects workspace files; use Mulch for learnings.
clawdhub install self-improving-agent
# or: git clone ... ~/.openclaw/skills/self-improving-agent
mulch prime when the project (or workspace) has .mulch/. Optionally add mulch prime output to workspace context if your setup supports it.mulch record from the project or workspace directory that contains .mulch/.~/.openclaw/workspace/; add promoted rules there.cp -r hooks/openclaw ~/.openclaw/hooks/self-improvement
openclaw hooks enable self-improvement
See references/openclaw-integration.md.
mulch init and mulch add <domain> as needed.mulch setup <provider> (cursor, claude, codex, etc.) for hooks.mulch onboard and paste the snippet into your agent docs.Mulch is safe for concurrent use: advisory file locking, atomic writes, and merge=union in .gitattributes for JSONL. Multiple agents can run mulch prime and mulch record in parallel; locks serialize writes per domain.
When a Mulch record is valuable as a reusable skill:
mulch query <domain> or mulch search "...".skills/<skill-name>/SKILL.md (template in assets/SKILL-TEMPLATE.md).mulch edit) that it was promoted to a skill.api domain for all API-related learnings.--relates-to, --supersedes.This skill does not use .learnings/ or markdown log files. All learnings live in .mulch/ and are recorded via the Mulch CLI. If you see references to .learnings/ in older docs, treat them as superseded by Mulch.