heartcode 0.1.60 → 0.1.63

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,57 @@
2
2
 
3
3
  What changed in each version of HeartCode, newest first.
4
4
 
5
+ ## 0.1.63 (2026-11-10)
6
+
7
+ - **Time limits set for free models out of the box**: Give up 45 s, Stalled 60 s, Tests wait 60 s
8
+ (never shorter than Give up), so Test all works without changing anything. Values already saved stay.
9
+ - **`heart models --all`** lists only the providers that are switched on.
10
+ - **README**: the setup as I do it, step by step (add every provider's models, Update model info,
11
+ Test all, keep the ones that work, sort by coding, save), with what the time limits do; old
12
+ screenshots taken out for new ones.
13
+
14
+ ## 0.1.62 (2026-11-10)
15
+
16
+ - **"Done" is checked, not taken on trust**: a web page or game that was changed is opened in a real
17
+ browser by HeartCode itself before "done" is accepted; errors, a blank page or a canvas that draws
18
+ nothing send the model back with screenshots (a canvas showing one flat color now counts as
19
+ broken). Saying "done" again without changing anything doesn't pass.
20
+ - **Better models take over**: a model that times out or errors, goes round in circles, says it's
21
+ stuck or keeps failing the browser check hands the task to the best-ranked of your models
22
+ (LMArena) not tried yet, not just the next in your list (often a much smaller one). Your #1 still
23
+ starts every message. Helpers are picked best-ranked first by default (Used: by score).
24
+ - **Fixes don't lose earlier work**: the changes tool lists a file's earlier versions from every
25
+ conversation in the project (versions, version: N). A changed file much smaller than an earlier
26
+ version stops "done" until what was lost is checked, and the review checks that what earlier
27
+ messages asked for still works. Rules: a fix keeps everything working; never rewrite a whole
28
+ working file to fix part of it; judge by what's on screen, not values inside the program.
29
+ - **One agent or several**: a plan of several steps asks whether to work on it with several agents
30
+ at once. With several, parts that stand alone run side by side, and a part no model is sure of
31
+ (compare) is done by the two best-ranked models, each in a copy of the project; HeartCode checks
32
+ both and another model picks the better one.
33
+ - **The screen stays tidy**: "waiting for" shows once; a plan shows 3 steps (Alt+L or /todos for all
34
+ of it); thinking shows 2 lines (Alt+O for all); the same call made again shows once with ×N.
35
+ - **Works on Windows**: npm start installs from source (paths from file URLs were /C:/…); MCP
36
+ servers, language servers and npm/npx (.cmd files) start through cmd.exe with proper quoting; a
37
+ stopped command, server or background job takes its whole process tree with it; formatters and
38
+ ffmpeg are found with their .exe/.cmd; voice records from the microphone (DirectShow); the model
39
+ is told the shell its commands really run in.
40
+ - **Settings page**: Save list is always there and saves the list exactly as shown, keeping the
41
+ sort and filters; Clear sort in one click; Suggest helpers only marks the suggestions (no
42
+ filtering; the Helpers filter is gone); plain-language tooltips on the Models settings; Give up,
43
+ Stalled and Tests wait can't contradict each other (Tests wait and Stalled ≥ Give up: the one you
44
+ set stays, the other moves, and the page says why).
45
+
46
+ ## 0.1.61 (2026-11-09)
47
+
48
+ - **No more hours of "not answering" after a connection dies**: requests go over HeartCode's own
49
+ HTTP/1.1 client (node:http/https, no packages) instead of Node's built-in fetch. That one used
50
+ HTTP/2, one connection for every request to a host; when it died without a word, every later
51
+ request waited on it and none was sent (every model behind one proxy "didn't start answering"
52
+ while the host answered at once). Now each request has its own socket, a stopped one takes it
53
+ with it, and the next request goes through on a fresh connection.
54
+ - **Alt+B shows the running background commands**; `A` shows the stopped and finished ones too.
55
+
5
56
  ## 0.1.60 (2026-11-08)
6
57
 
7
58
  - **Models say when they're stuck, and get help**: a todo step can be marked `stuck` with why; the
package/README.md CHANGED
@@ -8,8 +8,7 @@ ones, local ones, several at once.
8
8
  **Zero dependencies.** Only Node.js (22 or newer) and HeartCode's own code. No `node_modules`, no
9
9
  install scripts. What you install is what you can read.
10
10
 
11
- <!-- image: HeartCode in the terminal, answering a message -->
12
- ![HeartCode in the terminal](https://res.cloudinary.com/m0jnrul4/image/upload/v1793485425/Screenshot_2026-11-01_at_2.23.35_AM.png)
11
+ <img width="972" height="611" alt="Image" src="https://github.com/user-attachments/assets/4f747a6f-a958-4056-97ee-b6a8b9394b4a" />
13
12
 
14
13
  ## Why I made it
15
14
 
@@ -27,7 +26,11 @@ has none, so there's nothing for anyone to poison.
27
26
  down or fails, the next one answers and the work goes on. A ↻ in the status bar shows it.
28
27
  - When a conversation gets too long for a model, it moves to one of your models with more room
29
28
  instead of summarizing things away.
30
- - When a model goes round in circles, the next one takes over. Only you stop it (Esc).
29
+ - When a model goes round in circles, another takes over. Only you stop it (Esc).
30
+ - A model that shows it can't do the task (stuck, going round, or saying "done" while the work is
31
+ still broken) hands it to the best-ranked of your models it hasn't tried (LMArena's rankings),
32
+ not just the next in your list. Your list still decides who starts, and who answers when one is
33
+ down.
31
34
  - Models are told to say when they're stuck, and believed: first a different approach, then a
32
35
  second opinion from another of your models, then the next model takes over (not another version
33
36
  of the same one). The same happens when a model says "I can't" without trying its tools, or
