Something went wrong. Try again.
An agentic programming framework for people that don't trust an AI agent
Something went wrong. Try again.
2.3 kB · 57 lines
at main
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758#!/usr/bin/env bash# consolidate — fold a finished run into a one-page index and archive its# artifacts, so the live `.skepticism/runs/` directory (and the context the# controller loads at routing time) stays bounded as runs accumulate.## The controller authors the rich digest in INDEX.md (it knows the decisions);# this script provides the plumbing: ensure the index exists, append a stub# entry pulled from state.md, and move the run dir under archive/.## Everything here lives under `.skepticism/`, which is excluded from git locally# (see `state protect`) — the index is this machine's memory of past runs, not# project documentation, and it never reaches the remote.## Usage: consolidate <slug> (run from the project repo root)set -euo pipefail
ROOT=".skepticism"slug="${1:?usage: consolidate <slug>}"dir="${ROOT}/runs/${slug}"index="${ROOT}/INDEX.md"archive="${ROOT}/archive"
[[ -d "$dir" ]] || { echo "no such run: $dir" >&2; exit 1; }
feature="$(grep -m1 '^- feature:' "$dir/state.md" 2>/dev/null | sed 's/^- feature:[[:space:]]*//')"tier="$(grep -m1 '^- tier:' "$dir/state.md" 2>/dev/null | sed 's/^- tier:[[:space:]]*//')"today="$(date +%Y-%m-%d)"
if [[ ! -f "$index" ]]; then cat > "$index" <<EOF# Skepticism — completed runs index
One line per finished feature. Full artifacts live under \`archive/<slug>/\`.The controller reads this at routing time instead of scanning every run.
EOFfi
# Append a stub the controller can enrich with decisions/links.cat >> "$index" <<EOF## ${slug} — ${feature:-(no summary)} (${today})- tier: ${tier:-unknown}- artifacts: archive/${slug}/- decisions: <controller fills in the key decisions / requirement coverage here>
EOF
# Register the local git exclusion before writing anything. `state init` already# does this in phase 0, but this script is also runnable on its own — and a run# directory that appears in `git status` before the exclusion exists is exactly# the footprint Iron Rule 6 forbids. `state protect` is idempotent and exits 0# outside a git repository, so this is safe to call unconditionally."$(dirname "$0")/state" protect >/dev/null 2>&1 || true
mkdir -p "$archive"mv "$dir" "$archive/$slug"echo "consolidated ${slug} → ${archive}/${slug}; indexed in ${index}"