Debian Codegraph @

README.md

raw
1 # clnkr
2
3 [![CI](https://github.com/clnkr-ai/clnkr/actions/workflows/ci.yml/badge.svg)](https://github.com/clnkr-ai/clnkr/actions/workflows/ci.yml)
4
5 A coding agent CLI that gives the model bash and little else.
6
7 <img width="1388" height="826" alt="alacritty-2026-05-09-220219" src="https://github.com/user-attachments/assets/74370dc6-d954-4697-8080-fec8f49a9acd" />
8
9 Warning: `clnkr` executes bash directly. There is no permission system and no sandbox. Run it only in environments you are willing to trust and break.
10
11 ## Quick start
12
13 Install with Homebrew:
14
15 ```bash
16 brew install clnkr-ai/tap/clnkr
17 ```
18
19 Or install the Debian package from the latest release:
20
21 ```bash
22 curl -fsSLO https://github.com/clnkr-ai/clnkr/releases/download/v<VERSION>/clnkr_<VERSION>-1_<ARCH>.deb
23 sudo dpkg -i ./clnkr_<VERSION>-1_<ARCH>.deb
24 ```
25
26 Install from source with Go:
27
28 ```bash
29 go install github.com/clnkr-ai/clnkr/cmd/clnkr@latest
30 go install github.com/clnkr-ai/clnkr/cmd/clnkrd@latest
31 ```
32
33 Set a provider and run:
34
35 ```bash
36 export CLNKR_API_KEY=your-api-key
37 export CLNKR_PROVIDER=anthropic
38 export CLNKR_MODEL=claude-sonnet-4-6
39
40 clnkr
41 ```
42
43 At the prompt, ask for a task. `clnkr` proposes bash commands and asks before it runs each batch.
44
45 Run unattended:
46
47 ```bash
48 clnkr -p "find all TODO comments in this project"
49 ```
50
51 Skip approvals:
52
53 ```bash
54 clnkr --full-send
55 ```
56
57 ## Surfaces
58
59 `clnkr` is the interactive terminal REPL. Use it when a human is present to
60 approve commands, answer clarification questions, and steer the session.
61
62 `clnkr -p` is the unattended one-shot surface. Use it from a shell, script, or
63 automation when a task should run to completion and exit. Single-task runs save
64 the normal project session by default, so `clnkr --continue` can resume them.
65
66 `clnkrd` is the stdio JSONL adapter for tools that embed clnkr behavior. A
67 frontend writes JSONL commands to stdin and reads JSONL events from stdout.
68 It is not a daemon framework, service host, or model delegation mechanism.
69
70 ## Usage
71
72 Common workflows:
73
74 - Run interactively with approval before each command batch
75 - Run unattended with `-p`
76 - Resume project sessions with `--continue`
77 - Stream JSONL event logs with `--event-log`
78 - Save and load transcripts with `--trajectory` and `--load-messages`
79
80 One-shot task:
81
82 ```bash
83 clnkr -p "add tests for config loading"
84 ```
85
86 Resume the latest session for the current project:
87
88 ```bash
89 clnkr --continue
90 ```
91
92 Compact older transcript history:
93
94 ```text
95 /compact
96 ```
97
98 Inputs such as `/delegate ...` are ordinary prompt text, not host commands.
99
100 Emit events or reuse transcripts:
101
102 ```bash
103 clnkr -p "fix the build" --event-log /tmp/events.jsonl
104 clnkr -p "investigate the bug" --trajectory /tmp/investigation.json
105 clnkr -p "write a fix based on the investigation" --load-messages /tmp/investigation.json
106 ```
107
108 Embed clnkr through the `clnkrd` JSONL adapter:
109
110 ```bash
111 workdir=$(mktemp -d /tmp/clnkr-processes.$$.XXXXXX)
112 printf '%s\n' '{"type":"prompt","text":"inspect README.md; do not edit","mode":"full_send"}' |
113 clnkrd --event-log "$workdir/events.jsonl" > "$workdir/out.jsonl" 2> "$workdir/err"
114 sed -n '1,200p' "$workdir/out.jsonl"
115 ```
116
117 OpenAI-compatible endpoint:
118
119 ```bash
120 clnkr --provider openai --base-url http://gpu-host:8000/v1 --model my-model
121 clnkr --provider openai --base-url http://localhost:11434/v1 --model llama3
122 clnkr --provider openai --base-url http://proxy:4000/v1 --model gpt-4o
123 ```
124
125 The endpoint must support structured outputs.
126
127 Full CLI reference: [`doc/clnkr.1.md`](doc/clnkr.1.md).
128
129 ## Configuration
130
131 Set `CLNKR_API_KEY`. Everything else can come from flags or environment variables.
132
133 | Variable | Description |
134 |----------|-------------|
135 | `CLNKR_API_KEY` | API key for the LLM provider (required) |
136 | `CLNKR_PROVIDER` | Provider: `anthropic` or `openai` |
137 | `CLNKR_MODEL` | Model name (overridden by `--model`) |
138 | `CLNKR_BASE_URL` | LLM endpoint (overridden by `--base-url`) |
139
140 clnkr builds its system prompt from the built-in prompt plus `AGENTS.md` files in the user home directory, the XDG config directory, and the current working directory.
141
142 Prompt controls:
143
144 ```bash
145 clnkr --dump-system-prompt
146 clnkr --dump-system-prompt -p
147 clnkr --system-prompt-append "Prefer targeted tests first"
148 clnkr --no-system-prompt
149 ```
150
151 ## How it works
152
153 At each step, clnkr:
154
155 1. Send the conversation to the LLM.
156 2. Get back a question, command batch, or final answer.
157 3. Ask the user when the model needs clarification.
158 4. Ask for approval before running commands, unless `--full-send` or `-p` is set.
159 5. Send command results back to the model.
160 6. Print the final answer.
161
162 Architecture discussion: [`doc/clnkr.7.md`](doc/clnkr.7.md). Library/API reference: [`doc/clnkr.3.md`](doc/clnkr.3.md).
163
164 ## Development
165
166 ```bash
167 git clone https://github.com/clnkr-ai/clnkr.git
168 cd clnkr
169
170 make help # Show all targets
171 make build # Build shipped binaries
172 make check # Full quality suite
173 make test # Tests only
174 ```
175
176 ## License
177
178 [Apache-2.0](LICENSE)