rtk-ai/rtk

read before write rules are broken

Open

#1,005 opened on 2026年4月3日

GitHub で見る
 (1 comment) (0 reactions) (0 assignees)Rust (2,914 forks)batch import
P2-importantarea:clibugeffort-largeenhancementfilter-qualityhelp wantedpriority:high

Repository metrics

Stars
 (48,085 stars)
PR merge metrics
 (平均マージ 11d 1h) (30d で 45 merged PRs)

説明

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.

コントリビューターガイド