Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Enable an AI agent to iteratively improve its own skills and instructions based on task feedback.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/openclaw-integration.md
1# OpenClaw Integration23Complete setup and usage guide for integrating the self-improvement skill with OpenClaw.45## Overview67OpenClaw uses workspace-based prompt injection combined with event-driven hooks. Context is injected from workspace files at session start, and hooks can trigger on lifecycle events.89## Workspace Structure1011```12~/.openclaw/13├── workspace/ # Working directory14│ ├── AGENTS.md # Multi-agent coordination patterns15│ ├── SOUL.md # Behavioral guidelines and personality16│ ├── TOOLS.md # Tool capabilities and gotchas17│ ├── MEMORY.md # Long-term memory (main session only)18│ └── memory/ # Daily memory files19│ └── YYYY-MM-DD.md20├── skills/ # Installed skills21│ └── <skill-name>/22│ └── SKILL.md23└── hooks/ # Custom hooks24└── <hook-name>/25├── HOOK.md26└── handler.ts27```2829## Quick Setup3031### 1. Install the Skill3233```bash34clawdhub install self-improving-agent35```3637Or copy manually:3839```bash40cp -r self-improving-agent ~/.openclaw/skills/41```4243### 2. Install the Hook (Optional)4445Copy the hook to OpenClaw's hooks directory:4647```bash48cp -r hooks/openclaw ~/.openclaw/hooks/self-improvement49```5051Enable the hook:5253```bash54openclaw hooks enable self-improvement55```5657### 3. Create Learning Files5859Create the `.learnings/` directory in your workspace:6061```bash62mkdir -p ~/.openclaw/workspace/.learnings63```6465Or in the skill directory:6667```bash68mkdir -p ~/.openclaw/skills/self-improving-agent/.learnings69```7071## Injected Prompt Files7273### AGENTS.md7475Purpose: Multi-agent workflows and delegation patterns.7677```markdown78# Agent Coordination7980## Delegation Rules81- Use explore agent for open-ended codebase questions82- Spawn sub-agents for long-running tasks83- Use sessions_send for cross-session communication8485## Session Handoff86When delegating to another session:871. Provide full context in the handoff message882. Include relevant file paths893. Specify expected output format90```9192### SOUL.md9394Purpose: Behavioral guidelines and communication style.9596```markdown97# Behavioral Guidelines9899## Communication Style100- Be direct and concise101- Avoid unnecessary caveats and disclaimers102- Use technical language appropriate to context103104## Error Handling105- Admit mistakes promptly106- Provide corrected information immediately107- Log significant errors to learnings108```109110### TOOLS.md111112Purpose: Tool capabilities, integration gotchas, local configuration.113114```markdown115# Tool Knowledge116117## Self-Improvement Skill118Log learnings to `.learnings/` for continuous improvement.119120## Local Tools121- Document tool-specific gotchas here122- Note authentication requirements123- Track integration quirks124```125126## Learning Workflow127128### Capturing Learnings1291301. **In-session**: Log to `.learnings/` as usual1312. **Cross-session**: Promote to workspace files132133### Promotion Decision Tree134135```136Is the learning project-specific?137├── Yes → Keep in .learnings/138└── No → Is it behavioral/style-related?139├── Yes → Promote to SOUL.md140└── No → Is it tool-related?141├── Yes → Promote to TOOLS.md142└── No → Promote to AGENTS.md (workflow)143```144145### Promotion Format Examples146147**From learning:**148> Git push to GitHub fails without auth configured - triggers desktop prompt149150**To TOOLS.md:**151```markdown152## Git153- Don't push without confirming auth is configured154- Use `gh auth status` to check GitHub CLI auth155```156157## Inter-Agent Communication158159OpenClaw provides tools for cross-session communication:160161Use these only when cross-session sharing is explicitly needed and the environment is trusted. Prefer short sanitized summaries over raw transcripts, command output, or secret-bearing content.162163### sessions_list164165View active and recent sessions:166```167sessions_list(activeMinutes=30, messageLimit=3)168```169170### sessions_history171172Read transcript from another session:173```174sessions_history(sessionKey="session-id", limit=50)175```176177Only read another session's transcript when the user explicitly wants shared context or continuation across sessions.178179### sessions_send180181Send message to another session:182```183sessions_send(sessionKey="session-id", message="Learning: API requires X-Custom-Header")184```185186Prefer sending a concise learning summary plus relevant paths rather than forwarding raw transcript content.187188### sessions_spawn189190Spawn a background sub-agent:191```192sessions_spawn(task="Research X and report back", label="research")193```194195## Available Hook Events196197| Event | When It Fires |198|-------|---------------|199| `agent:bootstrap` | Before workspace files inject |200| `command:new` | When `/new` command issued |201| `command:reset` | When `/reset` command issued |202| `command:stop` | When `/stop` command issued |203| `gateway:startup` | When gateway starts |204205## Detection Triggers206207### Standard Triggers208- User corrections ("No, that's wrong...")209- Command failures (non-zero exit codes)210- API errors211- Knowledge gaps212213### OpenClaw-Specific Triggers214215| Trigger | Action |216|---------|--------|217| Tool call error | Log to TOOLS.md with tool name |218| Session handoff confusion | Log to AGENTS.md with delegation pattern |219| Model behavior surprise | Log to SOUL.md with expected vs actual |220| Skill issue | Log to .learnings/ or report upstream |221222## Verification223224Check hook is registered:225226```bash227openclaw hooks list228```229230Check skill is loaded:231232```bash233openclaw status234```235236## Troubleshooting237238### Hook not firing2392401. Ensure hooks enabled in config2412. Restart gateway after config changes2423. Check gateway logs for errors243244### Learnings not persisting2452461. Verify `.learnings/` directory exists2472. Check file permissions2483. Ensure workspace path is configured correctly249250### Skill not loading2512521. Check skill is in skills directory2532. Verify SKILL.md has correct frontmatter2543. Run `openclaw status` to see loaded skills255