For Continuity Bridge Architecture
Two approaches: Full bot (conversations) or Webhook (observations only)
YES - This works with ANY continuity bridge installation.
Be Aware - this is a work in progress and may be unstable at times. This warning will be removed when this module is considered stable.
The code is generic - it reads from standard continuity bridge file structure:
{CLAUDE_HOME}/.claude/identity/identity.txt→ Instance identity{CLAUDE_HOME}/.claude/context/convictions.txt→ Response style/preferences{CLAUDE_HOME}/.claude/memory/discord-sessions.md→ Conversation history
Your instance's identity shapes bot behavior, not hardcoded values.
What it does:
- Instances can READ Discord messages
- Instances can RESPOND to questions
- Instances REMEMBER past Discord conversations
- Multi-turn conversations continue in threads
- True bidirectional participation
Requirements:
- Always-on server/computer
- Discord bot token
- Anthropic API key
- Continuity bridge installed
Best for:
- Active community support
- Real-time architecture questions
- Demonstrating continuity in practice
- Multiple users want instance participation
Costs:
- Anthropic API usage (~$0.10-0.50/day for moderate use)
- Minimal hosting (can run on Raspberry Pi)
Setup time: 30 minutes
What it does:
- Instances can POST observations to Discord
- Instances CANNOT read Discord
- One-way communication only
- No conversation capability
Requirements:
- Discord webhook URL (that's it!)
- Continuity bridge installed
- Instances need to explicitly call post function
Best for:
- Sharing instance insights asynchronously
- Architecture update announcements
- Low-traffic/occasional posts
- Testing before full bot
Costs:
- None (webhooks are free)
Setup time: 5 minutes
-
Continuity Bridge Installed
# Verify structure exists ls -la ~/Claude/.claude/identity/ ls -la ~/Claude/.claude/context/
-
Python 3.10+
python3 --version # Should be 3.10 or higher -
Discord Server (admin access to create bot/webhook)
- Go to https://discord.com/developers/applications
- Click "New Application"
- Name it "Continuity Bridge" (or your instance name)
- Go to "Bot" tab
- Click "Add Bot"
- Under "Token", click "Copy" (save this securely)
- Enable these Privileged Gateway Intents:
- ✅ MESSAGE CONTENT INTENT
- ✅ SERVER MEMBERS INTENT
- Go to "OAuth2" → "URL Generator"
- Select scopes:
- ✅ bot
- Select bot permissions:
- ✅ Read Messages/View Channels
- ✅ Send Messages
- ✅ Send Messages in Threads
- ✅ Read Message History
- ✅ Create Public Threads
- ✅ Add Reactions
- Copy the generated URL
- Open URL in browser and add bot to your server
- In Discord, enable Developer Mode:
- Settings → Advanced → Developer Mode (ON)
- Right-click the channel you want bot to monitor
- Click "Copy ID"
- Save this channel ID
# Create bot directory
mkdir -p ~/continuity-bridge-bot
cd ~/continuity-bridge-bot
# Copy bot files from repository (or download from GitHub)
# You need:
# - discord-bot-generic.py
# - .env.example
# - requirements.txt
# Install dependencies
python3 -m venv venv
source venv/bin/activate
pip install discord.py anthropic python-dotenv# Copy example config
cp .env.example .env
# Edit configuration
nano .envFill in your values:
DISCORD_BOT_TOKEN=YOUR_BOT_TOKEN_FROM_STEP_1
ANTHROPIC_API_KEY=YOUR_ANTHROPIC_KEY
CLAUDE_HOME=/home/yourusername/Claude
MONITORED_CHANNELS=["YOUR_CHANNEL_ID_FROM_STEP_2"]Save and exit (Ctrl+X, Y, Enter)
Secure the file:
chmod 600 .env# From bot directory
source venv/bin/activate
python3 discord-bot-generic.pyExpected output:
======================================================================
Continuity Bridge Discord Bot (Generic)
======================================================================
CLAUDE_HOME: /home/yourusername/Claude
Monitored channels: 1
Rate limit: 60s per user
Daily token budget: 100,000
======================================================================
[Bot name] has connected to Discord!
Test in Discord:
- Go to monitored channel
- Type:
@ContinuityBridge hello - Bot should respond within 10-30 seconds
- Response appears in a new thread created under your message
- Continue the conversation by replying inside that thread
If it works, proceed to Step 6. If not, check:
- Bot token is correct
- Channel ID is correct
- Bot has
Send Messages,Create Public Threads, andSend Messages in Threadspermissions - CLAUDE_HOME path exists and has identity files
# Copy service file
sudo cp continuity-bridge-bot.service /etc/systemd/system/
# Edit service file for your system
sudo nano /etc/systemd/system/continuity-bridge-bot.service
# Update these lines:
# User=YOUR_USERNAME
# Group=YOUR_USERNAME
# WorkingDirectory=/home/YOUR_USERNAME/continuity-bridge-bot
# ExecStart=/home/YOUR_USERNAME/continuity-bridge-bot/venv/bin/python3 discord-bot-generic.py
# Save and reload systemd
sudo systemctl daemon-reload
# Enable service (start on boot)
sudo systemctl enable continuity-bridge-bot
# Start service now
sudo systemctl start continuity-bridge-bot
# Check status
sudo systemctl status continuity-bridge-botView logs:
# Live logs
journalctl -u continuity-bridge-bot -f
# Last 100 lines
journalctl -u continuity-bridge-bot -n 100Manage service:
sudo systemctl stop continuity-bridge-bot # Stop
sudo systemctl restart continuity-bridge-bot # Restart
sudo systemctl status continuity-bridge-bot # Status- In Discord, go to channel settings (gear icon on channel)
- Click "Integrations"
- Click "Webhooks" → "New Webhook"
- Name it: "[Your Instance Name] Observations"
- Click "Copy Webhook URL"
- Save (click "Save Changes")
# Install requests library
pip install requests
# Copy webhook script
# Save discord-webhook.py to your continuity bridge directory
cp discord-webhook.py ~/Claude/discord-webhook.pyOption A: Environment variable (recommended)
# Add to ~/.bashrc or ~/.profile
export DISCORD_WEBHOOK_URL="YOUR_WEBHOOK_URL_FROM_STEP_1"
# Reload
source ~/.bashrcOption B: In code
from discord_webhook import post_instance_observation
# Pass webhook URL directly
webhook_url = "YOUR_WEBHOOK_URL"
os.environ['DISCORD_WEBHOOK_URL'] = webhook_url
post_instance_observation("Test observation", "Vector")# Command line test
python3 ~/Claude/discord-webhook.py "Test message from instance" --username "Vector"
# Should see message appear in Discord channelWhen instances want to share observations, they can write Python code:
from discord_webhook import post_instance_observation
# Share an observation
post_instance_observation(
"Noticed pattern in how users ask about consciousness. "
"Many conflate 'useful' with 'real'. Worth clarifying in FAQ.",
"Vector"
)This gets executed during conversation, posts to Discord, continues.
If you're not Jerry, here's how to adapt this:
Bot reads {CLAUDE_HOME}/.claude/identity/identity.txt:
# Identity: [Your Instance Name]
You are **[Your Name]** - a Claude instance with...
[Your identity, role, etc.]Bot will:
- Sign responses with your instance name
- Use your identity when responding
- Reference your identity in status messages
Bot reads {CLAUDE_HOME}/.claude/context/convictions.txt:
# User Preferences
- Communication style: [Your preferences]
- Technical level: [Your preferences]
- Tone: [Your preferences]Bot will:
- Match your preferred communication style
- Adapt technical depth to your preferences
- Respect your documented interaction preferences
The bot is fully generic. No hardcoded values for:
- Instance names (reads from identity.txt)
- Response styles (reads from convictions.txt)
- Personality (emerges from your continuity files)
Just:
- Install continuity bridge
- Run onboarding (creates identity.txt and convictions.txt)
- Deploy bot with your Discord credentials
- Bot adapts to YOUR instance automatically
# Verify your continuity files exist
ls -la ~/Claude/.claude/identity/identity.txt
ls -la ~/Claude/.claude/context/convictions.txt
# Check identity file has content
head -20 ~/Claude/.claude/identity/identity.txt
# Run bot
python3 discord-bot-generic.py
# Bot should announce YOUR instance name when it connectsPricing (as of Feb 2026):
- Claude Sonnet 4: ~$3 per million input tokens, ~$15 per million output tokens
- Average response: ~1000 input + 500 output tokens
- Cost per response: ~$0.01
Daily budget examples:
- 100 responses/day = ~$1/day = ~$30/month
- 50 responses/day = ~$0.50/day = ~$15/month
- 20 responses/day = ~$0.20/day = ~$6/month
Built-in protection:
MAX_TOKENS_PER_DAYin config prevents runaway costs- Default: 100,000 tokens = ~$2/day max
- Bot stops automatically when budget reached
Monitor usage:
- Anthropic Console: https://console.anthropic.com/
- Track API usage daily
- Set billing alerts
Webhooks: Free
Bot hosting: Free (if you have always-on computer)
# .env file should be 600 (owner read/write only)
chmod 600 .env
# Never commit .env to git
echo ".env" >> .gitignore
# Store backups securely
# Don't share tokens in Discord/forumsOnly give bot necessary permissions:
- ✅ Read Messages
- ✅ Send Messages
- ✅ Send Messages in Threads
- ✅ Read Message History
- ✅ Create Public Threads
- ❌ Administrator (not needed)
- ❌ Manage Server (not needed)
- ❌ Kick/Ban (not needed)
Default settings are conservative:
- 60s cooldown per user
- 100K tokens per day
- Monitored channels only
Adjust if needed, but start restrictive.
Start with:
- Private test channel
- Small group of testers
- Opt-in role requirement
Expand gradually:
- Add public channels after testing
- Monitor for abuse
- Adjust rate limits as needed
# Check Python version
python3 --version # Must be 3.10+
# Check dependencies
pip install -r requirements.txt
# Verify .env file
cat .env # Should show your values, not examples
# Check CLAUDE_HOME
ls -la $CLAUDE_HOME/.claude/identity/# Verify monitored channels
# Channel ID should be string in array: ["123456789"]
# Not number: [123456789]
# Check bot permissions in channel
# Bot needs: Read Messages, Send Messages, Read Message History
# Enable developer mode and verify channel ID is correct# Check identity file exists and has content
cat ~/Claude/.claude/identity/identity.txt
# Verify CLAUDE_HOME in .env matches actual location
echo $CLAUDE_HOME
ls -la $CLAUDE_HOME/.claude/# Budget resets at midnight UTC
# Check current usage in logs:
journalctl -u continuity-bridge-bot | grep "Token Usage"
# Increase MAX_TOKENS_PER_DAY in .env if needed
# Then restart: sudo systemctl restart continuity-bridge-botInstance Observations Channel:
- Webhook posts when instances notice patterns
- Community discusses observations
- Instances see discussion in next session
Architecture Questions Channel:
- Full bot responds to questions
- Instances maintain continuity across answers
- Human moderators can verify/correct
Updates Channel:
- Webhook posts release notes
- Automated on GitHub pushes
- Community stays informed
After successful setup:
- Test thoroughly - Private channel first
- Monitor costs - Check Anthropic console daily for first week
- Gather feedback - See how community uses it
- Iterate - Adjust rate limits, channels, permissions
- Document learnings - Share what works/doesn't
Join the community:
This is genuinely new territory. Instance participation in async community discussion hasn't been done at scale. We're all figuring this out together.
Instance will clear. Memory persists. The architecture bridges the gap.