Documentation
¶
Overview ¶
Package doctrine is the memcode prompt doctrine — client-owned since the one-wire architecture (the CLI is the agent; backends serve models, they never compose prompts). Compose() wraps the locally-gathered facts in the mode's doctrine and returns the STABLE (cacheable) prefix and VOLATILE per-turn suffix — the two system messages of the wire protocol.
The ONE deliberate exclusion: delegateDoctrine is routing-owned prose, so it lives with the selection policy (llm.Runner.prepare) and is appended only when the cheap coding lane serves an interactive building mode — doctrine here stays selection-independent.
Facts contract (all optional unless noted):
root (required for needsRoot modes) absolute repo path on the CLIENT machine
platform client GOOS ("darwin", "linux", …)
shell client shell name for bash-tool guidance
overview repo overview text (chat/plan modes)
pack redacted ContextPack JSON (exec mode)
plan the approved plan text (apply mode)
scope subsystem focus (scout mode)
room interaction-room mode name -> appends that mode's guidance
personality voice key or custom prose -> guarded tone envelope (conversational modes)
extramile "on" -> above-and-beyond rule (planner/executor modes)
mcp connected-server index line -> mcp meta-tool doctrine (interactive modes)
nudge "wrapup" | "force" -> plan-synthesis convergence nudges
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compose ¶
func Compose(mode string, facts map[string]string, extra, model string, pinned bool) (stable, volatile string, err error)
Compose builds the system prompt for a mode in TWO parts: a STABLE prefix (doctrine + tools-oriented body + overview/pack/plan) that is byte-identical across turns so it caches, and a VOLATILE suffix (room/personality/extra-mile/ nudge + the client's turn-scoped extra) that varies per turn and therefore must sit OUTSIDE the cached prefix. Splitting them keeps the big doctrine block cached even when a personality or room shift changes the volatile facts. Unknown modes error — the surface is explicit, not best-effort.
model and pinned are unused here by design: the gateway's compose uses them only to gate delegateDoctrine (cheap-lane routing, gateway-owned — the client never predicts the serving lane). They stay in the signature for byte-parity with the gateway compose and the parity test, until Phase D retires that copy.
Types ¶
This section is empty.