Files
deepseek-harness/docs/adr/0006-tool-schemas-in-prompt-assembly.md
Tianyi Cui 9b8fccc6f9 Backfill architecture decision records
Seven ADRs capturing the why behind decisions already made: vendoring
Cordis as source with a guarded manifest; the microkernel event
taxonomy with one swappable concrete loop; event-sourced sessions
with derived history and the append-before-emit ordering contract;
the provider-neutral content-block vocabulary (and why not
OpenAI/Anthropic shapes); the custom tool-schema DSL over schemastery;
tool schemas living in the prompt assembly; and mechanical quality
gates over prose guidelines (the agents-write-the-code rationale).
2026-06-11 15:24:14 +08:00

1.4 KiB

ADR 0006: Tool schemas are part of the system-prompt assembly

Status: accepted (2026-06-11)

Context

On the wire, tool schemas travel in a dedicated tools field of the model request, not in prompt text. Architecturally, though, "what the model is told it can do" is one coherent concern: prompt sections and the tool list are assembled from the same plugin contributions and consumed at the same moment. The alternative — the loop querying the tool registry separately from the prompt service — splits one concern across two seams.

Decision

PromptAssembly { sections, tools }: the system-prompt service collects ordered text sections AND tool schemas (the tool registry auto-contributes a provider). The loop consumes one assembly per step; adapters map sections to the provider's system slot and tools to the wire tools field. The system-prompt/assemble waterfall is therefore a single interception point for everything the model is told up front — tool filtering (ToolSearch / progressive disclosure) is an assembly rewrite, same as prompt edits.

Consequences

  • One waterfall governs the model's standing context; plugins like plan mode can swap prompt text and visible tools in one listener.
  • The assembly interface is merge-extensible for future slots (no untyped extras bag — extension is declaration merging).
  • Slight conceptual surprise (schemas in a "prompt" service) is documented here and in the package README.