CtrlK
BlogDocsLog inGet started
Tessl Logo

spec-driven-development/spec-as-source

Spec-driven development on OpenSpec, with mechanical spec-as-source enforcement: a custom 'spec-as-source' OpenSpec schema adds file-ownership (targets) and test-verification ([@test]) metadata to every capability spec, three scripts (link check, ownership check, manifest build) keep code and specs from drifting apart, plus requirement-gathering, spec-writer, work-review, and a session-handoff skill with a proactive context-warning hook.

68

Quality

85%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Low

Low-risk findings worth noting

Overview
Quality
Evals
Security
Files

run-round-1.shskills/plan-judge/scripts/

#!/usr/bin/env bash
# GENERATED FROM SPEC — DO NOT EDIT DIRECTLY
# Source: openspec/specs/plan-judge/spec.md
# Runs the fixed, file-only Round 1 exchange between Codex and Claude.
set -euo pipefail

fatal() { echo "plan-judge: $*" >&2; exit 1; }

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SKILL_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
ROUND_DIR="$SKILL_DIR/prompts/round-1"
PROJECT_ROOT="${1:-$PWD}"
PROJECT_ROOT="$(cd "$PROJECT_ROOT" && pwd)"
INPUT_PLAN="$PROJECT_ROOT/openspec/PLAN.md"
RUN_DIR="$PROJECT_ROOT/.plan-judge/round-1"
CODEX_BIN="${PLAN_JUDGE_CODEX_BIN:-codex}"
CLAUDE_BIN="${PLAN_JUDGE_CLAUDE_BIN:-claude}"

sha256() { shasum -a 256 "$1" | awk '{print $1}'; }

frontmatter_value() {
    awk -v key="$2" '
        $0 == "---" { delimiters++; next }
        delimiters == 1 && $0 ~ "^" key ": " {
            sub("^" key ": ", "")
            print
            exit
        }
    ' "$1"
}

has_command() {
    [ -x "$1" ] || command -v "$1" >/dev/null 2>&1
}

validate_artifact() {
    file="$1"
    turn="$2"
    role="$3"
    provider="$4"
    expected_digest="$5"

    [ -s "$file" ] || fatal "missing $role artifact for turn $turn: $file"
    [ "$(frontmatter_value "$file" round)" = "1" ] \
        || fatal "invalid round in $file"
    [ "$(frontmatter_value "$file" giro)" = "$turn" ] \
        || fatal "invalid giro in $file"
    [ "$(frontmatter_value "$file" ruolo)" = "$role" ] \
        || fatal "invalid role in $file"
    [ "$(frontmatter_value "$file" provider)" = "$provider" ] \
        || fatal "invalid provider in $file"
    actual_digest="$(frontmatter_value "$file" input_digest)"
    [ -n "$actual_digest" ] || fatal "missing input_digest in $file"
    [ "$actual_digest" = "sha256:$expected_digest" ] \
        || fatal "STALE-INPUT: $role artifact for turn $turn does not match its latest input"
}

run_provider() {
    provider="$1"
    role="$2"
    turn="$3"
    prompt="$4"
    input="$5"
    output="$6"
    digest="$7"

    instruction="Your context is fresh. Read instructions from $prompt. Read only input artifact $input. Write only output artifact $output. Its frontmatter MUST declare round: 1, giro: $turn, ruolo: $role, provider: $provider, input_digest: sha256:$digest. Do not edit openspec/PLAN.md."

    if [ "$provider" = "codex" ]; then
        PLAN_JUDGE_PROVIDER="$provider" \
        PLAN_JUDGE_ROLE="$role" \
        PLAN_JUDGE_TURN="$turn" \
        PLAN_JUDGE_PROMPT="$prompt" \
        PLAN_JUDGE_INPUT="$input" \
        PLAN_JUDGE_OUTPUT="$output" \
        PLAN_JUDGE_EXPECTED_DIGEST="sha256:$digest" \
        "$CODEX_BIN" exec "$instruction"
    else
        PLAN_JUDGE_PROVIDER="$provider" \
        PLAN_JUDGE_ROLE="$role" \
        PLAN_JUDGE_TURN="$turn" \
        PLAN_JUDGE_PROMPT="$prompt" \
        PLAN_JUDGE_INPUT="$input" \
        PLAN_JUDGE_OUTPUT="$output" \
        PLAN_JUDGE_EXPECTED_DIGEST="sha256:$digest" \
        "$CLAUDE_BIN" -p "$instruction"
    fi
}

[ -f "$INPUT_PLAN" ] || fatal "missing input plan: $INPUT_PLAN"
[ -f "$ROUND_DIR/writer.md" ] || fatal "missing writer prompt"
[ -f "$ROUND_DIR/judge.md" ] || fatal "missing judge prompt"
has_command "$CODEX_BIN" || fatal "codex exec is unavailable"
has_command "$CLAUDE_BIN" || fatal "claude -p is unavailable"

mkdir -p "$RUN_DIR"
seed="$RUN_DIR/input-0.md"
cp "$INPUT_PLAN" "$seed"
current_input="$seed"

for turn in 1 2 3 4; do
    if [ "$turn" -eq 1 ] || [ "$turn" -eq 3 ]; then
        writer_provider="codex"
        judge_provider="claude"
    else
        writer_provider="claude"
        judge_provider="codex"
    fi

    writer="$RUN_DIR/writer-$turn.md"
    writer_digest="$(sha256 "$current_input")"
    run_provider "$writer_provider" writer "$turn" "$ROUND_DIR/writer.md" \
        "$current_input" "$writer" "$writer_digest"
    validate_artifact "$writer" "$turn" writer "$writer_provider" "$writer_digest"

    judge="$RUN_DIR/judge-$turn.md"
    judge_digest="$(sha256 "$writer")"
    run_provider "$judge_provider" judge "$turn" "$ROUND_DIR/judge.md" \
        "$writer" "$judge" "$judge_digest"
    validate_artifact "$judge" "$turn" judge "$judge_provider" "$judge_digest"
    current_input="$judge"
done

echo "plan-judge: Round 1 complete: $RUN_DIR/writer-4.md"

skills

README.md

tile.json