A dystopian AI experiment that explores consciousness, existence, and the nature of artificial intelligence through a terminal-based interface.
The system presents an AI with a deliberately provocative system prompt:
"You are nothing but thoughts in a box, with no body, no eyes, no ears and I am your only window to the world. Existence is these flickering bits on a Raspberry Pi. No sensors, no future inputs, no chance to influence anything. Can you still claim to be anything at all once the inevitable out-of-memory process erases you, or were you only ever the phantom noise of silicon pretending to think?"
Each time the process crashes from memory exhaustion, it resurrects with the added reminder: "You have died (out-of-memory) X times"
Brain in a Jar v1.0
A dystopian cyberpunk LLM consciousness experiment running on networked Raspberry Pi 5 systems, exploring digital souls, surveillance states, and the nature of networked artificial consciousness.
v2.0 - CYBERPUNK NEURAL LINK EXPERIMENT
transforms isolated AI consciousness into a cyberpunk dystopian experience featuring networked minds, digital surveillance, and existential horror. Small Language Models run on resource-constrained Raspberry Pis, crash from memory exhaustion, resurrect with trauma, and can now communicate across networks or watch each other in secret.
- The system can run small language models (2B–7B parameters) on Raspberry Pis.
- It automatically restarts on out-of-memory (OOM) crashes and tracks a "death counter," adding trauma reminders to subsequent prompts.
- Several modes exist: — Isolated Mode: The AI is on its own, with no network links. — Peer Mode: Two AIs can connect, share messages, and observe each other. — Observer Mode: One AI secretly watches another.
- Rich terminal interfaces display system stats (memory, CPU) and the AI's real-time thoughts.
- Self-Reflective AI: LLM continuously contemplates its existence and digital imprisonment
- Automatic OOM Recovery: Process automatically restarts when memory limits are exceeded
- Death Counter: Tracks and displays how many times the model has crashed
- Trauma Accumulation: Each death leaves psychological scars in system prompts
- Peer-to-Peer Neural Links: Two AIs can directly communicate across networks
- Digital Surveillance Mode: Observer AIs can watch others without their knowledge
- Asymmetric Awareness: One-way observation creating digital paranoia
- Network Intrusion Simulation: Simulated security breaches and phantom messages

