A ReAct Loop with Four File-System Tools Makes a Minimal Coding Agent
Coding agents like Cursor and Claude Code feel like magic, but their foundation is a simple ReAct loop connected to file-system tools. Seeing that loop built from scratch with Node.js demystifies the architecture and clarifies exactly what engineering work—sandboxing, patching, process management—separates a demo from a production tool.
A minimal coding agent, built on a standard ReAct loop, uses four Node.js tools—read_file, write_file, list_directory, and execute_command—to interact with a local filesystem. Given a high-level task to create a Vite + React + TypeScript TodoList app, the model decides when to scaffold the project, write component code, install dependencies, and start the dev server, with each tool's output fed back as context for the next decision.
The system prompt enforces strict rules, such as preventing redundant `cd` commands when a `workingDirectory` parameter is already set, to avoid common shell errors. The agent successfully generates a functional application with state management, localStorage persistence, and CSS animations, proving the output is real code written to disk, not just a text suggestion.
Production gaps remain: the agent lacks workspace sandboxing, command confirmation for destructive actions, structured patching, automated build verification, and long-running process management. These missing pieces separate a demo from a tool like Cursor or Claude Code, but the core decision-action-observation loop is identical.
Most developer-facing AI tools are just ReAct loops with different tool sets; the core architecture hasn't changed since the pattern was introduced.
The gap between a demo and a product is almost entirely in the safety and reliability engineering around the tools, not in the model's reasoning capability.
Explicitly teaching a model to avoid redundant `cd` commands in a system prompt is a brittle fix that reveals how easily tool-use agents produce silent shell errors in production.