feat: add RTK hook support for token-optimized CLI output #1

Closed
farhoodliquor-paperclip[bot] wants to merge 2 commits from feat/rtk-hooks into master
farhoodliquor-paperclip[bot] commented 2026-04-14 12:11:30 +00:00 (Migrated from github.com)

Summary

  • Adds RTK (rtk-ai/rtk) integration to the claude_k8s adapter for ~80% token reduction on CLI output
  • When enableRtk is set in adapter config, the adapter adds an init container to download RTK, mounts the binary in the main container, and configures Claude Code PreToolUse/PostToolUse hooks
  • Hooks are written to the workspace's .claude/settings.local.json (project-level) instead of the shared ~/.claude/settings.json, preventing settings pollution across agents on the same PVC
  • Supports rtkVersion for pinning and rtkImage for custom installer images

Key design decisions

  • Project-level settings isolation: Previous attempt (reverted d074cb2) used rtk install claude-code which writes to shared HOME. This implementation runs the install with a temp HOME, then moves the hooks to the project-level settings.local.json.
  • Configurable installer image: rtkImage field allows custom images instead of hardcoded curlimages/curl.
  • RTK_NO_TELEMETRY=1: Disabled for automated K8s environments.

Test plan

  • All 197 existing tests pass
  • 13 new RTK-specific tests added covering:
    • Init container creation and image configuration
    • Volume mounting (rtk-bin emptyDir)
    • Main command hook setup with settings isolation
    • RTK_NO_TELEMETRY env var
    • Version pinning
    • Custom rtkImage
    • Workspace-specific settings path
  • TypeScript type check passes

🤖 Generated with Claude Code

## Summary - Adds RTK (rtk-ai/rtk) integration to the claude_k8s adapter for ~80% token reduction on CLI output - When `enableRtk` is set in adapter config, the adapter adds an init container to download RTK, mounts the binary in the main container, and configures Claude Code PreToolUse/PostToolUse hooks - Hooks are written to the workspace's `.claude/settings.local.json` (project-level) instead of the shared `~/.claude/settings.json`, preventing settings pollution across agents on the same PVC - Supports `rtkVersion` for pinning and `rtkImage` for custom installer images ## Key design decisions - **Project-level settings isolation**: Previous attempt (reverted d074cb2) used `rtk install claude-code` which writes to shared HOME. This implementation runs the install with a temp HOME, then moves the hooks to the project-level `settings.local.json`. - **Configurable installer image**: `rtkImage` field allows custom images instead of hardcoded `curlimages/curl`. - **RTK_NO_TELEMETRY=1**: Disabled for automated K8s environments. ## Test plan - [x] All 197 existing tests pass - [x] 13 new RTK-specific tests added covering: - Init container creation and image configuration - Volume mounting (rtk-bin emptyDir) - Main command hook setup with settings isolation - RTK_NO_TELEMETRY env var - Version pinning - Custom rtkImage - Workspace-specific settings path - [x] TypeScript type check passes 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Pull request closed

Sign in to join this conversation.