Persistent Claude Code agent runner
  • Go 57.5%
  • Nix 22.4%
  • Shell 19.1%
  • Just 1%
Find a file
Jeremy Kennedy 732c7b7acc
All checks were successful
buildbot/nix-eval Build done.
buildbot/nix-build Build done.
buildbot/nix-effects Build done.
feat: support repo-local startup prompts
2026-05-19 01:01:51 -04:00
docs/plans docs: add task scheduler design doc and implementation plan 2026-03-20 11:54:00 -04:00
internal feat: support repo-local startup prompts 2026-05-19 01:01:51 -04:00
scripts feat: support repo-local startup prompts 2026-05-19 01:01:51 -04:00
skills feat: support repo-local startup prompts 2026-05-19 01:01:51 -04:00
vendor feat: initial hermitclaw release 2026-03-20 05:42:05 -04:00
.gitignore feat: initial hermitclaw release 2026-03-20 05:42:05 -04:00
CLAUDE.md feat: support repo-local startup prompts 2026-05-19 01:01:51 -04:00
config.example.toml feat: support repo-local startup prompts 2026-05-19 01:01:51 -04:00
flake.lock feat: initial hermitclaw release 2026-03-20 05:42:05 -04:00
flake.nix feat: support repo-local startup prompts 2026-05-19 01:01:51 -04:00
go.mod feat: initial hermitclaw release 2026-03-20 05:42:05 -04:00
go.sum feat: initial hermitclaw release 2026-03-20 05:42:05 -04:00
hermitclaw feat: initial hermitclaw release 2026-03-20 05:42:05 -04:00
install.sh feat: support repo-local startup prompts 2026-05-19 01:01:51 -04:00
justfile feat: initial hermitclaw release 2026-03-20 05:42:05 -04:00
LICENSE Initial commit 2026-03-20 05:34:59 -04:00
main.go feat: support repo-local startup prompts 2026-05-19 01:01:51 -04:00
README.md feat: support repo-local startup prompts 2026-05-19 01:01:51 -04:00

hermitclaw

Persistent Claude Code agent runner. Runs Claude Code in a tmux session with auto-restart, configurable channels, and conversation resume.

Like a hermit crab — lives in a shell, never lets go.

Features

  • Persistent tmux sessions — Claude Code runs in a named tmux session you can attach/detach from
  • Auto-restart — if Claude exits, it restarts automatically after a configurable delay
  • Resume by default — conversations persist across restarts via --continue
  • Channel support — connect Telegram or other channels
  • Systemd integration — optional systemd user service for boot-time start
  • Repo-local startup prompt — lets the working tree define startup behavior without writing agent-specific Claude assets into ~/.claude

Security Warning

hermitclaw passes --dangerously-skip-permissions to Claude Code. This grants the agent unrestricted access to your user account — arbitrary file reads/writes, shell commands, and network access with no human approval.

Recommended mitigations:

  • Run as a dedicated unprivileged user
  • Use filesystem permissions to limit scope
  • Use systemd sandboxing (ProtectHome=, ReadOnlyPaths=)
  • Review the tmux session regularly (hermitclaw attach)

Install

Option A: Nix Flake (NixOS / home-manager)

# flake.nix inputs:
hermitclaw = {
  url = "git+https://git.jeremyk.net/jeremy/hermitclaw.git";
  inputs.nixpkgs.follows = "nixpkgs";
};

# home-manager config:
imports = [ inputs.hermitclaw.homeManagerModules.default ];
programs.hermitclaw = {
  enable = true;
  claudePackage = pkgs.claude-code; # or your claude-code package
  workingDirectory = "~/dev";
  channels = [ "plugin:telegram@claude-plugins-official" ];
};

If you want startup behavior, define it in the working tree and pass a plain-text initial_prompt via hermitclaw config instead of relying on /welcome from ~/.claude.

The Nix module automatically:

  • Installs the binary with tmux on PATH
  • Generates ~/.config/hermitclaw/config.toml
  • Creates a systemd user service
  • Starts Claude in the configured working directory without installing agent-specific Claude skills or commands

Option B: Shell Installer

git clone https://git.jeremyk.net/jeremy/hermitclaw.git
cd hermitclaw
./install.sh            # Copies binary + config only
./install.sh --systemd  # Also installs systemd user service

Requires: tmux, claude (Claude Code), and optionally go (to build from source).

Usage

hermitclaw              # Attach if running, start + attach if not
hermitclaw start        # Start session in background
hermitclaw stop         # Stop session
hermitclaw restart      # Stop + start
hermitclaw attach       # Attach to running session
hermitclaw status       # Show whether session is running
hermitclaw logs         # Dump tmux scrollback
hermitclaw fresh        # Stop + start WITHOUT --continue (new conversation)

Configuration

Config file: ~/.config/hermitclaw/config.toml

# Working directory for Claude Code sessions
working_directory = "~/dev"

# Optional plain-text initial prompt passed to Claude at startup.
# Keep agent-specific instructions in the working tree, e.g. ~/dev/jk-agent/CLAUDE.md
# initial_prompt = "Read CLAUDE.md in the current working directory and follow it."

# tmux session name
session_name = "hermitclaw"

# Path to claude binary
# claude_binary = "claude"

# Claude Code channels (comma-separated)
# channels = "plugin:telegram@claude-plugins-official"

# Extra arguments passed to claude
# extra_args = ""

# Resume previous conversation on restart
auto_resume = true

# Seconds between restarts
restart_delay = 5

CLI flags override config file values. See hermitclaw --help.

License

GPL v3. See LICENSE.