#!/bin/bash # ============================================================================= # SentryAgent.ai — Start V&V Architect (Lead Validator) # ============================================================================= # Launches an independent Claude Code instance as the Lead Validator. # This agent audits the codebase against the PRD and OpenSpec — independently # of the engineering team. It reports findings directly to the CEO. # # Usage: # ./scripts/start-validator.sh # ============================================================================= set -e PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" VALIDATOR_WORKSPACE="$PROJECT_ROOT/.validator-workspace" VALIDATOR_SYSTEM_PROMPT="$PROJECT_ROOT/VALIDATOR.md" SHARED_LEDGER="$PROJECT_ROOT/openspec/vv_audit" echo "==============================================" echo " SentryAgent.ai — Starting V&V Architect" echo " (Lead Validator — Independent Audit Agent)" echo "==============================================" echo "" echo " Project root: $PROJECT_ROOT" echo " Workspace: $VALIDATOR_WORKSPACE" echo " System prompt: $VALIDATOR_SYSTEM_PROMPT" echo " Shared ledger: $SHARED_LEDGER" echo "" echo " The V&V Architect will:" echo " 1. Read README.md (PRD) in full" echo " 2. Register on hub as LeadValidator" echo " 3. Audit code against OpenSpec & PRD" echo " 4. Enforce DRY, SOLID, TypeScript standards" echo " 5. Log findings to openspec/vv_audit/" echo " 6. Notify CEO of any BLOCKERs" echo "" echo "==============================================" echo "" # Verify system prompt exists and has correct content (not a shell script) if [ ! -f "$VALIDATOR_SYSTEM_PROMPT" ]; then echo "ERROR: VALIDATOR.md not found at $VALIDATOR_SYSTEM_PROMPT" exit 1 fi # Quick sanity check — VALIDATOR.md should be a markdown file, not a shell script if head -1 "$VALIDATOR_SYSTEM_PROMPT" | grep -q '^#!/bin/bash'; then echo "ERROR: VALIDATOR.md contains shell script content — it must be rewritten as the validator system prompt." echo "See VALIDATOR.md header for the correct format." exit 1 fi # Create validator workspace (isolated from main project session) mkdir -p "$VALIDATOR_WORKSPACE" # Create the shared V&V audit ledger directory (written by validator, read by CTO) mkdir -p "$SHARED_LEDGER" # Initialize ledger index if it doesn't exist if [ ! -f "$SHARED_LEDGER/LEDGER.md" ]; then cat > "$SHARED_LEDGER/LEDGER.md" <<'EOF' # V&V Audit Ledger **Project:** SentryAgent.ai AgentIdP **Maintained by:** LeadValidator (V&V Architect) ## Summary | Metric | Count | |--------|-------| | Total issues logged | 0 | | Open | 0 | | Resolved | 0 | | Disputed | 0 | | Last audit | — | | Release gate status | NOT YET AUDITED | ## Issue Index EOF echo " Initialized: $SHARED_LEDGER/LEDGER.md" fi # Write a minimal CLAUDE.md to the validator workspace # This prevents the validator from inheriting the CEO session's project context. # The validator's full identity comes from --system-prompt-file (VALIDATOR.md). cat > "$VALIDATOR_WORKSPACE/CLAUDE.md" <