---
title: "Book of Doug: The Sermon Layer"
description: The Book of Doug is the complete body of law. Its laws are evaluated deterministically, so an agent cannot escape a law simply because the model failed to remember it.
created: 2026-09-20
updated: 2026-09-21
authors: ThinkingCap R&D
topics: [CapCom]
status: published
canonical: https://console.thinkingcap.com/rd/CapCom/Tooling/book-of-doug-sermon-layer
date: 2026-09-20
---

# Book of Doug: The Sermon Layer

## The Need

The Book of Doug is the complete body of law. Its laws are evaluated
deterministically, so an agent cannot escape a law simply because the
model failed to remember it.

That is necessary for enforcement, but it is not sufficient for good
behaviour.

If the AI only discovers a law when its proposed action is rejected, the
system is constantly correcting behaviour after the fact. We want the
model to enter each turn already understanding the laws most relevant to
what it is about to do.

The obvious solution would be to place the entire Book of Doug into
context on every turn. That is wasteful, increasingly expensive as the
Book grows, and likely counterproductive as relevant guidance becomes
buried among laws that have nothing to do with the current situation.

We therefore need a second function: **the Sermon**.

## Each Turn Is a Week

Think of every agent turn as a week in the life of a congregation.

Before the week begins, we can see something about what the flock is
about to encounter. We have the user's prompt, the intent envelope, the
actors involved, the resources being touched, the tools likely to be
used, and other contextual signals.

The system should ask:

> **What does the flock most need to hear this week?**

It then selects the small subset of Doug's laws most relevant to the
coming turn and places those laws directly into the AI's context.

That selection is the sermon.

## Scripture and Sermon Are Different

The distinction is important.

**The Book is law. The sermon is preparation.**

A law remains binding whether or not it was included in the sermon. The
deterministic evaluator continues to judge proposed actions against the
authoritative Book of Doug.

The sermon exists so the AI is less likely to propose an unlawful action
in the first place.

This gives us two complementary protections:

1.  **Contextual guidance:** relevant laws ride with the prompt and
    shape the model's reasoning before it acts.
2.  **Deterministic enforcement:** the resulting action is still
    evaluated against the authoritative rules regardless of what was
    placed in context.

The sermon can miss a law. The judge cannot.

## The Sermon Selection Step

The agent pipeline should therefore become:

**Prompt -\> Intent Envelope -\> Sermon Selection -\> Agent + Relevant
Laws -\> Proposed Action -\> Deterministic Judgment -\> Execute**

Sermon selection should inspect the shape of the coming interaction and
retrieve laws based on signals such as:

-   intended actions
-   actors and roles
-   resources or systems involved
-   tools likely to be invoked
-   data being accessed or changed
-   relevant capabilities and permissions
-   recent violations or recurring edge cases
-   dependencies between laws
-   laws explicitly marked as always worth carrying in context

The objective is not to find the absolute minimum number of laws.
Missing an applicable law is more expensive than carrying one
unnecessary law. Selection should therefore lean toward inclusion near
uncertain boundaries while still avoiding the cost of sending the entire
Book.

## The System Should Learn From Judgment

The deterministic judge creates a particularly valuable feedback signal.

If an action is rejected because of Law 47, but Law 47 was not included
in that turn's sermon, the enforcement system has discovered a failure
in sermon selection.

That event should be recorded.

Over time, the system can learn that prompts, intents, actors, tools, or
situations of that shape should cause Law 47 to be included in future
sermons.

Repeated violations can therefore improve not only behaviour, but the
system's ability to anticipate which laws matter.

## The Result

Every law in the Book of Doug ultimately participates in three different
functions:

**Retrieval** ... deciding when the law should be preached.

**Guidance** ... allowing the AI to reason with the law already in
context.

**Enforcement** ... deterministically preventing an action that violates
the law.

The Book remains sovereign. The judge remains deterministic. But the AI
no longer walks blindly toward the courthouse.

We see what is coming up this week, choose the sermon the flock needs,
and get them ready for it.
