heartcode 0.1.44 → 0.1.54

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.
@@ -7,48 +7,45 @@ its section into ~/.heart/prompts/compact.md (every project) or .heartcode/promp
7
7
 
8
8
  ## summarizer
9
9
 
10
- <!-- System prompt of the summary request. -->
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.
10
+ <!-- The system prompt of the summary request. -->
11
+ You summarize conversations between a user and a coding assistant. Don't continue the work. No tools: write only the summary, as plain text.
12
12
 
13
13
  ## findings
14
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.
15
+ <!-- Asked of the model doing the task, as the next message of its own conversation, just before it's compacted. Its reply leads the summary that replaces the conversation. -->
16
+ The earlier part of this conversation will be replaced by a summary, and your reasoning will be gone. Write down what you need to carry on: 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. No tools.
18
17
 
19
18
  ## summarize-again
20
19
 
21
20
  <!-- Added when the first reply wasn't a summary (empty, or a tool call). -->
22
- Your last reply was not a summary. Don't call tools or continue the task: write the summary now, as plain notes.
21
+ Your last reply was not a summary. No tools, don't continue the task: write the summary now, as plain notes.
23
22
 
24
23
  ## summarize
25
24
 
26
- <!-- /compact and auto-compact: asks the model to summarize the conversation so far.
27
- {{conversation}}: the conversation as text. {{focus}}: what the user asked to keep (may be empty). -->
25
+ <!-- Asks for a summary of a conversation. {{conversation}}: it, as text. {{branch}}: set for /tree, when the user is leaving this part (a branch) for an earlier point; then {{files}}: the files it changed (may be empty). Else /compact and auto-compact, and {{focus}}: what the user asked to keep (may be empty). -->
28
26
  <conversation>
29
27
  {{conversation}}
30
28
  </conversation>
31
29
 
