About

About KnightCode

A local, bring-your-own-key terminal coding agent. Install it from npm, run it in a repository, and connect a provider you already have.

v0.20.0MIT

What it is

KnightCode is a terminal coding agent. The knightcode command runs an interactive session, and the same agent is available in print, JSON, and RPC modes and through createAgentSession(). It starts with the read, bash, edit, and write tools; grep, find, and ls are built in and off until you enable them. Tools run with the permissions of the KnightCode process.

You bring the provider account. /login stores a credential, or you set an API key in the environment. OpenRouter is one of the built-in providers, next to direct adapters for Anthropic, OpenAI, Google, xAI, Groq, GitHub Copilot, Amazon Bedrock, and others. There is no KnightCode account and no bundled model subscription.

Who builds it

Mostly me - Raghav. I built it because I wanted a coding agent that runs in the terminal, talks to the provider I already pay, and does not spend tens of thousands of tokens on its own instructions before I type.

Contributions, bug reports, and feature requests are welcome on GitHub.

How it's built

The published command is @knightcodeai/cli. It depends on the other packages in this repository. @knightcode/ai is the provider layer: catalogs, API adapters, OAuth, and streaming.@knightcode/agent is the loop, the harness, compaction, session state, and the built-in tools. @knightcode/tui draws the terminal. @knightcode/durable is the Pico record runtime, with memory, JSONL, and SQLite storage. RPC is split across protocol, client, and server. SQLite session storage lives in its own package so the agent core does not require it. @knightcode/tools is the built-in extension for optional tools, the scratchpad, and the classifier gate. @knightcode/remote is remote sessions. Bun runs the repo from source. The website is a separate Next.js app.

  • Node.js 22.19
    Published npm install
  • @knightcode/tui
    Terminal UI
  • @knightcode/ai
    Providers, auth, streaming
  • @knightcode/agent
    Loop, tools, compaction, sessions
  • @knightcode/durable
    Pico record storage
  • protocol / client / server
    RPC
  • session-backend-sqlite
    SQLite session backend
  • @knightcode/tools
    Optional tools and the classifier gate
  • @knightcode/remote
    Remote sessions

What it isn't

License

MIT. The license text, including third-party notices, is in the repository.