Research
Technical papers on business systems, economics, and infrastructure.
Practitioner reports from production systems. Not peer-reviewed, nor academic; just the architecture and the reasoning behind it, in the hopes that it will help someone else avoid the same mistakes.
Papers
The Cognitive Loop
This paper describes Citadel, a cognitive architecture that gives a large language model persistent memory, causal reasoning, self-modification, and autonomous action across weeks and months of continuous operation. The system assembles ~25 context signals per inference call, filters them through a learned attention gate, implements type-specific memory decay, maintains a 500+ edge causal graph fed by live economic data, and rewrites its own identity weekly. 158 tools across 11 integrations. Two years of continuous production use. This paper reports on its design, the failures that shaped it, and the operational characteristics of a system that modifies its own cognition.
The Universal Margin
This paper describes a financial calculation engine built from the realisation that the math of profitability is identical for every type of business. A seven-stage deterministic pipeline resolves tax, computes order-weighted margins, applies a cash-flow-correct refund model with per-product recoverability, and derives break-even boundaries; the same 335 lines of code for e-commerce, services, subscriptions, and lead generation. A vocabulary layer swaps the terminology without touching the math. Products, campaigns, and organic traffic sources collapse into a unified entity abstraction with per-channel elasticity physics. A goal solver reverse-engineers the exact adjustment to every available lever (pricing, costs, budget, conversion) needed to hit a profit target, ranked by effort score. A constitutional test suite runs 10,000 randomised scenarios per invariant, cross-references a Python oracle, and enforces named axioms: Conservation of Mass proves refund handling is correct; Service Identity proves the engine is truly universal. 117,893 lines of TypeScript. Nine revenue channels. Four business models. One engine. This paper reports on the architecture, the six failed versions that preceded it, and the discovery that started as a spreadsheet at an agency where nobody not the strategists, not the clients, not (in one case) the client's accountant could answer the most basic question in business: how much money do you actually make per sale?
The Semantic Firewall
This paper describes a reading companion built for one person: a grandfather with Alzheimer's disease who loves books but can no longer follow the page. The system processes EPUBs through a two-pass AI pipeline (Gemini for structural analysis, Claude for warm prose), generates per-scene cognitive metadata, and enforces a Semantic Firewall that is constitutionally incapable of revealing content beyond the reader's current position. A three-strategy position tracking system (percentage range, Jaccard text similarity, linear estimation) matches the visible page to narrative context without modifying the original book file. A CSS injection layer called the Trudy Protocol overrides publisher typography to enforce left-aligned, animation-free, footnote-hidden layouts optimised for cognitive accessibility. A prompt-level spoiler prevention system bans adversarial vocabulary ('Antagonist', 'Villain', 'Hero') and constrains character descriptions to first-impression social roles. The architecture is offline-first: after a single download, the entire reading experience, including AI-generated summaries, character timelines, and chapter maps, works without internet. 7,556 lines of TypeScript and Python. Two books processed. One user. This paper reports on the neuroscience that informed the design, the architectural decisions that emerged from it, and what building for an audience of one teaches you about building for anyone.