Skip to content

feat: add OpenCode integration support - #224

Closed
AlecMcQuarrie wants to merge 2 commits into
rtk-ai:masterfrom
AlecMcQuarrie:feature/opencode-integration
Closed

AlecMcQuarrie wants to merge 2 commits into
rtk-ai:masterfrom
AlecMcQuarrie:feature/opencode-integration

Conversation

@AlecMcQuarrie

Copy link
Copy Markdown

Add RTK support for OpenCode alongside existing Claude Code integration. OpenCode users can now install RTK via its native plugin system for transparent command rewriting and token optimization.

New files:

  • hooks/opencode-rtk-plugin.ts: TypeScript plugin that ports the bash rewrite logic to OpenCode's tool.execute.before hook
  • hooks/opencode-rtk-awareness.md: Slim awareness doc for OpenCode
  • hooks/opencode-rtk-rules.md: Rules file for OpenCode's rules system

CLI changes:

  • rtk init --opencode [-g]: Install plugin + rules for OpenCode
  • rtk init --opencode --show: Show OpenCode RTK configuration
  • rtk init --opencode --uninstall [-g]: Remove OpenCode RTK artifacts
  • rtk discover --opencode: Scan OpenCode sessions for missed savings

Implementation:

  • OpenCode plugin uses tool.execute.before event to intercept and rewrite bash commands (same patterns as rtk-rewrite.sh)
  • OpenCodeProvider in discover module supports session scanning
  • All 418 tests pass, no new clippy errors

Add RTK support for OpenCode alongside existing Claude Code integration.
OpenCode users can now install RTK via its native plugin system for
transparent command rewriting and token optimization.

New files:
- hooks/opencode-rtk-plugin.ts: TypeScript plugin that ports the bash
  rewrite logic to OpenCode's tool.execute.before hook
- hooks/opencode-rtk-awareness.md: Slim awareness doc for OpenCode
- hooks/opencode-rtk-rules.md: Rules file for OpenCode's rules system

CLI changes:
- rtk init --opencode [-g]: Install plugin + rules for OpenCode
- rtk init --opencode --show: Show OpenCode RTK configuration
- rtk init --opencode --uninstall [-g]: Remove OpenCode RTK artifacts
- rtk discover --opencode: Scan OpenCode sessions for missed savings

Implementation:
- OpenCode plugin uses tool.execute.before event to intercept and
  rewrite bash commands (same patterns as rtk-rewrite.sh)
- OpenCodeProvider in discover module supports session scanning
- All 418 tests pass, no new clippy errors
@AlecMcQuarrie
AlecMcQuarrie deleted the feature/opencode-integration branch February 19, 2026 23:10
@AlecMcQuarrie
AlecMcQuarrie restored the feature/opencode-integration branch February 19, 2026 23:10
thehoff added a commit to thehoff/contextcrawler that referenced this pull request Jul 14, 2026
`project_filter_params` built `format!("{}{}*", p, SEP)` and the query
uses `project_path GLOB ?2`, so GLOB metacharacters (`*`, `?`, `[`) in a
project directory name acted as wildcards. A project literally named
`/repo/cli*` selected sibling `/repo/client-secret/…` history (verified:
unescaped `cli*/*` matches `client-secret/x`).

Fix: `glob_escape` wraps each metachar in a bracket class (`[*]`, `[?]`,
`[[]`) — GLOB has no ESCAPE clause — so the path matches literally; only
the trailing `*` remains a real wildcard. Behavioural test via the SQLite
GLOB operator: sibling no longer matches, real descendant still does.

Council-confirmed 5/5 (unanimous).

Refs: rtk-ai#224

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K3SAimSBwPUp4MkRXaYXSU
thehoff added a commit to thehoff/contextcrawler that referenced this pull request Jul 14, 2026
Security release: rtk-ai#210 (json.tool bypass regression from 0.4.2), rtk-ai#229
(env-prefix proxy-disable injection), rtk-ai#224 (GLOB project-history leak),
rtk-ai#221 (trust symlink secret-exfil), rtk-ai#223 (unscrubbed parse-failure error).
All council-gated. From the codex-5.6-max sweep + 5-voice audit
(rtk-ai#210-rtk-ai#233). See CHANGELOG.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K3SAimSBwPUp4MkRXaYXSU
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant