Part 6 · Inside a Production Coding Agent

Canonical Input Is a Stable Projection

Using CanonicalToolMeta and input projection to explain stable contracts across tool implementations

THE QUESTION THIS PAGE ANSWERS

ANSWER FIRST

What is the key idea behind “Canonical Input Is a Stable Projection”?

Using CanonicalToolMeta and input projection to explain stable contracts across tool implementations

DECISION RULE

Make the claim earn its place. Use this page as a decision aid, not a definition to memorize. Connect the idea to one real task, one observable result, and one failure that would change your mind.

TRY NEXT

Write one question you could answer with evidence after trying this idea.

WATCH FOR

A conclusion that sounds complete but leaves the key assumption untested.

Learning Objective Memorize the eight canonical fields, the seven CanonicalToolMeta fields with version = 1, and be able to explain why input may have missing fields or be omitted entirely.
Core Visual · Teaching Projection Diagram
raw_input Afile_path · old_stringnew_string · replace_all raw_input Bpath · offset · limitother harness fields canonicalprojection x.ai/tool · version 1name · kind · namespace · labelread_onlyinput: { path, offset, limit }Only stable, lightweight cross-fields retained
Teaching diagram: projection may discard fields; the full raw input is still carried by raw_input.
Eight Canonical Fields
path

File or search path

offset

Normalized start position

limit

Read or result limit

command

Command to execute

description

Command description

cwd

Working directory vocabulary

directory

Directory listing target

pattern

Search pattern

Metadata Contract and Omission Rules

Actual Fields of CanonicalToolMeta

versionnamekindnamespacelabelread_onlyinput

version is the number 1. input is an optional JSON value and is omitted entirely when there is no stable projection.

input Stays Lightweight

It is a canonical projection, not a mirror of raw input. Non-shared fields like grep flags and replace_all may be discarded; large fields such as before/after edit text and full write content do not enter the projection and can be obtained from raw_input.

Public Behavior Comparison: The Read tool in Claude Code's public documentation uses file_path, offset, and limit. Grok Build's normalization layer maps its own tool inputs to shared fields such as path. This comparison only covers publicly visible tool input naming and does not infer Claude Code's internal implementation.
Source Code Evidence
crates/codegen/xai-grok-tools/src/tool_taxonomy.rs · Lines 12–30, 190–200
pub mod field {
    pub const PATH: &str = "path";
    pub const OFFSET: &str = "offset";
    pub const LIMIT: &str = "limit";
    pub const COMMAND: &str = "command";
    pub const DESCRIPTION: &str = "description";
    pub const CWD: &str = "cwd";
    pub const DIRECTORY: &str = "directory";
    pub const PATTERN: &str = "pattern";
}
pub const TOOL_META_VERSION: u32 = 1;

pub struct CanonicalToolMeta {
    pub version: u32,
    pub name: String,
    pub kind: ToolKind,
    pub namespace: ToolNamespace,
    pub label: Cow<'static, str>,
    pub read_only: bool,
    pub input: Option<serde_json::Value>,
}
Source Snapshot Note: Based on the local repository at grok-build-main, files xai-grok-tools/src/tool_taxonomy.rs and normalization.rs, verified on 2026-07-17. No content canonical field exists in the source; fictitious metadata fields and version examples from older pages have been removed.
Classroom Exercise
04

Create a Projection for an Edit Call

The raw input contains file_path, old_string, new_string, and replace_all. Write out the canonical input and identify which fields should remain in raw_input.

Takeaway: The canonical layer pursues stable shared semantics across harnesses. The current fields are only path/offset/limit/command/description/cwd/directory/pattern, and the metadata version is the number 1. input may omit sensitive or large fields.

The handoffs inside “Core Visual · Teaching Projection Diagram”

“version is the number 1.” shows that an Agent is not defined by the model alone. Each handoff between model, context, tools, state, permissions, and people affects both progress and recovery.

Write the state before adding capability

Starting from “It is a canonical projection, not a mirror of raw input.”, split the workflow into starting state, next action, tool result, state update, and stop condition. Debugging then means finding the first lost piece of information or authority instead of saying vaguely that the model “got worse”.

A happy path is not reliability

Use “The raw input contains file_path , old_string , new_string , and replace_all .” to replay one successful and one failed run. Record the context, tool result, and owner at each turn; the workflow is maintainable when a second person can follow it without the original builder.

From “Core Visual · Teaching Projection Diagram” to “Eight Canonical Fields”

“Core Visual · Teaching Projection Diagram” grounds the problem in “raw_input A file_path · old_string new_string · replace_all raw_input B path · offset · limit other harness fields canonical projection x.ai/tool · version 1 name · kind · namespace · label read_only input: { p…”. “Eight Canonical Fields” then moves it toward “Normalized start position”. Together, they show that the lesson is not just a conclusion to remember, but a claim with conditions.

Carry the judgment into the next situation

When analyzing an Agent, trace state, action, tool result, and next step in order. Each handoff should explain where information came from, who confirmed it, and where failure stops.

  • “Core Visual · Teaching Projection Diagram”: raw_input A file_path · old_string new_string · replace_all raw_input B path · offset · limit other harness fields canonical projection x.ai/tool · version 1 name · kind · namespace · label read_only input: { p…
  • “Eight Canonical Fields”: Normalized start position
  • “The closing point”: The raw input contains file_path , old_string , new_string , and replace_all . Write out the canonical input and identify which fields should remain in raw_input

The final “The closing point” brings the discussion to “The raw input contains file_path , old_string , new_string , and replace_all . Write out the canonical input and identify which fields should remain in raw_input ”. The useful thing to carry forward is knowing which judgments must be revisited when input, scale, or risk changes.

Mark as learned Your reading progress updates automatically
← PreviousNext →

Keep reading

The next useful article in the thread.

ARTICLE DISCUSSION

Leave one useful thought here.

Keep the idea that clicked, the question that stayed open, or a small note for the next learner.

Discussing Canonical Input Is a Stable Projection Inside a Production Coding Agent
3discussionsArticle discussion · synced with the Circle
View in the learning circle
AM
Asha MorganContent editor
INSIGHTField note

I turned one judgment from this article into a small experiment I could run today. Knowing what to observe next is more useful than simply remembering the conclusion.

ARTICLE DISCUSSION7 helpful
LH
Lin HarperIndie developer
INSIGHTInsight

After reading this, I first looked for the conditions behind the idea instead of copying the method into a project. That order made the later trade-offs much clearer.

ARTICLE DISCUSSION5 helpful
KM
Kiki MooreProduct operations
QUESTIONQuestion

When this judgment reaches real work, which constraint should be added first? I am curious which step matters most between reading and the first practical attempt.

ARTICLE DISCUSSION4 helpful