ucode-agent 1.65.0 → 1.67.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/LICENSE +662 -21
  2. package/LICENSE-DOCS +404 -0
  3. package/NOTICE +47 -0
  4. package/README.md +19 -622
  5. package/package.json +21 -7
  6. package/skills/LICENSE +19 -0
  7. package/src/core/attach.js +1 -0
  8. package/src/core/commands.js +1 -0
  9. package/src/core/context.js +1 -0
  10. package/src/core/csscheck.js +1 -0
  11. package/src/core/doctor.js +1 -0
  12. package/src/core/failure.js +1 -0
  13. package/src/core/genericcheck.js +1 -0
  14. package/src/core/git.js +1 -0
  15. package/src/core/headless.js +1 -0
  16. package/src/core/history.js +1 -0
  17. package/src/core/htmlcheck.js +1 -0
  18. package/src/core/jslogic.js +1 -0
  19. package/src/core/lessons.js +1 -0
  20. package/src/core/livelog.js +1 -0
  21. package/src/core/login.js +1 -0
  22. package/src/core/loop.js +4064 -4043
  23. package/src/core/mcp.js +1 -0
  24. package/src/core/mcpcli.js +1 -0
  25. package/src/core/openable.js +1 -0
  26. package/src/core/opener.js +1 -0
  27. package/src/core/provider.js +1 -0
  28. package/src/core/relink.js +1 -0
  29. package/src/core/scope.js +1 -0
  30. package/src/core/settings.js +1 -0
  31. package/src/core/skills.js +1 -0
  32. package/src/core/snapshot.js +1 -0
  33. package/src/core/stuck.js +1 -0
  34. package/src/core/terminal.js +29 -4
  35. package/src/core/tests.js +1 -0
  36. package/src/core/undo.js +1 -0
  37. package/src/core/updater.js +1 -0
  38. package/src/core/version.js +1 -0
  39. package/src/core/voice.js +1 -0
  40. package/src/core/window.js +1 -0
  41. package/src/tools/blocks.js +1 -0
  42. package/src/tools/browser.js +1 -0
  43. package/src/tools/cache.js +1 -0
  44. package/src/tools/deploy.js +1 -0
  45. package/src/tools/files.js +1 -0
  46. package/src/tools/fuzzy.js +1 -0
  47. package/src/tools/index.js +1 -0
  48. package/src/tools/rename.js +1 -0
  49. package/src/tools/scaffold.js +1 -0
  50. package/src/tools/search.js +1 -0
  51. package/src/tools/shared.js +2 -1
  52. package/src/tools/shell.js +1 -0
  53. package/src/tools/symbols.js +1 -0
  54. package/src/tools/types.js +1 -0
  55. package/src/tools/web.js +1 -0
  56. package/src/ui/activity.js +1 -0
  57. package/src/ui/markdown.js +1 -0
  58. package/src/ui/plain.js +4 -3
  59. package/src/ui/screen.js +2012 -1833
  60. package/src/ui/theme.js +20 -9
  61. package/templates/LICENSE +23 -0
  62. package/ucode.js +1 -0
  63. package/LICENSE-APACHE +0 -202
