@zhushanwen/pi-goal
Codex-style /goal command for Pi — persistent goal-driven autonomous loop with evidence-based completion, token/time budgets, blocked detection, and steering templates.
Package details
Install @zhushanwen/pi-goal from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@zhushanwen/pi-goal- Package
@zhushanwen/pi-goal- Version
0.1.1- Published
- Jun 2, 2026
- Downloads
- not available
- Author
- zhushanwen321
- License
- MIT
- Types
- extension
- Size
- 85.3 KB
- Dependencies
- 0 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"./src/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
goal
Codex 风格的 /goal 命令 — 持久目标驱动自主循环,支持任务追踪、证据验证、Token/时间预算、阻塞检测。
功能
- 自主循环:
/goal <目标>启动后,AI 自动拆分任务并持续执行 - 证据验证:完成任务必须提供具体证据,不能空口完成
- 预算控制:Token 和时间双预算,70% 预警、90% 收尾、100% 终止
- 阻塞检测:连续无进展自动阻塞,用户可手动 resume
- 持久化:状态通过 session entries 保存,重启后自动恢复
安装
# symlink 方式(开发推荐)
ln -s /path/to/xyz-pi-extensions-workspace/main/packages/goal \
~/.pi/agent/extensions/goal
# npm 方式(正式)
pi install npm:@zhushanwen/pi-goal
使用
/goal 修复项目中所有失败的测试
/goal 实现用户认证功能 --tokens 500000 --timeout 30
/goal status # 查看进度
/goal pause # 暂停
/goal resume # 恢复
/goal clear # 清除
文件结构
goal/
├── index.ts
└── src/
├── index.ts # 入口 — 命令、事件、工具注册
├── state.ts # 状态机(6 态)
├── commands.ts # 命令参数解析
├── templates.ts # Steering prompt 模板
├── tool-handler.ts# goal_manager 工具处理
├── budget.ts # 预算计算
├── constants.ts # 常量
└── widget.ts # TUI 状态栏渲染