From 40627405f72f2ee1dcf751aeecf1108223d9f27e Mon Sep 17 00:00:00 2001 From: DannyDannyDanny Date: Sat, 18 Apr 2026 22:27:28 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20add=20claude-channels=20systemd=20servi?= =?UTF-8?q?ce=20on=20phantom-ship=20=F0=9F=A4=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claude Code Channels replaces OpenClaw for the @HarakatBot Telegram bridge. Uses claude.ai subscription auth via long-lived OAuth token at /etc/claude-channels/env — sidesteps the API rate limits OpenClaw was hitting. Runs as danny since plugin + pairing state lives in ~/.claude. Wraps claude in script(1) because claude needs a PTY for its interactive session mode. OpenClaw service disabled but config kept for easy rollback during validation. Will be fully removed once Channels is proven stable. Her workspace (SOUL/MEMORY/IDENTITY/etc) is preserved in vimwiki/openclaw/workspace/. --- nixos/hosts/phantom-ship.nix | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/nixos/hosts/phantom-ship.nix b/nixos/hosts/phantom-ship.nix index 4ebc6c4..605d222 100644 --- a/nixos/hosts/phantom-ship.nix +++ b/nixos/hosts/phantom-ship.nix @@ -85,10 +85,13 @@ in claude-code # Claude Code CLI (channels replaces openclaw) ]; - # OpenClaw AI gateway — Telegram bot, Anthropic API. + # OpenClaw AI gateway — DISABLED. Replaced by Claude Code Channels below. + # Config kept for easy rollback during validation; will be fully removed in a + # follow-up commit once Channels is proven stable. Workspace state at + # /var/lib/openclaw/ is preserved and also committed to vimwiki/openclaw/. # Secrets (not in repo): /etc/openclaw/telegram-bot-token, /etc/openclaw/env (ANTHROPIC_API_KEY) services.openclaw-gateway = { - enable = true; + enable = false; environmentFiles = [ "/etc/openclaw/env" ]; servicePath = [ pkgs.git pkgs.nodejs pkgs.openai-whisper ]; config = { @@ -100,6 +103,33 @@ in }; }; + # Claude Code Channels — Telegram bridge for @HarakatBot. + # Uses claude.ai subscription auth (long-lived OAuth token) to bypass + # the API rate limits OpenClaw was hitting. + # Secret (not in repo): /etc/claude-channels/env (CLAUDE_CODE_OAUTH_TOKEN) + # Plugin + pairing state lives at /home/danny/.claude/ (set up interactively). + systemd.services.claude-channels = { + description = "Claude Code Channels (Telegram bridge for @HarakatBot)"; + after = [ "network-online.target" ]; + wants = [ "network-online.target" ]; + wantedBy = [ "multi-user.target" ]; + path = [ pkgs.claude-code pkgs.bun pkgs.git pkgs.util-linux ]; + environment = { + HOME = "/home/danny"; + }; + serviceConfig = { + Type = "simple"; + User = "danny"; + Group = "users"; + WorkingDirectory = "/home/danny"; + EnvironmentFile = "/etc/claude-channels/env"; + # claude needs a PTY; wrap with script(1). /dev/null discards the typescript. + ExecStart = ''${pkgs.util-linux}/bin/script -qfc "${pkgs.claude-code}/bin/claude --channels plugin:telegram@claude-plugins-official" /dev/null''; + Restart = "always"; + RestartSec = 5; + }; + }; + # OpenClaw gateway needs write access to its config dir and repo clones. systemd.tmpfiles.rules = [ "d /etc/openclaw 0775 root openclaw - -"