Skip to content
Back to search

keen-code

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.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/mochow13/keen-code with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/mochow13/keen-code'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/mochow13--keen-code/badge.svg)](/listings/mochow13--keen-code)

HTML

<a href="/listings/mochow13--keen-code"><img src="/api/listings/mochow13--keen-code/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

These steps run a script from the network that findsafeskills does not scan.

Install with script

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`.

Install with `npm`

Install 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

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 223 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. <div align="center">
  2. <img src="./assets/banner.svg" alt="Keen Code — Your terminal. Your models. Your workflow." width="1000"/>
  3. <a href="https://github.com/mochow13/keen-code/releases/latest"><img src="https://img.shields.io/github/v/release/mochow13/keen-code?style=flat&amp;logo=github&amp;logoColor=7986CB&amp;labelColor=1B2030&amp;color=5C6BC0" alt="Latest Release" height="26"/></a>
  4. <a href="https://github.com/mochow13/keen-code/actions"><img src="https://img.shields.io/github/actions/workflow/status/mochow13/keen-code/go.yml?branch=main&amp;style=flat&amp;logo=githubactions&amp;logoColor=649FA9&amp;labelColor=1B2030&amp;color=649FA9&amp;label=build" alt="Build Status" height="26"/></a>
  5. <a href="https://codecov.io/gh/mochow13/keen-code"><img src="https://img.shields.io/codecov/c/github/mochow13/keen-code?style=flat&amp;logo=codecov&amp;logoColor=649FA9&amp;labelColor=1B2030&amp;color=649FA9" alt="Coverage" height="26"/></a>
  6. <a href="https://pkg.go.dev/github.com/mochow13/keen-code"><img src="https://img.shields.io/badge/go-reference-5C6BC0?style=flat&amp;logo=go&amp;logoColor=7986CB&amp;labelColor=1B2030" alt="Go Reference" height="26"/></a>
  7. <a href="https://go.dev/"><img src="https://img.shields.io/github/go-mod/go-version/mochow13/keen-code?style=flat&amp;logo=go&amp;logoColor=649FA9&amp;labelColor=1B2030&amp;color=649FA9" alt="Go Version" height="26"/></a>
  8. <a href="https://github.com/mochow13/keen-code/blob/main/LICENSE"><img src="https://img.shields.io/github/license/mochow13/keen-code?style=flat&amp;logo=opensourceinitiative&amp;logoColor=7986CB&amp;labelColor=1B2030&amp;color=5C6BC0" alt="License" height="26"/></a>
  9. <a href="https://www.producthunt.com/products/keen-code-a-cli-coding-agent?embed=true&utm_source=badge-featured&utm_medium=badge&utm_campaign=badge-keen-code" target="_blank" rel="noopener noreferrer"><img alt="Keen Code - A context-efficient CLI coding agent built by agents | Product Hunt" width="250" height="54" src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1162542&theme=dark&t=1780593417757"></a>
  10. </div>
  11. **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.
  12. 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.
  13. 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`](.ai-interactions/) directory.
  14. 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".
  15. <div align="center">
  16. <img src="./assets/demo.gif" alt="Keen Code demo" width="1200"/>
  17. </div>
  18. ## Table of Contents
  19. - [Features](#features)
  20. - [Development Philosophy](#development-philosophy)
  21. - [Development Cycle Example](#development-cycle-example)
  22. - [Install Keen Code](#install-keen-code)
  23. - [Install with script](#install-with-script)
  24. - [Install with npm](#install-with-npm)
  25. - [Run Keen](#run-keen)
  26. - [Supported Providers](#supported-providers)
  27. - [Built-in Tools](#built-in-tools)
  28. - [How Keen Handles Context](#how-keen-handles-context)
  29. - [Further Reading](#further-reading)
  30. ## Features
  31. - **Multi-provider** — Anthropic, OpenAI, Codex (via OAuth), Gemini, DeepSeek, Kimi, GLM, MiniMax, OpenCode Go, Yolo-Auto, and Amazon Bedrock. Switch with `/model`. More providers will be added in the future.
  32. - **11 built-in tools** — `read_file`, `write_file`, `edit_file`, `glob`, `grep`, `bash`, `web_fetch`, `ask_user`, `todo_write`, `delegate_task`, and `call_mcp_tool`. Core coding tools stay deliberately lean.
  33. - **Hashline editing** — `read_file` prefixes every line with an `N:HASH|` anchor (line number + 3-character FNV-1a hash of the line), and `edit_file` applies a multi-op `ops[]` array validated against one file snapshot, atomically — stale anchors are rejected instead of editing drifted content. Inspired by [pi-hashline-edit](https://pi.dev/packages/pi-hashline-edit).
  34. - **MCP (Model Context Protocol)** — Connect external tool providers from `~/.keen/mcp/configs.json` (or a file selected with `--mcp-config <file_path>`) over streamable HTTP or stdio, with `none`, `api_key`, or browser-based `oauth` auth. Connect and inspect servers with `/mcp`. See [docs/mcp-servers.md](docs/mcp-servers.md).
  35. - **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/skill-driven-mcp-impl.md](docs/skill-driven-mcp-impl.md).
  36. - **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`. Bundled `commit` and `review` utility skills ship out of the box. See [docs/skills-system.md](docs/skills-system.md).
  37. - **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 with `delegate_task`. See [docs/subagents.md](docs/subagents.md).
  38. - **Persistent memory** — Global (`~/.keen/memory/global/MEMORY.md`) and project (`.keen/memory/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](docs/memory.md).
  39. - **Thinking mode** — Extended reasoning for complex tasks. Use `/thinking` to change the thinking effort level for the current model. All models that support thinking can be configured.
  40. - **Session management** — Persistent sessions with resume capability.
  41. - **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](docs/compaction.md).
  42. - **Configurable tool history** — Lean cross-turn `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](docs/turn-memory.md).
  43. - **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 `/btw` without touching the main conversation. See [docs/cli-usage.md](docs/cli-usage.md).
  44. - **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](docs/queuing.md).
  45. - **Headless mode** — Run a non-interactive turn with `keen run "<prompt>"`, with `--format json` output, provider/model overrides, `--completion-signal` gating, and `--session` resume. See [docs/cli-usage.md#headless-mode-keen-run](docs/cli-usage.md#headless-mode-keen-run).
  46. - **Permission system** — Filesystem access is guard-checked: working-directory paths pass, sensitive paths prompt for approval, and system or `.gitignore` paths are denied. Always-allow tools with `/allow-permission`. See [docs/permission-system.md](docs/permission-system.md).
  47. ## How Keen Handles Context
  48. 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.
  49. 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.
  50. Subsequent turns therefore receive:
  51. - prior user and assistant messages
  52. - provider-native historical tool-call/result blocks reconstructed from assistant prose and `TurnMemory`
  53. - any pending provider-native state from a turn that failed mid-loop, so the model can resume instead of starting over
  54. 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.
  55. For the full rationale, lifecycle, and comparison with other coding agents, see [`docs/turn-memory.md`](docs/turn-memory.md).
  56. ## Development Philosophy
  57. Developing Keen Code is guided by the following philosophy:
  58. - All the code is written by AI agents, not humans
  59. - The project is developed iteratively using spec-task-code-review cycle by a human engineer
  60. - The human engineer has a very strict set of roles:
  61. - Specifiy and clarify the requirements
  62. - Review design docs and influence design decisions
  63. - Review changes made by the agents
  64. - Changes can also be reviewed by the agents themselves
  65. - Ensure the quality and correctness of the code
  66. - Focus on best practices and standards relevant to the programing language (Go in this case)
  67. - Thoroughly review and test the product after each iteration
  68. - Continously provide feedback to the agents to improve the product
  69. - Prompts are saved as markdown files in the `.ai-interactions/prompts` directory
  70. - Almost all of the prompts are stored to showcase how the project evolved from the initial requirements to the current state
  71. - Prompts are pretty much chronologically ordered which demonstrates the thought process and iterative nature of the development
  72. - All the outputs are saved as markdown files in the `.ai-interactions/outputs` directory
  73. - These outputs are basically plans, design docs, and breakdowns of the tasks
  74. - These outputs are the "specs" that the agents later use to implement the tasks
  75. ## Development Cycle Example
  76. All features follow a **spec → plan → task → review** cycle. Here's a concrete example — the `read_file` tool from Phase 3:
  77. **Spec** — [`prompts/phase-3/prompt-3_read-file-tool.md`](.ai-interactions/prompts/phase-3/prompt-3_read-file-tool.md)
  78. Requirements defined upfront: ask permission before reading, respect FileGuard path rules, text files only, 1 MB limit, support relative and absolute paths.
  79. **Plan** — [`outputs/phase-3/output-3_read-file-tool.md`](.ai-interactions/outputs/phase-3/output-3_read-file-tool.md)
  80. Design doc produced by the agent: how `Guard.CheckPath` maps to the REPL permission prompt, exact struct contracts, permission flow diagram.
  81. **Task** — [`prompts/phase-3/prompt-2_phase-3-tasks.md`](.ai-interactions/prompts/phase-3/prompt-2_phase-3-tasks.md)
  82. Implementation broken into steps — tool contract, permission bridge, REPL selector, unit tests — each approved before the next began.
  83. **Review** — (inline feedback during implementation)
  84. 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.
  85. ## Install Keen Code
  86. ### Install with script
  87. ```bash
  88. curl -fsSL https://raw.githubusercontent.com/mochow13/keen-code/main/scripts/install.sh | bash
  89. ```
  90. The same command above updates the CLI to the latest version.
  91. To pin a specific version:
  92. ```bash
  93. curl -fsSL https://raw.githubusercontent.com/mochow13/keen-code/main/scripts/install.sh | bash -s -- -v v0.16.1
  94. ```
  95. Installs to `/usr/local/bin` if writable, otherwise `$HOME/.local/bin`.
  96. ### Install with `npm`
  97. Install the CLI globally:
  98. ```bash
  99. npm install -g keen-code
  100. ```
  101. Update the global install:
  102. ```bash
  103. npm install -g keen-code@latest
  104. # or
  105. npm update -g keen-code
  106. ```
  107. `npm update` without `-g` only updates local project dependencies.
  108. Check that the install worked:
  109. ```bash
  110. keen --version
  111. which keen
  112. ```
  113. You can also run it without a global install:
  114. ```bash
  115. npx keen-code --version
  116. ```
  117. ## Run Keen
  118. Start Keen in your current directory:
  119. ```bash
  120. keen
  121. ```
  122. To use custom configuration files, select model/provider settings with `--model-config` and MCP servers with `--mcp-config`:
  123. ```bash
  124. keen --model-config ./model-config.json --mcp-config ./mcp-config.json
  125. keen run --model-config ./model-config.json --mcp-config ./mcp-config.json "Explain this project"
  126. ```
  127. Both flags accept relative or absolute paths and work independently. They replace their respective defaults (`~/.keen/configs.json` and `~/.keen/mcp/configs.json`); missing, unreadable, or invalid custom files cause startup to fail without falling back. The former `--config` flag is now `--model-config`. See [CLI usage](docs/cli-usage.md#custom-model-configuration-file) for details.
  128. ## Supported Providers
  129. - Anthropic
  130. - OpenAI
  131. - Codex (ChatGPT OAuth)
  132. - Google AI (Gemini)
  133. - Moonshot AI (Kimi)
  134. - DeepSeek
  135. - Z.ai (GLM)
  136. - MiniMax
  137. - OpenCode Go
  138. - Yolo-Auto
  139. - Amazon Bedrock
  140. > Use `/model` to switch providers. The ChatGPT/Codex option opens a browser-based OpenAI sign-in flow and stores OAuth credentials in `~/.keen/auth.json`.
  141. MiniMax uses its Anthropic-compatible API and includes MiniMax M2.7 and M2.5.
  142. OpenCode Go uses an API key and includes GLM, Kimi, DeepSeek, MiMo, MiniMax, and Qwen models.
  143. Yolo-Auto uses an API key against `https://yolo-auto.com/v1` and ships the `yolo` and `yolo-small` aliases; the catalog for your key is discoverable at `GET /v1/models`.
  144. ## Built-in Tools
  145. Keen Code aims to support minimal set of useful tools for coding. Currently, these tools are built in:
  146. - `read_file` — read a UTF-8 text file with `N:HASH|` line anchors
  147. - `glob` — find files by glob patterns
  148. - `grep` — search for text patterns in files
  149. - `write_file` — create or overwrite files
  150. - `edit_file` — hash-anchored multi-op edits (`LINE:HASH` anchors in one `ops` array, applied atomically)
  151. - `bash` — run shell commands
  152. - `web_fetch` — fetch a URL and return the content as text (HTML converted to Markdown)
  153. - `ask_user` — ask the interactive user clarification questions with preselected recommendations
  154. - `todo_write` — track multi-step work in a task list shown in a compact panel above the input
  155. - `delegate_task` — delegate up to 10 bounded tasks to named subagents and run them in parallel
  156. - `call_mcp_tool` — call a tool on a connected MCP (Model Context Protocol) server
  157. ## Further Reading
  158. - [TOUR.md](TOUR.md) — the full story of how this project was built
  159. - [CHANGELOG.md](CHANGELOG.md) — release history
  160. - [ROADMAP.md](ROADMAP.md) — what's planned next
  161. - [CONTRIBUTING.md](CONTRIBUTING.md) — how to contribute
  162. - [`docs/`](docs/) — architecture, tools, sessions, skills, and more

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.