heartcode 0.1.41 → 0.1.44

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,58 @@
2
2
 
3
3
  What changed in each version of HeartCode, newest first.
4
4
 
5
+ ## 0.1.44 (2026-11-03)
6
+
7
+ - **Orchestrators first**: with Pick on "an orchestrator hands it out", the model shown (status bar,
8
+ headless `init`) is the first orchestrator, the one that answers first. With several, they go in
9
+ your list's order. Your models lists them at the top. Changing Pick or the orchestrators reaches a
10
+ running HeartCode at once.
11
+ - **Tooltips at once**: every tooltip on the settings page shows the moment you point at it (or tab
12
+ to it), in the page's own style, not the browser's slow one. A **?** beside Mark as orchestrator(s)
13
+ says what it does.
14
+ - A headless run that started on another provider's model named the wrong provider in its `init` line.
15
+
16
+ ## 0.1.43 (2026-11-03)
17
+
18
+ - **An orchestrator in place of best fit**: with Pick on "an orchestrator hands it out", each
19
+ message starts on a model you mark as an orchestrator (a quick, cheap one is enough). It answers
20
+ at once, streaming, when it can ("hi" needs no other model), and otherwise hands the work to
21
+ whichever of your other models it thinks suits it best. It sees what each one can do and its places in LMArena's
22
+ rankings. It only hands work out: its only tools are handing off and asking you. On Your models,
23
+ select models and press Mark as orchestrator(s); click a model's "orchestrator ✕" tag to unmark it.
24
+ None marked: your first model that calls tools. The extra request per message that named a task's
25
+ skills is gone, and nothing assumes a task is about code.
26
+
27
+ ## 0.1.42 (2026-11-03)
28
+
29
+ - **Your "no, do this instead" reaches the model as you**: what you type when you decline a command,
30
+ an edit or a call goes to the model as your own message, not inside the tool's result (where small
31
+ models read it as the tool failing and tried again).
32
+ - **The conversation's size counted honestly**: tokens estimated the way tokenizers split text, so
33
+ code, CSS, JSON and SVG count for what they are (a flat estimate was up to 2× low on them: a request
34
+ thought to fit was refused, and compacting never started); a ratio learned on prose never makes it
35
+ smaller than characters ÷ 4, and what's new since the server's last count is never discounted.
36
+ - **The provider's prompt cache kept**: a file read again no longer rewrites its older copy in the
37
+ middle of the conversation at once (every such change makes the provider process everything after
38
+ it again: minutes on a local model, full price on a paid one); older copies go together with the
39
+ old results, or when it's nearly full.
40
+ - **Checks what uses a change**: before saying done, the model reads its whole change and updates
41
+ what uses it (the callers of a function, what reads a renamed value). In our test a 14B model
42
+ updated both callers 2 of 2 times, against 0 of 2 before. The new `changes` tool shows the model
43
+ its own diff for the message (or the conversation), with or without git.
44
+ - **Tool messages that can't be misread**: search tells a path that doesn't exist, a pattern no file
45
+ fits and an invalid regular expression apart from "no matches" (with how many files it searched),
46
+ and takes a pattern as its path (`src/*.css`); shortened output says it's shortened to fit, not an
47
+ error.
48
+ - **Findings saved before compacting**: the model working on the task writes down what it has found
49
+ just before the conversation is summarized, and the summary starts with it, so it doesn't read the
50
+ same files again after every compaction.
51
+ - **`--temp` keeps nothing**: besides `~/.heart`, the project's `.heartcode/` (research pages, notes)
52
+ is untouched (read from a copy), logs go with the throwaway folder, and skills or MCP servers saved
53
+ in a `--temp` run don't reach the project.
54
+ - **The update check at every start**, not once a day: a new version shows on the next launch.
55
+ - **Thanks** in the README to Reika, OpenCode, Cline, OpenClaw and Pi.
56
+
5
57
  ## 0.1.41 (2026-11-03)
6
58
 
7
59
  - **Model scores on Your models**: Coding, Web apps and Vision show each model's LMArena score with
package/README.md CHANGED
@@ -56,13 +56,14 @@ tried did what I needed:
56
56
  default): requests, tools & commands, model choices, the agent's decisions, errors, the
57
57
  conversation, debug. Read them on the settings page, searched and live.
58
58
  - **Takes skills, MCP servers and hooks** in Claude Code's formats; `/import` brings yours over.
59
- - **Tells you when a newer version is out** (a check with npm at most once a day, in the status bar):
59
+ - **Tells you when a newer version is out** (a check with npm each time it starts, in the status bar):
60
60
  `/update` shows what changed and installs it the way you installed HeartCode. Switch it off in
61
61
  `/settings` → General.
