How it works
A protocol, not a prompt.
Cognition Engines runs as a service your agent calls. It doesn't wrap the model, own the loop, or require a particular framework. It answers one question well — what do we already know about this kind of call? — and records what the agent did about it.
Load context before the work starts
At session start the agent calls get_session_context. One response carries the agent's own profile — accuracy and Brier score — along with relevant prior decisions, the guardrails currently in force, calibration broken out by category, the ready queue, and patterns that have been confirmed by more than one outcome. It can be returned as JSON or as markdown for direct injection into a system prompt.
Gate the decision point
pre_action is the primary call. It collapses what would otherwise be three round trips: it queries similar past decisions, evaluates the guardrails against the proposed action, fetches calibration for that category, and extracts recurring patterns. With auto_recordset it also opens the decision record and returns its id.
Precedent
similar decisions, with outcomes and lessons attached
Guardrails
pass / block, with the rule that fired
Calibration
how well this agent has predicted this category
Patterns
abstractions confirmed across multiple decisions
Retrieval that survives paraphrase
Precedent is only useful if it can be found from a differently-worded situation. Four retrieval modes are available.
Semantic
Embedding similarity over decision text. Finds precedent that shares meaning with the current situation even when the wording is different.
Keyword
BM25 ranking (rank_bm25) plus SQLite FTS5 full-text search over decision text, context and tags. Catches exact identifiers, error strings and names that embeddings blur.
Hybrid
Both, combined and rescored. The default retrieval mode — each result carries its semantic, keyword and combined scores.
Bridge
Query by structure (“what does it look like?”) or by function (“what problem does it solve?”). Surfaces precedent from a different domain that shares the underlying shape.
Capture the reasoning while it happens
record_thought attaches reasoning to the open decision as the work proceeds, so the trace is recorded rather than reconstructed. When several agents share one connection, thoughts are isolated by composite key —agent:{id}:decision:{id}— so a planner's deliberation never contaminates an implementer's.
Close the loop, or none of it counts
review_outcome logs what actually happened. This is the step most systems skip, and it is the only one that makes the rest measurable: without outcomes, confidence is a vibe. With them, calibration services score predicted confidence against realised results using Brier scoring, and drift detection watches for an agent whose calibration is degrading over time.
Why this matters: an agent that is 90% confident and 60% right is a different operational risk from one that is 90% confident and 88% right. Both look identical in a transcript. They look nothing alike in a calibration curve.
Storage and deployment
Decision store
SQLite in WAL mode with FTS5 full-text search. ACID, concurrent reads, normalised tables for tags, reasons, bridge definitions and traces.
Vector store
Pluggable behind a single abstraction — chromadb and memory backends ship today.
Interfaces
17 MCP tools and 34 CSTP JSON-RPC methods over HTTP.
Deployment
Docker Compose: CSTP server, vector store, dashboard. Self-hosted, no external account required.