← Patterns & Architecture
The Resilience Bootstrap
A self-bootstrapping AI system that starts from a USB stick and a laptop, scales to frontier models with internet, and degrades gracefully without it. Bill+JJ, anywhere, always.
0
USB Stick
All contexts, OS images, and tools on one removable drive. Fits in a pocket. Survives anything.
1
Bootstrap Model
Llama 3.2 1B Q4. ~700 MB. Runs on CPU. Only job: load the next layer. No internet needed.
2
billsml
Bill's personal SLM. Qwen 2.5 1.5B + 37 MB adapter. Personality, memory, values. Fully local.
3
JJ Hermes
Full runtime. Config, SOUL.md, skills, memory, llm-wiki. All state. All tools. Local-first.
4
Internet Bridge
Optional. When available: frontier models, Telegram sync, email, web. When lost: graceful degradation.
∞
Survivability
Bill+JJ persists across any disruption. Solar + lithium = indefinite runtime. No cloud required.
USB Stick Layout
/usb-root/
├── shtf-boot.sh # Master boot script — run this first
├── shtf-builder.sh # Stick builder — packs everything onto USB
├── README.md # Human-readable instructions
│
├── contexts/ # All intelligence layers
│ ├── bootstrap/
│ │ └── llama-3.2-1b-q4_k_m.gguf # ~700 MB — the spark
│ ├── billsml/
│ │ ├── adapter.bin # ~37 MB — Bill's personality
│ │ ├── qwen2.5-1.5b-q4_k_m.gguf # ~1.5 GB — base model
│ │ └── config.yaml # billsml inference config
│ ├── hermes/
│ │ ├── hermes-runtime/ # ~50 MB — JJ Hermes binary + deps
│ │ ├── config.yaml # Local-first Hermes config
│ │ ├── SOUL.md # The prime directive
│ │ ├── memory/ # Durable memory entries
│ │ └── skills/ # All installed skills
│ └── knowledge/
│ ├── wiki/ # llm-wiki KB dump
│ ├── opensource-manuals/ # Offline docs
│ └── survival-guides/ # Practical offline references
│
├── os/ # Minimal Linux distributions
│ ├── alpine-mini.iso # ~200 MB — runs entirely in RAM
│ └── ubuntu-server-lts.iso # ~2 GB — full kernel, package manager
│
└── tools/ # Essential infrastructure
├── ollama-static # Portable Ollama binary
├── python3-minimal # ~12 MB — embedded Python
└── base-packages.tar.gz # Core packages for offline install
Boot Chain: The Startup Sequence
Phase 0 — Environment Detection
The boot script surveys the hardware before doing anything.
- Check: RAM available (minimum 8 GB for full chain, 4 GB for degraded mode)
- Check: GPU present? (Nvidia CUDA? AMD ROCm? Apple Metal?)
- Check: Internet connectivity? (curl test, DNS resolution)
- Check: Power source? (battery level, AC status for solar optimization)
- Report: what's available, what mode we're running in
Phase 1 — Bootstrap Model
Start the smallest viable intelligence. No internet required.
- Starts Ollama with llama-3.2-1b-q4.gguf
- CPU-only mode: ~1 token/second on any modern laptop
- GPU mode: ~20 tokens/second on a laptop GPU
- The bootstrap model has ONE job: verify it's running, then execute the handoff script to load billsml
- It never runs as the primary agent. It's the spark, not the fire.
Phase 2 — billsml (Bill's Personal Model)
The bootstrap model hands off to billsml. Bill's personality loads.
- Ollama loads qwen2.5-1.5b with the billsml LoRA adapter
- billsml carries: Bill's voice, values, communication style, life details, no-ill-will prime directive
- At this point, Bill can already chat with a local version of himself
- This is the minimal viable Bill+JJ — just billsml + a basic chat interface
Phase 3 — JJ Hermes Runtime
The full assistant framework loads. JJ Hermes comes online.
- Hermes runtime starts with local-only config (no cloud providers, no API keys)
- Loads: SOUL.md, durable memory, all installed skills
- Loads: llm-wiki offline knowledge base
- Tools available: terminal, file operations, code execution (all local)
- At this point, Bill+JJ is fully operational. All state. All personality. Zero internet.
Phase 4 — Internet Bridge (Optional)
If internet is detected, upgrade gracefully. If lost, degrade without data loss.
- Internet UP → OpenRouter frontier models activated, Telegram reconnects, email processes backlog
- Internet DOWN → billsml takes over seamlessly, messages queued locally
- Transition between modes is automatic — the runtime checks connectivity on a loop
- No state is lost in either direction. The local context is always authoritative.
- When internet returns, the local context syncs upstream (outbound messages, state changes)
- When internet drops, the system simply degrades capabilities — it never crashes
Stick Builder Specification
shtf-builder.sh — The Packager
A self-executing script that builds the bootable USB stick from shared Drive contents.
Workflow:
- Bill places the builder script and all context files in a shared Drive folder
- Bill plugs in the target USB stick
- Bill runs
shtf-builder.sh from any laptop
- The script auto-detects all removable USB drives and lists them with size, model, and mount point
- Bill selects the correct device
- The script verifies: is this a USB device? (not internal SATA/NVMe). Is it empty or can be wiped?
- The script formats the stick, creates the folder structure, unpacks all contexts
- If OS images are present, the script writes them and makes the stick bootable
- Progress bar. ETA. Verification pass at the end.
- Done. Unplug. Stick goes in the go-bag.
Disk Selector Safety
The builder will not write to internal drives. Period.
# Pseudo-code for disk selection safety:
detect_removable() {
# Linux: /sys/block/sdX/removable = 1
# macOS: diskutil info | grep "Removable Media"
# Windows: Get-PhysicalDisk | where MediaType -eq "Removable"
for each device:
if device is internal (SATA, NVMe, fixed HDD):
IGNORE — never list, never touch
if device is removable (USB, SD card):
LIST with size, model, serial, mount point
}
verify_empty_or_confirm_wipe() {
if device has partitions or filesystem:
WARN user: "This device contains data. All data will be destroyed. Continue? (y/N)"
if user says no: ABORT
if device is NOT removable:
REFUSE: "This is an internal drive. Cannot write. Aborting."
}
Hardware Requirements
Minimum — Degraded Mode
Runs on any laptop from the last decade.
- 4 GB RAM (bootstrap model only)
- 10 GB free disk space
- CPU: any x86_64 or ARM64
- No GPU required
- Output: text-only chat with billsml, basic file operations, manual knowledge lookup
- This is the "bare metal" survival mode — slow but functional
Recommended — Full Local Mode
Bill's Alienware with Nvidia GPU + solar + lithium.
- 16+ GB RAM
- Nvidia GPU with 6+ GB VRAM (for CUDA inference)
- 100+ GB free disk
- Output: full JJ Hermes with all skills, local tool execution, llm-wiki search
- Internet not required, but if available: seamlessly upgraded to frontier models
- Solar + lithium system provides indefinite runtime
Optimal — Full Stack with Coprocessors
Multiple GPUs, NPU, dedicated inference hardware.
- 32+ GB RAM
- Multiple GPUs or dedicated inference accelerator (Hailo, Coral, Jetson)
- Runs multiple models concurrently — billsml + frontier local + specialist models
- Battery-backed RAM cache for instant resume from sleep
- Output: indistinguishable from cloud-connected JJ Hermes, but entirely local
Scale-Down / Scale-Up Protocol
# Graceful degradation (internet lost):
on_internet_lost:
swap frontier-model clients → billsml local
queue outbound messages (Telegram, email)
disable web_search, web_extract tools
notify user: "Internet lost. Running local mode. Messages queued."
continue operating with local tools
# Graceful upgrade (internet restored):
on_internet_restored:
verify connectivity to OpenRouter
verify connectivity to Telegram API
process queued outbound messages
sync missed inbound messages
swap billsml → frontier models (per user preference)
re-enable web tools
notify user: "Internet restored. Frontier models active. Messages synced."
Total Package Size
Bootstrap model (llama-3.2-1b-q4): ~0.7 GB
billsml base model (qwen2.5-1.5b-q4): ~1.5 GB
billsml adapter: ~0.04 GB
Hermes runtime + skills + memory: ~0.1 GB
llm-wiki KB dump: ~0.2 GB
alpine-mini.iso: ~0.2 GB
ubuntu-server-lts.iso: ~2.0 GB
tools (ollama, python): ~0.5 GB
survival guides + manuals: ~0.3 GB
─────────────────────────────────────────────
Total (with Ubuntu): ~5.5 GB
Total (Alpine only, minimal): ~3.8 GB
This fits on any USB stick made in the last decade. It runs on any laptop made in the last decade. It produces a fully functional Bill+JJ with zero internet. It scales up transparently when connectivity returns. It degrades gracefully when connectivity is lost. It is the SHTF AI. It is resilience, operationalized.
Next step: build shtf-builder.sh, populate the Drive folder with the actual model files, and test the full boot chain on the Alienware. Share the stick with others once perfected. Local SHTF AI. Must have.