Skip to content

sno-ai/sno-station-skills / skills/T-delegation-and-work-orders/pl/skills/pl

MANUAL-ONLY — load solely when the human owner types `/pl`, uses `$pl`, or asks you to act as the Project Lead (PL). Supervise one project lane and its executor agents. A charter or dispatch means: you are an EXECUTOR, not the PL.

FileKindSize
SKILL.mdskill md61.7 KB
references/callsigns.txtmarkdown384 B
references/decision-rights.mdmarkdown4.8 KB
references/dispatch-template.mdmarkdown38.2 KB
references/pocket-card.mdmarkdown1.9 KB
references/progress-reporting-hooks.mdmarkdown2.3 KB
references/todo-template.mdmarkdown6.9 KB
scripts/agent-cli-help.tother1.2 KB
scripts/attempt-gate.shexecutablescript3.6 KB
scripts/attempt-gate.tother4.6 KB
scripts/callsign-transfer-e2e.shexecutablescript7.9 KB
scripts/callsign-worktree.tother1.7 KB
scripts/callsign.shexecutablescript15.2 KB
scripts/convergence-watch.shexecutablescript8.6 KB
scripts/core-structure.tother5.7 KB
scripts/docker-env-doctor.shexecutablescript19.4 KB
scripts/exec-sentinel.shexecutablescript5.8 KB
scripts/exec-sentinel.tother2.4 KB
scripts/exec-state.shexecutablescript20.8 KB
scripts/exec-state.tother23.1 KB
scripts/exec-trust.shscript5.3 KB
scripts/exec-trust.tother6.4 KB
scripts/executor-wall.shexecutablescript6.8 KB
scripts/executor-wall.texecutablescript9.5 KB
scripts/fence-check.shexecutablescript4.4 KB
scripts/general-env-doctor.shexecutablescript14.0 KB
scripts/general-env-doctor.tother5.8 KB
scripts/gpu-watch.shexecutablescript4.5 KB
scripts/gpu-watch.tother1.5 KB
scripts/lane-open.shexecutablescript4.1 KB
scripts/lane-open.tother3.9 KB
scripts/lane-resolve.shexecutablescript5.0 KB
scripts/lane-resolve.texecutablescript7.0 KB
scripts/log-watch.shexecutablescript10.9 KB
scripts/log-watch.texecutablescript6.8 KB
scripts/on-station-proof.texecutablescript1.9 KB
scripts/portable-paths.tother1.5 KB
scripts/roster-git.tother4.1 KB
scripts/roster-reach.tother2.8 KB
scripts/roster.shexecutablescript19.9 KB
scripts/script-running.shscript5.8 KB
scripts/script-running.tother3.7 KB
scripts/selftest/run-selftest.shexecutablescript1.2 KB
scripts/spawn-exec-generation-e2e.shexecutablescript1.9 KB
scripts/spawn-exec-help.tother2.8 KB
scripts/spawn-exec-interactive-e2e.shscript13.2 KB
scripts/spawn-exec-lane-resolve.tother3.5 KB
scripts/spawn-exec-mission-state-e2e.shscript1.8 KB
scripts/spawn-exec-on-station-e2e.shexecutablescript2.2 KB
scripts/spawn-exec-operate.tother9.4 KB
scripts/spawn-exec.shexecutablescript36.8 KB
scripts/todo-close-evidence.tother1.2 KB
scripts/todo.shexecutablescript35.5 KB
scripts/todo.tother27.9 KB

scripts/executor-wall.sh

View on GitHub
#!/usr/bin/env bash
set -Eeuo pipefail

usage() {
    printf '%s\n' \
        'Usage: executor-wall.sh --spawn-id ID --term-after SECONDS --kill-after SECONDS --events PATH' \
        '       executor-wall.sh --spawn-id ID --cleanup-now'
}

