agent-ops-patterns / gallery / pi map / how it decides

How pi decides

In pi, the AI model chooses each next step and ends the run by replying without asking to use a tool; plain code checks and runs the tool calls but adds no check of its own that the work was done. By pi's stated design nobody is asked before a tool call runs unless an installed extension blocks it, and a shell command has no time limit unless the model sets one.

From earendil-works/pi at source version 1ce44bed, mapped 2026-10-28. Each answer links the code where that decision is made.

What it does without asking you

How it decides it is done

Limits and memory

Other judgments

Three problems in the code

  1. 1. Piped input and your message are joined with nothing between them

    In a one-shot run, pi joins piped input, the text of @file arguments and the first message into one prompt with no separator between them, so the end of one part runs straight into the start of the next. pi's maintainers closed the report about this as not planned.

    Reported; no linked fix found (#7863), checked 2026-11-01.

    Where: initial-message.ts:26-40. How we checked: the code was re-read at the source version named above; the sentences were checked by an independent AI reviewer from another company (OpenAI Codex, read-only) on 2026-11-01; every sentence it found too wide was rewritten or removed, and every rewrite was checked again.

  2. 2. Cut-down output from your own shell command can be marked as not cut

    When you run a command yourself with !, pi keeps only the tail of a long output. After older output has been dropped, the flag that says the output was cut can still read false.

    Reported; a fix is proposed, not merged (#10165), checked 2026-11-01.

    Where: bash-executor.ts:92-98, bash-executor.ts:131-143. How we checked: the code was re-read at the source version named above; the sentences were checked by an independent AI reviewer from another company (OpenAI Codex, read-only) on 2026-11-01; every sentence it found too wide was rewritten or removed, and every rewrite was checked again.

  3. 3. A "too long" error in unfamiliar wording is not recognized

    When a request fails, pi recognizes that it overflowed the model's context by matching the error text against a list of known provider messages. Wording the list does not know is treated as an ordinary error, so pi does not compact the history and retry. pi's tracker has an open report about one such message.

    Already tracked upstream (#10885), checked 2026-11-01.

    Where: overflow.ts:144-178, overflow.ts:39-69. How we checked: the code was re-read at the source version named above; the sentences were checked by an independent AI reviewer from another company (OpenAI Codex, read-only) on 2026-11-01; every sentence it found too wide was rewritten or removed, and every rewrite was checked again.

See the full map →

This card was taken from the published map of pi at one commit and covers only decisions shown there; it did not look at code outside the map's scope (the command-line agent, agent loop, model layer, code mode and MCP client), and no pi code was run to make it.

Map: first edition (2026-10-29) · taken from the full map · card data: gallery/cards/pi.json. Found something wrong? Use the correction form.