Skip to content

leek/agent-skills / skills/autopilot

autopilot

Verified

Build a whole spec while you are away. Asks every question up front, then a runner drives parallel fresh top-level Claude Code, Codex, or Grok sessions, one per ticket in its own worktree, onto one integration branch, delivered as one PR or a stack of PRs.

FileKindSize
SKILL.mdskill md10.5 KB
agents/openai.yamlconfig264 B
references/worker.mdmarkdown9.7 KB
scripts/autopilot.shexecutablescript13.5 KB
scripts/land.shexecutablescript6.2 KB
scripts/lib/observer.shscript9.9 KB
scripts/lib/output.shscript2.4 KB
scripts/lib/process.shscript5.0 KB
scripts/lib/provider.shscript12.2 KB
scripts/lib/runner.shscript33.5 KB
scripts/lib/state.shscript7.9 KB
scripts/lib/tickets.shscript6.9 KB
scripts/lib/tmux.shscript7.5 KB
scripts/result-schema.jsonconfig526 B
scripts/test-land.shscript4.4 KB
scripts/test-root-key.shexecutablescript8.6 KB
scripts/test-run.shscript12.7 KB
scripts/test-tmux.shexecutablescript10.6 KB

scripts/lib/output.sh

View on GitHub
#!/bin/bash
# Human-readable output, durable logs, and timing helpers.

set -e

timestamp() {
  date -u '+%Y-%m-%dT%H:%M:%SZ'
}

now_epoch() {
  date '+%s'
}

sanitize_message() {
  local value="$1"
  value="${value//$'\r'/ }"
  value="${value//$'\n'/ }"
  value="${value:0:500}"
  printf '%s' "$value"
}

format_duration() {
  local seconds="$1"
  if [[ "$seconds" -lt 60 ]]; then
    printf '%ss' "$seconds"
  elif [[ "$seconds" -lt 3600 ]]; then
    printf '%sm' "$((seconds / 60))"
  else
    printf '%sh%02dm' "$((seconds / 3600))" "$(((seconds % 3600) / 60))"
  fi
}

file_mtime() {
  local path="$1"
  if [[ ! -e "$path" ]]; then
    printf '0'
  elif stat -f '%m' "$path" >/dev/null 2>&1; then
    stat -f '%m' "$path"
  else
    stat -c '%Y' "$path"
  fi
}

iso_from_epoch() {
  local epoch="$1"
  if [[ "$epoch" -le 0 ]]; then
    printf ''
  elif date -u -r "$epoch" '+%Y-%m-%dT%H:%M:%SZ' >/dev/null 2>&1; then
    date -u -r "$epoch" '+%Y-%m-%dT%H:%M:%SZ'
  else
    date -u -d "@$epoch" '+%Y-%m-%dT%H:%M:%SZ'
  fi
}

shell_join() {
  local result="" quoted argument
  for argument in "$@"; do
    printf -v quoted '%q' "$argument"
    result="${result}${quoted} "
  done
  printf '%s' "${result% }"
}

emit_stderr() {
  printf 'Autopilot: %s\n' "$1" >&2
}

write_log() {
  local message timestamp_value
  message="$(sanitize_message "$1")"
  timestamp_value="$(timestamp)"
  if [[ -n "$LOG_FILE" ]] && ! printf '%s Autopilot: %s\n' "$timestamp_value" "$message" >>"$LOG_FILE"; then
    emit_stderr "warning: could not write canonical log $LOG_FILE"
  fi
  if [[ -n "$LOG_MIRROR_FILE" && "$LOG_MIRROR_FILE" != "$LOG_FILE" ]]; then
    if ! { printf '%s Autopilot: %s\n' "$timestamp_value" "$message" >>"$LOG_MIRROR_FILE"; } 2>/dev/null; then
      if [[ -n "$RUN_DIR" ]] && mkdir "$RUN_DIR/.log-mirror-warning" 2>/dev/null; then
        emit_stderr "warning: log mirror unavailable; canonical log continues at $LOG_FILE"
      fi
    fi
  fi
}

announce() {
  local message
  message="$(sanitize_message "$1")"
  write_log "$message"
  emit_stderr "$message"
}

# WORKER_ACTIVITY_FILE is set in a worker's stream readers: the run's activity and that
# worker's own, which its heartbeat reads.
mark_activity() {
  [[ -z "$ACTIVITY_FILE" ]] || touch "$ACTIVITY_FILE"
  [[ -z "${WORKER_ACTIVITY_FILE:-}" ]] || touch "$WORKER_ACTIVITY_FILE"
}

record_activity() {
  mark_activity
  write_log "$1"
}

announce_activity() {
  mark_activity
  announce "$1"
}
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall