Model loop, tools, events, reducer.
Walk through a tinyloop turn from user input to model response, tool execution, session events, UI state, and terminal rendering.
Open architectureA small, readable agent loop for studying how model turns become tool calls, session events, and interface state.
npm install -g tinyloopThis minimal coding agent is heavily inspired by Pi.
Overview
tinyloop is not trying to hide the machinery. It gives learners a concrete codebase where the model loop, tool calls, session events, and terminal UI are separate enough to inspect one piece at a time.
The model returns text or asks for a named function call.
tinyloop runs read_file, edit_file, write_file, or run_command.
Tool progress, tool results, messages, and failures become ordered events.
The TUI reduces events into state and renders from that state.
Learning map
Start with the architecture for the mechanics, read the principles for the design taste, or follow a walkthrough when you want one concrete path through the code.
Walk through a tinyloop turn from user input to model response, tool execution, session events, UI state, and terminal rendering.
Open architecturetinyloop favors explicit contracts, swappable session drivers, visible state, and an honest boundary between learning project and production agent.
Open principlesFollow one full turn or add one tiny tool while keeping the model, tool, event, and UI boundaries visible.
Open walkthroughsThe core boundary
This is the main architectural lesson in the repo. The agent package emits a session event stream; the TUI package normalizes those events and reduces them into transcript state.