LLM Cognition & Prompt Theory

This pillar treats the prompt as an engineering artefact rather than a string literal. The articles below work through four separable problems — how a prompt should be specified, how it gets versioned and reviewed, how a request should be routed across models, and what an agent should remember between sessions — and argue that conflating them is why prompt tooling discussions tend to talk past each other.

The four problems, kept separate

Specification asks whether a prompt can be written once, type-checked, and executed faithfully across OpenAI, Anthropic and a local model. That is a language design question, and promptel is our attempt at an answer: a small declarative DSL with typed parameters and a provider abstraction, plus an equivalent YAML form for people who do not want a new syntax.

Lifecycle asks how a prompt gets out of a codebase and into something reviewable. Blogus extracts prompts into .prompt files and pins each with a sha256 hash in a lockfile, so continuous integration can assert that the prompt which shipped is the prompt that was reviewed. It is a build-time tool and does not sit in the request path, which is a deliberate scope boundary rather than a missing feature.

Routing asks which model should serve a given request. The cost-quality frontier is real: a small model answers most queries acceptably and fails on a minority in ways that are hard to predict from the query text alone. Route-switch takes the empirical position, running MIPROv2 optimisation against captured traces rather than encoding a hand-written rule about query difficulty.

Memory asks what survives the end of a session. The articles here argue for a sharp distinction between context, which is the working set inside one inference call, and memory, which is an external store with a lifecycle of its own — and for typed schemas over treating memory as a single undifferentiated vector bag.

Where the argument is still open

The unresolved question across all four is evaluation. A prompt specification can be portable and still worse; a lockfile proves a prompt was reviewed and not that the review was good; a learned router optimises the metric it was given. We have better tooling for changing prompts than for knowing whether a change helped, and the articles say so where it applies.

LLM Cognition

l0l1 vs Text2SQL Tools: Validating SQL Instead of Writing It

l0l1 is not a Text2SQL tool. It validates SQL of any origin, scans for PII and learns approved query patterns. How it compares with Vanna, SQLCoder and others.

SQLText2SQLcopilot
LLM Cognition

mullama vs Ollama vs vLLM: Choosing a Local LLM Server in 2026

Comparing mullama, Ollama, vLLM, LocalAI and LM Studio for local LLM serving: when to use which, and when in-process inference beats a daemon.

OllamavLLMLocalAI
LLM Cognition

perishable vs Cloudflare vs Vault: LLM Keys Out of the Browser

perishable is a self-hosted proxy and browser SDK that keeps LLM API keys off the client. How it compares with Cloudflare's gateways and HashiCorp Vault.

api-key-securityshort-lived-tokensJWT
LLM Cognition

route-switch vs LiteLLM vs Portkey: LLM Gateways in 2026

Comparing route-switch, LiteLLM, Portkey and OpenRouter: what each gateway routes, what it records, and where MIPROv2 prompt optimisation fits in.

LLM gatewayLLM routingLiteLLM
LLM Cognition

memorg vs Mem0: Structured Memory vs Vector Memory for LLM Agents

A practical comparison of memorg and Mem0 for agent memory: an inspectable conversation store versus LLM-extracted facts, and when each one fits.

memoryagentsMem0
LLM Cognition

mpl vs MCP: An Audit and Contract Layer for Agent Protocols

MCP defines how agents talk. mpl checks what they said against a contract, scores it and records it. Why production agent systems may need both.

MCPA2Aagent-protocol
LLM Cognition

promptel vs DSPy: Declarative Prompts vs Compilation

Comparing promptel and DSPy: when to use a declarative prompt specification, when to use a programmatic compiler, and how the two compose.

promptsDSPydeclarative
LLM Cognition

Persistent Memory for Long-Running Agents

What happens when LLM agents must remember across sessions: memorg's conversation hierarchy, hybrid vector and keyword retrieval, and memory versus context.

memoryagentsretrieval
LLM Cognition

Prompt Lifecycle Management: From Extraction to Deployment

A practical framework for managing prompts as versioned, locked dependencies: extraction with blogus, regression testing, deployment, and catching drift.

promptsversioningdevops
LLM Cognition

Formalising Prompts as First-Class Research Objects

Why treating prompts as typed, portable artefacts changes how we reason about LLM behaviour, and how promptel and blogus put that idea into practice.

promptsformal-methodsspecification
LLM Cognition

Intelligent LLM Routing: Spending Compute Where It Matters

How route-switch routes LLM traffic by configured strategy, logs every call to DuckDB and SQLite, and reruns MIPROv2 prompt optimisation on captured traces.

routingMIPROv2cost-optimisation
LLM Cognition

Building mullama: What We Learned Replacing Ollama from Scratch

Why mullama is a Rust runtime on llama.cpp with native bindings for six languages and an Ollama-compatible CLI, and what in-process inference changes.

llama.cppinferencelocal-llm