heartcode 0.1.27 → 0.1.32
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 +123 -0
- package/README.md +84 -30
- package/SKILL.md +37 -11
- package/bin/heartcode.js +252 -56
- package/package.json +1 -1
- package/prompts/agent.md +131 -22
- package/src/agent.js +498 -77
- package/src/background.js +105 -0
- package/src/client.js +14 -3
- package/src/config.js +1 -1
- package/src/guided.js +7 -2
- package/src/headless.js +10 -4
- package/src/memory.js +6 -2
- package/src/research.js +142 -0
- package/src/sessions.js +4 -1
- package/src/settings.html +331 -76
- package/src/settings.js +73 -0
- package/src/telegram.js +81 -0
- package/src/tools.js +163 -53
- package/src/ui.js +235 -34
- package/src/web.js +150 -40
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,129 @@
|
|
|
2
2
|
|
|
3
3
|
What changed in each version of HeartCode, newest first.
|
|
4
4
|
|
|
5
|
+
## 0.1.32 (2026-11-01)
|
|
6
|
+
|
|
7
|
+
- Dialogs: pickers (`/select_model`, `/resume`, `/rewind`, `/export`…), permission questions, typed
|
|
8
|
+
questions (`/rename`, "what should it do instead?") and what commands show (`/help`, `/context`,
|
|
9
|
+
`/cost`, `/diff`, `/mcp`, `/doctor`, `/model_info`) open in a box over the conversation: 70% of
|
|
10
|
+
the width, as tall as what's in it (70% at most), everything behind dimmed. A short list is
|
|
11
|
+
cards (name, description under it); a permission shows what it's about (this task's last lines)
|
|
12
|
+
above the choices; long text scrolls. Esc closes any of them; a question the model asks closes
|
|
13
|
+
an open dialog so it can be answered.
|
|
14
|
+
- Commands that run in the background: `run_command` with `background: true` (a dev server, a
|
|
15
|
+
watcher) answers after a few seconds and keeps it running; the `background` tool reads its new
|
|
16
|
+
output, lists them, stops one; the model hears when one exits. `⚙ 1 running` in the status bar;
|
|
17
|
+
`Alt+B` (or `/background`) shows their logs live in a dialog, a tab each (←/→, a click), ↑/↓ and
|
|
18
|
+
PgUp/PgDn scroll, K twice stops one and closes its tab. Everything still running is stopped when
|
|
19
|
+
HeartCode exits. Alt+B only acts in an empty box (Option+← sends the same keys: the word jump).
|
|
20
|
+
- `/context`: what fills the context window, part by part (system prompt, tools, your messages,
|
|
21
|
+
notes, replies, tool results whole and as pointers), the room left, and the biggest pieces.
|
|
22
|
+
- The wrap-up after a task (notes, research pages kept or dropped, throwaway files removed) runs
|
|
23
|
+
after the answer is back, beside what you do next, on a connection of its own; it keeps a file a
|
|
24
|
+
new message may use. `heart -p` prints the result first and exits once it's done; `/exit` waits
|
|
25
|
+
for it.
|
|
26
|
+
- Web search: your own SearXNG (settings page → General → Web search: its address in its own row,
|
|
27
|
+
with Test), and the engines in the order you set (↑/↓, each switchable). They're asked in that
|
|
28
|
+
order: the next only when one hasn't found enough, failed or took over 3 s; the rest aren't asked
|
|
29
|
+
once there's enough. A SearXNG's JSON API is used when it's on there.
|
|
30
|
+
- `/select_model` has an "auto" row (back to your whole list, forgetting this folder's choice), and
|
|
31
|
+
a folder that picked its own models says so at start.
|
|
32
|
+
- `/` commands in alphabetical order (the `/` menu and `/help`).
|
|
33
|
+
- Settings page: one light/dark button at the top right instead of the switch in the sidebar; on a
|
|
34
|
+
phone, the top bar no longer grows taller than its tabs. Typing and pasting in the SearXNG and
|
|
35
|
+
skill-URL boxes work (an Enter handler cancelled every other key).
|
|
36
|
+
|
|
37
|
+
## 0.1.31 (2026-11-01)
|
|
38
|
+
|
|
39
|
+
- Commands typed while HeartCode works run at once instead of waiting in the queue, when they leave
|
|
40
|
+
the conversation alone: `/help`, `/cost`, `/model_info`, `/diff`, `/copy`, `/mcp`, `/doctor`,
|
|
41
|
+
`/toggle_thinking`, `/btw`, `/rename`, `/export`, `/tab`, `/close_tab`, `/exit`, `/settings`,
|
|
42
|
+
`/login_mcp`, `/install_skill`, `/import`, `/voice`, `/select_model`. The ones that change it
|
|
43
|
+
(`/compact`, `/clear_chat`, `/resume`, `/rewind`, `/tree`, `/fork`, `/init`, skills, `/tidy_memory`,
|
|
44
|
+
`/test_model`, `/reset`) still wait until it's done.
|
|
45
|
+
- `/select_model` while it works: the task goes on with its models, yours from the next message.
|
|
46
|
+
`/exit` while it works asks first (that stops the task).
|
|
47
|
+
- One question on screen at a time: a command's picker and the task's question (a permission)
|
|
48
|
+
take turns instead of drawing over each other.
|
|
49
|
+
|
|
50
|
+
## 0.1.30 (2026-11-01)
|
|
51
|
+
|
|
52
|
+
- Settings page: the sidebar is 7 items in 4 groups split by lines (Models · General, Notifications ·
|
|
53
|
+
Skills, MCP servers, System prompt · Advanced); merged pages have tabs (Your list / Providers,
|
|
54
|
+
Settings / Status bar, Logs / Files) and every old address still opens its tab. General is one
|
|
55
|
+
calm column of cards (permissions three across, colors four across, rows with the control on the
|
|
56
|
+
right), and voice input is a form (this machine or a provider, model, language) instead of JSON.
|
|
57
|
+
"Testing…" and warnings are amber, not the green that means "works".
|
|
58
|
+
- Headless (`heart -p`) output keeps Claude Code's shape for MCP tools: the `init` event lists each
|
|
59
|
+
as `mcp__<server>__<tool>`, and an MCP call's `tool_use` is named so, with the tool's own
|
|
60
|
+
arguments (it went out as HeartCode's one `mcp` tool since 0.1.28, which programs reading the
|
|
61
|
+
stream, like Nibedita, don't know).
|
|
62
|
+
- `--no-memory` now also keeps web pages out of the project (no `.heartcode/research/`), and helpers
|
|
63
|
+
follow it.
|
|
64
|
+
- SKILL.md brought up to date: no helper step limit, how the model reaches MCP tools, a model with
|
|
65
|
+
room before summarizing, and what a run leaves (research, notes, the wrap-up) and the extra
|
|
66
|
+
requests it makes (the review).
|
|
67
|
+
|
|
68
|
+
## 0.1.29 (2026-11-01)
|
|
69
|
+
|
|
70
|
+
- Telegram notifications: a message on your phone when a task finishes (the task, how long it took,
|
|
71
|
+
the answer), fails (the error), or HeartCode waits for you (a question or a permission). Set up on
|
|
72
|
+
the settings page's new Notifications page: make a bot with @BotFather, paste its token, press
|
|
73
|
+
Start in the bot, and HeartCode finds your chat and says hello. Each kind can be switched off; a
|
|
74
|
+
test button; Disconnect forgets the token. The token is never shown whole or logged; a message
|
|
75
|
+
that can't be sent never holds up the work.
|
|
76
|
+
A token saved before Start was pressed in the bot no longer leaves notifications silently off:
|
|
77
|
+
the chat is found (and saved) the first time one is sent.
|
|
78
|
+
|
|
79
|
+
## 0.1.28 (2026-11-01)
|
|
80
|
+
|
|
81
|
+
- When a conversation outgrows the current model's context window and you have other models selected,
|
|
82
|
+
HeartCode now moves to a model with room instead of compacting — nothing is summarized away when a
|
|
83
|
+
roomier model is available. It scans your model list in order, so it picks your highest-priority
|
|
84
|
+
model that can hold the whole conversation; if none of your models has more room, it compacts as
|
|
85
|
+
before (uses what's available). With a single pinned model, nothing changes.
|
|
86
|
+
- Learning that actually keeps what it learns, per project:
|
|
87
|
+
- Every web page HeartCode reads is saved whole as Markdown in `.heartcode/research/` (one file
|
|
88
|
+
per page, its address as the name, a header with the URL, title, date and what it was looking
|
|
89
|
+
for; real Markdown tables; the folder ignores itself in git). Helpers' pages are saved too.
|
|
90
|
+
- `web_fetch` takes `look_for`: a long page comes as its outline plus the parts that match, with
|
|
91
|
+
line numbers into the saved file — not just the first 10,000 characters.
|
|
92
|
+
- `web_search` offers matching pages this project already has first (with the date each was read);
|
|
93
|
+
`fresh: true` searches the web anyway. Matching notes and saved pages come with each message.
|
|
94
|
+
- When a task that read the web, ran commands or made files ends, a wrap-up step saves what's
|
|
95
|
+
worth knowing as notes (project or global), keeps each page it read (with what it was used for)
|
|
96
|
+
or deletes it as junk, and removes throwaway files and empty folders the task made.
|
|
97
|
+
- Lessons learned from fixes now go to the project when they only hold there (they all went
|
|
98
|
+
global before); note names are cut at a word's end; saving a note that repeats one says so.
|
|
99
|
+
- Less in every request:
|
|
100
|
+
- MCP tools are listed by name with one line each (one `mcp` tool), not each tool's whole schema:
|
|
101
|
+
~13,400 → ~1,800 tokens for two browser servers. A call whose arguments don't fit gets the
|
|
102
|
+
tool's arguments back with what's wrong (and "did you mean"), and isn't run. The 100-tool cap is gone.
|
|
103
|
+
- Every sizable tool result is saved to a file when it comes (`~/.heart/outputs/`, kept with the
|
|
104
|
+
chat, deleted with it); past 8 long results, all but the newest 4 become a pointer to their file.
|
|
105
|
+
- The UI guide left the system prompt: it comes with a message about a UI, or with the first UI
|
|
106
|
+
file written.
|
|
107
|
+
- Older conversations' MCP calls (made by their own `mcp__server__tool` names) are rewritten as
|
|
108
|
+
`mcp` calls when resumed.
|
|
109
|
+
- Done means done:
|
|
110
|
+
- The first file change of a message waits for a plan (the todo list, each step with how it'll be checked).
|
|
111
|
+
- Saying it's done after changing files without running anything since: sent back to check it.
|
|
112
|
+
Naming files as made that don't exist: sent back.
|
|
113
|
+
- Before a task with changes ends, another of your models (or the same one, fresh) reviews it
|
|
114
|
+
against your request, plan, changes and what was run: YES, or NO with what's wrong, which goes
|
|
115
|
+
back to be fixed.
|
|
116
|
+
- Nothing stops a task but Esc: going round in circles (the same call five times, ten repeated
|
|
117
|
+
calls, eight failing commands, replies that loop) hands over to the next model in your list, or
|
|
118
|
+
warns and goes on; a server that keeps failing is waited out, not given up on. Reminders about
|
|
119
|
+
unfinished work repeat as long as the model makes progress (no count). The page check clicks
|
|
120
|
+
every control and looks again whenever pages changed (no 30-button, 2-page or 3-look caps).
|
|
121
|
+
- Fixed: tool outputs saved in the same millisecond overwrote each other; HeartCode's own research
|
|
122
|
+
files showed up as a command's file changes (and in /rewind).
|
|
123
|
+
- Helpers' replies are shown in full under their name (only the title showed before), printed whole
|
|
124
|
+
when each finishes so helpers working side by side don't interleave.
|
|
125
|
+
- Helpers (the agent tool) no longer stop at 25 steps — like the main session, they run until the job
|
|
126
|
+
is done (Esc stops them; --max-turns still applies if you set it).
|
|
127
|
+
|
|
5
128
|
## 0.1.27 (2026-10-31)
|
|
6
129
|
|
|
7
130
|
- A built-in computer-use MCP server (@zavora-ai/computer-use-mcp), off by default: switch it on in
|
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
1
3
|
# HeartCode
|
|
2
4
|
|
|
3
5
|
A coding agent for your terminal that works with any OpenAI-compatible model.
|
|
@@ -7,28 +9,58 @@ behind your back: only Node.js (20 or newer) and HeartCode's own code. What you
|
|
|
7
9
|
what you can read.
|
|
8
10
|
|
|
9
11
|
<!-- image: HeartCode in the terminal, answering a message -->
|
|
10
|
-

|
|
11
13
|
|
|
12
14
|
## Why I made it
|
|
13
15
|
|
|
14
16
|
Not to compete with other coding CLIs. I made it for my own use, because none of the ones I
|
|
15
|
-
tried did what I needed
|
|
16
|
-
|
|
17
|
-
- **
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- **
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- **
|
|
27
|
-
|
|
28
|
-
- **
|
|
29
|
-
|
|
17
|
+
tried did what I needed:
|
|
18
|
+
|
|
19
|
+
- **No dependencies, so no supply-chain attack.** Coding CLIs run with your files, your keys and
|
|
20
|
+
your shell. Most pull in hundreds of npm packages, and any one of them, or any package those
|
|
21
|
+
depend on, can be hijacked and ship malware in an update. HeartCode has none: no
|
|
22
|
+
`node_modules`, no install scripts, only Node.js and HeartCode's own code. There's nothing for
|
|
23
|
+
anyone else to poison, and you can read everything you run.
|
|
24
|
+
- **None of the other CLIs I've used did these**, so HeartCode does:
|
|
25
|
+
- **Rotates through your models on its own, across providers.** Give it a list (free ones
|
|
26
|
+
included). When one hits a rate limit, goes down or fails, the next answers, from another
|
|
27
|
+
provider first, and the work goes on. A ↻ in the status bar shows when a fallback is answering.
|
|
28
|
+
- **Moves to a bigger model instead of forgetting.** When the conversation outgrows a model's
|
|
29
|
+
context window, it switches to one of your models with room before it summarizes anything away.
|
|
30
|
+
- **Researches before it builds.** It assumes what it remembers is out of date and reads the
|
|
31
|
+
current official docs first, not blogs or memory.
|
|
32
|
+
- **Learns, per project, and keeps it.** Every web page it reads is kept whole in
|
|
33
|
+
`.heartcode/research/`. When a task ends it saves what's worth knowing as notes
|
|
34
|
+
(`.heartcode/memory/`), drops the junk and removes throwaway files, in the background, while
|
|
35
|
+
you go on. A mistake it fixes becomes a
|
|
36
|
+
lesson it won't repeat. The next task starts from what's known instead of searching again.
|
|
37
|
+
- **Checks its work before calling it done**: a plan first, a run after every change, and another
|
|
38
|
+
model reviewing the result against what you asked. Going round in circles hands the work to
|
|
39
|
+
your next model; only you (Esc) stop it.
|
|
40
|
+
- **Gets good work out of weak and local models.** Models that can't call tools are guided step
|
|
41
|
+
by step. Edits by line number save a model that can't repeat text exactly. Each model's
|
|
42
|
+
abilities come from [models.dev](https://models.dev), so nothing is spent finding out.
|
|
43
|
+
- **Sends only what's needed.** MCP tools go as names until one is used, old tool output becomes a
|
|
44
|
+
pointer to its saved file, and guides arrive when the task needs them.
|
|
45
|
+
- **Tells you on Telegram** when a task finishes, fails or waits for you, so you can walk away.
|
|
46
|
+
- **Never sends `max_tokens`**, so no provider cuts a reply short by a limit you didn't choose.
|
|
47
|
+
|
|
48
|
+
### And the rest you'd expect
|
|
49
|
+
|
|
50
|
+
- **Any OpenAI-compatible provider**, several at once: OpenRouter, Groq, NVIDIA, Gemini, Ollama,
|
|
51
|
+
LM Studio, your own proxy…
|
|
52
|
+
- **Set up in a web page** on your own machine (`/settings`), not by editing config files.
|
|
53
|
+
- **Usable by other tools and AI agents**: `heart -p` runs one task headless, like `claude -p`
|
|
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.
|
|
30
57
|
- **Takes skills, MCP servers and hooks** in Claude Code's formats; `/import` brings yours over.
|
|
31
|
-
- **
|
|
58
|
+
- **Tabs** (`Alt+T`), each with its own conversation, and git worktrees for work kept apart.
|
|
59
|
+
- **Servers and watchers in the background**: the model starts one and goes on working, reads its
|
|
60
|
+
output when it needs to, and stops it. `Alt+B` (or `/background`) shows their logs live above the input,
|
|
61
|
+
a tab each (←/→ or a click switches), while you work; nothing outlives HeartCode.
|
|
62
|
+
- **`/context`**: what fills the context window, part by part (system prompt, tools, messages, tool
|
|
63
|
+
results) and the biggest single pieces.
|
|
32
64
|
|
|
33
65
|
## How I set it up and use it
|
|
34
66
|
|
|
@@ -62,34 +94,52 @@ heart
|
|
|
62
94
|
### 3. Open the settings page
|
|
63
95
|
|
|
64
96
|
Type `/settings`. The settings page opens in your browser. It runs on your machine only
|
|
65
|
-
(127.0.0.1, with a secret key in its link).
|
|
97
|
+
(127.0.0.1, with a secret key in its link). A running HeartCode picks up what you change right
|
|
98
|
+
away.
|
|
66
99
|
|
|
67
100
|
<!-- image: the settings page -->
|
|
68
|
-

|
|
102
|
+
|
|
103
|
+
The sidebar, in four groups:
|
|
104
|
+
|
|
105
|
+
- **Models**: *Your list* (the models HeartCode uses, in order) and *Providers* (where they
|
|
106
|
+
come from).
|
|
107
|
+
- **General**: *Settings* (what it may do without asking, terminal colors, features, thinking
|
|
108
|
+
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
|
+
bottom lines show, with a live preview). **Notifications**: Telegram.
|
|
110
|
+
- **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).
|
|
69
112
|
|
|
70
|
-
### 4.
|
|
113
|
+
### 4. Add a provider and pick models
|
|
114
|
+
|
|
115
|
+
On **Models → Providers**:
|
|
116
|
+
|
|
117
|
+

|
|
71
118
|
|
|
72
119
|
1. **Add a provider**: its name, base URL and API key. Pick one of the presets to fill in the URL.
|
|
73
120
|
2. **Choose the models to use**: click a model to add it to your list. I use the free models.
|
|
74
121
|
|
|
75
|
-
### 5.
|
|
122
|
+
### 5. Put your list in order
|
|
123
|
+
|
|
124
|
+
On **Models → Your list**:
|
|
76
125
|
|
|
77
126
|
1. **Sort them by context and abilities.** Click the *Abilities* column, then *Context*: the
|
|
78
127
|
models that can do the most, with the biggest context window, come first. Click
|
|
79
|
-
**
|
|
128
|
+
**Save order** to keep it.
|
|
80
129
|
2. **Rearrange a bit more.** Drag a row to move it. #1 is the one HeartCode uses; the others are
|
|
81
130
|
its fallbacks, tried in order.
|
|
131
|
+
3. **Test them** (optional): **Test all** sends each a short message and shows which really answer.
|
|
82
132
|
|
|
83
133
|
If a model says *not found* in models.dev, **Retry** looks it up again, or **Set up** tells
|
|
84
134
|
HeartCode what it can do.
|
|
85
135
|
|
|
86
|
-
|
|
87
|
-

|
|
88
|
-
|
|
89
|
-
### 6. Turn on logging (optional)
|
|
136
|
+
### 6. Optional: notifications and logs
|
|
90
137
|
|
|
91
|
-
|
|
92
|
-
|
|
138
|
+
- **Notifications**: a Telegram message when a task finishes, fails or waits for you. Make a bot
|
|
139
|
+
with [@BotFather](https://t.me/BotFather), paste its token, press Start in the bot, and
|
|
140
|
+
HeartCode finds your chat.
|
|
141
|
+
- **Advanced → Logs**: a log of each run, and each request with its reply, in files of their own.
|
|
142
|
+
Logs older than 30 days are deleted (you can change that).
|
|
93
143
|
|
|
94
144
|
### 7. Back to HeartCode
|
|
95
145
|
|
|
@@ -101,7 +151,7 @@ Your changes are already in.
|
|
|
101
151
|
**Turn off** is selected: press Enter. The page stops and HeartCode is yours again.
|
|
102
152
|
|
|
103
153
|
<!-- image: the "settings page is on" dialog -->
|
|
104
|
-

|
|
105
155
|
|
|
106
156
|
### 9. Send "Hi" as a test
|
|
107
157
|
|
|
@@ -111,7 +161,11 @@ Type `Hi` and press Enter. Wait for the reply: your model works.
|
|
|
111
161
|
|
|
112
162
|
Use HeartCode like any other coding agent: ask it to read, change, run and fix things in your
|
|
113
163
|
project. `/` shows every command, `Shift+Tab` changes what it may do without asking, `Esc` stops
|
|
114
|
-
it, and `heart --help` lists everything else.
|
|
164
|
+
it, and `heart --help` lists everything else. While it works, commands that leave the conversation
|
|
165
|
+
alone (`/help`, `/cost`, `/diff`, `/select_model`, `/settings`, `/tab`, `/exit`…) run at once; the
|
|
166
|
+
ones that change it (`/compact`, `/rewind`, `/resume`…) wait until it's done. Pickers, questions and what
|
|
167
|
+
commands show (`/help`, `/context`, `/diff`…) open in a dialog over the conversation; `Esc`
|
|
168
|
+
closes it.
|
|
115
169
|
|
|
116
170
|
## License
|
|
117
171
|
|
package/SKILL.md
CHANGED
|
@@ -71,9 +71,10 @@ all refused the request outright, else after `--max-retries` (10) whole rounds o
|
|
|
71
71
|
model (`-m <model>`) waits out rate limits and outages, up to `--max-retries` tries, and stops at
|
|
72
72
|
any other error. A provider that refuses a part of the request HeartCode can do without (the
|
|
73
73
|
model's thinking sent back, keys in the tools' schemas, images) gets it again without that part,
|
|
74
|
-
and that is remembered for the model for a day.
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
and that is remembered for the model for a day. When a conversation takes 85% of the window of the
|
|
75
|
+
model answering (room is kept for the reply), a model of the list with room for all of it takes
|
|
76
|
+
over (the first such one in the list's order); only when none has room is it summarized. When the
|
|
77
|
+
list moves on to a model with a smaller window, it's summarized for that model before it's sent.
|
|
77
78
|
Each request is fitted to the model it goes to: one that can't see gets a note in place of each
|
|
78
79
|
image, one that can't call tools gets the tool calls as text.
|
|
79
80
|
|
|
@@ -142,7 +143,8 @@ Tool names: HeartCode's own (`read_file`, `edit_file`, `write_file`, `run_comman
|
|
|
142
143
|
`list_files`, `web_fetch`, `web_search`…) or Claude Code's (`Read`, `Edit`, `Write`, `Bash`,
|
|
143
144
|
`Grep`, `Glob`, `WebFetch`, `WebSearch`). `--disallowedTools Bash` takes one away. MCP servers'
|
|
144
145
|
tools are named as in Claude Code: `mcp__<server>__<tool>`; `mcp__<server>` means all of one
|
|
145
|
-
server's tools, `mcp` all of them.
|
|
146
|
+
server's tools, `mcp` all of them. (The model itself reaches them through one `mcp` tool that lists
|
|
147
|
+
each by name; in the output they keep their own names, below.)
|
|
146
148
|
|
|
147
149
|
## Choose the model
|
|
148
150
|
|
|
@@ -163,8 +165,8 @@ The model in use knows the user's other models (what each can do, how often it f
|
|
|
163
165
|
session) and works with them through its `agent` tool: it asks a model that can for what it
|
|
164
166
|
can't do itself (a model that can't see asks one that can about a screenshot: "which tiles show a
|
|
165
167
|
chair?"), several at once when there are many images or parts, and a helper that fails is handed to
|
|
166
|
-
the next capable model until one does the job. A helper
|
|
167
|
-
|
|
168
|
+
the next capable model until one does the job. A helper works until its job is done (no step
|
|
169
|
+
limit; `--max-turns` applies to it too). Their tokens are in `usage`, and each model's in
|
|
168
170
|
`modelUsage`.
|
|
169
171
|
|
|
170
172
|
## Setting up a model
|
|
@@ -189,12 +191,34 @@ answers. A run that fails with a wrong key or an unknown model: ask the user to
|
|
|
189
191
|
| Flag | |
|
|
190
192
|
|---|---|
|
|
191
193
|
| `--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 |
|
|
192
|
-
| `--mcp-config <file or JSON>` | more MCP servers (repeatable); `--strict-mcp-config`: only those.
|
|
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 |
|
|
193
195
|
| `--skills-dir <folder>` | more skills (repeatable) |
|
|
194
|
-
| `--no-memory` |
|
|
196
|
+
| `--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") |
|
|
195
197
|
|
|
196
198
|
A project's own `HEARTCODE.md` (or `AGENTS.md`, `CLAUDE.md`) is read like instructions.
|
|
197
199
|
|
|
200
|
+
## What a run leaves, and the extra requests
|
|
201
|
+
|
|
202
|
+
Unless you pass `--no-memory`, a run keeps what it learns in the project it works in:
|
|
203
|
+
`.heartcode/research/` (every web page it read, whole, as Markdown; that folder ignores itself in
|
|
204
|
+
git) and `.heartcode/memory/` (notes). Notes and pages that match a task come with it next time,
|
|
205
|
+
so later runs research less. After a task that read the web, ran commands or made files, a
|
|
206
|
+
wrap-up request saves notes, keeps or deletes the pages it read, and removes throwaway files and
|
|
207
|
+
empty folders the task made (a test script, a debug log). It runs after the answer: the
|
|
208
|
+
`result` (or the printed answer) comes first, and `heart -p` exits once the wrap-up is done (a few
|
|
209
|
+
seconds more).
|
|
210
|
+
|
|
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.
|
|
214
|
+
|
|
215
|
+
Before a task that changed files ends, another of the user's models (the same one when only one is
|
|
216
|
+
used) reviews the work against the request in a request of its own; a NO sends it back to fix.
|
|
217
|
+
The first file change of a task waits for the model's plan (its todo list). Changing files and
|
|
218
|
+
then saying it's done without running anything since sends it back to check. Nothing stops a
|
|
219
|
+
task but `--max-turns`, `--max-retries` or an interrupt: a model going round in circles hands the
|
|
220
|
+
work to the next model in the list. These requests are in `usage` and `modelUsage` too.
|
|
221
|
+
|
|
198
222
|
## Long tasks: a stream of events
|
|
199
223
|
|
|
200
224
|
```sh
|
|
@@ -204,9 +228,11 @@ heart -p --input-format stream-json --output-format stream-json
|
|
|
204
228
|
Stdin: one message per line, `{"type":"user","message":{"role":"user","content":"…"}}`.
|
|
205
229
|
Stop the running one with `{"type":"control_request","request_id":"1","request":{"subtype":"interrupt"}}`;
|
|
206
230
|
any other control request gets a `control_response` with `subtype: "error"` (not supported).
|
|
207
|
-
Stdout: one JSON event per line, `system`/`init` (its `tools` include the MCP servers' tools,
|
|
208
|
-
`mcp_servers` says which are `connected`), then `assistant` (text, thinking, `tool_use`),
|
|
209
|
-
`user` (`tool_result`), and a `result` after each message. It runs until stdin closes.
|
|
231
|
+
Stdout: one JSON event per line, `system`/`init` (its `tools` include the MCP servers' tools, each
|
|
232
|
+
`mcp__<server>__<tool>`, and `mcp_servers` says which are `connected`), then `assistant` (text, thinking, `tool_use`),
|
|
233
|
+
`user` (`tool_result`), and a `result` after each message. It runs until stdin closes. An MCP
|
|
234
|
+
call's `tool_use` is named as in Claude Code, `mcp__<server>__<tool>`, with the tool's own
|
|
235
|
+
arguments as `input`.
|
|
210
236
|
|
|
211
237
|
A helper's steps (the `agent` tool: another of the user's models, or the same one, doing a job;
|
|
212
238
|
several can run at once) come as `assistant` and `user` lines too, as Claude Code sends a
|