ClawSkills logoClawSkills

Ai Compound 1.0.1

让您的 AI 代理自动学习和改进。回顾会话、提取经验、更新记忆文件并随时间积累知识。可设置夜间运行。

介绍

# Compound Engineering

让你的 AI 代理自动学习。从会话中提取经验,更新记忆文件,并随着时间的推移积累知识。

**核心思想**:你的代理审视自己的工作,提取模式和教训,并更新其指令。明天的代理比今天的更聪明。

---

## 快速开始

```bash # Review last 24 hours and update memory npx compound-engineering review

# Create hourly memory snapshot npx compound-engineering snapshot

# Set up automated nightly review (cron) npx compound-engineering setup-cron ```

---

## 工作原理

### 复合循环

``` ┌─────────────────────────────────────────┐ │ DAILY WORK │ │ Sessions, chats, tasks, decisions │ └────────────────┬────────────────────────┘ │ ▼ ┌─────────────────────────────────────────┐ │ NIGHTLY REVIEW (10:30 PM) │ │ • Scan all sessions from last 24h │ │ • Extract learnings and patterns │ │ • Update MEMORY.md and AGENTS.md │ │ • Commit and push changes │ └────────────────┬────────────────────────┘ │ ▼ ┌─────────────────────────────────────────┐ │ NEXT DAY │ │ Agent reads updated instructions │ │ Benefits from yesterday's learnings │ └─────────────────────────────────────────┘ ```

### 提取内容

- **模式**:行之有效的重复方法 - **陷阱**:失败或导致问题的事项 - **偏好**:发现的用户偏好 - **决策**:关键决策及其理由 - **待办事项**:需要记住的未完成项目

---

## Clawdbot 集成

### 自动每小时记忆

添加到你的 `HEARTBEAT.md`:

```markdown # Hourly Memory Snapshot Every hour, append a brief summary to memory/YYYY-MM-DD.md: - What was accomplished - Key decisions made - Anything to remember ```

或者使用 cron:

```bash # Add to clawdbot config or crontab 0 * * * * clawdbot cron run compound-hourly ```

### 每日回顾任务

将此 cron 任务添加到 Clawdbot:

```json { "id": "compound-nightly", "schedule": "30 22 * * *", "text": "Review all sessions from the last 24 hours. For each session, extract: 1) Key learnings and patterns, 2) Mistakes or gotchas to avoid, 3) User preferences discovered, 4) Unfinished items. Update MEMORY.md with a summary. Update memory/YYYY-MM-DD.md with details. Commit changes to git." } ```

---

## 手动回顾命令

当你想要手动触发回顾时:

``` Review the last 24 hours of work. Extract:

1. **Patterns that worked** - approaches to repeat 2. **Gotchas encountered** - things to avoid 3. **Preferences learned** - user likes/dislikes 4. **Key decisions** - and their reasoning 5. **Open items** - unfinished work

Update: - MEMORY.md with significant long-term learnings - memory/YYYY-MM-DD.md with today's details - AGENTS.md if workflow changes needed

Commit changes with message "compound: daily review YYYY-MM-DD" ```

---

## 记忆文件结构

### MEMORY.md(长期)

```markdown # Long-Term Memory

## Patterns That Work - When doing X, always Y first - User prefers Z approach for...

## Gotchas to Avoid - Don't do X without checking Y - API Z has rate limit of...

## User Preferences - Prefers concise responses - Timezone: PST - ...

## Project Context - Main repo at /path/to/project - Deploy process is... ```

### memory/YYYY-MM-DD.md(每日)

```markdown # 2026-01-28 (Tuesday)

## Sessions - 09:00 - Built security audit tool - 14:00 - Published 40 skills to MoltHub

## Decisions - Chose to batch publish in parallel (5 sub-agents) - Security tool covers 6 check categories

## Learnings - ClawdHub publish can timeout, retry with new version - npm publish hangs sometimes, may need to retry

## Open Items - [ ] Finish remaining MoltHub uploads - [ ] Set up analytics tracker ```

---

## 每小时快照

为了更细粒度的记忆,创建每小时快照:

```bash # Creates memory/YYYY-MM-DD-HH.md every hour */60 * * * * echo "## $(date +%H):00 Snapshot" >> ~/clawd/memory/$(date +%Y-%m-%d).md ```

或者让代理通过心跳检查时间并追加到每日文件来实现。

---

## 复合效应

**第 1 周**:代理掌握基础知识 **第 2 周**:代理记住你的偏好 **第 4 周**:代理预判你的需求 **第 2 个月**:代理成为你工作流的专家

知识会复合。每一次会话都会让未来的会话变得更好。

---

## 设置脚本

### 每日回顾 (launchd - macOS)

```xml <!-- ~/Library/LaunchAgents/com.clawdbot.compound-review.plist --> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "..."> <plist version="1.0"> <dict> <key>Label</key> <string>com.clawdbot.compound-review</string> <key>ProgramArguments</key> <array> <string>/opt/homebrew/bin/clawdbot</string> <string>cron</string> <string>run</string> <string>compound-nightly</string> </array> <key>StartCalendarInterval</key> <dict> <key>Hour</key> <integer>22</integer> <key>Minute</key> <integer>30</integer> </dict> </dict> </plist> ```

### 每小时记忆 (crontab)

```bash # Add with: crontab -e 0 * * * * /opt/homebrew/bin/clawdbot cron run compound-hourly 2>&1 >> ~/clawd/logs/compound.log ```

---

## 最佳实践

1. **睡前回顾** - 让每日任务在一天结束时运行 2. **不要过度提取** - 关注重要的学习内容,而非噪音 3. **定期修剪** - 每月从 MEMORY.md 中移除过时信息 4. **Git 管理一切** - 记忆文件应进行版本控制 5. **相信复合效应** - 起初效果微妙,但随着时间推移效果显著

---

由 **LXGIC Studios** 构建 - [@lxgicstudios](https://x.com/lxgicstudios)

---

**Built by LXGIC Studios**

- GitHub: [github.com/lxgicstudios/ai-compound](https://github.com/lxgicstudios/ai-compound) - Twitter: [@lxgicstudios](https://x.com/lxgicstudios)

更多产品