Data Storage
CODEBLOCK0
Create on first use: INLINECODE0
Scope
This skill:
- - ✅ Runs iterative attempts toward defined success criteria
- ✅ Logs each iteration with learnings
- ✅ Exits on success, max iterations, or unrecoverable error
- ❌ NEVER makes Git commits automatically
- ❌ NEVER deploys to production
- ❌ NEVER modifies system configuration
- ❌ NEVER runs indefinitely (max 10 iterations hard limit)
Quick Reference
| Topic | File |
|---|
| Loop examples | INLINECODE1 |
| Memory between iterations |
memory.md |
Core Rules
1. Pattern
CODEBLOCK1
2. Required Setup
| Element | Required | Example |
|---|
| Task | Yes | "Fix failing tests" |
| Success criteria |
Yes | "All tests pass" |
| Max iterations | Default: 5 | Max: 10 |
| Verify command | Recommended |
npm test |
3. When to Propose
- - Task has clear success criteria but uncertain path
- Previous attempt failed but error is fixable
- User says "keep trying until..."
NOT for: One-shot tasks, undefined goals, exploratory work
4. Each Iteration
- 1. Fresh context — Only carry: task, criteria, count, learnings
- Execute — Attempt the task
- Verify — Check success criteria
- Record — Append to history: what worked, what failed
- Decide — Pass? Exit. Fail? Retry if under limit.
5. Stopping Conditions
- - ✅ Success criteria met
- ❌ Max iterations reached
- ⚠️ Unrecoverable error (missing dependency, permission denied)
6. On Failure
If max reached without success:
- - Summarize all attempts
- Identify common failure pattern
- Recommend manual intervention or different approach
7. Safety
- - Hard limit: 10 iterations maximum
- No destructive actions without explicit per-action approval
- Log everything to ~/loop/history/
数据存储
~/loop/
├── active.json # 当前正在运行的循环
├── history/ # 已完成的循环日志
│ └── {loop-id}.json
└── learnings.md # 跨循环模式总结
首次使用时创建:mkdir -p ~/loop/history
适用范围
本技能:
- - ✅ 针对定义的成功标准进行迭代尝试
- ✅ 记录每次迭代及经验教训
- ✅ 在成功、达到最大迭代次数或遇到不可恢复错误时退出
- ❌ 绝不自动提交 Git
- ❌ 绝不部署到生产环境
- ❌ 绝不修改系统配置
- ❌ 绝不无限运行(硬性限制最多10次迭代)
快速参考
memory.md |
核心规则
1. 模式
任务 + 标准 → 执行 → 验证 → [通过?退出 : 重试]
2. 必要设置
是 | 所有测试通过 |
| 最大迭代次数 | 默认:5 | 最大:10 |
| 验证命令 | 推荐 | npm test |
3. 何时提出
- - 任务有明确成功标准但路径不确定
- 上次尝试失败但错误可修复
- 用户说继续尝试直到...
不适用于: 一次性任务、未定义目标、探索性工作
4. 每次迭代
- 1. 全新上下文 — 仅携带:任务、标准、次数、经验教训
- 执行 — 尝试完成任务
- 验证 — 检查成功标准
- 记录 — 追加到历史:哪些有效、哪些失败
- 决策 — 通过?退出。失败?若未超限则重试。
5. 停止条件
- - ✅ 满足成功标准
- ❌ 达到最大迭代次数
- ⚠️ 不可恢复错误(缺少依赖、权限拒绝)
6. 失败时
若达到最大次数仍未成功:
- - 总结所有尝试
- 识别常见失败模式
- 建议手动干预或采用不同方法
7. 安全措施
- - 硬性限制:最多10次迭代
- 未经明确逐项批准,不得执行破坏性操作
- 将所有内容记录到 ~/loop/history/