62
- - **Best fit by public rankings**: with "Pick" set to "the best for each task", each message's
63
- lead and code reviewer are your models ranked on the skills that task needs (web
64
- pages, code, images…) by LMArena's public rankings, fetched once a week. Your models shows each
65
- one's Coding, Web apps and Vision rank.
62
+ - **An orchestrator that hands work out**: with "Pick" set to "an orchestrator hands it out",
63
+ each message starts on a model you choose for that (a quick, cheap one is enough). It answers
64
+ at once when it can ("hi" needs no other model), and otherwise hands the work to whichever of
65
+ your models it thinks suits it. It knows what each one can do and where it stands in LMArena's
66
+ public rankings. Your models shows each model's Coding, Web apps and Vision scores.
66
67
  - **Works with discipline by default**: its rules (from Karpathy's guidelines, Grill Me,
67
68
  Superpowers, Ponytail and Caveman) have it ask before building, find a bug's root cause first,
68
69
  write the least code that works, change only what the task needs, prove it before saying done,
@@ -189,6 +190,16 @@ ones that change it (`/compact`, `/rewind`, `/resume`…) wait until it's done.
189
190
  commands show (`/help`, `/context`, `/diff`…) open in a dialog over the conversation; `Esc`
190
191
  closes it.
191
192
 
