#!/bin/bash
# =============================================================================
# SentryAgent.ai — Start Technical & Business Consultant (TBC)
# =============================================================================
# Launches a separate Claude Code instance as the TBC.
# The TBC is an independent advisory function reporting directly to the CEO.
# It does NOT interact with the CTO or engineering team.
#
# Usage:
#   ./scripts/start-tbc.sh
#
# The TBC agent runs in its own terminal session and communicates
# with the CEO via the central hub (#tbc-ceo channel).
# =============================================================================

set -e

PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
TBC_WORKSPACE="$PROJECT_ROOT/.tbc-workspace"

echo "=============================================="
echo "  SentryAgent.ai — Starting TBC Agent"
echo "  (Technical & Business Consultant)"
echo "=============================================="
echo ""
echo "  Project:    $PROJECT_ROOT"
echo "  Workspace:  $TBC_WORKSPACE"
echo "  Hub Channel: #tbc-ceo"
echo ""
echo "  The TBC will:"
echo "  1. Read PRD.md, README.md, and TBC/charter.md"
echo "  2. Register on central hub as TBC"
echo "  3. Check #tbc-ceo for pending CEO messages"
echo "  4. Report session-open status to CEO"
echo "  5. Await CEO agenda"
echo ""
echo "  Note: TBC is advisory only."
echo "  It does NOT interact with the CTO or engineering team."
echo ""
echo "=============================================="
echo ""

# Verify the TBC workspace exists
if [ ! -f "$TBC_WORKSPACE/CLAUDE.md" ]; then
  echo "ERROR: TBC workspace not found at $TBC_WORKSPACE/CLAUDE.md"
  echo "Please ensure the project is set up correctly."
  exit 1
fi

# Launch Claude Code in the TBC workspace
cd "$TBC_WORKSPACE"
exec claude
