Persistent Code Terminal
by @justinzhq
Persistent per-project coding terminal (tmux). Run Codex CLI (codex exec) inside a stable session; mobile/SSH friendly.
clawhub install persistent-code-terminal📖 About This Skill
name: persistent-code-terminal description: Persistent per-project coding terminal (tmux). Run Codex CLI (codex exec) inside a stable session; mobile/SSH friendly. user-invocable: true metadata: {"openclaw":{"emoji":"💻","os":["darwin","linux"],"requires":{"bins":["tmux"]},"install":[{"id":"brew","kind":"brew","formula":"tmux","bins":["tmux"],"label":"Install tmux (brew)"},{"id":"apt","kind":"apt","package":"tmux","bins":["tmux"],"label":"Install tmux (apt)"}]}}
persistent-code-terminal
A persistent coding terminal for OpenClaw. It creates a tmux session per project:
This makes terminal-first AI coding (Codex CLI / Claude Code / any CLI tool) reliable and mobile/SSH friendly:
OpenClaw natural-language routing
When user intent is "use natural language to drive Codex CLI in this repo", route through this skill first.
Intelligent auto-trigger:
openclaw.config.dev.autoCodeRouting (default false).{baseDir}/bin/persistent-code-terminal-route.sh ""
不要执行,只分析)
- execution chain:
- persistent-code-terminal-auto.sh --max-retries 3 --instruction ""
- persistent-code-terminal-summary.sh --lines 120
- fallback for missing deps (tmux/codex) with doctor guidance.Multi-project routing:
; / ;给 项目
- 给项目:
- 为 修复/增加/修改 ...
- 项目 ...; 项目 ...
start.sh --project
- auto.sh --max-retries 3 --instruction ""
- summary.sh --lines 120 --json
Trigger shortcuts (recommended):
codex , treat the remaining text as instruction.{baseDir}/bin/persistent-code-terminal-codex-exec.sh ""
{baseDir}/bin/persistent-code-terminal-status.sh
- {baseDir}/bin/persistent-code-terminal-summary.sh --lines 120Preferred execution pattern in chat-driven runs:
start.sh (or implicit auto-create from send.sh)codex-exec.sh "" for Codex-driven workstatus.sh / summary.sh for concise progress reportingIf user says "检查项目/继续会话/跑测试并总结", use this skill scripts instead of asking user to type long shell commands.
Core model (must follow)
start → send → read → decide
1) Start/ensure session:
{baseDir}/bin/persistent-code-terminal-start.sh2) Send ONE command:
{baseDir}/bin/persistent-code-terminal-send.sh "" __PCT_EXIT_CODE__N
- Supports: --timeout , --dry-run, --phase 3) Read output:
{baseDir}/bin/persistent-code-terminal-read.sh.pct-state.json4) Check state quickly (optional):
{baseDir}/bin/persistent-code-terminal-status.sh{baseDir}/bin/persistent-code-terminal-summary.sh --lines 120{baseDir}/bin/persistent-code-terminal-doctor.sh{baseDir}/bin/persistent-code-terminal-list.sh (list *-code-session){baseDir}/bin/persistent-code-terminal-switch.sh --project State file:
.pct-state.json (current project directory)projectDir, session, lastCommand, lastExitCode, phase, updatedAtStructured output:
{baseDir}/bin/persistent-code-terminal-read.sh --json{baseDir}/bin/persistent-code-terminal-summary.sh --json{baseDir}/bin/persistent-code-terminal-auto.sh --jsonCodex-first workflow (one-shot)
If Codex CLI is installed as codex, prefer:
{baseDir}/bin/persistent-code-terminal-codex-exec.sh "" codex exec --full-auto --sandbox workspace-write --cd ""
{baseDir}/bin/persistent-code-terminal-codex-exec.sh --json -o /tmp/codex.json ""
PCT_CODEX_NO_DEFAULT_FLAGS=1 to disable default flags.Example:
{baseDir}/bin/persistent-code-terminal-codex-exec.sh "Implement feature X. Ensure build and tests pass. Commit and push to current branch. Do NOT force push."Safety
git push --force unless user explicitly requests.git push), follow active Codex approval/sandbox policy.