Debian Codegraph @

doc/clnkr.1.md

raw
1 % clnkr(1) User Commands
2
3 # NAME
4
5 clnkr - a minimal coding agent (plain CLI)
6
7 # SYNOPSIS
8
9 **clnkr** [**-p**|**--prompt** *task*] [**-m**|**--model** *name*] [**--base-url** *url*] [**--provider** *mode*] [**--provider-api** *surface*] [**--act-protocol** *protocol*] [**--effort** *level*] [**--thinking-budget-tokens** *n*] [**--max-output-tokens** *n*] [**--max-steps** *n*] [**--full-send**] [**-c**|**--continue**] [**-l**|**--list-sessions**] [**-S**|**--no-system-prompt**] [**--system-prompt-append** *text*] [**--dump-system-prompt**] [**--load-messages** *file*] [**--event-log** *file*] [**--trajectory** *file*] [**-v**|**--verbose**] [**-V**|**--version**]
10
11 # DESCRIPTION
12
13 **clnkr** is a minimal coding agent that queries LLMs and executes bash commands using an act protocol. The default protocol is **auto**, which uses provider-native **bash** tool calls when the resolved provider/API supports them and falls back to provider-portable clnkr act JSON otherwise.
14
15 In default mode, **clnkr** starts an interactive REPL. With **-p**, it runs a single unattended task and exits. Single-task runs save the project session by default, so later **clnkr --continue** and **clnkr --list-sessions** can see them.
16
17 At the main idle conversational prompt, **/compact** summarizes older transcript history while keeping recent context intact for the current working thread.
18
19 If a provider rejects a model step because the transcript exceeds the model
20 context window, clnkr automatically compacts older transcript history, reports
21 the compacted message counts on stderr, and retries that failed model step
22 once. The automatic retry uses the same **[compact]** transcript format as
23 **/compact** and is saved in ordinary project sessions.
24
25 **clnkrd** is the stdio JSONL adapter for external tools embedding clnkr
26 behavior. It is not a daemon framework, service host, or model delegation
27 mechanism. Inputs such as **/delegate** *task* are ordinary prompt text; the
28 host does not intercept them.
29
30 **clnkr** has no external dependencies beyond the Go standard library.
31
32 The agent communicates through JSON turns: **act** (execute one or more `bash.commands[]` entries with `command` and nullable `workdir`), **clarify** (ask the user), and **done** (signal completion).
33
34 In **tool-calls** mode, command execution uses provider-native **bash** tool calls. **clarify** and **done** remain text JSON. Explicit **tool-calls** is rejected for OpenAI Chat Completions and OpenAI-compatible endpoints.
35
36 By default, **clnkr** asks for approval before each **act** turn in conversational mode. One approval accepts the whole command batch. Approval prompts show each requested command and any explicit workdir override. Pass **--full-send** to execute commands immediately without approval. Single-task mode (**-p**) implies **--full-send** and uses an unattended turn contract that omits **clarify**.
37
38 For Anthropic runs, **clnkr** requests Anthropic's native structured output format on every turn. Use **--model** with a model Anthropic documents as supporting structured output.
39
40 On OpenAI-compatible backends, the selected model path must support structured outputs. If a backend rejects the resolved OpenAI API surface, **clnkr** returns the provider error. When a proxy or gateway expects a different OpenAI surface, override with **--provider-api** or **CLNKR_PROVIDER_API**.
41
42 **clnkr** rejects `gpt-5.2-pro`, `gpt-5.4-pro`, and their dated snapshots even if you force **openai-chat-completions**, because agent turns require structured outputs.
43
44 Project-specific instructions are loaded from an **AGENTS.md** file in the current working directory, if present.
45
46 # OPTIONS
47
48 **-p**, **--prompt** *task*
49 : Run the given task unattended and exit. Without this flag, clnkr starts in conversational REPL mode. This implies **--full-send** and removes **clarify** from the model turn contract; passing **--full-send=false** with **-p** is rejected.
50
51 **-m**, **--model** *name*
52 : LLM model identifier. Required unless **CLNKR_MODEL** is set.
53
54 **--base-url** *url*
55 : LLM endpoint transport URL. If omitted, clnkr uses the provider default: **https://api.anthropic.com** for **anthropic** or **https://api.openai.com/v1** for **openai**. **CLNKR_BASE_URL** overrides the default when set.
56
57 **--provider** *mode*
58 : Provider adapter semantics: **anthropic** or **openai**. Required unless **CLNKR_PROVIDER** is set.
59
60 **--provider-api** *surface*
61 : OpenAI-only API surface override: **auto**, **openai-chat-completions**, or **openai-responses**. With **provider=openai**, **auto** prefers **openai-responses** for known supported names and other OpenAI-looking model names such as **gpt-***, **o** followed by a digit, **codex**, **codex-***, names ending in **-codex**, and names containing **-codex-**. Names that do not look OpenAI-ish, such as **llama3**, **gemini-2.0-flash**, **orca-***, **olmo-***, **openhermes-***, and **chatgpt-***, stay on **openai-chat-completions**. This flag is rejected for **provider=anthropic**.
62
63 **--act-protocol** *protocol*
64 : Command proposal mode: **auto**, **clnkr-inline**, or **tool-calls**. The default is **auto**, which uses provider-native **bash** tool calls when the resolved provider/API supports them and falls back to **clnkr-inline** otherwise. **clnkr-inline** accepts provider-portable clnkr act JSON in assistant text. **tool-calls** forces provider-native tools and is rejected when unsupported. Most users do not need this flag.
65
66 **--effort** *level*
67 : Provider effort level. Accepted values are **auto**, **low**, **medium**, **high**, **xhigh**, and **max**. Provider/model validation rejects levels that are not supported. For OpenAI Responses, maps to reasoning effort; **gpt-5-pro** accepts only **high**, and **xhigh** is accepted only for known codex-max-or-newer model families. For Anthropic, **low**, **medium**, and **high** send both `output_config.effort` and `thinking.type=adaptive` to the API. **auto** omits both fields. **max** is accepted only where supported and is otherwise rejected.
68
69 **--thinking-budget-tokens** *n*
70 : Anthropic manual thinking budget (legacy/debug flag). Requires **provider=anthropic** and a Claude model that supports extended thinking. Uses `thinking.type=enabled` with `budget_tokens=n`. Cannot be used with non-auto **--effort** or with Opus 4.7+ models. The value must be at least 1024 and less than the effective Anthropic **max_tokens** value.
71
72 **--max-output-tokens** *n*
73 : Provider output-token limit. Supported for Anthropic Messages and OpenAI Responses. For Anthropic it overrides the **max_tokens** request field; the default is 4096 when unset. Anthropic values above 21333 are rejected. OpenAI Chat Completions rejects this flag.
74
75 **--max-steps** *n*
76 : Maximum executed commands before requesting a final summary. 0 uses the default of 100. If an **act** batch exceeds the remaining budget, clnkr executes only the commands that fit and then requests a final summary.
77
78 **--full-send**
79 : Execute every **act** turn immediately. Without this flag, clnkr asks for approval before each command batch in conversational mode. Implied by **-p**.
80
81 **-c**, **--continue**
82 : Resume the most recent session for the current project directory. Saved JSON state messages restore the last persisted working directory. Mutually exclusive with **--trajectory**.
83
84 **-l**, **--list-sessions**
85 : List all saved sessions for the current project directory and exit.
86
87 **-S**, **--no-system-prompt**
88 : Omit the built-in system prompt entirely.
89
90 **--system-prompt-append** *text*
91 : Append *text* to the built-in system prompt after any loaded **AGENTS.md** content.
92
93 **--dump-system-prompt**
94 : Print the composed system prompt and exit. By default this prints the conversational prompt. Use **--dump-system-prompt -p** to print the unattended prompt.
95
96 **--load-messages** *file*
97 : Read a JSON message array from *file* and prepend the messages to the conversation before starting. Host-generated JSON state messages in that transcript restore the current working directory.
98
99 **--event-log** *file*
100 : Write every agent event as a JSONL line to *file*. Each line is a JSON object with **ts**, **type**, and **payload** fields. **ts** is a UTC RFC3339Nano timestamp recorded when clnkr writes the event. Older logs may contain only **type** and **payload**. Opens *file* with `O_APPEND`, so another process can tail the file while clnkr appends.
101
102 **--trajectory** *file*
103 : After the task finishes, write the full message history as a pretty-printed JSON array to *file*. Written before exit, even on error. Only applies to single-task mode (**-p**), not the REPL. Mutually exclusive with **--continue**.
104
105 **-v**, **--verbose**
106 : Show internal decisions (queries, parsing, working directory).
107
108 **-V**, **--version**
109 : Print version and exit.
110
111 # INTERACTIVE COMMANDS
112
113 **/compact**
114 : At the idle conversational prompt, summarize older transcript history while keeping the recent working thread intact.
115
116 This command is only available at the top-level conversational prompt. Trailing text after **/compact** is rejected. In single-task mode, approval replies, and clarification replies, the literal exact command is rejected with an error rather than triggering compaction.
117
118 # ENVIRONMENT
119
120 **CLNKR_API_KEY**
121 : API key for the LLM provider (required).
122
123 **CLNKR_PROVIDER**
124 : Provider adapter semantics.
125
126 **CLNKR_PROVIDER_API**
127 : OpenAI-only API surface override.
128
129 **CLNKR_MODEL**
130 : Default model identifier when **--model** is not provided.
131
132 **CLNKR_BASE_URL**
133 : Default LLM endpoint when **--base-url** is not provided.
134
135 # FILES
136
137 **AGENTS.md**
138 : If present in the current directory, its contents are appended to the system prompt as project-specific instructions.
139
140 # EXIT STATUS
141
142 **0**
143 : Success.
144
145 **1**
146 : Error (no API key, invalid flags, session load failure, failed final step-limit summary, etc.).
147
148 **2**
149 : In single-task mode or non-interactive **--full-send** mode, the run stopped because the agent asked for clarification. The question is printed to stderr.
150
151 # AUTHOR
152
153 Brian Cosgrove <[email protected]>
154
155 # SEE ALSO
156
157 **clnkr**(3), **clnkr**(7)