Skip to main content

Module prompt

Module prompt 

Source
Expand description

System-prompt assembly layer implementing the parity spec.

Why: The cross-model comparison harness must assemble the same fixed instruction surface for every model so the comparison measures the model, not the scaffolding (docs/trusty-code/parity-spec.md §1). This module owns that surface: the byte-identical BASE preamble, its version token, and the fixed-order assembler that merges BASE + agent prompt + project CLAUDE.md context + optional per-tier fallback guidance (the #1023 seam). What: BASE_PREAMBLE, BASE_PREAMBLE_VERSION, PromptAssembler, and assemble_system_prompt. Test: prompt::tests::*. System-prompt assembly layer (parity-spec — docs/trusty-code/parity-spec.md).

Why: The model-comparison harness must drive the same system instruction surface through every model so a comparison measures the model, not the scaffolding (parity-spec §1). This module owns that surface: the byte-identical BASE preamble, its version token, and the fixed-order assembler that merges the BASE preamble with the per-agent prompt, project CLAUDE.md context, and the optional per-tier fallback guidance. #4602: every section that INSTRUCTS the model to call a named tool — file discovery, batch writes, code discovery — left that byte-identical floor and is gated on the run’s tool registry, so an agent is never instructed to call a tool it was not given. BASE_PREAMBLE still MENTIONS write_file, read_file and bash inside the tool-use protocol, as e.g. illustrations of what batching means; those are not instructions and are not gated. What: Re-exports BASE_PREAMBLE, BASE_PREAMBLE_VERSION, PromptAssembler, assemble_system_prompt, and (#2059) assemble_system_prompt_for_mode — the HarnessMode-branching entry point task::executor/runner::in_process call. Its skills_catalog parameter (#2069) is P1B’s first token-efficiency layer to actually land: DailyDriver appends the cheap, always-cached skill metadata catalog (crate::skills::format_skill_catalog); Parity ignores it. Test: prompt::tests::* (via assembler.rs’s inline test include).

Structs§

PromptAssembler
Assembles the parity system prompt from its constituent sections.

Constants§

BASE_PREAMBLE
The BASE protocol preamble (spec §2a) — identical for every model slug.
BASE_PREAMBLE_VERSION
Semantic version of the crate::prompt::BASE_PREAMBLE constant.
BATCH_WRITE_GUIDANCE
The batch-write instructions, lifted OUT of BASE_PREAMBLE (#4602).
BATCH_WRITE_TOOLS
Tool names BATCH_WRITE_GUIDANCE instructs the model to call (#4602).
DISCOVERY_GUIDANCE
DailyDriver-only discovery guidance (PR A, #2689) appended as a trailing section, mirroring the skills_catalog pattern.
DISCOVERY_GUIDANCE_TOOLS
Tool names DISCOVERY_GUIDANCE instructs the model to call (#4602).
FILE_DISCOVERY_GUIDANCE
The file-discovery block, lifted OUT of BASE_PREAMBLE (#4602).
FILE_DISCOVERY_TOOLS
Tool names FILE_DISCOVERY_GUIDANCE instructs the model to call (#4602).
GATED_SECTIONS
Every registry-gated section paired with the tool names it declares (#4602).

Functions§

assemble_system_prompt
Assemble the parity system prompt in the spec’s stable, fixed order.
assemble_system_prompt_for_mode
Mode-aware prompt assembly — the CONSUMPTION POINT #2059 wired up for P1B’s token-efficiency work; #2069 is the first arm to actually land in it (progressive-disclosure skill loading).