description: "Opt-in per-turn tmux location context for users and maintainers enabling or tuning the agent's session, window, and pane awareness."
English | 中文
dsh-tmux-context lets the model identify the tmux session, window, pane, and pane-tree layout containing its agent process. It adds a durable, source-attributed reading on the first step of a turn only when that location changed. Terminals that merely inherit tmux environment variables without running in the named pane add nothing; failed queries also add nothing and do not fail the turn. This package is opt-in and is not included in the shipped Web or headless profiles.
Mount this plugin when the agent process runs inside tmux and the model benefits from knowing its window and pane location. Each reading is one additional user-role message in durable history; an unchanged location adds nothing, so long-running sessions accumulate little.
On each turn whose tmux state changed, the model receives one source-tagged context message with the session name, window index and name, pane index and id, active flags, and the compact pane-tree layout. Readings happen on the first step of a turn only; a pane moved or resized mid-turn is reflected on the next turn. Pixel sizes are intentionally excluded, and the visible contents of sibling panes are never captured.
The minimal mount needs no configuration. A positive refreshIntervalMs additionally suppresses injections that fall within that many milliseconds of the latest one; omission or 0 injects whenever the tmux state changed since the last injection.
- name: '@deepseek-ai/dsh-tmux-context'
config:
refreshIntervalMs: 60000
| Field | Default | Meaning |
|---|---|---|
refreshIntervalMs |
0 (every changed turn) |
Minimum milliseconds between durable injections in one session |
The generated configuration catalog is the exhaustive source for every accepted field and its JSDoc.
The process counts as in tmux only when its controlling terminal matches the pane's #{pane_tty}; a terminal launched from a tmux shell (a VS Code integrated terminal, a desktop launcher) inherits the variables but not the pane, so it reads as not in tmux. A missing ctx.shell, an absent environment, or a malformed reading is a no-op, and an executor rejection is contained and logged as a warning rather than failing the turn.
Read these pages when the package-level contract is not enough. They move from the design decision to the executor the query runs through and the exhaustive configuration.
On each turn whose tmux state changed, one source-tagged context message with the three lines below. <window-layout> is tmux's compact pane-tree description; pane and window pixel sizes are intentionally excluded, and the contents of sibling panes are never captured.
tmux location (turn <turn>):
session <session>, window <index> "<name>", pane <index> <pane-id>
window active=<0|1>, pane active=<0|1>, layout <window-layout>
Each three-line reading accumulates until compaction shadows it. Unchanged locations and interval suppression add nothing.
Append-only; newly visible content follows the reusable request prefix and does not invalidate existing KV Cache entries.
These limits define when tmux location context is a poor fit. They are current package constraints.
\t would mis-split the reading and be skipped as malformed; ordinary names are unaffected.$TMUX_PANE's #{pane_tty}. This deliberately excludes terminals that inherited $TMUX/$TMUX_PANE from a tmux ancestor (e.g. a VS Code integrated terminal). ps -o tty= is POSIX; the check is a no-op wherever it or #{pane_tty} is unavailable.