Package Exports
- kob-cli
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (kob-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
KOB CLI
A beautiful, fully agentic AI coding assistant for your terminal.
πΉπ Made in Thailand Β· v2.0.56 Β· MIT
Read your project, write your code, run your tests, fix your bugs β all without leaving the terminal. No editor plugin. No background daemon. Just
kob.
β¨ Why KOB CLI
Most AI chat tools are passive: you paste code, you get text back. KOB CLI is active β it understands your project, decides which tools to call, and shows you exactly what it changed, with diffs and undo support.
It is designed to feel like a disciplined pair programmer inside your terminal:
- π Reads first β the engine injects your file tree into context, so the model knows what you have before suggesting changes.
- π Acts, not just answers β
read_file,str_replace,write_file, and shell commands are first-class tool calls, not hidden magic. - π¨ Colored diffs, visible progress β every read, replacement, file write, and command run is reported inline as it happens.
- β‘ Interactive slash commands β real-time autocomplete for commands like
/models,/undo, and/configdirectly in the prompt. - β©οΈ
/undois real undo β every file mutation in the last turn can be reverted, no Git ceremony required. - π‘ Safe by default β destructive shell commands are flagged in red and require explicit
Yconfirmation. - πΎ Remembers your project β per-project session history means reopening
kobin the same repo picks up where you left off. - π Bilingual β status banners, help text, and prompts in English and ΰΉΰΈΰΈ’.
π Quick start
# 1. Install globally from npm
npm i -g kob-cli
# 2. Configure β the program creates a global config file for you
kob config
# API key : kob_xxx:token (paste from https://www.kob-ai.dev)
# Model : deepseek/deepseek-v4-flash (or pick from /models)
# Base URL: https://www.kob-ai.dev (default, just press Enter)
# 3. Launch the REPL
kobThat's it. No git clone, no bun install, no manual config file editing.
Inside the REPL, type a plain request β the agent does the rest.
β― add a healthcheck endpoint to src/server.ts and write a testPress Tab to switch between Ask, Plan, and Code modes. Press R to retry if the network blips. Type ? to see all key bindings.
π¦ Installation
Recommended: from npm
npm i -g kob-cli
kob --version # smoke test β e.g. 2.0.3Works on macOS, Linux, and Windows. The kob binary is added to your PATH automatically.
From source (for contributors)
git clone https://github.com/thekaroe-thailand/kobcli.git
cd kobcli
bun install
bun run dev # live REPL against the sourceIf you want the local checkout to be the global
kob:bun link # exposes this checkout as `kob` on your PATH kob --version # should match package.json
bun linkcreates a symlink in your global bin pointing at this checkout, so any edit here is immediately reflected when you runkob.
Sanity check (the same checks the CI runs):
bun run typecheck # tsc --noEmit, no compile
bun run src/index.ts --version # should print the version from package.json
bun run src/index.ts ask "hi" # should hit the API and return textIf any of those three error out, the checkout is broken β open an issue.
Update
You can easily upgrade KOB CLI to the latest version directly using:
kob upgradeThe built-in upgrader shows a live progress bar and suppresses routine npm warning noise such as funding notices and cleanup warnings. If npm returns a real error, KOB still prints it.
Or manually via npm:
npm update -g kob-cliUninstall
npm uninstall -g kob-cli
rm -rf ~/.kob-cli # wipes persisted sessionsβοΈ Configuration
You do not need to edit config by hand. Run kob config (or /config from inside the REPL) and the program creates a single global file for you at ~/.kob-cli/config.env, pre-filled with the values you entered.
kob config
β KOB CLI configuration
β
β API key (kob_xxx:token) β leave blank to keep current
β kob_xxxxxxxxxxxxxxxxxxxxxxxx
β
β Default model id
β deepseek/deepseek-v4-flash
β
β API base URL
β https://www.kob-ai.dev
β
β β Configuration savedThe form writes one global config file shared across projects. It looks like this:
KOB_API_BASE_URL=https://www.kob-ai.dev
KOB_API_KEY=kob_your_api_key_here
KOB_MODEL_ID=deepseek/deepseek-v4-flash
KOB_MAX_TOKENS=16384
KOB_AUTO_APPROVE_READONLY=trueConfig keys
| Key | Required | Default | Description |
|---|---|---|---|
KOB_API_KEY |
β | β | Format: kob_xxx or kob_xxx:token |
KOB_API_BASE_URL |
β | https://www.kob-ai.dev |
OpenAI-compatible endpoint |
KOB_MODEL_ID |
β | deepseek/deepseek-v4-flash |
provider/model form |
KOB_MAX_TOKENS |
β | 16384 |
Output cap per response |
KOB_AUTO_APPROVE_READONLY |
β | true |
Skip confirm on read-only shell commands |
Switching config later
The same form is available at any time β inside the REPL just type /config:
β― /configEdit one field, press Enter, the file is rewritten and the REPL reloads. Your session and history are preserved.
π§βπ» Usage
CLI commands
kob # launch interactive REPL (default)
kob chat # same as above, explicit
kob ask "β¦" # one-shot question, no REPL
kob ask "β¦" -m gpt-4o # override model for one request
kob models # list available models from backend
kob config # edit global KOB settings
kob --version # show version
kob --help # full CLI helpModes
Press Tab to cycle, or 1/2/3 to jump:
| Key | Mode | Color | Purpose |
|---|---|---|---|
1 |
Ask | π©΅ blue | Read-only Q&A about your code |
2 |
Plan | π©· pink | Design a solution, no file changes |
3 |
Code | π’ green | Build / edit autonomously β the only mode that mutates your project |
The mode colours the system prompt, the rail around the conversation, and the prompt icon. Code is the default.
Slash commands
Type / to open the autocomplete menu, or type the command directly:
| Command | What it does |
|---|---|
/ask |
Switch to Ask mode |
/plan |
Switch to Plan mode |
/code |
Switch to Code mode |
/models |
Pick a model from the live backend catalog |
/config |
Edit global KOB settings |
/git |
Branch + dirty file count + first 30 lines of git status |
/diff |
Show the file changes from the last turn |
/undo |
Revert every file mutation from the last turn |
/init |
Scaffold an AGENTS.md (file tree + commands) |
/tokens |
Show session input/output token totals |
/find <text> |
Search text across the project, scoped to the current directory |
/replace <a> <b> |
Replace <a> with <b> in one or all files |
/open |
Open a file and read it with line numbers |
/project:create |
Create a new project bookmark (prompts for name and path) |
/project:list |
List saved projects and switch to one (changes cwd) |
/project:delete |
Remove a project bookmark from the list |
/clear |
Clear the in-memory session |
/reset |
Clear + reload model from config |
/help |
Show all slash commands |
/exit |
Quit (/quit works too) |
Direct shell commands
Any input starting with $ or > is run as a shell command in your project root:
β― $ npm test
β $ npm test
> my-project@1.0.0 test
> jest
PASS src/sum.test.ts
exit 0 Β· 4.1sRead-only commands (ls, cat, git status, β¦) run with auto-approval when KOB_AUTO_APPROVE_READONLY=true. Mutating ones ask once. Dangerous ones (rm -rf, git reset --hard, curl β¦ | sh, β¦) are flagged in red and always require explicit Y.
Special keys
| Key | Action |
|---|---|
Tab |
Cycle mode (Ask β Plan β Code) |
1/2/3 |
Jump to mode |
β / β |
Walk through your last 100 prompts |
Esc |
Abort the current generation (during streaming) |
Ctrl+C |
Quit |
Ctrl+V |
Paste an image (vision-capable models only) |
y |
Copy the last assistant response to your clipboard |
R |
When shown "Press R to retry" β re-send the last request |
π§ How the agent works
The runtime is a small, explicit pipeline β no hidden orchestration, no opaque plugin system.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β USER INPUT β
β "add a healthcheck endpoint to src/server.ts" β
ββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ENGINE (src/core/engine.ts) β
β β’ load session history (scoped to cwd) β
β β’ inject file tree into the system prompt β
β β’ send to KOB AI /api/v2/chat/completions (streaming) β
ββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PARSER (src/tools/parser.ts) β
β β’ extract ```ts:path fenced blocks β write_file β
β β’ extract ```bash fenced blocks β run_shell β
β β’ extract tool_call JSON β str_replace / read_fileβ
ββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β EXECUTOR β
β β’ sandbox path: must be inside project root β
β β’ show inline: read Β· str_replace Β· write Β· command output β
β β’ destructive commands β red confirmation banner β
β β’ every mutation pushed to the undo stack β
ββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RENDER (src/ui/render.ts) β
β β’ colored diffs of changed files β
β β’ command output (first 8 lines + exit code + duration) β
β β’ markdown assistant reply with syntax tint β
β β’ "β Done" round close β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββA single user request can produce multiple rounds: the model reads a file, decides to edit, applies a str_replace, runs a test, sees the failure, and fixes it β all inside one turn.
Network resilience
- Up to 5 automatic retries on transient failures (DNS, TCP, TLS, fetch aborted) with exponential backoff + jitter (0.5s β 1s β 2s β 4s, capped at 5s).
- HTTP 4xx/5xx are not retried β they bubble up immediately with the server's message.
- User aborts (
Esc) are not retried β they propagate instantly. - On final failure the REPL prints
Press R to retry, any other key to continue.β one keypress, no retyping.
π Project layout
src/
βββ index.ts CLI entry + non-interactive subcommands
βββ repl.ts interactive REPL loop, command routing, Esc interrupt
βββ core/
β βββ api.ts streaming OpenAI-compatible client + retry logic
β βββ engine.ts agentic multi-round loop
β βββ modes.ts chat / ask / plan / code prompts
β βββ config.ts env loading + validation
β βββ env-file.ts read/write ~/.kob-cli/config.env (comment-preserving)
β βββ history.ts per-project session persistence
β βββ types.ts
βββ tools/
β βββ parser.ts extract file blocks, tool calls, shell commands
β βββ files.ts sandboxed read/write/str_replace + file tree
β βββ shell.ts run commands, read-only & danger classifiers
β βββ git.ts branch / dirty / ahead-behind
β βββ diff.ts LCS line diff + compact hunks
β βββ clipboard.ts
βββ ui/
β βββ banner.ts the KOB header
β βββ gradient.ts dependency-free hex gradient
β βββ markdown.ts Markdown β ANSI with syntax tint
β βββ render.ts status bar, diffs, help, results
β βββ spinner.ts interleaving single-line spinner
β βββ prompts.ts model picker, config form, approvals
β βββ theme.ts palette + helpers
βββ scripts/
βββ release.ts bump + build + publish + push + tagπ Development
bun run dev # bun run src/index.ts β live REPL
bun run typecheck # tsc --noEmit, no compile
bun run build # compile to a single native binary
bun run build:only # bun build src/index.ts --compile --outfile kob-cliReleasing a new version
The release script (src/scripts/release.ts) bumps package.json, runs the typecheck, rebuilds the binary, and commits in one step:
bun run release:patch # 2.0.0 β 2.0.1
bun run release:minor # 2.0.0 β 2.1.0
bun run release:major # 2.0.0 β 3.0.0Style
- TypeScript, strict, ESM modules
- async/await everywhere β no
.thenchains - single responsibility per file under
src/tools/,src/ui/ - prefer editing existing files; only create new ones when there is no good host
- run
bun run typecheckbefore opening a PR
π Backend contract
KOB CLI speaks the OpenAI streaming protocol to KOB_API_BASE_URL. Minimum the backend must support:
| Endpoint | Method | Purpose |
|---|---|---|
/api/v2/chat/completions |
POST | streaming chat (SSE) |
/api/ai/models |
POST | model catalog (primary) |
/api/models |
POST | model catalog (fallback) |
/api/v2/models |
GET | model catalog (fallback) |
Authentication is a Bearer token. The KobApiClient (see src/core/api.ts) tries the catalog endpoints in order, so older backends stay compatible.
πΊ Roadmap
In priority order, not promised:
- Conversation export to Markdown / JSON
- Multi-profile
.envswitching - Plugin hooks (pre/post tool execution)
- Background "watch this file" agents
- In-terminal Markdown preview pane
- Built-in token cost estimator
Out of scope, intentionally: editor plugin, GUI client, global cross-project memory store.
π Troubleshooting
Connection failed. Please check your network and try again.
The backend was unreachable for 5 retries. Check KOB_API_BASE_URL, your network, or just press R to retry.
This model does not support the requested operation.
You tried to paste an image into a text-only model, or called a vision tool on a model that has no vl in its id. Run /models to switch.
No API key configured. Exiting.
Run kob config and paste your kob_xxx:token key.
β Permission denied on shell commands
Mutating shell commands require an explicit Y at the prompt. Destructive ones are flagged in red β type Y only if you mean it.
π€ Contributing
Issues and PRs are welcome. Please read the design log under docs/ first β most architectural questions are answered there. The codebase is small enough that you can read it in an afternoon.
π License
MIT Β· Β© Kob AI Β· www.kob-ai.dev
ΰΈΰΉΰΈ²ΰΈΰΈΰΈ ΰΈΰΈ²ΰΈΰΈΰΈ β ΰΈΰΈ΅ΰΉ GitHub ΰΉΰΈ«ΰΉΰΈΰΉΰΈ§ΰΈ’ΰΈΰΈ°ΰΈΰΈ£ΰΈ±ΰΈ πΉπ
If you like it, drop a β on GitHub.