A context-aware terminal-based coding agent written in Go. Supports multiple-providers, MCPs, Subagents, Agent Skills, controllable tool output retention, hashline edits, and more.
61
stars
20
commits
Go
primary language
Sep 9, 2026
updated
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".
/model. More providers will be added in the future.read_file, write_file, edit_file, glob, grep, bash. Deliberately lean./thinking to change the thinking effort level for the current model. All models that support thinking can be configured.TurnMemory summaries by default; use /tool-history full to retain full tool outputs for future turns. More information can be found in docs/turn-memory.md./compact to compact the context.Keen Code collects two minimal anonymous usage events for actual interactive and headless coding sessions: keen_session_start and keen_session_end. Help, version, and invalid command invocations are not counted. The events contain a random resettable installation ID, a session ID, Keen version, OS, architecture, interactive/headless mode, and session duration in milliseconds. Google Analytics derives coarse country from the request connection, so no separate country event or country value is sent.
Keen Code never sends prompts, responses, code, paths, commands, repository details, model/provider details, or raw errors. Set KEEN_TELEMETRY=off or DO_NOT_TRACK=1 to disable telemetry. It is also disabled automatically in CI.
Telemetry delivery is fail-silent. The session-start event is emitted asynchronously, and the session-end event is emitted on normal exit. Each event has a one-second timeout. Forced termination, crashes, and network failures can still prevent delivery.
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:
TurnMemoryThe 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:
.ai-interactions/prompts directory
.ai-interactions/outputs directory
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 | bash
The 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.1
Installs to /usr/local/bin if writable, otherwise $HOME/.local/bin.
npmInstall the CLI globally:
npm install -g keen-code
Update the global install:
npm install -g keen-code@latest
# or
npm update -g keen-code
npm update without -g only updates local project dependencies.
Check that the install worked:
keen --version
which keen
You can also run it without a global install:
npx keen-code --version
Start Keen in your current directory:
keen
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 with N: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:HASH anchors in one ops array, applied atomically)bash — run shell commandsdocs/ — architecture, tools, sessions, skills, and more17 commits
3 commits
Go
98.9%
A context-aware terminal-based coding agent written in Go. Supports multiple-providers, MCPs, Subagents, Agent Skills, controllable tool output retention, hashline edits, and more.
61
stars
20
commits
Go
primary language
Sep 9, 2026
updated
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".
/model. More providers will be added in the future.read_file, write_file, edit_file, glob, grep, bash. Deliberately lean./thinking to change the thinking effort level for the current model. All models that support thinking can be configured.TurnMemory summaries by default; use /tool-history full to retain full tool outputs for future turns. More information can be found in docs/turn-memory.md./compact to compact the context.Keen Code collects two minimal anonymous usage events for actual interactive and headless coding sessions: keen_session_start and keen_session_end. Help, version, and invalid command invocations are not counted. The events contain a random resettable installation ID, a session ID, Keen version, OS, architecture, interactive/headless mode, and session duration in milliseconds. Google Analytics derives coarse country from the request connection, so no separate country event or country value is sent.
Keen Code never sends prompts, responses, code, paths, commands, repository details, model/provider details, or raw errors. Set KEEN_TELEMETRY=off or DO_NOT_TRACK=1 to disable telemetry. It is also disabled automatically in CI.
Telemetry delivery is fail-silent. The session-start event is emitted asynchronously, and the session-end event is emitted on normal exit. Each event has a one-second timeout. Forced termination, crashes, and network failures can still prevent delivery.
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:
TurnMemoryThe 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:
.ai-interactions/prompts directory
.ai-interactions/outputs directory
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 | bash
The 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.1
Installs to /usr/local/bin if writable, otherwise $HOME/.local/bin.
npmInstall the CLI globally:
npm install -g keen-code
Update the global install:
npm install -g keen-code@latest
# or
npm update -g keen-code
npm update without -g only updates local project dependencies.
Check that the install worked:
keen --version
which keen
You can also run it without a global install:
npx keen-code --version
Start Keen in your current directory:
keen
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 with N: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:HASH anchors in one ops array, applied atomically)bash — run shell commandsdocs/ — architecture, tools, sessions, skills, and more17 commits
3 commits
Go
98.9%