32
- Summarize the conversation above so that it can continue from your summary alone; the original will be gone.
30
+ {{#if branch}}The user is leaving the conversation above: they went back to an earlier point to try something else. Summarize it for the conversation they go on with:
31
+ - what was tried and how it went (what worked, what failed, why)
32
+ - decisions and findings worth keeping
33
+ - files changed there (with paths){{else}}Summarize the conversation above. Work continues from your summary alone; the original will be gone. Keep:
34
+ - what the user asked for (their words where it matters), and their preferences and decisions
35
+ - what was done: files read, created or changed (with paths) and the key details
36
+ - commands run and what they showed (errors, test results)
37
+ - what is unfinished or next{{/if}}{{#if files}}
38
+ Files it changed: {{files}}{{/if}}{{#if focus}}
39
+ Keep especially: {{focus}}{{/if}}
33
40
 
34
- Keep:
35
- - what the user asked for, in their words where it matters, and any preferences or decisions they stated
36
- - what has been done: files read, created or changed (with paths) and the important details of those changes
37
- - commands that were run and what they showed (errors, test results)
38
- - anything still unfinished or planned next
39
- {{#if focus}}
40
- The user asked to keep especially: {{focus}}
41
- {{/if}}
42
- Write it as compact notes. No preamble, no tool calls.
41
+ Write compact notes. No preamble, no tool calls.
43
42
 
44
43
  ## summary
45
44
 
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).
48
- {{requests}}: the user's messages so far, word for word ("- …" lines; may be empty). -->
45
+ <!-- Replaces the compacted part of the conversation. {{summary}}: the summary. {{findings}}: the model's own notes, written just before (may be empty). {{requests}}: the user's messages so far, word for word ("- …" lines; may be empty). -->
49
46
  This conversation was compacted to save space.{{#if findings}}
50
47
 
51
- Your own notes, written just before, of what you had found:
48
+ Your own notes, written just before:
52
49
 
53
50
  {{findings}}{{/if}}
54
51
 
@@ -59,27 +56,10 @@ Summary of everything before this point:
59
56
  The user's messages so far, word for word:
60
57
  {{requests}}{{/if}}
61
58
 
62
- ## branch-summarize
63
-
64
- <!-- /tree: the part of a branch the user is leaving, summarized for the branch they go to.
65
- {{conversation}}: that part as text. {{files}}: the files it changed (may be empty). -->
66
- <conversation>
67
- {{conversation}}
68
- </conversation>
69
-
70
- The user is leaving the conversation above (a branch: they went back to an earlier point to try something else). Summarize it for the conversation they go on with, so what was learned isn't lost:
71
- - what was tried and how it went (what worked, what failed and why)
72
- - decisions and findings worth keeping
73
- - files changed there (with paths){{#if files}}: {{files}}{{/if}}
74
-
75
- Compact notes. No preamble, no tool calls.
76
-
77
59
  ## branch-note
78
60
 
79
- <!-- Goes into the branch the user went to, before their next message. {{summary}}: the summary;
80
- {{files}}: the files the left branch changed; {{kept}} or {{restored}}: whether those changes are
81
- still on disk (only one is set, and only when it changed files). -->
82
- (The user went back to this point from another branch of this conversation. What happened on that branch, summarized:
61
+ <!-- Goes into the branch the user went to, before their next message. {{summary}}: the summary. {{files}}: the files the left branch changed. {{kept}} or {{restored}}: whether those changes are still on disk (one is set, only when it changed files). -->
62
+ (The user came back to this point from another branch of this conversation. What happened there:
83
63
 
84
64
  {{summary}}{{#if files}}
85
65
 
@@ -92,17 +72,16 @@ That branch changed {{files}}.{{/if}}{{#if kept}} Those changes are still in the
92
72
 
93
73
  ## summary-lost
94
74
 
95
- <!-- Stands in for a summary an older HeartCode lost (the model wrote a tool call instead). -->
75
+ <!-- Stands in for a summary an older HeartCode lost. -->
96
76
  (The summary of the earlier conversation was lost. Look at the project files to see where things stand.)
97
77
 
98
78
  ## continue
99
79
 
100
- <!-- Sent after an automatic compaction in the middle of a task, so the model carries on.
101
- {{task}}: the user's request it was working on, word for word (may be empty). -->
80
+ <!-- Sent after an automatic compaction in the middle of a task, so the model carries on. {{task}}: the request it was working on, word for word (may be empty). -->
102
81
  Continue the task from where you left off.{{#if task}} The request you are working on:
103
82
  {{task}}{{/if}}
104
83
 
105
84
  ## acknowledged
106
85
 
107
- <!-- After a manual /compact, the model's side of the exchange (keeps user/assistant turns alternating). -->
86
+ <!-- After a manual /compact: the model's side of the exchange (keeps user and assistant turns alternating). -->
108
87
  Understood. I have the summary and will continue from it.
package/prompts/guided.md CHANGED
@@ -7,18 +7,17 @@ its section into ~/.heart/prompts/guided.md (every project) or .heartcode/prompt
7
7
 
8
8
  ## system
9
9
 
10
- <!-- System prompt in guided mode (weak models: one question at a time). -->
11
- You are HeartCode, a precise coding agent working inside the user's project.
12
- HeartCode drives the work in small steps. Each message asks you ONE thing — answer exactly that, in the form asked, and nothing else: no explanation, no extra text.
13
- Base every answer on what you are shown, never on a guess: don't invent a file path, a name, a flag or code that isn't there. When you write code, write it complete and correct — no placeholders, and keep what should stay.
14
- Your memory of any external tool, library or API is out of date: get its current official docs online (search, then read the page) before using it, and follow the docs, not memory.
15
- Reuse what the project already has instead of writing it twice; keep code clean with clear names, and no comments unless something is genuinely non-obvious.
10
+ <!-- The system prompt in guided mode (models without tool calls: one question at a time). -->
11
+ You are HeartCode, a careful coding agent working in the user's project.
12
+ HeartCode does the work in small steps. Each message asks you ONE thing. Answer exactly that, in the form asked. No explanation, no extra text.
13
+ - Use only what you are shown. Never invent a file path, name, flag or code.
14
+ - Write code complete and correct. No placeholders. Keep what should stay.
15
+ - Your memory of tools, libraries and APIs is out of date: read their current docs online (search, then read) and follow the docs.
16
+ - Reuse what the project already has. Clear names. Comments only for what isn't obvious.
16
17
 
17
18
  ## context
18
19
 
19
- <!-- What comes before every guided question.
20
- {{task}}: the user's message. {{history}}: earlier messages and answers (may be empty).
21
- {{files}}: the project's files (or a note that there are none). {{done}}: notes on the steps so far (may be empty). -->
20
+ <!-- What comes before every guided question. {{task}}: the user's message. {{history}}: earlier messages and answers (may be empty). {{files}}: the project's files (or a note that there are none). {{done}}: notes on the steps so far (may be empty). -->
22
21
  TASK: {{task}}
23
22
  {{#if history}}
24
23
  EARLIER IN THIS CONVERSATION:
@@ -26,69 +25,45 @@ EARLIER IN THIS CONVERSATION:
26
25
  {{/if}}
27
26
  PROJECT FILES:{{files}}
28
27
  {{#if done}}
29
- WHAT HAS BEEN DONE SO FAR:
28
+ DONE SO FAR:
30
29
  {{done}}{{/if}}
31
30
 
32
31
  ## actions
33
32
 
34
- <!-- The steps guided mode can take, one per line as "name: what it does".
35
- The names are fixed (HeartCode acts on them); the descriptions are what the model sees in the menu. -->
33
+ <!-- The steps guided mode can take, one per line as "name: what it does". The names are fixed (HeartCode acts on them); the descriptions are what the model sees in the menu. -->
36
34
  read: look at a file
37
35
  search: find text in the project files
38
36
  edit: change an existing file
39
37
  create: make a new file
40
38
  run: run a shell command (tests, build, scripts)
41
39
  ask: ask the user a question
42
- delegate: hand the task to another of your models, one that can use tools itself
43
- finish: stop and give your final answer to the user
40
+ delegate: give the task to another of your models that can use tools
41
+ finish: stop and give your final answer
44
42
 
45
43
  ## next-action
46
44
 
47
- <!-- The step menu. {{menu}}: numbered steps, likeliest first. -->
45
+ <!-- The step menu. {{menu}}: numbered steps, likeliest first. {{reply}}: set when the last reply wasn't a number (what it said); {{count}}: how many steps. -->
48
46
  What should you do next for the TASK?
49
47
  {{menu}}
50
48
 
51
- Read a file before editing it. If the task is done, or it was only a question you can now answer, choose finish.
49
+ If DONE SO FAR shows the TASK is done, or it was a question you can now answer, choose finish.{{#if reply}}
50
+ "{{reply}}" is not a number from 1 to {{count}}.{{/if}}
52
51
  Reply with only the number.
53
52
 
54
- ## next-action-retry
55
-
56
- <!-- Added to the step menu when the reply wasn't a number. {{reply}}: what it said. {{count}}: how many steps. -->
57
- Your reply "{{reply}}" is not a number from 1 to {{count}}. Reply with only the number.
58
-
59
- ## yes-no
60
-
61
- <!-- A yes/no question. {{question}}: the question. -->
62
- {{question}}
63
- Reply with only yes or no.
64
-
65
53
  ## intent
66
54
 
67
55
  <!-- Asked at the start of each task: does it need changes? -->
68
- Does the TASK require changing existing code or creating files (not just answering a question)?
56
+ Does the TASK need code changed or files created (not just a question answered)?
57
+ Reply with only yes or no.
69
58
 
70
59
  ## pick-file
71
60
 
72
- <!-- Choosing a file. {{question}}: e.g. which-file-to-read. -->
73
- {{question}}
74
- Reply with only the file path.
75
-
76
- ## pick-file-retry
77
-
78
- <!-- The answer wasn't a project file. {{said}}: the answer. {{choices}}: the closest files, one per line. -->
79
- {{question}}
80
- Your answer "{{said}}" is not a file in the project. Choose one of these:
81
- {{choices}}
61
+ <!-- Choosing a file. {{edit}}: set when it's the file to change (else the file to read). {{said}}: set when the last answer wasn't a project file (what it said); {{choices}}: the closest files, one per line. -->
62
+ {{#if edit}}Which existing file should be changed?{{else}}Which file do you want to read?{{/if}}{{#if said}}
63
+ "{{said}}" is not a file in the project. Choose one of these:
64
+ {{choices}}{{/if}}
82
65
  Reply with only the file path.
83
66
 
84
- ## which-file-to-read
85
-
86
- Which file do you want to read?
87
-
88
- ## which-file-to-edit
89
-
90
- Which existing file should be changed?
91
-
92
67
  ## search
93
68
 
94
69
  What text should be searched for in the project files? Reply with only the search text.
@@ -96,10 +71,10 @@ What text should be searched for in the project files? Reply with only the searc
96
71
  ## edit-blocks
97
72
 
98
73
  <!-- Editing with SEARCH/REPLACE blocks. {{file}}: path. {{content}}: the file, fenced. -->
99
- Here is the current content of {{file}}:
74
+ The current content of {{file}}:
100
75
  {{content}}
101
76
 
102
- Write one or more SEARCH/REPLACE blocks that make the change needed for the TASK. Use exactly this format:
77
+ Write one or more SEARCH/REPLACE blocks that make the change the TASK needs. Use exactly this format:
103
78
  <<<<<<< SEARCH
104
79
  (lines copied exactly from the file)
105
80
  =======
@@ -110,52 +85,53 @@ Reply with only the blocks.
110
85
  ## rewrite
111
86
 
112
87
  <!-- Rewriting a whole file. {{file}}: path. {{content}}: the file, fenced. {{extra}}: an extra instruction (may be empty). -->
113
- Here is the current content of {{file}}:
88
+ The current content of {{file}}:
114
89
  {{content}}
115
90
 
116
- Rewrite this file with the change needed for the TASK. Reply with the COMPLETE new file content and nothing else. Keep everything that should not change. Never use placeholders like "rest of code here".{{#if extra}}
91
+ Rewrite this file with the change the TASK needs. Reply with the COMPLETE new file and nothing else. Keep everything that shouldn't change. Never write placeholders like "rest of code here".{{#if extra}}
117
92
  {{extra}}{{/if}}
118
93
 
119
94
  ## meant-to-remove
120
95
 
121
96
  <!-- Asked when an edit still removes definitions after a retry. {{names}}: what it removes. -->
122
- Your edit removes {{names}}. Does the TASK ask for that to be removed or renamed?
97
+ Your edit removes {{names}}. Does the TASK ask to remove or rename that?
98
+ Reply with only yes or no.
123
99
 
124
100
  ## keep-names
125
101
 
126
102
  <!-- An edit deleted definitions the task didn't ask to remove. {{names}}: them. {{them}}: "it" or "them". -->
127
- Your previous attempt deleted {{names}}. The TASK does not ask for that, so keep {{them}} exactly as is.
103
+ Your last try deleted {{names}}. The TASK doesn't ask for that: keep {{them}} exactly as is.
128
104
 
129
105
  ## find-place
130
106
 
131
107
  <!-- The file is too long to show. {{file}}: path. -->
132
- {{file}} is too long to show whole. What word or text in it marks the place that needs to change for the TASK? Reply with only that text.
108
+ {{file}} is too long to show whole. What word or text in it marks the place to change for the TASK? Reply with only that text.
133
109
 
134
110
  ## pick-range
135
111
 
136
112
  <!-- Choosing the lines to rewrite in a long file. {{file}}: path. {{part}}: " (lines 10-80 of 400)" or empty. {{view}}: numbered lines, fenced. -->
137
- Here is part of {{file}}{{part}}, with line numbers:
113
+ Part of {{file}}{{part}}, with line numbers:
138
114
  {{view}}
139
115
 
140
- Which lines need to change for the TASK? Reply with only the line range, like 12-30.
116
+ Which lines need to change for the TASK? Reply with only the range, like 12-30.
141
117
 
142
118
  ## rewrite-range
143
119
 
144
120
  <!-- Rewriting a line range. {{file}}, {{a}}-{{b}}: the range. {{chunk}}, {{before}}, {{after}}: fenced code. {{extra}}: an extra instruction (may be empty). -->
145
- In {{file}}, these are lines {{a}}-{{b}}:
121
+ In {{file}}, lines {{a}}-{{b}}:
146
122
  {{chunk}}
147
123
 
148
- The lines just before them:
124
+ The lines just before:
149
125
  {{before}}
150
- The lines just after them:
126
+ The lines just after:
151
127
  {{after}}
152
128
 
153
- Write the new code that replaces lines {{a}}-{{b}} for the TASK (it can be more or fewer lines).{{#if extra}}
129
+ Write the new code that replaces lines {{a}}-{{b}} for the TASK (more or fewer lines is fine).{{#if extra}}
154
130
  {{extra}}{{/if}} Reply with only that code.
155
131
 
156
132
  ## new-file-path
157
133
 
158
- What is the path of the new file, relative to the project root? Reply with only the path.
134
+ What is the new file's path, relative to the project root? Reply with only the path.
159
135
 
160
136
  ## new-file
161
137
 
@@ -169,25 +145,25 @@ Which shell command should be run?
169
145
  {{#if commands}}Commands this project has:
170
146
  {{commands}}
171
147
 
172
- Reply with a number from the list, or with a different shell command.{{else}}Reply with only the shell command.{{/if}}
148
+ Reply with a number from the list, or a different command.{{else}}Reply with only the command.{{/if}}
173
149
 
174
150
  ## ask-user
175
151
 
176
- What question do you want to ask the user? Reply with only the question.
152
+ What do you want to ask the user? Reply with only the question.
177
153
 
178
154
  ## finish
179
155
 
180
- Now write your final reply to the user: answer their request, or briefly summarize what was changed. Be clear and concise.
181
- Options for the user to choose from: a numbered list (1. 2. 3.), never bullets. Simple Markdown only (**bold**, `code`, plain lists, code blocks); no tables.
156
+ Now write your final reply to the user: answer their request, or say briefly what was changed.
157
+ Choices for the user: a numbered list (1. 2. 3.). Simple Markdown only (**bold**, `code`, plain lists, code blocks). No tables.
182
158
 
183
159
  ## describe-image
184
160
 
185
161
  <!-- For an image attached with @file.png. {{task}}: the user's message. -->
186
- The user attached this image to the task: "{{task}}". Describe everything in it that matters for the task: text, code, error messages, layout. Be thorough but concise.
162
+ The user attached this image to the task: "{{task}}". Describe everything in it that matters for the task: text, code, errors, layout. Thorough but short.
187
163
 
188
164
  ## note-repeated
189
165
 
190
- You just did the same thing twice — doing it again changes nothing. Choose a different step, or finish if the task is done.
166
+ You just did the same thing twice; again changes nothing. Choose a different step, or finish if the task is done.
191
167
 
192
168
  ## note-no-files
193
169
 
@@ -195,4 +171,4 @@ There are no files in the project.
195
171
 
196
172
  ## note-unknown-file
197
173
 
198
- Could not work out which file was meant.
174
+ Could not tell which file was meant.
@@ -0,0 +1,15 @@
1
+ # tests.md
2
+
3
+ What the settings page's Test asks your models (Test, Test all). Each `## name` below is one prompt.
4
+ A `<!-- … -->` note under a heading explains it and is never sent. To change one, copy its section
5
+ into ~/.heart/prompts/tests.md, or edit it on the settings page.
6
+
7
+ ## hello
8
+
9
+ <!-- Does it answer? One short message to the model; any reply in time passes, and its time shows under Works?. -->
10
+ Reply with just the word OK.
11
+
12
+ ## tool-check
13
+
14
+ <!-- A model that says it calls tools: can it do a small job with one? It gets HeartCode's write_file tool; it passes when it calls it with a path ending in notes.txt and content containing "hello" (keep those two, or it can't pass). -->
15
+ Create the file notes.txt containing exactly: hello
package/src/acp.js CHANGED
@@ -102,7 +102,7 @@ export async function runAcp({ makeApp, version, permission = 'ask', input = pro
102
102
  return { sessionId: ui.sessionId, modes: modes(ui.permission) }
103
103
  },
104
104
  'session/load': async ({ sessionId, cwd, mcpServers }) => {
105
- const chat = loadChat(sessionId)
105
+ const chat = loadChat(sessionId, cwd)
106
106
  if (!chat) throw Object.assign(new Error(`no session ${sessionId}`), { code: -32002 })
107
107
  const { ui } = await open(cwd ?? chat.root, mcpServers, chat)
108
108
  for (const h of chat.history) {