‹ Field Guide

Letter 21 · The key that fit

Koko holds a ruby key up to the moonlight. It fits the lock perfectly. At the ticket booth, Michi has one last question. “Are there still two seats?”

Press the whole piece

The factory makes four keys. Choose A or B, then choose plain or glowing. Every key begins with the same little text fragment. One token on our invented tray carries the entire opener. Another carries only its first five characters, ending just after the y in key. Both pieces let you finish a valid object.

After pouring the opener and the letter A, the mold still needs a closing quote and a brace. One piece supplies both. Another closes the quote, adds the optional glow field and closes the brace. The end token would leave the object unfinished. A decoder has to examine everything a candidate token adds. Tokens can cross several grammar boundaries or end inside a single word. The matching method in this four-key press enumerates the possible strings. Production grammar engines study how to do this efficiently across much larger languages and vocabularies. OpenAI Developers launch post on X · OpenAI engineering explanation · GreatGramma paper, ICML 2025

Fit the nested lock

Koko stacks two open rings, fits the quoted word cat and snaps in one closer. The stack lock has one more opening to remember. Try the end seal and the lock shows exactly what is missing. Add the final closer, then the seal, and it turns green. The little one-ring lock already stopped at the second opening.

An unrolled recognizer can handle a fixed depth. A recursive rule can reuse itself at every opening, with a stack to track what must close. The game recognizes a single quoted cat wrapped in pairs of brackets. For a real deployment, check which JSON Schema features the chosen provider accepts. XGrammar systems paper · ACM author talk on XGrammar-2 · Anthropic structured outputs

Read the receipt

The Moon show has three seats. A completed tool call proposes two ordinary seats. Its fields match the schema, the guest has permission, and the preflight check finds enough space. While the key is on the belt, another guest buys two seats. The booking tool checks again when it tries to commit. It returns a conflict and creates zero receipts for Michi.

Michi switches to a fresh one-seat order with a new operation key. Its first attempt fails before committing. She retries the same order and receives JELLY-01. Replaying the same key returns JELLY-01 again, even with zero Moon seats left. This works because our local tool stores the receipt together with the successful reservation. In a client-tool integration the harness needs to handle provider completion, validate the call, run the tool and send the observed result back into the model loop. OpenAI structured outputs guide · Anthropic strict tool use · Anthropic tool lifecycle

Enter Jelly Key Factory · Follow the Tool contract smith course