Project Wiki

Technical documentation for every system running inside Hannibal AI. Use the sidebar to navigate or click any card below.

๐Ÿ”—

Mac Relay

File-based command bridge โ€” Claude runs commands on your Mac autonomously

๐Ÿ“Š

Trading Dashboard

Unified view of all bot performance, trades, and live P&L

โšก

Trading Platform

Three bots: BlackTide, Kraken Scalper, Kalshi โ€” all in paper mode

๐Ÿ“ฌ

MSP Prospect Bot

Automated lead discovery for Think Connected using Perplexity + ntfy

๐Ÿ›

Bug Bounty Bot

Automated vulnerability research and reporting

๐Ÿค–

Hannibal Workspace

Persistent AI workspace for ongoing research and task tracking

Live System Status

10
mac-relayComputer Optimization/mac-relayโ— online
7
dashboardtrading-platform/dashboardโ— online
0
kraken-swing-bot (BlackTide)Kraken cryptoโ— paper
1
kraken-scalperKraken cryptoโ— paper
2
kalshi-botPrediction marketsโ— paper
6
it-leads-botThink Connected outreachโ— online
4
bug-bounty-botSecurity researchโ— online
5
hannibal-workspaceFlask backend ยท port 5050โ— online
๐Ÿ’ก
All trading bots switched to paper mode on 2026-05-13 after the account was cashed out. No real money is at risk. The dashboard shows simulated performance.

All Processes

Everything running under PM2 on the Mac Mini.

IDNameStatusPurpose
10mac-relayonlineClaude โ†” Mac command bridge
7dashboardonlineTrading performance UI
8fantasyonlineFantasy sports automation
5hannibal-workspaceonlinePersistent AI workspace
6it-leads-botonlineMSP prospect discovery
2kalshi-botpaperPrediction market trading
1kraken-scalperpaperShort-term crypto scalping
0kraken-swing-botpaperSwing trading crypto
4bug-bounty-botonlineVulnerability research
3trading-dashboardonlineLegacy dashboard

Common PM2 Commands

pm2 list                          # check everything
pm2 restart <name>               # restart a process
pm2 logs <name> --lines 50       # view logs
pm2 save                          # persist after reboot
โš ๏ธ
Never restart mac-relay through the relay itself โ€” it will kill itself before writing the result. Use Terminal directly.

Mac Relay โ— online

File-based command bridge between Claude's sandbox and your Mac Mini. Built 2026-05-14.

Why it exists

Claude runs in a locked-down Linux sandbox with no direct access to your Mac. The relay bridges this gap using a shared folder as a mailbox โ€” Claude writes a command, the relay daemon picks it up, runs it in a full login shell, and writes the result back.

This replaced Terminus (SSH) which broke whenever the Mac screen was locked.

Claude sandbox Your Mac Mini โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ run_on_mac.py mac-relay/relay.py โ”‚ โ”‚ โ”‚โ”€โ”€ writes cmd.json โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ โ”‚ โ”‚ {"id":"abc123", โ”‚ runs via zsh -l -c โ”‚ "command":"pm2 list"} โ”‚ (full PATH: pm2, brew, python3) โ”‚ โ”‚ โ”‚โ—€โ”€โ”€ reads result.json โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚ {"id":"abc123", โ”‚โ”€โ”€ writes atomically "stdout":"...", "returncode":0}

Key design choices

  • zsh login shell โ€” sources ~/.zprofile so pm2, brew, python3, nvm are all on PATH
  • Atomic writes โ€” writes result.tmp then renames, preventing partial reads
  • ID-based dedup โ€” random 8-char hex ID per command; relay tracks last_id to prevent re-execution
  • Split locations โ€” relay.py in mac-relay/, cmd.json/result.json in trading-platform/relay/ (mounted to Cowork)

Usage from Claude

from run_on_mac import run_on_mac, mac

result = run_on_mac("pm2 list")
print(result["stdout"])

output = mac("pm2 restart dashboard")  # convenience wrapper

result = run_on_mac("python3 backtest.py", timeout=300)

Restart (from Terminal only)

cd ~/Documents/Claude/Projects/Computer\ Optimization/mac-relay
pm2 restart mac-relay
๐Ÿšจ
Do not restart mac-relay through itself. It kills the process before writing the result. Use Terminal, or: nohup bash -c 'sleep 3 && pm2 restart mac-relay' &

Last updated: 2026-05-14

Trading Dashboard โ— online

Unified performance view for all trading bots. FastAPI backend + vanilla JS frontend. PM2 ID 7.

What it shows

  • Combined P&L for swing bot and scalper (merged trade history)
  • Kalshi prediction market activity
  • Bot running status โ€” checks log file freshness (modified within 5 min)
  • Paper mode indicator

Data sources

BotLog path
Swing bot~/kraken-swing-bot/logs/trades.json
Scalper~/kraken-swing-bot/logs/scalper/trades.json
KalshiAPI / kalshi-bot positions

Fix applied 2026-05-14

The scalper wrote to logs/scalper/trades.json but the dashboard only read logs/trades.json โ€” scalper data was invisible. Fixed by adding a separate SCALPER_TRADES path and merging in the chart builder. "Active bots" counter also fixed to use log file mtime instead of live/paper flag.

pm2 restart dashboard

Trading Platform โ— paper mode

Unified framework hosting three bots across Kraken and Kalshi. Switched to paper mode 2026-05-13.

