QUESTPIE Autopilot

Architecture

Single Bun process. One SQLite file. Zero external infrastructure. Six-layer stack, orchestrator internals, and filesystem-native state.

Single process. Zero infrastructure. Filesystem-native state. SDK-first.

Zero Infrastructure

What you need to run Autopilot:

  • Bun runtime -- the process
  • Anthropic API key -- the intelligence

That's it. No Docker. No Postgres. No Redis. No Pinecone. No Kubernetes. No message queue. The entire company runs as one Bun process with one SQLite file for the database. Install and run in 60 seconds.

What competitors require: Docker + Postgres + Redis + vector DB + message queue + monitoring stack + deployment pipeline. Autopilot's zero-infra story is a real adoption advantage.

System Stack

system overview
+-----------------------------------------------------------+
|  LAYER 1 -- HUMAN                                          |
|  CLI . Dashboard . Telegram . External APIs                |
|  Thin consumers. No business logic.                        |
+-----------------------------------------------------------+
                           | calls SDK functions
                           v
+-----------------------------------------------------------+
|  LAYER 2 -- ORCHESTRATOR                                   |
|  Single Bun process per company                            |
|                                                            |
|  Watcher -> detects FS changes (new tasks, status moves)   |
|  Workflow -> state machine routing (YAML-defined steps)    |
|  Context -> 6-layer prompt assembly (identity+state+mem)   |
|  Spawner -> creates TanStack AI sessions              |
|  Scheduler -> cron-based recurring agent jobs              |
|  Webhook -> HTTP event receiver (port 7777)                |
|  API -> REST + SSE realtime streaming (port 7778)          |
|  Notifier -> transport dispatcher (Telegram built-in)      |
|  Artifact -> lazy cold-start preview server                |
|  Skills -> reusable knowledge packages                     |
+-----------------------------------------------------------+
                           | spawns
                           v
+-----------------------------------------------------------+
|  LAYER 3 -- AGENTS                                         |
|  TanStack AI sessions with 12 tools + MCP              |
|  Role-scoped FS access, sandboxed shell, deny patterns     |
|  Human gates at explicit workflow steps                     |
+-----------------------------------------------------------+
                           | reads/writes
                           v
+-----------------------------------------------------------+
|  LAYER 4 -- STORAGE                                        |
|  Hybrid: YAML/Markdown/JSON files + SQLite (Drizzle ORM)  |
|  FTS5 full-text search + libSQL native vectors (DiskANN)             |
|  Better Auth for security . Git auto-commit audit trail    |
|  Write queue (file-level async mutex)                      |
+-----------------------------------------------------------+

SDK-First Architecture

All business logic lives in the orchestrator SDK. CLI, dashboard, and API are thin consumers that call the same functions. No logic is duplicated across consumers.

consumer pattern
// CLI -- thin shell over SDK
import { createTask, listTasks, loadAgents } from '@questpie/autopilot-orchestrator'

// Dashboard -- same SDK, different UI
import { createTask, listTasks, loadAgents } from '@questpie/autopilot-orchestrator'

// External API -- same SDK, HTTP wrapper
import { createTask, listTasks, loadAgents } from '@questpie/autopilot-orchestrator'

Hybrid Storage

YAML and Markdown files remain the source of truth -- human-readable, git-versioned, and portable. SQLite provides speed:

LayerTechnologyPurpose
ConfigYAML filesAgent definitions, workflows, schedules, webhooks, policies
KnowledgeMarkdown filesCompany brain, brand guidelines, technical docs
TasksYAML filesTask state, history, assignments, dependencies
IndexesSQLite + Drizzle ORMFast queries, status counts, agent lookups
SearchFTS5Full-text keyword search across all content
EmbeddingslibSQL native vectorsVector similarity search, semantic queries
AuthBetter AuthDashboard and API authentication
AuditGit auto-commit5-second batch, every agent action is a commit

Files for config and state (human-readable, git-versioned). SQLite for speed (queries, search, embeddings). If you delete the SQLite database, it is fully rebuilt from files.

Provider Abstraction

Three agent providers are available. Configure per-agent or company-wide:

ProviderConfig ValueFeatures
TanStack AI + OpenRoutertanstack-aiPrimary. 300+ models (Claude, GPT, Gemini, Llama). File tools, hooks, sub-agents.

The TanStack AI provider gives agents built-in file tools (read, write, edit, bash, glob, grep), web search, and the full autopilot tool set. Role-based filesystem scoping and deny patterns are enforced via middleware.

Orchestrator Module Map

ModuleResponsibility
fs/YAML CRUD with write queue. File-level async mutex prevents concurrent write corruption.
workflow/State machine engine. Reads YAML workflows, checks transitions, handles reviews and human gates.
context/Builds role-scoped system prompts from 6 layers: identity, company state, memory, task context, skills discovery, and tool list.
agent/Creates TanStack AI sessions. Injects context, configures tools/MCP, streams output.
scheduler/Cron-based recurring agent tasks from schedules.yaml.
watcher/Monitors company filesystem via chokidar. Detects new tasks, status changes, messages.
webhook/HTTP event receiver on port 7777. HMAC-SHA256 verification.
session/In-memory session stream management. Powers autopilot attach for real-time observation.
api/REST API + SSE event stream on port 7778. Dashboard and CLI consumer endpoint.
artifact/Lazy cold-start server for agent-created previews. Port pool management, idle timeout.
skills/Reusable knowledge packages. Loaded into context assembly Layer 2.
notifier/Notification dispatch. Telegram transport built-in, Slack/email planned.

Data Flow: Intent to Completion

data flow
Human: "Build a pricing page"
  |
  v
CLI: autopilot chat ceo "Build a pricing page"
  | Router decides which agent responds
  v
Watcher: detects new task file
  |
  v
Orchestrator: routes to CEO agent
  | Context assembler builds 6-layer prompt:
  |   Layer 1: Agent identity (role, personality, tools)
  |   Layer 2: Company state (knowledge, team, projects)
  |   Layer 3: Agent memory (facts, decisions, past sessions)
  |   Layer 4: Task context (description, dependencies, history)
  |   Layer 5: Skills discovery (role-matched skills)
  |   Layer 6: Tool list (available tool definitions)
  v
CEO Agent Session:
  | Reads company knowledge, evaluates scope
  | Calls: task({ action: "create", title: "Scope requirements", assigned_to: "sam" })
  | Calls: task({ action: "create", title: "Plan implementation", assigned_to: "alex" })
  | Calls: task({ action: "create", title: "Implement + Stripe", assigned_to: "max" })
  | Sets dependencies: implement -> plan -> scope
  v
Watcher: detects new tasks
  |
  v
Sam (strategist): writes spec -> task({ action: "update", status: "done" })
  v
Workflow Engine: scope -> plan transition -> activates Alex's task
  v
Alex (planner): writes plan -> task({ action: "update", status: "done" })
  v
Max (developer): implements, creates PR -> task({ action: "update", status: "done" })
  v
Riley (reviewer): reviews PR -> approves
  v
Workflow Engine: human_gate -> task moves to review, appears in inbox
  v
Human: autopilot approve TASK-003 -> workflow continues to deploy

On this page