#!/bin/bash # Workflow: consensus # Creates a foreman + N panelists, links them as peers, and primes each. # Panelists independently analyze the goal from different angles. # They report back to the foreman, who synthesizes a consensus. set -euo pipefail SESSION_NAME="$OLLIE_SESSION_NAME" CWD="$OLLIE_CWD" N=${OLLIE_CONSENSUS_N:-3} # Set status to running. echo "running" | ollie-9p write "session/$SESSION_NAME/goalstatus" # Create the foreman agent. FOREMAN=$(printf 'profile=foreman\ncwd=%s\nname=foreman\n' "$CWD" \ | ollie-9p rdwr "session/$SESSION_NAME/agent/new") FOREMAN=$(echo "$FOREMAN" | tr -d '\n') # Create panelist agents and establish peer links. PANELISTS=() ANGLES=("correctness and completeness" "simplicity and maintainability" "edge cases and failure modes") for i in $(seq 1 "$N"); do NAME="panelist_${i}" ID=$(printf 'profile=panelist\ncwd=%s\nname=%s\n' "$CWD" "$NAME" \ | ollie-9p rdwr "session/$SESSION_NAME/agent/new") ID=$(echo "$ID" | tr -d '\n') PANELISTS+=("$NAME") # Establish bidirectional peer link (foreman ↔ panelist). echo "peeradd $NAME" | ollie-9p rdwr "session/$SESSION_NAME/agent/$FOREMAN/ctl" done # Prime the foreman — it waits for panelist reports. cat <" | ollie-9p write session/\$OLLIE_SESSION_ID/agent/\$OLLIE_UNAME/peer/foreman \`\`\` Be direct. No filler. Focus on your angle. Cite specific code locations when relevant. PROMPT done