The episodic learning layer is the most ambitious feature I’ve built. The idea is simple: Sentinel should learn from its own experience. The implementation is anything but.

Every completed task produces an episodic record — a structured summary of what was attempted, what worked, what failed, and what strategy was used. These records are enriched with step-level detail: exit codes, stderr previews, scanner results, fixer actions. The enriched text gets embedded using Nomic (running locally on CPU) and stored in PostgreSQL with pgvector.
When a new task arrives, the system searches its episodic memory for similar past experiences. The retrieval pipeline uses over-retrieve and re-rank: pull more candidates than needed, then run them through a FlashRank cross-encoder reranker to find the most relevant matches. The results are injected into the planner’s context, giving Claude information about what worked before and what to avoid.
Domain classification tags each record by area — file operations, web tasks, messaging, system administration. This enables domain-filtered retrieval, so a coding task doesn’t surface memories about email configuration.
The hardest part was the privacy boundary. Episodic records are generated by trusted orchestrator code, not by the worker model. The planner sees strategy patterns and outcome summaries, never raw worker output. The same air gap that protects planning from worker manipulation protects learning too.
Strategy pattern tracking closes the loop. When the planner uses a strategy that succeeds, that pattern gets reinforced. When it fails, the failure is recorded. The system doesn’t just remember — it gets better.