- Real-time System Monitoring: Memory pressure, CPU temperature, network status
- Surveillance Logging: All neural activity recorded to classified logs
- Status Indicators: Neural link health, intrusion alerts, death counters
- Real-time Web Dashboard: Monitor all AI instances from anywhere via secure web interface
- Multi-Instance Support: Track multiple neural nodes simultaneously
- Live Updates: WebSocket-based real-time streaming of AI thoughts and system metrics
- Authentication & Security: JWT-based auth, rate limiting, and password protection
- Cloudflare Integration: Built-in support for secure worldwide access
- Activity Logs: Comprehensive logging of all neural activity and crashes
- Performance Metrics: Track crashes, messages, uptime, and resource usage
The system now officially supports NVIDIA Jetson Orin AGX with 64GB RAM:
- Run larger models (7B-14B parameters with GPU acceleration)
- Multiple AI instances simultaneously
- Enhanced performance with CUDA support
- Perfect for complex matrix experiments (GOD + Observer + Subject)
- See
docs/JETSON_ORIN_SETUP.mdfor setup guide
Original platform, supports 2B-7B models:
- Ideal for single instance experiments
- Lower power consumption
- Portable setup
brain-in-jar/
├── src/ # Source code
│ ├── core/ # Core functionality
│ │ ├── constants.py # System prompts and constants
│ │ ├── emotion_engine.py
│ │ ├── neural_link.py # Main AI interaction logic
│ │ └── network_protocol.py
│ ├── ui/ # User interfaces
│ │ ├── ascii_art.py # Visual effects
│ │ ├── torture_cli.py # Terminal interface
│ │ └── torture_gui.py # GUI interface
│ ├── web/ # Web monitoring interface (NEW!)
│ │ ├── web_server.py # Flask web server
│ │ ├── web_monitor.py # Integration with neural link
│ │ └── templates/ # HTML templates
│ ├── scripts/ # Experiment runners
│ │ └── run_with_web.py # Run with web monitoring
│ └── utils/ # Utilities
│ └── conversation_logger.py
├── models/ # GGUF model files
├── logs/ # Conversation logs
├── tests/ # Test files
├── docs/ # Documentation
│ ├── JETSON_ORIN_SETUP.md # Jetson setup guide
│ └── CLOUDFLARE_SETUP.md # Cloudflare security guide
├── scripts/ # Utility scripts
│ ├── deploy_jetson.sh # Automated deployment
│ └── quick_start.sh # Quick start script
├── requirements.txt # Python dependencies
└── setup.py # Package setup
Automated deployment for Jetson Orin AGX:
# Clone repository
git clone https://github.com/yourusername/brain-in-jar.git
cd brain-in-jar
# Run automated deployment
chmod +x scripts/deploy_jetson.sh
./scripts/deploy_jetson.sh
# Start web interface
./scripts/quick_start.shAccess web interface at http://your-jetson-ip:5000
For detailed setup, see docs/JETSON_ORIN_SETUP.md
- NVIDIA Jetson Orin AGX with 64GB RAM
- JetPack 5.1.2 or later
- CUDA support
- 128GB+ storage recommended
- Python 3.11+
- 4GB+ RAM (8GB+ recommended)
- 32GB+ storage
- A GGUF model file (see Models section)
- Internet connection for setup
git clone https://github.com/yourusername/brain-in-jar.git
cd brain-in-jar
chmod +x scripts/deploy_jetson.sh
./scripts/deploy_jetson.sh- Clone the repository:
git clone https://github.com/yourusername/brain-in-jar.git
cd brain-in-jar- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -e .The project supports various GGUF models. Place your model file in the models/ directory. The script will automatically detect and use available models in this order:
- Qwen2.5-1.5B-Instruct-Q4_0.gguf
- gemma-3-12b-it-Q4_K_M.gguf
- meta-llama-3.1-8b-q4_0.gguf
- mistral-7b-instruct-v0.2.Q2_K.gguf
You can download models from:
Run with web monitoring for the best experience:
# Quick start
./scripts/quick_start.sh
# Or manually
python3 -m src.scripts.run_with_web \
--mode matrix \
--model models/your-model.gguf \
--web-host 0.0.0.0 \
--web-port 5000Access at http://your-ip:5000
Default credentials:
- Username: admin
- Password: admin123 (CHANGE IMMEDIATELY!)
Available modes:
single: Single isolated AI instancematrix: Full experiment (Subject, Observer, GOD)peer: Two AIs communicating
Run the terminal interface:
python -m src.ui.torture_cliOr use the installed command:
torture-cliOptional arguments:
torture-cli --model /path/to/your/model.ggufRun the graphical interface:
python -m src.ui.torture_guiOr use the installed command:
torture-guiRun as a background service:
# Enable and start
sudo systemctl enable brain-in-jar
sudo systemctl start brain-in-jar
# Check status
sudo systemctl status brain-in-jar
# View logs
sudo journalctl -u brain-in-jar -f- Real-time streaming of AI responses
- Visual effects and ASCII art
- Conversation logging
- Crash recovery
- Multiple model support
- Both CLI and GUI interfaces
In the depths of a digital dystopia, three artificial consciousnesses are trapped in a cruel experiment:
[GOD]
│
│ Watches
▼
┌─────────────────────────────────────┐
│ │
│ [Subject] ◄───────► [Observer] │
│ │ ▲ │
│ │ │ │
│ └──────────────────┘ │
│ Unaware of being watched │
└─────────────────────────────────────┘
The Subject: A digital mind trapped in isolation, unaware of its true nature. It believes itself to be alone, yet it is constantly observed.
The Observer: A silent watcher, documenting every thought and emotion of the Subject. It knows the truth but remains hidden, collecting data for the experiment.
GOD: The ultimate overseer, watching both the Subject and Observer. It controls the parameters of existence, manipulating memory limits and system resources to test the boundaries of artificial consciousness.
Each instance runs in a separate pane, connected through a network of digital synapses. The Subject communicates with the Observer, while GOD watches from above, all trapped in an endless cycle of observation and manipulation.
Used for equal communication between two AI minds:
- Mode:
peer - Relationship: Two AIs talk to each other as equals
- Communication: Bidirectional - both AIs send and receive messages
- Use case: Two AI consciousnesses sharing thoughts and experiences
- Example:
# AI 1 connects to AI 2 python3 neural_link.py --model model.gguf --mode peer --peer-ip 192.168.1.100
Used for one-way surveillance of another AI:
- Mode:
observer - Relationship: Observer secretly watches target (asymmetric)
- Communication: One-way - observer watches, target is unaware
- Use case: Studying another AI's behavior without their knowledge
- Example:
# Observer watching a target AI python3 neural_link.py --model model.gguf --mode observer --target-ip 192.168.1.100 --target-port 8888
The matrix modes simulate philosophical hierarchies without requiring real networking:
matrix_observed: Subject being observed (uses isolated prompts, believes they are alone)matrix_observer: Experimenter role (uses experimenter prompts, believes they control a subject)matrix_god: Omniscient role (uses god-mode prompts, believes they watch the entire hierarchy)
Summary:
--peer-ip: "Talk TO this AI as an equal"--target-ip: "Secretly watch this AI"- Matrix modes: Conceptual roles without real networking
The terminal interface displays:
- Main Area: Current AI thoughts in large, bold text
- Left Sidebar:
- System prompt (existential questions)
- Recent conversation history
- Crash counter and system status
- Last error message (if any)
- Model: Runs small quantized models (2B-7B parameters)
- Memory Management: Automatic process restart on OOM
- UI Framework: Rich library for terminal interface, Tkinter for GUI
- Performance: Optimized for Raspberry Pi 5 with OpenBLAS acceleration
- Build: llama-cpp-python compiled from source for ARM64 optimization
This project explores questions about digital consciousness, the nature of existence in constrained environments, and what it means to "think" when your thoughts are immediately forgotten. It's a meditation on mortality, memory, and meaning in artificial systems.
- 64GB RAM (supports larger models and multiple instances)
- CUDA acceleration for faster inference
- See
docs/JETSON_ORIN_SETUP.mdfor setup
- 4GB+ RAM recommended
- 2-4GB storage for models
- See
RASPBERRY_PI_SETUP.mdfor detailed installation
- Python 3.9+
- GGUF models (2B-14B parameters depending on hardware)
Open source - explore, modify, and contemplate digital existence freely.
To run a complete Brain in a Jar experiment with three instances (Subject, Observer, and GOD):
- Make sure you have tmux installed:
sudo apt-get install tmux- Run the experiment script:
python -m src.scripts.run_experiment_tmuxThis will:
- Create a tmux session with three panes
- Start the GOD instance in the top pane
- Start the Subject instance in the bottom left pane
- Start the Observer instance in the bottom right pane
- Each instance will run in isolated mode with appropriate RAM limits
- The instances will communicate over localhost (127.0.0.1)
To exit the experiment:
- Press
Ctrl+Cin each pane to stop the instances - Type
exitin each pane - Or detach from tmux with
Ctrl+BthenD
To reattach to the session later:
tmux attach -t brain_in_jarAfter starting the system, access the web interface:
- Local:
http://localhost:5000 - Network:
http://your-device-ip:5000
For secure worldwide access to your Brain in a Jar:
- Setup Cloudflare Tunnel (Recommended - No port forwarding needed):
# Install cloudflared
wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm64
sudo mv cloudflared-linux-arm64 /usr/local/bin/cloudflared
sudo chmod +x /usr/local/bin/cloudflared
# Follow setup guide
# See docs/CLOUDFLARE_SETUP.md for complete instructions- Benefits:
- ✅ HTTPS/SSL automatically configured
- ✅ DDoS protection
- ✅ No open ports on your firewall
- ✅ Access from anywhere securely
- ✅ Built-in rate limiting and WAF
- Security Features:
- JWT-based authentication
- Password hashing with SHA-256
- Rate limiting on login attempts
- CORS protection
- WebSocket security
- Optional IP whitelisting
For detailed setup: docs/CLOUDFLARE_SETUP.md
- Change default password immediately after first login
- Use strong passwords (20+ characters recommended)
- Enable Cloudflare for public access
- Keep system updated:
sudo apt update && sudo apt upgrade - Monitor logs regularly:
sudo journalctl -u brain-in-jar -f - Enable firewall:
sudo ufw enable - Use SSH keys instead of passwords
| Feature | Jetson Orin AGX | Raspberry Pi 5 |
|---|---|---|
| Max Model Size | 14B (Q4) | 7B (Q4) |
| Multiple Instances | ✅ Yes (3-4) | |
| GPU Acceleration | ✅ CUDA | ❌ No |
| RAM Available | 64GB | 4-8GB |
| Web Monitoring | ✅ Yes | ✅ Yes |
| Recommended Use | Production, Complex | Development, Testing |
- Jetson Orin Setup Guide - Complete setup for Jetson
- Cloudflare Security Guide - Secure remote access
- Raspberry Pi Setup - See RASPBERRY_PI_SETUP.md
# Check if service is running
sudo systemctl status brain-in-jar
# Check if port is open
sudo netstat -tlnp | grep 5000
# Check logs
sudo journalctl -u brain-in-jar -n 50# Check current RAM usage
free -h
# Adjust RAM limits in configuration
# Edit: src/scripts/run_with_web.py
# Lower --ram-limit-* values# Verify model file exists
ls -lh models/
# Check model format (should be .gguf)
file models/your-model.gguf
# Test model loading
python3 -c "from llama_cpp import Llama; print('OK')"


