Skip to content

Commit 0518449

Browse files
committed
feat(ralphex-fe): add RTK (Rust Token Killer) for token savings (#68)
- Add rtk-download parallel stage to Dockerfile (same pattern as .devcontainer/) - Copy rtk binary to /usr/local/bin in final image - Run `rtk init -g --auto-patch` in init-docker.sh as fallback for standalone usage - Add rtk --version to CI verify step - Add RTK to README tools table
1 parent b491cab commit 0518449

4 files changed

Lines changed: 26 additions & 1 deletion

File tree

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ jobs:
127127
add_image "ralphex-fe" \
128128
"ralphex-fe" \
129129
"ralphex-fe/Dockerfile" \
130-
"bun --version && hugo version && /srv/ralphex --version"
130+
"bun --version && hugo version && /srv/ralphex --version && rtk --version"
131131
fi
132132
133133
if [ "$INCLUDES" = "[]" ]; then

‎ralphex-fe/Dockerfile‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,22 @@ RUN set -eux; \
4343
fi; \
4444
tar -xzf hugo.tar.gz -C /usr/local/bin/ hugo
4545

46+
# ── RTK (token-optimized CLI proxy for Claude Code) ─────────────────────────
47+
# Pattern from: .devcontainer/Dockerfile
48+
FROM alpine:3.21 AS rtk-download
49+
RUN apk add --no-cache curl jq
50+
RUN set -eux; \
51+
ARCH="$(uname -m)"; \
52+
case "$ARCH" in \
53+
x86_64) RTK_TARGET="x86_64-unknown-linux-musl" ;; \
54+
aarch64) RTK_TARGET="aarch64-unknown-linux-gnu" ;; \
55+
esac; \
56+
RTK_VERSION=$(curl -fsSL https://api.github.com/repos/rtk-ai/rtk/releases/latest \
57+
| jq -r '.tag_name' | sed 's/^v//'); \
58+
curl -fsSL -o /tmp/rtk.tar.gz \
59+
"https://github.com/rtk-ai/rtk/releases/download/v${RTK_VERSION}/rtk-${RTK_TARGET}.tar.gz"; \
60+
tar -xzf /tmp/rtk.tar.gz -C /usr/local/bin rtk
61+
4662
# ── Ralphex binary (latest from GitHub Releases) ────────────────────────────
4763
# Pattern from: claude-code/.devcontainer/Dockerfile
4864
FROM alpine:3.21 AS ralphex-download
@@ -117,6 +133,7 @@ COPY --from=go-download /usr/local/go /usr/local/go
117133
COPY --from=docker-download /usr/local/bin/docker /usr/local/bin/docker
118134
COPY --from=hugo-download /usr/local/bin/hugo /usr/local/bin/hugo
119135
COPY --from=ralphex-download /usr/local/bin/ralphex /srv/ralphex
136+
COPY --from=rtk-download /usr/local/bin/rtk /usr/local/bin/rtk
120137

121138
ENV GOROOT=/usr/local/go \
122139
GOPATH=/home/app/go

‎ralphex-fe/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ This is a standalone image, not a devcontainer.
1717
| Python 3 | system |
1818
| Playwright + Chromium | native Debian |
1919
| Claude Code CLI | latest |
20+
| RTK | latest (GitHub Releases) |
2021
| Ralphex | latest (GitHub Releases) |
2122
| Git, ripgrep, jq, curl, wget | system |
2223

‎ralphex-fe/init-docker.sh‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ if [ -d /mnt/claude ]; then
2727
fi
2828

2929
chown -R app:app /home/app/.claude
30+
31+
# ── RTK: ensure rewrite hook is configured ─────────────────────────────
32+
# Host mount usually brings the hook, but init idempotently to cover
33+
# standalone usage (no host mount). Runs as app user for correct paths.
34+
if command -v rtk >/dev/null 2>&1; then
35+
gosu app rtk init -g --auto-patch 2>/dev/null || true
36+
fi
3037
fi
3138

3239
# copy credentials extracted from macOS keychain (mounted separately)

0 commit comments

Comments
 (0)