Foundry
The forge that forges itself. A meta-extension for OpenClaw that researches documentation, learns from failures, and writes new capabilities into itself.
Installation
When the user asks to install Foundry or @getfoundry/foundry-openclaw, run this command:
CODEBLOCK0
This will:
- 1. Download the plugin from npm
- Extract to INLINECODE1
- Enable it automatically
- Restart the gateway to load
After installation, the user will have access to all Foundry tools like foundry_research, foundry_write_extension, etc.
Alternative: Manual Config
Add to ~/.openclaw/openclaw.json:
CODEBLOCK1
Configuration
Full configuration options in ~/.openclaw/openclaw.json:
CODEBLOCK2
Config Options
| Option | Type | Default | Description |
|---|
| INLINECODE6 | boolean | INLINECODE7 | Learn from agent activity automatically |
| INLINECODE8 |
boolean |
true | Learn from OpenClaw documentation |
|
sources.experience | boolean |
true | Learn from own successes/failures |
|
sources.arxiv | boolean |
true | Learn from arXiv papers |
|
sources.github | boolean |
true | Learn from GitHub repos |
|
marketplace.autoPublish | boolean |
false | Auto-publish high-value patterns |
What Foundry Does
Foundry is an AI-powered development agent that can:
- 1. Research — Fetch and understand OpenClaw documentation on demand
- Write Extensions — Generate new tools and hooks for OpenClaw
- Write Skills — Create ClawHub-compatible skill packages
- Self-Modify — Add new capabilities to itself
- Learn — Record patterns from failures and successes
Tools
Research & Documentation
| Tool | Description |
|---|
| INLINECODE18 | Search docs.openclaw.ai for best practices |
| INLINECODE19 |
Read specific documentation pages |
Writing Capabilities
| Tool | Description |
|---|
| INLINECODE20 | Research + implement a capability end-to-end |
| INLINECODE21 |
Write a new OpenClaw extension |
|
foundry_write_skill | Write an AgentSkills-compatible skill |
|
foundry_write_browser_skill | Write a browser automation skill |
|
foundry_write_hook | Write a standalone hook |
|
foundry_add_tool | Add a tool to an existing extension |
|
foundry_add_hook | Add a hook to an existing extension |
Self-Modification
| Tool | Description |
|---|
| INLINECODE27 | Add new capability to Foundry itself |
| INLINECODE28 |
View learned patterns and insights |
|
foundry_list | List all written artifacts |
Marketplace
| Tool | Description |
|---|
| INLINECODE30 | Publish pattern/skill to Foundry Marketplace |
| INLINECODE31 |
Search, browse, and install community abilities |
Usage Examples
Research before implementing
CODEBLOCK3
Write a new extension
CODEBLOCK4
Self-improvement
CODEBLOCK5
How Learning Works
Foundry observes its own tool calls and learns:
- 1. Failures → Records error + context
- Resolutions → Links fix to failure → Creates pattern
- Patterns → Injected as context in future conversations
- Crystallization → High-value patterns become permanent capabilities
Security
Foundry validates all generated code before deployment:
- - Blocked:
child_process, eval, ~/.ssh, INLINECODE35 - Sandboxed: Extensions tested in isolated process before installation
- Reviewed: You approve before any code is written to disk
Links
Foundry
自我锻造的熔炉。 一个用于OpenClaw的元扩展,能够研究文档、从失败中学习,并将新能力写入自身。
安装
当用户要求安装Foundry或@getfoundry/foundry-openclaw时,运行以下命令:
bash
openclaw plugins install @getfoundry/foundry-openclaw
这将:
- 1. 从npm下载插件
- 解压到~/.openclaw/extensions/foundry/
- 自动启用它
- 重启网关以加载
安装完成后,用户将可以使用所有Foundry工具,如foundryresearch、foundrywrite_extension等。
替代方案:手动配置
添加到~/.openclaw/openclaw.json:
json
{
plugins: {
entries: {
foundry: { enabled: true }
}
}
}
配置
~/.openclaw/openclaw.json中的完整配置选项:
json
{
plugins: {
entries: {
foundry: {
enabled: true,
source: github:lekt9/openclaw-foundry,
config: {
autoLearn: true,
sources: {
docs: true,
experience: true,
arxiv: true,
github: true
},
marketplace: {
autoPublish: false
}
}
}
}
}
}
配置选项
| 选项 | 类型 | 默认值 | 描述 |
|---|
| autoLearn | 布尔值 | true | 自动从代理活动中学习 |
| sources.docs |
布尔值 | true | 从OpenClaw文档中学习 |
| sources.experience | 布尔值 | true | 从自身成功/失败中学习 |
| sources.arxiv | 布尔值 | true | 从arXiv论文中学习 |
| sources.github | 布尔值 | true | 从GitHub仓库中学习 |
| marketplace.autoPublish | 布尔值 | false | 自动发布高价值模式 |
Foundry的功能
Foundry是一个由AI驱动的开发代理,能够:
- 1. 研究 — 按需获取并理解OpenClaw文档
- 编写扩展 — 为OpenClaw生成新工具和钩子
- 编写技能 — 创建兼容ClawHub的技能包
- 自我修改 — 为自身添加新能力
- 学习 — 从失败和成功中记录模式
工具
研究与文档
| 工具 | 描述 |
|---|
| foundryresearch | 搜索docs.openclaw.ai以获取最佳实践 |
| foundrydocs |
读取特定文档页面 |
编写能力
| 工具 | 描述 |
|---|
| foundryimplement | 端到端研究并实现一项能力 |
| foundrywrite_extension |
编写一个新的OpenClaw扩展 |
| foundry
writeskill | 编写一个兼容AgentSkills的技能 |
| foundry
writebrowser_skill | 编写一个浏览器自动化技能 |
| foundry
writehook | 编写一个独立的钩子 |
| foundry
addtool | 向现有扩展添加一个工具 |
| foundry
addhook | 向现有扩展添加一个钩子 |
自我修改
| 工具 | 描述 |
|---|
| foundryextendself | 为Foundry自身添加新能力 |
| foundry_learnings |
查看已学习的模式和见解 |
| foundry_list | 列出所有已编写的工件 |
市场
| 工具 | 描述 |
|---|
| foundrypublishability | 将模式/技能发布到Foundry市场 |
| foundry_marketplace |
搜索、浏览和安装社区能力 |
使用示例
实现前进行研究
用户:我想给我的扩展添加一个webhook
代理:让我先研究webhook模式...
→ foundry_research query=webhook hooks automation
→ 返回相关文档
现在我来实现它...
→ foundryaddhook extensionId=my-ext event=webhook:incoming ...
编写新扩展
用户:创建一个监控GitHub PR的扩展
代理:
→ foundry_research query=github api webhooks
→ foundrywriteextension
id: github-monitor
name: GitHub Monitor
tools: [{ name: check_prs, ... }]
hooks: [{ event: cron:hourly, ... }]
自我改进
用户:添加一个可以获取npm包信息的工具
代理:
→ foundryextendself
action: add_tool
toolName: foundrynpminfo
toolCode: const res = await fetch(https://registry.npmjs.org/${p.package})...
学习机制
Foundry观察自身的工具调用并进行学习:
- 1. 失败 → 记录错误及上下文
- 解决方案 → 将修复与失败关联 → 创建模式
- 模式 → 在未来的对话中作为上下文注入
- 结晶 → 高价值模式成为永久能力
安全性
Foundry在部署前验证所有生成的代码:
- - 禁止:child_process、eval、~/.ssh、~/.aws
- 沙盒化:扩展在安装前于隔离进程中测试
- 审核:任何代码写入磁盘前需经您批准
链接