@cstart/coldstart 2.0.1 → 2.0.3

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.
@@ -152,11 +152,20 @@ function filesBlock(root, files) {
152
152
  }
153
153
 
154
154
  // --- The capture prompt (kept identical to the Codex/Claude capture prompt) ----
155
- function buildCapturePrompt(root, block, sid) {
155
+ function buildCapturePrompt(root, block, sid, isSubagent) {
156
156
  return `You have completed a task now and have gathered knowledge as a part of that task or \
157
- process. We need to preserve the knowledge so that another agent in future can make use of your \
158
- findings. We are storing this in a notebook format and this notebook has to be backed by the \
159
- codebase you are working on.
157
+ process knowledge another agent in future could make use of.
158
+
159
+ But before writing any notes, we need to decide whether the task you completed deserves a note. \
160
+ If you were investigating on an older branch or doing a PR review, we may not need to save notes \
161
+ because that code is not in the present — it's in the past or it's in the future. The notes that \
162
+ we write are backed by the code in the present. This was an example to explain to you. As an \
163
+ agent who worked on the current task, you know its exact intent and are best suited to decide \
164
+ whether this task deserves a note. And if nothing about the current code is worth recording, \
165
+ then no note is the right answer.
166
+
167
+ Once you decide the task does deserve a note, we store it in a notebook format, and this \
168
+ notebook has to be backed by the codebase you are working on.
160
169
 
161
170
  We need to save only the working knowledge of the codebase in a specific format so that it can \
162
171
  be searched and served to future cold agents. We don't need to store any general interaction you \
@@ -167,8 +176,9 @@ below format —
167
176
 
168
177
  THE NOTEBOOK HAS THREE CONTAINERS. Put each piece of knowledge in its one home:
169
178
 
170
- 1. FILE notes write one for EVERY file you actually read and understood this session. No \
171
- judgment call about whether it seems obvious. First decide the file's CHARACTER:
179
+ 1. FILE notes (if you decided to write a note for the entire task) write one for EVERY file \
180
+ you actually read and understood this session. No judgment call about whether it seems obvious. \
181
+ First decide the file's CHARACTER:
172
182
  - hub = the file has no single purpose (models.py, helpers, utils). Knowledge lives per \
173
183
  SYMBOL, as facets: one facet for each symbol you worked with this session. Only symbols you \
174
184
  have firsthand knowledge of — never enumerate the rest.
@@ -245,7 +255,9 @@ Spec shapes (only include fields you actually have):
245
255
  "body":"what you looked for + that it is not there",
246
256
  "scope":{"terms":["search","terms"]}} (the search that proved it)
247
257
 
248
- When your notes are written, stop.`;
258
+ ${isSubagent
259
+ ? `Once you have handled the notebook — whether you wrote notes or decided none were needed — remember you were spawned as a subagent. The coordinator that spawned you receives ONLY your final message, so your last message must repeat, in full, the result you produced for it — your findings, not the notebook decision.`
260
+ : `When your notes are written, stop.`}`;
249
261
  }
250
262
 
251
263
  // --- stdin + guards -------------------------------------------------------------
@@ -324,7 +336,7 @@ process.on("unhandledRejection", (e) => { log(`unhandled ${e?.stack || e}`); pro
324
336
  process.exit(0);
325
337
  }
326
338
 
327
- const prompt = buildCapturePrompt(root, filesBlock(root, files), sid);
339
+ const prompt = buildCapturePrompt(root, filesBlock(root, files), sid, event === "subagentStop");
328
340
  logCaptureEvent(root, { event: "elicit", session: sid, agent: aid, touched: files.length, hook: event });
329
341
  log(`ELICIT session=${sid} agent=${aid} touched=${files.length} promptBytes=${prompt.length} event=${event || "?"}`);
330
342
  process.stdout.write(JSON.stringify({ followup_message: prompt }));
@@ -147,11 +147,20 @@ function filesBlock(root, files) {
147
147
 
148
148
  // --- The capture prompt (v4, 2026-07-07 — user-authored opening; validation-run
149
149
  // configuration: gates off via --force, capture-only) ---------------------------
150
- function buildCapturePrompt(root, block, sid) {
150
+ function buildCapturePrompt(root, block, sid, isSubagent) {
151
151
  return `You have completed a task now and have gathered knowledge as a part of that task or \
152
- process. We need to preserve the knowledge so that another agent in future can make use of your \
153
- findings. We are storing this in a notebook format and this notebook has to be backed by the \
154
- codebase you are working on.
152
+ process knowledge another agent in future could make use of.
153
+
154
+ But before writing any notes, we need to decide whether the task you completed deserves a note. \
155
+ If you were investigating on an older branch or doing a PR review, we may not need to save notes \
156
+ because that code is not in the present — it's in the past or it's in the future. The notes that \
157
+ we write are backed by the code in the present. This was an example to explain to you. As an \
158
+ agent who worked on the current task, you know its exact intent and are best suited to decide \
159
+ whether this task deserves a note. And if nothing about the current code is worth recording, \
160
+ then no note is the right answer.
161
+
162
+ Once you decide the task does deserve a note, we store it in a notebook format, and this \
163
+ notebook has to be backed by the codebase you are working on.
155
164
 
156
165
  We need to save only the working knowledge of the codebase in a specific format so that it can \
157
166
  be searched and served to future cold agents. We don't need to store any general interaction you \
@@ -162,8 +171,9 @@ below format —
162
171
 
163
172
  THE NOTEBOOK HAS THREE CONTAINERS. Put each piece of knowledge in its one home:
164
173
 
165
- 1. FILE notes write one for EVERY file you actually read and understood this session. No \
166
- judgment call about whether it seems obvious. First decide the file's CHARACTER:
174
+ 1. FILE notes (if you decided to write a note for the entire task) write one for EVERY file \
175
+ you actually read and understood this session. No judgment call about whether it seems obvious. \
176
+ First decide the file's CHARACTER:
167
177
  - hub = the file has no single purpose (models.py, helpers, utils). Knowledge lives per \
168
178
  SYMBOL, as facets: one facet for each symbol you worked with this session. Only symbols you \
169
179
  have firsthand knowledge of — never enumerate the rest.
@@ -239,7 +249,9 @@ Spec shapes (only include fields you actually have):
239
249
  "body":"what you looked for + that it is not there",
240
250
  "scope":{"terms":["search","terms"]}} (the search that proved it)
241
251
 
242
- When your notes are written, stop.`;
252
+ ${isSubagent
253
+ ? `Once you have handled the notebook — whether you wrote notes or decided none were needed — remember you were spawned as a subagent. The coordinator that spawned you receives ONLY your final message, so your last message must repeat, in full, the result you produced for it — your findings, not the notebook decision.`
254
+ : `When your notes are written, stop.`}`;
243
255
  }
244
256
 
245
257
  // --- stdin + guards -------------------------------------------------------------
@@ -323,7 +335,7 @@ process.on("unhandledRejection", (e) => { log(`unhandled ${e?.stack || e}`); pro
323
335
  process.exit(0);
324
336
  }
325
337
 
326
- const prompt = buildCapturePrompt(root, filesBlock(root, files), sid);
338
+ const prompt = buildCapturePrompt(root, filesBlock(root, files), sid, input.hook_event_name === "SubagentStop");
327
339
  logCaptureEvent(root, { event: "elicit", session: sid, agent: aid, touched: files.length, hook: input.hook_event_name });
328
340
  log(`ELICIT session=${sid} agent=${aid} touched=${files.length} promptBytes=${prompt.length} event=${input.hook_event_name || "?"}`);
329
341
  process.stdout.write(JSON.stringify({ decision: "block", reason: prompt }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cstart/coldstart",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },