Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

5) Trade-off Decisions

From cognokratos/sophos-agent · docs/architecture/5-trade-off-decisions.md · pinned revision 8d9fe52182d8

Learn: case studies (why Markdown stopped being the database, why a runs table, why the monolith).

TopicDecisionRationale
Service shapeMonolith (web+agent) for v0Simplest workshops; the agent is a library inside the SvelteKit server.
OrchestrationExplicit StateGraphThe agent loop is two named nodes and one conditional edge, readable in one file; no prebuilt agent factory.
StreamingSSE now, WS laterMinimal code & great for teaching; reconnects replay buffered events by Last-Event-ID.
PersistenceSQLite + LangGraph checkpointsDurable, resumable runs with the official SqliteSaver; one local file. Markdown/JSONL are generated exports.
SQLite driverbetter-sqlite3Required by the official checkpointer; reused for the app tables instead of adding node:sqlite or an ORM.
Database filesOne file (data/db/sophos.db)App tables and checkpoint tables share a connection: one thing to back up or delete.
ToolsMCP: Memory & Fetch, one MCPAdapterKeep scope teachable; new servers are added in mcp.json, not in code. Tool names carry the server prefix.
SecurityLoopback-only defaultNothing is published beyond 127.0.0.1; MCP servers stay on the internal network. Fetch is the explicit egress.
VersionsPinned + lockedLockfiles for the app and both MCP containers; exact versions for local stdio servers. Reduces tool drift.
Base imagesMajor-version tags, no digestsSecurity patches flow in on rebuild; digests would need a bump process this project does not have yet.

This chapter is maintained in cognokratos/sophos-agent beside the code it teaches. The book shows docs/architecture/5-trade-off-decisions.md at revision 8d9fe52182d8441454916ec8a6ab13c0773228e2 (branch main). View source at this revision · Report a correction.

Corrections are made upstream against the current main branch and appear here when the book's pin for this source is updated.