heartcode 0.1.37 → 0.1.41

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.
@@ -0,0 +1 @@
1
+ {"sessionId":"4639584a-9f21-4557-8aab-bb929b2c0d12","pid":1642,"procStart":"Mon Nov 2 08:59:52 2026","acquiredAt":1793649027261}
package/CHANGELOG.md CHANGED
@@ -2,6 +2,105 @@
2
2
 
3
3
  What changed in each version of HeartCode, newest first.
4
4
 
5
+ ## 0.1.41 (2026-11-03)
6
+
7
+ - **Model scores on Your models**: Coding, Web apps and Vision show each model's LMArena score with
8
+ its place (`1478 #60`; hover for the votes); green is the top tenth. The page opens fast again
9
+ with thousands of models (each name matched once, not once per ranking entry).
10
+ - **Your models in three rows**: the title with Order providers and Update model info (models.dev
11
+ and the scores in one click); the settings on one line with short names (Pick, If one fails, Give
12
+ up after, New message to, Tests wait); search, filters, the count, Clear, Test all and Save order
13
+ on one line. The sort shows in the column heads.
14
+ - **Best fit said plainly**: with Pick on "the best for each task", the page and the sidebar say
15
+ each message goes to the models that score best for it (not "HeartCode uses #1"), and Order
16
+ providers is off, with why on hover.
17
+ - **The list holds still while models are tested** (or Update model info runs): filters, sorting,
18
+ the settings, dragging and each row's changes wait; Stop and Request still work.
19
+ - **Settings from another device**: the link shows your machine's network address
20
+ (`http://192.168.1.108:43135/?t=…`) and the page answers there; only with its key, and only to
21
+ this machine's addresses.
22
+ - **Slash commands leave nothing behind**: a command shows a toast for a few seconds; what it shows
23
+ opens in a dialog, and nothing stays in the conversation.
24
+ - **/import asks before a duplicate**: one you already have (same name, same text, or the same MCP
25
+ server under another name) is marked, and added only if you say so, under a new name.
26
+ - **Removed**: /test_model and `heart probe` (models.dev says what a model can do), and the
27
+ settings only those tests could switch on.
28
+
29
+ ## 0.1.40 (2026-11-03)
30
+
31
+ - **A smaller, general system prompt** (about 6,700 tokens to start a task, from 13,000+): its rules
32
+ in working order (ask what they want → research and plan → find your way → write code → install
33
+ tools → prove it works, then stop → keep going → how to answer), the discipline skill merged into
34
+ them (no separate copy), nothing about one kind of project: a check is "the way the person will use
35
+ it", for a page, a script or a server alike. Gone: the web UI guide, the reminder on every
36
+ message, the automatic page review with screenshots, and asking models what they're good at
37
+ (best fit's rankings do that). Your other models in a short list; an MCP server's own
38
+ instructions sent once, the first time its tool is used.
39
+ - **Your terminal's mouse**: HeartCode no longer takes the mouse, so text is selected and copied the
40
+ terminal's own way, over SSH too (to the computer you connect from). `"mouse": true` in config.json
41
+ brings back the wheel scrolling the conversation and drag to copy.
42
+ - **A model that doesn't start answering** within the time allowed: a helper, the image describer or
43
+ the reviewer goes to your next model at once, not after three more waits.
44
+ - **Gemini, then another model**: Gemini's tool-call signature goes back to Gemini only; Mistral and
45
+ others refused the request with it (422).
46
+ - **/update's changelog** wrapped at words, not mid-word, and a list item's lines joined.
47
+ - Lessons learned from a fixed mistake are tagged by the tool that failed (npm, python3, cargo…).
48
+
49
+ ## 0.1.39 (2026-11-03)
50
+
51
+ - **Best fit picks by public rankings**, not by a model's opinion of models: for each new message,
52
+ one short request names the skills the task needs (web pages, code, images, long inputs…), and
53
+ your models are ranked by their places in LMArena's rankings of those skills (people comparing
54
+ two models' answers, per skill). The best becomes the lead, the next take over when it fails; the
55
+ code review and the page review go to the best-ranked others (not the lead). Models the rankings
56
+ don't know come after, in your order. The rankings are fetched once a week into
57
+ ~/.heart/rankings.json, and only in best fit: with "your order", your list is followed as it is.
58
+ - **Your models shows each model's ranks**: Coding, Web apps and Vision columns (its place in
59
+ LMArena's ranking; the top tenth in green), sortable like the others, with Get rankings /
60
+ Refresh rankings above the list.
61
+ - **Gemini 3.x works with tools**: the thought signature Gemini sends with each tool call is kept
62
+ and sent back, so its second step is no longer refused (400 "missing a thought_signature").
63
+
64
+ ## 0.1.38 (2026-11-02)
65
+
66
+ - **Asks what you want before building**: the questions whose answers change the result (what it's
67
+ for, looks, testing, robustness, scope), in rounds, each with a recommended answer; again for a
68
+ new message that leaves things open. The answers are kept with the conversation and steer the
69
+ checks and reviews: a demo isn't sent back for polish or tests nobody asked for. The UI guide and
70
+ the page review only go for looks when looks were asked for. When it made something that runs, it
71
+ ends with how to run it.
72
+ - **The discipline skill**, built in and always on (from Karpathy's guidelines, Grill Me,
73
+ Superpowers, Ponytail and Caveman): think first, ask in rounds, root cause first, done-when and
74
+ non-goals, the least code that works, surgical changes, test first when tests are wanted, evidence
75
+ before claims, stop when proven, answers kept short. Skills with `use: always` go in every message;
76
+ Make my own copy on the settings page to change it or turn it off.
77
+ - **Your models, by strength**: what each model is good and weak at is learned once (a web search,
78
+ kept in model-strengths.json for every project) and shown to the model with your test results.
79
+ The plan's parts can go to other models at the same time (parallel, model, files), each helper
80
+ changing only its own files. **Best fit** (Your models → HeartCode picks the model by): for each
81
+ new message the models that suit it best do the work, review it and check pages; your order breaks
82
+ ties. `--model-choice order|fit` for one run.
83
+ - **Nothing hangs**: every command can carry on in the background, the model choosing how long to
84
+ wait and checking back; processes a command leaves running (`server &`) are kept as background
85
+ commands instead of killed. A reply must start within 60 seconds (Your models: A reply must start
86
+ within), then the next model answers; reviews, picks and summaries are streamed too, so a silent
87
+ model is given up on.
88
+ - **Nothing lost**: the conversation is saved after every step, so a crash or kill mid-task loses
89
+ nothing and "continue" picks it up; the answers to its questions and folders named earlier come
90
+ back too.
91
+ - **Logs, kind by kind**: requests, tools & commands, model choices, the agent's decisions, errors,
92
+ the conversation, debug, each switched on by itself (all off by default), a file per kind per run;
93
+ read on the settings page by run, searched and live.
94
+ - **Updates**: a newer HeartCode is shown at start and in the status bar (asked of npm once a day);
95
+ `/update` shows what changed and installs it the way you installed HeartCode (a git checkout:
96
+ git pull). Check for updates on General.
97
+ - Reads folders your message names (read only, outside the project); MCP arguments mended from the
98
+ tool's schema (a missing page id, msgId for msgid, a value for a list…); page syntax errors with
99
+ their line; "enough checks" after five with nothing changed; a nudge at the third change to the
100
+ same spot; plan-first holds back the whole reply.
101
+ - Scrolled up, the conversation stays where you're reading while the answer comes in;
102
+ Alt+Shift+↑/↓ (or Ctrl+Home/End) to its top and bottom.
103
+
5
104
  ## 0.1.37 (2026-11-02)
6
105
 
7
106
  - Settings page, Your models: filters (search, provider, test result with counts, context, tools,
package/README.md CHANGED
@@ -52,9 +52,21 @@ tried did what I needed:
52
52
  - **Set up in a web page** on your own machine (`/settings`), not by editing config files.
53
53
  - **Usable by other tools and AI agents**: `heart -p` runs one task headless, like `claude -p`
54
54
  (see [SKILL.md](SKILL.md)).
55
- - **Logs each request and its reply** in a file of its own when you switch logging on, so you can
56
- see what went wrong.
55
+ - **Logs what you need, nothing else**: seven kinds, each switched on by itself (all off by
56
+ default): requests, tools & commands, model choices, the agent's decisions, errors, the
57
+ conversation, debug. Read them on the settings page, searched and live.
57
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):
60
+ `/update` shows what changed and installs it the way you installed HeartCode. Switch it off in
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.
66
+ - **Works with discipline by default**: its rules (from Karpathy's guidelines, Grill Me,
67
+ Superpowers, Ponytail and Caveman) have it ask before building, find a bug's root cause first,
68
+ write the least code that works, change only what the task needs, prove it before saying done,
69
+ then stop, and answer short. A skill with `use: always` adds rules of your own to every message.
58
70
  - **Tabs** (`Alt+T`), each with its own conversation, and git worktrees for work kept apart.
59
71
  - **Servers and watchers in the background**: the model starts one and goes on working, reads its
60
72
  output when it needs to, and stops it. `Alt+B` (or `/background`) shows their logs live above the input,
@@ -93,9 +105,11 @@ heart
93
105
 
94
106
  ### 3. Open the settings page
95
107
 
96
- Type `/settings`. The settings page opens in your browser. It runs on your machine only
97
- (127.0.0.1, with a secret key in its link). A running HeartCode picks up what you change right
98
- away.
108
+ Type `/settings`. The settings page opens in your browser. The link shown has your machine's
109
+ network address (like `http://192.168.1.108:43135/?t=…`), so it opens from another device on the
110
+ same network too: HeartCode on a server over SSH, the page on your laptop. Only that link works:
111
+ it has a secret key, and the page answers only to this machine's own addresses. A running
112
+ HeartCode picks up what you change right away.
99
113
 
100
114
  <!-- image: the settings page -->
101
115
  ![The settings page](https://res.cloudinary.com/m0jnrul4/image/upload/v1793485584/8396c407-f5f8-48af-a242-0b5cbc1c0331.png)
@@ -108,7 +122,7 @@ The sidebar, in four groups:
108
122
  effort, voice input, web search: your own SearXNG and the engines' order, and which outside tools are ready) and *Status bar* (drag and drop what the
109
123
  bottom lines show, with a live preview). **Notifications**: Telegram.
110
124
  - **Skills**, **MCP servers** and **System prompt**: what HeartCode can do and how it's told.
111
- - **Advanced**: *Logs* (requests and runs) and *Files* (the rest of the settings, as files).
125
+ - **Advanced**: *Logs* (seven kinds, each on or off, and a viewer) and *Files* (the rest of the settings, as files).
112
126
 
113
127
  ### 4. Add a provider and pick models
114
128
 
@@ -126,15 +140,15 @@ On **Models → Your list**:
126
140
  1. **Sort them by context and abilities.** Click the *Abilities* column, then *Context*: the
127
141
  models that can do the most come first, the biggest context window first among those (each
128
142
  column clicked breaks the ties of the ones before; click one again to reverse it, a third time to
129
- drop it). Click **Save list** to keep it.
143
+ drop it). Click **Save order** to keep it.
130
144
  2. **Rearrange a bit more.** Drag a row to move it. #1 is the one HeartCode uses; the others are
