FFT_nano
Developer Docs
Comprehensive, implementation-anchored documentation rebuilt from src/, container/agent-runner/src/, and runtime scripts.
Quickstart
Read In This Order
Validate Runtime
npm run typecheck
npm test
npm run validate:skillsDocumentation Coverage
| Area | Coverage |
|---|---|
| Host Runtime | All modules under src/*.ts documented |
| Container Runtime | container/agent-runner/src/*.ts deep-dive included |
| Commands and IPC | Telegram command surface, task/action IPC payloads documented |
| Storage Contracts | SQLite tables, FTS index, JSON snapshots, farm-state files documented |
| Security Boundaries | Main/non-main gates, mount allowlist, path traversal guards documented |
| Operational Scripts | Setup/start/farm/release script behavior documented |
Source-of-Truth Rule
If docs and code diverge, code wins. This docs set is built to minimize that divergence by referencing concrete modules and contracts.
If docs and code diverge, code wins. This docs set is built to minimize that divergence by referencing concrete modules and contracts.
Architecture Snapshot
Single host process orchestrates message ingress, persistence, containerized agent execution, scheduler loops, and IPC action/task handling.
| File | Role |
|---|---|
src/index.ts | Main orchestrator (message loops, commands, routing, lifecycle) |
src/container-runner.ts | Mount/env policy + container execution + result parsing |
src/db.ts | SQLite schema + message/task persistence + FTS transcript search |
src/task-scheduler.ts | Due-task polling and scheduled task execution |
src/telegram.ts | Telegram poll/send/download abstraction |
container/agent-runner/src/index.ts | In-container pi runtime bridge |
Runtime Flow
- Ingress via Telegram and/or WhatsApp
- Per-chat queue policy applied (
collect|interrupt|followup|steer|steer-backlog) - Prompt built from missed messages since last agent interaction
- Container run launched with per-chat overrides (model/provider/think/reasoning)
- Result streamed or sent final, then timestamps and usage counters updated
Full details: Runtime Message Flow
Config and Environment
High-Impact Env Vars
TELEGRAM_BOT_TOKEN=
WHATSAPP_ENABLED=0|1
CONTAINER_RUNTIME=auto|apple|docker
FFT_NANO_MAIN_WORKSPACE_DIR=~/nano
MEMORY_RETRIEVAL_GATE_ENABLED=1
MEMORY_TOP_K=8
FARM_STATE_ENABLED=true|false
FARM_MODE=demo|production
HA_URL=http://localhost:8123
HA_TOKEN=...Full reference: Configuration and Environment Variables
IPC Contracts
Per-group IPC namespace at data/ipc/<group>/ mounted to /workspace/ipc.
Message IPC
{
"type": "message",
"chatJid": "telegram:123456",
"text": "status update"
}Task IPC
{
"type": "schedule_task",
"prompt": "Check greenhouse readings",
"schedule_type": "cron",
"schedule_value": "0 * * * *",
"context_mode": "isolated",
"groupFolder": "main"
}Full payload contracts: IPC Contracts
Memory System
- Canonical memory file is
MEMORY.mdper group SOUL.mdis identity/policy context, not compaction log store- Retrieval-gated memory context is built lexically from group + global memory
- Transcript episodic memory is powered by SQLite FTS5
Full behavior: Memory System
Farm Mode and Home Assistant
- Fast/medium/slow collector loops write farm-state ledgers
- Farm actions are allowlisted and main-chat-only
- Production mode blocks control actions until profile validation passes
Full behavior: Farm Mode and Home Assistant
Security Model
- Container isolation for all agent execution
- External mount allowlist at
~/.config/fft_nano/mount-allowlist.json - Main vs non-main authorization gates on commands and IPC
- Path traversal protection for memory actions
Full controls: Security Model
Full Guide Index
| Guide | Scope |
|---|---|
| 01-architecture | System architecture and startup topology |
| 02-runtime-message-processing | Message-to-run flow with queue and delegation logic |
| 03-container-runtime | Runtime selection, mounts, env passthrough, container execution |
| 04-config-env | Code-backed env/config reference |
| 05-telegram | Telegram API integration, commands, media handling |
| 06-whatsapp | Baileys connection/auth/runtime behavior |
| 07-scheduler-and-tasks | Scheduler loop, task schema, control commands |
| 08-ipc-contracts | Message/task/action IPC payload contracts |
| 09-memory-system | Memory retrieval/search/compaction model |
| 10-farm-mode | Collector loops, farm actions, production gate |
| 11-security-model | Isolation and authorization controls |
| 12-coding-delegation | Delegation triggers, constraints, subagent commands |
| 13-data-models | Type contracts and persistence structures |
| 14-testing-release | Validation and release checks |
| 15-agent-runner | In-container runtime internals |
| 16-scripts-reference | Operational script reference |
All Source Module References
One page per host module under src/*.ts with exported API signatures and env references.
Master list: module-index.html
Scripts and Release
Primary Script Commands
./scripts/setup.sh
./scripts/start.sh start
./scripts/start.sh dev telegram-only
./scripts/farm-bootstrap.sh --mode demo
./scripts/farm-bootstrap.sh --mode production
npm run release-checkDetails: Scripts Reference and Testing and Release
Status: Old visual style restored. New comprehensive content and references are now wired into this styled docs hub.