OpenClaw Integration——模具行业从业者必备知识手册
-
<h2>OpenClaw Integration</h2>
<p>Complete setup and usage guide for integrating the self-improvement skill with OpenClaw.</p>
<h3>Overview</h3>
<p>OpenClaw 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.</p>
<h3>Workspace Structure</h3>
<pre><code>
~/.openclaw/
├── workspace/ # Working directory
│ ├── AGENTS.md # Multi-agent coordination patterns
│ ├── SOUL.md # Behavioral guidelines and personality
│ ├── TOOLS.md # Tool capabilities and gotchas
│ ├── MEMORY.md # Long-term memory (main session only)
│ └── memory/ # Daily memory files
│ └── YYYY-MM-DD.md
├── skills/ # Installed skills
│ └── <skill-name>/
│ └── SKILL.md
└── hooks/ # Custom hooks
└── <hook-name>/
├── HOOK.md
└── handler.ts
</code></pre><h3>Quick Setup</h3>
<h4>1. Install the Skill</h4>
<pre><code>
clawdhub install self-improving-agent
</code></pre><p>Or copy manually:</p>
<pre><code>
cp -r self-improving-agent ~/.openclaw/skills/
</code></pre><h4>2. Install the Hook (Optional)</h4>
<p>Copy the hook to OpenClaw's hooks directory:</p>
<pre><code>
cp -r hooks/openclaw ~/.openclaw/hooks/self-improvement
</code></pre><p>Enable the hook:</p>
<pre><code>
openclaw hooks enable self-improvement
</code></pre><h4>3. Create Learning Files</h4>
<p>Create the <code>.learnings/</code> directory in your workspace:</p>
<pre><code>
mkdir -p ~/.openclaw/workspace/.learnings
</code></pre><p>Or in the skill directory:</p>
<pre><code>
mkdir -p ~/.openclaw/skills/self-improving-agent/.learnings
</code></pre><h3>Injected Prompt Files</h3>
<h4>AGENTS.md</h4>
<p>Purpose: Multi-agent workflows and delegation patterns.</p>
<pre><code>
Agent Coordination
Delegation Rules
- Use explore agent for open-ended codebase questions
- Spawn sub-agents for long-running tasks
- Use sessions_send for cross-session communication
Session Handoff
When delegating to another session:
- Provide full context in the handoff message
- Include relevant file paths
- Specify expected output format
</code></pre>
<h4>SOUL.md</h4>
<p>Purpose: Behavioral guidelines and communication style.</p>
<pre><code>
Behavioral Guidelines
Communication Style
- Be direct and concise
- Avoid unnecessary caveats and disclaimers
- Use technical language appropriate to context
Error Handling
- Admit mistakes promptly
- Provide corrected information immediately
- Log significant errors to learnings
</code></pre>
<h4>TOOLS.md</h4>
<p>Purpose: Tool capabilities, integration gotchas, local configuration.</p>
<pre><code>
Tool Knowledge
Self-Improvement Skill
Log learnings to
.learnings/for continuous improvement.Local Tools
- Document tool-specific gotchas here
- Note authentication requirements
- Track integration quirks
</code></pre>
<h3>Learning Workflow</h3>
<h4>Capturing Learnings</h4>
<ol>
<li><strong>In-session</strong>: Log to <code>.learnings/</code> as usual</li>
<li><strong>Cross-session</strong>: Promote to workspace files</li>
</ol><h4>Promotion Decision Tree</h4>
<pre><code>
Is the learning project-specific?
├── Yes → Keep in .learnings/
└── No → Is it behavioral/style-related?
├── Yes → Promote to SOUL.md
└── No → Is it tool-related?
├── Yes → Promote to TOOLS.md
└── No → Promote to AGENTS.md (workflow)
</code></pre><h4>Promotion Format Examples</h4>
<p><strong>From learning:</strong></p>
<blockquote>
<p>Git push to GitHub fails without auth configured - triggers desktop prompt</p>
</blockquote><p><strong>To TOOLS.md:</strong></p>
<pre><code>Git
- Don't push without confirming auth is configured
- Use
gh auth statusto check GitHub CLI a
你在实际生产中遇到过类似问题吗?欢迎留言讨论。
</code></pre>