Architecture
FERAL is structured as a layered system. The Brain is the central runtime — a FastAPI Python server that orchestrates reasoning, memory, tools, voice, hardware, and UI generation. Clients (web, CLI, hardware daemons, messaging channels) connect over HTTP and WebSocket.System Diagram
Core Layers
Reasoning Plane
The Orchestrator (feral-core/agents/orchestrator.py) runs the main agent loop:
- Receive user intent (text, voice, or hardware event).
- Load context: memory tiers, identity, session state.
- Route to an LLM provider via the multi-provider interface.
- Execute tools selected by the LLM.
- Store results in memory, update the knowledge graph.
- Return response — optionally as GenUI SDUI payload.
Memory Plane
On top of these tiers:
- Memory Wiki — compiles notes, episodes, and graph entries into durable wiki pages with provenance tracking.
- Session Snapshots — snapshot, branch, and restore full conversation + working memory state.
~/.feral/memory.db.
Workflow Plane
TaskFlows (feral-core/agents/taskflow.py) are durable background workflows backed by SQLite:
- Persist through restarts.
- Support
wait(pause until a condition),resume, andcancel. - Each flow tracks a step timeline with status transitions.
- API:
POST /api/taskflows,GET /api/taskflows/{id},POST /api/taskflows/{id}/resume.
Interface Plane (GenUI)
The GenUI engine generates Server-Driven UI payloads from tool results and provider contracts:- A tool returns structured data.
- The GenUI engine selects an appropriate SDUI template (card, chart, map, form, list).
- The payload is sent to the client, which renders it without knowing the tool’s internals.
Execution Plane
- Tools & Skills — computer use (shell, files, grep), web search, browser automation, custom JSON manifests, Python plugins, WASM sandboxed skills.
- MCP — dual-role: expose FERAL’s tools as an MCP server, and consume external MCP servers.
- Channels — bridge to Telegram, Discord, Slack, WhatsApp.
- HUP (Hardware Use Protocol) — a generic, self-describing hardware hub. Devices declare an
actions[]envelope (seeHUP_ACTION_SCHEMAinhardware/protocol.py); the brain converts it to aDeviceManifest, registers transport adapters (GenericSelfDescribingAdapterfor brain-local USB/serial,WebSocketNodeAdapterfor mesh nodes,BridgedPeripheralAdapterfor phone-bridged BLE peripherals), and auto-generates LLM tools viaGenericHardwareSkill— including a closed-loop honesty loop when capabilities declare averifycontract. Brain-local discovery is config-driven (DEVICE_DISCOVERY_SPECS). Operators can disable the generic path withFERAL_GENERIC_HARDWARE_SKILLS=0to fall back to hand-written skills.
Security
- Blind Vault — API keys stored encrypted, never exposed to the LLM.
- WASM Sandbox — untrusted skills run in a Wasmtime sandbox.
- Permission Plane — tool-level approval policies.
Wire Protocol
All client↔brain communication uses theFeralMessage envelope defined in feral-core/models/protocol.py:
