Retrieval over procedures
Ama is receiving a chilled delivery at store 112 and the probe reads 7 °C. She asks the operations assistant whether she can accept the yoghurt. The answer must come from the procedure in effect today for her store, quote the safety step word for word, and say exactly where it came from. This lesson shows what changes when an agent retrieves from procedures: versions with effective dates, numbered steps, memos that override, and documents only managers may read.
By the end you can
- Store procedures as a versioned corpus with owners, effective dates, store types and numbered steps
- Chunk procedures by section so steps and tables stay together and every chunk carries its code, version and step numbers
- Give the agent
search_proceduresandget_proceduretools, with filters taken from the session and the calendar, and know when it should search again or open the whole section - Settle conflicts between a procedure and a regional memo, and make the agent say which one wins
- Answer with citations and exact quotes, admit gaps, and keep the index in step with every procedure update
The everyday picture
Think of the recipe binder in a busy restaurant kitchen. Each recipe card has a number, a date and the head chef's initials. A good cook does not cook from memory. She finds the card, reads the whole method from step 1, and checks the date on the card. When the head chef pins a note on the board ("from Monday, cook chicken to 75 °C, not 70"), she follows the note, because it is newer and it comes from the person in charge. If the boss asks why she did something, she says "card 12, step 4".
Two habits keep the kitchen safe. Old cards go in the bin the day new ones arrive, because one old card left in the drawer is enough for someone to cook to the wrong temperature. And when a dish is not in the binder, the cook asks the head chef instead of guessing. An agent that answers from procedures needs the same habits: the current card, the whole method, the pinned note, the card number in every answer, no old cards in the drawer, and an honest "ask your manager".
Procedures are a corpus with structure
Mangrove Market has about 140 standard operating procedures for its stores: receiving deliveries and writing the goods received note (GRN), cold-chain checks, expiry checks, stock counts, cash handling and incident reports. Regional operations teams add about 30 short memos a year. Every procedure version has the same fields:
- a code and version, such as
CC-2v4, plus a title and an owner (the food safety team owns cold chain; finance owns cash handling) - an effective date, and an end date once a newer version replaces it
- the store types it applies to (Mangrove has
standard,compactandfresh_plusstores, the last with a fish and meat counter), the regions for a memo, and the roles that may read it - numbered steps in sections: section 3 "Check temperatures" has steps 3.1 to 3.4 and a table of limits
This structure is what makes procedures different from the help pages in Retrieval-augmented generation, where you learned chunking, embeddings and hybrid search. Procedures change on a date, so the old text is still a real document but is wrong for today. Their unit of meaning is the numbered step, and the most important steps carry a number that must not move: 5 °C, 20 units, two people. And they have scope: a step can be right for a fresh_plus store in the North region and wrong for a compact store in the South.
So ingestion has to respect the structure. Mangrove's document system exports each version as JSON with sections, steps and tables, and the chunker follows three rules. First, a chunk never crosses a section. Second, a long section is split only between steps, never inside one, and a table is never split. Third, every chunk carries its metadata twice: as columns (code, version, section, first and last step, a safety flag) for filtering and citing, and as a label line at the top of the chunk text, such as CC-2 v4 | Cold chain at receiving | 3 Check temperatures | steps 3.1-3.4, so the embedding and the model both see where the text comes from. With these rules the 140 procedures become about 2,000 chunks, most of them one section each.
Quick check
Section 4 of the receiving procedure has nine steps and is about 700 tokens. Your chunk limit is 450 tokens. What should the chunker do?
Splitting between steps keeps every instruction whole, and the repeated label means each half still says where it comes from. A cut at a fixed size can separate a step from its limit. One chunk per step loses the order and the surrounding steps that make a single step make sense.