Skip to content

Prompt Enhancer

The prompt enhancer automatically prepends contextual information to each user prompt before it reaches the model: git status, recently accessed files, and LSP diagnostics.

Prompt enhancement is enabled by default when [options.prompt_enhancer] or enabled is omitted. Set enabled = false to disable the user-message <context> block explicitly.

  • System prompt: Base template plus runtime appendages. The current contract is layered: invariants first, then active mode and workflow phase, then tool-specific guidance. Runtime appendages include tool inventory, taxonomy, shared tool contract, session/workspace/model context, mode and phase, permissions/tool gates, summaries, capabilities, and a compact one-line user-message context hint/summary when live enhancer context is available.
  • User message only: All heavy enhancer content (git status, recent files, LSP, repo map, memory, flow, context retriever when enabled) is injected into the user message in a <context> block. The system prompt only gets counts/presence, not the full blocks.
  • Codebase context (default on): Metadata-only workspace snapshots run once per user turn and can suppress risky injections when stale under options.codebase_context.stale_policy. See Codebase context snapshots.

For appendage order and the system-prompt hint/summary contract, see prompt-enhancer.md.

Prompt docs and review artifacts use the annotation model from the Prompt Artifact Annotation Spec: authoring source, rendered docs, compiled prompt, and eval metadata are separate surfaces. The metadata block says whether a block is sent to the model, which role owns it, and which trust boundary applies.

role: developer
source_kind: static_instruction
send_to_model: true
authority: high
trust_boundary: instructional
annotations:
- CRITICAL
- ASSERT

Use prompt assertions for behavior that should map to evals:

[ASSERT: prompt_context_stays_user_scoped]

For practical prompt-writing guidance and alternate prompt shapes, see Prompt Engineering Patterns. For the full maintained artifact format, see the Prompt Artifact Annotation Spec.

How workspace state changes the next prompt

Section titled “How workspace state changes the next prompt”
sequenceDiagram participant You as You in the repo participant State as Workspace state participant Assembler as BMO prompt assembly participant Model as Model turn participant Tools as Tool calls and edits You->>State: edit files, run commands, create diagnostics State->>Assembler: git summary, recent paths, LSP, flow, memory Assembler->>Model: system invariants plus user context block Model->>Tools: choose bounded actions Tools->>State: mutate or observe workspace State-->>Assembler: next turn receives the updated snapshot

The practical effect is simple: the agent does not receive only your last typed sentence. It receives that sentence plus a bounded snapshot of the same workspace state you just changed, so the next turn can react to the current branch, touched files, and active diagnostics without you restating them.

[options.prompt_enhancer]
enabled = true
include_git = true
include_recent_files = true
include_lsp = true
max_recent_files = 10
OptionDefaultDescription
enabledtrueEnable prompt enhancement; explicit false disables
include_gittrueInclude git status output in enhanced prompts
include_recent_filestrueInclude a list of recently accessed files
include_lsptrueInclude current LSP diagnostics (errors, warnings)
max_recent_files10Maximum number of recent files to include (1–50)

These top-level options.* keys inject lines into the system prompt (separate from the prompt-enhancer <context> block). They default on when omitted (nil-guard in config); set false to disable.

OptionDefaultDescription
include_git_statetrueCompact git summary (branch, modified/staged/untracked counts) in the system prompt
include_last_turn_summarytrueShort excerpt of the last user+assistant turn
include_recent_tool_callstrueLast N tool names from recent history (recent_tool_calls_count)

Enable the prompt enhancer when you find yourself frequently having to tell the agent “there are errors in the build” or “I was just working on these files.” It makes the agent’s starting context richer with no extra effort.

For richer timeline context (file change events + terminal summary), see Flow Awareness. For outcome-based selection of which enhancer content to include in long sessions, see Adaptive Context.

Another way to read the diagram above: changing the workspace is part of the conversation. A file edit, a failed build, or a new diagnostic shifts the context BMO can lawfully attach to the next prompt.