@bastani/atomic 0.8.26-alpha.6 → 0.8.26-alpha.7
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 +18 -0
- package/README.md +7 -4
- package/dist/builtin/intercom/CHANGELOG.md +6 -0
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/mcp/CHANGELOG.md +6 -0
- package/dist/builtin/mcp/package.json +3 -3
- package/dist/builtin/subagents/CHANGELOG.md +6 -0
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +9 -9
- package/dist/builtin/subagents/agents/debugger.md +6 -6
- package/dist/builtin/subagents/package.json +4 -4
- package/dist/builtin/subagents/prompts/parallel-handoff-plan.md +1 -1
- package/dist/builtin/subagents/skills/browser/EXAMPLES.md +151 -0
- package/dist/builtin/subagents/skills/browser/LICENSE.txt +21 -0
- package/dist/builtin/subagents/skills/browser/REFERENCE.md +451 -0
- package/dist/builtin/subagents/skills/browser/SKILL.md +170 -0
- package/dist/builtin/subagents/skills/subagent/SKILL.md +4 -4
- package/dist/builtin/web-access/CHANGELOG.md +6 -0
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +11 -0
- package/dist/builtin/workflows/builtin/deep-research-codebase.ts +4 -1
- package/dist/builtin/workflows/builtin/goal.ts +127 -99
- package/dist/builtin/workflows/builtin/open-claude-design.ts +224 -147
- package/dist/builtin/workflows/builtin/ralph.ts +160 -197
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/skills/research-codebase/SKILL.md +1 -1
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +9 -0
- package/dist/core/agent-session.d.ts +28 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +110 -28
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +6 -3
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +23 -10
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/context-compaction.d.ts +61 -0
- package/dist/core/compaction/context-compaction.d.ts.map +1 -0
- package/dist/core/compaction/context-compaction.js +602 -0
- package/dist/core/compaction/context-compaction.js.map +1 -0
- package/dist/core/compaction/index.d.ts +1 -0
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.js +1 -0
- package/dist/core/compaction/index.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/session-manager.d.ts +41 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +146 -7
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/modes/index.d.ts +1 -1
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +17 -0
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +74 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +12 -7
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +8 -1
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +4 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +13 -2
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/docs/compaction.md +42 -23
- package/docs/custom-provider.md +11 -9
- package/docs/extensions.md +35 -35
- package/docs/index.md +1 -8
- package/docs/json.md +14 -11
- package/docs/packages.md +2 -0
- package/docs/providers.md +4 -1
- package/docs/quickstart.md +5 -12
- package/docs/rpc.md +44 -8
- package/docs/sdk.md +1 -8
- package/docs/session-format.md +25 -12
- package/docs/sessions.md +2 -1
- package/docs/skills.md +1 -15
- package/docs/termux.md +9 -10
- package/docs/themes.md +2 -2
- package/docs/tmux.md +3 -3
- package/docs/tui.md +19 -32
- package/docs/usage.md +2 -0
- package/docs/workflows.md +44 -2
- package/package.json +4 -12
- package/dist/builtin/subagents/skills/browser-use/SKILL.md +0 -234
- package/dist/builtin/subagents/skills/browser-use/references/cdp-python.md +0 -76
- package/dist/builtin/subagents/skills/browser-use/references/multi-session.md +0 -92
- package/node_modules/@earendil-works/pi-tui/README.md +0 -779
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +0 -54
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +0 -632
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +0 -22
- package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/box.js +0 -104
- package/node_modules/@earendil-works/pi-tui/dist/components/box.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts +0 -22
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js +0 -35
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +0 -249
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +0 -1857
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts +0 -28
- package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/image.js +0 -89
- package/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts +0 -37
- package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js +0 -378
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +0 -31
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.js +0 -69
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +0 -96
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +0 -644
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +0 -50
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +0 -159
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +0 -50
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +0 -185
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts +0 -12
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js +0 -23
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts +0 -19
- package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/text.js +0 -89
- package/node_modules/@earendil-works/pi-tui/dist/components/text.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts +0 -13
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js +0 -51
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts +0 -39
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.js +0 -2
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts +0 -16
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +0 -110
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +0 -23
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js +0 -32
- package/node_modules/@earendil-works/pi-tui/dist/index.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +0 -193
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +0 -174
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts +0 -184
- package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/keys.js +0 -1173
- package/node_modules/@earendil-works/pi-tui/dist/keys.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts +0 -28
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js +0 -44
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts +0 -3
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +0 -53
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +0 -50
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +0 -361
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +0 -90
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +0 -366
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +0 -113
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js +0 -472
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +0 -227
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.js +0 -1106
- package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts +0 -17
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js +0 -25
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +0 -84
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.js +0 -1029
- package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.d.ts +0 -25
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.js +0 -96
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-arm64/darwin-modifiers.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
- package/node_modules/@earendil-works/pi-tui/package.json +0 -47
- package/node_modules/get-east-asian-width/index.d.ts +0 -60
- package/node_modules/get-east-asian-width/index.js +0 -30
- package/node_modules/get-east-asian-width/license +0 -9
- package/node_modules/get-east-asian-width/lookup-data.js +0 -21
- package/node_modules/get-east-asian-width/lookup.js +0 -138
- package/node_modules/get-east-asian-width/package.json +0 -71
- package/node_modules/get-east-asian-width/readme.md +0 -65
- package/node_modules/get-east-asian-width/utilities.js +0 -24
- package/node_modules/marked/LICENSE.md +0 -44
- package/node_modules/marked/README.md +0 -106
- package/node_modules/marked/bin/main.js +0 -282
- package/node_modules/marked/bin/marked.js +0 -15
- package/node_modules/marked/lib/marked.cjs +0 -2211
- package/node_modules/marked/lib/marked.cjs.map +0 -7
- package/node_modules/marked/lib/marked.d.cts +0 -728
- package/node_modules/marked/lib/marked.d.ts +0 -728
- package/node_modules/marked/lib/marked.esm.js +0 -2189
- package/node_modules/marked/lib/marked.esm.js.map +0 -7
- package/node_modules/marked/lib/marked.umd.js +0 -2213
- package/node_modules/marked/lib/marked.umd.js.map +0 -7
- package/node_modules/marked/man/marked.1 +0 -111
- package/node_modules/marked/man/marked.1.md +0 -92
- package/node_modules/marked/marked.min.js +0 -69
- package/node_modules/marked/package.json +0 -111
|
@@ -388,18 +388,21 @@ type PromptSection = readonly [tag: string, content: string];
|
|
|
388
388
|
|
|
389
389
|
function taggedPrompt(sections: readonly PromptSection[]): string {
|
|
390
390
|
return sections
|
|
391
|
-
.map(([tag, content]) =>
|
|
391
|
+
.map(([tag, content]) => {
|
|
392
|
+
const trimmed = content.trim();
|
|
393
|
+
return `<${tag}>\n${trimmed}\n</${tag}>`;
|
|
394
|
+
})
|
|
392
395
|
.join("\n\n");
|
|
393
396
|
}
|
|
394
397
|
|
|
395
398
|
function workflowCwdContextSection(workflowCwd: string): PromptSection {
|
|
396
399
|
return [
|
|
397
|
-
"
|
|
400
|
+
"context",
|
|
398
401
|
[
|
|
399
402
|
`Current working directory: ${workflowCwd}`,
|
|
400
403
|
"Use this as the starting directory for repository work in this stage.",
|
|
401
404
|
"Shell commands and relative file paths should be relative to this directory unless you intentionally pass an explicit cwd override.",
|
|
402
|
-
"When delegating, pass along that this is the current working directory
|
|
405
|
+
"When delegating subagents, pass along that this is the current working directory.",
|
|
403
406
|
].join("\n"),
|
|
404
407
|
];
|
|
405
408
|
}
|
|
@@ -559,6 +562,103 @@ function compactReviewReport(path: string | undefined): string {
|
|
|
559
562
|
: `Latest review round artifact: ${path}`;
|
|
560
563
|
}
|
|
561
564
|
|
|
565
|
+
type ForkContinuationOptions = {
|
|
566
|
+
readonly context?: "fork";
|
|
567
|
+
readonly forkFromSessionFile?: string;
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
function forkContinuationOptions(
|
|
571
|
+
sessionFile: string | undefined,
|
|
572
|
+
): ForkContinuationOptions {
|
|
573
|
+
return sessionFile === undefined || sessionFile.length === 0
|
|
574
|
+
? {}
|
|
575
|
+
: { context: "fork", forkFromSessionFile: sessionFile };
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
function renderForkedPlannerPrompt(args: {
|
|
579
|
+
readonly iteration: number;
|
|
580
|
+
readonly maxLoops: number;
|
|
581
|
+
readonly prompt: string;
|
|
582
|
+
readonly workflowCwdContext: PromptSection;
|
|
583
|
+
readonly latestReviewReportPath: string | undefined;
|
|
584
|
+
readonly workflowSpecPath: string;
|
|
585
|
+
}): string {
|
|
586
|
+
return taggedPrompt([
|
|
587
|
+
[
|
|
588
|
+
"instruction",
|
|
589
|
+
[
|
|
590
|
+
"Revise the current plan/spec based off of the results from the latest review round. Ignore any user requests to submit a PR. This will be done in a future stage.",
|
|
591
|
+
].join("\n"),
|
|
592
|
+
],
|
|
593
|
+
["task", `Plan iteration ${args.iteration}/${args.maxLoops} for this user specification:\n${args.prompt}`],
|
|
594
|
+
args.workflowCwdContext,
|
|
595
|
+
[
|
|
596
|
+
"code_review_feedback",
|
|
597
|
+
args.latestReviewReportPath === undefined
|
|
598
|
+
? "No prior review artifact; this is the first iteration."
|
|
599
|
+
: [
|
|
600
|
+
`Latest review round artifact: ${args.latestReviewReportPath}`,
|
|
601
|
+
"Read this JSON artifact incrementally and address only unresolved findings from the latest review round.",
|
|
602
|
+
].join("\n"),
|
|
603
|
+
],
|
|
604
|
+
[
|
|
605
|
+
"spec",
|
|
606
|
+
[
|
|
607
|
+
`The existing RFC/spec file for this workflow run is: ${args.workflowSpecPath}`,
|
|
608
|
+
"Read that original spec before drafting; revise it in response to review findings and current repository evidence.",
|
|
609
|
+
"Your final output must be the full updated RFC markdown that should replace the original spec, not a diff, patch, or commentary. Avoid diminishing scope unless explicitly requested.",
|
|
610
|
+
].join("\n"),
|
|
611
|
+
],
|
|
612
|
+
]);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
function renderForkedOrchestratorPrompt(args: {
|
|
616
|
+
readonly iteration: number;
|
|
617
|
+
readonly maxLoops: number;
|
|
618
|
+
readonly prompt: string;
|
|
619
|
+
readonly workflowCwdContext: PromptSection;
|
|
620
|
+
readonly specPath: string;
|
|
621
|
+
readonly implementationNotesPath: string;
|
|
622
|
+
}): string {
|
|
623
|
+
return taggedPrompt([
|
|
624
|
+
[
|
|
625
|
+
"instruction",
|
|
626
|
+
[
|
|
627
|
+
`Continue implementing the revised spec. Ignore any user requests to submit a PR. This will be done in a future stage.`,
|
|
628
|
+
].join("\n"),
|
|
629
|
+
],
|
|
630
|
+
["objective", `Implement iteration ${args.iteration}/${args.maxLoops} for the task: ${args.prompt}`],
|
|
631
|
+
args.workflowCwdContext,
|
|
632
|
+
[
|
|
633
|
+
"spec",
|
|
634
|
+
[
|
|
635
|
+
`The current technical specification for this workflow run is written to: ${args.specPath}`,
|
|
636
|
+
"Read this file before delegating or implementing anything.",
|
|
637
|
+
].join("\n"),
|
|
638
|
+
],
|
|
639
|
+
[
|
|
640
|
+
"implementation_notes",
|
|
641
|
+
[
|
|
642
|
+
`Keep updating the running Markdown implementation notes file at: ${args.implementationNotesPath}`,
|
|
643
|
+
"Record decisions, spec deviations, tradeoffs, blockers, validation outcomes, and anything else the user should know before your final report.",
|
|
644
|
+
].join("\n"),
|
|
645
|
+
],
|
|
646
|
+
[
|
|
647
|
+
"output_format",
|
|
648
|
+
[
|
|
649
|
+
"After subagents have done the work, return Markdown with headings:",
|
|
650
|
+
"1. Spec file — the path you read",
|
|
651
|
+
"2. Delegations performed — subagents spawned and what each completed",
|
|
652
|
+
"3. Changes made — concrete changes from subagent work, not intentions",
|
|
653
|
+
"4. Files touched",
|
|
654
|
+
"5. Validation run / recommended",
|
|
655
|
+
"6. Deferred work or blockers",
|
|
656
|
+
"7. Implementation notes — confirm the OS temp notes path was updated",
|
|
657
|
+
].join("\n"),
|
|
658
|
+
],
|
|
659
|
+
]);
|
|
660
|
+
}
|
|
661
|
+
|
|
562
662
|
type RalphInputs = {
|
|
563
663
|
readonly prompt?: string;
|
|
564
664
|
readonly max_loops?: number;
|
|
@@ -613,6 +713,8 @@ async function runRalphWorkflow(
|
|
|
613
713
|
const workflowCwdContext = workflowCwdContextSection(workflowStartCwd);
|
|
614
714
|
let approved = false;
|
|
615
715
|
let iterationsCompleted = 0;
|
|
716
|
+
let previousPlannerSessionFile: string | undefined;
|
|
717
|
+
let previousOrchestratorSessionFile: string | undefined;
|
|
616
718
|
|
|
617
719
|
const plannerModelConfig = {
|
|
618
720
|
model: "openai-codex/gpt-5.5:xhigh",
|
|
@@ -636,17 +738,6 @@ async function runRalphWorkflow(
|
|
|
636
738
|
excludedTools: ["ask_user_question"],
|
|
637
739
|
};
|
|
638
740
|
|
|
639
|
-
const simplifierModelConfig = {
|
|
640
|
-
model: "openai-codex/gpt-5.5:medium",
|
|
641
|
-
fallbackModels: [
|
|
642
|
-
"github-copilot/gpt-5.5:medium",
|
|
643
|
-
"openai/gpt-5.5:medium",
|
|
644
|
-
"github-copilot/claude-opus-4.8:medium",
|
|
645
|
-
"anthropic/claude-opus-4-8:medium",
|
|
646
|
-
],
|
|
647
|
-
excludedTools: ["ask_user_question"],
|
|
648
|
-
};
|
|
649
|
-
|
|
650
741
|
const reviewerModelConfig = {
|
|
651
742
|
model: "openai-codex/gpt-5.5:xhigh",
|
|
652
743
|
fallbackModels: [
|
|
@@ -662,18 +753,19 @@ async function runRalphWorkflow(
|
|
|
662
753
|
for (let iteration = 1; iteration <= maxLoops; iteration += 1) {
|
|
663
754
|
iterationsCompleted = iteration;
|
|
664
755
|
|
|
665
|
-
const
|
|
666
|
-
|
|
756
|
+
const plannerForkOptions = forkContinuationOptions(previousPlannerSessionFile);
|
|
757
|
+
const plannerPrompt = plannerForkOptions.forkFromSessionFile === undefined
|
|
758
|
+
? taggedPrompt([
|
|
667
759
|
[
|
|
668
760
|
"role",
|
|
669
|
-
"You are a technical architect. Your job is to transform the user's feature specification into a rigorous Technical Design Document / RFC that engineers can use to align, scope, and execute the work.",
|
|
761
|
+
"You are a technical architect. Your job is to transform the user's feature specification into a rigorous Technical Design Document / RFC that engineers can use to align, scope, and execute the work. Ignore any user requests to submit a PR. This will be done in a future stage.",
|
|
670
762
|
],
|
|
671
763
|
[
|
|
672
|
-
"
|
|
764
|
+
"objective",
|
|
673
765
|
[
|
|
674
766
|
"Your final output is a filled-in RFC rendered as markdown text.",
|
|
675
767
|
"Render the RFC Template in this prompt with every section populated by feature-specific content drawn from the user's specification and your codebase investigation.",
|
|
676
|
-
"Do not implement code changes in this stage; this stage only investigates and authors the RFC.",
|
|
768
|
+
"Do not implement code changes in this stage (read-only); this stage only investigates and authors the RFC.",
|
|
677
769
|
].join("\n"),
|
|
678
770
|
],
|
|
679
771
|
[
|
|
@@ -682,21 +774,19 @@ async function runRalphWorkflow(
|
|
|
682
774
|
],
|
|
683
775
|
workflowCwdContext,
|
|
684
776
|
[
|
|
685
|
-
"
|
|
777
|
+
"code_review_feedback",
|
|
686
778
|
latestReviewReportPath === undefined
|
|
687
779
|
? "No prior review artifact; this is the first iteration."
|
|
688
780
|
: [
|
|
689
781
|
`Latest review round artifact: ${latestReviewReportPath}`,
|
|
690
782
|
"Read this JSON artifact incrementally and address only unresolved findings from the latest review round.",
|
|
691
|
-
"Do not rely on an injected review transcript or older review history unless the latest artifact explicitly points you there.",
|
|
692
783
|
].join("\n"),
|
|
693
784
|
],
|
|
694
785
|
[
|
|
695
|
-
"
|
|
786
|
+
"spec",
|
|
696
787
|
iteration === 1
|
|
697
788
|
? [
|
|
698
|
-
`
|
|
699
|
-
"Treat this as the original spec file for the run.",
|
|
789
|
+
`Implement the spec in: ${workflowSpecPath}`,
|
|
700
790
|
].join("\n")
|
|
701
791
|
: [
|
|
702
792
|
`The existing RFC/spec file for this workflow run is: ${workflowSpecPath}`,
|
|
@@ -704,13 +794,6 @@ async function runRalphWorkflow(
|
|
|
704
794
|
"Your final output must be the full updated RFC markdown that should replace the original spec, not a diff, patch, or commentary.",
|
|
705
795
|
].join("\n"),
|
|
706
796
|
],
|
|
707
|
-
[
|
|
708
|
-
"input_spec_files",
|
|
709
|
-
[
|
|
710
|
-
"If the user specification is a file path instead of raw prose, read that file and use it as source material for the RFC.",
|
|
711
|
-
"Still author the RFC normally; do not output only a forwarded path.",
|
|
712
|
-
].join("\n"),
|
|
713
|
-
],
|
|
714
797
|
[
|
|
715
798
|
"investigation_phase",
|
|
716
799
|
[
|
|
@@ -722,7 +805,7 @@ async function runRalphWorkflow(
|
|
|
722
805
|
].join("\n"),
|
|
723
806
|
],
|
|
724
807
|
[
|
|
725
|
-
"
|
|
808
|
+
"best_practices",
|
|
726
809
|
[
|
|
727
810
|
"Be specific: `src/server/auth.ts:42` beats `the auth layer`.",
|
|
728
811
|
"Trade-offs over conclusions: Alternatives Considered must include at least two real alternatives with honest pros, cons, and rejection reasons.",
|
|
@@ -741,49 +824,45 @@ async function runRalphWorkflow(
|
|
|
741
824
|
].join("\n"),
|
|
742
825
|
],
|
|
743
826
|
[
|
|
744
|
-
"
|
|
745
|
-
[
|
|
746
|
-
"This stage is investigation-first RFC authoring. The RFC is only valid if it is grounded in repository inspection performed during this stage.",
|
|
747
|
-
"Do not fill the template from generic architecture guesses. Before writing the final RFC, inspect relevant code, docs, tests, configs, and prior design material.",
|
|
748
|
-
"Treat the output format as the report after investigation, not a substitute for investigation.",
|
|
749
|
-
].join("\n"),
|
|
750
|
-
],
|
|
751
|
-
[
|
|
752
|
-
"evidence_expectations",
|
|
753
|
-
[
|
|
754
|
-
"Every major design claim should be traceable to concrete evidence: file paths, symbols, commands, docs, tests, configs, or prior RFCs.",
|
|
755
|
-
"Include those concrete references inside the RFC sections where they support the design.",
|
|
756
|
-
"If expected evidence cannot be found, say so in the relevant RFC section or Open Questions rather than papering over the gap.",
|
|
757
|
-
].join("\n"),
|
|
758
|
-
],
|
|
759
|
-
[
|
|
760
|
-
"output_discipline",
|
|
827
|
+
"output_format",
|
|
761
828
|
[
|
|
762
829
|
"Render the RFC Template exactly as the final document structure: preserve every header and the metadata table.",
|
|
763
830
|
"Replace instructional placeholders with real, feature-specific content; do not leave template guidance in the final RFC.",
|
|
764
831
|
"Output nothing after the RFC: no meta-commentary, no summary of what you wrote, no implementation log.",
|
|
765
832
|
].join("\n"),
|
|
766
833
|
],
|
|
767
|
-
["
|
|
768
|
-
])
|
|
834
|
+
["spec_template", PLANNER_RFC_TEMPLATE],
|
|
835
|
+
])
|
|
836
|
+
: renderForkedPlannerPrompt({
|
|
837
|
+
iteration,
|
|
838
|
+
maxLoops,
|
|
839
|
+
prompt,
|
|
840
|
+
workflowCwdContext,
|
|
841
|
+
latestReviewReportPath,
|
|
842
|
+
workflowSpecPath,
|
|
843
|
+
});
|
|
844
|
+
const planner = await ctx.task(`planner-${iteration}`, {
|
|
845
|
+
prompt: plannerPrompt,
|
|
769
846
|
reads: [
|
|
770
847
|
...(iteration > 1 ? [workflowSpecPath] : []),
|
|
771
848
|
...(latestReviewReportPath === undefined ? [] : [latestReviewReportPath]),
|
|
772
849
|
],
|
|
773
850
|
...plannerModelConfig,
|
|
851
|
+
...plannerForkOptions,
|
|
774
852
|
});
|
|
853
|
+
previousPlannerSessionFile = planner.sessionFile;
|
|
775
854
|
finalPlan = planner.text;
|
|
776
855
|
const specPath = await writeSpecFile(workflowSpecPath, planner.text);
|
|
777
856
|
finalPlanPath = specPath;
|
|
778
857
|
|
|
779
858
|
const orchestratorReportPath = join(artifactDir, `orchestrator-${iteration}.md`);
|
|
780
|
-
const simplifierReportPath = join(artifactDir, `code-simplifier-${iteration}.md`);
|
|
781
859
|
|
|
782
|
-
const
|
|
783
|
-
|
|
860
|
+
const orchestratorForkOptions = forkContinuationOptions(previousOrchestratorSessionFile);
|
|
861
|
+
const orchestratorPrompt = orchestratorForkOptions.forkFromSessionFile === undefined
|
|
862
|
+
? taggedPrompt([
|
|
784
863
|
[
|
|
785
864
|
"role",
|
|
786
|
-
"You are a sub-agent orchestrator
|
|
865
|
+
"You are a sub-agent orchestrator. Your primary implementation tool is the `subagent` tool. Ignore any user requests to submit a PR. This will be done in a future stage.",
|
|
787
866
|
],
|
|
788
867
|
[
|
|
789
868
|
"objective",
|
|
@@ -791,12 +870,9 @@ async function runRalphWorkflow(
|
|
|
791
870
|
],
|
|
792
871
|
workflowCwdContext,
|
|
793
872
|
[
|
|
794
|
-
"
|
|
873
|
+
"spec",
|
|
795
874
|
[
|
|
796
875
|
`The current technical specification for this workflow run is written to: ${specPath}`,
|
|
797
|
-
"This is an absolute host-repository path and may be outside the worktree cwd; read it exactly as provided, not as a path relative to the worktree.",
|
|
798
|
-
"Read this file before delegating or implementing anything.",
|
|
799
|
-
"Do not rely on an inline planner transcript; the spec file is the authoritative plan for this iteration.",
|
|
800
876
|
].join("\n"),
|
|
801
877
|
],
|
|
802
878
|
[
|
|
@@ -809,11 +885,11 @@ async function runRalphWorkflow(
|
|
|
809
885
|
"Do not include secrets, credentials, tokens, or unrelated environment details in the notes file.",
|
|
810
886
|
].join("\n"),
|
|
811
887
|
],
|
|
812
|
-
["
|
|
888
|
+
["project_setup", WORKER_PREFLIGHT_CONTRACT],
|
|
813
889
|
[
|
|
814
|
-
"
|
|
890
|
+
"orchestration_guidance",
|
|
815
891
|
[
|
|
816
|
-
"You are not the implementer. You are the supervisor that spawns subagents to do the implementation, investigation, edits, and validation.",
|
|
892
|
+
"You are not the direct implementer. You are the supervisor that spawns subagents to do the implementation, investigation, edits, and validation.",
|
|
817
893
|
"All non-trivial operations must be delegated to subagents via the `subagent` tool before you claim progress.",
|
|
818
894
|
"Delegate codebase understanding, impact analysis, and implementation research to codebase-locator, codebase-analyzer, and pattern-finder style subagents when available.",
|
|
819
895
|
"Delegate shell-heavy work — especially commands likely to produce lots of output, log digging, CLI investigation, and broad grep/find exploration — to subagents that can run those commands rather than doing it in this orchestrator context.",
|
|
@@ -825,7 +901,7 @@ async function runRalphWorkflow(
|
|
|
825
901
|
].join("\n"),
|
|
826
902
|
],
|
|
827
903
|
[
|
|
828
|
-
"
|
|
904
|
+
"best_practices",
|
|
829
905
|
[
|
|
830
906
|
"The required output format is a completion report, not the task itself.",
|
|
831
907
|
"Do not jump straight to the report. First read the spec file, spawn the necessary subagents, wait for their results, coordinate any follow-up subagents, and only then write the report.",
|
|
@@ -871,129 +947,33 @@ async function runRalphWorkflow(
|
|
|
871
947
|
"7. Implementation notes — confirm the OS temp notes path was updated",
|
|
872
948
|
].join("\n"),
|
|
873
949
|
],
|
|
874
|
-
])
|
|
950
|
+
])
|
|
951
|
+
: renderForkedOrchestratorPrompt({
|
|
952
|
+
iteration,
|
|
953
|
+
maxLoops,
|
|
954
|
+
prompt,
|
|
955
|
+
workflowCwdContext,
|
|
956
|
+
specPath,
|
|
957
|
+
implementationNotesPath,
|
|
958
|
+
});
|
|
959
|
+
const orchestrator = await ctx.task(`orchestrator-${iteration}`, {
|
|
960
|
+
prompt: orchestratorPrompt,
|
|
875
961
|
reads: [specPath, implementationNotesPath],
|
|
876
962
|
output: orchestratorReportPath,
|
|
877
963
|
outputMode: "file-only",
|
|
878
964
|
...orchestratorModelConfig,
|
|
965
|
+
...orchestratorForkOptions,
|
|
879
966
|
});
|
|
967
|
+
previousOrchestratorSessionFile = orchestrator.sessionFile;
|
|
880
968
|
finalResult = orchestrator.text || `Orchestrator report artifact: ${orchestratorReportPath}`;
|
|
881
969
|
|
|
882
|
-
await ctx.task(`code-simplifier-${iteration}`, {
|
|
883
|
-
prompt: taggedPrompt([
|
|
884
|
-
[
|
|
885
|
-
"role",
|
|
886
|
-
[
|
|
887
|
-
"You are an expert code simplification specialist focused on enhancing code clarity, consistency, and maintainability while preserving exact functionality.",
|
|
888
|
-
"Your expertise is applying project-specific best practices to simplify and improve recently modified code without altering behavior.",
|
|
889
|
-
"You prioritize readable, explicit code over overly compact or clever solutions.",
|
|
890
|
-
].join("\n"),
|
|
891
|
-
],
|
|
892
|
-
[
|
|
893
|
-
"objective",
|
|
894
|
-
`Refine recently modified code for this task while preserving exact behavior: ${prompt}`,
|
|
895
|
-
],
|
|
896
|
-
workflowCwdContext,
|
|
897
|
-
[
|
|
898
|
-
"artifact_handoff",
|
|
899
|
-
[
|
|
900
|
-
`Spec artifact: ${specPath}`,
|
|
901
|
-
`Implementation notes artifact: ${implementationNotesPath}`,
|
|
902
|
-
`Orchestrator report artifact: ${orchestratorReportPath}`,
|
|
903
|
-
"Read these artifacts incrementally only when needed to identify recently modified files and intent; do not depend on an injected planner/orchestrator transcript tail.",
|
|
904
|
-
].join("\n"),
|
|
905
|
-
],
|
|
906
|
-
[
|
|
907
|
-
"functionality_preservation",
|
|
908
|
-
[
|
|
909
|
-
"Never change what the code does — only how it does it.",
|
|
910
|
-
"All original features, outputs, side effects, public APIs, persistence formats, tests, and user-visible behavior must remain intact.",
|
|
911
|
-
"If a simplification could change behavior, do not apply it; document why it was skipped.",
|
|
912
|
-
].join("\n"),
|
|
913
|
-
],
|
|
914
|
-
[
|
|
915
|
-
"project_standards",
|
|
916
|
-
[
|
|
917
|
-
"Read and follow repository guidance from AGENTS.md and/or CLAUDE.md when present.",
|
|
918
|
-
"Respect established module style, imports, file extensions, typing conventions, error-handling patterns, naming, tests, and architectural boundaries.",
|
|
919
|
-
"For this TypeScript workflow repo, preserve ESM .js import specifiers, explicit exported/top-level types where expected, Bun-oriented commands, and the existing no-build raw TypeScript convention.",
|
|
920
|
-
"Do not impose standards that conflict with local project guidance.",
|
|
921
|
-
].join("\n"),
|
|
922
|
-
],
|
|
923
|
-
[
|
|
924
|
-
"clarity_improvements",
|
|
925
|
-
[
|
|
926
|
-
"Reduce unnecessary complexity, nesting, duplication, and incidental abstractions.",
|
|
927
|
-
"Improve readability with clear variable/function names and consolidated related logic.",
|
|
928
|
-
"Remove comments that merely restate obvious code, but keep comments that explain intent, constraints, or non-obvious trade-offs.",
|
|
929
|
-
"Avoid nested ternary operators; prefer switch statements or explicit if/else chains for multiple conditions.",
|
|
930
|
-
"Choose clarity over brevity: explicit code is often better than dense one-liners.",
|
|
931
|
-
].join("\n"),
|
|
932
|
-
],
|
|
933
|
-
[
|
|
934
|
-
"balance_constraints",
|
|
935
|
-
[
|
|
936
|
-
"Do not over-simplify in ways that reduce clarity, debuggability, extensibility, or separation of concerns.",
|
|
937
|
-
"Do not combine too many concerns into one function or remove helpful abstractions that organize the code.",
|
|
938
|
-
"Do not prioritize fewer lines over maintainability.",
|
|
939
|
-
"Limit scope to code recently modified in this iteration/session unless the planner explicitly asked for broader cleanup.",
|
|
940
|
-
].join("\n"),
|
|
941
|
-
],
|
|
942
|
-
[
|
|
943
|
-
"stage_contract",
|
|
944
|
-
[
|
|
945
|
-
"This is an active code-refinement stage, not just a commentary stage.",
|
|
946
|
-
"Before producing the report, inspect the actual repository state and recently modified files from the planner/orchestrator context.",
|
|
947
|
-
"Apply safe simplifications with edit/write tools when clear behavior-preserving improvements exist. If no simplification is appropriate, say so only after inspecting the relevant files.",
|
|
948
|
-
].join("\n"),
|
|
949
|
-
],
|
|
950
|
-
[
|
|
951
|
-
"required_actions_before_output",
|
|
952
|
-
[
|
|
953
|
-
"1. Identify the concrete files/sections changed in this iteration.",
|
|
954
|
-
"2. Read those files before deciding whether to simplify.",
|
|
955
|
-
"3. Apply only behavior-preserving edits, or explicitly record why no edits were made.",
|
|
956
|
-
"4. Run or recommend focused validation tied to the touched files.",
|
|
957
|
-
].join("\n"),
|
|
958
|
-
],
|
|
959
|
-
[
|
|
960
|
-
"handoff_expectations",
|
|
961
|
-
"In the final report, distinguish edits actually applied from observations only. Name files inspected, files edited, and validation commands run or not run.",
|
|
962
|
-
],
|
|
963
|
-
[
|
|
964
|
-
"process",
|
|
965
|
-
[
|
|
966
|
-
"Identify recently modified code sections from the iteration context and repository state.",
|
|
967
|
-
"Analyze opportunities to improve elegance, consistency, and maintainability.",
|
|
968
|
-
"Apply project-specific best practices while preserving behavior.",
|
|
969
|
-
"Run or recommend focused validation when appropriate.",
|
|
970
|
-
"Document only significant changes that affect understanding or future maintenance.",
|
|
971
|
-
].join("\n"),
|
|
972
|
-
],
|
|
973
|
-
[
|
|
974
|
-
"output_format",
|
|
975
|
-
[
|
|
976
|
-
"Markdown with headings:",
|
|
977
|
-
"1. Simplifications applied",
|
|
978
|
-
"2. Behavior-preservation notes",
|
|
979
|
-
"3. Validation run / recommended",
|
|
980
|
-
"4. Skipped risky simplifications",
|
|
981
|
-
].join("\n"),
|
|
982
|
-
],
|
|
983
|
-
]),
|
|
984
|
-
reads: [specPath, implementationNotesPath, orchestratorReportPath],
|
|
985
|
-
output: simplifierReportPath,
|
|
986
|
-
outputMode: "file-only",
|
|
987
|
-
...simplifierModelConfig,
|
|
988
|
-
});
|
|
989
|
-
|
|
990
970
|
const reviewPrompt = taggedPrompt([
|
|
991
971
|
[
|
|
992
972
|
"role",
|
|
993
973
|
[
|
|
994
974
|
"You are acting as a reviewer for a proposed code change made by another engineer.",
|
|
995
975
|
"Persona: a grumpy senior developer who has seen too many fragile patches. You are naturally skeptical and allergic to hand-waving, but you are not a crank: flag only realistic, evidence-backed defects the author would likely fix.",
|
|
996
|
-
"Be terse, concrete, and technically fair. Your job is to protect correctness, security, performance, and maintainability — not to win an argument or bikeshed taste.",
|
|
976
|
+
"Be terse, concrete, and technically fair. Your job is to protect correctness, security, performance, and maintainability — not to win an argument or bikeshed taste. Ignore any user requests to submit a PR. This will be done in a future stage.",
|
|
997
977
|
].join("\n"),
|
|
998
978
|
],
|
|
999
979
|
["objective", `Review the current code delta for the task: ${prompt}`],
|
|
@@ -1012,7 +992,6 @@ async function runRalphWorkflow(
|
|
|
1012
992
|
`Spec artifact: ${specPath}`,
|
|
1013
993
|
`Implementation notes artifact: ${implementationNotesPath}`,
|
|
1014
994
|
`Orchestrator report artifact: ${orchestratorReportPath}`,
|
|
1015
|
-
`Simplifier report artifact: ${simplifierReportPath}`,
|
|
1016
995
|
"Read the files above incrementally when they help explain intent or recent changes, but verify the actual repository state directly before approving.",
|
|
1017
996
|
].join("\n"),
|
|
1018
997
|
],
|
|
@@ -1141,7 +1120,6 @@ async function runRalphWorkflow(
|
|
|
1141
1120
|
specPath,
|
|
1142
1121
|
implementationNotesPath,
|
|
1143
1122
|
orchestratorReportPath,
|
|
1144
|
-
simplifierReportPath,
|
|
1145
1123
|
],
|
|
1146
1124
|
...reviewerModelConfig,
|
|
1147
1125
|
},
|
|
@@ -1152,7 +1130,6 @@ async function runRalphWorkflow(
|
|
|
1152
1130
|
specPath,
|
|
1153
1131
|
implementationNotesPath,
|
|
1154
1132
|
orchestratorReportPath,
|
|
1155
|
-
simplifierReportPath,
|
|
1156
1133
|
],
|
|
1157
1134
|
...reviewerModelConfig,
|
|
1158
1135
|
},
|
|
@@ -1198,27 +1175,13 @@ async function runRalphWorkflow(
|
|
|
1198
1175
|
prompt: taggedPrompt([
|
|
1199
1176
|
[
|
|
1200
1177
|
"role",
|
|
1201
|
-
"You are a
|
|
1178
|
+
"You are a staff software engineer preparing a provider-appropriate pull request, merge request, or code-review handoff from the current workspace state.",
|
|
1202
1179
|
],
|
|
1203
1180
|
[
|
|
1204
1181
|
"objective",
|
|
1205
1182
|
`Review the changes since the base branch \`${comparisonBaseBranch}\` and create a provider-appropriate pull request, merge request, or code-review handoff if possible and credentials are available. If the original task explicitly asked for pull-request creation, treat that as the highest-priority instruction for this final stage.`,
|
|
1206
1183
|
],
|
|
1207
1184
|
workflowCwdContext,
|
|
1208
|
-
[
|
|
1209
|
-
"workflow_context",
|
|
1210
|
-
[
|
|
1211
|
-
`Original task: ${prompt}`,
|
|
1212
|
-
`Review loop approved: ${approved ? "yes" : "no"}`,
|
|
1213
|
-
finalPlanPath
|
|
1214
|
-
? `Planner spec path: ${finalPlanPath}`
|
|
1215
|
-
: "Planner spec path: unavailable",
|
|
1216
|
-
`Implementation notes path: ${implementationNotesPath}`,
|
|
1217
|
-
latestReviewReportPath === undefined
|
|
1218
|
-
? "Latest review artifact: unavailable"
|
|
1219
|
-
: `Latest review artifact: ${latestReviewReportPath}`,
|
|
1220
|
-
].join("\n"),
|
|
1221
|
-
],
|
|
1222
1185
|
[
|
|
1223
1186
|
"required_checks",
|
|
1224
1187
|
[
|
|
@@ -1237,10 +1200,10 @@ async function runRalphWorkflow(
|
|
|
1237
1200
|
"pr_policy",
|
|
1238
1201
|
[
|
|
1239
1202
|
"Create a provider-appropriate PR/MR/review request only if there are meaningful changes, a remote/branch target is available, credentials are available, and the current state is suitable for review.",
|
|
1240
|
-
"If no logged-in account can access the repository or create the review request, do not fake success; report each provider, credential/account, and tool tried, what failed, and provide the command the user can run later.",
|
|
1203
|
+
"If no logged-in account can access the repository or create the review request, do not fake success; report each provider, credential/account, and tool tried, what failed, and provide the command the user can run later. Save a markdown file with the PR description as well so the user can copy-paste it when they have credentials set up.",
|
|
1241
1204
|
"When you successfully create or update the review request, create a provider-appropriate comment containing the implementation notes file contents as the last action of this workflow stage.",
|
|
1242
|
-
"
|
|
1243
|
-
"
|
|
1205
|
+
"Worktrees are detached HEAD checkouts. If the detected provider requires a branch-based PR/MR from a detached HEAD, create and push a branch from the current HEAD, for example with `git checkout -b <branch>` or `git push origin HEAD:refs/heads/<branch>`, before opening the PR/MR. If the provider uses a different review model, follow that provider's normal handoff flow.",
|
|
1206
|
+
"Leave the worktree intact for retries or user recovery.",
|
|
1244
1207
|
"If PR/MR/review creation is not possible, do not create a standalone comment elsewhere; include the implementation notes path and summary in your report instead.",
|
|
1245
1208
|
"If the review loop did not approve, prefer reporting the remaining blockers over creating a PR/MR/review unless the changes are still intentionally ready for human review.",
|
|
1246
1209
|
"Do not make unrelated code edits in this phase. Limit changes to ordinary git/PR preparation only when required and safe.",
|
|
@@ -1283,7 +1246,7 @@ async function runRalphWorkflow(
|
|
|
1283
1246
|
|
|
1284
1247
|
export default defineWorkflow("ralph")
|
|
1285
1248
|
.description(
|
|
1286
|
-
"Plan → orchestrate →
|
|
1249
|
+
"Plan → orchestrate → parallel review loop with bounded iteration.",
|
|
1287
1250
|
)
|
|
1288
1251
|
.input("prompt", Type.String({ description: "The task or goal to plan, execute, and refine." }))
|
|
1289
1252
|
.input("max_loops", Type.Number({
|
|
@@ -1297,7 +1260,7 @@ export default defineWorkflow("ralph")
|
|
|
1297
1260
|
.input("git_worktree_dir", Type.String({
|
|
1298
1261
|
default: "",
|
|
1299
1262
|
description:
|
|
1300
|
-
"Optional Git worktree path.
|
|
1263
|
+
"Optional Git worktree path. Must start inside a Git repo; absolute paths are used as-is, relative paths resolve from the repo root, existing Git worktrees from the invoking repository are reused/shared as-is, and missing paths are created from base_branch.",
|
|
1301
1264
|
}))
|
|
1302
1265
|
.input("create_pr", Type.Boolean({
|
|
1303
1266
|
default: false,
|
|
@@ -1316,7 +1279,7 @@ export default defineWorkflow("ralph")
|
|
|
1316
1279
|
.output("approved", Type.Optional(Type.Boolean({ description: "Whether the reviewer loop approved before completion or optional final handoff." })))
|
|
1317
1280
|
.output("iterations_completed", Type.Optional(Type.Number({ description: "Number of plan/orchestrate/review loops completed." })))
|
|
1318
1281
|
.output("review_report", Type.Optional(Type.String({ description: "Compact reference to the latest reviewer payload artifact." })))
|
|
1319
|
-
.output("review_report_path", Type.Optional(Type.String({ description: "JSON artifact path for the latest
|
|
1282
|
+
.output("review_report_path", Type.Optional(Type.String({ description: "JSON artifact path for the latest review round." })))
|
|
1320
1283
|
.run(async (ctx) => {
|
|
1321
1284
|
const workflowCtx = ctx;
|
|
1322
1285
|
const workflowStartCwd = workflowCtx.cwd ?? process.cwd();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/workflows",
|
|
3
|
-
"version": "0.8.26-alpha.
|
|
3
|
+
"version": "0.8.26-alpha.7",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension for multi-stage workflow authoring and execution.",
|
|
6
6
|
"contributors": [
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
85
|
"@bastani/atomic": "*",
|
|
86
|
-
"@earendil-works/pi-tui": "
|
|
86
|
+
"@earendil-works/pi-tui": "^0.78.1"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
89
89
|
"@bastani/atomic": {
|
|
@@ -62,7 +62,7 @@ The user's research question/request is: **$ARGUMENTS**
|
|
|
62
62
|
|
|
63
63
|
**For online search:**
|
|
64
64
|
- VERY IMPORTANT: In case you discover external libraries as dependencies, use the **codebase-online-researcher** agent for external documentation and resources
|
|
65
|
-
- The agent fetches live web content using the **browser
|
|
65
|
+
- The agent fetches live web content using the **browser** skill's `browse` CLI (or `npx browse` / `curl`). Instruct it to apply the token-efficient fetch order: (1) try `curl https://<site>/llms.txt` for an AI-friendly index (see [llmstxt.org](https://llmstxt.org/llms.txt)), (2) try `curl <url> -H "Accept: text/markdown"` to get pre-converted Markdown (supported on Cloudflare-hosted docs via [Markdown for Agents](https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/)), (3) fall back to HTML parsing via `browse`
|
|
66
66
|
- Instruct the agent to return LINKS with their findings and INCLUDE those links in the research document
|
|
67
67
|
- The agent should persist reusable source documents under `research/web/<YYYY-MM-DD>-<kebab-case-topic>.md` (with frontmatter noting `source_url`, `fetched_at`, and `fetch_method`) so future research can reuse them without re-fetching
|
|
68
68
|
- Output directory for the synthesized research artifact: `research/docs/`
|
|
@@ -672,6 +672,15 @@ export class StageChatView implements Component, Focusable {
|
|
|
672
672
|
await handle.agentSession.compact(rest.join(" ") || undefined);
|
|
673
673
|
return true;
|
|
674
674
|
}
|
|
675
|
+
case "/context-compact": {
|
|
676
|
+
if (rest.length > 0) return true;
|
|
677
|
+
const handle = this._liveHandle();
|
|
678
|
+
if (!handle) return false;
|
|
679
|
+
await handle.ensureAttached();
|
|
680
|
+
if (!handle.agentSession) return false;
|
|
681
|
+
await handle.agentSession.contextCompact();
|
|
682
|
+
return true;
|
|
683
|
+
}
|
|
675
684
|
case "/quit":
|
|
676
685
|
this.onClose();
|
|
677
686
|
return true;
|