Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ rtk init --agent kilocode # Kilo Code
rtk init --agent antigravity # Google Antigravity
rtk init -g --agent pi # Pi
rtk init --agent hermes # Hermes
rtk init -g --agent droid # Factory Droid

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# 2. Restart your AI tool, then test
git status # Automatically rewritten to rtk git status
Expand Down Expand Up @@ -365,7 +366,7 @@ rtk init -g

## Supported AI Tools

RTK supports 14 AI coding tools. Each integration rewrites shell commands to `rtk` equivalents for 60-90% token savings where the agent supports command interception.
RTK supports 15 AI coding tools. Each integration rewrites shell commands to `rtk` equivalents for 60-90% token savings where the agent supports command interception.

| Tool | Install | Method |
|------|---------|--------|
Expand All @@ -384,6 +385,7 @@ RTK supports 14 AI coding tools. Each integration rewrites shell commands to `rt
| **Mistral Vibe** | Planned ([#800](https://github.com/rtk-ai/rtk/issues/800)) | Blocked on upstream |
| **Kilo Code** | `rtk init --agent kilocode` | .kilocode/rules/rtk-rules.md (project-scoped) |
| **Google Antigravity** | `rtk init --agent antigravity` | .agents/rules/antigravity-rtk-rules.md (project-scoped) |
| **Factory Droid** | `rtk init -g --agent droid` (or per-project) | PreToolUse hook in `~/.factory/hooks.json` (matcher `Execute`) |

For per-agent setup details, override controls, and graceful degradation, see the [Supported Agents guide](https://www.rtk-ai.app/guide/getting-started/supported-agents). The Hermes plugin source and tests live in `hooks/hermes/`; installed Hermes runtime files still live under `~/.hermes/plugins/rtk-rewrite/`.

Expand Down
23 changes: 22 additions & 1 deletion docs/guide/getting-started/supported-agents.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Supported Agents
description: How to integrate RTK with Claude Code, Cursor, Copilot, Cline, Windsurf, Codex, OpenCode, Hermes, Kilo Code, and Antigravity
description: How to integrate RTK with Claude Code, Cursor, Copilot, Cline, Windsurf, Codex, OpenCode, Hermes, Kilo Code, Antigravity, and Factory Droid
sidebar:
order: 3
---
Expand Down Expand Up @@ -37,6 +37,7 @@ Agent runs "cargo test"
| OpenClaw | TypeScript plugin (`before_tool_call`) | Yes |
| Pi | TypeScript extension (`tool_call` event) | Yes |
| Hermes | Python plugin (`terminal` command mutation) | Yes |
| Factory Droid | Shell hook (`PreToolUse`, matcher `Execute`) | Yes |
| Cline / Roo Code | Rules file (prompt-level) | N/A |
| Windsurf | Rules file (prompt-level) | N/A |
| Codex CLI | AGENTS.md instructions | N/A |
Expand Down Expand Up @@ -137,6 +138,26 @@ Creates `~/.hermes/plugins/rtk-rewrite/` and enables it through `plugins.enabled

The plugin fails open. If `rtk` is missing at load time, the hook is not registered. If `rtk rewrite` errors, the tool is not `terminal`, the payload has no string `command`, or the plugin raises an exception, Hermes runs the original command unchanged. The same `rtk rewrite` limitations apply: already-prefixed `rtk` commands, compound shell commands, heredocs, and commands without filters are not rewritten.

### Factory Droid

```bash
rtk init -g --agent droid # user-scoped (~/.factory/hooks.json)
rtk init --agent droid # project-scoped (.factory/hooks.json, commit to share)
```

Installs a `PreToolUse` hook (matcher `Execute`) into Droid's canonical `hooks.json` — falling back to the `hooks` key of `settings.json` only when that file already carries live `PreToolUse` hooks. Respects `$FACTORY_HOME_OVERRIDE`.

RTK honors Droid's own permission lists, never another agent's settings. Commands matching an explicit `commandDenylist` or `commandBlocklist` entry — read from all four settings scopes (`~/.factory/settings.json`, `~/.factory/settings.local.json`, `.factory/settings.json`, `.factory/settings.local.json`) — are left untouched so Droid's native confirmation or block fires on the original command. Every other command is rewritten via `updatedInput` with **no** permission decision: Droid's native flow (allowlist, autonomy level, other hooks) decides on the rewritten command. To auto-run rewritten read-only commands, add `rtk`-prefixed entries (e.g. `rtk git status`) to your `commandAllowlist`.

Uninstall:

```bash
rtk init --uninstall -g --agent droid
rtk init --uninstall --agent droid
```

Removes only RTK's hook entry; other hooks and settings are untouched.

### Cline / Roo Code

```bash
Expand Down
19 changes: 19 additions & 0 deletions src/hooks/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ pub const BEFORE_TOOL_KEY: &str = "BeforeTool";
pub const CLAUDE_HOOK_COMMAND: &str = "rtk hook claude";
/// Native Rust hook command for Cursor (replaces rtk-rewrite.sh).
pub const CURSOR_HOOK_COMMAND: &str = "rtk hook cursor";
/// Native Rust hook command for Factory Droid.
pub const DROID_HOOK_COMMAND: &str = "rtk hook droid";

pub const CONFIG_DIR: &str = ".config";
pub const OPENCODE_SUBDIR: &str = "opencode";
Expand All @@ -34,6 +36,23 @@ pub const PI_EXTENSIONS_SUBDIR: &str = "extensions";
pub const PI_PLUGIN_FILE: &str = "rtk.ts";
pub const PI_CODING_AGENT_DIR_ENV: &str = "PI_CODING_AGENT_DIR";

/// Factory Droid config directory, joined onto the resolved home directory.
pub const DROID_DIR: &str = ".factory";
/// Canonical Droid hooks file (Droid's own /hooks UI reads and writes this).
pub const DROID_HOOKS_FILE: &str = "hooks.json";
/// Legacy nested hooks location (`.factory/hooks/hooks.json`), still read by
/// Droid when the root `hooks.json` is absent.
pub const DROID_HOOKS_SUBDIR: &str = "hooks";
/// Droid settings file. Its `hooks` key is a fallback config surface: Droid
/// merges `hooks.json` OVER it per event key, so a `PreToolUse` entry here is
/// silently ignored once `hooks.json` defines `PreToolUse`.
pub const DROID_SETTINGS_FILE: &str = "settings.json";
/// Tool matcher used by Droid for shell command execution.
pub const DROID_EXECUTE_MATCHER: &str = "Execute";
/// Environment variable Droid uses to override its HOME directory (the
/// `.factory` segment is appended to it): `$FACTORY_HOME_OVERRIDE/.factory`.
pub const DROID_HOME_ENV: &str = "FACTORY_HOME_OVERRIDE";

pub const HERMES_DIR: &str = ".hermes";
pub const HERMES_PLUGINS_SUBDIR: &str = "plugins";
pub const HERMES_PLUGIN_NAME: &str = "rtk-rewrite";
Expand Down
Loading
Loading