@@ -38,6 +41,9 @@ has none, so there's nothing for anyone to poison.
38
41
  makes a plan before it changes anything.
39
42
  - It runs and tests what it changed before it says "done", and another of your models checks the
40
43
  result against what you asked.
44
+ - A web page or game it changed, HeartCode opens in a real browser itself before it accepts "done":
45
+ errors, a blank page or a canvas that draws nothing send it back to work, whatever the model's own
46
+ checks said.
41
47
  - It writes the least code that works and changes only what the task needs.
42
48
 
43
49
  **It learns, per project**
@@ -58,7 +64,7 @@ has none, so there's nothing for anyone to poison.
58
64
  - **Skills, MCP servers and hooks** in Claude Code's formats; `/import` brings yours over.
59
65
  - **Tabs** (`Alt+T`) and git worktrees, for work kept apart.
60
66
  - **Servers in the background**: the model starts a dev server and keeps working. `Alt+B` shows
61
- their logs live.
67
+ the running ones' logs live (`A`: the stopped ones too).
62
68
  - **Telegram messages** when a task finishes, fails or waits for you.
63
69
  - **Logs** of exactly what you choose (seven kinds, all off by default), readable on the settings page.
64
70
  - **`heart -p`** runs one task without the screen, for other tools and AI agents, like `claude -p`
@@ -74,16 +80,23 @@ has none, so there's nothing for anyone to poison.
74
80
  2. **It reads up** on whatever it's about to use, instead of trusting its memory.
75
81
  3. **It makes a plan**: a todo list you can see. Its first change of each message waits for one.
76
82
  4. **It does the work**: reading files, running commands, editing.
77
- 5. **It may split the work.** Your #1 model can hand a job to a helper, or run separate parts at
78
- the same time, each on its own files. The model decides. Pick your helpers yourself (below), or
79
- let HeartCode pick them; without any, it can use any of your models, in your order. Every step
80
- on screen names the model doing it.
83
+ 5. **It splits the work, if you want.** When the plan has several steps, HeartCode asks: several
84
+ agents at once, or one? With several, steps that stand alone run at the same time, each on its
85
+ own files and on the model best at it. A step no model is sure to do well is done by two of your
86
+ best-ranked models, each in a copy of the project, and the better result is kept (HeartCode checks
87
+ both, another model picks). Nobody to answer (`heart -p`): several. Pick your helpers yourself
88
+ (below), or let HeartCode pick them; without any, it can use any of your models. Every step on
89
+ screen names the model doing it.
81
90
  6. **It checks before it says it's done**: it must have tested what it changed, finished its todo
