Keen Code is a terminal-based AI coding agent like Claude Code or Codex CLI. Written in Go, it is simpler, lighter, minimalistic but useful coding agent for typical software engineering tasks. It supports multiple providers, skills, MCPs, subagents with multi-agent orchestration, and more.
Keen Code is highly opinionated. It avoids features that are not necessarily needed or useful for a regular software engineer. It tries to avoid unnecessary complexity and attempts to keep the agent harness as simple as possible.
From requirements to implementation, Keen Code was engineered using a wide range of coding agents and agentic IDEs. By far, AI coding agents are the most ubiquitous use case in the era of AI agents. One of the goals of the project is to showcase how coding agents can be used to develop coding agents themselves. This is why most prompts and output docs are saved as markdown files in the .ai-interactions directory.
Keen Code is also an experiment to play with the new way of working where engineers work with AI agents to develop software. In this setting, engineers are sometimes referred to as "orchestrators".
Born as an experiment, Keen is now a fully functional coding agent designed for real-world software development.
- Features
- Screenshots
- Development Philosophy
- Development Cycle Example
- Install Keen Code
- Run Keen
- Supported Providers
- Built-in Tools
- How Keen Handles Context
- Further Reading
- Multi-provider — Anthropic, OpenAI, Codex (via OAuth), Gemini, DeepSeek, Kimi, GLM, MiniMax, OpenCode Go, and Amazon Bedrock. Switch with
/model. More providers will be added in the future. - 10 built-in tools —
read_file,write_file,edit_file,glob,grep,bash,web_fetch,ask_user,delegate_task, andcall_mcp_tool. Core coding tools stay deliberately lean. - Hashline editing —
read_fileprefixes every line with anN:HASH|anchor (line number + 3-character FNV-1a hash of the line), andedit_fileapplies a multi-opops[]array validated against one file snapshot, atomically — stale anchors are rejected instead of editing drifted content. Inspired by pi-hashline-edit. - MCP (Model Context Protocol) — Connect external tool providers from
~/.keen/mcp/configs.jsonover streamable HTTP or stdio, withnone,api_key, or browser-basedoauthauth. Connect and inspect servers with/mcp. See docs/mcp-servers.md. - Skill-driven MCP servers — Each connected MCP server generates an ordinary skill (
mcp:<server>) with a tool table and JSON schemas, so tool discovery stays prompt-efficient and detailed schemas load on demand. No tool-search-tool needed to discover MCP tools. See docs/mcp-skills.md. - Skills system — User-defined skills discovered from project and home directories (
.agents/skills,.keen/skills,.claude/skills), activated as slash commands and managed with/skills. Bundledcommitandreviewutility skills ship out of the box. See docs/skills-system.md. - Subagents — Define focused profiles as markdown files in
.agents/agents/(project or home) with their own provider, model, thinking effort, and permissions. The main agent delegates up to 10 bounded tasks in parallel withdelegate_task. See docs/subagents.md. - Persistent memory — Global (
~/.keen/memory/global/MEMORY.md) and project (.keen/MEMORY.md) markdown files are loaded into the system prompt every session; the agent records to them when you ask it to remember. Manage with/memory. See docs/memory.md. - Thinking mode — Extended reasoning for complex tasks. Use
/thinkingto change the thinking effort level for the current model. All models that support thinking can be configured. - Session management — Persistent sessions with resume capability.
- Context compaction — Summarize the conversation into a smaller continuation context with
/compact, or let Keen compact automatically when the context approaches the model's budget. See docs/compaction.md. - Configurable tool history — Lean cross-turn
TurnMemorysummaries by default; use/tool-history fullto retain full tool outputs for future turns. More information can be found in docs/turn-memory.md. - Adversarial review and side questions — Run a separately-configured second model as an adversarial critic of the main agent's work with
/adversary, and ask quick side questions with/btwwithout touching the main conversation. See docs/cli-usage.md. - Input queuing — Prompts and skill activations typed while the agent streams are queued, previewed, and submitted one at a time as turns complete. Clear the queue with
/emptyq. See docs/queuing.md. - Headless mode — Run a non-interactive turn with
keen run "<prompt>", with--format jsonoutput, provider/model overrides,--completion-signalgating, and--sessionresume. See docs/cli-usage.md#headless-mode-keen-run. - Permission system — Filesystem access is guard-checked: working-directory paths pass, sensitive paths prompt for approval, and system or
.gitignorepaths are denied. Always-allow tools with/allow-permission. See docs/permission-system.md.
Full interface |
Command output |
Diff review |
Interactive commands |
Permission prompt |
|
Keen takes a deliberately lean approach to cross-turn context. Within a single assistant turn the model has full access to its tool calls and results. By default, later model requests receive a bounded TurnMemory summary attached to assistant messages: where retained tools ran, their bounded invocation inputs, status, and non-zero bash exit codes—not their raw outputs.
For ideation or work that benefits from revisiting exact earlier results, run /tool-history full. Tool outputs from future turns are then retained in the current session's cross-turn model context. Run /tool-history none to return to the compact default, or /tool-history to inspect the setting. Full history increases prompt size and token cost; it is not persisted when a session is saved.
Subsequent turns therefore receive:
- prior user and assistant messages
- provider-native historical tool-call/result blocks reconstructed from assistant prose and
TurnMemory - any pending provider-native state from a turn that failed mid-loop, so the model can resume instead of starting over
The default tradeoff is intentional: smaller context and a better signal-to-noise ratio, at the cost of occasionally re-reading files or re-running searches when older observations are needed again. Read-only facts and external observations are refreshed when needed rather than treated as durable evidence. /tool-history full lets you choose continuity over that default for the remainder of the session.
For the full rationale, lifecycle, and comparison with other coding agents, see docs/turn-memory.md.
Developing Keen Code is guided by the following philosophy:
- All the code is written by AI agents, not humans
- The project is developed iteratively using spec-task-code-review cycle by a human engineer
- The human engineer has a very strict set of roles:
- Specifiy and clarify the requirements
- Review design docs and influence design decisions
- Review changes made by the agents
- Changes can also be reviewed by the agents themselves
- Ensure the quality and correctness of the code
- Focus on best practices and standards relevant to the programing language (Go in this case)
- Thoroughly review and test the product after each iteration
- Continously provide feedback to the agents to improve the product
- Prompts are saved as markdown files in the
.ai-interactions/promptsdirectory- Almost all of the prompts are stored to showcase how the project evolved from the initial requirements to the current state
- Prompts are pretty much chronologically ordered which demonstrates the thought process and iterative nature of the development
- All the outputs are saved as markdown files in the
.ai-interactions/outputsdirectory- These outputs are basically plans, design docs, and breakdowns of the tasks
- These outputs are the "specs" that the agents later use to implement the tasks
All features follow a spec → plan → task → review cycle. Here's a concrete example — the read_file tool from Phase 3:
Spec — prompts/phase-3/prompt-3_read-file-tool.md
Requirements defined upfront: ask permission before reading, respect FileGuard path rules, text files only, 1 MB limit, support relative and absolute paths.
Plan — outputs/phase-3/output-3_read-file-tool.md
Design doc produced by the agent: how Guard.CheckPath maps to the REPL permission prompt, exact struct contracts, permission flow diagram.
Task — prompts/phase-3/prompt-2_phase-3-tasks.md
Implementation broken into steps — tool contract, permission bridge, REPL selector, unit tests — each approved before the next began.
Review — (inline feedback during implementation)
The LLM was rejecting .go files because MIME detection flagged them as binary. Review caught this; switched to character-based text validation. The fix landed in the same iteration.
curl -fsSL https://raw.githubusercontent.com/mochow13/keen-code/main/scripts/install.sh | bashThe same command above updates the CLI to the latest version.
To pin a specific version:
curl -fsSL https://raw.githubusercontent.com/mochow13/keen-code/main/scripts/install.sh | bash -s -- -v v0.16.1Installs to /usr/local/bin if writable, otherwise $HOME/.local/bin.
Install the CLI globally:
npm install -g keen-codeUpdate the global install:
npm install -g keen-code@latest
# or
npm update -g keen-codenpm update without -g only updates local project dependencies.
Check that the install worked:
keen --version
which keenYou can also run it without a global install:
npx keen-code --versionStart Keen in your current directory:
keen- Anthropic
- OpenAI
- Codex (ChatGPT OAuth)
- Google AI (Gemini)
- Moonshot AI (Kimi)
- DeepSeek
- Z.ai (GLM)
- MiniMax
- OpenCode Go
- Amazon Bedrock
Use
/modelto switch providers. The ChatGPT/Codex option opens a browser-based OpenAI sign-in flow and stores OAuth credentials in~/.keen/auth.json.
MiniMax uses its Anthropic-compatible API and includes MiniMax M2.7 and M2.5. OpenCode Go uses an API key and includes GLM, Kimi, DeepSeek, MiMo, MiniMax, and Qwen models.
Keen Code aims to support minimal set of useful tools for coding. Currently, these tools are built in:
read_file— read a UTF-8 text file withN:HASH|line anchorsglob— find files by glob patternsgrep— search for text patterns in fileswrite_file— create or overwrite filesedit_file— hash-anchored multi-op edits (LINE:HASHanchors in oneopsarray, applied atomically)bash— run shell commandsweb_fetch— fetch a URL and return the content as text (HTML converted to Markdown)ask_user— ask the interactive user clarification questions with preselected recommendationsdelegate_task— delegate up to 10 bounded tasks to named subagents and run them in parallelcall_mcp_tool— call a tool on a connected MCP (Model Context Protocol) server
- TOUR.md — the full story of how this project was built
- CHANGELOG.md — release history
- ROADMAP.md — what's planned next
- CONTRIBUTING.md — how to contribute
docs/— architecture, tools, sessions, skills, and more

