heartcode 0.1.40 → 0.1.42
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 +54 -0
- package/README.md +22 -10
- package/SKILL.md +28 -8
- package/bin/heart.js +4 -3
- package/bin/heartcode.js +37 -55
- package/package.json +1 -1
- package/prompts/README.md +0 -1
- package/prompts/agent.md +8 -8
- package/prompts/compact.md +15 -2
- package/src/acp.js +1 -1
- package/src/agent.js +61 -22
- package/src/capabilities.js +2 -2
- package/src/client.js +33 -5
- package/src/config.js +13 -0
- package/src/director.js +11 -8
- package/src/guided.js +12 -21
- package/src/importer.js +53 -14
- package/src/log.js +1 -1
- package/src/memory.js +2 -2
- package/src/probe.js +20 -310
- package/src/prompts.js +1 -1
- package/src/rankings.js +15 -8
- package/src/research.js +2 -1
- package/src/settings.html +79 -86
- package/src/settings.js +16 -11
- package/src/tools.js +61 -8
- package/src/ui.js +18 -0
- package/src/update.js +11 -14
- package/prompts/probe.md +0 -67
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,60 @@
|
|
|
2
2
|
|
|
3
3
|
What changed in each version of HeartCode, newest first.
|
|
4
4
|
|
|
5
|
+
## 0.1.42 (2026-11-03)
|
|
6
|
+
|
|
7
|
+
- **Your "no, do this instead" reaches the model as you**: what you type when you decline a command,
|
|
8
|
+
an edit or a call goes to the model as your own message, not inside the tool's result (where small
|
|
9
|
+
models read it as the tool failing and tried again).
|
|
10
|
+
- **The conversation's size counted honestly**: tokens estimated the way tokenizers split text, so
|
|
11
|
+
code, CSS, JSON and SVG count for what they are (a flat estimate was up to 2× low on them: a request
|
|
12
|
+
thought to fit was refused, and compacting never started); a ratio learned on prose never makes it
|
|
13
|
+
smaller than characters ÷ 4, and what's new since the server's last count is never discounted.
|
|
14
|
+
- **The provider's prompt cache kept**: a file read again no longer rewrites its older copy in the
|
|
15
|
+
middle of the conversation at once (every such change makes the provider process everything after
|
|
16
|
+
it again: minutes on a local model, full price on a paid one); older copies go together with the
|
|
17
|
+
old results, or when it's nearly full.
|
|
18
|
+
- **Checks what uses a change**: before saying done, the model reads its whole change and updates
|
|
19
|
+
what uses it (the callers of a function, what reads a renamed value). In our test a 14B model
|
|
20
|
+
updated both callers 2 of 2 times, against 0 of 2 before. The new `changes` tool shows the model
|
|
21
|
+
its own diff for the message (or the conversation), with or without git.
|
|
22
|
+
- **Tool messages that can't be misread**: search tells a path that doesn't exist, a pattern no file
|
|
23
|
+
fits and an invalid regular expression apart from "no matches" (with how many files it searched),
|
|
24
|
+
and takes a pattern as its path (`src/*.css`); shortened output says it's shortened to fit, not an
|
|
25
|
+
error.
|
|
26
|
+
- **Findings saved before compacting**: the model working on the task writes down what it has found
|
|
27
|
+
just before the conversation is summarized, and the summary starts with it, so it doesn't read the
|
|
28
|
+
same files again after every compaction.
|
|
29
|
+
- **`--temp` keeps nothing**: besides `~/.heart`, the project's `.heartcode/` (research pages, notes)
|
|
30
|
+
is untouched (read from a copy), logs go with the throwaway folder, and skills or MCP servers saved
|
|
31
|
+
in a `--temp` run don't reach the project.
|
|
32
|
+
- **The update check at every start**, not once a day: a new version shows on the next launch.
|
|
33
|
+
- **Thanks** in the README to Reika, OpenCode, Cline, OpenClaw and Pi.
|
|
34
|
+
|
|
35
|
+
## 0.1.41 (2026-11-03)
|
|
36
|
+
|
|
37
|
+
- **Model scores on Your models**: Coding, Web apps and Vision show each model's LMArena score with
|
|
38
|
+
its place (`1478 #60`; hover for the votes); green is the top tenth. The page opens fast again
|
|
39
|
+
with thousands of models (each name matched once, not once per ranking entry).
|
|
40
|
+
- **Your models in three rows**: the title with Order providers and Update model info (models.dev
|
|
41
|
+
and the scores in one click); the settings on one line with short names (Pick, If one fails, Give
|
|
42
|
+
up after, New message to, Tests wait); search, filters, the count, Clear, Test all and Save order
|
|
43
|
+
on one line. The sort shows in the column heads.
|
|
44
|
+
- **Best fit said plainly**: with Pick on "the best for each task", the page and the sidebar say
|
|
45
|
+
each message goes to the models that score best for it (not "HeartCode uses #1"), and Order
|
|
46
|
+
providers is off, with why on hover.
|
|
47
|
+
- **The list holds still while models are tested** (or Update model info runs): filters, sorting,
|
|
48
|
+
the settings, dragging and each row's changes wait; Stop and Request still work.
|
|
49
|
+
- **Settings from another device**: the link shows your machine's network address
|
|
50
|
+
(`http://192.168.1.108:43135/?t=…`) and the page answers there; only with its key, and only to
|
|
51
|
+
this machine's addresses.
|
|
52
|
+
- **Slash commands leave nothing behind**: a command shows a toast for a few seconds; what it shows
|
|
53
|
+
opens in a dialog, and nothing stays in the conversation.
|
|
54
|
+
- **/import asks before a duplicate**: one you already have (same name, same text, or the same MCP
|
|
55
|
+
server under another name) is marked, and added only if you say so, under a new name.
|
|
56
|
+
- **Removed**: /test_model and `heart probe` (models.dev says what a model can do), and the
|
|
57
|
+
settings only those tests could switch on.
|
|
58
|
+
|
|
5
59
|
## 0.1.40 (2026-11-03)
|
|
6
60
|
|
|
7
61
|
- **A smaller, general system prompt** (about 6,700 tokens to start a task, from 13,000+): its rules
|
package/README.md
CHANGED
|
@@ -56,10 +56,10 @@ 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
|
|
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 "
|
|
62
|
+
- **Best fit by public rankings**: with "Pick" set to "the best for each task", each message's
|
|
63
63
|
lead and code reviewer are your models ranked on the skills that task needs (web
|
|
64
64
|
pages, code, images…) by LMArena's public rankings, fetched once a week. Your models shows each
|
|
65
65
|
one's Coding, Web apps and Vision rank.
|
|
@@ -105,9 +105,11 @@ heart
|
|
|
105
105
|
|
|
106
106
|
### 3. Open the settings page
|
|
107
107
|
|
|
108
|
-
Type `/settings`. The settings page opens in your browser.
|
|
109
|
-
(
|
|
110
|
-
|
|
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.
|
|
111
113
|
|
|
112
114
|
<!-- image: the settings page -->
|
|
113
115
|

|
|
@@ -138,15 +140,15 @@ On **Models → Your list**:
|
|
|
138
140
|
1. **Sort them by context and abilities.** Click the *Abilities* column, then *Context*: the
|
|
139
141
|
models that can do the most come first, the biggest context window first among those (each
|
|
140
142
|
column clicked breaks the ties of the ones before; click one again to reverse it, a third time to
|
|
141
|
-
drop it). Click **Save
|
|
143
|
+
drop it). Click **Save order** to keep it.
|
|
142
144
|
2. **Rearrange a bit more.** Drag a row to move it. #1 is the one HeartCode uses; the others are
|
|
143
145
|
its fallbacks, tried in order.
|
|
144
146
|
3. **Test them** (optional): **Test all** sends each a short message and shows which really answer.
|
|
145
|
-
Each test waits up to 10 seconds;
|
|
147
|
+
Each test waits up to 10 seconds; **Tests wait**, above the list, changes that.
|
|
146
148
|
4. **Filter them** (optional): by name, provider, test result (works, doesn't, not tested, or one
|
|
147
|
-
error like 402), context, tools, thinking, images or free. **Test
|
|
148
|
-
shown, and **Use these N** makes them the models HeartCode uses, in the order you see (the others
|
|
149
|
-
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
|
|
150
152
|
working models, fastest first.
|
|
151
153
|
|
|
152
154
|
If a model says *not found* in models.dev, **Retry** looks it up again, or **Set up** tells
|
|
@@ -187,6 +189,16 @@ ones that change it (`/compact`, `/rewind`, `/resume`…) wait until it's done.
|
|
|
187
189
|
commands show (`/help`, `/context`, `/diff`…) open in a dialog over the conversation; `Esc`
|
|
188
190
|
closes it.
|
|
189
191
|
|
|
192
|
+
## Thanks
|
|
193
|
+
|
|
194
|
+
A lot of what HeartCode handles, I learned from other coding agents and the problems they ran into
|
|
195
|
+
first. Thank you to [Reika](https://github.com/alexwkleung/reika) (its measured findings on small
|
|
196
|
+
models: sending a "no, do this instead" as your own message, counting code's tokens honestly,
|
|
197
|
+
keeping the provider's prompt cache, checking what uses a changed function, saving what the model
|
|
198
|
+
found before compacting), [OpenCode](https://github.com/anomalyco/opencode),
|
|
199
|
+
[Cline](https://github.com/cline/cline), [OpenClaw](https://github.com/openclaw/openclaw) and
|
|
200
|
+
[Pi](https://github.com/earendil-works/pi), for the many use cases like these they showed me.
|
|
201
|
+
|
|
190
202
|
## License
|
|
191
203
|
|
|
192
204
|
[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. 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
|
|
@@ -116,7 +123,9 @@ goes to stderr. Logs never go to stdout.
|
|
|
116
123
|
|
|
117
124
|
## Continue the same conversation
|
|
118
125
|
|
|
119
|
-
|
|
126
|
+
Every run is saved as a session in `~/.heart/sessions/` (and logged, for the kinds of logs the user
|
|
127
|
+
switched on), as when the user works in HeartCode; `--temp` keeps nothing. Pass the `session_id`
|
|
128
|
+
from the last result:
|
|
120
129
|
|
|
121
130
|
```sh
|
|
122
131
|
heart -p --output-format json --resume 20261027-… "now add a test for the empty case"
|
|
@@ -126,7 +135,9 @@ heart -p --continue "…" # or: the last session in this folder
|
|
|
126
135
|
## Keep it safe
|
|
127
136
|
|
|
128
137
|
Headless never asks anyone. What the permission mode would ask about is declined, and the
|
|
129
|
-
model is told why.
|
|
138
|
+
model is told why. A question the model would ask the user (what to build, how it should look,
|
|
139
|
+
what testing) it decides itself, and says in its reply what it assumed: put the choices that
|
|
140
|
+
matter in the prompt. An MCP tool its server marks read-only is never asked about. The model can't
|
|
130
141
|
give itself a freer permission mode (its `manage` tool asks the user, so headless refuses it), and
|
|
131
142
|
can't switch the model you chose.
|
|
132
143
|
|
|
@@ -137,10 +148,10 @@ can't switch the model you chose.
|
|
|
137
148
|
| Everything (edits and commands) | `--permission-mode all` (the default unless the user set another) |
|
|
138
149
|
| 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 |
|
|
139
150
|
| A cap on how long it works | `--max-turns 30` (model steps), `--max-retries 3` (a failing provider) |
|
|
140
|
-
| Nothing
|
|
151
|
+
| 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) |
|
|
141
152
|
|
|
142
153
|
Tool names: HeartCode's own (`read_file`, `edit_file`, `write_file`, `run_command`, `search`,
|
|
143
|
-
`list_files`, `web_fetch`, `web_search`…) or Claude Code's (`Read`, `Edit`, `Write`, `Bash`,
|
|
154
|
+
`list_files`, `changes`, `web_fetch`, `web_search`…) or Claude Code's (`Read`, `Edit`, `Write`, `Bash`,
|
|
144
155
|
`Grep`, `Glob`, `WebFetch`, `WebSearch`). `--disallowedTools Bash` takes one away. MCP servers'
|
|
145
156
|
tools are named as in Claude Code: `mcp__<server>__<tool>`; `mcp__<server>` means all of one
|
|
146
157
|
server's tools, `mcp` all of them. (The model itself reaches them through one `mcp` tool that lists
|
|
@@ -162,13 +173,17 @@ assumptions, and the user can set it up on the settings page. Models that can't
|
|
|
162
173
|
work, in a slower guided mode.
|
|
163
174
|
|
|
164
175
|
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
|
|
176
|
+
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
177
|
can't do itself (a model that can't see asks one that can about a screenshot: "which tiles show a
|
|
167
178
|
chair?"), several at once when there are many images or parts, and a helper that fails is handed to
|
|
168
179
|
the next capable model until one does the job. A helper works until its job is done (no step
|
|
169
180
|
limit; `--max-turns` applies to it too). Their tokens are in `usage`, and each model's in
|
|
170
181
|
`modelUsage`.
|
|
171
182
|
|
|
183
|
+
A long run that fills the model's context window is compacted: the model first writes down what it
|
|
184
|
+
has found, then the conversation so far is replaced by a summary that starts with those notes. That
|
|
185
|
+
is two extra requests, counted in `usage`, and not in the stream.
|
|
186
|
+
|
|
172
187
|
## Setting up a model
|
|
173
188
|
|
|
174
189
|
Ask the user which provider and model to use, and for the key. Never invent one. Then:
|
|
@@ -182,7 +197,8 @@ HEART_API_KEY=… heart -u https://api.groq.com/openai/v1 -m openai/gpt-oss-120b
|
|
|
182
197
|
```
|
|
183
198
|
|
|
184
199
|
A model server on this machine (Ollama on :11434, LM Studio on :1234, llama.cpp on :8080) is
|
|
185
|
-
found on its own. The user can also set everything up in a browser: `heart settings
|
|
200
|
+
found on its own. The user can also set everything up in a browser: `heart settings` (its link has
|
|
201
|
+
the machine's network address, so it opens from another device too, for HeartCode on a server), where
|
|
186
202
|
**Test** (or **Test all**) under *Your models* sends a model a short message to show it really
|
|
187
203
|
answers. A run that fails with a wrong key or an unknown model: ask the user to test it there.
|
|
188
204
|
|
|
@@ -191,7 +207,7 @@ answers. A run that fails with a wrong key or an unknown model: ask the user to
|
|
|
191
207
|
| Flag | |
|
|
192
208
|
|---|---|
|
|
193
209
|
| `--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
|
|
210
|
+
| `--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
211
|
| `--skills-dir <folder>` | more skills (repeatable) |
|
|
196
212
|
| `--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
213
|
|
|
@@ -245,6 +261,10 @@ Every `assistant` line's `message.model` is the model that wrote it (`provider/m
|
|
|
245
261
|
fallback, the one that took over, not the one the run started with (the `init` line's `model`).
|
|
246
262
|
`modelUsage` in the `result` has each model that answered.
|
|
247
263
|
|
|
264
|
+
Not in the stream: HeartCode's own prompts (the system prompt, its nudges), the skill-picking
|
|
265
|
+
request of best fit, the review's verdict and the wrap-up. Their tokens are in `usage` and
|
|
266
|
+
`modelUsage`. Retries and switches to another model go to stderr with `--verbose`.
|
|
267
|
+
|
|
248
268
|
## Don't
|
|
249
269
|
|
|
250
270
|
- 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
|
@@ -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 })
|
|
@@ -64,7 +65,7 @@ if (temp) {
|
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
// a folder first: HeartCode opens it (subcommands and options go straight through)
|
|
67
|
-
const SUBCOMMANDS = ['
|
|
68
|
+
const SUBCOMMANDS = ['models', 'providers', 'config', 'settings']
|
|
68
69
|
const first = args[0]
|
|
69
70
|
if (first && !first.startsWith('-') && !SUBCOMMANDS.includes(first)) {
|
|
70
71
|
const where = path.resolve(first.replace(/^~(?=\/|$)/, os.homedir()))
|
|
@@ -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(
|
|
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,8 +2,8 @@
|
|
|
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'
|
|
6
|
-
import {
|
|
5
|
+
import { loadConfig, saveConfig, readJson, writeJson, providerName, CONFIG_FILE, HOME, TEMP, AUTO_MODEL, isAuto, parseModel, takeIn, whatOf, VERSION } from '../src/config.js'
|
|
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'
|
|
9
9
|
import { listJobs, getJob, stopJob, removeJob, runningJobs, tailLines, ago as ranFor } from '../src/background.js'
|
|
@@ -46,7 +46,6 @@ ${c.bold('usage')}
|
|
|
46
46
|
as provider/model, #1 first
|
|
47
47
|
heart models --all [filter] every provider's models (provider/model)
|
|
48
48
|
heart models --json as JSON (with --all too), for other programs
|
|
49
|
-
heart probe test the current model for real (otherwise its abilities come from models.dev)
|
|
50
49
|
heart config show the config file
|
|
51
50
|
heart settings change providers, models and settings in your browser
|
|
52
51
|
|
|
@@ -60,11 +59,11 @@ ${c.bold('options')}
|
|
|
60
59
|
--ask ask before every edit and command, this run
|
|
61
60
|
--hide-thinking collapse the model's thinking to one line
|
|
62
61
|
-C, --cwd <dir> project folder (default: current folder)
|
|
63
|
-
--temp a throwaway settings folder (your providers, model
|
|
64
|
-
copied in), shared by the --temp runs going on at once
|
|
65
|
-
after the last; ~/.heart
|
|
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)
|
|
66
66
|
--context <n> context window size in tokens
|
|
67
|
-
--force re-run the probe
|
|
68
67
|
--save keep the given -u/-m/--api-key/... in ${CONFIG_FILE}
|
|
69
68
|
-w, --worktree work in a new git worktree and branch (--worktree=name to name it,
|
|
70
69
|
or to continue in it); removed on exit if nothing changed
|
|
@@ -123,7 +122,6 @@ const SECTIONS = [
|
|
|
123
122
|
['/context', "what's in the context now: system prompt, tools, messages, tool results, and the biggest pieces"],
|
|
124
123
|
['/background', 'commands running in the background (servers, watchers): their logs live, a tab each (Alt+B) · /background stop [id] · /background files', true],
|
|
125
124
|
['/model_info', 'what the model can do and how HeartCode uses it'],
|
|
126
|
-
['/test_model', 'test the model for real (otherwise what it can do comes from models.dev, or your settings)'],
|
|
127
125
|
['/tidy_memory', 'merge, update and link the memory notes now'],
|
|
128
126
|
['/import', 'bring commands, skills, MCP servers and memory from other CLIs'],
|
|
129
127
|
['/install_skill', 'install a skill from a GitHub repo or a SKILL.md URL (add --project for this folder only)', true],
|
|
@@ -241,6 +239,7 @@ class App {
|
|
|
241
239
|
}
|
|
242
240
|
|
|
243
241
|
saveProjectModels() {
|
|
242
|
+
if (TEMP) return // --temp keeps nothing: the choice lasts for this run only
|
|
244
243
|
const file = path.join(this.root, '.heartcode', 'models.json')
|
|
245
244
|
if (this.cfg.session?.length) writeJson(file, { session: this.cfg.session.map((t) => ({ provider: t.provider, model: t.model })) })
|
|
246
245
|
else fs.rmSync(file, { force: true }) // auto: forget the folder's choice
|
|
@@ -350,8 +349,7 @@ class App {
|
|
|
350
349
|
ui.print(c.dim(`↻ ${t.provider} · ${t.model} answered${i ? ` (#${i + 1} in your model list)` : ' (#1 again)'}`))
|
|
351
350
|
}
|
|
352
351
|
if (cfg.maxRetries !== undefined) client.retryIf = (e, attempt) => attempt < cfg.maxRetries // headless: then give up
|
|
353
|
-
let profile = await getProfile(client, ui,
|
|
354
|
-
if (!quiet) cfg.force = false
|
|
352
|
+
let profile = await getProfile(client, ui, quiet)
|
|
355
353
|
const strat = {}
|
|
356
354
|
// The model asked from now on (at first, and when the model list moves on): its own profile,
|
|
357
355
|
// abilities (sees images? calls tools? its window), thinking effort, price, and what its
|
|
@@ -689,7 +687,7 @@ class App {
|
|
|
689
687
|
const parts = {
|
|
690
688
|
provider: `${c.brand('●')} ${c.muted(now.provider)} ${c.faint(`(${on})`)}`,
|
|
691
689
|
model,
|
|
692
|
-
mode: strat ? c.muted(strat.actions === 'tools' ? 'tools' : 'guided') : c.dim('not
|
|
690
|
+
mode: strat ? c.muted(strat.actions === 'tools' ? 'tools' : 'guided') : c.dim('not loaded yet'),
|
|
693
691
|
thinking: strat?.thinking ? c.think(`thinking${cfg.effort ? ` · ${cfg.effort}` : ''}`) + (ui.showThinking ? '' : c.faint(' (collapsed)')) : null,
|
|
694
692
|
images: strat?.vision ? c.muted('images') : null,
|
|
695
693
|
ctx: null,
|
|
@@ -1305,7 +1303,7 @@ function afterReset(apps, level) {
|
|
|
1305
1303
|
setTheme(fresh.theme)
|
|
1306
1304
|
reloadPrompts()
|
|
1307
1305
|
for (const app of apps) {
|
|
1308
|
-
for (const k of Object.keys(app.cfg)) if (!['
|
|
1306
|
+
for (const k of Object.keys(app.cfg)) if (!['maxRetries', 'maxTurns', 'mcp', 'adhoc', 'fixed'].includes(k)) delete app.cfg[k]
|
|
1309
1307
|
Object.assign(app.cfg, fresh)
|
|
1310
1308
|
const { ui } = app
|
|
1311
1309
|
ui.permission = fresh.permissions ?? 'all' // not setPermission: that saves it again
|
|
@@ -1335,31 +1333,22 @@ function leaveTabWorktree(app) {
|
|
|
1335
1333
|
|
|
1336
1334
|
// A model's profile: the saved one; else what models.dev says (nothing is sent to the model to
|
|
1337
1335
|
// find out); a model it doesn't know: plain assumptions, until you set it up on the settings page.
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
if (!p && !force) {
|
|
1336
|
+
async function getProfile(client, ui, quiet = false) {
|
|
1337
|
+
let p = loadProfile(client)
|
|
1338
|
+
if (!p) {
|
|
1342
1339
|
await loadPrices()
|
|
1343
1340
|
p = profileFrom(client, limitsOf(client.provider, client.baseUrl, client.model))
|
|
1344
1341
|
writeJson(profilePath(client), p)
|
|
1345
1342
|
}
|
|
1346
1343
|
// one models.dev didn't know when it was saved: looked up again (it may have been added, or the list
|
|
1347
1344
|
// couldn't be had then)
|
|
1348
|
-
if (p
|
|
1345
|
+
if (p.source === 'assumed') {
|
|
1349
1346
|
await loadPrices()
|
|
1350
1347
|
const known = limitsOf(client.provider, client.baseUrl, client.model)
|
|
1351
1348
|
if (known) writeJson(profilePath(client), (p = { ...p, known, source: 'models.dev' }))
|
|
1352
1349
|
}
|
|
1353
|
-
if (p) {
|
|
1354
|
-
|
|
1355
|
-
return p
|
|
1356
|
-
}
|
|
1357
|
-
ui.print(c.dim(`Testing ${client.model}…`))
|
|
1358
|
-
const t0 = Date.now()
|
|
1359
|
-
const tested = await probe(client, (label) => ui.spinner(`testing: ${label}`), signal)
|
|
1360
|
-
ui.stopSpin()
|
|
1361
|
-
ui.print(c.dim(`done in ${duration(Date.now() - t0)} · saved to ${profilePath(client)}`))
|
|
1362
|
-
return tested
|
|
1350
|
+
if (p.source === 'assumed' && !quiet) ui.warn(`${client.model} isn't in models.dev: assuming it calls tools and streams, with a ~128k window. Set what it can do on /settings`)
|
|
1351
|
+
return p
|
|
1363
1352
|
}
|
|
1364
1353
|
|
|
1365
1354
|
// A setting from its choices: the argument if valid, else a picker. Returns the choice or null.
|
|
@@ -1424,8 +1413,8 @@ async function slash(app, line, working = false) {
|
|
|
1424
1413
|
}
|
|
1425
1414
|
case 'settings': {
|
|
1426
1415
|
settingsPage ??= startSettings({ cfg, root: app.root, onLoginMcp: (name) => signInMcp(app, name, null), apply: (what) => applySettings(app.tabs ? app.tabs.list.map((t) => t.app) : [app], cfg, what) })
|
|
1427
|
-
const { url, close } = await settingsPage
|
|
1428
|
-
openBrowser(
|
|
1416
|
+
const { url, local, close } = await settingsPage
|
|
1417
|
+
openBrowser(local)
|
|
1429
1418
|
ui.print(`${c.info('↗')} ${c.bold('settings')} ${c.muted('opened in your browser:')}\n ${c.faint(url)}`)
|
|
1430
1419
|
// a dialog until it's turned off: nothing else meanwhile, in any tab (Esc turns it off too).
|
|
1431
1420
|
// Not busy meanwhile: what's changed on the page applies at once, here too (opened while a task
|
|
@@ -1456,7 +1445,7 @@ async function slash(app, line, working = false) {
|
|
|
1456
1445
|
return ui.showText('Commands and keys', app.help())
|
|
1457
1446
|
case 'update': {
|
|
1458
1447
|
ui.spinner('asking npm for the newest HeartCode')
|
|
1459
|
-
const u = await checkUpdate(
|
|
1448
|
+
const u = await checkUpdate()
|
|
1460
1449
|
ui.stopSpin()
|
|
1461
1450
|
if (!u) return ui.warn("couldn't reach npm to check for a newer HeartCode")
|
|
1462
1451
|
app.update = u
|
|
@@ -1647,10 +1636,17 @@ async function slash(app, line, working = false) {
|
|
|
1647
1636
|
case 'import': {
|
|
1648
1637
|
const items = findImports(app.root)
|
|
1649
1638
|
if (!items.length) return ui.print('Nothing to import: no commands, skills, MCP servers, instructions or memory from Claude Code, Codex, Gemini CLI, OpenCode or Cursor found.')
|
|
1639
|
+
for (const it of items) if (it.dup?.()) it.desc = `${c.yellow('already have it')} · ${it.desc}`
|
|
1650
1640
|
const chosen = await ui.pick(`Import from other CLIs (${items.length} found)`, items, { multi: true })
|
|
1651
1641
|
if (!chosen) return
|
|
1652
1642
|
for (const it of chosen) {
|
|
1653
1643
|
try {
|
|
1644
|
+
// a duplicate (also of one just imported): added only if you say so, under a free name
|
|
1645
|
+
const dup = it.dup?.()
|
|
1646
|
+
if (dup && (await ui.pick(`${it.label}: ${dup}. Add it anyway?`, [{ label: 'No, skip it', value: false }, { label: 'Yes, add it under a new name', value: true }]))?.value !== true) {
|
|
1647
|
+
ui.print(`${c.dim('–')} ${it.label} ${c.dim(`skipped: ${dup}`)}`)
|
|
1648
|
+
continue
|
|
1649
|
+
}
|
|
1654
1650
|
ui.print(`${c.green('✓')} ${it.run()}`)
|
|
1655
1651
|
} catch (e) {
|
|
1656
1652
|
ui.print(`${c.red('✗')} ${it.label}: ${e.message}`)
|
|
@@ -1688,7 +1684,7 @@ async function slash(app, line, working = false) {
|
|
|
1688
1684
|
ui.showThinking = !ui.showThinking
|
|
1689
1685
|
return ui.print(c.dim(`thinking ${ui.showThinking ? 'shown' : 'collapsed'}`))
|
|
1690
1686
|
}
|
|
1691
|
-
if (!['model_info', '
|
|
1687
|
+
if (!['model_info', 'compact'].includes(cmd)) {
|
|
1692
1688
|
app.skills = loadSkills(app.root) // edits to skill files apply right away
|
|
1693
1689
|
if (app.s) app.s.skills = app.skills
|
|
1694
1690
|
if (cmd.startsWith('skill:')) {
|
|
@@ -1711,13 +1707,6 @@ async function slash(app, line, working = false) {
|
|
|
1711
1707
|
}
|
|
1712
1708
|
case 'model_info':
|
|
1713
1709
|
return ui.showText(s.client.model, describe(s.profile, s.strat))
|
|
1714
|
-
case 'test_model': {
|
|
1715
|
-
const tested = await getProfile(app.client(s.client.provider, s.client.model), ui, true, app.signal) // tested on a fresh connection (requests not fitted to what it was thought to do), and saved
|
|
1716
|
-
s.reset()
|
|
1717
|
-
app.s = null // built again from the saved profile (one profile and strategy, kept up to date as the model list moves on)
|
|
1718
|
-
await app.session()
|
|
1719
|
-
return ui.print(`${c.cyan(tested.model)}\n${describe(tested, strategy(tested, cfg))}`)
|
|
1720
|
-
}
|
|
1721
1710
|
}
|
|
1722
1711
|
}
|
|
1723
1712
|
|
|
@@ -1840,7 +1829,7 @@ async function repl(app, f = {}) {
|
|
|
1840
1829
|
// models this folder picked earlier (/select_model): said, with the way back to your whole list
|
|
1841
1830
|
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`)}`)
|
|
1842
1831
|
app.tabs?.onChange?.() // the conversation it opened with
|
|
1843
|
-
// a newer HeartCode: asked in the background
|
|
1832
|
+
// a newer HeartCode: asked of npm in the background at every start, said once and kept in the status bar
|
|
1844
1833
|
if (cfg.updateCheck !== false)
|
|
1845
1834
|
checkUpdate()
|
|
1846
1835
|
.then((u) => {
|
|
@@ -1860,7 +1849,9 @@ async function repl(app, f = {}) {
|
|
|
1860
1849
|
app.signal = ctl.signal // Esc stops whatever this line started (a task, a probe, …)
|
|
1861
1850
|
ui.escArm = 0 // a fresh task: a first Esc from before doesn't count toward stopping this one
|
|
1862
1851
|
ui.busy() // the spinner stays until this line's work is done
|
|
1863
|
-
|
|
1852
|
+
const command = app.isCommand(t)
|
|
1853
|
+
if (command) {
|
|
1854
|
+
const mark = ui.mark?.() // what it prints goes back out of the conversation when it's done
|
|
1864
1855
|
try {
|
|
1865
1856
|
if ((await slash(app, t)) === 'exit') {
|
|
1866
1857
|
if (app.tabs) app.tabs.quitting = true
|
|
@@ -1871,6 +1862,7 @@ async function repl(app, f = {}) {
|
|
|
1871
1862
|
log('error', e.stack)
|
|
1872
1863
|
ui.print(c.red(`error: ${e.message}`))
|
|
1873
1864
|
}
|
|
1865
|
+
if (mark) ui.unmark(mark, /^\S+/.exec(t)[0])
|
|
1874
1866
|
} else {
|
|
1875
1867
|
let ok = await runTask(app, t, ctl)
|
|
1876
1868
|
// plan mode: the plan is done; go ahead with it?
|
|
@@ -1891,7 +1883,7 @@ async function repl(app, f = {}) {
|
|
|
1891
1883
|
ctl = null
|
|
1892
1884
|
app.afterLine()
|
|
1893
1885
|
app.tabs?.onChange?.() // the conversation may be another now (/resume, /fork, /clear_chat)
|
|
1894
|
-
if (ui.tail) ui.print() // nothing after /clear_chat
|
|
1886
|
+
if (ui.tail && !command) ui.print() // nothing after /clear_chat, nor after a command (it left nothing)
|
|
1895
1887
|
}
|
|
1896
1888
|
ui.close()
|
|
1897
1889
|
}
|
|
@@ -1917,7 +1909,6 @@ async function main() {
|
|
|
1917
1909
|
'hide-thinking': { type: 'boolean' },
|
|
1918
1910
|
cwd: { type: 'string', short: 'C' },
|
|
1919
1911
|
context: { type: 'string' },
|
|
1920
|
-
force: { type: 'boolean' },
|
|
1921
1912
|
save: { type: 'boolean' },
|
|
1922
1913
|
continue: { type: 'boolean', short: 'c' },
|
|
1923
1914
|
resume: { type: 'boolean', short: 'r' },
|
|
@@ -1968,7 +1959,6 @@ async function main() {
|
|
|
1968
1959
|
useLogs(cfg)
|
|
1969
1960
|
const safe = { ...cfg, providers: Object.fromEntries(Object.entries(cfg.providers).map(([n, p]) => [n, { ...p, apiKey: p.apiKey && mask(p.apiKey) }])) }
|
|
1970
1961
|
log('start', `heartcode ${VERSION} · node ${process.version} · ${process.platform} · cwd ${process.cwd()}`, { args: process.argv.slice(2).map((a) => (a === f['api-key'] ? mask(a) : a)), config: safe })
|
|
1971
|
-
cfg.force = f.force
|
|
1972
1962
|
if (f.provider) {
|
|
1973
1963
|
if (!cfg.providers[f.provider]) throw new Error(`no provider "${f.provider}" (heartcode providers lists them)`)
|
|
1974
1964
|
Object.assign(cfg, { provider: f.provider, fixed: true })
|
|
@@ -1987,12 +1977,12 @@ async function main() {
|
|
|
1987
1977
|
saveConfig(cfg)
|
|
1988
1978
|
console.log(c.dim(`saved to ${CONFIG_FILE}`))
|
|
1989
1979
|
}
|
|
1990
|
-
const sub = ['
|
|
1980
|
+
const sub = ['models', 'providers', 'config', 'settings'].includes(positionals[0]) && positionals.length <= 2 ? positionals[0] : null
|
|
1991
1981
|
|
|
1992
1982
|
if (sub === 'settings') {
|
|
1993
|
-
const { url } = await startSettings({ cfg })
|
|
1994
|
-
console.log(`${c.brand('♥')} HeartCode settings: ${url}\n${c.dim('opened in your browser · Ctrl+C to stop')}`)
|
|
1995
|
-
openBrowser(
|
|
1983
|
+
const { url, local } = await startSettings({ cfg })
|
|
1984
|
+
console.log(`${c.brand('♥')} HeartCode settings: ${url}\n${c.dim('opened in your browser · from another device on this network, open the link above · Ctrl+C to stop')}`)
|
|
1985
|
+
openBrowser(local)
|
|
1996
1986
|
return new Promise(() => {}) // until Ctrl+C
|
|
1997
1987
|
}
|
|
1998
1988
|
|
|
@@ -2085,14 +2075,6 @@ async function main() {
|
|
|
2085
2075
|
app.worktree = wt
|
|
2086
2076
|
if (sub === 'providers') return app.listProviders(), ui.close()
|
|
2087
2077
|
if (sub === 'models') return await app.listModels(positionals[1] ?? '', { all: f.all, json: f.json }), ui.close()
|
|
2088
|
-
if (sub === 'probe') {
|
|
2089
|
-
cfg.force = true
|
|
2090
|
-
const s = await app.session()
|
|
2091
|
-
if (s) ui.print(describe(s.profile, s.strat))
|
|
2092
|
-
ui.close()
|
|
2093
|
-
process.exitCode = s ? 0 : 1
|
|
2094
|
-
return
|
|
2095
|
-
}
|
|
2096
2078
|
if (f['no-memory']) app.memory = null
|
|
2097
2079
|
const chat = f['resume-id'] ? loadChat(f['resume-id']) : f.continue && headless ? listChats(app.root)[0] : f['session-id'] ? (loadChat(f['session-id']) ?? { ...newChat(app.root), id: f['session-id'] }) : null
|
|
2098
2080
|
if (f['resume-id'] && !chat) throw new Error(`no session ${f['resume-id']}`)
|
package/package.json
CHANGED
package/prompts/README.md
CHANGED
|
@@ -7,7 +7,6 @@ Everything HeartCode sends to a model, in four files. Each `## name` heading is
|
|
|
7
7
|
| `agent.md` | tool mode (capable models): the system prompt, tool descriptions, memory, notes HeartCode adds |
|
|
8
8
|
| `guided.md` | guided mode (weak models): one question at a time |
|
|
9
9
|
| `compact.md` | `/compact` and auto-compact |
|
|
10
|
-
| `probe.md` | the one-time test of a new model |
|
|
11
10
|
|
|
12
11
|
In a prompt, `{{name}}` is filled in by HeartCode (the note under each heading lists them),
|
|
13
12
|
`{{#if name}} … {{else}} … {{/if}}` keeps a part only when `name` has a value, and a
|
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
|
-
[
|
|
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
|
|
|
@@ -103,11 +104,6 @@ Reply now, without using tools: what did you do, and what is the result? If some
|
|
|
103
104
|
<!-- HeartCode's own answer when the model gives none at all. {{model}}: its name; {{changed}}: files changed in this message (may be empty). -->
|
|
104
105
|
{{model}} stopped without a final answer.{{#if changed}} Files changed in this message: {{changed}} (/rewind can undo them).{{/if}} Say "continue" to make it carry on.
|
|
105
106
|
|
|
106
|
-
## system-acknowledged
|
|
107
|
-
|
|
108
|
-
<!-- For models without a system role: the system prompt goes in as the first user message, and this is the model's reply to it. -->
|
|
109
|
-
Understood.
|
|
110
|
-
|
|
111
107
|
## instructions
|
|
112
108
|
|
|
113
109
|
<!-- Added to the system prompt when the user has instructions: HEARTCODE.md or AGENTS.md in the
|
|
@@ -137,7 +133,11 @@ Read a file; returns numbered lines. For part of a big file, give start_line and
|
|
|
137
133
|
|
|
138
134
|
## tool-search
|
|
139
135
|
|
|
140
|
-
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.
|
|
141
141
|
|
|
142
142
|
## tool-list_files
|
|
143
143
|
|
package/prompts/compact.md
CHANGED
|
@@ -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.
|
|
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
|
|