โณ This skill is pending AI review.

Scores will appear once the review pipeline completes.

version unknown

resilient-coding-agent

cosformula@cosformulaโญ 11 starsยท last commit 9mo agoยท 0 open issues

Run long-running coding agents (Codex, Claude Code, etc.) in tmux sessions that survive orchestrator restarts, with automatic resume on interruption.

Choose how to use this skill

You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.

1. Native installer

This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.

Do not guess an installer command or replace an existing version without reviewing the diff.

2. Complete package recommended

Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.

No complete ProSkills package is published for this listing yet.

3. Prompt-only

Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.

Need only the instruction file?

Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.

No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.

โ€”/10

// RATINGS

โญGitHub Stars
โญโญ 11 on GitHubGitHub โ†—

Growing

๐ŸŸขProSkills Score
โ€”
๐Ÿ“

Not yet listed on ClawHub or SkillsMP

// README

Resilient Coding Agent

ClawHub Version GitHub stars License: MIT CI Publish

Run long-running coding agents (Codex CLI, Claude Code, OpenCode, Pi) in tmux sessions that survive orchestrator restarts, with periodic health checks and automatic resume on interruption.

Problem

AI coding agents running long tasks (refactors, full codebase reviews, complex builds) get killed when the orchestrator process restarts. You lose progress, get no completion notification, and have to start over.

Solution

Decouple the coding agent from the orchestrator by running it in a tmux session. The agent keeps running regardless of what happens to the orchestrator. A monitor loop can check health with tmux has-session and tmux capture-pane, detect likely crashes, and trigger native resume commands in the same tmux session.

Features

  • Runs coding agents in tmux sessions so tasks survive orchestrator restarts
  • Supports periodic health monitoring (tmux has-session + tmux capture-pane)
  • Detects likely agent exits from shell-prompt return and exit indicators in recent output
  • Auto-recovers with native resume commands (codex exec resume <session-id>, claude --resume, opencode run "Continue")
  • Supports completion notifications via marker files, system events, or webhooks

Supported Agents

  • Codex CLI (with codex exec resume for recovery)
  • Claude Code (with claude --resume for recovery)
  • OpenCode
  • Pi Coding Agent

Install

Via npx skills (any agent)

npx skills add cosformula/resilient-coding-agent-skill

Via ClawHub (OpenClaw)

clawhub install resilient-coding-agent

Manual

git clone https://github.com/cosformula/resilient-coding-agent-skill.git

Quick Start

# Start a long Codex task in tmux
SESSION="codex-refactor"
TMPDIR=$(mktemp -d) && chmod 700 "$TMPDIR"

# Write prompt (in practice, use orchestrator's write tool)
echo "Refactor auth module" > "$TMPDIR/prompt"

tmux new-session -d -s "$SESSION" -e "TASK_TMPDIR=$TMPDIR"
tmux send-keys -t "$SESSION" 'cd ~/project && set -o pipefail && codex exec --full-auto --json "$(cat $TASK_TMPDIR/prompt)" | tee $TASK_TMPDIR/events.jsonl && openclaw system event --text "Codex done: auth refactor" --mode now; echo "__TASK_DONE__"' Enter

# Save this task's Codex session ID (safer than resume --last when multiple tasks run)
until [ -s "$TMPDIR/codex-session-id" ]; do
  if command -v jq &>/dev/null; then
    jq -r 'select(.thread_id) | .thread_id' "$TMPDIR/events.jsonl" 2>/dev/null | head -n 1 > "$TMPDIR/codex-session-id"
  else
    grep -oE '"thread_id":"[^"]+"' "$TMPDIR/events.jsonl" 2>/dev/null | head -n 1 | cut -d'"' -f4 > "$TMPDIR/codex-session-id"
  fi
  sleep 1
done

# Check progress
tmux capture-pane -t "$SESSION" -p -S -100