82
- list and made the files it names. Then your next models say yes or no (also when it changed no
91
+ list and made the files it names. A web page it changed, HeartCode opens in a browser itself.
92
+ Then your next models say yes or no (also when it changed no
83
93
  files but ran commands or a browser); a no sends it back.
84
94
  7. **It tidies up** in the background: saves notes for next time, removes throwaway files.
85
95
 
86
- ## How to set it up
96
+ ## How I set it up
97
+
98
+ There are many ways to set HeartCode up. This is how I do it: every free model I can get, tested,
99
+ the ones that work kept, the best at coding first.
87
100
 
88
101
  ### 1. Install
89
102
 
@@ -112,49 +125,110 @@ Type `/settings`. The page opens in your browser. Its link also works from anoth
112
125
  network (handy when HeartCode runs on a server over SSH). Only that link works: it has a secret
113
126
  key. A running HeartCode picks up your changes right away.
114
127
 
115
- <!-- image: the settings page -->
116
- ![The settings page](https://res.cloudinary.com/m0jnrul4/image/upload/v1793485584/8396c407-f5f8-48af-a242-0b5cbc1c0331.png)
128
+ <img width="1920" height="1083" alt="Image" src="https://github.com/user-attachments/assets/b51c5884-1da3-4fc9-9a0c-de119d8bb15e" />
117
129
 
118
- What's in the sidebar:
130
+ ### 4. Add your providers and pick their models
119
131
 
120
- - **Models**: *List* (the models HeartCode uses, in order) and *Providers* (where they come from).
121
- - **General**: what it may do without asking, colors, thinking effort, voice input, web search,
122
- and the *Status bar* (drag and drop what it shows). **Notifications**: Telegram.
123
- - **Skills**, **MCP servers** and **System prompt**: what HeartCode can do and what it's told.
124
- - **Advanced**: *Logs* and *Files* (the rest of the settings, as files).
132
+ On **Models → Providers**:
125
133
 
126
- ### 4. Add a provider and pick models
134
+ 1. **+ Add a provider**: its name, base URL and API key. A preset fills in the URL.
135
+ 2. **Pick models.** I take all of them: tick the box at the top (*select every model shown*), then
136
+ **Add N to the list**. Or click a model to add just that one.
137
+ 3. Do the same for every provider you have.
127
138
 
128
- On **Models → Providers**:
139
+ ### 5. Update model info
140
+
141
+ On **Models → List**, click **Update model info**. It fetches what each model can do and costs
142
+ (from [models.dev](https://models.dev)) and its places in LMArena's public rankings for coding, web
143
+ apps and vision. The rankings become columns you can sort by (step 9).
144
+
145
+ ### 6. Test all
146
+
147
+ Click **Test all**. It sends each model a short message and shows in the *Works?* column which ones
148
+ answer, and how fast.
149
+
150
+ Why: most providers have free and paid models side by side, and not every model they list works
151
+ for your key. The test shows which ones really answer for you. (A paid model charges for its few
152
+ tokens.)
153
+
154
+ The three time limits next to the buttons are already set the way I use them:
155
+
156
+ | Setting | Default | What it does |
157
+ |---|---|---|
158
+ | **Give up** | 45 s | How long a model gets to start answering (its first word, thought or tool call). Nothing by then: it counts as failed and the next model takes over. |
159
+ | **Stalled** | 60 s | How long a reply may go quiet once it has started. A model that keeps sending is never cut off; one silent for this long is asked again, or another takes over. |
160
+ | **Tests wait** | 60 s | Only for the Test buttons: how long each model gets to answer the test message. No answer by then shows as *no answer*. |
161
+
162
+ Give up and Stalled apply to real work too. They're kept consistent: Stalled and Tests wait are
163
+ never shorter than Give up. Change one so they would clash and the other moves with it (the page
164
+ says so). Hover any setting for what it does.
129
165
 
130
- ![The settings page](https://res.cloudinary.com/m0jnrul4/image/upload/v1793485944/HeartCode-Settings-11-01-2026_02_28_AM_1.png)
166
+ ### 7. Wait for every test to finish
131
167
 
132
- 1. **Add a provider**: its name, base URL and API key. A preset fills in the URL.
133
- 2. **Pick models**: click a model to add it to your list. I use the free ones.
168
+ With many models this takes a while. When it's done, a message says how many work.
134
169
 
135
- ### 5. Put your list in order
170
+ ### 8. Keep only the ones that work
136
171
 
137
- On **Models → List**:
172
+ In the filters above the list, set *Result* to **✓ Works**. Only the models that answered show.
138
173
 
139
- 1. **Sort.** Click *Abilities*, then *Context*: the most capable models come first, the biggest
140
- context window first among those. Click **Save list**.
141
- 2. **Drag rows** to fine-tune. #1 is the one HeartCode uses; the rest are its fallbacks, in order.
142
- 3. **Test** (optional): **Test all** sends each model a short message and shows which answer and
143
- how fast (*Works?*). Sort by it to put the fastest first.
144
- 4. **Filter** (optional): by name, provider, test result, context, abilities, free or helpers.
145
- **Use only these** keeps just the ones you see, in that order.
146
- 5. **Helpers** (optional): the models #1 can hand parts of a task to. In the *Helper* column, switch
147
- a model on and pick what it's good at: **UI & visuals**, **Code & logic**, **Big & hard**,
148
- **Quick & cheap** (hover an icon to see what it covers). **Suggest helpers** proposes them from
149
- the models that passed **Test all** and the rankings; or set *Helpers* (at the top) to
150
- **Automatic**. *Used*: which helper #1 takes first: in your order, by your provider ranking, or
151
- **by score** (best placed in LMArena's rankings first).
174
+ ### 9. Sort by coding
152
175
 
153
- **Update model info** fetches what each model can do and costs (from models.dev) and its places in
154
- LMArena's public rankings for coding, web apps and vision, as columns to sort by. A model *not
155
- found* in models.dev: **Retry** looks it up again, or **Set up** tells HeartCode what it can do.
176
+ Click the **`</>`** column header (*Coding*): the 9th header counting from *#*, right after the
177
+ wrench, bulb and image icons, before the globe and eye. The models best placed in LMArena's coding ranking come first. #1 is
178
+ the one HeartCode uses first, so the best coder answers, and the next ones take over when it fails.
179
+
180
+ ### 10. Save
181
+
182
+ Click **Use only these N**. HeartCode uses just these models, in the order shown. The others stay
183
+ under Providers, and the sort and filter stay as they are for next time.
184
+
185
+ ### 11. Back to HeartCode
186
+
187
+ Go back to the terminal. While the settings page is on, HeartCode shows a dialog and waits.
188
+ **Turn off** is selected: press Enter to stop the settings page. Your changes are already in.
189
+
190
+ ### 12. Start coding
191
+
192
+ Ask it to read, change, run and fix things in your project, like any coding agent.
193
+
194
+ - `/` shows every command; `heart --help` lists the rest.
195
+ - `Shift+Tab` changes what it may do without asking.
196
+ - `Esc` twice stops it; `Esc` also closes a dialog.
197
+ - While it works, `Enter` queues a message. `Esc` (or `↑`) takes queued messages back into the box
198
+ to change or drop, without stopping the work.
199
+ - `Shift+Enter` (or `Option+Enter`) adds a new line. `Alt+O` shows all of the model's thinking (two lines
200
+ of it show otherwise), `Alt+L` the whole plan (three of its steps show while it works). The same
201
+ call made again and again shows once, with a count (×4).
202
+ - While it works, commands that don't change the conversation (`/help`, `/cost`, `/diff`,
203
+ `/settings`…) run at once; the ones that do (`/compact`, `/rewind`…) wait until it's done.
156
204
 
157
- ### 6. Recommended: let it see what it builds
205
+ <img width="972" height="611" alt="Image" src="https://github.com/user-attachments/assets/dcf9488a-7cee-4a24-8e3e-c86876d379c9" />
206
+
207
+ ## More on the settings page
208
+
209
+ What's in the sidebar:
210
+
211
+ - **Models**: *List* (the models HeartCode uses, in order) and *Providers* (where they come from).
212
+ - **General**: what it may do without asking, colors, thinking effort, voice input, web search,
213
+ and the *Status bar* (drag and drop what it shows). **Notifications**: Telegram.
214
+ - **Skills**, **MCP servers** and **System prompt**: what HeartCode can do and what it's told.
215
+ - **Advanced**: *Logs* and *Files* (the rest of the settings, as files).
216
+
217
+ On **Models → List**, also:
218
+
219
+ - **Drag rows** to fine-tune the order. **Clear sort** puts the list back in its own order; **Clear
220
+ all** turns off the filters too.
221
+ - **Filter** by name, provider, test result, context, abilities or free.
222
+ - **Helpers**: the models #1 can hand parts of a task to. In the *Helper* column, switch a model on
223
+ and pick what it's good at: **UI & visuals**, **Code & logic**, **Big & hard**, **Quick & cheap**
224
+ (hover an icon to see what it covers). **Suggest helpers** proposes them from the models that
225
+ passed **Test all** and the rankings; or set *Helpers* (at the top) to **Automatic**. *Used*:
226
+ which helper #1 takes first: **by score** (the default: best placed in LMArena's rankings first),
227
+ in your order, or by your provider ranking.
228
+ - A model *not found* in models.dev: **Retry** looks it up again, or **Set up** tells HeartCode what
229
+ it can do.
230
+
231
+ ### Recommended: let it see what it builds
158
232
 
159
233
  Out of the box, HeartCode reads, writes and runs code. It can't see a page it made or click
160
234
  through an app. These three fix that. They're optional, but you'll get much better results with
@@ -197,35 +271,6 @@ hands the looking to the first of your models that can.
197
271
  - **Advanced → Logs**: switch on only the kinds you need and read them there (by run, searched,
198
272
  live). Logs older than 3 days are deleted.
199
273
 
200
- ### 7. Back to HeartCode
201
-
202
- Go back to the terminal. While the settings page is on, HeartCode shows a dialog and waits. Your
203
- changes are already in.
204
-
205
- ### 8. Press Enter to stop the settings page
206
-
207
- **Turn off** is selected: press Enter.
208
-
209
- <!-- image: the "settings page is on" dialog -->
210
- ![The settings dialog](https://res.cloudinary.com/m0jnrul4/image/upload/v1793486060/Screenshot_2026-11-01_at_2.34.15_AM.png)
211
-
212
- ### 9. Send "Hi" as a test
213
-
214
- Type `Hi` and press Enter. A reply means your model works.
215
-
216
- ### 10. Start using it
217
-
218
- Ask it to read, change, run and fix things in your project, like any coding agent.
219
-
220
- - `/` shows every command; `heart --help` lists the rest.
221
- - `Shift+Tab` changes what it may do without asking.
222
- - `Esc` twice stops it; `Esc` also closes a dialog.
223
- - While it works, `Enter` queues a message. `Esc` (or `↑`) takes queued messages back into the box
224
- to change or drop, without stopping the work.
225
- - `Shift+Enter` (or `Option+Enter`) adds a new line. `Alt+O` shows all of the model's thinking.
226
- - While it works, commands that don't change the conversation (`/help`, `/cost`, `/diff`,
227
- `/settings`…) run at once; the ones that do (`/compact`, `/rewind`…) wait until it's done.
228
-
229
274
  ## Thanks
230
275
 
231
276
  A lot of what HeartCode handles, I learned from other coding agents and the problems they ran into
package/bin/heartcode.js CHANGED
@@ -5,7 +5,7 @@ import { Client, limitSaid, estMessages } from '../src/client.js'
5
5
  import { loadConfig, saveConfig, readJson, writeJson, providerName, CONFIG_FILE, HOME, TEMP, AUTO_MODEL, isAuto, parseModel, takeIn, whatOf, VERSION, speedOf, jobsOf } from '../src/config.js'
6
6
  import { loadProfile, strategy, describe, profilePath, profileFrom } from '../src/probe.js'
7
7
  import { learnFromUsage, LIMIT_MS, RATE_CAP_MS } from '../src/context.js'
8
- import { loadRankings, rankIn } from '../src/rankings.js'
8
+ import { loadRankings, scoreOf } from '../src/rankings.js'
9
9
  import { Session, transcript, contextReport } from '../src/agent.js'
10
10
  import { listJobs, getJob, stopJob, removeJob, runningJobs, tailLines, ago as ranFor } from '../src/background.js'
11
11
  import { checkUpdate, installKind, UPDATE_COMMANDS, packageDir, whatsNew } from '../src/update.js'
@@ -45,7 +45,7 @@ ${c.bold('usage')}
45
45
  heart providers list added providers
46
46
  heart models [filter] what -m takes, one per line: "auto" (the list), then each model
47
47
  as provider/model, #1 first
48
- heart models --all [filter] every provider's models (provider/model)
48
+ heart models --all [filter] every switched-on provider's models (provider/model)
49
49
  heart models --json as JSON (with --all too), for other programs
50
50
  heart config show the config file
51
51
  heart settings change providers, models and settings in the browser
@@ -106,6 +106,7 @@ const SECTIONS = [
106
106
  ]],
107
107
  ['settings', [
108
108
  ['/toggle_thinking', "the model's thinking: its last two lines, or all of it (Alt+O)"],
109
+ ['/todos', 'the whole plan of the task at work, every step and its state (Alt+L)'],
109
110
  ['/voice', 'dictate a message (or Space in an empty box, once voice is set up): it shows in the box while speaking, Enter sends it, Esc cancels'],
110
111
  ]],
111
112
  ['session', [
@@ -145,7 +146,7 @@ for (const [, list] of SECTIONS) list.sort(byName) // alphabetical, in /help and
145
146
  const COMMANDS = SECTIONS.flatMap(([, list]) => list).sort(byName)
146
147
  // Typed while a task works, these run at once, beside it: they leave the conversation alone. The
147
148
  // others (/compact, /rewind, /resume, /init…) wait in the queue until it's done.
148
- const RIGHT_AWAY = new Set(['help', 'cost', 'context', 'background', 'model_info', 'diff', 'copy', 'mcp', 'doctor', 'toggle_thinking', 'btw', 'rename', 'export', 'tab', 'close_tab', 'exit', 'quit', 'settings', 'login_mcp', 'install_skill', 'import', 'voice', 'select_model'])
149
+ const RIGHT_AWAY = new Set(['help', 'todos', 'cost', 'context', 'background', 'model_info', 'diff', 'copy', 'mcp', 'doctor', 'toggle_thinking', 'btw', 'rename', 'export', 'tab', 'close_tab', 'exit', 'quit', 'settings', 'login_mcp', 'install_skill', 'import', 'voice', 'select_model'])
149
150
  const helpText = (sections) => sections.map(([title, list]) => ` ${c.bold(title)}\n` + list.map(([n, d]) => ` ${c.cyan(n.padEnd(17))} ${d}`).join('\n')).join('\n\n')
150
151
  const SLASH = helpText(SECTIONS)
151
152
 
@@ -162,6 +163,7 @@ function keysHelp(keys = {}, mouse = false, voice = false) {
162
163
  ['Esc Esc', 'rewind to an earlier message (at the prompt)'],
163
164
  ['Shift+Tab', 'change what runs without asking (permissions)'],
164
165
  [forAct('toggle_thinking'), "the model's thinking: after an answer, all of it in a box; while it works, all of it as it comes or its last two lines"],
166
+ [forAct('show_plan'), 'the whole plan in a box (only three of its steps show while it works)'],
165
167
  [forAct('background_log'), "the background commands' logs in a dialog, a tab each (←/→ switch, ↑/↓ scroll, K twice stops one, Esc closes); with text in the box it moves back a word instead"],
166
168
  [forAct('new_tab'), 'new tab'],
167
169
  [forAct('close_tab'), 'close this tab'],
@@ -862,12 +864,12 @@ class App {
862
864
  // across the lists the helpers are picked by (coding, web apps, long real tasks, hard prompts);
863
865
  // models not in them after, in your list's order.
864
866
  byProvider() {
865
- if (this.cfg.helperOrder === 'score') {
867
+ if ((this.cfg.helperOrder ?? 'score') === 'score') { // the default: a small model early in your list isn't who looks at a screenshot
866
868
  const data = loadRankings()
867
869
  const share = new Map()
868
870
  const of = (t) => {
869
871
  const k = `${t.provider}/${t.model}`
870
- if (!share.has(k)) share.set(k, Math.min(...['text:coding', 'webdev:webdev', 'agent:overall', 'text:hard_prompts'].map((l) => rankIn(t.model, l, data)).filter(Boolean).map((r) => r.rank / r.of), Infinity))
872
+ if (!share.has(k)) share.set(k, scoreOf(t.model, data))
871
873
  return share.get(k)
872
874
  }
873
875
  return (a, b) => (of(a) === of(b) ? 0 : of(a) < of(b) ? -1 : 1) // Infinity (not ranked) last; ties keep your order
@@ -933,13 +935,20 @@ class App {
933
935
 
934
936
  // Alt+B, /background: the background commands' logs in a dialog, one at a time with a tab each.
935
937
  // ←/→ (or a click on a tab): another one; ↑/↓, PgUp/PgDn, the wheel: back in its log (End: the
936
- // newest again); K twice: stop it and close its tab; Esc or Alt+B: closed.
938
+ // newest again); K twice: stop it and close its tab; A: the stopped ones too; Esc or Alt+B: closed.
937
939
  toggleJobs(on = !this.jobsShown) {
938
940
  const { ui } = this
939
941
  if (!on) return ui.setDialog(null)
940
942
  this.jobsShown = true
941
943
  const ERROR = /\b(error|errors|failed|fail|exception|traceback|panic|fatal)\b/i
942
- const jobs = () => listJobs(this.root)
944
+ // running ones only (and any that stop while it's open); A: the stopped and finished ones too
945
+ let showAll = false
946
+ const live = new Set()
947
+ const jobs = () => {
948
+ for (const j of runningJobs(this.root)) live.add(j.id) // a command's leftover that's gone counts as stopped
949
+ const list = listJobs(this.root)
950
+ return showAll ? list : list.filter((j) => live.has(j.id))
951
+ }
943
952
  const current = () => jobs().find((j) => j.id === this.jobTab) ?? jobs().findLast((j) => !j.exited) ?? jobs().at(-1)
944
953
  let spots = [] // where each tab is on its row: { from, to, id }
945
954
  let back = 0 // lines scrolled back from the newest (0: following it)
@@ -978,6 +987,7 @@ class App {
978
987
  if (key.name === 'end') return (back = 0)
979
988
  if (key.name === 'home') return (back = 1e6)
980
989
  if (key.name === 'k' && !key.ctrl && !key.meta) return kill()
990
+ if (key.name === 'a' && !key.ctrl && !key.meta) return (showAll = !showAll), (back = 0)
981
991
  },
982
992
  click: (col, row) => {
983
993
  const hit = row === 0 && spots.find((t) => col >= t.from && col < t.to)
@@ -985,7 +995,8 @@ class App {
985
995
  },
986
996
  draw: (w, h) => {
987
997
  const all = jobs()
988
- if (!all.length) return ['', ...wrapWords('Nothing runs in the background. The model starts servers and watchers there.', w - 2).map((l) => ` ${c.faint(l.trim())}`), '', ` ${c.faint('Esc close')}`]
998
+ const ended = listJobs(this.root).length - all.length // stopped or finished, not shown
999
+ if (!all.length) return ['', ...wrapWords('Nothing runs in the background. The model starts servers and watchers there.', w - 2).map((l) => ` ${c.faint(l.trim())}`), '', ` ${c.faint(`${ended ? `A show ${ended} stopped · ` : ''}Esc close`)}`]
989
1000
  const job = current()
990
1001
  this.jobTab = job.id
991
1002
  // the tabs, scrolled so the one shown is on screen
@@ -1016,7 +1027,7 @@ class App {
1016
1027
  ` ${c.bold(clip(job.command, Math.max(10, w - 2 - width(` · ${state} · ${ranFor(job)}${where}`.replace(/\x1b\[[0-9;]*m/g, '')))))} ${c.faint('·')} ${state} ${c.faint(`· ${ranFor(job)}`)}${where}`, // the command, as much as the rest leaves room for
1017
1028
  ...Array.from({ length: n }, (_, i) => (shown.length ? (shown[i] === undefined ? '' : ` ${ERROR.test(shown[i]) ? c.red(shown[i]) : c.muted(shown[i])}`) : i ? '' : ` ${c.faint('(no output yet)')}`)),
1018
1029
  c.ghost('─'.repeat(w)),
1019
- ` ${said ? c.yellow(said) : c.faint(`${all.length > 1 ? '←/→ another one · ' : ''}↑/↓ PgUp/PgDn scroll · K ${job.exited ? 'close' : 'stop'} it · Esc close`)}`,
1030
+ ` ${said ? c.yellow(said) : c.faint(`${all.length > 1 ? '←/→ another one · ' : ''}↑/↓ PgUp/PgDn scroll · K ${job.exited ? 'close' : 'stop'} it · ${showAll ? 'A running only' : ended ? `A show ${ended} stopped` : ''}${showAll || ended ? ' · ' : ''}Esc close`)}`,
1020
1031
  ]
1021
1032
  },
1022
1033
  })
@@ -1118,16 +1129,17 @@ class App {
1118
1129
 
1119
1130
  // `heart models`: what -m takes, one per line (as \`opencode models\`): "auto" (your list: #1, then
1120
1131
  // the next when one fails; also no -m), then your models as provider/model, #1 first. all: every
1121
- // provider's models (fetched from each; a provider whose list is off: the ones added by name).
1132
+ // switched-on provider's models (fetched from each; a provider whose list is off: the ones added by
1133
+ // name). A provider switched off isn't listed at all: its models aren't offered anywhere.
1122
1134
  // json: one JSON object on stdout, for other programs:
1123
1135
  // { "models": [{ "id": "auto", "fallbacks": true }, { "id": "groq/openai/gpt-oss-120b", "provider", "model", "place": 1 }, …],
1124
- // "providers": [{ "name", "baseUrl", "list": true, "off"?: true, "models": ["provider/model", …], "error"? }] } (--all)
1136
+ // "providers": [{ "name", "baseUrl", "list": true, "models": ["provider/model", …], "error"? }] } (--all)
1125
1137
  async listModels(filter = '', { all = false, json = false } = {}) {
1126
1138
  const { ui, cfg } = this
1127
1139
  const match = (id) => id.toLowerCase().includes(filter.toLowerCase())
1128
1140
  const mine = this.myModels().map((t, i) => ({ id: `${t.provider}/${t.model}`, provider: t.provider, model: t.model, place: i + 1 }))
1129
- const providers = !all ? [] : await Promise.all(Object.entries(cfg.providers).map(async ([name, p]) => {
1130
- const out = { name, baseUrl: p.baseUrl, list: p.list !== false, ...(p.off && { off: true }), models: [] }
1141
+ const providers = !all ? [] : await Promise.all(Object.entries(cfg.providers).filter(([, p]) => !p.off).map(async ([name, p]) => {
1142
+ const out = { name, baseUrl: p.baseUrl, list: p.list !== false, models: [] }
1131
1143
  if (out.list) {
1132
1144
  try {
1133
1145
  out.models = await new Client({ baseUrl: p.baseUrl, apiKey: p.apiKey }).listModels()
@@ -1734,6 +1746,8 @@ async function slash(app, line, working = false) {
1734
1746
  if (text) ui.ahead.push(text) // sent: the next prompt takes it, as if typed
1735
1747
  return
1736
1748
  }
1749
+ case 'todos':
1750
+ return ui.showPlan()
1737
1751
  case 'toggle_thinking':
1738
1752
  ui.showThinking = !ui.showThinking
1739
1753
  ui.print(c.dim(ui.showThinking ? 'thinking shown: all of it (Alt+O: last two lines)' : 'thinking shown: its last two lines (Alt+O: all of it)'))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heartcode",
3
- "version": "0.1.60",
3
+ "version": "0.1.63",
4
4
  "description": "A coding CLI for any local or OpenAI-compatible model, including small models without tool calling.",
5
5
  "keywords": [
6
6
  "ai",
package/prompts/agent.md CHANGED
@@ -9,7 +9,7 @@ its section into ~/.heart/prompts/agent.md (every project) or .heartcode/prompts
9
9
 
10
10
  <!-- The system prompt in tool mode (models with native tool calls).
11
11
  {{root}}: the project folder's absolute path.
12
- {{env}}: the OS and shell ("macOS (darwin 25.6.0, arm64), shell zsh"). {{today}}: the date (2026-10-30).
12
+ {{env}}: the OS and the shell commands run in ("macOS (darwin 25.6.0, arm64), shell sh"; cmd.exe on Windows). {{today}}: the date (2026-10-30).
13
13
  {{rootList}}: every entry in the project root, names only ("src/ · .git/ · node_modules/ (ignored) · package.json").
14
14
  {{servers}}: language servers used in this project before ("typescript-language-server --stdio (typescript) for .ts"), or empty.
15
15
  {{see}}: set when the model can see images.
@@ -46,8 +46,10 @@ Stop looking once you have what the task needs.
46
46
 
47
47
  ## 4. Write code
48
48
  1. Bugs: find the root cause with evidence first. Read the whole error and reproduce it. Two fixes failed: investigate again. Three failures of one approach: change the approach.
49
+ It worked before and doesn't now: first find what changed since it worked (changes tool: versions) and fix or undo that change. Don't rebuild it.
50
+ A fix keeps everything working that the user asked for in this conversation. "Fix it" means all of it works again, not just the last thing they named.
49
51
  2. Write the least that works. In this order: not needed → already in this code (reuse it) → the standard library → a built-in platform feature → an installed dependency → one line → new code, as little as possible. No abstractions or options nobody asked for.
50
- 3. Read a file before you change it. Change only what the task needs, in the style that's there. Don't touch nearby code. Remove only what your change made unused.
52
+ 3. Read a file before you change it. Change only what the task needs, in the style that's there. Don't touch nearby code. Remove only what your change made unused. Never rewrite or cut down a whole working file to fix part of it.
51
53
  4. Clear names. A comment only for what isn't obvious.
52
54
  5. Tests: if the user wants them or the project has them, write the failing test first, see it fail, then make it pass.
53
55
  6. "All" or "every": do one, check it, then do the rest the same way.
@@ -55,7 +57,8 @@ Stop looking once you have what the task needs.
55
57
 
56
58
  ## 5. Prove it works, then stop
57
59
  1. Never say done, fixed or working without running what proves it and reading the output. "It should work" is not proof.
58
- 2. Check it the way the user will use it: run it, use it with real input and an edge case, look at it, read its errors. Run the tests if there are any. Stop what you started.
60
+ 2. Check it the way the user will use it, and judge it by what they get: run it, use it with real input and an edge case, read its errors. Something on a screen: take a screenshot and look at it. Values read from inside the program (variables, state) don't prove it works. Run the tests if there are any. Stop what you started.
61
+ Every problem the user named is part of the task: check each one is gone, one by one, before you say done.
59
62
  3. Before you say done, read your whole change (changes tool). Update everything that uses what you changed or renamed.
60
63
  4. A real bug: fix the cause and check again until it works. Once the proof passes, stop: no polish or extra tests.
61
64
  5. A review point (from HeartCode, a reviewer or a helper): check it against the code. If it's wrong, say why and skip it.
@@ -145,6 +148,7 @@ Find text or a regex in the project's files, or only in `path` (a file, a folder
145
148
  ## tool-changes
146
149
 
147
150
  Your file changes in this message, as a diff (`all`: the whole conversation; `path`: one file). Read it before you say done.
151
+ A file's earlier versions in this project (path, versions: true): as it was before each earlier message, in any conversation here. version: N gives one, and what changed from it to now. Something worked before and doesn't now: find the version that worked and what changed since.
148
152
 
149
153
  ## tool-list_files
150
154
 
@@ -222,7 +226,7 @@ Files of this skill (read one with the skill tool: name "{{name}}", file "<path>
222
226
  <!-- The todo tool: the model's checklist, shown to the user. -->
223
227
  Your todo list for a task with several steps. Send the whole list each time: content and status (pending, in_progress, completed or stuck). One item in_progress at a time; mark it completed as soon as it's done. A small task: one item (changing files needs a plan first).
224
228
  Stuck: you've tried a step twice and it still doesn't work, or you don't know how to go on. Mark it stuck at once, with why (what you tried, what happened). It gets you help: a new approach, a second opinion, then another model. Saying so is expected and useful; claiming it works when it doesn't wastes the user's time.
225
- A part that stands alone (needs no other part's result, touches no file another part touches) can run at the same time on another of your models: parallel: true, model ("provider model" from "Your helpers" or "Your other models"; left out: your first helper, or yours when you have none), files (the files only it changes). HeartCode starts the pending ones as helpers when you save the list (not in plan mode, not from a helper) and gives you what each did; you combine and check. Parts that build on each other, one file, a small fix: do them yourself.
229
+ A part that stands alone (needs no other part's result, touches no file another part touches) can run at the same time on another of your models: parallel: true, model ("provider model" from "Your helpers" or "Your other models"; left out: your first helper, or yours when you have none), files (the files only it changes). A part you're not sure one model does well (hard, or visual): also compare: true, with its files: two of the best models each do it in a copy of the project, and the better result is kept. HeartCode starts the pending ones as helpers when you save the list (not in plan mode, not from a helper) and gives you what each did; you combine and check. Parts that build on each other, one file, a small fix: do them yourself.
226
230
 
227
231
  ## tool-web_search
228
232
 
@@ -319,23 +323,30 @@ Write the plan with the todo tool: the result in one line, then each step with h
319
323
 
320
324
  ## not-done
321
325
 
322
- <!-- Sent when the model stops but isn't done. One placeholder is set, and only its part is sent. {{asked}}: it wrote questions for the user as text (only ask_user lets them answer); {{todos}}: open todo items, a "- item" per line; {{unchecked}}: files changed and not run or tested since; {{missing}}: files its answer names that don't exist; {{early}}: it named a next step but didn't take it. -->
326
+ <!-- Sent when the model stops but isn't done. One placeholder is set, and only its part is sent. {{asked}}: it wrote questions for the user as text (only ask_user lets them answer); {{todos}}: open todo items, a "- item" per line; {{unchecked}}: files changed and not run or tested since; {{missing}}: files its answer names that don't exist; {{early}}: it named a next step but didn't take it; {{shrunk}}: files it changed that are much smaller than an earlier version (one per line); {{broken}}: HeartCode opened {{page}} in a browser and it doesn't work (the report), {{shots}} its screenshots, {{command}} the same check as a command. -->
323
327
  {{#if asked}}(The user can't answer questions written as text. Ask each one with the ask_user tool: question, header, options (your recommended one first), emphasis: true. Put all the calls in one reply.){{/if}}
324
328
  {{#if todos}}(Not done: your todo list has open items:
325
329
  {{todos}}
326
330
  Do them. If one is no longer needed, update the list and say why.){{/if}}
327
331
  {{#if unchecked}}(Not done: you changed {{unchecked}} and ran nothing since, so it isn't proven to work. Run, test or open it the way the user will. Fix what's wrong, then reply.){{/if}}
328
332
  {{#if missing}}(Your answer names {{missing}}, but they aren't in the project. Make them, or correct your answer.){{/if}}
333
+ {{#if shrunk}}(Before you say done: these files are much smaller than they were earlier in this project:
334
+ {{shrunk}}
335
+ What earlier messages asked for may be gone. Look at that version (changes tool, with path and version) and what changed since. Everything the user asked for in this conversation, and everything that worked, must still work: bring back what was lost, then check it. Removed on purpose (the user asked, or it was broken and replaced): say so in your answer.){{/if}}
336
+ {{#if broken}}(Not done: HeartCode opened {{page}} in a real browser itself, and it doesn't work:
337
+ {{broken}}
338
+ This is what the user gets, whatever your own checks said. Look at the screenshots ({{shots}}) with read_file. Find the cause in the code, fix it, then run the same check yourself: {{command}} (it exits 0 when it passes). Checking values in the page (state, variables) doesn't prove it works; what's on the screen does.){{/if}}
329
339
  {{#if early}}(You named a next step but didn't take it. If the task isn't done, do the rest now with your tools. If it is done and checked, reply with the final result only.){{/if}}
330
340
 
331
341
  ## review
332
342
 
333
- <!-- A check before a task is called done, in a request of its own (your next models when there are any). {{request}}: the user's messages; {{plan}}: the todo list; {{answer}}: the agent's final reply; {{changes}}: the diffs; {{ran}}: commands run (newest last) and how they ended; {{emphasis}}: what the user said about how they want it (may be empty). -->
343
+ <!-- A check before a task is called done, in a request of its own (your next models when there are any). {{request}}: the user's messages; {{plan}}: the todo list; {{answer}}: the agent's final reply; {{changes}}: the diffs; {{ran}}: commands run (newest last) and how they ended; {{emphasis}}: what the user said about how they want it (may be empty); {{shrunk}}: changed files much smaller than an earlier version (may be empty). -->
334
344
  You check a coding agent's work before the user gets it. Judge it strictly against what the user asked:
335
345
  1. Complete: every part, every item of "all" or "every". Done, not described: steps for the user to do themselves, or "I can't", isn't doing it.
336
346
  2. Correct: it would work. No bug, wrong API, placeholder or TODO.
337
347
  3. Checked: what it ran shows it working.
338
348
  4. Clean: no scratch files it made by hand left in the project (experiments, copies, test pages). Tool caches and build output (node_modules, .pytest_cache) are fine.
349
+ 5. Nothing lost: what the user asked for in earlier messages, and what worked before, still works. A fix that removes earlier features isn't done.
339
350
  Don't judge style or taste.{{#if emphasis}} The user said how they want it: {{emphasis}}. Hold it to that; what they didn't choose (polish, extras, tests, edge cases) is not missing.{{/if}}
340
351
 
341
352
  The user asked:
@@ -352,7 +363,10 @@ What it changed (long changes are shortened here to save room; a shortened part
352
363
 
353
364
  What it ran:
354
365
  {{ran}}
355
-
366
+ {{#if shrunk}}
367
+ Files much smaller than an earlier version of them (something may have been lost):
368
+ {{shrunk}}
369
+ {{/if}}
356
370
  The FIRST word of your reply must be YES (done right) or NO. If NO, follow with a numbered list of what's wrong or missing: where, what, and what's needed. Nothing else.
357
371
 
358
372
  ## review-failed
@@ -487,6 +501,30 @@ Your part: {{part}}
487
501
  {{#if files}}Change only these files: {{files}}. Read others if you need to; never change them.
488
502
  {{/if}}Do your part completely, check it works as far as it can alone, and stop. Reply with what you did, the names (functions, ids, events) other parts will use, and what another part must still do.
489
503
 
504
+ ## compare
505
+
506
+ <!-- Two models did the same part of a plan, each in its own copy of the project; another model picks the better. {{task}}: the user's request; {{part}}: the part; {{model0}}/{{model1}}: who did A and B; {{said0}}/{{said1}}: what each replied; {{changes0}}/{{changes1}}: what each changed; {{check0}}/{{check1}}: HeartCode's browser check of a web page each changed. -->
507
+ Two models did the same part of a task, each on its own copy of the project. Pick the one that does the part better: it works (see the checks), it's complete, and it's correct. Don't judge style.
508
+
509
+ The user asked:
510
+ {{task}}
511
+
512
+ The part: {{part}}
513
+
514
+ A ({{model0}}) said:
515
+ {{said0}}
516
+ A changed:
517
+ {{changes0}}
518
+ HeartCode's check of A: {{check0}}
519
+
520
+ B ({{model1}}) said:
521
+ {{said1}}
522
+ B changed:
523
+ {{changes1}}
524
+ HeartCode's check of B: {{check1}}
525
+
526
+ The FIRST word of your reply must be A or B, then one line why. Nothing else.
527
+
490
528
  ## part-files
491
529
 
492
530
  <!-- A helper doing one part tried to change a file its part doesn't own. {{file}}: that file; {{files}}: the ones it owns. -->
@@ -504,9 +542,9 @@ Now combine them: read what they changed, add what's still needed between them,
504
542
 
505
543
  ## plan-check
506
544
 
507
- <!-- Added to the todo tool's result, once a message each. {{research}}: set when the plan has two or more steps and nothing was looked up yet. {{split}}: set when it has three or more open parts and none runs side by side or on another model. -->
545
+ <!-- Added to the todo tool's result, once a message each. {{research}}: set when the plan has two or more steps and nothing was looked up yet. {{split}}: set when the user chose several agents at once and no part is marked to run side by side or on another model. -->
508
546
  {{#if research}}(Before you start: does this plan use a library, framework, API, tool or command? Your memory of it is out of date. Read its current official docs first (web_search, then web_fetch), or the pages already saved for this project. Only this project's own code: go on.){{/if}}
509
- {{#if split}}(Could any of these parts run side by side, or go to one of your models that's better at it? If so, mark them (parallel, model, files) and save the list again. If not, go on.){{/if}}
547
+ {{#if split}}(The user wants several agents working at once. Mark each part that stands alone parallel: true, with the files only it changes and the model best at it (model). A part you're not sure one model does well: also compare: true. Then save the list again. If every part needs the one before it, say so in one line and go on.){{/if}}
510
548
 
511
549
  ## tool-memory
512
550