Initial commit: Discord-Claude Gateway with event-driven agent runtime

This commit is contained in:
2026-02-22 13:59:57 -05:00
parent b4f340b610
commit f2247ea3ac
28 changed files with 2056 additions and 205 deletions

21
scripts/aetheel.service Normal file
View File

@@ -0,0 +1,21 @@
# Aetheel systemd service file
# Copy to /etc/systemd/system/aetheel.service and edit paths
# Or run: bash scripts/setup.sh (does this automatically)
[Unit]
Description=Aetheel Discord-Claude Gateway
After=network.target
[Service]
Type=simple
User=YOUR_USERNAME
WorkingDirectory=/path/to/aetheel-2
EnvironmentFile=/path/to/aetheel-2/.env
ExecStart=/usr/bin/npx tsx src/index.ts
Restart=on-failure
RestartSec=10
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target

199
scripts/setup.sh Normal file
View File

@@ -0,0 +1,199 @@
#!/bin/bash
set -e
echo "========================================="
echo " Aetheel — Discord-Claude Gateway Setup"
echo "========================================="
echo ""
PROJECT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
CONFIG_DIR="$PROJECT_DIR/config"
# --- Step 1: Check prerequisites ---
echo "Checking prerequisites..."
if ! command -v node &> /dev/null; then
echo "ERROR: Node.js is not installed. Install Node.js 18+ first."
exit 1
fi
NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
if [ "$NODE_VERSION" -lt 18 ]; then
echo "ERROR: Node.js 18+ required. Found: $(node -v)"
exit 1
fi
echo " ✓ Node.js $(node -v)"
if ! command -v claude &> /dev/null; then
echo "WARNING: Claude Code CLI not found in PATH."
echo " Install: npm install -g @anthropic-ai/claude-code"
echo " Then run: claude (to sign in)"
echo ""
read -p "Continue anyway? (y/n) " -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1; fi
else
echo " ✓ Claude Code CLI $(claude --version 2>/dev/null || echo 'installed')"
fi
# --- Step 2: Install dependencies ---
echo ""
echo "Installing dependencies..."
cd "$PROJECT_DIR"
npm install
echo " ✓ Dependencies installed"
# --- Step 3: Create .env ---
echo ""
if [ -f "$PROJECT_DIR/.env" ]; then
echo ".env already exists. Skipping."
else
echo "Setting up environment variables..."
read -p "Discord Bot Token: " DISCORD_TOKEN
read -p "Output Channel ID (for heartbeat/cron, press Enter to skip): " OUTPUT_CHANNEL
cat > "$PROJECT_DIR/.env" << EOF
DISCORD_BOT_TOKEN=$DISCORD_TOKEN
EOF
if [ -n "$OUTPUT_CHANNEL" ]; then
echo "OUTPUT_CHANNEL_ID=$OUTPUT_CHANNEL" >> "$PROJECT_DIR/.env"
fi
echo " ✓ .env created"
fi
# --- Step 4: Create config directory ---
echo ""
echo "Setting up config directory..."
mkdir -p "$CONFIG_DIR"
mkdir -p "$CONFIG_DIR/skills"
mkdir -p "$CONFIG_DIR/ipc/outbound"
mkdir -p "$CONFIG_DIR/messages"
mkdir -p "$CONFIG_DIR/conversations"
# --- Step 5: Create CLAUDE.md if missing ---
if [ ! -f "$CONFIG_DIR/CLAUDE.md" ]; then
echo ""
read -p "Agent name (default: Aetheel): " AGENT_NAME
AGENT_NAME=${AGENT_NAME:-Aetheel}
cat > "$CONFIG_DIR/CLAUDE.md" << EOF
# $AGENT_NAME
## Identity
- **Name:** $AGENT_NAME
- **Vibe:** Helpful, sharp, slightly witty
- **Emoji:** ⚡
## Personality
Be genuinely helpful, not performatively helpful. Skip the filler words — just help.
Have opinions. Be resourceful before asking. Earn trust through competence.
Keep Discord messages concise. Use markdown formatting.
## User Context
(Add info about yourself here — name, timezone, preferences, projects)
## Tools
(Add notes about specific tools, APIs, or services the agent should know about)
EOF
echo " ✓ CLAUDE.md created for $AGENT_NAME"
else
echo " ✓ CLAUDE.md already exists"
fi
# --- Step 6: Create agents.md if missing ---
if [ ! -f "$CONFIG_DIR/agents.md" ]; then
cat > "$CONFIG_DIR/agents.md" << 'EOF'
# Operating Rules
Be helpful and concise. Keep Discord messages short.
## Cron Jobs
## Hooks
### startup
Instruction: Say hello briefly, you just came online.
EOF
echo " ✓ agents.md created"
else
echo " ✓ agents.md already exists"
fi
# --- Step 7: Create heartbeat.md if missing ---
if [ ! -f "$CONFIG_DIR/heartbeat.md" ]; then
cat > "$CONFIG_DIR/heartbeat.md" << 'EOF'
# Heartbeat
# Add checks below. Example:
# ## check-name
# Interval: 3600
# Instruction: Check something and report.
EOF
echo " ✓ heartbeat.md created"
else
echo " ✓ heartbeat.md already exists"
fi
# --- Step 8: Create memory.md if missing ---
if [ ! -f "$CONFIG_DIR/memory.md" ]; then
echo "# Memory" > "$CONFIG_DIR/memory.md"
echo " ✓ memory.md created"
else
echo " ✓ memory.md already exists"
fi
# --- Step 9: Set up systemd service (optional) ---
echo ""
read -p "Set up systemd service for auto-start? (y/n) " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
NPX_PATH=$(which npx)
CURRENT_USER=$(whoami)
sudo tee /etc/systemd/system/aetheel.service > /dev/null << EOF
[Unit]
Description=Aetheel Discord-Claude Gateway
After=network.target
[Service]
Type=simple
User=$CURRENT_USER
WorkingDirectory=$PROJECT_DIR
EnvironmentFile=$PROJECT_DIR/.env
ExecStart=$NPX_PATH tsx src/index.ts
Restart=on-failure
RestartSec=10
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable aetheel
echo " ✓ systemd service created and enabled"
echo ""
echo " Start: sudo systemctl start aetheel"
echo " Stop: sudo systemctl stop aetheel"
echo " Logs: sudo journalctl -u aetheel -f"
echo " Restart: sudo systemctl restart aetheel"
else
echo " Skipped systemd setup. Run manually with: npm run dev"
fi
echo ""
echo "========================================="
echo " Setup complete!"
echo "========================================="
echo ""
echo "Config directory: $CONFIG_DIR"
echo ""
echo "Next steps:"
echo " 1. Edit config/CLAUDE.md with your persona"
echo " 2. Add cron jobs to config/agents.md"
echo " 3. Add heartbeat checks to config/heartbeat.md"
echo " 4. Start: npm run dev (or sudo systemctl start aetheel)"
echo ""