SimpleCoder
View SourceBasic code "agent" built using the ai sdk v5 beta & powered by GPT-5.
TypeScriptAIAgentsai sdk v5
Overview
SimpleCoder is a deliberately simple terminal coding assistant intended to demonstrate how equipping a model with a decent prompt & tool set can enable "agentic" AI behavior. The purpose isn't to showcase a production-ready agent, but rather to supplement a future blog post on the topic for non-technical readers. Around 95% of the code was put together over the course of a few hours.
For example,
- Message history management could be improved since in the current state, the entire message history is sent to the model for each request. A naive but "good enough" improvement for this simple project would be to track token usage & either truncate the message history or summarize it at certain thresholds to avoid context pollution & token waste on subsequent messages.
- More sophisticated stop conditions could be implemented as opposed to
stopWhen: stepCountIs(Infinity)
- More deterministic flow control could be implemented as opposed to relying on the system prompt to dictate the flow
- Shell command execution could and should be further scrutinized
Again, outside of going a bit overboard with shell command execution & diff rendering, the intent is to just be a simple example.
Highlights
- Terminal-based chat with file system access via structured tools & powered by GPT-5
- Streaming token display with live tool execution feedback
- Basic file operations: read, edit, list, and command execution with safety guardrails
- Diff rendering for file edits
Stack
- Node v24.2.0
- TypeScript v5.9.2
- biome for linting & formatting
- vitest for unit testing pure utility functions
- ai sdk v5 (beta) for LLM interactions
- zod for schema validation
Footnotes
Claude Code (Claude Opus 4.1) was used to expedite the development of: command execution, diff rendering, and unit tests.