I built a pip-installable Python coding agent from first principles — hummcode
I wanted to understand how coding agents actually work at the lowest level, so I studied a few open-source implementations and built one in Python.
It's called hummcode (the Hummingbird Coding Agent).
pip install hummcode
GitHub: https://github.com/0xchamin/hummcode
PyPI: https://pypi.org/project/hummcode/
Hummcode is a coding agent with a clean async event loop, tree-based session memory, and a small set of composable primitive tools. No framework. No magic. The entire architecture is based on fundamentals.
Here are the tools
read_file— reads any filelist_files— recursive directory listing, skips node_modules/.git etc.edit_file— surgical search-and-replace (validates uniqueness before writing — refuses if the string appears 0 or 2+ times)execute_bash— runs shell commands, 120s timeout, returns stdout + stderrask_oracle— delegates isolated questions to a cheaper secondary model
Here's the memory system overview:
Most agents use a flat messages = []list. The problem is every failed attempt stays in context forever and eventually you hit the token limit and get a 400. hummcode uses a tree instead — every message is a node with a parent pointer. If the agent goes down a bad path, `/rewind` moves the pointer back and the dead branch is excluded from all future LLM calls. When tokens get too high, a sliding window + LLM summarisation compacts the old nodes cleanly.
Hummcode is model agnostic:
Powered by LiteLLM. Swap between Claude, GPT-4o, Mistral, or Ollama by changing one env variable. You can also switch mid-session with `/model`.
The UI:
Ships with a Textual TUI — dual pane, chat on the left, tool execution log on the right. Also runs headless with `hummcode --cli`.
This work is hugely inspired from following notable work:
- Geoffry Huntley's coding agent post (ghuntley.com/agent) and his Go implementation (link to Git repo)
- Pi coding agent by Earendil (pi.dev) — the tree memory idea came from here
- TeenyCode by Yang Shun — proved you don't need much code for a working agent
This is v0.1.1. Rough in places. Happy to answer questions about the architecture or the design decisions.
If you like my work, please do star my Git repo. thanks!
GitHub: https://github.com/0xchamin/hummcode
PyPI: https://pypi.org/project/hummcode/