131
145
  its fallbacks, tried in order.
132
146
  3. **Test them** (optional): **Test all** sends each a short message and shows which really answer.
133
- Each test waits up to 10 seconds; the **Timeout** box next to it changes that.
147
+ Each test waits up to 10 seconds; **Tests wait**, above the list, changes that.
134
148
  4. **Filter them** (optional): by name, provider, test result (works, doesn't, not tested, or one
135
- error like 402), context, tools, thinking, images or free. **Test all** then tests only the ones
136
- shown, and **Use these N** makes them the models HeartCode uses, in the order you see (the others
137
- stay under Providers). Filter to the working ones, sort by Works?, Use these: HeartCode uses your
149
+ error like 402), context, tools, thinking, images or free. **Test N** then tests only the ones
150
+ shown, and **Use only these N** makes them the models HeartCode uses, in the order you see (the others
151
+ stay under Providers). Filter to the working ones, sort by Works?, Use only these: HeartCode uses your
138
152
  working models, fastest first.
139
153
 
140
154
  If a model says *not found* in models.dev, **Retry** looks it up again, or **Set up** tells
@@ -145,7 +159,8 @@ HeartCode what it can do.
145
159
  - **Notifications**: a Telegram message when a task finishes, fails or waits for you. Make a bot
146
160
  with [@BotFather](https://t.me/BotFather), paste its token, press Start in the bot, and
147
161
  HeartCode finds your chat.
148
- - **Advanced → Logs**: a log of each run, and each request with its reply, in files of their own.
162
+ - **Advanced → Logs**: switch on only the kinds you need (requests, tools & commands, model choices,
163
+ the agent's decisions, errors, the conversation, debug), and read them there: by run, searched, live.
149
164
  Logs older than 3 days are deleted (you can change that).
150
165
 
151
166
  ### 7. Back to HeartCode
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. 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 "best fit" setting: their models ranked for each task, 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,6 +80,13 @@ 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.
89
+
83
90
  A run picks up settings the user changes meanwhile (`heart settings`, another HeartCode, or
84
91
  `~/.heart` by hand) without being restarted, from its next request: the model order, prompts,
85
92
  hooks, skills, MCP servers. `--temp` runs share one throwaway folder, so a change in one reaches the
@@ -126,7 +133,9 @@ heart -p --continue "…" # or: the last session in this folder
126
133
  ## Keep it safe
127
134
 
128
135
  Headless never asks anyone. What the permission mode would ask about is declined, and the
129
- model is told why. An MCP tool its server marks read-only is never asked about. The model can't
136
+ model is told why. A question the model would ask the user (what to build, how it should look,
137
+ what testing) it decides itself, and says in its reply what it assumed: put the choices that
138
+ matter in the prompt. An MCP tool its server marks read-only is never asked about. The model can't
130
139
  give itself a freer permission mode (its `manage` tool asks the user, so headless refuses it), and
131
140
  can't switch the model you chose.
132
141
 
@@ -162,7 +171,7 @@ assumptions, and the user can set it up on the settings page. Models that can't
162
171
  work, in a slower guided mode.
163
172
 
164
173
  The model in use knows the user's other models (what each can do, how often it failed this
165
- session) and works with them through its `agent` tool: it asks a model that can for what it
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
166
175
  can't do itself (a model that can't see asks one that can about a screenshot: "which tiles show a
167
176
  chair?"), several at once when there are many images or parts, and a helper that fails is handed to
168
177
  the next capable model until one does the job. A helper works until its job is done (no step
@@ -191,7 +200,7 @@ answers. A run that fails with a wrong key or an unknown model: ask the user to
191
200
  | Flag | |
192
201
  |---|---|
193
202
  | `--append-system-prompt "<text>"` | your instructions for this run, at the end of the system prompt. HeartCode's own part then says less (no role of its own, no "stay in the project folder", no way of finishing of its own) and tells the model to follow yours where they differ; its `manage` tool is left out, and nothing from the run's messages is saved to its memory |
194
- | `--mcp-config <file or JSON>` | more MCP servers (repeatable); `--strict-mcp-config`: only those. The model sees every server's tools by name, one line each, and gets a tool's arguments when it uses it (a call that doesn't fit them comes back with what's wrong, not run). What a server says about using its tools goes in the system prompt |
203
+ | `--mcp-config <file or JSON>` | more MCP servers (repeatable); `--strict-mcp-config`: only those. The model sees every server's tools by name, one line each, and gets a tool's arguments when it uses it (a call that doesn't fit them comes back with what's wrong, not run). What a server says about using its tools comes once, with the first result of one of them |
195
204
  | `--skills-dir <folder>` | more skills (repeatable) |
196
205
  | `--no-memory` | nothing read or kept: no memory notes, no web pages saved in the project, no wrap-up at the end (see "What a run leaves") |
197
206
 
@@ -208,9 +217,11 @@ empty folders the task made (a test script, a debug log). It runs after the answ
208
217
  `result` (or the printed answer) comes first, and `heart -p` exits once the wrap-up is done (a few
209
218
  seconds more).
210
219
 
211
- A command that keeps running (a dev server, a watcher) is started with `run_command` and
212
- `background: true`; the `background` tool reads its new output, lists such commands and stops one.
213
- Whatever is still running is stopped when HeartCode exits.
220
+ No command blocks: `run_command` waits up to `wait` seconds (the model's choice, 30 if left out)
221
+ and a command still running then carries on in the background; one meant to keep running (a dev
222
+ server, a watcher) takes `background: true`. The `background` tool reads a command's new output
223
+ (after waiting up to `wait` seconds for it), lists them and stops one. Whatever is still running is
224
+ stopped when HeartCode exits.
214
225
 
215
226
  Before a task that changed files ends, another of the user's models (the same one when only one is
216
227
  used) reviews the work against the request in a request of its own; a NO sends it back to fix.
@@ -243,6 +254,10 @@ Every `assistant` line's `message.model` is the model that wrote it (`provider/m
243
254
  fallback, the one that took over, not the one the run started with (the `init` line's `model`).
244
255
  `modelUsage` in the `result` has each model that answered.
245
256
 
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
259
+ `modelUsage`. Retries and switches to another model go to stderr with `--verbose`.
260
+
246
261
  ## Don't
247
262
 
248
263
  - Don't run `heart` without `-p` from an agent: it's a full-screen app and waits for a person.
package/bin/heart.js CHANGED
@@ -8,11 +8,11 @@
8
8
  // your config.json (providers, keys), the models' test results and
9
9
  // prices copied in; deleted when the last of them quits; your own is
10
10
  // never written to
11
- // Logs, when they're switched on (the settings page: Logging): each run's log in
12
- // ~/.heart/logs/runs/<day-month-year-hour-min-sec>/, a file per tab ("log": true in config.json);
13
- // each request to a model in ~/.heart/logs/requests/<same>/, a file per request ("logRequests").
14
- // Kept for logDays days (3 unless changed). HEART_LOG=/path/file.log logs this run in that one file
15
- // anyway; HEART_LOG=off: no run log.
11
+ // Logs, each kind switched on by itself (the settings page: Logs; "logs" in config.json), all off
12
+ // by default: text logs in ~/.heart/logs/runs/<day-month-year-hour-min-sec>/, a file per kind
13
+ // (tools.log, models.log, agent.log, errors.log, conversation.log, debug.log); each request to a
14
+ // model in ~/.heart/logs/requests/<same>/, a file per request. Kept for logDays days (3 unless
15
+ // changed). HEART_LOG=/path/file.log logs everything of this run in that one file; HEART_LOG=off: none.
16
16
  import fs from 'node:fs'
17
17
  import os from 'node:os'
18
18
  import path from 'node:path'
@@ -64,7 +64,7 @@ if (temp) {
64
64
  }
65
65
 
66
66
  // a folder first: HeartCode opens it (subcommands and options go straight through)
67
- const SUBCOMMANDS = ['probe', 'models', 'providers', 'config', 'settings']
67
+ const SUBCOMMANDS = ['models', 'providers', 'config', 'settings']
68
68
  const first = args[0]
69
69
  if (first && !first.startsWith('-') && !SUBCOMMANDS.includes(first)) {
70
70
  const where = path.resolve(first.replace(/^~(?=\/|$)/, os.homedir()))
@@ -75,26 +75,13 @@ if (first && !first.startsWith('-') && !SUBCOMMANDS.includes(first)) {
75
75
  // else: words, a task to run (heart "fix the failing test")
76
76
  }
77
77
 
78
- // the run's log, if switched on (not for -p/--print: its callers set HEART_LOG themselves if they
79
- // want one; nor for --help and --version); requests are logged by HeartCode itself (src/log.js)
80
- const logOn = (() => {
81
- try {
82
- return JSON.parse(fs.readFileSync(path.join(process.env.HEART_HOME || realHome, 'config.json'), 'utf8')).log === true
83
- } catch {
84
- return false
85
- }
86
- })()
78
+ // where the logs go, and this run's name for its folders (src/log.js: each kind of log is switched on
79
+ // by itself in config.json's "logs", also while HeartCode runs)
87
80
  const logs = temp ? path.join(os.tmpdir(), 'heart-temp-logs') : path.join(realHome, 'logs')
88
81
  process.env.HEART_LOGS ??= logs
89
82
  let runStamp = stamp
90
83
  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
91
84
  process.env.HEART_LOG_STAMP ??= runStamp
92
- // The run's folder is set aside either way (made with its first line): the Logging page's switch
93
- // turns the log on or off while HeartCode runs (src/log.js, HEART_LOG_RUN).
94
- if (!process.env.HEART_LOG && !process.env.HEART_LOG_DIR && !args.some((a) => ['-p', '--print', '-h', '--help', '-v', '--version'].includes(a))) {
95
- process.env.HEART_LOG_DIR = path.join(logs, 'runs', runStamp) // old ones: deleted after logDays (src/log.js)
96
- process.env.HEART_LOG_RUN = logOn ? 'on' : 'off' // how it starts
97
- }
98
85
 
99
86
  process.argv = [process.argv[0], fileURLToPath(new URL('./heartcode.js', import.meta.url)), ...args]
100
87
  await import('./heartcode.js')