# If Codex crashes, resume this exact session
CODEX_SESSION_ID="$(cat "$TMPDIR/codex-session-id")"
tmux send-keys -t "$SESSION" "codex exec resume $CODEX_SESSION_ID \"Continue the refactor\"" Enter

# Or run the monitor script for automated crash detection + resume
./scripts/monitor.sh "$SESSION" codex

Requirements

  • tmux installed
  • At least one coding agent CLI (codex, claude, opencode, or pi)
  • bash for the health-monitor script (scripts/monitor.sh)

Compatibility

  • macOS / Linux: Fully supported. Install tmux via package manager.
  • Windows: Requires WSL. Native Windows is not supported (no tmux).
  • Shell: Health monitoring detects bash ($ ), zsh (% ), and fish (> ) prompts.

License

MIT, Copyright cosformula

// HOW IT'S BUILT

// FILES

9 files shipped with this skill. Inline text is the catalog copy. The upstream link is the source repository.

  • SKILL.md8.8 KB59bae00748d5upstream โ†—
    ---
    name: resilient-coding-agent
    description: "Run long-running coding agents (Codex, Claude Code, etc.) in tmux sessions that survive orchestrator restarts, with automatic resume on interruption."
    metadata:
      openclaw:
        emoji: "๐Ÿ›ก๏ธ"
        requires:
          bins: [tmux]
          anyBins: [codex, claude, opencode, pi]
    ---
    
    # Resilient Coding Agent
    
    Long-running coding agent tasks (Codex CLI, Claude Code, OpenCode, Pi) are vulnerable to interruption: orchestrator restarts, process crashes, network drops. This skill decouples the coding agent process from the orchestrator using tmux, and leverages agent-native session resume for recovery.
    
    **Placeholders:** `<task-name>` and `<project-dir>` are filled in by the orchestrator. `<task-name>` must match `[a-z0-9-]` only. `<project-dir>` must be a valid existing directory.
    
    **Temp directory:** Each task uses a secure temp directory created with `mktemp -d`. Store this path as `<tmpdir>` and use it for all task files (prompt, events, session ID, done marker). This avoids predictable filenames and symlink/race conditions. Example: `TMPDIR=$(mktemp -d)` produces something like `/var/folders/xx/.../T/tmp.aBcDeFgH`.
    
    **Prompt safety:** Task prompts are never interpolated into shell commands. Instead, write the prompt to a temp file using the orchestrator's `write` tool (no shell involved), then reference it with `"$(cat $TMPDIR/prompt)"` inside the tmux command. The shell treats command substitution output inside double quotes as a single literal argument, preventing injection. This depends on the orchestrator's `write` tool not invoking a shell; OpenClaw's built-in `write` tool meets this requirement.
    
    **Sensitive output:** tmux scrollback and event log files may contain secrets or API keys from agent output. On shared machines, restrict file permissions (`chmod 600`) and clean up temp directories after task completion.
    
    ## Prerequisites
    
    This skill assumes the orchestrator is already configured to use coding agent CLIs (Codex, Claude Code, etc.) for coding tasks instead of native sessions. If the orchestrator is still using `sessions_spawn` for coding work, configure it to prefer coding agents first (e.g., via AGENTS.md or equivalent). See the `coding-agent` skill for setup.
    
    ## When to Use This
    
    Use this pattern when:
    - The task is expected to take **more than 5 minutes**
    - The orchestrator might restart during execution
    - You want fire-and-forget execution with completion notification
    
    For quick tasks under 5 minutes, running the agent directly is fine.
    
    ## Start a Task
    
    Create a tmux session with a descriptive name. Use the agent prefix (`codex-`, `claude-`, etc.) for easy identification.
    
    ### Codex CLI
    
    ```bash
    # Step 1: Create secure temp directory
    TMPDIR=$(mktemp -d)
    chmod 700 "$TMPDIR"
    
    # Step 2: Write prompt to file (use orchestrator's write tool, not echo/shell)
    # File: $TMPDIR/prompt
    
    # Step 3: Launch in tmux (pass TMPDIR via env)
    tmux new-session -d -s codex-<task-name> -e "TASK_TMPDIR=$TMPDIR"
    tmux send-keys -t codex-<task-name> 'cd <project-dir> && set -o pipefail && codex exec --full-auto --json "$(cat $TASK_TMPDIR/prompt)" | tee $TASK_TMPDIR/events.jsonl && echo "__TASK_DONE__"' Enter
    
    # Step 4: Capture this task's Codex session ID; resume --last is unsafe with concurrent tasks.
    # Uses jq for reliable JSON parsing (falls back to grep if jq unavailable).
    until [ -s "$TMPDIR/codex-session-id" ]; do
      if command -v jq &>/dev/null; then
        jq -r 'select(.thread_id) | .thread_id' "$TMPDIR/events.jsonl" 2>/dev/null | head -n 1 > "$TMPDIR/codex-session-id"
      else
        grep -oE '"thread_id":"[^"]+"' "$TMPDIR/events.jsonl" 2>/dev/null | head -n 1 | cut -d'"' -f4 > "$TMPDIR/codex-session-id"
      fi
      sleep 1
    done
    ```
    
    ### Claude Code
    
    ```bash
    # Create secure temp directory and write prompt to $TMPDIR/prompt first
    TMPDIR=$(mktemp -d) && chmod 700 "$TMPDIR"
    tmux new-session -d -s claude-<task-name> -e "TASK_TMPDIR=$TMPDIR"
    tmux send-keys -t claude-<task-name> 'cd <project-dir> && claude -p "$(cat $TASK_TMPDIR/prompt)" && echo "__TASK_DONE__"' Enter
    ```
    
    ### OpenCode / Pi
    
    ```bash
    # Create secure temp directory and write prompt to $TMPDIR/prompt first
    TMPDIR=$(mktemp -d) && chmod 700 "$TMPDIR"
    
    # OpenCode
    tmux new-session -d -s opencode-<task-name> -e "TASK_TMPDIR=$TMPDIR"
    tmux send-keys -t opencode-<task-name> 'cd <project-dir> && opencode run "$(cat $TASK_TMPDIR/prompt)" && echo "__TASK_DONE__"' Enter
    
    # Pi (separate temp dir)
    TMPDIR=$(mktemp -d) && chmod 700 "$TMPDIR"
    tmux new-session -d -s pi-<task-name> -e "TASK_TMPDIR=$TMPDIR"
    tmux send-keys -t pi-<task-name> 'cd <project-dir> && pi -p "$(cat $TASK_TMPDIR/prompt)" && echo "__TASK_DONE__"' Enter
    ```
    
    ### Completion Notification (Optional)
    
    Chain a notification command after the agent so you know when it finishes. Use `;` before `echo "__TASK_DONE__"` so the marker prints even if the notification command fails:
    
    ```bash
    # Generic: touch a marker file
    tmux send-keys -t codex-<task-name> 'cd <project-dir> && codex exec --full-auto "$(cat $TASK_TMPDIR/prompt)" && touch $TASK_TMPDIR/done; echo "__TASK_DONE__"' Enter
    
    # macOS: system notification
    tmux send-keys -t codex-<task-name> 'cd <project-dir> && codex exec --full-auto "$(cat $TASK_TMPDIR/prompt)" && osascript -e "display notification \"Task done\" with title \"Codex\""; echo "__TASK_DONE__"' Enter
    
    # OpenClaw: system event (immediate wake)
    tmux send-keys -t codex-<task-name> 'cd <project-dir> && codex exec --full-auto "$(cat $TASK_TMPDIR/prompt)" && openclaw system event --text "Codex done: <task-name>" --mode now; echo "__TASK_DONE__"' Enter
    ```
    
    ## Monitor Progress
    
    ```bash
    # Check if the session is still running
    tmux has-session -t codex-<task-name> 2>/dev/null && echo "running" || echo "finished/gone"
    
    # Read recent output (last 200 lines)
    tmux capture-pane -t codex-<task-name> -p -S -200
    
    # Read the full scrollback
    tmux capture-pane -t codex-<task-name> -p -S -
    ```
    
    Check progress when:
    - The user asks for a status update
    - You want to proactively report milestones
    
    ## Health Monitoring
    
    For long-running tasks, use an active monitor loop instead of only checking on demand.
    
    Periodic check flow:
    1. Run `tmux has-session -t <agent-task>` to confirm the tmux session still exists.
    2. Run `tmux capture-pane -t <agent-task> -p -S -<N>` to capture recent output.
    3. Detect likely agent exit by checking the last `N` lines for:
       - Shell prompt returned (for example, a line ending in `$ `, `% `, or `> `)
       - Exit indicators (`exit code`, `status <non-zero>`, `exited`)
       - No completion marker (`__TASK_DONE__`)
    4. If crash is detected, run the agent-native resume command in the same tmux session.
    
    Use a done marker in your start command so the monitor can distinguish normal completion from crashes:
    
    ```bash
    tmux send-keys -t codex-<task-name> 'cd <project-dir> && codex exec --full-auto "$(cat $TASK_TMPDIR/prompt)" && echo "__TASK_DONE__"' Enter
    ```
    
    For Codex tasks, save the session ID to `$TMPDIR/codex-session-id` when the task starts (see **Codex CLI** above). The monitor reads that file to resume the exact task session.
    
    The orchestrator should run this check loop periodically (every 3-5 minutes, via cron or a background timer). On consecutive failures, double the interval (3m, 6m, 12m, ...) and reset when the agent is running normally. Stop after 5 hours wall-clock.
    
    ## Recovery After Interruption
    
    For automated crash detection and retries, use **Health Monitoring** above.
    Keep this section as a manual fallback when you need to intervene directly:
    
    ```bash
    # Codex (prefer explicit session ID from $TMPDIR/codex-session-id)
    tmux send-keys -t codex-<task-name> 'codex exec resume <session-id> "Continue the previous task"' Enter
    
    # Claude Code
    tmux send-keys -t claude-<task-name> 'claude --resume' Enter
    
    # OpenCode
    tmux send-keys -t opencode-<task-name> 'opencode run "Continue"' Enter
    
    # Pi: no native resume; re-run the task prompt manually
    ```
    
    ## Cleanup
    
    After a task completes, kill the tmux session:
    
    ```bash
    tmux kill-session -t codex-<task-name>
    ```
    
    List all coding agent tmux sessions:
    
    ```bash
    tmux list-sessions 2>/dev/null | grep -E '^(codex|claude|opencode|pi)-'
    ```
    
    ## Naming Convention
    
    Tmux sessions use the pattern `<agent>-<task-name>`:
    
    - `codex-refactor-auth`
    - `claude-review-pr-42`
    - `codex-bus-sim-physics`
    
    Keep names short, lowercase, hyphen-separated.
    
    ## Checklist
    
    Before starting a long task:
    
    1. Pick tmux over direct execution (if task > 5 min)
    2. Name the tmux session with the agent prefix
    3. Optionally chain a completion notification
    4. Tell the user: task content, tmux session name, estimated duration
    5. Monitor via `tmux capture-pane` on request
    
    ## Limitations
    
    - tmux sessions do not survive a **machine reboot** (tmux itself is killed). For reboot-resilient tasks, the coding agent's native resume (`codex exec resume <session-id>`, `claude --resume`) is the recovery path.
    - Interactive approval prompts inside tmux require manual `tmux attach` or `tmux send-keys`. Use `--full-auto` / `--yolo` / `-p` flags when possible.
    
  • README.md4.3 KB0a46d5c3e099upstream โ†—
    # Resilient Coding Agent
    
    [![ClawHub](https://img.shields.io/badge/ClawHub-resilient--coding--agent-blue)](https://clawhub.com/cosformula/resilient-coding-agent)
    [![Version](https://img.shields.io/badge/version-0.2.0-green)](https://clawhub.com/cosformula/resilient-coding-agent)
    [![GitHub stars](https://img.shields.io/github/stars/cosformula/resilient-coding-agent-skill)](https://github.com/cosformula/resilient-coding-agent-skill)
    [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
    [![CI](https://github.com/cosformula/resilient-coding-agent-skill/actions/workflows/ci.yml/badge.svg)](https://github.com/cosformula/resilient-coding-agent-skill/actions/workflows/ci.yml)
    [![Publish](https://github.com/cosformula/resilient-coding-agent-skill/actions/workflows/clawhub-publish.yml/badge.svg)](https://github.com/cosformula/resilient-coding-agent-skill/actions/workflows/clawhub-publish.yml)
    
    Run long-running coding agents (Codex CLI, Claude Code, OpenCode, Pi) in tmux sessions that survive orchestrator restarts, with periodic health checks and automatic resume on interruption.
    
    ## Problem
    
    AI coding agents running long tasks (refactors, full codebase reviews, complex builds) get killed when the orchestrator process restarts. You lose progress, get no completion notification, and have to start over.
    
    ## Solution
    
    Decouple the coding agent from the orchestrator by running it in a tmux session. The agent keeps running regardless of what happens to the orchestrator. A monitor loop can check health with `tmux has-session` and `tmux capture-pane`, detect likely crashes, and trigger native resume commands in the same tmux session.
    
    ## Features
    
    - Runs coding agents in `tmux` sessions so tasks survive orchestrator restarts
    - Supports periodic health monitoring (`tmux has-session` + `tmux capture-pane`)
    - Detects likely agent exits from shell-prompt return and exit indicators in recent output
    - Auto-recovers with native resume commands (`codex exec resume <session-id>`, `claude --resume`, `opencode run "Continue"`)
    - Supports completion notifications via marker files, system events, or webhooks
    
    ## Supported Agents
    
    - **Codex CLI** (with `codex exec resume` for recovery)
    - **Claude Code** (with `claude --resume` for recovery)
    - **OpenCode**
    - **Pi Coding Agent**
    
    ## Install
    
    ### Via npx skills (any agent)
    
    ```bash
    npx skills add cosformula/resilient-coding-agent-skill
    ```
    
    ### Via ClawHub (OpenClaw)
    
    ```bash
    clawhub install resilient-coding-agent
    ```
    
    ### Manual
    
    ```bash
    git clone https://github.com/cosformula/resilient-coding-agent-skill.git
    ```
    
    ## Quick Start
    
    ```bash
    # Start a long Codex task in tmux
    SESSION="codex-refactor"
    TMPDIR=$(mktemp -d) && chmod 700 "$TMPDIR"
    
    # Write prompt (in practice, use orchestrator's write tool)
    echo "Refactor auth module" > "$TMPDIR/prompt"
    
    tmux new-session -d -s "$SESSION" -e "TASK_TMPDIR=$TMPDIR"
    tmux send-keys -t "$SESSION" 'cd ~/project && set -o pipefail && codex exec --full-auto --json "$(cat $TASK_TMPDIR/prompt)" | tee $TASK_TMPDIR/events.jsonl && openclaw system event --text "Codex done: auth refactor" --mode now; echo "__TASK_DONE__"' Enter
    
    # Save this task's Codex session ID (safer than resume --last when multiple tasks run)
    until [ -s "$TMPDIR/codex-session-id" ]; do
      if command -v jq &>/dev/null; then
        jq -r 'select(.thread_id) | .thread_id' "$TMPDIR/events.jsonl" 2>/dev/null | head -n 1 > "$TMPDIR/codex-session-id"
      else
        grep -oE '"thread_id":"[^"]+"' "$TMPDIR/events.jsonl" 2>/dev/null | head -n 1 | cut -d'"' -f4 > "$TMPDIR/codex-session-id"
      fi
      sleep 1
    done
    
    # Check progress
    tmux capture-pane -t "$SESSION" -p -S -100
    
    # If Codex crashes, resume this exact session
    CODEX_SESSION_ID="$(cat "$TMPDIR/codex-session-id")"
    tmux send-keys -t "$SESSION" "codex exec resume $CODEX_SESSION_ID \"Continue the refactor\"" Enter
    
    # Or run the monitor script for automated crash detection + resume
    ./scripts/monitor.sh "$SESSION" codex
    ```
    
    ## Requirements
    
    - `tmux` installed
    - At least one coding agent CLI (codex, claude, opencode, or pi)
    - `bash` for the health-monitor script (`scripts/monitor.sh`)
    
    ## Compatibility
    
    - **macOS / Linux**: Fully supported. Install tmux via package manager.
    - **Windows**: Requires WSL. Native Windows is not supported (no tmux).
    - **Shell**: Health monitoring detects bash (`$ `), zsh (`% `), and fish (`> `) prompts.
    
    ## License
    
    MIT, Copyright cosformula
    
  • scripts/monitor.sh4.3 KB81b324c46074upstream โ†—
    #!/usr/bin/env bash
    #
    # Monitor a coding agent running in a tmux session.
    # Detects crashes (shell prompt return, exit indicators) and auto-resumes
    # using the agent's native resume command.
    #
    # Usage:
    #   ./scripts/monitor.sh <tmux-session> <agent>
    #
    #   tmux-session  Name of the tmux session (e.g. codex-refactor)
    #   agent         One of: codex, claude, opencode, pi
    #
    # For Codex, expects a session ID file at /tmp/<session>.codex-session-id
    # (created during task start; see SKILL.md for details).
    #
    # Retry: 3min base, doubles on each consecutive failure, resets when agent
    # is running normally. Stops after 5 hours wall-clock.
    
    set -uo pipefail
    
    SESSION="${1:?Usage: monitor.sh <tmux-session> <agent>}"
    AGENT="${2:?Usage: monitor.sh <tmux-session> <agent>}"
    
    # Validate agent at startup
    case "$AGENT" in
      codex|claude|opencode|pi) ;;
      *) echo "Unsupported agent: $AGENT (must be codex, claude, opencode, or pi)" >&2; exit 1 ;;
    esac
    
    # Sanitize session name: only allow alphanumeric, dash, underscore, dot
    if ! printf '%s' "$SESSION" | grep -Eq '^[A-Za-z0-9._-]+$'; then
      echo "Invalid session name: $SESSION (only alphanumeric, dash, underscore, dot allowed)" >&2
      exit 1
    fi
    
    CODEX_SESSION_FILE="/tmp/${SESSION}.codex-session-id"
    RETRY_COUNT=0
    START_TS="$(date +%s)"
    DEADLINE_TS=$(( START_TS + 18000 ))  # 5 hours wall-clock
    
    while true; do
      NOW_TS="$(date +%s)"
      if [ "$NOW_TS" -ge "$DEADLINE_TS" ]; then
        echo "Retry timeout reached (5h wall-clock). Stopping monitor."
        break
      fi
    
      INTERVAL=$(( 180 * (2 ** RETRY_COUNT) ))
    
      # Cap sleep so we don't overshoot the 5h deadline
      REMAINING=$(( DEADLINE_TS - NOW_TS ))
      if [ "$INTERVAL" -gt "$REMAINING" ]; then
        INTERVAL="$REMAINING"
      fi
    
      # Capture tmux pane; if session disappeared between has-session and capture,
      # treat it as session gone rather than crashing the script.
      if tmux has-session -t "$SESSION" 2>/dev/null; then
        OUTPUT="$(tmux capture-pane -t "$SESSION" -p -S -120 2>/dev/null)" || {
          echo "tmux session $SESSION disappeared during capture. Stopping monitor."
          break
        }
        RECENT="$(printf '%s\n' "$OUTPUT" | tail -n 40)"
    
        if printf '%s\n' "$RECENT" | grep -q "__TASK_DONE__"; then
          echo "Task completed normally."
          break
        fi
    
        # Detect shell prompt return. Only match lines that are ONLY a prompt
        # (user@host indicators or bare shell markers) to avoid false positives
        # from agent output containing "> " or "$ " mid-line.
        PROMPT_BACK=0
        EXIT_HINT=0
        LAST_LINE="$(printf '%s\n' "$RECENT" | grep -v '^$' | tail -n 1)"
        printf '%s\n' "$LAST_LINE" | grep -Eq '^[^[:space:]]*[$%#>] $' && PROMPT_BACK=1
        # Match explicit exit indicators, not substrings like "HTTP status 200"
        printf '%s\n' "$RECENT" | grep -Eiq '(exit code [0-9]|exited with|exit status [1-9])' && EXIT_HINT=1
    
        if [ "$PROMPT_BACK" -eq 1 ] || [ "$EXIT_HINT" -eq 1 ]; then
          RETRY_COUNT=$(( RETRY_COUNT + 1 ))
    
          case "$AGENT" in
            codex)
              if [ -s "$CODEX_SESSION_FILE" ]; then
                CODEX_SESSION_ID="$(cat "$CODEX_SESSION_FILE")"
                # Validate session ID format (UUID-like alphanumeric + dashes)
                if ! printf '%s' "$CODEX_SESSION_ID" | grep -Eq '^[A-Za-z0-9_-]+$'; then
                  echo "Invalid Codex session ID format: $CODEX_SESSION_ID"
                  break
                fi
                echo "Crash detected. Resuming Codex session $CODEX_SESSION_ID (retry #$RETRY_COUNT)"
                tmux send-keys -t "$SESSION" "codex exec resume ${CODEX_SESSION_ID} \"Continue the previous task\"" Enter
              else
                echo "Missing Codex session ID file: $CODEX_SESSION_FILE"
                break
              fi
              ;;
            claude)
              echo "Crash detected. Resuming Claude Code (retry #$RETRY_COUNT)"
              tmux send-keys -t "$SESSION" 'claude --resume' Enter
              ;;
            opencode)
              echo "Crash detected. Resuming OpenCode (retry #$RETRY_COUNT)"
              tmux send-keys -t "$SESSION" 'opencode run "Continue"' Enter
              ;;
            pi)
              echo "Pi has no resume command. Manual restart required. Stopping monitor."
              break
              ;;
          esac
        else
          RETRY_COUNT=0  # agent is running normally, reset backoff
          INTERVAL=180
        fi
      else
        echo "tmux session $SESSION no longer exists. Stopping monitor."
        break
      fi
      sleep "$INTERVAL"
    done
    
  • .clawhubignore285 Ba3af62142c4aupstream โ†—
    .git/
    .github/
    
    # Runtime / deps
    node_modules/
    .venv/
    __pycache__/
    
    # Build artifacts
    build/
    dist/
    
    # Data / temp
    data/
    tmp/
    .cache/
    
    # OS/editor
    .DS_Store
    Thumbs.db
    *.log
    
    # Tests
    tests/
    
    # Scripts (excluded to avoid VirusTotal behavioral tags)
    scripts/
    
    # GitHub-only docs
    README.md
    
  • .github/workflows/ci.yml579 B491babf0c298upstream โ†—
    name: CI
    
    on:
      push:
      pull_request:
      workflow_dispatch:
    
    jobs:
      package-check:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - name: Verify publish dir
            run: |
              set -euo pipefail
              OUT=/tmp/skill
              rm -rf "$OUT" && mkdir -p "$OUT"
              rsync -a --delete --exclude-from=.clawhubignore ./ "$OUT/"
              echo "Publish files:"; find "$OUT" -type f -maxdepth 3 -print
              test ! -f "$OUT/README.md"
              test ! -d "$OUT/tests"
              test ! -d "$OUT/.github"
              test -f "$OUT/SKILL.md"
    
  • .github/workflows/clawhub-publish.yml1.8 KB0e8abfde306eupstream โ†—
    name: Publish to ClawHub
    
    on:
      workflow_dispatch:
        inputs:
          version:
            description: "Semver version (e.g. 0.1.0)"
            required: true
          changelog:
            description: "Changelog text"
            required: true
            default: "Update"
          tags:
            description: "Comma-separated tags"
            required: false
            default: "latest"
      push:
        tags:
          - "v*"
    
    jobs:
      publish:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
    
          - name: Build publish dir
            run: |
              set -euo pipefail
              OUT=/tmp/skill
              rm -rf "$OUT" && mkdir -p "$OUT"
              rsync -a --delete --exclude-from=.clawhubignore ./ "$OUT/"
              test -f "$OUT/SKILL.md"
              find "$OUT" -maxdepth 3 -type f -print
    
          - name: Install & login ClawHub
            env:
              CLAWHUB_TOKEN: ${{ secrets.CLAWHUB_TOKEN }}
            run: |
              npm i -g clawhub@latest
              clawhub login --token "$CLAWHUB_TOKEN" --no-browser
              clawhub whoami
    
          - name: Publish
            env:
              EVENT_NAME: ${{ github.event_name }}
              REF_NAME: ${{ github.ref_name }}
              INPUT_VERSION: ${{ inputs.version }}
              INPUT_CHANGELOG: ${{ inputs.changelog }}
              INPUT_TAGS: ${{ inputs.tags }}
            run: |
              set -euo pipefail
              if [[ "$EVENT_NAME" == "workflow_dispatch" ]]; then
                VERSION="$INPUT_VERSION"
                CHANGELOG="$INPUT_CHANGELOG"
                TAGS="$INPUT_TAGS"
              else
                VERSION="${REF_NAME#v}"
                CHANGELOG="Release ${REF_NAME}"
                TAGS="latest"
              fi
              clawhub publish /tmp/skill \
                --slug resilient-coding-agent \
                --name "Resilient Coding Agent" \
                --version "$VERSION" \
                --changelog "$CHANGELOG" \
                --tags "$TAGS"
    
  • .github/workflows/release.yml1.0 KB9f505a5e5a85upstream โ†—
    name: Release
    
    on:
      push:
        tags:
          - "v*"
    
    permissions:
      contents: write
    
    jobs:
      release:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
    
          - name: Build skill package
            run: |
              set -euo pipefail
              OUT=/tmp/skill-pkg
              rm -rf "$OUT" && mkdir -p "$OUT"
              rsync -a --delete --exclude-from=.clawhubignore ./ "$OUT/"
              test -f "$OUT/SKILL.md"
    
              SKILL_NAME=$(basename "$GITHUB_REPOSITORY" | sed 's/-skill$//')
              VERSION="${GITHUB_REF_NAME#v}"
              ARCHIVE="${SKILL_NAME}-${VERSION}.tar.gz"
              tar -czf "/tmp/${ARCHIVE}" -C "$OUT" .
              echo "ARCHIVE=/tmp/${ARCHIVE}" >> "$GITHUB_ENV"
              echo "SKILL_NAME=${SKILL_NAME}" >> "$GITHUB_ENV"
              echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
    
          - name: Create GitHub Release
            uses: softprops/action-gh-release@v2
            with:
              name: "${{ env.SKILL_NAME }} v${{ env.VERSION }}"
              generate_release_notes: true
              files: ${{ env.ARCHIVE }}
    
  • .gitignore51 Bf54c20883aedupstream โ†—
    node_modules/
    data/
    tmp/
    *.log
    .DS_Store
    .clawhub/
    
  • LICENSE1.0 KBd21997902a0bupstream โ†—
    MIT License
    
    Copyright (c) 2026 cosformula
    
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.
    

Plain-text copy, no login: /skill-bundles/cosformula-resilient-coding-agent-skill.md

// REPO STATS

11 stars
0 open issues
Last commit: 9mo ago