pub trait Pack: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn register(&self, host: &Arc<Host>, registry: &mut Registry);
fn preamble(&self, ctx: &PackContext) -> Vec<Message>;
// Provided methods
fn required_api_schemas(&self) -> Option<&'static [&'static str]> { ... }
fn shape_user_prompt(&self, text: &str) -> String { ... }
fn build_registry(&self, host: &Arc<Host>) -> Registry { ... }
}Expand description
A faithful reproduction of one harness: its real toolset + its base prompt, selected
whole via --harness (ADR-0012). One pack is active per run.
The pack — not a per-tool field — is the unit of harness identity (contrast Grok Build, which tags every tool with a namespace because it co-locates all harnesses’ tools in one registry; we build a fresh registry per pack, so no tag is needed).
Required Methods§
Sourcefn register(&self, host: &Arc<Host>, registry: &mut Registry)
fn register(&self, host: &Arc<Host>, registry: &mut Registry)
Register this pack’s tools into registry, each under its harness’s real wire
name (Tool has no name of its own — the name is assigned here). Tools are
constructed here holding an Arc<Host> (the only OS seam; ToolCtx is too small
to carry it). A duplicate name is a wiring bug and panics inside
Registry::register.
Sourcefn preamble(&self, ctx: &PackContext) -> Vec<Message>
fn preamble(&self, ctx: &PackContext) -> Vec<Message>
The pack’s base preamble: the ordered, role-tagged System/Developer
messages that seed the conversation (ADR-0013). Each pack maps its harness onto
our roles faithfully — a single System message, or System + Developer, etc.
The wire (Task 12) places each role in the right slot. Task 8 ships a scaffold;
the real content lands in Task 13.
Provided Methods§
Sourcefn required_api_schemas(&self) -> Option<&'static [&'static str]>
fn required_api_schemas(&self) -> Option<&'static [&'static str]>
The provider wire schemas this pack’s tools require, or None when the pack
is wire-agnostic (grok, claude). The codex pack pins ["openai-responses"]
because its apply_patch is a freeform (custom-grammar) tool that only
round-trips on the OpenAI Responses wire (ADR-0012, D5). Checked pre-run
against the resolved provider: a real schema not in the set fails before the
loop with an actionable message. The mock wire (keyless CI) is a universal
escape hatch and is always allowed, independent of this list.
Sourcefn shape_user_prompt(&self, text: &str) -> String
fn shape_user_prompt(&self, text: &str) -> String
Shape a raw user prompt the way this harness expects it. Some harnesses wrap
the task in a tag their system prompt refers to (grok’s <user_query>);
Claude Code sends it verbatim. The default is verbatim; a pack overrides only
if its prompt is written against a wrapper. Keeps harness-specific shaping in
the pack rather than spread across the exec/tui layers.
Sourcefn build_registry(&self, host: &Arc<Host>) -> Registry
fn build_registry(&self, host: &Arc<Host>) -> Registry
Convenience: a fresh Registry holding exactly this pack’s tools, over host.
§Panics
If the pack’s Pack::register assigns the same wire name twice.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".