Skip to content

runanshao/Grip

Repository files navigation

grip

开局抓手 · A grip on any project. Status: v0.1 — early, dogfooded on real work but not battle-tested. 抓住它,你就知道一个复杂目标该怎么拆、往哪走。 Grab it, and you know how to break any goal down — and where to go next.

grip 是一个 Claude Code 插件:一个通用的需求/问题拆解器。给它一个场景或目标("每月把云账单按团队分摊""拍 15 秒短片""自动核对运费账单"),它把问题拆成一棵带依赖、可落地、能交给执行的工作流树。

它跟普通"拆解工具"的差别不在"会拆"——而在拆完不放它走:一个独立的"师傅"会复查这棵树拆得对不对,关键处再停下来等你拍板。面向愿意用 Claude Code 的进阶玩家。

grip is a Claude Code plugin — a general-purpose goal/requirement decomposer. What sets it apart isn't that it decomposes (base models do that) — it's that it won't let the decomposition walk away unchecked: an independent critic reviews the tree, and it stops for your sign-off at the moments that matter.


它怎么运转 · How it works

你给一个目标
   │
   ▼
①拒拆检查 → ②目标体检(防XY问题) → ③逼问情境(最重要,不锁定不开拆)
   │
   ▼
④场景共建 + 定义成功标准(DoD) + 点破拆解角度(教学)
   │
   ▼
⑤拆成带依赖的工作流树(每个叶子: 完成标准 / 执行标注 / 可执行叶子配提示词)
   │
   ▼
⑥资源现实核对 ──► ⑦独立师傅(critic)复查 ──打回──┐
   │                        │                    │
   │                        └──最多2轮──◄─────────┘
   ▼
⑧真人拍板(暴露最没把握的3处 + 所有【需人确认】节点)
   │
   ▼
⑨产出 .md(人读) + .json(机读) ──► Python校验器/hook 确定性把关
   │
   ▼
/run 参照该文件执行(遇【需人确认】停下等人)

判断交给 LLM,把关交给 Python。 拆解、复查、判角度——是 LLM 的判断活;闸门、依赖成环、超预算、防橡皮图章——这些不能靠模型听话的事,交给 tools/validate_decomposition.py 用代码兜死。

组件 是什么 干什么
/grip 命令 (徒弟) 主交互流程 逼问情境 → 共建场景 → 拆树 → 送审 → 等你拍板
decomposition-critic (机器师傅) 只读子 agent 用 13 条质量标准独立复查,发现缺陷打回
validate_decomposition.py (闸门) 确定性校验器 闸门 / 成环 / 超预算 / schema / 防橡皮图章

越用越准(最小学习回路):每轮 critic 抓到的通用缺陷,会被沉淀进项目里的 docs/decompositions/_lessons.md;下一轮复查时,师傅把这些历史教训当额外清单逐条再查。师傅因此越来越懂你这个项目反复踩的坑。这个文件是你本地私有的(不入库)。 Gets sharper with use: each generalizable defect the critic catches is appended to a local docs/decompositions/_lessons.md; on the next run the critic reads those past lessons as an extra checklist. Project-local, not committed.

看一眼真实产出 → examples/monthly-cloud-cost-allocation.md(注意第七节"师傅复查"的逐字打回→通过)。


安装 · Install

方式一:作为 Claude Code 插件(推荐)· As a plugin

把本仓库加为插件 marketplace 后安装;插件会自带 /grip 命令、decomposition-critic 子 agent,以及自动校验的 hook(hooks/hooks.json,用 ${CLAUDE_PLUGIN_ROOT} 定位,无需写死路径)。

方式二:手动拷贝 · Manual copy

把这几样拷进你项目的对应位置:

commands/grip.md                 →  <你的项目>/.claude/commands/grip.md
agents/decomposition-critic.md   →  <你的项目>/.claude/agents/decomposition-critic.md
tools/validate_decomposition.py  →  <你的项目>/tools/validate_decomposition.py

再在 .claude/settings.json 挂上 Write hook:

{
  "hooks": {
    "PostToolUse": [
      { "matcher": "Write|Edit",
        "hooks": [ { "type": "command",
          "command": "python3 \"$CLAUDE_PROJECT_DIR/tools/validate_decomposition.py\" --hook" } ] }
    ]
  }
}

Windows 用户:把命令里的 python3 改成 python(或 py)。hooks/hooks.json 同理。 Windows: replace python3 with python (or py) in the hook command and in hooks/hooks.json.

hook 在会话启动时加载——改完 settings 要新开一次会话才生效。 Hooks load at session start — open a new session after editing settings.

需要 Python 3.7+(仅标准库,零依赖)。Requires Python 3.7+ (stdlib only).


用法 · Usage

/grip 每月把云服务器账单按团队分摊出账单
/grip throw a 60th-birthday party for my mum this weekend

grip 用你输入的语言回复。完成后产出两份文件:docs/decompositions/<date>-<goal>.md(人读)和 .json(机读,给校验器/hook)。确认后交执行:/run 参照 <file> 推进

手动校验任意一棵 JSON 树 / Validate any JSON tree by hand:

python tools/validate_decomposition.py docs/decompositions/<file>.json

JSON 格式见 SCHEMA.md


测试 · Tests

python tests/run_tests.py     # 5 个用例,零依赖

诚实的边界 · Honest limits

  • grip 只拆解 + 复查,不执行/run 负责执行,且会基于这份树重新规划,不逐字照搬。 grip decomposes & reviews only; /run executes and re-plans from the tree.
  • 闸门是启发式关键词匹配,一定会漏(假阴性)。 真有财务/法律后果的动作只要换个说法或用外语,就可能测不到。它是兜底,不是保证——别拿它当真实的财务安全闸;高后果动作务必人工复核。 The gate is heuristic and WILL miss things. A consequential action phrased without the keywords slips through. It's a backstop, not a safety guarantee — human-review anything that moves money or is irreversible.
  • 防橡皮图章 / 防幻觉在提示词层面只能压制,机制强制靠 Python 校验器那层。
  • hook 在文件写入之后运行——它促模型修正,但不阻止那一次写入。 The PostToolUse hook runs after the write — it prompts a fix, it doesn't prevent the write.
  • 闸门关键词目前只覆盖中文 + 英文。其他语言暂无确定性闸门保护。 Gate keywords cover Chinese + English only; other languages get no deterministic gate yet.

License

MIT

About

开局抓手 · A Claude Code plugin that breaks any goal into a reviewed, executable workflow — with an independent critic and human gates for consequential actions.

Resources

License

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages