rtk-ai/rtk

read before write rules are broken

Open

#1,005 创建于 2026年4月3日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)Rust (2,914 fork)batch import
P2-importantarea:clibugeffort-largeenhancementfilter-qualityhelp wantedpriority:high

仓库指标

Star
 (48,085 star)
PR 合并指标
 (平均合并 11天 1小时) (30 天内合并 45 个 PR)

描述

Hi,

ClaudeCode, OpenCode have a strict read before write policy. That policy is broken when Read tool is rewritten by RTK to rtk read. The agent sees the file and the optimized content wants to edit the file but there is no rtk edit command so the agent calls the native tool. But there is no native read tool calls before the edit and the edit fails.

The agent needs to issue an another read to make able the edit the file. It means the agent loosing time and tokens when rereads the file. But there is a catch if the rewrite hooks work then the agent even cannot issue a native read command because it will be rewritten again.

I disabled the read command in the rtk config and instruct the agent to use rtk cat for explore, but disabling the read disabled the cat too. So now rtk read and rtk cat returns the raw file content. At least the Edit works. This is suboptimal and I think it would be optimal solution if RTK implements Edit and Write too, which is bypassing the read before write policy or better tracking the reads can enforce the policy on its own.

贡献者指南