strands-darwin 0.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.
- package/README.md +140 -0
- package/README.zh-CN.md +140 -0
- package/dist/patches/@strands-agents+sdk+1.16.0.patch +1443 -0
- package/dist/src/agent/background-delegation.d.ts +67 -0
- package/dist/src/agent/background-delegation.js +159 -0
- package/dist/src/agent/background-delegation.js.map +1 -0
- package/dist/src/agent/call-stats.d.ts +118 -0
- package/dist/src/agent/call-stats.js +128 -0
- package/dist/src/agent/call-stats.js.map +1 -0
- package/dist/src/agent/compact.d.ts +108 -0
- package/dist/src/agent/compact.js +192 -0
- package/dist/src/agent/compact.js.map +1 -0
- package/dist/src/agent/context-anchor.d.ts +64 -0
- package/dist/src/agent/context-anchor.js +43 -0
- package/dist/src/agent/context-anchor.js.map +1 -0
- package/dist/src/agent/cost.d.ts +56 -0
- package/dist/src/agent/cost.js +44 -0
- package/dist/src/agent/cost.js.map +1 -0
- package/dist/src/agent/diagnostics.d.ts +212 -0
- package/dist/src/agent/diagnostics.js +374 -0
- package/dist/src/agent/diagnostics.js.map +1 -0
- package/dist/src/agent/instructions.d.ts +54 -0
- package/dist/src/agent/instructions.js +118 -0
- package/dist/src/agent/instructions.js.map +1 -0
- package/dist/src/agent/max-tokens-recovery.d.ts +17 -0
- package/dist/src/agent/max-tokens-recovery.js +65 -0
- package/dist/src/agent/max-tokens-recovery.js.map +1 -0
- package/dist/src/agent/model-call-budget.d.ts +8 -0
- package/dist/src/agent/model-call-budget.js +24 -0
- package/dist/src/agent/model-call-budget.js.map +1 -0
- package/dist/src/agent/model-retry.d.ts +134 -0
- package/dist/src/agent/model-retry.js +256 -0
- package/dist/src/agent/model-retry.js.map +1 -0
- package/dist/src/agent/permission-rules.d.ts +47 -0
- package/dist/src/agent/permission-rules.js +260 -0
- package/dist/src/agent/permission-rules.js.map +1 -0
- package/dist/src/agent/permission.d.ts +361 -0
- package/dist/src/agent/permission.js +797 -0
- package/dist/src/agent/permission.js.map +1 -0
- package/dist/src/agent/prompt-cache.d.ts +66 -0
- package/dist/src/agent/prompt-cache.js +194 -0
- package/dist/src/agent/prompt-cache.js.map +1 -0
- package/dist/src/agent/refusal.d.ts +20 -0
- package/dist/src/agent/refusal.js +23 -0
- package/dist/src/agent/refusal.js.map +1 -0
- package/dist/src/agent/retry-guard.d.ts +26 -0
- package/dist/src/agent/retry-guard.js +193 -0
- package/dist/src/agent/retry-guard.js.map +1 -0
- package/dist/src/agent/rewind.d.ts +29 -0
- package/dist/src/agent/rewind.js +118 -0
- package/dist/src/agent/rewind.js.map +1 -0
- package/dist/src/agent/runtime.d.ts +814 -0
- package/dist/src/agent/runtime.js +1596 -0
- package/dist/src/agent/runtime.js.map +1 -0
- package/dist/src/agent/safety-classifier.d.ts +11 -0
- package/dist/src/agent/safety-classifier.js +0 -0
- package/dist/src/agent/safety-classifier.js.map +1 -0
- package/dist/src/agent/sdk-logging.d.ts +49 -0
- package/dist/src/agent/sdk-logging.js +110 -0
- package/dist/src/agent/sdk-logging.js.map +1 -0
- package/dist/src/agent/session.d.ts +102 -0
- package/dist/src/agent/session.js +244 -0
- package/dist/src/agent/session.js.map +1 -0
- package/dist/src/agent/stream-resumption.d.ts +16 -0
- package/dist/src/agent/stream-resumption.js +33 -0
- package/dist/src/agent/stream-resumption.js.map +1 -0
- package/dist/src/agent/system-prompt.d.ts +50 -0
- package/dist/src/agent/system-prompt.js +161 -0
- package/dist/src/agent/system-prompt.js.map +1 -0
- package/dist/src/agent/thinking.d.ts +99 -0
- package/dist/src/agent/thinking.js +145 -0
- package/dist/src/agent/thinking.js.map +1 -0
- package/dist/src/agent/usage.d.ts +132 -0
- package/dist/src/agent/usage.js +233 -0
- package/dist/src/agent/usage.js.map +1 -0
- package/dist/src/agent/working-context.d.ts +51 -0
- package/dist/src/agent/working-context.js +160 -0
- package/dist/src/agent/working-context.js.map +1 -0
- package/dist/src/agents/child-recipe.d.ts +33 -0
- package/dist/src/agents/child-recipe.js +98 -0
- package/dist/src/agents/child-recipe.js.map +1 -0
- package/dist/src/agents/concurrency-limit.d.ts +25 -0
- package/dist/src/agents/concurrency-limit.js +43 -0
- package/dist/src/agents/concurrency-limit.js.map +1 -0
- package/dist/src/agents/dispatch-registry.d.ts +180 -0
- package/dist/src/agents/dispatch-registry.js +289 -0
- package/dist/src/agents/dispatch-registry.js.map +1 -0
- package/dist/src/agents/failed-child-text.d.ts +44 -0
- package/dist/src/agents/failed-child-text.js +69 -0
- package/dist/src/agents/failed-child-text.js.map +1 -0
- package/dist/src/agents/loader.d.ts +26 -0
- package/dist/src/agents/loader.js +134 -0
- package/dist/src/agents/loader.js.map +1 -0
- package/dist/src/agents/report-projection.d.ts +31 -0
- package/dist/src/agents/report-projection.js +125 -0
- package/dist/src/agents/report-projection.js.map +1 -0
- package/dist/src/agents/subagent-tool.d.ts +61 -0
- package/dist/src/agents/subagent-tool.js +180 -0
- package/dist/src/agents/subagent-tool.js.map +1 -0
- package/dist/src/agents/workflow-tool.d.ts +85 -0
- package/dist/src/agents/workflow-tool.js +530 -0
- package/dist/src/agents/workflow-tool.js.map +1 -0
- package/dist/src/cli-args.d.ts +39 -0
- package/dist/src/cli-args.js +198 -0
- package/dist/src/cli-args.js.map +1 -0
- package/dist/src/cli-doctor.d.ts +26 -0
- package/dist/src/cli-doctor.js +398 -0
- package/dist/src/cli-doctor.js.map +1 -0
- package/dist/src/cli-main.d.ts +1 -0
- package/dist/src/cli-main.js +279 -0
- package/dist/src/cli-main.js.map +1 -0
- package/dist/src/cli-sessions.d.ts +17 -0
- package/dist/src/cli-sessions.js +136 -0
- package/dist/src/cli-sessions.js.map +1 -0
- package/dist/src/cli-trajectory.d.ts +37 -0
- package/dist/src/cli-trajectory.js +303 -0
- package/dist/src/cli-trajectory.js.map +1 -0
- package/dist/src/cli-usage.d.ts +18 -0
- package/dist/src/cli-usage.js +53 -0
- package/dist/src/cli-usage.js.map +1 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +29 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/commands/custom-commands.d.ts +43 -0
- package/dist/src/commands/custom-commands.js +155 -0
- package/dist/src/commands/custom-commands.js.map +1 -0
- package/dist/src/commands/workflow-command.d.ts +26 -0
- package/dist/src/commands/workflow-command.js +56 -0
- package/dist/src/commands/workflow-command.js.map +1 -0
- package/dist/src/config.d.ts +463 -0
- package/dist/src/config.js +1457 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/context-overflow-error.d.ts +7 -0
- package/dist/src/context-overflow-error.js +26 -0
- package/dist/src/context-overflow-error.js.map +1 -0
- package/dist/src/dev-repl.d.ts +1 -0
- package/dist/src/dev-repl.js +365 -0
- package/dist/src/dev-repl.js.map +1 -0
- package/dist/src/headless-protocol.d.ts +147 -0
- package/dist/src/headless-protocol.js +359 -0
- package/dist/src/headless-protocol.js.map +1 -0
- package/dist/src/headless-runner.d.ts +30 -0
- package/dist/src/headless-runner.js +405 -0
- package/dist/src/headless-runner.js.map +1 -0
- package/dist/src/headless-stdin.d.ts +28 -0
- package/dist/src/headless-stdin.js +78 -0
- package/dist/src/headless-stdin.js.map +1 -0
- package/dist/src/headless.d.ts +106 -0
- package/dist/src/headless.js +229 -0
- package/dist/src/headless.js.map +1 -0
- package/dist/src/hooks/codex-hook-runner.d.ts +92 -0
- package/dist/src/hooks/codex-hook-runner.js +446 -0
- package/dist/src/hooks/codex-hook-runner.js.map +1 -0
- package/dist/src/hooks/codex-hooks.d.ts +23 -0
- package/dist/src/hooks/codex-hooks.js +152 -0
- package/dist/src/hooks/codex-hooks.js.map +1 -0
- package/dist/src/hooks/hook-process.d.ts +23 -0
- package/dist/src/hooks/hook-process.js +241 -0
- package/dist/src/hooks/hook-process.js.map +1 -0
- package/dist/src/hooks/lifecycle-hooks.d.ts +37 -0
- package/dist/src/hooks/lifecycle-hooks.js +153 -0
- package/dist/src/hooks/lifecycle-hooks.js.map +1 -0
- package/dist/src/hooks/tool-hooks.d.ts +63 -0
- package/dist/src/hooks/tool-hooks.js +350 -0
- package/dist/src/hooks/tool-hooks.js.map +1 -0
- package/dist/src/mcp/codegraph-preflight.d.ts +29 -0
- package/dist/src/mcp/codegraph-preflight.js +232 -0
- package/dist/src/mcp/codegraph-preflight.js.map +1 -0
- package/dist/src/mcp/registry.d.ts +133 -0
- package/dist/src/mcp/registry.js +209 -0
- package/dist/src/mcp/registry.js.map +1 -0
- package/dist/src/mcp/web-search-empty-results.d.ts +14 -0
- package/dist/src/mcp/web-search-empty-results.js +94 -0
- package/dist/src/mcp/web-search-empty-results.js.map +1 -0
- package/dist/src/memory/command.d.ts +11 -0
- package/dist/src/memory/command.js +253 -0
- package/dist/src/memory/command.js.map +1 -0
- package/dist/src/memory/controller.d.ts +51 -0
- package/dist/src/memory/controller.js +316 -0
- package/dist/src/memory/controller.js.map +1 -0
- package/dist/src/memory/prompt.d.ts +4 -0
- package/dist/src/memory/prompt.js +22 -0
- package/dist/src/memory/prompt.js.map +1 -0
- package/dist/src/memory/scheduler.d.ts +33 -0
- package/dist/src/memory/scheduler.js +134 -0
- package/dist/src/memory/scheduler.js.map +1 -0
- package/dist/src/memory/state.d.ts +112 -0
- package/dist/src/memory/state.js +355 -0
- package/dist/src/memory/state.js.map +1 -0
- package/dist/src/memory/store.d.ts +19 -0
- package/dist/src/memory/store.js +130 -0
- package/dist/src/memory/store.js.map +1 -0
- package/dist/src/memory/tools.d.ts +29 -0
- package/dist/src/memory/tools.js +22 -0
- package/dist/src/memory/tools.js.map +1 -0
- package/dist/src/memory/validation.d.ts +33 -0
- package/dist/src/memory/validation.js +159 -0
- package/dist/src/memory/validation.js.map +1 -0
- package/dist/src/npm-package/generate-patch.d.ts +23 -0
- package/dist/src/npm-package/generate-patch.js +88 -0
- package/dist/src/npm-package/generate-patch.js.map +1 -0
- package/dist/src/npm-package/patch-package-format.d.ts +43 -0
- package/dist/src/npm-package/patch-package-format.js +66 -0
- package/dist/src/npm-package/patch-package-format.js.map +1 -0
- package/dist/src/paths.d.ts +39 -0
- package/dist/src/paths.js +105 -0
- package/dist/src/paths.js.map +1 -0
- package/dist/src/pricing/cost.d.ts +182 -0
- package/dist/src/pricing/cost.js +215 -0
- package/dist/src/pricing/cost.js.map +1 -0
- package/dist/src/pricing/model-prices.d.ts +112 -0
- package/dist/src/pricing/model-prices.js +320 -0
- package/dist/src/pricing/model-prices.js.map +1 -0
- package/dist/src/sdk-patch-preflight.d.ts +23 -0
- package/dist/src/sdk-patch-preflight.js +71 -0
- package/dist/src/sdk-patch-preflight.js.map +1 -0
- package/dist/src/skills/builtin/commit-message/SKILL.md +45 -0
- package/dist/src/skills/builtin/commit-message/references/types.md +8 -0
- package/dist/src/skills/builtin/developer/SKILL.md +107 -0
- package/dist/src/skills/builtin/self-evolution-research/SKILL.md +150 -0
- package/dist/src/skills/builtin/self-evolution-research/scripts/roll-research-path.mjs +208 -0
- package/dist/src/skills/builtin/self-reflection/SKILL.md +172 -0
- package/dist/src/skills/builtin/self-reflection/references/reflection-template.md +90 -0
- package/dist/src/skills/builtin/self-reflection/scripts/locate-trajectory.mjs +175 -0
- package/dist/src/skills/loader.d.ts +26 -0
- package/dist/src/skills/loader.js +186 -0
- package/dist/src/skills/loader.js.map +1 -0
- package/dist/src/skills/plugin.d.ts +34 -0
- package/dist/src/skills/plugin.js +137 -0
- package/dist/src/skills/plugin.js.map +1 -0
- package/dist/src/skills/prompt.d.ts +8 -0
- package/dist/src/skills/prompt.js +214 -0
- package/dist/src/skills/prompt.js.map +1 -0
- package/dist/src/skills/resource-safety.d.ts +15 -0
- package/dist/src/skills/resource-safety.js +149 -0
- package/dist/src/skills/resource-safety.js.map +1 -0
- package/dist/src/tools/background-bash.d.ts +95 -0
- package/dist/src/tools/background-bash.js +639 -0
- package/dist/src/tools/background-bash.js.map +1 -0
- package/dist/src/tools/background-tail.d.ts +28 -0
- package/dist/src/tools/background-tail.js +75 -0
- package/dist/src/tools/background-tail.js.map +1 -0
- package/dist/src/tools/background-wait-contract.d.ts +4 -0
- package/dist/src/tools/background-wait-contract.js +7 -0
- package/dist/src/tools/background-wait-contract.js.map +1 -0
- package/dist/src/tools/file-editor-serial.d.ts +24 -0
- package/dist/src/tools/file-editor-serial.js +99 -0
- package/dist/src/tools/file-editor-serial.js.map +1 -0
- package/dist/src/tools/image-viewer.d.ts +43 -0
- package/dist/src/tools/image-viewer.js +256 -0
- package/dist/src/tools/image-viewer.js.map +1 -0
- package/dist/src/tools/update-plan.d.ts +30 -0
- package/dist/src/tools/update-plan.js +65 -0
- package/dist/src/tools/update-plan.js.map +1 -0
- package/dist/src/tools/web-fetch.d.ts +70 -0
- package/dist/src/tools/web-fetch.js +667 -0
- package/dist/src/tools/web-fetch.js.map +1 -0
- package/dist/src/trajectory/export.d.ts +31 -0
- package/dist/src/trajectory/export.js +116 -0
- package/dist/src/trajectory/export.js.map +1 -0
- package/dist/src/trajectory/fork.d.ts +19 -0
- package/dist/src/trajectory/fork.js +110 -0
- package/dist/src/trajectory/fork.js.map +1 -0
- package/dist/src/trajectory/memory-tool.d.ts +20 -0
- package/dist/src/trajectory/memory-tool.js +98 -0
- package/dist/src/trajectory/memory-tool.js.map +1 -0
- package/dist/src/trajectory/prompt-history.d.ts +62 -0
- package/dist/src/trajectory/prompt-history.js +256 -0
- package/dist/src/trajectory/prompt-history.js.map +1 -0
- package/dist/src/trajectory/reader.d.ts +21 -0
- package/dist/src/trajectory/reader.js +62 -0
- package/dist/src/trajectory/reader.js.map +1 -0
- package/dist/src/trajectory/record.d.ts +417 -0
- package/dist/src/trajectory/record.js +394 -0
- package/dist/src/trajectory/record.js.map +1 -0
- package/dist/src/trajectory/replay.d.ts +74 -0
- package/dist/src/trajectory/replay.js +285 -0
- package/dist/src/trajectory/replay.js.map +1 -0
- package/dist/src/trajectory/resume-recap.d.ts +43 -0
- package/dist/src/trajectory/resume-recap.js +68 -0
- package/dist/src/trajectory/resume-recap.js.map +1 -0
- package/dist/src/trajectory/search.d.ts +40 -0
- package/dist/src/trajectory/search.js +127 -0
- package/dist/src/trajectory/search.js.map +1 -0
- package/dist/src/trajectory/spend.d.ts +157 -0
- package/dist/src/trajectory/spend.js +264 -0
- package/dist/src/trajectory/spend.js.map +1 -0
- package/dist/src/trajectory/stream.d.ts +30 -0
- package/dist/src/trajectory/stream.js +30 -0
- package/dist/src/trajectory/stream.js.map +1 -0
- package/dist/src/trajectory/writer.d.ts +310 -0
- package/dist/src/trajectory/writer.js +636 -0
- package/dist/src/trajectory/writer.js.map +1 -0
- package/dist/src/tui/App.d.ts +109 -0
- package/dist/src/tui/App.js +2660 -0
- package/dist/src/tui/App.js.map +1 -0
- package/dist/src/tui/InputBox.d.ts +90 -0
- package/dist/src/tui/InputBox.js +129 -0
- package/dist/src/tui/InputBox.js.map +1 -0
- package/dist/src/tui/MarkdownText.d.ts +16 -0
- package/dist/src/tui/MarkdownText.js +117 -0
- package/dist/src/tui/MarkdownText.js.map +1 -0
- package/dist/src/tui/MessageList.d.ts +27 -0
- package/dist/src/tui/MessageList.js +61 -0
- package/dist/src/tui/MessageList.js.map +1 -0
- package/dist/src/tui/PermissionPrompt.d.ts +18 -0
- package/dist/src/tui/PermissionPrompt.js +114 -0
- package/dist/src/tui/PermissionPrompt.js.map +1 -0
- package/dist/src/tui/PlanChecklist.d.ts +7 -0
- package/dist/src/tui/PlanChecklist.js +12 -0
- package/dist/src/tui/PlanChecklist.js.map +1 -0
- package/dist/src/tui/QueuedMessages.d.ts +8 -0
- package/dist/src/tui/QueuedMessages.js +24 -0
- package/dist/src/tui/QueuedMessages.js.map +1 -0
- package/dist/src/tui/StartupScreen.d.ts +25 -0
- package/dist/src/tui/StartupScreen.js +51 -0
- package/dist/src/tui/StartupScreen.js.map +1 -0
- package/dist/src/tui/ToolCallPanel.d.ts +33 -0
- package/dist/src/tui/ToolCallPanel.js +112 -0
- package/dist/src/tui/ToolCallPanel.js.map +1 -0
- package/dist/src/tui/WelcomeHeader.d.ts +30 -0
- package/dist/src/tui/WelcomeHeader.js +69 -0
- package/dist/src/tui/WelcomeHeader.js.map +1 -0
- package/dist/src/tui/background-tool-presentation.d.ts +22 -0
- package/dist/src/tui/background-tool-presentation.js +209 -0
- package/dist/src/tui/background-tool-presentation.js.map +1 -0
- package/dist/src/tui/busy-suffix.d.ts +37 -0
- package/dist/src/tui/busy-suffix.js +39 -0
- package/dist/src/tui/busy-suffix.js.map +1 -0
- package/dist/src/tui/clipboard-image.d.ts +18 -0
- package/dist/src/tui/clipboard-image.js +109 -0
- package/dist/src/tui/clipboard-image.js.map +1 -0
- package/dist/src/tui/context-format.d.ts +43 -0
- package/dist/src/tui/context-format.js +71 -0
- package/dist/src/tui/context-format.js.map +1 -0
- package/dist/src/tui/copy-command.d.ts +68 -0
- package/dist/src/tui/copy-command.js +182 -0
- package/dist/src/tui/copy-command.js.map +1 -0
- package/dist/src/tui/edit-diff.d.ts +135 -0
- package/dist/src/tui/edit-diff.js +356 -0
- package/dist/src/tui/edit-diff.js.map +1 -0
- package/dist/src/tui/frame-budget.d.ts +351 -0
- package/dist/src/tui/frame-budget.js +446 -0
- package/dist/src/tui/frame-budget.js.map +1 -0
- package/dist/src/tui/help-format.d.ts +17 -0
- package/dist/src/tui/help-format.js +38 -0
- package/dist/src/tui/help-format.js.map +1 -0
- package/dist/src/tui/live-text.d.ts +51 -0
- package/dist/src/tui/live-text.js +154 -0
- package/dist/src/tui/live-text.js.map +1 -0
- package/dist/src/tui/markdown.d.ts +62 -0
- package/dist/src/tui/markdown.js +244 -0
- package/dist/src/tui/markdown.js.map +1 -0
- package/dist/src/tui/mcp-format.d.ts +28 -0
- package/dist/src/tui/mcp-format.js +67 -0
- package/dist/src/tui/mcp-format.js.map +1 -0
- package/dist/src/tui/path-completion.d.ts +119 -0
- package/dist/src/tui/path-completion.js +305 -0
- package/dist/src/tui/path-completion.js.map +1 -0
- package/dist/src/tui/permission-queue.d.ts +61 -0
- package/dist/src/tui/permission-queue.js +129 -0
- package/dist/src/tui/permission-queue.js.map +1 -0
- package/dist/src/tui/plan-format.d.ts +9 -0
- package/dist/src/tui/plan-format.js +30 -0
- package/dist/src/tui/plan-format.js.map +1 -0
- package/dist/src/tui/prompt-completion.d.ts +22 -0
- package/dist/src/tui/prompt-completion.js +46 -0
- package/dist/src/tui/prompt-completion.js.map +1 -0
- package/dist/src/tui/prompt-editor.d.ts +102 -0
- package/dist/src/tui/prompt-editor.js +379 -0
- package/dist/src/tui/prompt-editor.js.map +1 -0
- package/dist/src/tui/prompt-history-search.d.ts +53 -0
- package/dist/src/tui/prompt-history-search.js +123 -0
- package/dist/src/tui/prompt-history-search.js.map +1 -0
- package/dist/src/tui/prompt-queue.d.ts +58 -0
- package/dist/src/tui/prompt-queue.js +74 -0
- package/dist/src/tui/prompt-queue.js.map +1 -0
- package/dist/src/tui/prompt-recall.d.ts +74 -0
- package/dist/src/tui/prompt-recall.js +90 -0
- package/dist/src/tui/prompt-recall.js.map +1 -0
- package/dist/src/tui/react-environment.d.ts +11 -0
- package/dist/src/tui/react-environment.js +24 -0
- package/dist/src/tui/react-environment.js.map +1 -0
- package/dist/src/tui/rewind-search.d.ts +34 -0
- package/dist/src/tui/rewind-search.js +68 -0
- package/dist/src/tui/rewind-search.js.map +1 -0
- package/dist/src/tui/shell-command.d.ts +114 -0
- package/dist/src/tui/shell-command.js +310 -0
- package/dist/src/tui/shell-command.js.map +1 -0
- package/dist/src/tui/spend-advisory.d.ts +52 -0
- package/dist/src/tui/spend-advisory.js +64 -0
- package/dist/src/tui/spend-advisory.js.map +1 -0
- package/dist/src/tui/status-format.d.ts +120 -0
- package/dist/src/tui/status-format.js +192 -0
- package/dist/src/tui/status-format.js.map +1 -0
- package/dist/src/tui/subagent-format.d.ts +49 -0
- package/dist/src/tui/subagent-format.js +146 -0
- package/dist/src/tui/subagent-format.js.map +1 -0
- package/dist/src/tui/task-format.d.ts +29 -0
- package/dist/src/tui/task-format.js +87 -0
- package/dist/src/tui/task-format.js.map +1 -0
- package/dist/src/tui/terminal-bell.d.ts +20 -0
- package/dist/src/tui/terminal-bell.js +33 -0
- package/dist/src/tui/terminal-bell.js.map +1 -0
- package/dist/src/tui/tool-detail-presentation.d.ts +60 -0
- package/dist/src/tui/tool-detail-presentation.js +206 -0
- package/dist/src/tui/tool-detail-presentation.js.map +1 -0
- package/dist/src/tui/turn-state.d.ts +195 -0
- package/dist/src/tui/turn-state.js +548 -0
- package/dist/src/tui/turn-state.js.map +1 -0
- package/dist/src/tui/visual-language.d.ts +45 -0
- package/dist/src/tui/visual-language.js +57 -0
- package/dist/src/tui/visual-language.js.map +1 -0
- package/dist/src/version.d.ts +7 -0
- package/dist/src/version.js +38 -0
- package/dist/src/version.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: self-evolution-research
|
|
3
|
+
description: Roll a weighted research path — self-review of TUI polish, logging and observability, unused Strands SDK capability, anything else, or comparable coding-agent product research — then compare the findings with Darwin's current code and architecture, maintain a ranked iteration backlog, and drive the developer skill iteratively through every qualifying direction in the batch. Use for Darwin self-evolution, competitive research, or continuous product iteration.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Self-evolution research
|
|
7
|
+
|
|
8
|
+
Run this workflow from the Darwin repository root. Keep research claims sourced, backlog state persistent, and implementation inside the existing `developer` supervision boundary.
|
|
9
|
+
|
|
10
|
+
One research run produces one **batch**: every direction that run adds to the backlog shares its origin report, and those records are that batch. The batch is then implemented **iteratively** — one direction at a time, each built on the Darwin revision the previous direction produced — and the loop continues until the batch is exhausted or a halt condition in section 7 fires. Finishing one direction successfully is not a reason to stop.
|
|
11
|
+
|
|
12
|
+
## 1. Inspect the backlog first
|
|
13
|
+
|
|
14
|
+
Before using any product-research source, read `docs/research/backlog_index.md`. It is the source-of-truth router for stable 20-priority pages under `docs/research/backlog/`. If the index or a routed page is missing, stop and report that this required product artifact is unavailable; do not silently invent a replacement elsewhere.
|
|
15
|
+
|
|
16
|
+
Treat only these values as valid statuses: `not-started`, `in-progress`, `done`, `abandoned`.
|
|
17
|
+
|
|
18
|
+
Do a metadata-only search across the routed pages for direction headings and exact `Status`, `Priority`, and `Origin report` lines. Do not read completed directions' evidence or notes into context. Identify the current batch as the unfinished records sharing the newest origin report, then select work within it in this order:
|
|
19
|
+
|
|
20
|
+
1. the highest-priority `in-progress` direction;
|
|
21
|
+
2. otherwise the highest-priority `not-started` direction;
|
|
22
|
+
3. otherwise begin fresh research.
|
|
23
|
+
|
|
24
|
+
A lower numeric **Priority** wins; use the earlier stable ID to break a tie. If either unfinished status exists, do **not** perform fresh product research. Read only the selected direction section and unfinished records sharing its origin report, then work that batch starting from the selected direction.
|
|
25
|
+
|
|
26
|
+
## 2. Apply the score gate before spending an iteration
|
|
27
|
+
|
|
28
|
+
The ranking dimensions, the `Score` formula, `MINIMUM_IMPLEMENTATION_SCORE = 6`, and the two constraints that keep the gate honest (never restate a rating to cross the gate; a below-gate direction survives only with a recorded safety, correctness, or dependency reason) are defined once in `docs/research/backlog_index.md` — apply them as written there.
|
|
29
|
+
|
|
30
|
+
Apply the gate twice, with the same threshold:
|
|
31
|
+
|
|
32
|
+
- **when proposing** — a direction scoring below the gate is not added as `not-started`. Record it in the research report as considered and rejected, with its score.
|
|
33
|
+
- **when selecting** — a backlog record scoring below the gate is set to `abandoned` with the reason `below score gate (Score = <n> < 6)` and skipped. Continue the loop with the next direction; a gated record never halts the batch.
|
|
34
|
+
|
|
35
|
+
## 3. Research only when the backlog has no unfinished work
|
|
36
|
+
|
|
37
|
+
### 3.1 Roll the research path first
|
|
38
|
+
|
|
39
|
+
Before reading a single source — repository or product — run the bundled script once from the skill directory shown in the `load_skill` result:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
node <skill-directory>/scripts/roll-research-path.mjs
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
It draws one of five weighted paths (the current weights and each path's share are printed in the script's own output and `--help`) and prints a `research-path`/`focus`/`share`/`draw`/`path-source`/`rolled-at`/`weights` block.
|
|
46
|
+
|
|
47
|
+
| Path | What the run looks for |
|
|
48
|
+
|---|---|
|
|
49
|
+
| `tui` | TUI interaction and visual polish: the live frame, streaming and history rendering, prompts and completion, colour and severity, small-terminal layout, keyboard editing. |
|
|
50
|
+
| `observability` | Logging and observability: notices and diagnostics, the trajectory record, usage and cost reporting, background-job and subagent visibility, what a failure leaves behind. |
|
|
51
|
+
| `sdk` | Strands SDK capability darwin has not adopted — hooks, plugins, interventions, conversation managers, model and tool features — measured against what darwin hand-rolls or lives without. |
|
|
52
|
+
| `open` | Anything else worth improving; deliberately unscoped. |
|
|
53
|
+
| `peer` | The sourced comparable-product analysis in 3.3. |
|
|
54
|
+
|
|
55
|
+
The roll is binding, and these rules are what make it worth running at all:
|
|
56
|
+
|
|
57
|
+
- **Once per research run, before any source.** Rolling after reading is choosing.
|
|
58
|
+
- **Copy the script's output verbatim** into the report's research-path section (see section 4). Never paraphrase it, and never write a path the script did not print.
|
|
59
|
+
- **Never re-roll an unappealing outcome.** If the script was somehow run more than once, record every output and use the first. A run that finds its path unproductive says so in the report and proposes nothing rather than quietly switching paths.
|
|
60
|
+
- **`--path <id>` is for a user who directs the path**, and only then. It prints `path-source: override (user-directed)`, which must survive into the report — a directed run may never be presented as chance. A run does not override on its own initiative.
|
|
61
|
+
- **The path decides where evidence comes from, not the standard it meets.** Sections 1, 2 and 4–8 apply unchanged: the same backlog contract, the same 1–5 ratings, the same score gate, the same report file, the same `developer` handoff.
|
|
62
|
+
|
|
63
|
+
### 3.2 Every path starts in the repository
|
|
64
|
+
|
|
65
|
+
Inspect current Darwin behavior and architecture in source, tests, README, the repository's own instruction and architecture documents (`AGENTS.md` and whatever architecture notes, specs or contract files it points to — a project workflow's spec directory counts when the project has one, but none is required), and recent relevant history. Cite repository paths and symbols for every claim; never characterize darwin from model memory when the file is right there.
|
|
66
|
+
|
|
67
|
+
On the four self-review paths, that repository evidence *is* the evidence — there is no peer requirement, and the report says so explicitly instead of padding its source table with products the run never opened. A self-review finding still has to be shown, not asserted: name the file, symbol, documented decision or test that demonstrates the gap, and state what a user or operator experiences because of it. Where the repository documents the path's scope — an architecture note, a spec, a recorded contract (start from `AGENTS.md` and follow its references; in darwin the load-bearing decisions table is the index) — read it first: a "missing" capability is often a recorded, deliberate decision, and re-proposing it as an improvement is the characteristic failure of these paths. If the scope turns out to be in good shape, that is a legitimate outcome — record it and propose nothing.
|
|
68
|
+
|
|
69
|
+
Consulting a peer product opportunistically on a self-review path is allowed, but it never replaces the repository evidence, and anything cited still obeys the sourcing rules in 3.3.
|
|
70
|
+
|
|
71
|
+
### 3.3 Peer-product research — the `peer` path
|
|
72
|
+
|
|
73
|
+
Research all of these scopes:
|
|
74
|
+
|
|
75
|
+
- Claude Code;
|
|
76
|
+
- Codex;
|
|
77
|
+
- DeepSeek harness;
|
|
78
|
+
- PenguinHarness; and
|
|
79
|
+
- at least one additional relevant coding-agent product.
|
|
80
|
+
|
|
81
|
+
Prefer primary product documentation, release notes, and source repositories. Record a URL, access date, source type, and the specific claim each source supports. Separate sourced fact from inference. If source access is unavailable or a named product cannot be verified, record the limitation and make no claim about it; never fabricate coverage to complete the list.
|
|
82
|
+
|
|
83
|
+
Capture notable product features and innovations, then compare each relevant item with Darwin's present functionality, SDK-extension architecture, permission model, sessions, skills, MCP, subagents, TUI, and verification approach as applicable.
|
|
84
|
+
|
|
85
|
+
## 4. Persist the research run safely
|
|
86
|
+
|
|
87
|
+
Use the current UTC date and target `docs/research/research_<YYYY-MM-DD>.md`. Follow `docs/research/research_template.md`.
|
|
88
|
+
|
|
89
|
+
- If the daily file does not exist, create it from the template structure.
|
|
90
|
+
- If it exists, read it first and append a new `## Run — <UTC timestamp>` section at the end.
|
|
91
|
+
- Never replace or rewrite an earlier same-day run.
|
|
92
|
+
- Record the section 3.1 roll before any finding, in its own `### Research path` block, as the script's verbatim output. A run whose report shows no roll is unauditable: nothing afterwards can prove the path was drawn rather than picked.
|
|
93
|
+
- On a self-review path, say in the source section that no peer product was consulted, and cite repository paths and symbols in place of URLs. Do not leave the peer table empty without saying why, and never list a product the run did not open.
|
|
94
|
+
- Give every claim and direction a source or repository-evidence link.
|
|
95
|
+
|
|
96
|
+
Propose zero to five new, non-duplicate iteration directions. Use the routed-page metadata search to collect existing IDs, priorities, and headings before adding one. Rank each direction on 1–5 scales:
|
|
97
|
+
|
|
98
|
+
- **Importance** — higher is more valuable;
|
|
99
|
+
- **Architecture fit** — higher fits Darwin's current design better;
|
|
100
|
+
- **Evidence confidence** — higher has stronger source support;
|
|
101
|
+
- **Implementation difficulty** — higher is harder;
|
|
102
|
+
- **Implementation risk** — higher is riskier.
|
|
103
|
+
|
|
104
|
+
Score each direction with the index's formula. Rank by score, but include qualitative rationale and do not let the formula override a documented safety or dependency concern. Apply the section 2 gate: append every accepted direction as a complete `not-started` section to the current priority-range page, with a stable ID, priority, dimensions, source report, empty-or-explicit evidence, and notes; record gated directions only in the report. Order accepted directions so dependencies come first — that order is the batch's implementation sequence, not a suggestion.
|
|
105
|
+
|
|
106
|
+
The current page owns at most 20 priorities. If the next Priority falls outside its range, create the next zero-padded `directions-NNN-NNN.md` page for the next 20-priority range and add exactly one route to `backlog_index.md`; never rebalance a closed page or duplicate mutable direction state in the index.
|
|
107
|
+
|
|
108
|
+
## 5. Iterate the batch through developer
|
|
109
|
+
|
|
110
|
+
Call `load_skill` with the exact name `developer` once, then follow that workflow separately for each direction. Do not reproduce, bypass, or recursively delegate the developer protocol, and give every direction its own fresh child session — a child conversation is never reused across directions.
|
|
111
|
+
|
|
112
|
+
For each direction in the batch, in priority order:
|
|
113
|
+
|
|
114
|
+
1. **Check the starting point.** The working tree must be clean, HEAD must contain the previously accepted commit, and `pnpm typecheck` plus `pnpm test` must pass at HEAD. Halt per section 7 rather than delegating onto an unverified tree; a failure inherited from the previous iteration would otherwise be indistinguishable from one the next child caused.
|
|
115
|
+
2. **Delegate against the newest Darwin.** Each iteration must run the revision the previous iteration produced. Launching the child from repository source (`tsx src/cli.ts`, as `package.json`'s `start` script does) uses HEAD directly; if the child is launched from the built `bin` entry (`dist/src/cli.js`), run `pnpm build` first. Never hand iteration N+1 to a stale artifact.
|
|
116
|
+
3. **Mark the work.** Change exactly the one selected direction section in its routed page to `in-progress`; do not create an index status summary.
|
|
117
|
+
4. **Hand over** the direction's stable ID and requirement; the originating research report and reference sources; the Darwin architecture evidence and intended extension points; repository scope and the repository's own workflow requirements (task, planning or spec artifacts only when its configured workflow calls for them); independently observable acceptance checks; and authorization boundaries.
|
|
118
|
+
5. **Accept and close** it per section 6, then append that supervision run's batch record to `docs/iteration-log.md`.
|
|
119
|
+
6. **Report the iteration** to the user — direction, commit, independently re-run checks, token spend, and what remains in the batch — and then continue immediately with the next direction. Do not wait for another instruction to keep going.
|
|
120
|
+
|
|
121
|
+
Exactly one direction is `in-progress` at a time. Others stay `not-started` until their turn.
|
|
122
|
+
|
|
123
|
+
## 6. Close each direction honestly
|
|
124
|
+
|
|
125
|
+
After each developer child finishes, perform the developer workflow's independent acceptance before changing status:
|
|
126
|
+
|
|
127
|
+
- On acceptance, set the direction to `done` and record commit/change plus exact acceptance evidence.
|
|
128
|
+
- On failed or blocked acceptance, keep it `in-progress` and record blockers and the next recovery step.
|
|
129
|
+
- Set `abandoned` only for an explicit product decision or the section 2 gate, and record who/what decided it and the reason.
|
|
130
|
+
|
|
131
|
+
Never mark `done` from the child's report alone. Ensure the actual `/developer` supervision batch is appended to `docs/iteration-log.md` with the child session, accepted milestone, and Host-rerun checks before moving on to the next direction.
|
|
132
|
+
|
|
133
|
+
## 7. Halt the batch only for a recorded reason
|
|
134
|
+
|
|
135
|
+
Stop iterating and report when — and only when — one of these holds:
|
|
136
|
+
|
|
137
|
+
- **the batch is exhausted**: every record is `done` or `abandoned`. Normal completion.
|
|
138
|
+
- **acceptance keeps failing**: one direction fails independent acceptance twice, counting the developer workflow's focused correction as the second attempt. Leave it `in-progress` with blockers and do not start the next direction on an unaccepted tree.
|
|
139
|
+
- **a premise was falsified**: an accepted result invalidates a remaining direction's assumption. Record the invalidation in that section and require a fresh research run; never silently reinterpret a requirement into a different feature.
|
|
140
|
+
- **only the user can decide**: a remaining direction needs a product, safety, or authorization decision that neither the requirement nor repository evidence resolves. Ask instead of guessing.
|
|
141
|
+
- **the starting point cannot be restored**: the tree is dirty or HEAD is red, and fixing it would mean inventing scope.
|
|
142
|
+
- **continuing is not worth it**: every remaining record is below the gate, obsolete, or already covered by shipped work. Record each as `abandoned` with that reason.
|
|
143
|
+
|
|
144
|
+
Difficulty alone is not a halt condition, and neither is a successful iteration.
|
|
145
|
+
|
|
146
|
+
## 8. Report the batch
|
|
147
|
+
|
|
148
|
+
**Push before reporting.** Accepted commits exist only on the local branch until now — a batch that ends with commit but no push leaves the evolution invisible outside this machine. Once the loop halts (whatever the halt reason), if any commit was accepted this run, `git push` the current branch once and verify with `git log @{u}..` that nothing accepted remains unpushed. Never force-push and never rewrite history to make a push succeed; if the push is rejected, the remote is missing, or credentials fail, state that plainly in the report together with the exact unpushed commits, instead of retrying around it.
|
|
149
|
+
|
|
150
|
+
Report each direction attempted with its final status and commit, the push result (pushed, or why not, with any unpushed commits), the directions abandoned by the gate or by decision with their reasons, aggregate token spend across every child delegation, the halt condition that ended the loop, and the remaining backlog. When this invocation performed fresh research, also report the rolled path and whether it came from the roll or from a user override. Recommend fresh research only once the batch holds no unfinished record.
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Rolls the research path for one `self-evolution-research` run.
|
|
4
|
+
*
|
|
5
|
+
* Why a script rather than "pick one": a model asked to choose its own research
|
|
6
|
+
* direction will keep choosing the familiar one. Peer-product comparison was the
|
|
7
|
+
* only path the workflow had, so every run re-derived the same kind of finding and
|
|
8
|
+
* darwin's own rough edges — the frame, the logs, the SDK features it never
|
|
9
|
+
* adopted — were never anybody's assignment. A weighted draw makes the unfamiliar
|
|
10
|
+
* path *arrive* instead of having to be argued for.
|
|
11
|
+
*
|
|
12
|
+
* Two properties make the roll worth trusting:
|
|
13
|
+
*
|
|
14
|
+
* - **The odds are exact.** Weights are whole halves, and the draw runs over
|
|
15
|
+
* half-units (`DRAW_UNITS_PER_WEIGHT`) rather than over the weights themselves, so
|
|
16
|
+
* the documented share is exactly the implemented share and no rounding drifts. A
|
|
17
|
+
* weight that is not a whole half throws at load rather than quietly biasing a
|
|
18
|
+
* path. The share is printed as a percentage only for the reader's benefit.
|
|
19
|
+
* - **The record distinguishes a roll from a decision.** `path-source` is either
|
|
20
|
+
* `roll` (with the raw draw, so the outcome can be audited against the weights)
|
|
21
|
+
* or `override` — a run that was told which path to take must never be able to
|
|
22
|
+
* present that as chance.
|
|
23
|
+
*
|
|
24
|
+
* The draw uses `crypto.randomInt`, which is uniform over the range and needs no
|
|
25
|
+
* seed. There is deliberately no `--seed`: a reproducible roll is a roll somebody
|
|
26
|
+
* can shop for.
|
|
27
|
+
*/
|
|
28
|
+
import { randomInt } from 'node:crypto';
|
|
29
|
+
import process from 'node:process';
|
|
30
|
+
import { fileURLToPath } from 'node:url';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The paths, with their weights. Order is fixed: the draw maps onto these ranges
|
|
34
|
+
* in sequence, so reordering the array changes which draw yields which path (the
|
|
35
|
+
* odds are unaffected, but a recorded draw would no longer audit).
|
|
36
|
+
*
|
|
37
|
+
* Weights are `2:0.5:1:1.5:5`. Peer research keeps the plurality — it is the path
|
|
38
|
+
* with outside evidence, and the one whose findings have historically survived the
|
|
39
|
+
* score gate — while the self-review paths are no longer equal to each other: TUI
|
|
40
|
+
* polish draws twice as often as `sdk`, `open` sits between them, and observability
|
|
41
|
+
* keeps the smallest non-trivial share.
|
|
42
|
+
*/
|
|
43
|
+
export const RESEARCH_PATHS = [
|
|
44
|
+
{
|
|
45
|
+
id: 'tui',
|
|
46
|
+
weight: 2,
|
|
47
|
+
focus: 'TUI interaction and visual polish',
|
|
48
|
+
scope:
|
|
49
|
+
'How darwin looks and feels while it works: the live frame, streaming and history rendering, prompts and completion, colour and severity, layout under a small terminal, keyboard editing.',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'observability',
|
|
53
|
+
weight: 0.5,
|
|
54
|
+
focus: 'logging and observability',
|
|
55
|
+
scope:
|
|
56
|
+
'What an operator can find out afterwards: notices and diagnostics, the trajectory record, usage and cost reporting, background job and subagent visibility, what a failure leaves behind.',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: 'sdk',
|
|
60
|
+
weight: 1,
|
|
61
|
+
focus: 'Strands SDK capabilities darwin does not use yet',
|
|
62
|
+
scope:
|
|
63
|
+
'The SDK surface darwin has not adopted — hooks, plugins, interventions, conversation managers, model and tool features — measured against what darwin hand-rolls or does without. Read the repository\'s recorded SDK contracts first (start from `AGENTS.md` and the architecture documents it points to); a "missing" SDK feature is often a recorded contract.',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: 'open',
|
|
67
|
+
weight: 1.5,
|
|
68
|
+
focus: 'anything else worth improving',
|
|
69
|
+
scope:
|
|
70
|
+
'Deliberately unscoped: performance, correctness, permissions, configuration, docs, verification, developer ergonomics. The direction still needs repository evidence and still faces the score gate.',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: 'peer',
|
|
74
|
+
weight: 5,
|
|
75
|
+
focus: 'comparable coding-agent product analysis',
|
|
76
|
+
scope:
|
|
77
|
+
'The sourced peer comparison in section 3.3 of the skill: Claude Code, Codex, DeepSeek harness, PenguinHarness, and at least one further relevant product.',
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
export const TOTAL_WEIGHT = RESEARCH_PATHS.reduce((sum, path) => sum + path.weight, 0);
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The draw runs over half-units, not over the weights: a weight of `0.5` cannot be
|
|
85
|
+
* a range of integers, and rounding it to one would hand that path twice its share.
|
|
86
|
+
* Halving the unit is the smallest change that keeps the draw an integer — which is
|
|
87
|
+
* what `randomInt` needs and what makes a recorded draw auditable.
|
|
88
|
+
*/
|
|
89
|
+
export const DRAW_UNITS_PER_WEIGHT = 2;
|
|
90
|
+
|
|
91
|
+
export const TOTAL_DRAW_UNITS = TOTAL_WEIGHT * DRAW_UNITS_PER_WEIGHT;
|
|
92
|
+
|
|
93
|
+
// Loud at load, because a weight that is not a whole half would otherwise become a
|
|
94
|
+
// silently biased range rather than an error.
|
|
95
|
+
for (const path of RESEARCH_PATHS) {
|
|
96
|
+
const units = path.weight * DRAW_UNITS_PER_WEIGHT;
|
|
97
|
+
if (!Number.isInteger(units) || units <= 0) {
|
|
98
|
+
throw new RangeError(`weight for ${path.id} must be a positive multiple of ${1 / DRAW_UNITS_PER_WEIGHT}, received ${String(path.weight)}`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** `tui=2 observability=0.5 sdk=1 open=1.5 peer=5` — the weights, for the record. */
|
|
103
|
+
export function formatWeightTable() {
|
|
104
|
+
return RESEARCH_PATHS.map((path) => `${path.id}=${path.weight}`).join(' ');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function findResearchPath(id) {
|
|
108
|
+
return RESEARCH_PATHS.find((path) => path.id === id);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Maps a draw in `[0, TOTAL_DRAW_UNITS)` onto a path.
|
|
113
|
+
*
|
|
114
|
+
* Out of range throws rather than clamping: a clamp would silently bias the first
|
|
115
|
+
* or last path, which is the one bug this whole file exists to avoid.
|
|
116
|
+
*/
|
|
117
|
+
export function pathForDraw(draw) {
|
|
118
|
+
if (!Number.isInteger(draw) || draw < 0 || draw >= TOTAL_DRAW_UNITS) {
|
|
119
|
+
throw new RangeError(`draw must be an integer in [0, ${TOTAL_DRAW_UNITS}), received ${String(draw)}`);
|
|
120
|
+
}
|
|
121
|
+
let cursor = 0;
|
|
122
|
+
for (const path of RESEARCH_PATHS) {
|
|
123
|
+
cursor += path.weight * DRAW_UNITS_PER_WEIGHT;
|
|
124
|
+
if (draw < cursor) return path;
|
|
125
|
+
}
|
|
126
|
+
// Unreachable while the guard above holds; kept so a future weight bug is loud.
|
|
127
|
+
throw new RangeError(`no path covers draw ${draw}`);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Exact for these weights: every weight over 10 terminates in one decimal place. */
|
|
131
|
+
function formatShare(weight) {
|
|
132
|
+
const percent = (weight * 100) / TOTAL_WEIGHT;
|
|
133
|
+
return `${Number.isInteger(percent) ? percent : percent.toFixed(1)}%`;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The block a research run copies verbatim into its report.
|
|
138
|
+
*
|
|
139
|
+
* One `key: value` per line, so the report shows the same text the script printed
|
|
140
|
+
* and a reader can re-check the outcome against the weights and the draw.
|
|
141
|
+
*/
|
|
142
|
+
export function formatRoll({ path, draw, source, at }) {
|
|
143
|
+
return [
|
|
144
|
+
`research-path: ${path.id}`,
|
|
145
|
+
`focus: ${path.focus}`,
|
|
146
|
+
`share: ${formatShare(path.weight)} (weight ${path.weight} of ${TOTAL_WEIGHT})`,
|
|
147
|
+
`draw: ${draw === undefined ? 'none — path was not rolled' : `${draw} of ${TOTAL_DRAW_UNITS} half-units`}`,
|
|
148
|
+
`path-source: ${source}`,
|
|
149
|
+
`rolled-at: ${at}`,
|
|
150
|
+
`weights: ${formatWeightTable()}`,
|
|
151
|
+
].join('\n');
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const USAGE = [
|
|
155
|
+
'Usage: node roll-research-path.mjs [--path <id>]',
|
|
156
|
+
'',
|
|
157
|
+
` (no arguments) roll one path; weights ${formatWeightTable()}`,
|
|
158
|
+
' --path <id> record a user-directed path instead of rolling',
|
|
159
|
+
' --help print this',
|
|
160
|
+
'',
|
|
161
|
+
'Paths:',
|
|
162
|
+
...RESEARCH_PATHS.map((path) => ` ${path.id.padEnd(14)} ${formatShare(path.weight).padStart(5)} ${path.focus}`),
|
|
163
|
+
].join('\n');
|
|
164
|
+
|
|
165
|
+
function main(argv) {
|
|
166
|
+
if (argv.includes('--help') || argv.includes('-h')) {
|
|
167
|
+
process.stdout.write(`${USAGE}\n`);
|
|
168
|
+
return 0;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
let requested;
|
|
172
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
173
|
+
const arg = argv[index];
|
|
174
|
+
if (arg === '--path') {
|
|
175
|
+
requested = argv[index + 1];
|
|
176
|
+
index += 1;
|
|
177
|
+
if (requested === undefined) {
|
|
178
|
+
process.stderr.write(`error: --path needs a path id\n${USAGE}\n`);
|
|
179
|
+
return 2;
|
|
180
|
+
}
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
// Refused rather than ignored: a typo'd flag must not quietly become a roll.
|
|
184
|
+
process.stderr.write(`error: unexpected argument ${JSON.stringify(arg)}\n${USAGE}\n`);
|
|
185
|
+
return 2;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const at = new Date().toISOString();
|
|
189
|
+
|
|
190
|
+
if (requested !== undefined) {
|
|
191
|
+
const path = findResearchPath(requested);
|
|
192
|
+
if (path === undefined) {
|
|
193
|
+
process.stderr.write(`error: unknown path ${JSON.stringify(requested)}\n${USAGE}\n`);
|
|
194
|
+
return 2;
|
|
195
|
+
}
|
|
196
|
+
process.stdout.write(`${formatRoll({ path, draw: undefined, source: 'override (user-directed)', at })}\n`);
|
|
197
|
+
return 0;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const draw = randomInt(TOTAL_DRAW_UNITS);
|
|
201
|
+
process.stdout.write(`${formatRoll({ path: pathForDraw(draw), draw, source: 'roll', at })}\n`);
|
|
202
|
+
return 0;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Only when executed, so a test can import the weights and the mapping.
|
|
206
|
+
if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
207
|
+
process.exitCode = main(process.argv.slice(2));
|
|
208
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: self-reflection
|
|
3
|
+
description: Reflect on the current session's recorded trajectory with a fresh headless darwin worker — grade goal completion, mine the record for darwin-side improvements, score them with the self-evolution gate, and queue accepted directions into the research backlog. Use when the user asks darwin to reflect on or review this session.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Self-reflection
|
|
7
|
+
|
|
8
|
+
Run this workflow from the Darwin repository root. The reflection itself is delegated to a
|
|
9
|
+
headless darwin child, exactly like the `developer` workflow's worker: this Host conversation
|
|
10
|
+
locates the evidence and accepts the result; the child reads the record and writes the
|
|
11
|
+
reflection. Do not analyse the trajectory in the Host and do not write the reflection yourself.
|
|
12
|
+
|
|
13
|
+
## 1. Locate this session's trajectory first
|
|
14
|
+
|
|
15
|
+
Before launching anything, run the bundled locator once from the skill directory shown in the
|
|
16
|
+
`load_skill` result:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
node <skill-directory>/scripts/locate-trajectory.mjs
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
It resolves `~/.darwin/sessions/<project-key>/` for the current working directory and selects
|
|
23
|
+
the trajectory file appended to most recently — at this moment that is the Host's own session,
|
|
24
|
+
because the prompt that invoked this skill was already recorded as a `userInput` line. The
|
|
25
|
+
script prints a `session:` / `trajectory:` / `last-user-input:` block plus explicit
|
|
26
|
+
`closed-through-turn:` and `closed-through-seq:` fields, and mutates nothing. Those two fields
|
|
27
|
+
name the latest recorded `turnEnded` and form the inclusive reflection cutoff: the later open
|
|
28
|
+
`userInput` identifies this Host session but is not part of the subject being graded.
|
|
29
|
+
|
|
30
|
+
Two checks are mandatory before the selected id is trusted:
|
|
31
|
+
|
|
32
|
+
- on the default (newest-mtime) selection, the `last-user-input:` preview must be
|
|
33
|
+
recognizable as this conversation's latest user prompt. If it is not — another darwin
|
|
34
|
+
session in this project is active, or this session runs with `trajectory: false` — stop and
|
|
35
|
+
ask instead of reflecting on the wrong session;
|
|
36
|
+
- run the locator **before** starting the child. The child is itself a darwin session in the
|
|
37
|
+
same project, so a locator run after launch could select the child.
|
|
38
|
+
|
|
39
|
+
The user may also name any past session of this project explicitly: run the locator with
|
|
40
|
+
`--session <id>` (ids come from `darwin sessions` or `darwin trajectory list`). The named id
|
|
41
|
+
is then the authority — the preview no longer has to match this conversation; echo it back so
|
|
42
|
+
the user can confirm the subject is the session they meant. The script refuses a missing id
|
|
43
|
+
rather than falling back to another session. When the project records no trajectory at all,
|
|
44
|
+
the locator says so and exits non-zero; there is nothing to reflect on — report that instead
|
|
45
|
+
of inventing a subject. A selected current or named record with no `turnEnded` also exits
|
|
46
|
+
non-zero: an open request is not a reflection subject and must never be graded as unfinished.
|
|
47
|
+
|
|
48
|
+
Keep the exact `session:`, `trajectory:`, `closed-through-turn:` and `closed-through-seq:`
|
|
49
|
+
values; all four go into the child prompt verbatim.
|
|
50
|
+
|
|
51
|
+
## 2. Launch the reflection worker
|
|
52
|
+
|
|
53
|
+
Construct a shell-safe darwin command for the repository root and launch it with the `bash`
|
|
54
|
+
tool in **`start` mode** with `--yolo --context-offload`; offload is already default-on, and
|
|
55
|
+
this retained process-only flag force-enables it if persistent config opted out. Never run the
|
|
56
|
+
child with foreground `execute`. The managed-child contract is the `developer` skill's, applied unchanged: monitor
|
|
57
|
+
with `bash status`, drain with incremental `bash output` until `hasMore: false`, capture the
|
|
58
|
+
child's `^session: ([a-z0-9_-]+)$`, `^usage: input=(\d+|-) output=(\d+|-) cacheRead=(\d+|-)
|
|
59
|
+
cacheWrite=(\d+|-)$` and `^cost: total=(\d+\.\d+|-) input=(\d+\.\d+|-) output=(\d+\.\d+|-)
|
|
60
|
+
cacheRead=(\d+\.\d+|-) cacheWrite=(\d+\.\d+|-) model=(\S+) pricing=(\S+)$` stderr records, and
|
|
61
|
+
treat `-` as unknown, never zero (a `cost:` `total` of `-` is never summed as 0). The child
|
|
62
|
+
must not load the `developer`, `self-evolution-research`, or `self-reflection` skills,
|
|
63
|
+
must not start another darwin, and must not delegate the reflection again.
|
|
64
|
+
|
|
65
|
+
The first prompt must hand the child:
|
|
66
|
+
|
|
67
|
+
- the reflected session id and absolute trajectory path from section 1, stated read-only: the
|
|
68
|
+
child never rewrites, repairs, or appends to the record;
|
|
69
|
+
- the exact inclusive subject boundary from section 1: `closed-through-turn: <turn>` and
|
|
70
|
+
`closed-through-seq: <seq>`. The child must verify that exact seq is a `turnEnded` for that
|
|
71
|
+
exact turn, then read and grade only records with `seq <= <seq>`; no later record may affect
|
|
72
|
+
the goal summary, grade, findings, spend, timing, or citations;
|
|
73
|
+
- how to read it: `pnpm tsx src/cli.ts trajectory replay <session-id>` (read-only, no model
|
|
74
|
+
call) for orientation only, plus the raw `trajectory.jsonl` lines for the authoritative
|
|
75
|
+
bounded range and what replay does not print — `turnEnded` spend and failure fields,
|
|
76
|
+
tool-call inputs, timestamps and `seq` ranges. Replay may show the open tail, so the child
|
|
77
|
+
must discard everything after the passed cutoff;
|
|
78
|
+
- the honesty bound: state the actual first and last `seq` and turn values among records in the
|
|
79
|
+
passed closed range. The last value must be the passed `closed-through-seq` / turn, never the
|
|
80
|
+
file's later open tail; unknown spend metrics stay unknown, never 0;
|
|
81
|
+
- the output contract: exactly one new file,
|
|
82
|
+
`docs/reflections/reflection_<UTC-date>_<session-id>.md` (date as `YYYY-MM-DD`), creating
|
|
83
|
+
`docs/reflections/` when missing and refusing to overwrite an existing file;
|
|
84
|
+
- the template: follow `<skill-directory>/references/reflection-template.md` — every section
|
|
85
|
+
present, in order, none renamed;
|
|
86
|
+
- the scoring contract of section 3, verbatim;
|
|
87
|
+
- the backlog contract of section 4, verbatim; and
|
|
88
|
+
- the mutation scope: exactly the one reflection file plus appended direction sections in the
|
|
89
|
+
current routed page under `docs/research/backlog/`; rollover may also create the next page and
|
|
90
|
+
add its one route to `docs/research/backlog_index.md`. No source edits, and no commit unless
|
|
91
|
+
the user explicitly authorized one in this conversation.
|
|
92
|
+
|
|
93
|
+
## 3. What the reflection must contain
|
|
94
|
+
|
|
95
|
+
The template is the authoritative layout; these are its two load-bearing judgements.
|
|
96
|
+
|
|
97
|
+
**Completion grade** — exactly one of four levels, justified by trajectory evidence (turn and
|
|
98
|
+
`seq` references), never by impression:
|
|
99
|
+
|
|
100
|
+
- **Perfect** — the whole run was smooth: no failed or misdirected tool calls, no
|
|
101
|
+
direction reversals, and the user's goal fully met;
|
|
102
|
+
- **High** — the user's goal fully met, but the path had real detours: tool-use errors,
|
|
103
|
+
retried approaches, changed direction;
|
|
104
|
+
- **Medium** — the core need was met, with two or more stated problems left unresolved;
|
|
105
|
+
- **Low** — the core need was not met.
|
|
106
|
+
|
|
107
|
+
**Darwin improvement findings** — what this run shows could have been avoided by improving
|
|
108
|
+
darwin itself: system prompt, tool descriptions, multi-agent orchestration, context
|
|
109
|
+
management, execution time, token spend, or anything else the record supports. Every finding
|
|
110
|
+
names its evidence records and ends in a concrete, implementable suggestion.
|
|
111
|
+
|
|
112
|
+
**Scored directions and the gate** — apply the `docs/research/backlog_index.md` ranking
|
|
113
|
+
contract to every suggestion: rate **Importance**, **Architecture fit**, **Evidence
|
|
114
|
+
confidence**, **Difficulty** and **Risk** on 1–5 scales, compute
|
|
115
|
+
`Score = 2 × Importance + Architecture fit + Evidence confidence − Difficulty − Risk`, and
|
|
116
|
+
apply the same gate, `MINIMUM_IMPLEMENTATION_SCORE = 6`. Propose zero to five new,
|
|
117
|
+
non-duplicate directions; read the index first, search the routed pages'
|
|
118
|
+
headings and ID/Priority metadata, and never re-propose a direction that already exists in any
|
|
119
|
+
status. Qualitative rationale rides along, and the formula
|
|
120
|
+
never overrides a documented safety or dependency concern. Directions below the gate stay in
|
|
121
|
+
the reflection document as rejected, with their scores.
|
|
122
|
+
|
|
123
|
+
## 4. Queue accepted directions into the backlog
|
|
124
|
+
|
|
125
|
+
Every direction at or above the gate is appended to the current routed priority page as one
|
|
126
|
+
complete `not-started` section: a stable `SRF-NNN` id (the next unused number; never renumber
|
|
127
|
+
anything), a Priority continuing after the highest existing record, all five dimensions plus
|
|
128
|
+
the Score, an Origin report link to the new reflection document, explicit implementation /
|
|
129
|
+
acceptance evidence, and Notes carrying the evidence summary. Order accepted sections so
|
|
130
|
+
dependencies come first — that order is their implementation sequence. Existing sections are
|
|
131
|
+
never edited, reordered, or restated; the page diff must show appended sections only.
|
|
132
|
+
|
|
133
|
+
A page holds at most 20 priorities. If the next Priority falls outside the current range,
|
|
134
|
+
create the next zero-padded `directions-NNN-NNN.md` page under `docs/research/backlog/` and add
|
|
135
|
+
exactly one route to `backlog_index.md`. Creating that route is the only permitted index edit;
|
|
136
|
+
never add mutable status there or rebalance a closed page.
|
|
137
|
+
|
|
138
|
+
Accepted `SRF` sections are ordinary backlog work: the next `self-evolution-research` run selects
|
|
139
|
+
them as its development tasks through its normal batch rules.
|
|
140
|
+
This workflow never starts implementing them itself.
|
|
141
|
+
|
|
142
|
+
## 5. Accept independently
|
|
143
|
+
|
|
144
|
+
After the child reports completion, verify from the Host without trusting its prose:
|
|
145
|
+
|
|
146
|
+
- the reflection file exists at the exact expected path, contains every template section, and
|
|
147
|
+
its grade is one of the four levels with cited trajectory evidence;
|
|
148
|
+
- every accepted direction's Score arithmetic is correct and at or above 6, and every `SRF` id
|
|
149
|
+
is new;
|
|
150
|
+
- `git status` / `git diff`: nothing changed outside the reflection file, the current/new
|
|
151
|
+
routed page, and an index route on rollover; backlog sections are append-only and any index
|
|
152
|
+
diff adds only that one route.
|
|
153
|
+
|
|
154
|
+
On a concrete failure, send the exact failure back to the same child session as a focused
|
|
155
|
+
correction — another `bash start` task with `--session <captured-id> --yolo
|
|
156
|
+
--context-offload`, per the `developer` correction rules. Do not patch the reflection yourself
|
|
157
|
+
to conceal the failure.
|
|
158
|
+
|
|
159
|
+
## 6. Report
|
|
160
|
+
|
|
161
|
+
Report:
|
|
162
|
+
|
|
163
|
+
- the reflected session id and trajectory path;
|
|
164
|
+
- the child conversation session id, every `bg-*` task id and terminal outcome;
|
|
165
|
+
- the reflection document path and its grade;
|
|
166
|
+
- accepted directions (`SRF` ids with scores) now queued for `self-evolution-research`, and
|
|
167
|
+
rejected ones with their scores;
|
|
168
|
+
- token spend per captured `usage:` line plus the aggregate, `-` metrics stated as unknown, and
|
|
169
|
+
the captured `cost:` USD `total` per line plus its aggregate on the same rule (a missing line
|
|
170
|
+
stated as such);
|
|
171
|
+
and
|
|
172
|
+
- unresolved risks, denied operations, or decisions still needed.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Session reflection — `<session-id>`
|
|
2
|
+
|
|
3
|
+
Follow this layout exactly: every section present, in order, headings unchanged. Every
|
|
4
|
+
judgement cites trajectory evidence as `turn N` / `seq N` references. Unknown metrics are
|
|
5
|
+
written as `unknown`, never `0`.
|
|
6
|
+
|
|
7
|
+
```markdown
|
|
8
|
+
# Session reflection — <session-id>
|
|
9
|
+
|
|
10
|
+
- **date (UTC):** <YYYY-MM-DD>
|
|
11
|
+
- **project:** <absolute project root>
|
|
12
|
+
- **trajectory:** <absolute trajectory.jsonl path>
|
|
13
|
+
- **record read:** seq <first>–<closed-through-seq>, turns <first>–<closed-through-turn>
|
|
14
|
+
(inclusive closed subject range; records after this `turnEnded` cutoff were not graded)
|
|
15
|
+
- **model / provider:** <from runStarted>
|
|
16
|
+
- **session spend:** input=<n|unknown> output=<n|unknown> cacheRead=<n|unknown>
|
|
17
|
+
cacheWrite=<n|unknown> (summed over recorded `turnEnded.spend`; absent fields stay unknown)
|
|
18
|
+
|
|
19
|
+
## 1. What the user asked for, and what happened
|
|
20
|
+
|
|
21
|
+
One paragraph per user goal: the goal in the user's own terms, what the session delivered,
|
|
22
|
+
and where in the record the delivery (or its absence) is visible.
|
|
23
|
+
|
|
24
|
+
## 2. Overall completion grade
|
|
25
|
+
|
|
26
|
+
**Grade: <Perfect | High | Medium | Low>**
|
|
27
|
+
|
|
28
|
+
Rubric — pick exactly one:
|
|
29
|
+
|
|
30
|
+
- **Perfect** — the whole run was smooth: no failed or misdirected tool calls, no
|
|
31
|
+
direction reversals, and the user's goal fully met.
|
|
32
|
+
- **High** — the user's goal fully met, but the path had real detours: tool-use errors,
|
|
33
|
+
retried approaches, changed direction.
|
|
34
|
+
- **Medium** — the core need was met, with two or more stated problems left unresolved.
|
|
35
|
+
- **Low** — the core need was not met.
|
|
36
|
+
|
|
37
|
+
Justification: the specific records that place the run at this level and rule out the level
|
|
38
|
+
above (e.g. the failed tool calls that deny Perfect, or the unresolved leftovers that deny
|
|
39
|
+
High, each with turn/seq references). List every leftover problem explicitly when grading
|
|
40
|
+
Medium.
|
|
41
|
+
|
|
42
|
+
## 3. Process observations
|
|
43
|
+
|
|
44
|
+
A factual pass over the record — what a reader needs before believing section 4:
|
|
45
|
+
|
|
46
|
+
- turn-by-turn outline (goal of the turn, tools used, outcome);
|
|
47
|
+
- every failed, retried, or abandoned tool call, with its error text;
|
|
48
|
+
- direction changes, cancelled turns, permission denials, queued prompts;
|
|
49
|
+
- time and token hotspots: the slowest stretches and the most expensive turns, from record
|
|
50
|
+
timestamps and `turnEnded.spend`.
|
|
51
|
+
|
|
52
|
+
## 4. Improvement findings for darwin
|
|
53
|
+
|
|
54
|
+
What this run shows could have been avoided by improving darwin itself — system prompt, tool
|
|
55
|
+
descriptions, multi-agent orchestration, context management, execution time, token spend, or
|
|
56
|
+
anything else the record supports. One subsection per finding:
|
|
57
|
+
|
|
58
|
+
### F<N> — <one-line finding>
|
|
59
|
+
|
|
60
|
+
- **Evidence:** <turn/seq references and what they show>
|
|
61
|
+
- **Root-cause area:** <system prompt | tool description | orchestration | context
|
|
62
|
+
management | execution time | token spend | other>
|
|
63
|
+
- **Suggestion:** <the concrete, implementable change to darwin>
|
|
64
|
+
|
|
65
|
+
A run with nothing to improve says so here instead of inventing findings.
|
|
66
|
+
|
|
67
|
+
## 5. Scored directions and the gate
|
|
68
|
+
|
|
69
|
+
The `self-evolution-research` ranking applied to each section 4 suggestion. Dimensions are
|
|
70
|
+
1–5; `Score = 2 × Importance + Architecture fit + Evidence confidence − Difficulty − Risk`;
|
|
71
|
+
`MINIMUM_IMPLEMENTATION_SCORE = 6`. Check `docs/research/backlog_index.md` first, search its
|
|
72
|
+
routed pages' heading/ID/Priority metadata, and propose only non-duplicates (zero to five in
|
|
73
|
+
total). The formula never overrides a documented safety
|
|
74
|
+
or dependency concern — say so in Rationale when that applies.
|
|
75
|
+
|
|
76
|
+
| ID | Direction | Importance | Architecture fit | Evidence confidence | Difficulty | Risk | Score | Verdict |
|
|
77
|
+
|---|---|---:|---:|---:|---:|---:|---:|---|
|
|
78
|
+
| SRF-<NNN> | <direction> | <1–5> | <1–5> | <1–5> | <1–5> | <1–5> | <n> | accepted / rejected (below gate) / duplicate of <ID> |
|
|
79
|
+
|
|
80
|
+
Rationale per direction: why these ratings, and the dependency order among accepted directions.
|
|
81
|
+
Rejected and duplicate directions stay in this table with their scores; they are not added to
|
|
82
|
+
the backlog.
|
|
83
|
+
|
|
84
|
+
## 6. Backlog updates
|
|
85
|
+
|
|
86
|
+
The exact complete direction sections appended to the current routed page (status
|
|
87
|
+
`not-started`, origin report pointing at this document), in dependency order — or `none` when
|
|
88
|
+
nothing passed the gate. If rollover created the next 20-priority page, also record that page
|
|
89
|
+
and the one route appended to `docs/research/backlog_index.md`.
|
|
90
|
+
```
|