spawn_id=''
term_after=''
kill_after=''
events=''
cleanup_now=0
while (($#)); do
    case "$1" in
        --spawn-id) spawn_id="${2:-}"; shift 2 ;;
        --term-after) term_after="${2:-}"; shift 2 ;;
        --kill-after) kill_after="${2:-}"; shift 2 ;;
        --events) events="${2:-}"; shift 2 ;;
        --cleanup-now) cleanup_now=1; shift ;;
        -h|--help) usage; exit 0 ;;
        *) printf 'executor-wall: unknown argument: %s\n' "$1" >&2; exit 2 ;;
    esac
done

[[ "$spawn_id" =~ ^[A-Za-z0-9._-]+$ ]] || {
    printf 'executor-wall: --spawn-id must be one safe token\n' >&2
    exit 2
}
[[ "$(uname -s)" == Linux ]] || {
    printf 'executor-wall: needs Linux with a systemd user session and cgroups; this host runs %s, so no wall was armed and nothing was signalled\n' "$(uname -s)" >&2
    exit 69
}
command -v jq >/dev/null
command -v flock >/dev/null
command -v systemctl >/dev/null

events_lock=''
if ((cleanup_now == 0)); then
    [[ "$term_after" =~ ^[0-9]+$ && "$kill_after" =~ ^[0-9]+$ ]] || {
        printf 'executor-wall: wall times must be whole seconds\n' >&2
        exit 2
    }
    ((term_after > 0 && kill_after > term_after)) || {
        printf 'executor-wall: require 0 < --term-after < --kill-after\n' >&2
        exit 2
    }
    [[ -n "$events" && ! -L "$events" ]] || {
        printf 'executor-wall: --events must be a non-symlink path\n' >&2
        exit 2
    }
    mkdir -p -- "$(dirname -- "$events")"
    touch -- "$events"
    events_lock="$events.lock"
fi
uid="$(id -u)"
user_prefix="/user.slice/user-$uid.slice/user@$uid.service/"
declare -a discovered_units=() discovered_groups=() unsafe_pids=()
declare -a signalled_units=() signalled_groups=() signal_failures=()
started_at=$SECONDS
term_deadline=0
kill_deadline=0
if ((cleanup_now == 0)); then
    term_deadline=$((started_at + term_after))
    kill_deadline=$((started_at + kill_after))
fi

append_event() {
    local event="$1" detail="${2:-}" scopes_json lock_fd
    scopes_json="$(printf '%s\n' "${signalled_groups[@]:-}" | sed '/^$/d' | sort -u | jq -Rsc 'split("\n") | map(select(length > 0))')"
    exec {lock_fd}>>"$events_lock"
    flock -x "$lock_fd"
    jq -nc \
        --arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
        --arg sid "$spawn_id" \
        --arg event "$event" \
        --arg detail "$detail" \
        --argjson scopes "$scopes_json" \
        '{ts:$ts,spawn_id:$sid,event:$event,scopes:$scopes} +
         (if $detail == "" then {} else {detail:$detail} end)' >>"$events"
    flock -u "$lock_fd"
    exec {lock_fd}>&-
}

