Architecture
User
Input: "Check files"
LLM
Inference Engine
The chatbot has no continuous brain. Every single reply is a fresh reconstruction of reality.
Runtime Assembly
For every user message, the system re-reads the System Prompt, Chat History, and previous Tool Results to create the context window.
Tool Execution
The LLM cannot "run" code. It outputs text (JSON). The wrapper code executes the command on the OS and feeds the text result back into the prompt.
What the LLM "Sees"
[System Prompt] + [History] + [Tool Output]
This combined text is the only "self" the agent has access to.