Repository navigation
Backlog
Description
#4809 is narrowed to the AGENTS.md part of rtk init --agent dsh. This issue keeps the rewrite plugin it also shipped (hooks/dsh/rtk-rewrite/, which wraps ctx.shell.execute and calls rtk rewrite), with what was measured on a real DeepSeek Harness 0.2.2-rc.5 (Docker, mock OpenAI endpoint, head 8e6b3bc).
Once DSH has loaded it, the plugin works: git status, git log -3, cd sub && git status and git status && echo done ran as rtk … (they show in rtk gain --history). HMR picks up both install and uninstall within about 4 s, and with no rtk on PATH the original command runs.
What an integration has to pass first:
- Boot on a stock profile. DSH creates
profiles/<name>/cordis.patch.ymlas three comment lines followed by[]. Appending a block- insert:after that gives invalid YAML. On its next start DSH exits withfailed to parse overlay …/cordis.patch.yml: YAMLException: end of the stream or a document separator is expected (6:1). The file has to be edited as YAML, not as text. That also covers removing an entry the user has extended withconfig:, and a file saved with CRLF line endings. - Survive the profile's package manager. The package is copied into
<profile>/node_modules/rtk-rewritewithout being declared. With pnpm 11.29 and 12.23, the nextdsh plugin add <x>orpnpm installmoves it tonode_modules/.ignored/or deletes it, and the patch entry stays behind. DSH then logsrtk-rewrite (rtk-rewrite): failed to import: … Cannot find package 'rtk-rewrite'and commands run unrewritten. Rerunningrtk init -g --agent dshreports a normal install without mentioning that the plugin had been missing. pnpm 10.34 keeps it. Declaring it as a profile dependency was suggested on feat(init): add DeepSeek Harness (DSH) agent support #4809 but has not been measured. - Agree with
rtk hook check --agent dsh. The plugin decides on its own whether to apply the rewrite: a whitelist, an insertion-only token check, and the original command on a deny. On 3 of 5 commandshook checkreports a rewrite the plugin does not apply (git pushunder a deny rule,git status && ls -la,cat README.md). Either the diagnostic models the plugin, or those decisions move intortk rewrite. - Pin its decisions. These mutations still pass the plugin's 35 tests: removing the
isSafeRewritegate inapply; whitelistevery→some; acatchthat rethrows; notimeout(the timeout test's mock exits 0 with empty stdout, so it passes either way); patchingctx.shellwithoutcordis.original. On the Rust side:--uninstall --dry-rundeleting the plugin directory and rewriting the patch for real, and the- id: rtk-rewriteexact-line match.
Metadata
Metadata
Assignees
Labels
No labels
Activity