All topics

Docs /

Shell integration

A plain Terminal pane has no agent, so TAO CODING cannot tell when a command you typed has finished — unless your shell says so. If it emits the standard OSC 133 prompt marks (the same ones VS Code, WezTerm, Ghostty, kitty and Windows Terminal read), TAO CODING follows each command from prompt to exit and uses that to refresh the Git panel when a command finishes inside the selected worktree — a hand-typed git commit shows up just like an agent's — and to notify you when a command that ran for more than 10 seconds finishes in a pane you weren't watching (see Notifications). Nothing is injected into your shell: add the snippet for yours, guarded so it only runs inside TAO CODING (TAOCODING_SESSION is set in every pane). If you already use another terminal's shell integration that emits these marks, there is nothing to add.

zsh (~/.zshrc)

if [[ -n $TAOCODING_SESSION ]]; then
  __taocoding_precmd()  { printf '\033]133;D;%s\a\033]133;A\a' "$?"; }
  __taocoding_preexec() { printf '\033]133;C\a'; }
  precmd_functions+=(__taocoding_precmd)
  preexec_functions+=(__taocoding_preexec)
fi

bash (~/.bashrc; bash ≥ 4.4 for PS0)

if [[ -n $TAOCODING_SESSION ]]; then
  __taocoding_prompt() { printf '\033]133;D;%s\a\033]133;A\a' "$?"; }
  PROMPT_COMMAND="__taocoding_prompt${PROMPT_COMMAND:+;$PROMPT_COMMAND}"
  PS0='\[\e]133;C\a\]'"$PS0"
fi

fish (~/.config/fish/config.fish)

if set -q TAOCODING_SESSION
    function __taocoding_prompt --on-event fish_prompt
        printf '\e]133;A\a'
    end
    function __taocoding_preexec --on-event fish_preexec
        printf '\e]133;C\a'
    end
    function __taocoding_postexec --on-event fish_postexec
        printf '\e]133;D;%s\a' $status
    end
end

PowerShell 7 ($PROFILE; the least-tested of the four — cmd.exe has no equivalent)

if ($env:TAOCODING_SESSION) {
  $global:__taocodingPrompt = $function:prompt
  function global:prompt {
    $code = [int](-not $?)
    "$([char]27)]133;D;$code`a$([char]27)]133;A`a" + (& $global:__taocodingPrompt)
  }
  Set-PSReadLineKeyHandler -Key Enter -ScriptBlock {
    [Console]::Write("$([char]27)]133;C`a")
    [Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine()
  }
}

The marks are A (prompt drawn), C (command started) and D;<exit> (command ended); B (end of prompt) is optional and omitted above. The very first prompt's D is ignored, and a machine you ssh into without the snippet simply sends nothing until you are back.