Skip to content

docs(agents): how a host without a tool hook delegates to rtk rewrite - #4841

Closed
ismoss wants to merge 1 commit into
rtk-ai:developfrom
ismoss:docs/hosts-without-tool-hook
Closed

ismoss wants to merge 1 commit into
rtk-ai:developfrom
ismoss:docs/hosts-without-tool-hook

Conversation

@ismoss

@ismoss ismoss commented Oct 29, 2026 •

Copy link
Copy Markdown

What

docs/guide/getting-started/supported-agents.md gains a short "Hosts without a tool hook" section: what such a host has to do to use RTK, which exit codes it may act on, and the safety rules that make the result trustworthy.

Why

Every row in the supported-agents table assumes rtk init has something to patch — a PreToolUse hook, a plugin event, or a settings file. A host whose plugin can see and replace the shell command, but exposes no pre-tool event, is not in the table and gets no guidance. The page already states that agent hooks are thin delegates over rtk rewrite; the missing piece is only how to be one without a hook.

I wrote such a delegate for DeepSeek Harness (ismoss/dsh-rtk, MIT), which has exactly this shape (no pre-tool rewrite, but a plugin can wrap the shell service), and tested it end to end on Windows against rtk 1.1.0:

  • git status --porcelain executes as rtk git status --porcelain, and rtk gain counts the run;
  • exit 2 leaves the command untouched — the host's own permission system still owns the decision;
  • a missing rtk falls back to the original command in about 5 ms;
  • the rewrite is accepted only when dropping the inserted rtk tokens leaves the original tokens untouched.

Those are the rules already implied by the source comments (2 = "hook defers to the host's native deny") and by the exit-code table in docs/usage/FEATURES.md; this section just writes them where someone implementing a host will look.

Scope

Docs only: one file, +35 lines, no code and no behaviour change. No new agent is claimed as supported — a host-side delegate never touches rtk init, so it needs no row in the table.

Related: #4809 adds the instructions-only path for DSH's rtk init; this covers the other half, for a host that would rather rewrite than instruct.

Every row in the supported-agents table assumes rtk init has something to patch: a PreToolUse hook, a plugin event, or a settings file. A host that exposes the shell to plugins instead has no row and no guidance, even though the page already says the hooks are thin delegates over rtk rewrite.

Adds a short section for that shape: read stdout on 0 and 3 only, treat 2 as the host's own deny, fall back to the original command on anything else, and check that the only change is an inserted rtk token.
@rtk-wshm-sync-bot rtk-wshm-sync-bot Bot added the documentation Improvements or additions to documentation label Oct 29, 2026
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

📝 Type docs
🟢 Risk low

Summary

Adds a new 'Hosts without a tool hook' section to the supported-agents docs, explaining how a host that can intercept shell commands via a plugin (but has no PreToolUse-style hook) can delegate to rtk rewrite. It documents the exit-code handling rules and a safety check (token-diff validation) to ensure the rewritten command only adds rtk without altering the original command.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Analyzed automatically by wshm · This is an automated analysis, not a human review.

@CLAassistant

CLAassistant commented Oct 29, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ismoss

ismoss commented Oct 30, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@KuSh

KuSh commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

Thanks for writing this up. Closing in favour of #3918, which documents the same rtk rewrite contract for hosts without a hook as a full guide (exit codes, where the call goes, fail-open rules, accounting) and already has green CI. Your check that only the inserted rtk tokens differ is not in it, so a suggestion on #3918 would be welcome there; if your section targets a different case, reply here.

@KuSh KuSh closed this Oct 31, 2026
@KuSh KuSh added the duplicate This issue or pull request already exists label Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants