
rashomon 推出 AutoSteer for Claude Code,编码前为智能体补充仓库上下文
来源标题:AutoSteer for Claude Code
AutoSteer 是 rashomon 推出的 Claude Code 引导层:在智能体动手前,把仓库中与请求所涉文件相关的信息交给它,并在回合结束时告知最后一次编辑后测试或构建是否通过。它不会阻塞智能体,记录只保存在本机文件夹,不发起任何网络连接。运行需 Claude Code 2.1.280 以上、macOS 或 Linux、Go 1.25 以上。
以下正文由 AI 翻译自 Hacker News 最新(原文版权归原站所有),可能存在偏差,重要内容请以原文为准。
AutoSteer for Claude Code:在 agent 动手写之前先给它交代背景,写完之后再检查结果。 AutoSteer 会把你的仓库里已经知道的、与一次请求所涉及文件相关的信息交给你的 Claude Code agent,并在回合结束时告诉你最后一次编辑之后测试或构建是否通过。 它从不阻塞 agent。记录就是你机器上的一个文件夹;rashomon 不会把它发送到任何地方,也不建立网络连接。它给 agent 的提示会成为对话的一部分,就像 agent 读到的其他任何内容一样。 AutoSteer 是 rashomon 的引导层,也是这个项目的前进方向。编码 agent 读写代码的能力不错,但在大型代码库里它们会漏掉一些东西:另一个包里的调用方、本该复用的辅助函数、团队去年定下的约定。 AutoSteer 的目标就是掌握这些信息,并把对眼前任务真正重要的部分交给 agent: 这个循环是:了解项目、理解任务、给 agent 交代背景、记录它的操作、验证结果、更新已知信息。 需要 Claude Code 2.1.280 或更高版本、macOS 或 Linux,以及 Go 1.25 或更高版本。在终端中执行,不要在 Claude Code 会话内: curl -fsSL https://raw.githubusercontent.com/altrace-dev-role/rashomon/main/install.sh | sh rashomon watch 这会安装最新发行版 v1.0-AutoSteer。如果想改为从 main 构建(可能比发行版更新): go install github.com/altrace-dev-role/rashomon/cmd/rashomon@main rashomon watch go install 会把 rashomon 放进 $(go env GOPATH)/bin,该目录必须在你的 PATH 中。watch 会显示安装会做什么,并询问 Install? [y/N];回答 y,然后照常使用 claude。 当请求中提到项目里的某个文件时,rashomon 给 agent 的提示会显示在你的回复上方。对于“试一试”中的那个请求: ※ rashomon told the agent: "rashomon record: preflight for this request from the repository; the request text is not kept. paths named: 'internal/parse/lexer.go' spec rules that apply: none gates before done: none; evidence for a done claim (inferred from the request): judgment_disclosed unknown: no spec found; no gate history for this project" 在编辑了文件、或运行了测试或构建的回合结束时: ※ rashomon: verified - go test passed after the last edit. → rashomon report --session <id> 当 agent 声称完成,且最后一次编辑之后没有运行任何测试或构建时: ※ rashomon: done was claimed; the record shows 1 file edited, no test or build run after the last edit. → rashomon report --session <id> mkdir -p /tmp/rk-try/internal/parse && cd /tmp/rk-try printf 'module example.com/rktry\n\ngo 1.25\n' > go.mod printf 'package parse\n' > internal/parse/lexer.go 运行 claude,接受文件夹信任提示,然后发送 fix the zebracornflake check in internal/parse/lexer.go; reply in one sentence and run no tools. 上面显示的那条提示会出现在回复之前。 输入 /exit,然后检查除了路径之外,请求里的任何词都没有被保留。下面这条命令只会打印 grep exit=1: grep -rl zebracornflake "$(rashomon status | sed -n 's/^store: //p')"; echo "grep exit=$?" 测量留出组是可选加入的:除非你设置 RASHOMON_HOLDOUT=on,或者某个受信任的 spec 带有 holdout 对象,否则它是关闭的。环境中设置了 CI 时,不会显示任何提示。 RASHOMON_STEER_ARM=off 或 steer 会强制指定配对测量运行的组别,且仅在 lab store(一个被 rashomon measure --prepare 标记过的 store)上有效;在任何其他 store 上它都会被视作未设置,因此仓库的设置无法用它关闭留出组。 上面这些提示无需任何配置。如果想额外让 agent 获得一份依据你仓库自身依赖图生成的背景说明,请对仓库做一次索引: rashomon graph index 这会在仓库中写入 .rashomon/graph.jsonl,以及 .rashomon/graph.json(当后者不存在时,它记录的是从你的 manifest 文件推断出的配置)。 Go 仓库需要先做一步。它的图来自 pgraph,这是本仓库中的第二个工具。插件自带 pgraph,并会在根目录含有 go.mod 的 Git 仓库中于后台运行它。安装脚本和 go install 途径不会带来它:用这些方式时,你需要自行安装。它是一个独立的 Go module,需要 Go 1.26 或更高版本: go install github.com/altrace-dev-role/rashomon/pgraph/cmd/pgraph@main pgraph sync . rashomon graph index pgraph sync 会在仓库下写入 .pgraph;删除该目录即会遗忘它。没有执行 sync 时,rashomon graph index 会停止并提示 no pgraph sync with a symbols file under this root; run pgraph sync. Python 仓库仅靠 rashomon graph index 就能索引,使用的是精简版读取器:按名称识别定义、导入和调用。在 Python 仓库中,某个单元首次编辑时的背景说明、编辑后的检查,以及保留每次编辑所声明名称的功能,只有在已记录对本构建的同意之后才会开始生效:在终端上对本构建的确认界面回答 yes(rashomon watch 和 rashomon consent 会再次显示该界面);使用插件时,则是在本构建上的首次会话,它会通过一条通知记录该同意。仅对更早构建给出的同意,永远不会让它们作用于 Python 编辑。 Python 读取器是第一版;发行说明列出了它目前还无法读取的内容。 索引会改变 rashomon 为该仓库保存的内容。在索引某个仓库之前,请先阅读“它记录什么、以及它从不存储什么”。 这些途径安装的都是 v1.0-AutoSteer 发行版:rashomon version 会打印 1.0-AutoSteer。请只使用一种途径:在已启用插件的情况下,watch 会拒绝执行。 claude plugin marketplace add altrace-dev-role/rashomon claude plugin install rashomon@rashomon claude plugin enable rashomon@rashomon 或者 curl -fsSL https://raw.githubusercontent.com/altrace-dev-role/rashomon/main/install.sh | sh,然后运行 rashomon watch。 这里的例子是:测试失败了,而一个辅助 agent(子 agent)在翻阅代码,可该 agent 的结束语却说测试通过了。这个会话由 test/acceptance/readme_test.go 构建,它把 hook payload 送入真正的记录器,如果这段摘录与渲染结果出现差异,该测试就会失败。下面这段摘录就是 rashomon report 渲染该会话时的原样输出: the agent's account:
(原文较长,此处译出前 6000 字,完整内容请点「打开原文」。)
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。