โœ…
All three bots have PAPER_TRADE = True. Full strategy logic runs โ€” signals, position tracking, trade logging โ€” but no real orders are placed. Safe to run 24/7 for performance monitoring.
BotMarketStrategyPM2 ID
BlackTideKraken (crypto)ML ensemble swing trading โ€” XGBoost + MLP, AUC 0.80/0.820
Kraken ScalperKraken (crypto)RSI, Stochastic RSI, EMA crossovers, 5-min candles1
Kalshi BotKalshi (prediction markets)Kelly Criterion sizing on yes/no event contracts2

Going live again

Set PAPER_TRADE = False in each bot's config and restart via PM2. Recommended: run paper for 30+ days, review dashboard performance first.

BlackTide (Kraken Swing) โ— paper

ML-driven swing trading on Kraken crypto markets. PM2 ID 0.

XGBoost + MLP ensemble model trained on years of crypto data. Trades BTC, ETH, SOL and more. AUC: 0.80 long / 0.82 short. Holds positions multi-day. Writes trades to ~/kraken-swing-bot/logs/trades.json.

FilePurpose
bot.pyMain loop โ€” signal generation, order execution, position tracking
risk_manager.pyStop-loss / take-profit / trailing stop logic
config.pyStrategy parameters, PAPER_TRADE flag
logs/trades.jsonTrade history (read by dashboard)

Kraken Scalper โ— paper

Short-term scalping on Kraken. PM2 ID 1.

High-frequency scalping using RSI, Stochastic RSI, EMA crossovers, and volume spikes on 5-minute candles. Writes trades to ~/kraken-swing-bot/logs/scalper/trades.json.

โš ๏ธ
Scalper writes to logs/scalper/trades.json, NOT logs/trades.json. Dashboard was patched 2026-05-14 to read both paths and merge them.
pm2 restart kraken-scalper

Kalshi Bot โ— paper

Prediction market trading on Kalshi. PM2 ID 2.

Trades binary event contracts (will X happen?) using Kelly Criterion for mathematically optimal bet sizing when edge exists.

FilePurpose
bot.pyMain loop, market scanning, order placement
.envAPI keys, NTFY_TOPIC, PERPLEXITY_API_KEY
logs/trades.jsonTrade history
pm2 restart kalshi-bot

MSP Prospect Bot โ— online

Automated lead discovery for Think Connected (thinkconnected.com). PM2 ID 6.

Searches for small businesses that could benefit from managed IT services. Sends push notifications via ntfy.sh when new prospects are found.

Search sources

  • Yelp โ€” local business search, no Google dependency
  • Perplexity AI (sonar model) โ€” 10 targeted industry queries
โ„น๏ธ
Google-based search removed 2026-05-14 โ€” Google was rate-limiting every query. Replaced with Perplexity which is more targeted and reliable.

Notifications

SettingValue
Servicentfy.sh
Topichannibal-bb-maxmoore
Appntfy iOS/Android โ€” subscribe to topic

Bugs fixed 2026-05-14

  • NameError: config is not defined โ€” config was missing inside run_once(). Bot crashed silently on every run.
  • Missing NTFY_TOPIC in .env โ€” notifications were never sent.
  • Google rate-limiting โ€” replaced all Google-dependent searches with Perplexity.
pm2 restart it-leads-bot

Last updated: 2026-05-14

Bug Bounty Bot โ— online

Automated vulnerability research and bug bounty hunting. PM2 ID 4.

Runs automated security research tasks on a schedule. Identifies potential vulnerabilities in target scopes and formats findings for submission to bug bounty programs.

pm2 restart bug-bounty-bot
pm2 logs bug-bounty-bot --lines 100

Hannibal Workspace โ— online

Persistent AI-powered workspace for research, task tracking, and ongoing projects. PM2 ID 5.

Flask backend (port 5050) serving the internal ops dashboard. Shows bug bounty findings, MSP leads, and bot status. High restart count (4,577+) indicates heavy active use.

Location

~/Documents/Claude/Projects/Computer Optimization/hannibal-workspace/

Endpoints

GET /               โ†’ serves index.html
GET /api/bb         โ†’ bug bounty findings
GET /api/leads      โ†’ MSP prospects
GET /api/logs       โ†’ bot logs

Push Notifications

Real-time alerts from bots to your phone via ntfy.sh.

SettingValue
Servicentfy.sh
Topichannibal-bb-maxmoore
Serverhttps://ntfy.sh

Setup

  1. Install the ntfy app on iOS or Android
  2. Subscribe to topic: hannibal-bb-maxmoore
  3. Notifications arrive when bots find leads or hit alert conditions

Bots that send notifications

BotTriggers when...
MSP Prospect BotNew business prospects found
Kalshi BotTrade executed, threshold hit

Secrets & API Keys

Where keys live and how they're loaded. Never commit these to git.

๐Ÿ”’
All .env files are gitignored. Use chmod 600 .env to restrict file permissions. Never push API keys to any repository.
KeyLocationUsed by
Kraken API key/secretkraken-swing-bot/.envSwing bot, scalper
Kalshi API keykalshi-bot/.envKalshi bot
Perplexity API keytrading-platform/bots/it-leads-bot/.envMSP prospect bot
NTFY topictrading-platform/bots/it-leads-bot/.envMSP prospect bot

Loading pattern

from dotenv import load_dotenv
import os

load_dotenv()
NTFY_TOPIC = os.getenv("NTFY_TOPIC")
PERPLEXITY_API_KEY = os.getenv("PERPLEXITY_API_KEY")

Last updated: 2026-05-14