How jarvesusaram99/portable-ai-usb works
1. What this repo is
- This repository is not a full AI application codebase; it is a portable deployment and orchestration layer for an offline AI assistant that lives on a USB drive.
- The architecture centers on bundling a local model runtime, model files, and the AnythingLLM interface so the whole system can move between computers.
2. Primary runtime components
- AnythingLLM is the user-facing chat/UI layer.
- Ollama is the local model-serving engine.
- GGUF model files are stored locally in the models/ directory.
- The user talks to AnythingLLM, which routes requests to the local runtime rather than a cloud service.
3. Portable storage boundary
- The key architectural boundary is the USB drive itself.
- Persistent application state is meant to stay on the USB:
- anythingllm_data/ for chats and settings
- models/ for downloaded weights and model metadata
- anythingllm/ for the installed interface
- ollama/ for the local engine
- This keeps state off the host machine and is the main portability guarantee.
4. Install-time flow
- Installation is driven by platform wrapper scripts:
- install.bat and install-core.ps1 on Windows
- linux/install.sh and linux/install-core.sh for Linux-side setup logic
- The installer downloads selected models, sets up the local engine, and prepares AnythingLLM in a USB-relative location.
- Initial downloads require internet access; after that, the system is intended to run offline.
5. Model acquisition and management
- The repo supports curated model downloads plus a “custom GGUF” path.
- Model selection happens during install, and files are placed in models/.
- The installer is idempotent in practice: if a model already exists, it is skipped on rerun.
- The README references HuggingFace as the source for model downloads, which is the main external dependency for acquiring weights.
6. Startup/runtime flow
- Launchers are OS-specific entrypoints:
- start-windows.bat
- start-mac.command
- linux/start-linux.sh
- At runtime, the launcher starts the local AI stack and opens the AnythingLLM window.
- The black terminal window is intentionally kept open because it acts as the control process for the local services and safe shutdown.
7. Windows-specific portability behavior
- start-windows.bat includes cache-clearing behavior to handle moving the USB between different PCs.
- This is important because AnythingLLM may otherwise retain host-specific path/cache data and fail on a new machine.
- The launcher therefore acts as a portability repair layer, not just a process starter.
8. Linux-specific preflight
- Linux has an explicit preflight-check.sh before installation/startup.
- This suggests a validation boundary for environment readiness before the install scripts run.
- In architecture terms, Linux adds a small health-check stage ahead of the shared install/runtime flow.
9. Data flow at runtime
- User prompt enters AnythingLLM.
- AnythingLLM sends the request to the local model engine.
- The engine loads the chosen GGUF model from models/.
- The response returns back to AnythingLLM and is shown in the UI.
- No cloud API is required in the steady state.
10. External dependencies that matter architecturally
- AnythingLLM: UI/orchestration layer the user interacts with.
- Ollama: local inference backend.
- HuggingFace: model distribution source.
- These are not optional implementation details; they define the system’s major boundaries and startup sequence.
11. Repository structure as deployment layout
- The repo mainly contains:
- installer wrappers
- startup wrappers
- shared install logic
- platform-specific scripts
- There is no application source tree here; the repo is effectively a portable packaging and bootstrap system.
12. Operational characteristics
- The system is designed for offline use after setup, CPU-based inference, and local persistence.
- Performance and RAM requirements depend on model size, which affects the practical deployment target but not the software architecture itself.
- The architecture is best diagrammed as a USB-contained stack: launcher scripts → local engine → local model store → AnythingLLM UI → persistent USB data.
Main entry points: install-core.ps1 Core install · install-core.sh Linux core · start-windows.bat Windows start · install.sh Linux install
Components 16
USB-contained stack
Portable state and local runtime that move with the drive.
- USB drive · The portability boundary where app state, models, and runtimes are kept.
- AnythingLLM · User-facing chat interface and request router for the local assistant.
- Ollama · Local model-serving backend used for offline inference.
- Models · Local GGUF weights and model metadata stored on the USB drive.
- App data · Chats, settings, and other AnythingLLM state persisted on the USB drive.
- AnythingLLM install · USB-local AnythingLLM installation prepared by the installer.
- Ollama install · USB-local Ollama installation prepared by the installer.
Host OS scripts
Platform-specific wrappers that install, validate, and start the portable stack.
- Windows install · Windows entrypoint that drives installation setup on the USB drive.
install.bat - Core install · Shared Windows install logic used to prepare the portable stack.
install-core.ps1 - Linux install · Linux entrypoint that drives installation setup on the USB drive.
linux/install.sh - Linux core · Shared Linux install logic used to prepare the portable stack.
linux/install-core.sh - Preflight check · Linux readiness check that runs before install or startup.
linux/preflight-check.sh - Windows start · Windows launcher that starts the local stack and handles cache cleanup.
start-windows.bat - macOS start · macOS launcher that starts the local stack and opens the interface.
start-mac.command - Linux start · Linux launcher that starts the local stack and opens the interface.
linux/start-linux.sh
Other components
- HuggingFace · External source used to download curated model weights during install.
Connections 25
- Windows install → Core install: delegates · Windows wrapper hands off to shared install logic.
- Linux install → Preflight check: checks · Linux install is preceded by an environment readiness check.
- Linux install → Linux core: delegates · Linux wrapper hands off to shared install logic.
- Core install → AnythingLLM install: prepares · Installer lays down the AnythingLLM installation on the USB drive.
- Core install → Ollama install: prepares · Installer lays down the Ollama runtime on the USB drive.
- Core install → Models: downloads · Installer fetches selected models into local storage.
- Linux core → AnythingLLM install: prepares · Linux install logic prepares the USB-local AnythingLLM installation.
- Linux core → Ollama install: prepares · Linux install logic prepares the USB-local Ollama runtime.
- Linux core → Models: downloads · Linux install logic fetches selected models into local storage.
- Core install → HuggingFace: sources · Model acquisition comes from HuggingFace during setup.
- Linux core → HuggingFace: sources · Model acquisition comes from HuggingFace during setup.
- Windows start → AnythingLLM: starts · Windows launcher starts the user-facing assistant.
- Windows start → Ollama: starts · Windows launcher starts the local model engine.
- Windows start → App data: cleans · Windows launcher clears host-specific cache/path state for portability.
- macOS start → AnythingLLM: starts · macOS launcher starts the user-facing assistant.
- macOS start → Ollama: starts · macOS launcher starts the local model engine.
- Linux start → AnythingLLM: starts · Linux launcher starts the user-facing assistant.
- Linux start → Ollama: starts · Linux launcher starts the local model engine.
- AnythingLLM → Ollama: routes to · Chat requests are sent from AnythingLLM to the local backend.
- Ollama → Models: loads · The engine loads the selected GGUF model from local storage.
- AnythingLLM → App data: persists · Chats and settings are stored in USB-local application data.
- USB drive → AnythingLLM install: contains · Installed interface lives on the portable drive.
- USB drive → Ollama install: contains · Installed engine lives on the portable drive.
- USB drive → Models: contains · Model files are kept on the portable drive.
- USB drive → App data: contains · Persistent app state is kept on the portable drive.