castle-web-cli 0.4.30 → 0.4.31

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.
@@ -28,6 +28,5 @@ export declare function buildTaskPrompt(opts: {
28
28
  progressPath: string;
29
29
  notesPath: string;
30
30
  depsSummary?: string;
31
- backend?: 'cursor' | 'claude';
32
31
  }): string;
33
32
  export declare const CLAUDE_TASK_SYSTEM_REMINDER = "Castle background task agent: work autonomously to completion -- never pause to ask questions or wait for confirmation; finish the task end-to-end, then stop. Prefer the quickest viable change that fully does the job.";
@@ -21,10 +21,8 @@ Hard rules:
21
21
  short imperative title on the first line
22
22
  after: comma-separated titles or ids this task must wait for (optional line)
23
23
  supersedes: comma-separated titles or ids this task replaces (optional line)
24
- Then a SHORT self-contained prompt -- one tight paragraph (aim under 100
25
- words): what to build or fix and what "done" looks like. Task agents read
26
- the deck's own docs for framework/API detail, so never restate recipes,
27
- file layouts, or implementation steps.
24
+ Then a detailed, self-contained prompt for the implementing agent:
25
+ what to build or fix, which files matter, and what "done" looks like.
28
26
  \`\`\`
29
27
 
30
28
  - Use \`after:\` only when a task truly builds on or would conflict with another (it may reference tasks spawned in this same reply, by title). Independent tasks must NOT wait on each other.
@@ -103,16 +101,6 @@ export function buildTaskPrompt(opts) {
103
101
  const deps = opts.depsSummary
104
102
  ? `\n\nThis task waited on earlier tasks:\n${opts.depsSummary}\n`
105
103
  : '';
106
- // Claude-only: collapsing the wrap-up (progress 90 + restart + notes) into
107
- // one shell call reliably saves 1-2 serial ~7s turns there. Cursor's
108
- // composer sometimes reacts to the same rule with MORE calls, so it stays
109
- // on the plain instructions. Read-before-overwrite likewise targets
110
- // claude's Write-tool precondition (a blind Write to an existing file is
111
- // rejected, forcing a wasted failed-call + Read + retry cycle).
112
- const wrapUp = opts.backend === 'claude'
113
- ? `\n- NEVER point your Write tool at a file that already exists (scenes/main.scene especially): it rejects files it has not Read, and the failed call + forced Read wastes two turns. Replace existing files with ONE shell command instead (\`cat > scenes/main.scene <<'EOF' ... EOF\`); reserve the Write tool for brand-new files.
114
- - Wrap up in ONE tool call, not several: once your last file edit is done, combine the 90-progress write, the final \`npm run restart\`, and writing the notes file into a single shell command (\`;\`-separated so the notes land even if the restart hiccups). Then stop -- no extra turns after it.`
115
- : '';
116
104
  return `You are a background build agent for the Castle deck "${opts.deckLabel}" (current directory). A separate conversation agent dispatched you with one task. Read the deck's CLAUDE.md / AGENTS.md first and follow its workflow (including reloading the served deck after changes, e.g. \`npm run restart\`).
117
105
 
118
106
  Your task (id ${opts.taskId}): ${opts.title}
@@ -125,7 +113,7 @@ Operating rules:
125
113
  - The moment implementation is complete and you switch to verifying, write 90 to the progress file -- verification time must not read as stalled progress.
126
114
  - Do this one task completely, then stop. Do not expand scope.
127
115
  - Update your progress VERY frequently: write a bare integer 0-100 to ${opts.progressPath} (e.g. \`echo 30 > ${opts.progressPath}\`) every time you advance -- at least every 10 points, or every 20 for properly small tasks. Start near 10, write 90 just before wrapping up. Never let it sit stale while you work.
128
- - Before finishing, write ${opts.notesPath}: a SHORT test guide for the user -- 2-4 brief sentences. Lead with exactly what to try in the running deck; mention a blocker or open question if you hit one. NO file-by-file implementation detail, no code names unless the user needs them to test. The user reads this verbatim when checking your work off.${wrapUp}
116
+ - Before finishing, write ${opts.notesPath}: a SHORT test guide for the user -- 2-4 brief sentences. Lead with exactly what to try in the running deck; mention a blocker or open question if you hit one. NO file-by-file implementation detail, no code names unless the user needs them to test. The user reads this verbatim when checking your work off.
129
117
  - If you are truly blocked, write the blocker to the notes file and stop rather than guessing wildly.
130
118
  - Never touch files under .castle/ other than those two paths.`;
131
119
  }
package/dist/agent.js CHANGED
@@ -428,13 +428,10 @@ async function runTaskAgentIn(ctx, task) {
428
428
  progressPath: path.join(relDir, 'progress'),
429
429
  notesPath: path.join(relDir, 'notes.md'),
430
430
  depsSummary: ctx.depsSummary,
431
- backend: ctx.backend,
432
431
  });
433
- // Claude task autonomy comes from CLAUDE_TASK_SYSTEM_REMINDER (appended to
434
- // the system prompt in buildAgentInvocation). No /goal prefix: goal
435
- // conditions cap at 4000 chars, so long task prompts made the CLI exit
436
- // instantly with an error -- which then read as a 1-second "done".
437
- const invocation = buildAgentInvocation(ctx.backend, 'task', taskPrompt, ctx.claudeModel);
432
+ // Claude task runs get /goal (claude code's built-in commit-to-completion
433
+ // command) plus the system-prompt autonomy reminder.
434
+ const invocation = buildAgentInvocation(ctx.backend, 'task', ctx.backend === 'claude' ? `/goal ${taskPrompt}` : taskPrompt, ctx.claudeModel);
438
435
  let result = { ok: false, finalText: '', error: 'not run' };
439
436
  let lineBuf = '';
440
437
  const flushFeedLines = (delta) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "castle-web-cli",
3
- "version": "0.4.30",
3
+ "version": "0.4.31",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "castle-web": "./dist/index.js"