This document captures how coding agent integrations work inside Supaterm.
Supaterm owns pane context, socket transport, tab state, and notifications. An agent-specific integration only needs to translate the agent's native lifecycle into structured events that Supaterm can understand.
- A coding agent runs inside a Supaterm pane.
- Supaterm injects pane-local environment into terminal processes:
SUPATERM_SOCKET_PATHSUPATERM_CLI_PATHSUPATERM_STATE_HOMEwhen the app is launched with a state rootSUPATERM_SURFACE_IDSUPATERM_TAB_ID
- Supaterm prepends the bundled CLI directory to pane
PATH. - Structured agent events go through the
spCLI and then through the socket control boundary into the app process. - The app process is the only place that decides tab activity, pending input state, and desktop notification delivery.
- Agent notifications are routed to the pane context first and then to the stored session surface when available.
- Foreground session routing prevents restored or background sessions from stealing the panel, fork, copy, and tab activity surface.
The integration is split into three layers.
- inject pane context into the process environment
- inject the Debug or bundled
sppath - preserve isolated
SUPATERM_STATE_HOMEfor development runs
- install agent-native hook configuration when the user opts in
- install the Supaterm agent skill when the user opts in
- forward hook payloads through
sp - keep adapter behavior thin and agent-native
- accept typed socket requests
- bind agent sessions to pane surfaces
- store any transient agent state the UI needs
- update tab-level activity
- emit in-app or desktop notifications when needed
- clear pane-bound agent state when the shell reports the foreground command has finished
- monitor transcript or task-progress sources when an agent exposes them
Future agent integrations should keep that split. The wrapper or adapter should stay thin, and all UI state should stay inside the app.
Supaterm ships its agent skill from supaterm-skills inside the app bundle.
Install it with:
sp agent install-skillThe install command links ~/.agents/skills/supaterm to the bundled skill directory.
If that path already exists as a symlink or directory, Supaterm replaces it with a symlink to the current bundled skill.
On app launch, Supaterm silently refreshes existing Supaterm skill installs to the current bundle path.
Install every supported hook bridge with:
sp agent install-hooksThe app also exposes setup commands through:
sp onboardClaude uses Supaterm's user settings hook bridge.
- Supaterm exposes a Claude integration toggle in Settings > Coding Agents.
- Turning the toggle on installs hooks with
sp agent install-hook claude. - Turning the toggle off removes hooks with
sp agent remove-hook claude. - On open, Settings reads
~/.claude/settings.jsonto reflect whether Supaterm-managed hooks are currently present. - The CLI command preserves unrelated settings, removes any existing Supaterm-managed hooks anywhere in the file, and then installs the canonical Supaterm Claude hooks into the user settings file.
- The installed hook command uses
SUPATERM_CLI_PATHso the hook bridge targets the bundledspbinary injected into Supaterm panes. - On app launch, Supaterm silently refreshes installed Supaterm-managed Claude hooks to the current canonical hook definition.
- Supaterm's canonical Claude hook fragment is also available from
sp internal agent-settings claude. - The installed user settings tell Claude to invoke
sp agent receive-agent-hook --agent claudefor:SessionStartPreToolUseNotificationUserPromptSubmitStopSessionEnd
sp agent receive-agent-hookreads one agent hook event JSON object from stdin.- The caller must declare the agent explicitly with
--agent. - Installed hooks also pass
--pid "$PPID"so Supaterm can track live agent processes. - It forwards that payload to the app over the socket method
terminal.agent_hook. - The forwarded request carries the decoded event, the explicit agent kind, and the ambient
SupatermCLIContextfrom the current pane.
The app binds Claude sessions to pane surfaces, tracks the foreground session for each pane, and turns Claude hook events into tab activity.
SessionStartbinds the session to the current pane surface, registers agent presence, and starts panel monitoring.PreToolUsemarks the tab asrunning.Notificationmarks the tab asneeds inputand may trigger a notification.UserPromptSubmitmarks the tab asrunning.Stopmarks the tab asidleand stores the final assistant message as the latest tab notification when one is provided.SessionEndclears the tab activity and drops the stored session state.- A command-finished signal from the shell clears pane-bound agent sessions and presence.
The panel monitor reads Claude task progress from:
~/.claude/tasks/<sanitized-session-id>/*.json- the hook
transcript_pathwhen one is present
The monitor understands task reminders, TaskCreate, TaskUpdate, TodoWrite, and goal status records. It filters internal task rows and keeps recently completed rows visible briefly.
Codex uses the same app-side bridge and tab-state model, with transcript lifecycle as the source of truth for detail and final running state.
- Supaterm exposes a Codex integration toggle in Settings > Coding Agents.
- Turning the toggle on installs hooks with
sp agent install-hook codex. - Turning the toggle off removes hooks with
sp agent remove-hook codex. - On open, Settings reads
~/.codex/hooks.jsonto reflect whether Supaterm-managed hooks are currently present. - The install command enables the Codex hooks feature by running
codex features enable hooksthrough the user's login shell. - The same install command preserves unrelated hooks, removes any existing Supaterm-managed hooks anywhere in the file, and then installs the canonical Supaterm Codex hooks into the user-scoped global file.
- The install command also trusts the installed Supaterm hook commands in
~/.codex/config.toml. - The remove command rewrites
~/.codex/hooks.jsonand removes the matching Supaterm hook trust entries from~/.codex/config.toml. - The remove command does not disable the Codex hooks feature flag.
- On app launch, Supaterm silently refreshes installed Supaterm-managed Codex hooks to the current canonical hook definition and trust state.
- Supaterm's canonical Codex hook fragment is also available from
sp internal agent-settings codex. - The installed global hooks tell Codex to invoke
sp agent receive-agent-hook --agent codexfor:PostToolUsePreToolUseSessionStartUserPromptSubmitStop
The app binds Codex sessions to pane surfaces and turns Codex hook events into tab activity.
SessionStartbinds the session to the current pane surface and starts transcript observation for the recordedtranscript_path.PreToolUseandPostToolUseoptimistically mark the tab asrunningbefore transcript progress arrives, and recover the pane binding whenSessionStartwas missed.UserPromptSubmitre-arms transcript observation for the next turn, recovers the pane binding whenSessionStartwas missed, and clears structured completion suppression without supplying Codex detail on its own.Stopmarks the tab asidleand stores the final assistant message as the latest tab notification when one is provided.- Transcript lifecycle remains authoritative for Codex detail and final
idletransitions. task_startedandturn_startedmark the tab asrunning.task_complete,turn_complete, andturn_abortedmark the tab asidle.errormarks the turn failed and clears the active turn.thread_goal_updatedand goal context records can populate goal progress rows.update_plantool calls can populate panel progress rows.- Resume and startup read the current transcript snapshot before polling, so an already-active Codex turn appears as
runningimmediately. - While a Codex turn is running, Supaterm tails the Codex rollout file from
transcript_path. event_msglines drive lifecycle, and non-finalagent_messageevents can update live activity detail.response_itemlines only update live activity detail for non-final assistant messages.- While Codex is
running, the sidebar tab row shows the tab-level running badge without inline activity text. Notification bodies remain available from the row hover popover.
The same shared activity model powers every agent, and desktop notification titles derive from the explicit agent kind.
Supaterm currently treats a hook as Supaterm-managed when its command, lowercased, contains supaterm.
Pi uses the extension package from supaterm-skills, not the sp agent install-hook settings bridge.
Settings > Coding Agents can install or remove the package by invoking pi through the user's login shell.
Install it with:
pi install git:github.com/supabitapp/supaterm-skillsInstall from a local checkout while developing:
pi install /absolute/path/to/supaterm/integrations/supaterm-skillsThe Pi extension source lives in integrations/supaterm-skills/extensions/pi-notify-supaterm.
The extension only forwards events when it sees both:
SUPATERM_CLI_PATHSUPATERM_SURFACE_ID
It synthesizes a stable Pi session ID from the pane surface ID, sends hook events through sp agent receive-agent-hook --agent pi, emits running heartbeats during active work, and sends completion or attention notifications when the Pi run finishes or waits for input.