package/README.md CHANGED
@@ -1,631 +1,28 @@
1
- # ucode
2
-
3
- A coding agent that lives in your terminal. It reads your code, edits it, runs
4
- your commands, and keeps every conversation on disk. It runs on Google's
5
- Gemini models, free with a key.
6
-
7
- ## At a glance
8
-
9
- | | |
10
- | --- | --- |
11
- | **Builds** | a whole app in about a minute, from a starter that already works, opened for you when it does |
12
- | **Thinks** | a thinking level per step — cheap on easy steps, more on the plan, most when a fix has failed |
13
- | **Designs** | its own tone, typefaces and accent for every app, and a check that sends the generated look back |
14
- | **Checks** | types, syntax, related tests, the running server's errors, and the page itself — opened and clicked |
15
- | **Fixes** | sends problems back to the model, tries a different approach when a fix fails, learns the common ones |
16
- | **Edits real code** | finds the code first, smallest change in the code's own style; renames by code shape |
17
- | **Undoes** | `/undo [n]` puts the whole project back, including what commands changed |
18
- | **Git** | `/diff`, `/commit` with a written message, `/review` for bugs |
19
- | **Extends** | MCP servers, hooks, skills, your own slash commands |
20
- | **Restyles** | itself and your terminal, when you ask: "make ucode orange and my terminal navy" |
21
- | **Automates** | `ucode -p "task" --json` for scripts and CI; `npm run eval` runs ten real jobs |
22
- | **Stays free** | Gemini's free tier, paced to its per-minute limit — or Ollama, offline |
23
-
24
- It opens on a quiet screen — the name, the place to type, and the version in the
25
- corner:
26
-
27
- ```
28
- ██╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗
29
- ██║ ██║██╔════╝██╔═══██╗██╔══██╗██╔════╝
30
- ██║ ██║██║ ██║ ██║██║ ██║█████╗
31
- ██║ ██║██║ ██║ ██║██║ ██║██╔══╝
32
- ╚██████╔╝╚██████╗╚██████╔╝██████╔╝███████╗
33
- ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝
34
-
35
-
36
- ╭──────────────────────────────────────────────────────────────────────────────╮
37
- │ › Ask anything… │
38
- │ │
39
- │ BUILD Gemini 3.5 Flash-Lite 0% │
40
- ╰──────────────────────────────────────────────────────────────────────────────╯
41
-
42
- try build me a landing page for a coffee shop
43
- explain what this project does and how it fits together
44
- add a dark mode toggle that remembers the choice
45
-
46
-
47
- v1.65.0
48
- ```
49
-
50
- A light crosses the wordmark once as it opens, and the three lines under the box
51
- are there so an empty screen has something to say. Once you are talking, each
52
- message you send is marked down its left edge in the same blue as the input, so
53
- your own words are easy to find in a long session — and each step the agent
54
- takes carries the shape of the work: a hollow diamond to look, a filled one to
55
- change, an arrow to run.
56
-
57
- ```
58
- ▌ build a notes dashboard
59
-
60
- ◇ Read 3 files
61
- ◆ Writing index.html +148 -0
62
- ▸ Running npm run dev
63
-
64
- The dashboard is at http://localhost:3000, and `npm run dev` brings it back up.
65
-
66
- ╭──────────────────────────────────────────────────────────────────────────────────╮
67
- │ › now add a dark mode toggle │
68
- │ │
69
- │ BUILD Gemini 3.5 Flash-Lite 4% │
70
- ╰──────────────────────────────────────────────────────────────────────────────────╯
71
- ```
72
-
73
- The status sits inside the input box because it describes the thing you are
74
- typing into. Three facts, no more: the live mode, the answering model, and how
75
- full the context window is. The percentage turns amber at 75%, which is where
76
- older turns start being folded into a summary. While a turn is running the
77
- middle of that row carries the spinner and the way out of it, and hands the
78
- space straight back when it finishes.
79
-
80
- ## Install
81
-
82
- ```bash
83
- npm i -g ucode-agent
84
- ```
85
-
86
- Then save your Google key (free at [aistudio.google.com/apikey](https://aistudio.google.com/apikey)):
87
-
88
- ```bash
89
- ucode login YOUR_KEY
90
- ```
91
-
92
- It is written to `~/.ucode/.env` as `GEMINI_API_KEY`. A `.env` in
93
- the project you are working on wins over that one, and a real environment
94
- variable wins over both.
95
-
96
- Then, in any project:
97
-
98
- ```bash
99
- ucode
100
- ```
101
-
102
- Needs Node 22 or newer.
103
-
104
- ## The models
105
-
106
- Served by Google (aistudio.google.com), free with a key.
107
-
108
- | Model | For |
109
- | --- | --- |
110
- | **Gemini 3.5 Flash-Lite** ★ | the default — fast, reliable with tools, 500 free requests a day |
111
- | Gemini 3.5 Flash | smarter, but only about 20 free requests a day |
112
- | Gemini 3.1 Flash-Lite | older and lighter, 500 free requests a day |
113
-
114
- `/model` shows them and switches. `ucode -m gemini-3.5-flash` starts on one.
115
-
116
- When Google is overloaded and Flash-Lite stops answering, ucode carries on with
117
- 3.5 Flash by itself and goes back to Flash-Lite a few minutes later.
118
-
119
- ## What it does
120
-
121
- **Twenty-one tools, and any MCP server you add.** `create_app`, `read_file`, `read_files`, `write_file`,
122
- `batch_write`, `edit_file`, `multi_edit`, `edit_files`, `rename_symbol`,
123
- `find_symbol`, `outline`, `type_of`, `add_block`, `list_dir`, `glob`, `grep`,
124
- `run_command`, `run_commands`, `look_at_app`, `web_search`, `deploy`. Read-only
125
- calls run in parallel, and start the moment the model finishes writing them —
126
- while the rest of its reply is still arriving. Anything that writes runs on its
127
- own, in order.
128
-
129
- **It asks rather than guesses.** `type_of` opens a language service on the
130
- TypeScript the project itself has installed and gives back the exact signature,
131
- the JSDoc, and where a thing is defined — inferred types included. `find_symbol`
132
- answers "where is this declared", which is the question `grep` is usually being
133
- asked badly. `rename_symbol` renames by code shape, knowing where strings and
134
- comments begin, because a find-and-replace that matched too much is the most
135
- common broken edit.
136
-
137
- **It checks itself as it goes.** After a change: an incremental type check that
138
- answers in about a second rather than a cold minute, then the tests that reach
139
- the files just changed, then anything the running dev server has complained
140
- about since the last look. All three come back the way an error does, so the
141
- model fixes them without being told.
142
-
143
- **New apps are ready in seconds.** A starter installed once is kept and
144
- hard-linked into the next app — the same files under another name, so it costs
145
- no extra disk and skips the wait entirely.
146
-
147
- **Apps start from a ready-made starter — and finish in the same call.**
148
- `create_app` copies a starter that is already known to build, and takes the
149
- app's files with it, so a one-page app is a single round trip: the starter
150
- lands, the model's files are written over it, and the starter's own files come
151
- back inside the result so there is nothing to read afterwards.
152
-
153
- The default starter is `plain-html`: one page, one stylesheet, one module,
154
- nothing to install and nothing to build. A tasks app, a game, a calculator or a
155
- visualisation is finished before a framework would have finished installing.
156
- `next-shadcn` is there for routes, a database or many screens — Next.js 16,
157
- TypeScript, Tailwind 4, shadcn/ui with 25 components, light/dark, toasts and a
158
- considered theme. Setting that up by hand is about four minutes
159
- (`create-next-app` and the shadcn CLI measured at 116s and 130s) plus a dozen
160
- round trips; the copy takes under a second, and its install runs in the
161
- background while the model writes the first components.
162
-
163
- **Built to be fast, and measured.** A traced build of a small Next.js app went
164
- from 17 minutes and 116 model steps to about 6 minutes and 25 steps, by fixing
165
- where the time actually went:
166
-
167
- - Edits return the file as it now stands, so the model does not re-read it.
168
- - Files written more than a few steps ago stop being re-sent in full; the
169
- conversation stays small, so every step answers faster.
170
- - A file-write whose JSON is malformed — a missing comma, an unescaped quote in
171
- the code, raw line breaks — is repaired instead of thrown away with all its
172
- output.
173
- - An edit whose `old_string` is slightly off — a middle line remembered wrong,
174
- escapes written out, a blank line at either end, a different indent — still
175
- lands, through the fallback matchers from opencode's edit tool. Found in two
176
- places is still refused, and so is a match far bigger than what was asked
177
- for. `replace_all` does a rename in one call.
178
- - A missing file comes back with the lookalikes beside it ("did you mean
179
- App.jsx?"), and a tool named with the wrong case runs as the tool it means,
180
- instead of each costing a round trip to learn a spelling.
181
- - Every write is parsed on the spot, so a syntax error comes back in the same
182
- step rather than a minute later from a failed build.
183
- - A failed build that is missing a component or package says exactly which
184
- command fixes it.
185
- - The starter is the shadcn models already know (Radix), so the code they write
186
- compiles the first time.
187
- - A new app goes out without the tools it has nothing to point at — no symbol
188
- lookup, no rename, no type query in an empty folder — and an instruction pack
189
- that loads itself sends its short form, with the full one a `load_skill`
190
- away. Both are re-read by the provider on every step, so what is not in the
191
- request is time off every one of them.
192
- - Ready-made blocks for a page with no build step as well as for React: a list you
193
- can add to, tick off, rename and remove, a filter row, a localStorage store, a
194
- dialog, toasts, a theme toggle. Typing is the slowest part of a build, and each
195
- block is a hundred lines nobody has to type.
196
- - A nested argument written the wrong way — a JSON string, a { path: contents } map
197
- — is read rather than refused. Each refusal was a round trip spent being told
198
- something that could simply be parsed.
199
- - A tool that was not offered is refused rather than quietly run, so withholding one
200
- from a new project, or from plan mode, means what it says.
201
- - The closing message is cut to eight lines. A build that ends with the request
202
- read back and every feature ticked off is a status report nobody asked for,
203
- and it is the last thing left on screen.
204
-
205
- `UCODE_TRACE=1` writes every model call and tool, with its duration, to
206
- `~/.ucode/trace.jsonl`.
207
-
208
- Measured on "build me a simple todo app" — same prompt, same model, two traced
209
- runs: **27 model calls, 8 failed tool calls, no finished app** before this round of
210
- work; **14 model calls, no failures, a working app in under two minutes** after it.
211
-
212
- **Deploy in one line.** Say "deploy it", or type `/deploy [folder]`, and the app
213
- goes live on Vercel. ucode picks a short project name that fits the app and is
214
- free (`food-iq`, else `food-iq-app`…), copies the app's `.env` keys to Vercel as
215
- encrypted variables, refuses code with a secret written into it (and says how to
216
- move it to a server route), and gives you the link. Deploying again updates the
217
- same link. Needs a token from vercel.com/account/tokens in `~/.ucode/.env` as
218
- `VERCEL_TOKEN=...`.
219
-
220
- **A look for every app.** `create_app` takes a design preset — ocean, grove,
221
- sunset, graphite, violet or citrus — each a full light and dark palette with its
222
- own font, so apps stop looking like the same default blue.
223
-
224
- **Every turn can be taken back.** `/undo` puts back every file the last turn
225
- changed — a rewritten file returns byte for byte, a file that did not exist
226
- before is removed again. Each write keeps the original the first time that turn
227
- touches it, so what comes back is the state before the turn rather than before
228
- the last of six edits to the same file. An agent that writes to your disk on
229
- its own should be able to take it back, whether or not the project has git.
230
-
231
- **It notices when it is going round in circles.** The same failing edit, an edit
232
- that changes nothing, or a build failing on the same errors three times gets a
233
- firm, specific note; if that does not work, the turn moves to another model.
234
-
235
- **It never dies at the daily limit.** When the free daily limit runs out mid-build,
236
- ucode counts down to the reset and carries on by itself.
237
-
238
- **You can see it working.** The status row shows the current step with a light
239
- sweeping across it, the step count and the time, and each answer ends with
240
- `✓ Done in 6m 12s · 25 steps`. When a dev server comes up, the app opens in your
241
- browser (`UCODE_OPEN=0` turns that off).
242
-
243
- **`/stats` and `ucode doctor`.** `/stats` shows the session's time, steps, tokens,
244
- files and builds. `ucode doctor` (or `/doctor`) checks Node, npm, git, the API
245
- key and today's free requests left, the browser, the Vercel token and the
246
- version, with the fix for anything wrong.
247
-
248
- **Parallel workers.** When a build splits into parts that touch different files
249
- — the API route, the upload component, the results view — the model hands them
250
- to up to three workers that build at the same time, each line in the transcript
251
- tagged with the worker's name. File writes take turns so two never collide.
252
-
253
- **Installs that start early.** The moment a `package.json` with dependencies is
254
- written, its install starts in the background while the rest of the app is
255
- still being written. An install the model asks for later waits for that one
256
- instead of running twice, and anything run in that folder waits for it too.
257
-
258
- **It opens what it built and uses it.** Every app build ends with a look — not
259
- when the model remembers to ask for one, but as part of the same pass that
260
- type-checks. It opens the app in a real browser (the Edge or Chrome already on
261
- your machine, so there is nothing extra to download) at 375px and 1440px, and
262
- serves the folder itself when there is no dev server to point at, which is how
263
- a three-file app gets checked at all.
264
-
265
- Then it uses the app. It types into the first field, presses Enter, and clicks
266
- the button that submits — and if the page gains no elements, changes no text
267
- and stores nothing, that is reported as the thing to fix before anything else.
268
- A page that renders and has no working behaviour passes a type check, a syntax
269
- check and a screenshot; the only way to find out is to press something.
270
-
271
- It also reports console errors, failed requests, content that spills off a
272
- phone screen, broken images and unlabeled controls, saves screenshots to
273
- `.ucode/screenshots`, and has Gemini review them the way a designer
274
- would. The model fixes what it finds before calling the app done. Both widths load at once, and the designer review — the slow part — runs
275
- on the first look at an app in each request and is skipped, not waited on, when
276
- the vision model is busy. The look after the fixes re-runs only the fast checks:
277
- a few seconds.
278
-
279
- **Errors fixed before you see them.** When the model says it is done, ucode
280
- type-checks every file it changed — `tsc --noEmit` for TypeScript projects,
281
- a syntax check for JavaScript and Python — and hands any errors back to fix,
282
- up to three rounds.
283
-
284
- **A plan you can see.** For longer jobs the model keeps a short checklist, with
285
- a bar across the top for how far along it is and one row per step, so the one in
286
- progress is findable without reading the rest:
287
-
288
- ```
289
- ━━━━────── 2/5
290
- ✓ Scaffold
291
- ✓ Upload
292
- ▸ Score dial
293
- ○ Findings
294
- ○ Polish
295
- ```
296
-
297
- **It knows the project before it asks.** Each turn starts with a map of every
298
- file and the names each code file exports, so the model goes straight to the
299
- right file instead of searching for it.
300
-
301
- **Project memory.** `UCODE.md` in a project — and `~/.ucode/UCODE.md` for how you
302
- like to work everywhere — is read at the start of every turn. `/remember <note>`
303
- adds a line to it.
304
-
305
- **Edits that never guess.** `edit_file` matches exactly once or it fails, and
306
- when it fails it says *why*. It tolerates what does not matter — tabs against
307
- spaces, a different indent depth, Windows line endings — and re-indents the
308
- replacement to fit the file, but a match found twice is still refused.
309
- `edit_files` changes several files in one call, and writes none of them if any
310
- edit fails.
311
-
312
- **Diffs with real line numbers.** Removed lines are numbered where they were,
313
- added lines where they now are. Numbers you can jump to, not decoration.
1
+ <div align="center">
314
2
 
315
- **Live commentary.** `● Listing src`, `● Running npm test` — what it is doing,
316
- as it does it, named after the file or command rather than the tool.
317
-
318
- **Two modes.** Build edits and runs. Plan reads and researches with the writing
319
- tools withheld, which is stronger than asking a model nicely. `ctrl+b` swaps
320
- them; the chip inside the input box says which is live.
321
-
322
- **Sessions.** Everything is on disk under `~/.ucode/sessions`, saved after every
323
- step. `/resume` lists them with what each one was actually about, the ones from
324
- this folder first. Press `d` twice on one to delete it — the list stays open, so
325
- clearing out several is quick — or `/session delete 2,5`.
326
-
327
- **It updates itself.** Each launch checks npm in the background and, if there is
328
- a newer version, installs it while you work. The next launch is the new one.
329
- Set `UCODE_NO_UPDATE=1` to turn that off.
330
-
331
- **A context window that folds rather than forgets.** Past 75% the oldest turns
332
- are summarised instead of dropped, never cutting between a tool call and its
333
- result. The full history stays on disk regardless.
334
-
335
- **Screenshots.** Mention a `.png` in your message and it gets attached.
336
-
337
- ## Skills
338
-
339
- A skill is a folder with a `SKILL.md`: frontmatter, then instructions. Only the
340
- names and one-line descriptions go into the system prompt — a body is pulled in
341
- when it is wanted, so the prompt stays the same size however many you add.
342
-
343
- | Skill | For |
344
- | --- | --- |
345
- | `ui-ux` | interfaces: direction, tokens, layout, states, motion, accessibility |
346
- | `build-app` | going from nothing to something running, and proving it runs |
347
- | `debug` | finding the real cause instead of the first plausible one |
348
- | `code-review` | reviewing a change the way a careful colleague would |
349
- | `write-tests` | tests that fail for the right reason |
350
- | `ai-features` | model-backed features: prompts with rules, validated JSON, images, failure handling |
351
- | `security` | secrets, auth, ownership checks, injection, XSS, CSRF, SSRF, uploads |
352
- | `performance` | measure first, find the real bottleneck, prove the win with numbers |
353
- | `refactor` | change the shape of code without changing what it does |
354
-
355
- **Every skill loads itself** when the request calls for it — an app pulls in
356
- `ui-ux` and `build-app`, "it crashes" pulls in `debug`, an AI feature pulls in
357
- `ai-features`, an API key pulls in `security` — so the whole skill is in
358
- context before the model takes its first step. Waiting for the model to decide it needs design guidance means
359
- finding out it did not after the app is built.
360
-
361
- Add your own in `.ucode/skills/<name>/SKILL.md` inside a project. A project
362
- skill shadows a built-in of the same name. Give it an `auto:` line and it loads
363
- itself too:
364
-
365
- ```markdown
366
- ---
367
- name: house-style
368
- description: How we write services here.
369
- auto: endpoint, handler, migration
370
- ---
371
-
372
- Everything after the frontmatter is the instruction.
373
- ```
374
-
375
- ## Commands
376
-
377
- | | |
378
- | --- | --- |
379
- | `/help` | the list |
380
- | `/model` | show the models and switch — `/models` does the same |
381
- | `/resume` | pick up an earlier conversation — `/session`, `/sessions` too |
382
- | `/session delete 2,5` | delete saved conversations by number (or `d d` in the list) |
383
- | `/new` | save this one and start fresh |
384
- | `/remember <note>` | add a standing note to this project's `UCODE.md` |
385
- | `/undo [n]` | put the project back as it was before the last turn — or `n` turns — including what commands changed |
386
- | `/diff` | what has changed this session |
387
- | `/commit [msg]` | commit the changes, with a message written from the diff if you give none |
388
- | `/review` | read the uncommitted changes for bugs, changing nothing |
389
- | `/init` | read the project and write its `UCODE.md` |
390
- | `/mcp` | connected MCP servers and their tools |
391
- | `/permissions [ask\|auto]` | ask before every command, or run them; what is always allowed |
392
- | `/theme [what]` | change how ucode or your terminal looks — or just ask in words |
393
- | `/look [url]` | open the running app and report what is on the page |
394
- | `/deploy [folder]` | put the app online and get its link |
395
- | `/mic` | say what you want instead of typing it — same as `ctrl+t` |
396
- | `/stats` | time, steps and tokens this session |
397
- | `/doctor` | check that everything ucode needs is working |
398
- | `/skills` | what it knows how to do, and what is loaded |
399
- | `/search <query>` | look something up on the web |
400
- | `/copy` | last reply to the clipboard |
401
- | `/clear` | clear the screen, keep the conversation |
402
- | `/exit` | save and quit |
403
-
404
- `ctrl+b` plan/build · click `+ file` (or `ctrl+o`) to add a picture or file · `esc` stops a running turn · `ctrl+d` quits ·
405
- `↑ ↓` scroll the conversation, or walk history once you are typing ·
406
- `tab` completes a command
407
-
408
- ### Speak instead of typing
409
-
410
- Press `ctrl+t` (or click `mic`, or type `/mic`) and say what you want —
411
- "make me a quiz app about planets". The chip turns red while it listens.
412
- `enter` stops and sends it; `ctrl+t` stops and puts the words in the box to
413
- check first; `esc` throws it away. It stops by itself after two minutes.
414
-
415
- Gemini writes down what you said, so nothing extra is needed beyond your key.
416
- Recording uses what the computer already has: Windows' built-in recorder, `sox`
417
- or `ffmpeg` on macOS (`brew install sox`), `arecord` or `sox` on Linux. If a
418
- quiet mic is taken for silence, set `UCODE_MIC_QUIET` lower than 800.
419
-
420
- ### Change how it looks — and your terminal
421
-
422
- Just ask: "make ucode orange with the arc spinner", "put my name under the
423
- logo", "make my terminal navy with a bigger font", "make the terminal a bit
424
- see-through". Or use `/theme`:
425
-
426
- ```
427
- /theme what it looks like now, and the choices
428
- /theme orange a new colour at once (a name, #ff8c2b, or rgb(...))
429
- /theme reset ucode's own blue again
430
- /theme terminal reset the terminal back the way it was
431
- ```
432
-
433
- ucode's look is saved in `~/.ucode/theme.json` — accent, spinner (`dots`,
434
- `line`, `arc`, `circle`, `square`, `bounce`, `pulse`, `star`) and the line
435
- under the logo — so it survives restarts and updates.
436
-
437
- The terminal is changed the way each one allows, after you say yes:
438
-
439
- | Terminal | What changes | How long |
440
- | --- | --- | --- |
441
- | Windows Terminal | background, text, cursor, font, size, opacity | kept, every tab (the old settings are backed up) |
442
- | Terminal.app (macOS) | background, text, cursor, font, size | this window |
443
- | iTerm2 (macOS) | background, text, cursor | this session |
444
- | Linux, VS Code and others | background, text, cursor | this session |
445
-
446
- ### Your own commands
447
-
448
- A file `.ucode/commands/explain.md` (or `~/.ucode/commands/` for every
449
- project) becomes `/explain`. Its text is the prompt; `$ARGUMENTS` is replaced
450
- by whatever you type after the command.
451
-
452
- ### MCP servers
453
-
454
- Connect tools from any MCP server — library docs, GitHub, a database:
455
-
456
- ```
457
- ucode mcp add context7 npx -y @upstash/context7-mcp
458
- ucode mcp add github --url https://api.githubcopilot.com/mcp/ --header "Authorization=Bearer ${GITHUB_TOKEN}"
459
- ucode mcp list
460
- ucode mcp remove github
461
- ```
462
-
463
- They are saved in `~/.ucode/mcp.json` (`--project` puts them in this folder's
464
- `.ucode/mcp.json`). ucode asks before each MCP tool runs; answer `a` to always
465
- allow that tool. A project's own servers and hooks only run once you approve them.
466
-
467
- ### Permissions and hooks
468
-
469
- `.ucode/settings.json` (or `~/.ucode/settings.json`):
470
-
471
- ```json
472
- {
473
- "commands": "ask",
474
- "allow": ["npm test", "git status"],
475
- "hooks": {
476
- "afterEdit": ["npx prettier --write {files}"],
477
- "beforeCommand": ["node guard.js"]
478
- }
479
- }
480
- ```
481
-
482
- `"commands": "ask"` puts every command to you first (`/permissions ask`);
483
- answering `a` adds it to `allow`. A `beforeCommand` hook that exits non-zero
484
- stops the command; it sees it in `UCODE_COMMAND`.
485
-
486
- ### Run it without a keyboard
487
-
488
- ```
489
- ucode -p "fix the failing test" prints the answer
490
- ucode -p "make a quiz app" --json --yes one JSON line: ok, answer, files, steps, requests, time
491
- ```
492
-
493
- Progress goes to stderr. With no `--yes`, anything that would be asked is declined.
494
- `npm run eval` runs ten real jobs this way and checks each one — use it before
495
- a release (it spends about 30 free requests, and takes about seven minutes).
496
-
497
- ### Other models
498
-
499
- Any OpenAI-compatible server works, Ollama on your own computer included —
500
- free and offline:
501
-
502
- ```
503
- UCODE_BASE_URL=http://localhost:11434/v1 UCODE_MODEL=qwen2.5-coder ucode
504
- ```
505
-
506
- ## How it thinks
507
-
508
- - **Thinking levels.** Flash-Lite does not think at all unless asked. ucode
509
- asks for a little on every step (it costs nothing on a straightforward
510
- write), more on the first step of a build, and the most when a fix has
511
- already failed. `UCODE_THINK=0` turns it off.
512
- - **A design direction for every build** — a tone, two typefaces and an accent —
513
- so two apps never come out the same, and a check for the generated look
514
- (the starter's colours, Inter, purple gradients, gradient text, emoji icons)
515
- that sends it back to be fixed. `UCODE_DESIGN_CHECK=0` turns the check off.
516
- - **Learns from its mistakes.** Problems ucode keeps catching are counted in
517
- `~/.ucode/lessons.json`, and the common ones are warned about before the next build.
518
- - **Tries a different approach** when the same problem survives a fix, and
519
- offers to hand that fix to Gemini 3.5 Flash — only if you say yes, since it
520
- has about 20 free requests a day.
521
- - **Changes to existing code** get their own rules: find the code, read only
522
- what is involved, make the smallest change in the code's own style.
523
- - **Stays under the free limit.** Requests are spaced to Google's per-minute
524
- limit instead of being refused and waited out; `/stats` shows how many were sent.
525
-
526
- ## Options
527
-
528
- ```
529
- ucode [options]
530
-
531
- -m, --model <id> which model to use
532
- -C, --cwd <dir> work in another directory
533
- --plan start in plan mode
534
- -p, --print <task> do one task with no keyboard, print the answer, exit
535
- --json with -p: one JSON object about the run
536
- -y, --yes with -p: say yes to anything that would be asked
537
- --debug print stack traces when something breaks
538
- -v, --version print the version
539
- -h, --help the above
540
- ```
541
-
542
- ## Configuration
543
-
544
- | | |
545
- | --- | --- |
546
- | `~/.ucode/.env` | `GEMINI_API_KEY`, and `TAVILY_API_KEY` for web search |
547
- | `~/.ucode/settings.json`, `.ucode/settings.json` | permissions, always-allowed commands, hooks |
548
- | `~/.ucode/mcp.json`, `.ucode/mcp.json` | MCP servers |
549
- | `.ucode/commands/*.md` | your own slash commands |
550
- | `~/.ucode/snapshots/` | the project before each turn, for `/undo` |
551
- | `~/.ucode/lessons.json` | mistakes ucode keeps catching, warned about next time |
552
- | `~/.ucode/sessions/` | one JSON per conversation |
553
- | `.ucode/skills/` | skills belonging to a project |
554
- | `UCODE.md` | project memory, read every turn |
555
- | `~/.ucode/UCODE.md` | your own standing instructions, for every project |
556
-
557
- Environment overrides: `UCODE_MODEL`, `UCODE_WORKER_MODEL` (a faster model for
558
- parallel workers), `UCODE_WORKER_STEPS`, `UCODE_MAX_CONTEXT_TOKENS`,
559
- `UCODE_MAX_STEPS`, `UCODE_MAX_TOOL_OUTPUT`, `UCODE_REQUEST_TIMEOUT_MS`,
560
- `UCODE_STALL_MS` (how long a silent reply is waited on before asking again, 60s),
561
- `UCODE_BASE_URL`, `UCODE_NO_UPDATE`, `UCODE_THINK=0`, `UCODE_DESIGN_CHECK=0`,
562
- `UCODE_RPM` (requests a minute before pacing, 0 = off), `UCODE_RIPGREP=0`.
563
-
564
- Search uses ripgrep (`rg`) when it is installed — much faster on a big
565
- project — and its own search otherwise.
566
-
567
- Web search needs a Tavily key — free, 1000 searches a month, no card. Without
568
- one, ucode answers from what it knows and says that it could not check.
569
-
570
- ## How it is put together
3
+ # ucode
571
4
 
572
- ```
573
- ucode.js the command: arguments in, Agent out
574
- src/core/loop.js the agent loop, the system prompt, the slash commands
575
- src/core/provider.js the only file that knows which provider answers
576
- src/core/history.js sessions on disk
577
- src/core/window.js folding a long conversation to fit
578
- src/core/skills.js loading skills, and deciding which load themselves
579
- src/core/context.js the project map and project memory
580
- src/core/failure.js one error shape: what, why, what next
581
- src/core/scope.js what a request carries: build scope, design direction, edit rules
582
- src/core/genericcheck.js the check for a generated-looking design
583
- src/core/lessons.js mistakes counted across sessions, warned about up front
584
- src/core/snapshot.js the project before every turn, for /undo
585
- src/core/settings.js permissions, always-allow, hooks, project trust
586
- src/core/mcp.js the MCP client: stdio and HTTP servers, no SDK
587
- src/core/headless.js ucode -p: one job, no keyboard
588
- src/tools/ the twenty-one tools, plus their shared plumbing
589
- src/ui/screen.js the full-screen interface
590
- src/ui/plain.js the same interface for when there is no terminal
591
- src/ui/theme.js colour, boxes, and the string maths behind both
592
- ```
5
+ **A free, open-source AI coding agent for your terminal.**<br>
6
+ Builds whole apps in about a minute on Google Gemini's free tier — then opens them and clicks through to check its own work.
593
7
 
594
- Everything above `provider.js` speaks one small provider-neutral message
595
- format. Moving to another host means rewriting that one file.
8
+ [![npm](https://img.shields.io/npm/v/ucode-agent?color=4d8dff&label=npm)](https://www.npmjs.com/package/ucode-agent)
9
+ [![downloads](https://img.shields.io/npm/dm/ucode-agent?color=4d8dff)](https://www.npmjs.com/package/ucode-agent)
10
+ [![tests](https://github.com/sppideey/ucode-agent/actions/workflows/test.yml/badge.svg)](https://github.com/sppideey/ucode-agent/actions/workflows/test.yml)
11
+ [![license](https://img.shields.io/badge/license-AGPL--3.0-4d8dff)](LICENSE)
12
+ [![node](https://img.shields.io/badge/node-%E2%89%A522-4d8dff)](https://nodejs.org)
13
+ [![stars](https://img.shields.io/github/stars/sppideey/ucode-agent?style=social)](https://github.com/sppideey/ucode-agent/stargazers)
596
14
 
597
- Every failure carries three things — what was attempted, what failed, and what
598
- to do next — so no screen ever has to fall back on a stack trace. Tool failures
599
- are handed to the model as text instead, which is why they read like
600
- instructions.
15
+ <img src="https://raw.githubusercontent.com/sppideey/ucode-agent/main/.github/ucode-hero.png" alt="ucode in a terminal: a tasks app built in 58 seconds, with the command list popped up over the input box" width="900">
601
16
 
602
- ## Development
17
+ </div>
603
18
 
604
19
  ```bash
605
- git clone https://github.com/sppideey/ucode-agent
606
- cd ucode-agent
607
- npm install
608
- npm link # puts `ucode` on PATH, pointing at this checkout
609
- npm test
20
+ npm i -g ucode-agent # Node 22 or newer
21
+ ucode login YOUR_KEY # a free key from aistudio.google.com/apikey
22
+ ucode # in any project folder
610
23
  ```
611
24
 
612
- `npm link` matters while developing: it symlinks the global command to your
613
- working copy, so an edit is live on the next launch. Running
614
- `npm i -g ucode-agent` replaces that with a frozen copy from the registry and
615
- your edits stop taking effect.
616
-
617
- The tests need no network and no framework — `node test/run.js` runs them all.
618
-
619
- ## Licence
620
-
621
- Dual-licensed under either of, at your option:
622
-
623
- - MIT — see [LICENSE](LICENSE)
624
- - Apache License 2.0 — see [LICENSE-APACHE](LICENSE-APACHE)
625
-
626
- Made with ❤️ by om dixit.
627
-
628
- The edit matchers, the summary template, the context-overflow and transient-error
629
- patterns and tool-name repair are adapted from
630
- [opencode](https://opencode.ai) (MIT); see
631
- [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
25
+ A coding agent that lives in your terminal, like Claude Code or Codex CLI — but
26
+ free: it runs on Gemini's free tier, or on Ollama with no internet at all. It
27
+ reads your code, edits it, runs your commands, checks its own work, and keeps
28
+ every conversation on disk. If it helps you, a ⭐ helps other people find it.