Skip to content

sno-ai/sno-station-skills / skills/T-delegation-and-work-orders/deliver/skill

deliver

Verified

Carry out a released charter to a proven result: plan only as much as the work needs, do the work through the project's own workers, prove every success check with a recorded real run, get one independent review, and close honestly. Invoke explicitly as `$deliver <charter>` (Codex) or `/deliver <charter>` (Claude, Cursor), or the way your agent invokes a skill, or when a dispatch names you the executor of a charter.

FileKindSize
SKILL.mdskill md5.7 KB
references/proof.mdmarkdown1.8 KB
scripts/deliver-proofexecutablescript6.4 KB
scripts/deliver-proof.tother13.6 KB
scripts/selftest/run-selftest.shexecutablescript1.7 KB

scripts/deliver-proof

View on GitHub
#!/usr/bin/env bash
# Usage: sno deliver-proof run CHARTER N -- COMMAND... | see CHARTER N FILE TEXT | check CHARTER.
# Needs bash 4+; on a system without GNU coreutils (macOS) also python3. The charter basename drops a final .md.
# A command runs in the current directory. A `see` evidence path is read from the current
# directory and recorded relative to the charter's directory.
# A Success check whose text starts with ~~ (struck through) is dropped: not required, not provable.
# Success check numbers must be unique across the whole charter, slices included.
# Command output goes to stderr and its log; stdout carries only the summary.
# Existing Proof rows stay before the next section; a missing Proof section is added at EOF.
# Repeated runs within one UTC second use numbered log names.
set -Eeuo pipefail

if (( BASH_VERSINFO[0] < 4 )); then
    printf 'deliver-proof needs bash 4+; found bash %s\n' "$BASH_VERSION" >&2
    exit 2
fi

# GNU tools first; BSD stat and python3 where GNU is absent (macOS).
file_mode() { stat -c %a -- "$1" 2>/dev/null || stat -f %Mp%Lp -- "$1"; }
relative_to() {  # <dir> <path>: like realpath -m --relative-to=<dir> -- <path>
    realpath -m --relative-to="$1" -- "$2" 2>/dev/null ||
        python3 -c 'import os, sys; sys.stdout.buffer.write(os.fsencode(os.path.relpath(os.path.realpath(sys.argv[2]), os.path.realpath(sys.argv[1]))))' "$1" "$2"
}

usage() {
    local status="${1:-2}"
    printf 'usage: sno deliver-proof run CHARTER N -- COMMAND... | see CHARTER N FILE TEXT | check CHARTER\n' >&"$((status == 0 ? 1 : 2))"
    exit "$status"
}

append_row() {
    local charter="$1" row="$2" tmp
    tmp="$(mktemp "${charter}.XXXXXX")"
    chmod "$(file_mode "$charter")" "$tmp"
    PROOF_ROW="$row" awk '
        function flush_blanks(    i) {
            for (i = 0; i < blanks; i++) print ""
            blanks = 0
        }
        BEGIN {
            row = ENVIRON["PROOF_ROW"]
            header = "| check | result | how | exit | log | at (UTC) |"
            separator = "| --- | --- | --- | --- | --- | --- |"
        }
        $0 == "## Proof" { proof = 1; found = 1; print; next }
        proof && /^## / {
            if (!header_seen) { print header; print separator }
            print row
            flush_blanks()
            proof = 0
        }
        proof && /^[[:space:]]*$/ { blanks++; next }
        proof { flush_blanks() }
        proof && $0 == header { header_seen = 1 }
        { print }
        END {
            if (proof) {
                if (!header_seen) { print header; print separator }
                print row
                flush_blanks()
            } else if (!found) {
                print "\n## Proof\n"
                print header
                print separator
                print row
            }
        }
    ' "$charter" >"$tmp"
    mv -- "$tmp" "$charter"
}

