npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zhushanwen/pi-goal

v0.14.10

Published

Codex-style /goal command for Pi — persistent goal-driven autonomous loop with evidence-based completion, token budget, agent-reported blocking, and steering templates.

Downloads

2,776

Readme

goal

Codex 风格的 /goal 命令 — 持久目标追踪:goal_control 工具创建/完成/阻塞目标,完成需逐条对照 successCriteria 的证据验证,仅 token 维度预算。

功能

  • 目标管理:goal_control tool 是唯一创建入口(create / complete / report_blocked)。/goal <objective> 是提示词触发器——不直接启动,而是引导 AI 调 goal_control create(slug / objective / successCriteria 均由 AI 在 toolcall 时决定)
  • 证据验证:complete 必须提供具体 evidence(改动的文件、通过的测试、运行的命令),且满足 create 时定义的每条 successCriteria 条件,不能空口完成
  • 预算控制:仅 token 维度预算(耗时仅记账显示,不作预算维度)。70% 预警、90% 发收尾 steering、100% 且已发收尾提示后进入 budget_limited 终态。默认不设预算,仅在用户显式要求时设置
  • 阻塞处理:无自动检测——blocked 只能由 agent 主动调 goal_control report_blocked(穷尽替代方案后);用户经 /goal resume 恢复(paused/blocked → active)
  • 持久化:状态通过 session entries 保存(append-only),重启后从最新一条 goal-state entry 恢复,崩溃后保持原状态

状态机

6 态:active / paused / blocked / complete / budget_limited / cancelled。 complete / budget_limited / cancelled 为终态(不可逆)。

安装

# symlink 方式(开发推荐;globalExtDir 平铺布局,目标不带分组层)
ln -s /path/to/taiji/extensions/universal/goal \
      ~/.pi/agent/extensions/goal

# npm 方式(正式)
pi install npm:@zhushanwen/pi-goal

使用

/goal 修复项目中所有失败的测试
/goal 实现用户认证功能 --tokens 500000
/goal status      # 查看进度(criteria 逐条编号显示)
/goal resume      # 恢复(paused/blocked → active)
/goal pause       # 暂停(active → paused)
/goal update <new-objective> [--criteria <a;b;c>]   # 重塑目标
/goal history     # 查看历史 goal
/goal clear       # 清除(→ cancelled)

文件结构

goal/
├── index.ts            # 入口 — re-export src/index.ts
└── src/
    ├── index.ts        # 工厂入口(注册 command/tool/events + goalInit slot,全部委托 adapters)
    ├── commands.ts     # /goal 命令参数解析(识别 --tokens / --criteria flag)
    ├── constants.ts    # 语义常量
    ├── ports.ts        # Pi 能力抽象(Persistence/Ui/Messaging/Session)
    ├── service.ts      # 协调层 — createGoal / finalizeAndPersist / applyEvent
    ├── persistence.ts  # serialize/deserialize + GoalHistoryEntry
    ├── session.ts      # 运行时句柄 + 状态重建(append-only 只读最新一条,无 entry GC)
    ├── engine/         # 零 Pi 依赖的纯状态机(goal/budget/types/liveness)
    ├── adapters/       # Pi 桥接(goal-control-adapter / command-adapter / ports /
    │                   #   success-criteria + event-handlers/)
    └── projection/     # 渲染(widget / prompts / gui)