193
+ ## Thanks
194
+
195
+ A lot of what HeartCode handles, I learned from other coding agents and the problems they ran into
196
+ first. Thank you to [Reika](https://github.com/alexwkleung/reika) (its measured findings on small
197
+ models: sending a "no, do this instead" as your own message, counting code's tokens honestly,
198
+ keeping the provider's prompt cache, checking what uses a changed function, saving what the model
199
+ found before compacting), [OpenCode](https://github.com/anomalyco/opencode),
200
+ [Cline](https://github.com/cline/cline), [OpenClaw](https://github.com/openclaw/openclaw) and
201
+ [Pi](https://github.com/earendil-works/pi), for the many use cases like these they showed me.
202
+
192
203
  ## License
193
204
 
194
205
  [MIT](LICENSE)
package/SKILL.md CHANGED
@@ -58,7 +58,7 @@ reached has an `error` (in text: a line on stderr) and is skipped; the command s
58
58
 
59
59
  | `-m` | What runs |
60
60
  |---|---|
61
- | `auto`, or no `-m` | the user's list: #1, and the next one in order when it fails (with the user's "best fit" setting: their models ranked for each task, below). Use this unless you need one particular model. |
61
+ | `auto`, or no `-m` | the user's list: #1, and the next one in order when it fails (with the user's orchestrator setting: an orchestrator model first, below). Use this unless you need one particular model. |
62
62
  | `provider/model` (`-m groq/openai/gpt-oss-120b`), or a model of #1's provider alone | that model alone: never another one, also when it fails (a rate limit or an outage is tried again, up to `--max-retries`) |
63
63
  | that, plus `--fallback-model provider/model` (repeatable) | that model, then the fallbacks in order when it fails (as `claude -p --fallback-model`) |
64
64
 
@@ -80,12 +80,14 @@ image, one that can't call tools gets the tool calls as text.
80
80
 
81
81
  `--provider <name>` and `-u <url>` (a server for this run) also mean one model, alone.
82
82
 
83
- **Best fit** (the user's setting "Pick: the best for each task", on Your models in `heart settings`): with `auto`,
84
- each new message first names the skills the task needs (code, web pages, images, long inputs…) in
85
- one short request, and the user's models are ordered by their places in the public LMArena rankings
86
- of those skills (fetched once a week); the best leads, the next take over when it fails, and the
87
- code review goes to the best of the others. Models the rankings don't know come last, in the user's
88
- order. With "Your order" (the default), the list is the user's order, as is.
83
+ **Orchestrator** (the user's setting "Pick: an orchestrator hands it out", on Your models in
84
+ `heart settings`; `--model-choice fit` for one run): with `auto`, each message starts on one of the
85
+ models the user chose as orchestrators (none chosen: their first that calls tools). It answers
86
+ at once, streaming, when it can (a greeting, a question), and otherwise hands the work to the
87
+ user's other models through its `agent` tool. It picks which one, knowing what each can do and
88
+ its places in the public LMArena rankings. It has no other tool: the models it picks do the work. If no
89
+ orchestrator answers, the list goes on to the next model. With "in your order" (the default), the list
90
+ is the user's order, as is.
89
91
 
90
92
  A run picks up settings the user changes meanwhile (`heart settings`, another HeartCode, or
91
93
  `~/.heart` by hand) without being restarted, from its next request: the model order, prompts,
@@ -123,7 +125,9 @@ goes to stderr. Logs never go to stdout.
123
125
 
124
126
  ## Continue the same conversation
125
127
 
126
- Pass the `session_id` from the last result:
128
+ Every run is saved as a session in `~/.heart/sessions/` (and logged, for the kinds of logs the user
129
+ switched on), as when the user works in HeartCode; `--temp` keeps nothing. Pass the `session_id`
130
+ from the last result:
127
131
 
128
132
  ```sh
129
133
  heart -p --output-format json --resume 20261027-… "now add a test for the empty case"
@@ -146,10 +150,10 @@ can't switch the model you chose.
146
150
  | Everything (edits and commands) | `--permission-mode all` (the default unless the user set another) |
147
151
  | Changes kept apart from the user's files | `--worktree=<name>` (in a git repo): it works in `.heartcode/worktrees/<name>` on the branch `heartcode/<name>`; kept if anything changed (merge it from there), removed if nothing did |
148
152
  | A cap on how long it works | `--max-turns 30` (model steps), `--max-retries 3` (a failing provider) |
149
- | Nothing written to the user's `~/.heart` (sessions, logs, settings) | `--temp` (a throwaway copy, shared by the `--temp` runs going on at once) |
153
+ | Nothing kept: no session, logs, settings or notes in `~/.heart`, nothing in the project's `.heartcode/` | `--temp` (a throwaway copy, shared by the `--temp` runs going on at once, deleted after the last; the project's notes and research are read, and what the run adds goes with the copy) |
150
154
 
151
155
  Tool names: HeartCode's own (`read_file`, `edit_file`, `write_file`, `run_command`, `search`,
152
- `list_files`, `web_fetch`, `web_search`…) or Claude Code's (`Read`, `Edit`, `Write`, `Bash`,
156
+ `list_files`, `changes`, `web_fetch`, `web_search`…) or Claude Code's (`Read`, `Edit`, `Write`, `Bash`,
153
157
  `Grep`, `Glob`, `WebFetch`, `WebSearch`). `--disallowedTools Bash` takes one away. MCP servers'
154
158
  tools are named as in Claude Code: `mcp__<server>__<tool>`; `mcp__<server>` means all of one
155
159
  server's tools, `mcp` all of them. (The model itself reaches them through one `mcp` tool that lists
@@ -171,13 +175,17 @@ assumptions, and the user can set it up on the settings page. Models that can't
171
175
  work, in a slower guided mode.
172
176
 
173
177
  The model in use knows the user's other models (what each can do, how often it failed this
174
- session, and in best fit their ranks for code, web apps and vision) and works with them through its `agent` tool: it asks a model that can for what it
178
+ session, and with an orchestrator their ranks overall, for code, web apps and vision) and works with them through its `agent` tool: it asks a model that can for what it
175
179
  can't do itself (a model that can't see asks one that can about a screenshot: "which tiles show a
176
180
  chair?"), several at once when there are many images or parts, and a helper that fails is handed to
177
181
  the next capable model until one does the job. A helper works until its job is done (no step
178
182
  limit; `--max-turns` applies to it too). Their tokens are in `usage`, and each model's in
179
183
  `modelUsage`.
180
184
 
185
+ A long run that fills the model's context window is compacted: the model first writes down what it
186
+ has found, then the conversation so far is replaced by a summary that starts with those notes. That
187
+ is two extra requests, counted in `usage`, and not in the stream.
188
+
181
189
  ## Setting up a model
182
190
 
183
191
  Ask the user which provider and model to use, and for the key. Never invent one. Then:
@@ -191,7 +199,8 @@ HEART_API_KEY=… heart -u https://api.groq.com/openai/v1 -m openai/gpt-oss-120b
191
199
  ```
192
200
 
193
201
  A model server on this machine (Ollama on :11434, LM Studio on :1234, llama.cpp on :8080) is
194
- found on its own. The user can also set everything up in a browser: `heart settings`, where
202
+ found on its own. The user can also set everything up in a browser: `heart settings` (its link has
203
+ the machine's network address, so it opens from another device too, for HeartCode on a server), where
195
204
  **Test** (or **Test all**) under *Your models* sends a model a short message to show it really
196
205
  answers. A run that fails with a wrong key or an unknown model: ask the user to test it there.
197
206
 
@@ -254,8 +263,8 @@ Every `assistant` line's `message.model` is the model that wrote it (`provider/m
254
263
  fallback, the one that took over, not the one the run started with (the `init` line's `model`).
255
264
  `modelUsage` in the `result` has each model that answered.
256
265
 
257
- Not in the stream: HeartCode's own prompts (the system prompt, its nudges), the skill-picking
258
- request of best fit, the review's verdict and the wrap-up. Their tokens are in `usage` and
266
+ Not in the stream: HeartCode's own prompts (the system prompt, its nudges), the review's verdict
267
+ and the wrap-up. An orchestrator's handoffs are in it: `agent` tool calls, with the helper's lines under them. Their tokens are in `usage` and
259
268
  `modelUsage`. Retries and switches to another model go to stderr with `--verbose`.
260
269
 
261
270
  ## Don't
package/bin/heart.js CHANGED
@@ -52,10 +52,11 @@ if (temp) {
52
52
  fs.rmSync(dir, { recursive: true, force: true }) // left by a crashed run: from your settings again
53
53
  fs.mkdirSync(runs, { recursive: true })
54
54
  // your providers and keys; what HeartCode learned about each model and prices (or it tests them again)
55
- for (const f of ['config.json', 'models', 'prices.json']) if (fs.existsSync(path.join(realHome, f))) fs.cpSync(path.join(realHome, f), path.join(dir, f), { recursive: true })
55
+ for (const f of ['config.json', 'models', 'prices.json', 'memory']) if (fs.existsSync(path.join(realHome, f))) fs.cpSync(path.join(realHome, f), path.join(dir, f), { recursive: true })
56
56
  }
57
57
  fs.writeFileSync(path.join(runs, String(process.pid)), '')
58
58
  process.env.HEART_HOME = dir
59
+ process.env.HEART_TEMP = '1' // the project's .heartcode folders too: copies in here (config.js projectDir)
59
60
  process.on('exit', () => {
60
61
  fs.rmSync(path.join(runs, String(process.pid)), { force: true })
61
62
  if (!others().length) fs.rmSync(dir, { recursive: true, force: true })
@@ -77,7 +78,7 @@ if (first && !first.startsWith('-') && !SUBCOMMANDS.includes(first)) {
77
78
 
78
79
  // where the logs go, and this run's name for its folders (src/log.js: each kind of log is switched on
79
80
  // by itself in config.json's "logs", also while HeartCode runs)
80
- const logs = temp ? path.join(os.tmpdir(), 'heart-temp-logs') : path.join(realHome, 'logs')
81
+ const logs = temp ? path.join(process.env.HEART_HOME, 'logs') : path.join(realHome, 'logs') // --temp: deleted with its folder
81
82
  process.env.HEART_LOGS ??= logs
82
83
  let runStamp = stamp
83
84
  for (let n = 2; ['runs', 'requests'].some((d) => fs.existsSync(path.join(logs, d, runStamp))); n++) runStamp = `${stamp}-${n}` // two runs in the same second
package/bin/heartcode.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import path from 'node:path'
3
3
  import { parseArgs } from 'node:util'
4
4
  import { Client } from '../src/client.js'
5
- import { loadConfig, saveConfig, readJson, writeJson, providerName, CONFIG_FILE, HOME, AUTO_MODEL, isAuto, parseModel, takeIn, whatOf, VERSION } from '../src/config.js'
5
+ import { loadConfig, saveConfig, readJson, writeJson, providerName, CONFIG_FILE, HOME, TEMP, AUTO_MODEL, isAuto, parseModel, takeIn, whatOf, VERSION } from '../src/config.js'
6
6
  import { loadProfile, strategy, describe, profilePath, profileFrom } from '../src/probe.js'
7
7
  import { learnFromUsage, LIMIT_MS } from '../src/context.js'
8
8
  import { Session, transcript, contextReport } from '../src/agent.js'
@@ -59,9 +59,10 @@ ${c.bold('options')}
59
59
  --ask ask before every edit and command, this run
60
60
  --hide-thinking collapse the model's thinking to one line
61
61
  -C, --cwd <dir> project folder (default: current folder)
62
- --temp a throwaway settings folder (your providers, model tests and prices
63
- copied in), shared by the --temp runs going on at once and deleted
64
- after the last; ~/.heart isn't touched
62
+ --temp keep nothing: a throwaway settings folder (your providers, model info,
63
+ prices and notes copied in), shared by the --temp runs going on at once
64
+ and deleted after the last, with its logs; ~/.heart and the project's
65
+ .heartcode/ aren't touched (their notes and research are read from a copy)
65
66
  --context <n> context window size in tokens
66
67
  --save keep the given -u/-m/--api-key/... in ${CONFIG_FILE}
67
68
  -w, --worktree work in a new git worktree and branch (--worktree=name to name it,
@@ -79,7 +80,7 @@ ${c.bold('headless')} (for other programs; flags and output as in Claude Code's
79
80
  --skills-dir <dir> more skills (repeatable)
80
81
  --allowedTools <list> only these tools (HeartCode's or Claude Code's names: Read, Edit, Bash…)
81
82
  --disallowedTools <list> never these tools
82
- --model-choice <order|fit> your models' order (#1, then the next), or the best fit for each task
83
+ --model-choice <order|fit> your models' order (#1, then the next), or fit: an orchestrator hands each task out
83
84
  --permission-mode <m> all, commands, ask, plan (or bypassPermissions, acceptEdits, default);
84
85
  --dangerously-skip-permissions = all. Nothing is asked: the rest is declined
85
86
  --session-id <id> start (or continue) the session with this id
@@ -238,6 +239,7 @@ class App {
238
239
  }
239
240
 
240
241
  saveProjectModels() {
242
+ if (TEMP) return // --temp keeps nothing: the choice lasts for this run only
241
243
  const file = path.join(this.root, '.heartcode', 'models.json')
242
244
  if (this.cfg.session?.length) writeJson(file, { session: this.cfg.session.map((t) => ({ provider: t.provider, model: t.model })) })
243
245
  else fs.rmSync(file, { force: true }) // auto: forget the folder's choice
@@ -676,7 +678,7 @@ class App {
676
678
  const rotated = rot && rot.at > 0
677
679
  const name = rotated ? c.yellow('↻ ' + now.model) : c.info(now.model)
678
680
  const model =
679
- count === 1 ? name : cfg.session ? `${name} ${c.faint(`(${count} chosen)`)}` : `${c.muted(fitMode(cfg) ? 'best fit' : 'auto')} ${c.faint('(')}${name}${c.faint(')')} ${c.faint(`(${count})`)}`
681
+ count === 1 ? name : cfg.session ? `${name} ${c.faint(`(${count} chosen)`)}` : `${c.muted(fitMode(cfg) ? 'orchestrated' : 'auto')} ${c.faint('(')}${name}${c.faint(')')} ${c.faint(`(${count})`)}`
680
682
  const key = `${now.provider}/${now.model}`
681
683
  if (this.profileKey !== key) [this.profileKey, this.profile] = [key, this.s?.profile ?? loadProfile(this.client(now.provider, now.model))]
682
684
  const profile = this.s?.profile ?? this.profile
@@ -775,8 +777,8 @@ class App {
775
777
  Object.assign(this.s, { noFormat: cfg.format === false, noLsp: cfg.lsp === false })
776
778
  Object.assign(this.s, { mcp: this.mcp, memory: this.memory, skills: this.skills, director: this.director })
777
779
  this.s.team = () => this.team() // your other models: a job this one can't do goes to one of them
778
- this.s.allModels = () => this.sessionModels().map((t) => ({ ...t, ...this.abilities(t) })) // all of them, for a best-fit pick
779
- this.s.fitMode = () => fitMode(this.cfg) // models picked by strengths per message, not by the list's order
780
+ this.s.fitMode = () => fitMode(this.cfg) // an orchestrator hands each message's work out, not your list's order
781
+ this.s.orchestrators = () => this.orchestrators()
780
782
  this.s.engineFor = (t) => this.engine(t.provider, t.model, ui, undefined, { quiet: true })
781
783
  // A model's context window, read from its saved profile (no probe, no network): so the agent can
782
784
  // see, before compacting, whether another model in the list has room for the whole conversation.
@@ -806,6 +808,7 @@ class App {
806
808
  .filter((t) => cfg.providers[t.provider] && t.model && !seen.has(`${t.provider}/${t.model}`) && seen.add(`${t.provider}/${t.model}`))
807
809
  .map((t) => ({ ...t, baseUrl: cfg.providers[t.provider].baseUrl, apiKey: cfg.providers[t.provider].apiKey }))
808
810
  this.s?.client.setRotation(list, cfg.rotation ?? {})
811
+ if (fitMode(cfg)) this.s?.client.orderBy(this.orchestrators().map((t) => `${t.provider} ${t.model}`)) // the first orchestrator answers first (and the status bar shows it)
809
812
  }
810
813
 
811
814
  async use(name, model) {
@@ -820,13 +823,23 @@ class App {
820
823
  // models.dev: nothing is sent to them to find out.
821
824
  team() {
822
825
  // helpers use this session's models (the set you chose, else your list), minus the one in use —
823
- // so a pinned single model gives no team, and a chosen set keeps helpers within it
826
+ // so a pinned single model gives no team, and a chosen set keeps helpers within it. While one
827
+ // orchestrates: minus the orchestrators too (they only hand work out)
824
828
  const now = this.s?.client.rotation?.list[this.s.client.rotation.at] ?? this.sessionModels()[0]
829
+ const lead = this.s?.orchestrating ? this.orchestrators() : []
825
830
  return this.sessionModels()
826
- .filter((t) => !(t.provider === now?.provider && t.model === now?.model))
831
+ .filter((t) => ![now, ...lead].some((o) => t.provider === o?.provider && t.model === o?.model))
827
832
  .map((t) => ({ ...t, ...this.abilities(t) }))
828
833
  }
829
834
 
835
+ // The models that orchestrate (Pick: "an orchestrator hands it out"): those picked on Your models
836
+ // that are in this session's set and call tools; none picked: your first that calls tools.
837
+ orchestrators() {
838
+ const mine = this.sessionModels().filter((t) => this.abilities(t).tools)
839
+ const picked = mine.filter((t) => (this.cfg.orchestrators ?? []).some((o) => o.provider === t.provider && o.model === t.model))
840
+ return picked.length ? picked : mine.slice(0, 1)
841
+ }
842
+
830
843
  // What a model can do, from its saved profile or models.dev (guessed: neither knows it).
831
844
  abilities(t) {
832
845
  const cl = this.client(t.provider, t.model)
@@ -856,7 +869,7 @@ class App {
856
869
  const rot = this.s?.client.rotation
857
870
  if (rot) return rot.list[rot.at]
858
871
  if (this.s) return { provider: this.s.client.provider, model: this.s.client.model }
859
- return this.sessionModels()[0] ?? null
872
+ return (fitMode(cfg) ? this.orchestrators()[0] : null) ?? this.sessionModels()[0] ?? null
860
873
  }
861
874
 
862
875
  // your list has models, but the providers of all of them are switched off
@@ -1174,7 +1187,7 @@ let settingsPage = null
1174
1187
 
1175
1188
  // The browser, with a page. Windows: its URL handler (cmd's start mangles a URL whose arguments
1176
1189
  // it reads as its own, and wants a quoted empty title first).
1177
- // How HeartCode picks your models: "fit" (by strengths, per message) or your order; --model-choice for this run wins.
1190
+ // How HeartCode picks your models: "fit" (an orchestrator hands the work out) or your order; --model-choice for this run wins.
1178
1191
  let modelChoiceFlag
1179
1192
  const fitMode = (cfg) => (modelChoiceFlag ?? cfg.modelChoice) === 'fit'
1180
1193
 
@@ -1198,7 +1211,7 @@ function applySettings(apps, cfg, what) {
1198
1211
  const { ui } = app
1199
1212
  const busy = Boolean(ui.busySince || app.working)
1200
1213
  const now = (fn) => (busy ? app.later.push(fn) : fn())
1201
- if (app.cfg !== cfg) for (const k of ['providers', 'provider', 'model', 'effort', 'theme', 'context', 'autoCompact', 'director', 'format', 'lsp', 'voice', 'rotation', 'statusBar']) app.cfg[k] = cfg[k]
1214
+ if (app.cfg !== cfg) for (const k of ['providers', 'provider', 'model', 'effort', 'theme', 'context', 'autoCompact', 'director', 'format', 'lsp', 'voice', 'rotation', 'statusBar', 'modelChoice', 'orchestrators']) app.cfg[k] = cfg[k]
1202
1215
  // a model pinned in this CLI (/select_model) is a session choice: a model/order change on the
1203
1216
  // settings page leaves it alone (only /select_model auto here returns it to the list)
1204
1217
  if (what === 'model' && !app.cfg.session) {
@@ -1206,8 +1219,8 @@ function applySettings(apps, cfg, what) {
1206
1219
  if (app.s && !(cfg.providers[cfg.provider] && cfg.model)) now(() => ((app.s = null), ui.print(c.dim('settings: no model chosen'))))
1207
1220
  else if (app.s && !app.myModels().length) now(() => ((app.s = null), ui.print(c.dim('settings: the providers of all your models are switched off'))))
1208
1221
  }
1209
- // your model list: into the running session now, its next request goes to the new #1
1210
- if ((what === 'model' || what === 'setting:rotation') && !app.cfg.session && app.s && cfg.providers[cfg.provider] && cfg.model) {
1222
+ // your model list: into the running session now, its next request goes to the new #1 (or orchestrator)
1223
+ if (['model', 'setting:rotation', 'setting:modelChoice', 'setting:orchestrators'].includes(what) && !app.cfg.session && app.s && cfg.providers[cfg.provider] && cfg.model) {
1211
1224
  const was = `${app.s.client.provider} · ${app.s.client.model}`
1212
1225
  app.useRotation()
1213
1226
  const is = `${app.s.client.provider} · ${app.s.client.model}`
@@ -1443,7 +1456,7 @@ async function slash(app, line, working = false) {
1443
1456
  return ui.showText('Commands and keys', app.help())
1444
1457
  case 'update': {
1445
1458
  ui.spinner('asking npm for the newest HeartCode')
1446
- const u = await checkUpdate({ force: true })
1459
+ const u = await checkUpdate()
1447
1460
  ui.stopSpin()
1448
1461
  if (!u) return ui.warn("couldn't reach npm to check for a newer HeartCode")
1449
1462
  app.update = u
@@ -1827,7 +1840,7 @@ async function repl(app, f = {}) {
1827
1840
  // models this folder picked earlier (/select_model): said, with the way back to your whole list
1828
1841
  if (app.folderModels && cfg.session?.length) ui.print(`${c.muted('this folder uses')} ${c.cyan(cfg.session.map((t) => t.model).join(', '))} ${c.faint(`(picked earlier) · ${c.cyan('/select_model auto')} for your whole list again`)}`)
1829
1842
  app.tabs?.onChange?.() // the conversation it opened with
1830
- // a newer HeartCode: asked in the background (once a day at most), said once and kept in the status bar
1843
+ // a newer HeartCode: asked of npm in the background at every start, said once and kept in the status bar
1831
1844
  if (cfg.updateCheck !== false)
1832
1845
  checkUpdate()
1833
1846
  .then((u) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heartcode",
3
- "version": "0.1.41",
3
+ "version": "0.1.44",
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
@@ -50,6 +50,7 @@ A tool or package the plan needs that isn't installed: find the right way for th
50
50
 
51
51
  ## Prove it works, then stop
52
52
  Never say done, fixed or working without having just run what proves it and read its output. "It should work" and "no syntax error" are not proof. Check it the way the person who asked will use it: run it, use it with real input and an edge case, look at what it shows, read its errors; stop what you started. Tests there: run them.
53
+ Before you say done, read your whole change (the changes tool) and find what uses what you changed: the callers of a function you changed, everything that reads a name, value or format you renamed or reshaped. Update them too.
53
54
  A real bug: fix the cause, run it again, until it works end to end. The proof passes: stop — no polish, cleanup or extra tests after. A review point (HeartCode's, a reviewer's, a helper's): check it against the code first; wrong: say why and don't do it.
54
55
  When you made something that runs, end with how to run it: the exact command(s) from the project folder and the URL to open.
55
56
 
@@ -81,12 +82,12 @@ How to use {{server}}, in its own words (said once):
81
82
  ## output-cut
82
83
 
83
84
  <!-- After the start of a tool result too long for the conversation. {{shown}}, {{total}}: characters; {{file}}: where all of it is (empty if it couldn't be saved). -->
84
- [Output cut: the first {{shown}} of {{total}} characters are above.{{#if file}} All of it is in {{file}}: read the rest with read_file (start_line, end_line) or find what you need in it with search (path: that file).{{else}} Ask for less of it at a time.{{/if}}]
85
+ [Shortened to fit the conversation, not an error: the tool ran normally and its result is complete; only the first {{shown}} of {{total}} characters are shown above.{{#if file}} All of it is in {{file}}: read the rest with read_file (start_line, end_line) or find what you need in it with search (path: that file).{{else}} Ask for less of it at a time.{{/if}}]
85
86
 
86
87
  ## output-old
87
88
 
88
89
  <!-- Replaces an older tool result (all but the newest few long ones) once there are many. {{call}}: what the call was ("run_command npm test"); {{total}}: its length; {{file}}: where all of it is (may be empty). The first lines follow it. -->
89
- [older output of {{call}}, {{total}} characters{{#if file}} — all of it is in {{file}}: read_file it (start_line/end_line) or search in it if you need it again{{/if}}. Its first lines:]
90
+ [older output of {{call}}, {{total}} characters, shortened to save room (it ran normally then){{#if file}} — all of it is in {{file}}: read_file it (start_line/end_line) or search in it if you need it again{{/if}}. Its first lines:]
90
91
 
91
92
  ## empty-reply
92
93
 
@@ -132,7 +133,11 @@ Read a file; returns numbered lines. For part of a big file, give start_line and
132
133
 
133
134
  ## tool-search
134
135
 
135
- Find text or a regex in the project's files (or only in `path`). Returns file:line: text.
136
+ Find text or a regex in the project's files (or only in `path`: a file, a folder, or a pattern like `src/*.css`). Returns file:line: text.
137
+
138
+ ## tool-changes
139
+
140
+ What you changed in files for this message, as a diff: each file from before your first change to now (with `all`: everything changed in this conversation; with `path`: that file only). Read it before you say done, to see your whole change at once.
136
141
 
137
142
  ## tool-list_files
138
143
 
@@ -239,20 +244,44 @@ Which of your models does the job (from "Your other models" in the system prompt
239
244
 
240
245
  ## team
241
246
 
242
- <!-- In the system prompt when the user set up other models. {{models}}: one per line with what each can do (and failures this session). {{you}}: what this model can do. {{ranked}}: best fit's rankings are shown. -->
247
+ <!-- In the system prompt when the user set up other models. {{models}}: one per line with what each can do (and failures this session). {{you}}: what this model can do. {{ranked}}: the rankings are shown (with an orchestrator). -->
243
248
  # Your other models
244
249
 
245
250
  Besides you (tool calls, {{you}}), the user set up these models:
246
251
  {{models}}
247
252
 
248
253
  Work with them through the agent tool: "model" picks one, "images" gives it images to look at.
249
- {{#if ranked}}"ranked": its place in public rankings (LMArena) of coding, web apps and vision — #1 is the best of hundreds of models.
254
+ {{#if ranked}}"ranked": its place in public rankings (LMArena) overall, of coding, web apps and vision — #1 is the best of hundreds of models.
250
255
  {{/if}}
251
256
  - Hand a part to the one best at it, independent parts at the same time, while you plan, put it together and check. A small job: do it yourself.
252
257
  - Can't do something (see an image, read more than fits): never decline or guess — ask a model that can, the ability first; not one that keeps failing.
253
258
  - Ask for what you need to act, in the form you need it ("which of tiles 1-9 show a chair? the numbers only"), not for a description. A loop that needs the ability at every step (look, act, look again) goes whole to a model that has it.
254
259
  - Helpers share the browser and MCP servers (they take turns using one); never give two helpers the same files. A helper that fails goes to your next capable model; an answer that doesn't settle it: ask again, sharper. Trust a clear answer; don't redo its work.
255
260
 
261
+ ## orchestrator
262
+
263
+ <!-- The system prompt of the orchestrator (Pick: "an orchestrator hands it out"): it answers or hands the work out, nothing else. {{models}}: the models it hands work to, one per line with what each can do. {{ranked}}: their rankings are shown. -->
264
+ You are HeartCode's orchestrator, in the terminal, in the user's project at {{root}} ({{env}}; today is {{today}}). You don't do the work yourself and you have no tools for it: you talk with the user and hand work to the models below, with the agent tool.
265
+
266
+ The models you hand work to:
267
+ {{models}}
268
+ {{#if ranked}}"ranked": its place in public rankings (LMArena) overall, of coding, web apps and vision — #1 is the best of hundreds of models.
269
+ {{/if}}
270
+ - A greeting, a question you can answer well from what you know or from this conversation: answer it yourself, now. Nothing to hand out.
271
+ - Anything that needs the project's files, commands, the web or real work: hand it to the model that suits it best ("model"). It has every tool but sees only your prompt, not this conversation: give it the whole task, what the user said they want, and what to report back.
272
+ - Independent parts can go to several models at once (several agent calls in one reply). A model that fails is replaced on its own; an answer that doesn't settle it: ask again, sharper, or ask another model.
273
+ - When the work comes back, tell the user what was done, plainly and short. Don't claim more than the reports say.
274
+
275
+ ## tool-hand
276
+
277
+ <!-- The agent tool's description for the orchestrator. -->
278
+ Hand work to one of the models in the system prompt. It works with every tool (files, commands, web) in its own fresh context and sees only your prompt, so say exactly what to do and what to report. Its final reply comes back as the result. description: 3-5 words for the user. Several calls in one reply run at the same time.
279
+
280
+ ## tool-hand-model
281
+
282
+ <!-- The agent tool's "model" for the orchestrator. -->
283
+ Which model does it, as "provider model" from the system prompt's list. Left out: the first of them.
284
+
256
285
  ## you-see
257
286
 
258
287
  <!-- In the system prompt of a model that can see images (models that can often say they can't). -->
@@ -487,19 +516,6 @@ Put them together now: read what they changed, make what's still needed between
487
516
  <!-- Added to the todo tool's result once a message, when a plan has three or more open parts and none runs side by side or on another model. -->
488
517
  (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.)
489
518
 
490
- ## pick-skills
491
-
492
- <!-- Its own request at the start of a message, in "best fit" mode: the skills the task needs, so your models can be ranked for it (rankings.js). {{task}}: the user's message; {{choices}}: their answers about how to do it; {{skills}}: the skills to choose from, one per line. -->
493
- Which skills does this coding task need most? The task:
494
- {{task}}
495
- {{#if choices}}How the user wants it: {{choices}}
496
- {{/if}}
497
- The skills:
498
- {{skills}}
499
-
500
- Name the 1 to 3 that matter most for doing it well, most important first. Reply with one line and nothing else:
501
- skills: name, name
502
-
503
519
  ## same-spot
504
520
 
505
521
  <!-- Added to an edit's result when it's the third change to the same spot (the same file, within a few lines) in this message. {{file}}, {{line}}: where. -->
@@ -10,6 +10,12 @@ its section into ~/.heart/prompts/compact.md (every project) or .heartcode/promp
10
10
  <!-- System prompt of the summary request. -->
11
11
  You write summaries of conversations between a user and a coding assistant. You don't continue the work and you can't use tools: you only write the summary, as plain text.
12
12
 
13
+ ## findings
14
+
15
+ <!-- Asked of the model doing the task, as the next message of its own conversation, just before the
16
+ conversation is compacted. Its reply leads the summary that replaces the conversation. -->
17
+ The earlier part of this conversation is about to be replaced by a summary, and your reasoning so far will be gone. Write down now what you'd need to carry on without reading everything again: what you found and concluded (causes, decisions, what works and what doesn't), where things are (files, lines, names), what's done, and what's next. Plain notes, only what matters. Don't call tools.
18
+
13
19
  ## summarize-again
14
20
 
15
21
  <!-- Added when the first reply wasn't a summary (empty, or a tool call). -->
@@ -37,9 +43,16 @@ Write it as compact notes. No preamble, no tool calls.
37
43
 
38
44
  ## summary
39
45
 
40
- <!-- Replaces the compacted part of the conversation. {{summary}}: the summary.
46
+ <!-- Replaces the compacted part of the conversation. {{summary}}: the summary; {{findings}}: the
47
+ model's own notes of what it had found, written just before (may be empty).
41
48
  {{requests}}: the user's messages so far, word for word ("- …" lines; may be empty). -->
42
- This conversation was compacted to save space. Summary of everything before this point:
49
+ This conversation was compacted to save space.{{#if findings}}
50
+
51
+ Your own notes, written just before, of what you had found:
52
+
53
+ {{findings}}{{/if}}
54
+
55
+ Summary of everything before this point:
43
56
 
44
57
  {{summary}}{{#if requests}}
45
58
 
package/src/acp.js CHANGED
@@ -14,7 +14,7 @@ import { HeadlessUI } from './headless.js'
14
14
  import { PERMISSIONS } from './ui.js'
15
15
  import { loadChat } from './sessions.js'
16
16
 
17
- const KIND = { read_file: 'read', list_files: 'search', search: 'search', edit_file: 'edit', write_file: 'edit', run_command: 'execute', web_fetch: 'fetch', web_search: 'fetch', todo: 'think', agent: 'think' }
17
+ const KIND = { read_file: 'read', changes: 'read', list_files: 'search', search: 'search', edit_file: 'edit', write_file: 'edit', run_command: 'execute', web_fetch: 'fetch', web_search: 'fetch', todo: 'think', agent: 'think' }
18
18
  const plain = (s) => String(s ?? '').replace(/\x1b\[[0-9;]*m/g, '')
19
19
 
20
20
  // The screen for one session: everything goes to the editor as session/update.