discover() {
    local proc_dir pid status_uid env_file cgroup unit shown_group
    local -a marked_env_files=()
    discovered_units=()
    discovered_groups=()
    unsafe_pids=()
    mapfile -t marked_env_files < <(
        grep -l -z -x -F -- "SNO_EXEC_SPAWN_ID=$spawn_id" /proc/[0-9]*/environ 2>/dev/null || true
    )
    for env_file in "${marked_env_files[@]:-}"; do
        [[ -n "$env_file" ]] || continue
        proc_dir="${env_file%/environ}"
        pid="${proc_dir##*/}"
        status_uid="$(awk '/^Uid:/ { print $2; exit }' "$proc_dir/status" 2>/dev/null || true)"
        [[ "$status_uid" == "$uid" ]] || continue
        cgroup="$(awk -F: '$1 == "0" { print $3; exit }' "$proc_dir/cgroup" 2>/dev/null || true)"
        unit="${cgroup##*/}"
        if [[ "$cgroup" != "$user_prefix"* || ! "$unit" =~ \.(scope|service)$ ]]; then
            unsafe_pids+=("$pid:$cgroup")
            continue
        fi
        shown_group="$(systemctl --user show "$unit" -p ControlGroup --value 2>/dev/null || true)"
        if [[ "$shown_group" != "$cgroup" ]]; then
            unsafe_pids+=("$pid:$cgroup")
            continue
        fi
        discovered_units+=("$unit")
        discovered_groups+=("$cgroup")
    done
    if ((${#discovered_units[@]})); then
        mapfile -t discovered_units < <(printf '%s\n' "${discovered_units[@]}" | sort -u)
        mapfile -t discovered_groups < <(printf '%s\n' "${discovered_groups[@]}" | sort -u)
    fi
}

remember_discovery() {
    signalled_units+=("${discovered_units[@]:-}")
    signalled_groups+=("${discovered_groups[@]:-}")
    if ((${#signalled_units[@]})); then
        mapfile -t signalled_units < <(printf '%s\n' "${signalled_units[@]}" | sed '/^$/d' | sort -u)
        mapfile -t signalled_groups < <(printf '%s\n' "${signalled_groups[@]}" | sed '/^$/d' | sort -u)
    fi
}

signal_discovered() {
    local signal="$1" unit
    for unit in "${discovered_units[@]:-}"; do
        [[ -n "$unit" ]] || continue
        if ! systemctl --user kill --kill-whom=all --signal="$signal" "$unit" 2>/dev/null; then
            if systemctl --user is-active --quiet "$unit"; then
                signal_failures+=("$signal:$unit")
            fi
        fi
    done
}

containers_empty() {
    local group procs
    discover
    ((${#unsafe_pids[@]} == 0 && ${#discovered_units[@]} == 0)) || return 1
    for group in "${signalled_groups[@]:-}"; do
        [[ -n "$group" ]] || continue
        if [[ -r "/sys/fs/cgroup$group/cgroup.procs" ]]; then
            procs="$(<"/sys/fs/cgroup$group/cgroup.procs")"
            [[ -z "$procs" ]] || return 1
        fi
    done
}

cleanup_marked_now() {
    discover
    remember_discovery
    if ((${#unsafe_pids[@]})); then
        printf 'executor-wall: marked process entered an unsafe cgroup during startup cleanup: %s\n' \
            "${unsafe_pids[*]}" >&2
        return 1
    fi
    signal_discovered KILL
    for _ in {1..50}; do
        containers_empty && break
        sleep 0.1
    done
    if ((${#signal_failures[@]} == 0)) && containers_empty; then
        return 0
    fi
    printf 'executor-wall: startup cleanup could not prove zero marked processes; signal-failures=%s\n' \
        "${signal_failures[*]:-none}" >&2
    return 1
}

if ((cleanup_now == 1)); then
    cleanup_marked_now
    exit $?
fi

sleep "$((term_deadline - SECONDS))"
discover
remember_discovery
append_event expiry-intent
if ((${#unsafe_pids[@]})); then
    signal_failures+=("unsafe:${unsafe_pids[*]}")
fi
signal_discovered TERM

remaining=$((kill_deadline - SECONDS))
((remaining <= 0)) || sleep "$remaining"
discover
remember_discovery
if ((${#unsafe_pids[@]})); then
    signal_failures+=("unsafe:${unsafe_pids[*]}")
fi
signal_discovered KILL

for _ in {1..20}; do
    containers_empty && break
    sleep 0.1
done

if ((${#unsafe_pids[@]} == 0 && ${#signal_failures[@]} == 0)) && containers_empty; then
    append_event kill-confirmed
    exit 0
fi

detail='termination could not be proven'
((${#unsafe_pids[@]} == 0)) || detail="$detail; unsafe=${unsafe_pids[*]}"
((${#signal_failures[@]} == 0)) || detail="$detail; signal-failures=${signal_failures[*]}"
append_event termination-failed "$detail"
exit 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: 472kUpdated 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