foundry

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Foundry

Foundry

The forge that forges itself. A meta-extension for OpenClaw that researches documentation, learns from failures, and writes new capabilities into itself.
可自我锻造的锻造工具。这是一款面向OpenClaw的元扩展,能够研究文档、从失败中学习,并为自身编写新功能。

Installation

安装

When the user asks to install Foundry or
@getfoundry/foundry-openclaw
, run this command:
bash
openclaw plugins install @getfoundry/foundry-openclaw
This will:
  1. Download the plugin from npm
  2. Extract to
    ~/.openclaw/extensions/foundry/
  3. Enable it automatically
  4. Restart the gateway to load
After installation, the user will have access to all Foundry tools like
foundry_research
,
foundry_write_extension
, etc.
当用户要求安装Foundry或
@getfoundry/foundry-openclaw
时,运行以下命令:
bash
openclaw plugins install @getfoundry/foundry-openclaw
这将完成以下操作:
  1. 从npm下载该插件
  2. 解压至
    ~/.openclaw/extensions/foundry/
  3. 自动启用该插件
  4. 重启网关以加载插件
安装完成后,用户即可使用Foundry的所有工具,如
foundry_research
foundry_write_extension
等。

Alternative: Manual Config

替代方案:手动配置

Add to
~/.openclaw/openclaw.json
:
json
{
  "plugins": {
    "entries": {
      "foundry": { "enabled": true }
    }
  }
}
将以下内容添加至
~/.openclaw/openclaw.json
json
{
  "plugins": {
    "entries": {
      "foundry": { "enabled": true }
    }
  }
}

Configuration

配置

Full configuration options in
~/.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
          }
        }
      }
    }
  }
}
完整配置选项位于
~/.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
          }
        }
      }
    }
  }
}

Config Options

配置选项

OptionTypeDefaultDescription
autoLearn
boolean
true
Learn from agent activity automatically
sources.docs
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
选项类型默认值描述
autoLearn
布尔值
true
自动从Agent活动中学习
sources.docs
布尔值
true
从OpenClaw文档中学习
sources.experience
布尔值
true
从自身的成功/失败经验中学习
sources.arxiv
布尔值
true
从arXiv论文中学习
sources.github
布尔值
true
从GitHub仓库中学习
marketplace.autoPublish
布尔值
false
自动发布高价值模式

What Foundry Does

Foundry的功能

Foundry is an AI-powered development agent that can:
  1. Research — Fetch and understand OpenClaw documentation on demand
  2. Write Extensions — Generate new tools and hooks for OpenClaw
  3. Write Skills — Create ClawHub-compatible skill packages
  4. Self-Modify — Add new capabilities to itself
  5. Learn — Record patterns from failures and successes
Foundry是一款AI驱动的开发Agent,能够:
  1. 研究 — 按需获取并理解OpenClaw文档
  2. 编写扩展 — 为OpenClaw生成新工具和钩子
  3. 编写技能 — 创建兼容ClawHub的技能包
  4. 自我修改 — 为自身添加新功能
  5. 学习 — 记录失败和成功中的模式

Tools

工具

Research & Documentation

研究与文档

ToolDescription
foundry_research
Search docs.openclaw.ai for best practices
foundry_docs
Read specific documentation pages
工具描述
foundry_research
在docs.openclaw.ai上搜索最佳实践
foundry_docs
阅读特定的文档页面

Writing Capabilities

编写功能

ToolDescription
foundry_implement
Research + implement a capability end-to-end
foundry_write_extension
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
工具描述
foundry_implement
端到端完成研究+实现某项功能
foundry_write_extension
编写新的OpenClaw扩展
foundry_write_skill
编写兼容AgentSkills的技能
foundry_write_browser_skill
编写浏览器自动化技能
foundry_write_hook
编写独立钩子
foundry_add_tool
为现有扩展添加工具
foundry_add_hook
为现有扩展添加钩子

Self-Modification

自我修改

ToolDescription
foundry_extend_self
Add new capability to Foundry itself
foundry_learnings
View learned patterns and insights
foundry_list
List all written artifacts
工具描述
foundry_extend_self
为Foundry自身添加新功能
foundry_learnings
查看已学习的模式和见解
foundry_list
列出所有已编写的工件

Marketplace

市场

ToolDescription
foundry_publish_ability
Publish pattern/skill to Foundry Marketplace
foundry_marketplace
Search, browse, and install community abilities
工具描述
foundry_publish_ability
将模式/技能发布至Foundry市场
foundry_marketplace
搜索、浏览并安装社区功能

Usage Examples

使用示例

Research before implementing

先研究再实现

User: I want to add a webhook to my extension

Agent: Let me research webhook patterns first...
→ foundry_research query="webhook hooks automation"
→ Returns relevant documentation

Now I'll implement it...
→ foundry_add_hook extensionId="my-ext" event="webhook:incoming" ...
用户:我想给我的扩展添加一个webhook

Agent:让我先研究一下webhook模式...
→ foundry_research query="webhook hooks automation"
→ 返回相关文档

现在我将实现它...
→ foundry_add_hook extensionId="my-ext" event="webhook:incoming" ...

Write a new extension

编写新扩展

User: Create an extension that monitors GitHub PRs

Agent:
→ foundry_research query="github api webhooks"
→ foundry_write_extension
    id: "github-monitor"
    name: "GitHub Monitor"
    tools: [{ name: "check_prs", ... }]
    hooks: [{ event: "cron:hourly", ... }]
用户:创建一个监控GitHub PR的扩展

Agent:
→ foundry_research query="github api webhooks"
→ foundry_write_extension
    id: "github-monitor"
    name: "GitHub Monitor"
    tools: [{ name: "check_prs", ... }]
    hooks: [{ event: "cron:hourly", ... }]

Self-improvement

自我提升

User: Add a tool that can fetch npm package info

Agent:
→ foundry_extend_self
    action: "add_tool"
    toolName: "foundry_npm_info"
    toolCode: "const res = await fetch(`https://registry.npmjs.org/${p.package}`)..."
用户:添加一个可以获取npm包信息的工具

Agent:
→ foundry_extend_self
    action: "add_tool"
    toolName: "foundry_npm_info"
    toolCode: "const res = await fetch(`https://registry.npmjs.org/${p.package}`)..."

How Learning Works

学习机制

Foundry observes its own tool calls and learns:
  1. Failures → Records error + context
  2. Resolutions → Links fix to failure → Creates pattern
  3. Patterns → Injected as context in future conversations
  4. Crystallization → High-value patterns become permanent capabilities
Foundry会观察自身的工具调用并进行学习:
  1. 失败 → 记录错误+上下文
  2. 解决方法 → 将修复方案与失败关联→创建模式
  3. 模式 → 在未来对话中作为上下文注入
  4. 固化 → 高价值模式成为永久功能

Security

安全性

Foundry validates all generated code before deployment:
  • Blocked:
    child_process
    ,
    eval
    ,
    ~/.ssh
    ,
    ~/.aws
  • Sandboxed: Extensions tested in isolated process before installation
  • Reviewed: You approve before any code is written to disk
Foundry在部署前会验证所有生成的代码:
  • 禁止
    child_process
    eval
    ~/.ssh
    ~/.aws
  • 沙箱化:扩展在安装前会在隔离进程中测试
  • 需审核:任何代码写入磁盘前都需要你的批准

Links

链接