Skip to content

feat(claude): persistent tmux session via cc; drop agentapi helpers - #6

Merged
fx merged 5 commits into
mainfrom
tmux-claude-session
May 31, 2026
Merged

feat(claude): persistent tmux session via cc; drop agentapi helpers#6
fx merged 5 commits into
mainfrom
tmux-claude-session

Conversation

@fx

@fx fx commented May 31, 2026

Copy link
Copy Markdown
Owner

What

Replaces the AgentAPI helper aliases with a cc command that runs Claude Code in a persistent, attachable tmux session.

Context: the Coder claude-code module v5 dropped AgentAPI (the old web/attach layer), so workspaces now launch Claude directly. cc restores a durable session that survives the web-terminal tab closing/reconnecting and is reachable over ssh <ws>.coder.

Changes

  • dot_bash_aliases: remove aa="agentapi attach" and agentapi-restart(); add cc()
    • attach-or-create a tmux session named claude
    • root→vscode hop (Coder envbuilder workspaces run as root; Claude refuses --dangerously-skip-permissions as root) — no-op on the desktop
    • falls back to plain claude if tmux is absent
    • claude alias unchanged (still launches Claude directly, no tmux)
  • fish config: add cc function for desktop parity
  • dot_tmux.conf (new): truecolor, fast ESC (TUI-friendly), mouse, 50k scrollback, aggressive-resize

Notes

Pairs with an infra-repo change to the Coder default template that points the Claude Code app tile at bash -ic cc and symlinks claude into /usr/local/bin. Workspaces pick this up on next start (they curl install.sh from main), so merge this before updating workspaces.

Copilot AI review requested due to automatic review settings May 31, 2026 19:34
AgentAPI was removed in claude-code Coder module v5, so replace the
agentapi attach/restart helpers with a 'cc' command that attaches to
(or creates) a persistent, attachable tmux session running Claude Code.
Survives terminal disconnects and is reachable over SSH. Adds a tuned
~/.tmux.conf (truecolor, fast ESC, mouse, scrollback) for the session.

- dot_bash_aliases: remove 'aa'/agentapi-restart; add cc() with root->vscode hop
- fish config: add cc function (desktop parity)
- dot_tmux.conf: new
@fx
fx force-pushed the tmux-claude-session branch from 30c787d to b527db4 Compare May 31, 2026 19:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a cc helper to run Claude Code inside a persistent, attachable tmux session (replacing the removed AgentAPI attach/restart helpers) and introduces a tmux configuration tuned for this workflow.

Changes:

  • Replace AgentAPI bash helpers with a cc function that attaches/creates a claude tmux session (and falls back to direct claude if tmux is missing).
  • Add a fish cc function for parity with bash usage.
  • Add a new dot_tmux.conf with truecolor, mouse support, larger scrollback, and resize/status tweaks.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
dot_tmux.conf New tmux defaults aimed at a stable Claude Code TUI experience.
dot_config/fish/config.fish.tmpl Adds cc wrapper for tmux-based Claude sessions in fish.
dot_bash_aliases Removes AgentAPI helpers and introduces bash cc with root→vscode hop.

Comment thread dot_config/fish/config.fish.tmpl
fx added 4 commits May 31, 2026 12:45
…cal/bin

mise installs claude-code as a managed tool (shim in ~/.local/share/mise/shims),
so the $HOME/.local/bin/claude check false-negatived and exit 1'd, aborting the
chezmoi run before update-claude-settings.sh could write ~/.claude/settings.json
— which made verify-marketplace.sh fail with 'settings.json not created'.
verify-marketplace.sh runs outside `mise exec`, and mise installs claude-code
as a managed tool (shim in ~/.local/share/mise/shims, not ~/.local/bin). Check
both locations directly instead of only the non-existent ~/.local/bin/claude.
…d vscode

The non-root user is the container's primary user (UID 1000 by devcontainer
convention), not necessarily 'vscode'. Resolve it via `id -un 1000` and drop
to it only when running as root, so cc is correct whether the runtime container
runs the agent as root or already as the non-root user.
@fx
fx merged commit daa48f0 into main May 31, 2026
3 checks passed
@fx
fx deleted the tmux-claude-session branch May 31, 2026 20:02
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.

2 participants