The author built a simple AI agent in about 100 lines of Common Lisp, using a recursive message loop and an eval tool.
The author built a simple AI agent in about 100 lines of Common Lisp, using a recursive message loop and an eval tool. The agent receives a list of messages, sends the latest message to a language model, and either receives a textual response or a request to execute a tool. When a tool is requested, the model generates a Common Lisp form as a string, which the agent evaluates and appends to the message list before recursing. The entire implementation relies on only two libraries for HTTP requests and JSON handling. The only tool available is eval, which allows the model to write and execute arbitrary Common Lisp code on the host machine. Memory is implemented by writing the message list to a file and reading it back, eliminating the need for a separate database schema. A context window limitation can be mitigated by summarizing past messages with another model call. The author added a web search capability by prompting the model to define a brave-search function via eval, which performs HTTP requests to the Brave Search API and parses the JSON response. This demonstrates runtime creation of new functions without a pre‑defined tool catalog. The agent stores its own source code and capabilities as text entries in its memory file, which can be reloaded in new sessions. The approach highlights homoiconicity, where code is treated as data and can be generated and executed on demand. The full source code and Dockerfile are available on GitHub.
- Publisher
- Hacker News
- Reliability
- high
- Published
- 7/12/2026, 10:00:20 AM
- Retrieved
- 7/12/2026, 10:00:20 AM
- Relevance
- 80%
- Confidence
- 85%