[[ $# -gt 0 ]] || usage 0
if [[ $1 == --help && $# -eq 1 ]]; then
    usage 0
fi
case "$1" in
    run) [[ $# -ge 5 && $4 == -- ]] || usage ;;
    see) [[ $# -eq 5 ]] || usage ;;
    check) [[ $# -eq 2 ]] || usage ;;
    *) usage ;;
esac

[[ -f $2 && -r $2 ]] || { printf 'cannot read charter: %s\n' "$2" >&2; exit 2; }
charter="$(realpath -- "$2")"
charter_dir="$(dirname -- "$charter")"
mapfile -t checks < <(awk '
    $0 == "## Success checks" { section = 1; next }
    /^## / { section = 0 }
    section && /^[0-9]+[.][[:space:]]+~~/ { next }
    section && /^[0-9]+[.]/ { match($0, /^[0-9]+[.]/); print substr($0, 1, RLENGTH - 1) }
' "$charter")
duplicate="$(printf '%s\n' "${checks[@]}" | sort | uniq -d | head -n 1)"
[[ -z $duplicate ]] || { printf 'Success check number %s appears more than once in %s; number checks uniquely across all slices\n' "$duplicate" "$charter" >&2; exit 2; }
(( ${#checks[@]} > 0 )) || { printf 'charter has no numbered Success checks: %s\n' "$charter" >&2; exit 2; }

if [[ $1 == check ]]; then
    declare -A latest_result=() latest_log=()
    while IFS=$'\t' read -r number result log; do
        [[ -n $number ]] || continue
        latest_result[$number]="$result"
        latest_log[$number]="$log"
    done < <(awk '
        $0 == "## Proof" { proof = 1; next }
        /^## / { proof = 0 }
        proof && /^\|[[:space:]]*[0-9]+[[:space:]]*\|/ {
            line = $0
            gsub(/\\\|/, "\034", line)
            split(line, cell, "|")
            for (i = 2; i <= 6; i++) {
                gsub(/^[[:space:]]+|[[:space:]]+$/, "", cell[i])
                gsub(/\034/, "|", cell[i])
            }
            print cell[2] "\t" cell[3] "\t" cell[6]
        }
    ' "$charter")
    proven=0
    for number in "${checks[@]}"; do
        if [[ ! -v latest_result[$number] ]]; then
            printf 'check %s: NOT proven (no proof row)\n' "$number"
        elif [[ ${latest_result[$number]} != pass ]]; then
            printf 'check %s: NOT proven (latest result is %s)\n' "$number" "${latest_result[$number]}"
        elif [[ ! -e "$charter_dir/${latest_log[$number]}" ]]; then
            printf 'check %s: NOT proven (log or evidence missing)\n' "$number"
        else
            printf 'check %s: proven\n' "$number"
            proven=$((proven + 1))
        fi
    done
    printf '%s/%s checks proven\n' "$proven" "${#checks[@]}"
    (( proven == ${#checks[@]} ))
    exit $?
fi

number="$3"
valid=0
for check_number in "${checks[@]}"; do
    [[ $number == "$check_number" ]] && valid=1
done
(( valid )) || { printf 'no Success check %s in %s\n' "$number" "$charter" >&2; exit 2; }

at="$(date -u +%Y%m%dT%H%M%SZ)"
if [[ $1 == see ]]; then
    [[ -f $4 && -s $4 ]] || { printf 'evidence missing or empty: %s\n' "$4" >&2; exit 2; }
    log="$(relative_to "$charter_dir" "$4")"
    how="see: $5"
    status=0
    result=pass
else
    base="$(basename -- "$charter")"
    base="${base%.md}"
    log="$base.proof/$number-$at.log"
    mkdir -p -- "$charter_dir/$base.proof"
    suffix=2
    while [[ -e "$charter_dir/$log" ]]; do
        log="$base.proof/$number-$at-$suffix.log"
        suffix=$((suffix + 1))
    done
    set +e
    "${@:5}" </dev/null 2>&1 | tee -- "$charter_dir/$log" >&2
    statuses=("${PIPESTATUS[@]}")
    set -e
    status="${statuses[0]}"
    [[ ${statuses[1]} -eq 0 ]] || { printf 'could not write proof log: %s\n' "$charter_dir/$log" >&2; exit 2; }
    result=fail
    (( status == 0 )) && result=pass
    how="run: ${*:5}"
fi
how="${how//$'\n'/ }"
how="${how//$'\r'/ }"
how="${how//|/\\|}"
row="| $number | $result | $how | $status | $log | $at |"
append_row "$charter" "$row"
printf 'check %s: %s (exit %s)\n' "$number" "$result" "$status"
exit "$status"
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: 323kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 323kUpdated 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: 323kUpdated Claude CodeCodexVerifiedInstall