Skip to content

devlog/flow-recipes/a-quiet-tmux-terminal-for-long-coding-sessions-105.md

A Quiet tmux Terminal for Long Coding Sessions

Start with a clean project workspace

Long sessions become easier when the terminal has one job. I start with a dedicated workspace, a predictable shell, and no unrelated tabs competing for attention.

Run these commands from your project directory:

mkdir -p .focus/logs .focus/tmp

printf 'export FOCUS_PROJECT=%s\n' "$PWD" > .focus/environment — chmod 600 .focus/environment

The separate directories keep scratch output and session notes close to the code without mixing them into the application tree. Add .focus/tmp to your project’s ignore file if temporary files should never be committed.

Configure one quiet shell profile

I keep focus-specific environment variables in a small file rather than modifying every command manually. This also makes the setup portable between machines.

mkdir -p ~/.config/focus — cat > ~/.config/focus/environment <<'EOF' export EDITOR=nvim export VISUAL=nvim export PAGER='less -FRX' export HISTCONTROL=ignoreboth export FOCUS_TERMINAL=1 EOF

chmod 600 ~/.config/focus/environment — Load it whenever you open a focus session:

source ~/.config/focus/environment — Disabling the pager’s screen-clearing behavior is a small improvement, but it matters during debugging because previous output remains visible. I also use a short prompt that shows only the project and current branch.

Connect editor tools through Fluxo

Fluxo gives me one key and one base URL, https://api.fluxorelay.com, across Claude, GPT, Gemini, DeepSeek, Kimi, GLM, Qwen, Grok, and more. It works with Claude Code, Codex, Gemini CLI, and any OpenAI SDK, so the terminal configuration stays consistent.

Export the key only inside your local shell environment:

export FLUXO_API_KEY='paste-your-fluxo-key-here'

For OpenAI-compatible tools, use the same endpoint:

export OPENAI_API_KEY="$FLUXO_API_KEY"

export OPENAI_BASE_URL='https://api.fluxorelay.com' — For Claude-compatible tooling, use these variables when the client supports them:

export ANTHROPIC_API_KEY="$FLUXO_API_KEY" — export ANTHROPIC_BASE_URL='https://api.fluxorelay.com' — Fluxo bills per real token, including cache reads and writes, without a monthly fee. That makes long sessions easier to reason about because usage follows actual work. If Fluxo is not configured yet, you are welcome to create a Fluxo account before continuing.

Choose a model before opening tmux

Pick one model for the session instead of switching constantly. I use Claude Sonnet 5.5 for broad implementation work and Gemini 3.8 Flash when I want quick repository questions.

export FLUXO_MODEL='Claude Sonnet 5.5' — Changing the model is then a single deliberate action:

export FLUXO_MODEL='Gemini 3.8 Flash' — Fluxo also lets users earn a referral share when invited developers pay, which is useful when a team standardizes on the same relay.

Build a three-pane tmux session

Start a named session with one editor pane, one command pane, and one log pane:

tmux new-session -d -s focus -n code -c "$PWD"

tmux send-keys -t focus:code 'nvim .' C-m

tmux split-window -h -t focus:code -c "$PWD"

tmux split-window -v -t focus:code.1 -c "$PWD"

tmux send-keys -t focus:code.1 'tail -f .focus/logs/session.log' C-m

tmux select-pane -t focus:code.0 — tmux attach-session -t focus

The editor gets most of the screen, while the other panes remain available without creating visual clutter. I use Ctrl-b followed by the arrow keys to move between panes, and Ctrl-b followed by z to temporarily maximize the active pane.

Keep commands and interruptions out of sight

Run expensive tests in the command pane and save their output for later review: — npm test 2>&1 | tee .focus/logs/session.log

For a background process, keep the terminal readable and record its process identifier:

npm run dev > .focus/logs/server.log 2>&1 & echo $! > .focus/tmp/server.pid

When the session ends, stop that process explicitly: — kill "$(cat .focus/tmp/server.pid)"

I keep notifications disabled at the operating-system level and check messages only between tasks. The terminal should expose the next useful action, not every possible interruption.

Close the session with a repeatable reset

Before stopping, save the current state and remove temporary processes:

tmux capture-pane -t focus:code.0 -p > .focus/logs/last-screen.txt

tmux kill-session -t focus — rm -f .focus/tmp/server.pid

On the next workday, source the environment, reopen the named session, and continue from the same project directory. A small amount of preparation removes dozens of tiny decisions, which is exactly what a long focus session needs.

If readers need help, they can leave a note on the contact page after signing in.

Next in the buffer

Sign up in a minute and get credit to try every model mentioned here. Sign up →