minimal-agent 0.8.2 → 0.10.0
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 +14 -12
- package/package.json +34 -1
- package/plugins/cron-runner/.claude-plugin/plugin.json +5 -0
- package/plugins/cron-runner/commands/cron.md +26 -0
- package/plugins/cron-runner/commands/crons.md +7 -0
- package/plugins/cron-runner/plugin.js +34 -0
- package/plugins/cron-runner/src/commands.js +348 -0
- package/plugins/cron-runner/src/cronTime.js +148 -0
- package/plugins/cron-runner/src/lock.js +68 -0
- package/plugins/cron-runner/src/runs.js +89 -0
- package/plugins/cron-runner/src/scheduleEngine.js +72 -0
- package/plugins/cron-runner/src/scheduler.js +355 -0
- package/plugins/cron-runner/src/schema.js +140 -0
- package/plugins/cron-runner/src/service.js +167 -0
- package/plugins/cron-runner/src/store.js +298 -0
- package/plugins/cron-runner/src/types.js +1 -0
- package/plugins/workflow-runner/commands/workflow.md +4 -4
- package/plugins/workflow-runner/commands/workflows.md +1 -1
- package/plugins/workflow-runner/plugin.js +3 -1
- package/plugins/workflow-runner/src/agentCommon.js +249 -51
- package/plugins/workflow-runner/src/dslManifest.js +72 -0
- package/plugins/workflow-runner/src/expressions.js +198 -15
- package/plugins/workflow-runner/src/index.js +40 -8
- package/plugins/workflow-runner/src/jsonPayload.js +1 -1
- package/plugins/workflow-runner/src/loader.js +286 -72
- package/plugins/workflow-runner/src/multimodal.js +37 -0
- package/plugins/workflow-runner/src/recovery.js +49 -39
- package/plugins/workflow-runner/src/runner.js +802 -287
- package/plugins/workflow-runner/src/stepExecutors/agent.js +157 -39
- package/plugins/workflow-runner/src/stepExecutors/assert.js +16 -3
- package/plugins/workflow-runner/src/stepExecutors/llm.js +60 -111
- package/plugins/workflow-runner/src/stepExecutors/skill.js +47 -47
- package/plugins/workflow-runner/src/stepExecutors/tool.js +76 -10
- package/plugins/workflow-runner/src/stepExecutors/verify.js +27 -10
- package/plugins/workflow-runner/src/taskIdentity.js +296 -0
- package/plugins/workflow-runner/src/types.js +19 -9
- package/plugins/workflow-runner/src/workflowState.js +516 -33
- package/skills/adversarial-review/SKILL.md +0 -1
- package/skills/ai-image/SKILL.md +89 -0
- package/skills/ai-image/scripts/generate.mjs +497 -0
- package/skills/ai-image/scripts/generate_from_plan.mjs +469 -0
- package/skills/ai-image/scripts/generate_from_plan_test.mjs +223 -0
- package/skills/ai-image/scripts/generate_test.mjs +74 -0
- package/skills/browser-automation/SKILL.md +47 -0
- package/skills/docx/SKILL.md +25 -3
- package/skills/docx/scripts/office/helpers/__pycache__/__init__.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/helpers/__pycache__/merge_runs.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/helpers/__pycache__/simplify_redlines.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/validators/__pycache__/__init__.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/validators/__pycache__/base.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/validators/__pycache__/docx.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/validators/__pycache__/pptx.cpython-314.pyc +0 -0
- package/skills/docx/scripts/office/validators/__pycache__/redlining.cpython-314.pyc +0 -0
- package/skills/docx/scripts/opc_check.py +253 -0
- package/skills/image-gen-openrouter/SKILL.md +10 -2
- package/skills/image-stats/SKILL.md +65 -0
- package/skills/image-stats/scripts/__pycache__/image_stats.cpython-314.pyc +0 -0
- package/skills/image-stats/scripts/__pycache__/image_stats_test.cpython-314.pyc +0 -0
- package/skills/image-stats/scripts/image_stats.py +368 -0
- package/skills/image-stats/scripts/image_stats_test.py +181 -0
- package/skills/pptx/SKILL.md +123 -95
- package/skills/pptx/design.md +82 -0
- package/skills/pptx/examples/README.md +29 -0
- package/skills/pptx/examples/hybrid_example.mjs +107 -0
- package/skills/pptx/examples/hybrid_example.pptx +0 -0
- package/skills/pptx/pptxgenjs.md +41 -0
- package/skills/pptx/scripts/deck_helpers.mjs +224 -0
- package/skills/pptx/scripts/layout_lint.py +293 -0
- package/skills/pptx/scripts/layout_lint_test.py +160 -0
- package/skills/pptx/scripts/opc_check.py +339 -0
- package/skills/pptx/scripts/svg_fallback.mjs +145 -0
- package/skills/pptx/svg.md +67 -0
- package/skills/tts-zh/SKILL.md +19 -2
- package/skills/ui-design/SKILL.md +158 -0
- package/skills/ui-design/claude_design.md +309 -0
- package/skills/ui-design/evals/evals.json +254 -0
- package/skills/ui-design/references/aesthetic-direction.md +83 -0
- package/skills/ui-design/references/claude-design-protocol.md +36 -0
- package/skills/ui-design/references/design-context.md +53 -0
- package/skills/ui-design/references/design-execution-playbook.md +82 -0
- package/skills/ui-design/references/export-pptx.md +124 -0
- package/skills/ui-design/references/layout-composition.md +654 -0
- package/skills/ui-design/references/preview-feedback.md +37 -0
- package/skills/ui-design/references/source-image-layout.md +189 -0
- package/skills/ui-design/references/starter-components.md +78 -0
- package/skills/ui-design/references/vi-aegis-vector.md +144 -0
- package/skills/ui-design/references/vi-amber-prism.md +133 -0
- package/skills/ui-design/references/vi-aqua-glass.md +200 -0
- package/skills/ui-design/references/vi-comfort-vision.md +147 -0
- package/skills/ui-design/references/vi-ember-prism.md +140 -0
- package/skills/ui-design/references/vi-nebula-console.md +151 -0
- package/skills/ui-design/references/vi-obsidian-optics.md +139 -0
- package/skills/ui-design/references/vi-obsidian-xui.md +143 -0
- package/skills/ui-design/references/vi-precision-horizon-dark.md +117 -0
- package/skills/ui-design/references/vi-precision-horizon.md +215 -0
- package/skills/ui-design/references/vi-solar-relay.md +130 -0
- package/skills/ui-design/references/vi-template-workflow.md +48 -0
- package/skills/ui-design/references/vi-verdant-grid.md +141 -0
- package/skills/ui-design/references/vi-violet-meridian.md +172 -0
- package/skills/ui-design/scripts/__pycache__/assemble_material.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/assemble_material_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/chart_sanity_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/check_language_policy.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/check_ui_artifact.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/check_ui_artifact_pptx_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/deck_pages_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/deck_pages_check_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/deck_visual_style_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/deck_visual_style_check_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/design_budget_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/design_budget_check_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/design_repair_hints.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/design_repair_hints_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/design_style_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/design_style_check_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/draft_coverage_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/extract_source_assets.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/extract_source_assets_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/generated_image_review_collect.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/generated_image_review_collect_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/image_plan_lint.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/image_plan_lint_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/image_prompt_rewrite.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/image_prompt_rewrite_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/layout_balance.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/layout_balance_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/normalize_design_json.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/normalize_design_json_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/plan_source_layout.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/plan_source_layout_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/resolve_source_hint.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/resolve_source_hint_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/resolve_source_input.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/resolve_source_input_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/scaffold_ui_artifact.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/source_usage_check.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/source_usage_check_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/text_readability_pixel.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/visual_quality_gate.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/__pycache__/visual_quality_gate_test.cpython-314.pyc +0 -0
- package/skills/ui-design/scripts/assemble_material.py +217 -0
- package/skills/ui-design/scripts/assemble_material_test.py +149 -0
- package/skills/ui-design/scripts/browser_check_ui_artifact.mjs +221 -0
- package/skills/ui-design/scripts/chart_sanity_check.py +261 -0
- package/skills/ui-design/scripts/chart_sanity_check_test.py +165 -0
- package/skills/ui-design/scripts/check_language_policy.py +351 -0
- package/skills/ui-design/scripts/check_ui_artifact.py +435 -0
- package/skills/ui-design/scripts/check_ui_artifact_pptx_test.py +251 -0
- package/skills/ui-design/scripts/deck_pages_check.py +158 -0
- package/skills/ui-design/scripts/deck_pages_check_test.py +134 -0
- package/skills/ui-design/scripts/deck_visual_style_check.py +767 -0
- package/skills/ui-design/scripts/deck_visual_style_check_test.py +713 -0
- package/skills/ui-design/scripts/design_budget_check.py +271 -0
- package/skills/ui-design/scripts/design_budget_check_test.py +183 -0
- package/skills/ui-design/scripts/design_repair_hints.py +162 -0
- package/skills/ui-design/scripts/design_repair_hints_test.py +54 -0
- package/skills/ui-design/scripts/design_style_check.py +397 -0
- package/skills/ui-design/scripts/design_style_check_test.py +233 -0
- package/skills/ui-design/scripts/draft_coverage_check.py +184 -0
- package/skills/ui-design/scripts/draft_coverage_check_test.py +131 -0
- package/skills/ui-design/scripts/export_pptx_from_html.mjs +2367 -0
- package/skills/ui-design/scripts/extract_source_assets.py +607 -0
- package/skills/ui-design/scripts/extract_source_assets_test.py +256 -0
- package/skills/ui-design/scripts/generated_image_review_collect.py +206 -0
- package/skills/ui-design/scripts/generated_image_review_collect_test.py +91 -0
- package/skills/ui-design/scripts/image_plan_lint.py +571 -0
- package/skills/ui-design/scripts/image_plan_lint_test.py +515 -0
- package/skills/ui-design/scripts/image_prompt_rewrite.py +713 -0
- package/skills/ui-design/scripts/image_prompt_rewrite_test.py +966 -0
- package/skills/ui-design/scripts/layout_balance.py +881 -0
- package/skills/ui-design/scripts/layout_balance_test.py +927 -0
- package/skills/ui-design/scripts/normalize_design_json.py +272 -0
- package/skills/ui-design/scripts/normalize_design_json_test.py +119 -0
- package/skills/ui-design/scripts/plan_source_layout.py +1450 -0
- package/skills/ui-design/scripts/plan_source_layout_test.py +1136 -0
- package/skills/ui-design/scripts/resolve_source_input.py +270 -0
- package/skills/ui-design/scripts/resolve_source_input_test.py +98 -0
- package/skills/ui-design/scripts/scaffold_ui_artifact.py +377 -0
- package/skills/ui-design/scripts/source_usage_check.py +581 -0
- package/skills/ui-design/scripts/source_usage_check_test.py +427 -0
- package/skills/ui-design/scripts/text_readability_pixel.py +340 -0
- package/skills/ui-design/scripts/text_readability_pixel_test.py +219 -0
- package/skills/ui-design/scripts/visual_quality_gate.py +301 -0
- package/skills/ui-design/scripts/visual_quality_gate_test.py +233 -0
- package/skills/ui-design/tests/e2e/prompts/deck.md +19 -0
- package/skills/ui-design/tests/e2e/prompts/webpage.md +17 -0
- package/skills/ui-design/tests/e2e/render_check.mjs +101 -0
- package/skills/ui-design/tests/e2e/rubric.json +54 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/checks/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/checks/language-check.txt +12 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/checks/static-check.txt +15 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/outputs/index.html +837 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/prompt.md +12 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/review.md +21 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/aegis-vector-preview-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/outputs/homepage.html +373 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/outputs/platform.html +378 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/prompt.md +13 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/review.md +26 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/homepage/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/homepage/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/homepage/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/platform/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/platform/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/amber-prism-screenshot-check-1/screenshots/platform/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-1/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-1/outputs/index.html +656 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-1/prompt.md +12 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-1/render_check.mjs +67 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-2/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-2/outputs/index.html +587 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-2/prompt.md +12 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-iteration-2/review.md +36 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/checks/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/checks/language-check.txt +8 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/checks/static-check.txt +16 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/outputs/index.html +739 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/prompt.md +11 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/review.md +22 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/aqua-glass-volcano-refresh-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/comfort-vision-preview-1/checks/browser-check.json +52 -0
- package/skills/ui-design/tests/e2e/runs/comfort-vision-preview-1/outputs/index.html +641 -0
- package/skills/ui-design/tests/e2e/runs/comfort-vision-preview-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/comfort-vision-preview-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-red-preview-1/outputs/index.html +467 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-red-preview-1/screenshots/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-red-preview-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-red-preview-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/outputs/homepage.html +373 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/outputs/platform.html +378 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/prompt.md +13 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/review.md +26 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/homepage/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/homepage/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/homepage/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/platform/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/platform/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/ember-prism-screenshot-check-1/screenshots/platform/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/checks/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/checks/language-check.txt +4 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/execution_notes.md +10 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/outputs/index.html +587 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/prompt.md +14 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/review.md +13 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/empty-agent-protocol-check/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/deck/checks/browser-check.json +24 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/deck/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/deck/execution_notes.md +21 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/deck/outputs/deck.html +451 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/deck/screenshots/slide-01.png +0 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/deck/screenshots/slide-02.png +0 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/review.md +79 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/checks/browser-check.json +26 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/execution_notes.md +20 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/outputs/index.html +534 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/iteration-1/webpage/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/browser-check.json +64 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/language-check.txt +7 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/quick-validate.txt +1 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/static-console.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/checks/static-homepage.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/outputs/console.html +600 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/outputs/homepage.html +556 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/prompt.md +29 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/review.md +57 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/screenshots/console-desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/screenshots/console-mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/screenshots/homepage-desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/nebula-console-iteration-1/screenshots/homepage-mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/checks/browser-check.json +33 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/checks/language-check.txt +6 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/checks/quick-validate.txt +1 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/outputs/index.html +682 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/prompt.md +13 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/review.md +59 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-optics-iteration-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/outputs/page-01.html +466 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/outputs/page-02.html +433 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/prompt.md +13 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-01/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-01/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-01/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-02/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-02/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/obsidian-xui-screenshot-check-1/screenshots/page-02/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/checks/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/checks/language-check.txt +3 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/execution_notes.md +24 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/outputs/index.html +723 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/prompt.md +15 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/review.md +26 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/browser-dark.json +49 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/browser-light.json +49 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/language-check.txt +11 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/static-dark.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/checks/static-light.txt +3 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/execution_notes.md +23 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/outputs/dark.html +392 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/outputs/light.html +476 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/prompt.md +23 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/review.md +41 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/screenshots/dark/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/screenshots/dark/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/screenshots/light/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/precision-horizon-iteration-2/screenshots/light/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/checks/browser-check.json +54 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/checks/language-check.txt +5 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/checks/quick-validate.txt +1 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/outputs/index.html +765 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/prompt.md +15 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/review.md +59 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/solar-relay-iteration-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/verdant-grid-preview-1/outputs/index.html +508 -0
- package/skills/ui-design/tests/e2e/runs/verdant-grid-preview-1/screenshots/browser-check.json +49 -0
- package/skills/ui-design/tests/e2e/runs/verdant-grid-preview-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/verdant-grid-preview-1/screenshots/mobile.png +0 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/checks/browser-check.json +54 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/checks/language-check.txt +6 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/checks/quick-validate.txt +1 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/checks/static-check.txt +2 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/outputs/index.html +788 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/prompt.md +14 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/review.md +60 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/screenshots/desktop.png +0 -0
- package/skills/ui-design/tests/e2e/runs/violet-meridian-iteration-1/screenshots/mobile.png +0 -0
- package/skills/video-compose/SKILL.md +8 -1
- package/skills/web-crawler/SKILL.md +70 -0
- package/skills/web-crawler/scripts/crawl.mjs +538 -0
- package/skills/web-crawler/scripts/crawl.test.mjs +204 -0
- package/skills/xlsx/SKILL.md +12 -0
- package/skills/xlsx/scripts/opc_check.py +253 -0
- package/src/advisorState.js +22 -0
- package/src/askBridge.js +97 -3
- package/src/bootstrap/workingDir.js +12 -1
- package/src/cli/args.js +17 -1
- package/src/cli/configMenu.js +236 -0
- package/src/cli/configWizard.js +7 -5
- package/src/cli/print.js +37 -4
- package/src/cli/streamJson.js +77 -24
- package/src/cli/wizards/advisorWizard.js +147 -0
- package/src/cli/wizards/fieldForm.js +149 -0
- package/src/cli/wizards/imageWizard.js +60 -0
- package/src/cli/wizards/openRouterWizard.js +23 -0
- package/src/cli/wizards/providerPresets.js +95 -0
- package/src/cli/wizards/providerWizard.js +219 -0
- package/src/cli/wizards/searchWizard.js +23 -0
- package/src/cli/wizards/ttsWizard.js +34 -0
- package/src/config/configFile.js +441 -83
- package/src/config/configService.js +446 -0
- package/src/config.js +24 -64
- package/src/context/agentHome.js +9 -0
- package/src/context/archive.js +7 -2
- package/src/context/compact.js +8 -5
- package/src/context/contextLock.js +81 -0
- package/src/context/persistContext.js +30 -11
- package/src/context/reactiveCompact.js +4 -2
- package/src/context/recentDirs.js +21 -61
- package/src/context/sessionPath.js +97 -23
- package/src/context/sessionRegistry.js +303 -24
- package/src/context/tokenCounter.js +18 -0
- package/src/context/workspaceIndex.js +731 -0
- package/src/infra/verification.js +28 -15
- package/src/llm/client.js +394 -159
- package/src/llm/providers/anthropicFormat.js +241 -0
- package/src/llm/providers/openaiFormat.js +190 -0
- package/src/loop.js +219 -32
- package/src/main.js +61 -11
- package/src/messageQueue.js +97 -0
- package/src/multimodal.js +203 -0
- package/src/plugin-sdk.js +15 -0
- package/src/plugins/commandRouter.js +3 -0
- package/src/plugins/hookEngine.js +5 -1
- package/src/plugins/pluginLifecycle.js +28 -0
- package/src/plugins/pluginLoader.js +2 -1
- package/src/plugins/pluginRunner.js +49 -21
- package/src/plugins/transcript.js +4 -3
- package/src/prompts/pluginList.js +5 -5
- package/src/prompts/projectInstructions.js +3 -3
- package/src/prompts/promptAssembly.js +133 -144
- package/src/prompts/skillList.js +12 -22
- package/src/prompts/system.js +0 -1
- package/src/session/runAgentTurn.js +70 -0
- package/src/session/runTurn.js +41 -6
- package/src/toolGate.js +17 -0
- package/src/tools/advisor/advisor.js +379 -0
- package/src/tools/agent/agent.js +555 -0
- package/src/tools/agent/agentTypes.js +59 -0
- package/src/tools/agent/coordinator.js +93 -0
- package/src/tools/agent/worktree.js +270 -0
- package/src/tools/ask/ask.js +7 -2
- package/src/tools/bash/bash.js +112 -18
- package/src/tools/download/download.js +144 -0
- package/src/tools/edit/edit.js +1 -0
- package/src/tools/edit/multi-edit.js +1 -0
- package/src/tools/genimage/genimage.js +242 -0
- package/src/tools/genspeech/genspeech.js +67 -0
- package/src/tools/glob/glob.js +1 -0
- package/src/tools/grep/grep.js +3 -0
- package/src/tools/grep/rgPath.js +2 -0
- package/src/tools/index.js +25 -2
- package/src/tools/read/read.js +1 -0
- package/src/tools/shared/killTree.js +52 -0
- package/src/tools/toolProgressBridge.js +48 -0
- package/src/tools/webbrowser/agentBrowserPath.js +258 -0
- package/src/tools/webbrowser/browser.js +59 -42
- package/src/tools/webbrowser/browserControl.js +118 -0
- package/src/tools/webbrowser/browserDaemon.js +97 -0
- package/src/tools/webbrowser/browserService.js +27 -0
- package/src/tools/webbrowser/browserStream.js +119 -0
- package/src/tools/webbrowser/webbrowser.js +699 -130
- package/src/tools/webfetch/webfetch.js +1 -0
- package/src/tools/websearch/websearch.js +134 -51
- package/src/tools/write/write.js +1 -0
- package/src/ui/App.js +249 -22
- package/src/ui/AskQuestion.js +29 -10
- package/src/ui/InputBox.js +104 -12
- package/src/ui/LiveArea.js +112 -19
- package/src/ui/MessageList.js +100 -14
- package/src/ui/ModelPicker.js +56 -0
- package/src/ui/QueuedMessagesBanner.js +14 -0
- package/src/ui/Root.js +18 -10
- package/src/ui/SessionPicker.js +102 -0
- package/src/ui/StatusLine.js +13 -4
- package/src/ui/WorkspacePicker.js +55 -0
- package/src/ui/figures.js +44 -0
- package/src/ui/hooks/askSlot.js +82 -0
- package/src/ui/hooks/useChat.js +358 -64
- package/src/ui/hooks/usePasteHandler.js +11 -1
- package/src/ui/hooks/useTextBuffer.js +1 -3
- package/src/ui/liveViewport.js +5 -1
- package/src/ui/markdown.js +206 -0
- package/src/ui/textBuffer.js +0 -7
- package/src/ui/theme.js +32 -0
- package/src/utils/debugLog.js +0 -4
- package/src/utils/resourcePaths.js +2 -2
- package/src/utils/stripThink.js +50 -0
- package/src/web/browserBridge.js +447 -0
- package/src/web/protocol.js +19 -0
- package/workflows/adaptive-research.yaml +13 -5
- package/workflows/book-review-short.yaml +36 -10
- package/workflows/e2e-write-greet.yaml +6 -2
- package/workflows/illustrate.yaml +227 -0
- package/workflows/plan.yaml +460 -179
- package/workflows/ppt.yaml +1659 -0
- package/workflows/ralph-loop.yaml +199 -0
- package/workflows/schema.json +81 -23
- package/workflows/webppt.yaml +496 -0
- package/workflows/word.yaml +710 -0
- package/workflows/youtube-shorts.yaml +46 -15
- package/MINIMAL-TRACE.md +0 -77
- package/plugins/HOW-TO-WRITE-A-PLUGIN.md +0 -186
- package/plugins/ralph-wiggum/.claude-plugin/plugin.json +0 -9
- package/plugins/ralph-wiggum/README.md +0 -197
- package/plugins/ralph-wiggum/commands/cancel-ralph.md +0 -18
- package/plugins/ralph-wiggum/commands/help.md +0 -137
- package/plugins/ralph-wiggum/commands/ralph-loop.md +0 -85
- package/plugins/ralph-wiggum/hooks/hooks.json +0 -15
- package/plugins/ralph-wiggum/hooks/stop-hook.sh +0 -191
- package/plugins/ralph-wiggum/plugin.js +0 -280
- package/plugins/ralph-wiggum/src/goalState.js +0 -258
- package/plugins/ralph-wiggum/src/sentinels.js +0 -76
- package/plugins/ralph-wiggum/src/stopHookRunner.js +0 -104
- package/plugins/ralph-wiggum/src/verificationGate.js +0 -202
- package/plugins/workflow-runner/src/miniReAct.js +0 -223
- package/plugins/workflow-runner/src/voteHelpers.js +0 -110
- package/skills/config/SKILL.md +0 -123
- package/skills/frontend-design/LICENSE.txt +0 -177
- package/skills/frontend-design/SKILL.md +0 -42
- package/src/ui/ProgressPanel.js +0 -54
- package/src/ui/StreamingBlock.js +0 -11
- package/src/ui/ToolStatus.js +0 -11
|
@@ -7,32 +7,40 @@ description: |
|
|
|
7
7
|
去做任意视频流水线(横屏长视频、广告片、教程片都行)。
|
|
8
8
|
version: "0.1"
|
|
9
9
|
|
|
10
|
+
# 声明产物:new-task 启动清理残留 / completed 报实际产物 / 同任务 resume 重写不被
|
|
11
|
+
# 内核「覆盖前先 Read」守卫挡(见 CLAUDE.md 任务身份语义)
|
|
12
|
+
artifacts:
|
|
13
|
+
- "./assets/script.json"
|
|
14
|
+
- "./out/shorts.mp4"
|
|
15
|
+
|
|
10
16
|
inputs:
|
|
11
17
|
- name: topic
|
|
12
18
|
type: string
|
|
13
19
|
required: true
|
|
14
|
-
|
|
20
|
+
greedy: true
|
|
21
|
+
description: "视频主题(中文,可一句话自然语言;命令行整句进 topic,不被空格拆碎)"
|
|
15
22
|
- name: openrouter_key
|
|
16
23
|
type: string
|
|
17
24
|
required: false
|
|
18
|
-
description: "OpenRouter API key;不填则用 OPENROUTER_API_KEY 环境变量"
|
|
25
|
+
description: "【高级·用 --input openrouter_key=...】OpenRouter API key;不填则用 OPENROUTER_API_KEY 环境变量"
|
|
19
26
|
- name: aspect
|
|
20
27
|
type: enum
|
|
21
28
|
values: ["9:16", "16:9", "1:1", "4:5"]
|
|
22
29
|
default: "9:16"
|
|
23
|
-
description: "
|
|
30
|
+
description: "【高级·用 --input aspect=...】图片与视频宽高比"
|
|
24
31
|
- name: width
|
|
25
32
|
type: number
|
|
26
33
|
default: 1080
|
|
27
|
-
description: "
|
|
34
|
+
description: "【高级·用 --input width=N】视频输出宽度"
|
|
28
35
|
- name: height
|
|
29
36
|
type: number
|
|
30
37
|
default: 1920
|
|
31
|
-
description: "
|
|
38
|
+
description: "【高级·用 --input height=N】视频输出高度"
|
|
32
39
|
|
|
33
40
|
steps:
|
|
34
41
|
# ---------- 1. 用 LLM 写 5 幕脚本(强制 5 幕以便后续 loop 用静态数组) ----------
|
|
35
42
|
- id: write_script
|
|
43
|
+
title: "1/11·写五幕脚本"
|
|
36
44
|
llm: |
|
|
37
45
|
你是短视频文案策划。请为主题"${inputs.topic}"写一个 **正好 5 幕** 的竖屏短视频。
|
|
38
46
|
每一幕包含:
|
|
@@ -48,13 +56,17 @@ steps:
|
|
|
48
56
|
|
|
49
57
|
# ---------- 2. 把 LLM 输出落盘为 script.json ----------
|
|
50
58
|
- id: write_script_json
|
|
59
|
+
title: "2/11·脚本落盘 script.json"
|
|
51
60
|
tool: Write
|
|
61
|
+
artifacts:
|
|
62
|
+
- "./assets/script.json"
|
|
52
63
|
args:
|
|
53
64
|
file_path: "./assets/script.json"
|
|
54
65
|
content: "${script_json_text}"
|
|
55
66
|
|
|
56
67
|
# ---------- 3. 解析 script.json,拆出 prompts.txt / narrations.txt(每行一个) ----------
|
|
57
68
|
- id: parse_script
|
|
69
|
+
title: "3/11·解析脚本拆分文案"
|
|
58
70
|
tool: Bash
|
|
59
71
|
args:
|
|
60
72
|
command: |
|
|
@@ -69,44 +81,57 @@ steps:
|
|
|
69
81
|
content: parse_log
|
|
70
82
|
|
|
71
83
|
- id: assert_script_parsed
|
|
72
|
-
|
|
73
|
-
|
|
84
|
+
title: "4/11·校验脚本拆分产物"
|
|
85
|
+
type: verify
|
|
86
|
+
checks:
|
|
87
|
+
- 'file_exists:./assets/prompts.txt'
|
|
88
|
+
- 'file_exists:./assets/narrations.txt'
|
|
74
89
|
onFail: "脚本解析失败:./assets/prompts.txt 或 ./assets/narrations.txt 不存在"
|
|
75
90
|
|
|
76
91
|
# ---------- 4. 生成 5 张配图(loop 静态数组 + 每轮先读对应一行 prompt) ----------
|
|
92
|
+
# ⚠️ Bash 引号 footgun:${i} 是引擎插值(shell 之前发生)。曾写 1 基算术
|
|
93
|
+
# `sed -n '$((${i}+1))p'`——shell 单引号内不做算术展开,sed 收到字面 $((0+1))p
|
|
94
|
+
# 直接报错。正解:loop 直接用 1 基序号,sed 行号即 ${i}。
|
|
77
95
|
- id: gen_images
|
|
96
|
+
title: "5/11·生成五张配图"
|
|
78
97
|
type: loop
|
|
79
|
-
over: "[
|
|
98
|
+
over: "[1, 2, 3, 4, 5]"
|
|
80
99
|
as: i
|
|
81
100
|
do:
|
|
82
101
|
- id: read_prompt
|
|
102
|
+
title: "读第 ${i} 行画面提示词"
|
|
83
103
|
tool: Bash
|
|
84
104
|
args:
|
|
85
|
-
command:
|
|
105
|
+
command: 'sed -n "${i}p" ./assets/prompts.txt'
|
|
86
106
|
capture:
|
|
87
107
|
content: prompt_text
|
|
88
108
|
- id: gen_one_image
|
|
109
|
+
title: "生成第 ${i} 张配图"
|
|
89
110
|
skill: image-gen-openrouter
|
|
90
111
|
input: 'prompt=${prompt_text} output=./assets/img_${i}.png aspect=${inputs.aspect} key=${inputs.openrouter_key}'
|
|
91
112
|
|
|
92
|
-
# ---------- 5. 生成 5 段 TTS
|
|
113
|
+
# ---------- 5. 生成 5 段 TTS 音频(1 基序号,理由同 gen_images) ----------
|
|
93
114
|
- id: gen_audio
|
|
115
|
+
title: "6/11·生成五段配音"
|
|
94
116
|
type: loop
|
|
95
|
-
over: "[
|
|
117
|
+
over: "[1, 2, 3, 4, 5]"
|
|
96
118
|
as: i
|
|
97
119
|
do:
|
|
98
120
|
- id: read_narration
|
|
121
|
+
title: "读第 ${i} 句旁白"
|
|
99
122
|
tool: Bash
|
|
100
123
|
args:
|
|
101
|
-
command:
|
|
124
|
+
command: 'sed -n "${i}p" ./assets/narrations.txt'
|
|
102
125
|
capture:
|
|
103
126
|
content: narration_text
|
|
104
127
|
- id: gen_one_tts
|
|
128
|
+
title: "合成第 ${i} 段语音"
|
|
105
129
|
skill: tts-zh
|
|
106
130
|
input: 'text=${narration_text} output=./assets/audio_${i}.mp3'
|
|
107
131
|
|
|
108
132
|
# ---------- 6. 探测各段音频时长,逗号串联 ----------
|
|
109
133
|
- id: probe_durations
|
|
134
|
+
title: "7/11·探测音频时长"
|
|
110
135
|
tool: Bash
|
|
111
136
|
args:
|
|
112
137
|
command: |
|
|
@@ -119,6 +144,7 @@ steps:
|
|
|
119
144
|
|
|
120
145
|
# ---------- 7. 合并所有 TTS 段成一条音轨 ----------
|
|
121
146
|
- id: merge_audio
|
|
147
|
+
title: "8/11·合并音轨"
|
|
122
148
|
tool: Bash
|
|
123
149
|
args:
|
|
124
150
|
command: |
|
|
@@ -133,6 +159,7 @@ steps:
|
|
|
133
159
|
|
|
134
160
|
# ---------- 8. 读 narrations_json(前面 parse_script 已写好),作 SRT 文本输入 ----------
|
|
135
161
|
- id: read_narrations_json
|
|
162
|
+
title: "9/11·读取旁白清单"
|
|
136
163
|
tool: Read
|
|
137
164
|
args:
|
|
138
165
|
file_path: "./assets/narrations_json.txt"
|
|
@@ -141,18 +168,22 @@ steps:
|
|
|
141
168
|
|
|
142
169
|
# ---------- 9. 生成 SRT 字幕 ----------
|
|
143
170
|
- id: make_srt
|
|
171
|
+
title: "10/11·生成字幕"
|
|
144
172
|
skill: subtitle-srt
|
|
145
173
|
input: 'texts=${narrations_json} durations=${durations} output=./assets/subs.srt'
|
|
146
174
|
|
|
147
175
|
# ---------- 10. 合成最终 mp4 ----------
|
|
148
176
|
- id: compose_video
|
|
177
|
+
title: "11/11·合成最终视频"
|
|
149
178
|
skill: video-compose
|
|
150
179
|
input: 'images_glob=./assets/img_*.png audio=./assets/audio.mp3 srt=./assets/subs.srt output=./out/shorts.mp4 width=${inputs.width} height=${inputs.height}'
|
|
151
180
|
|
|
152
|
-
# ---------- 11. 守门 assert ----------
|
|
181
|
+
# ---------- 11. 守门 verify(升级自 assert) ----------
|
|
153
182
|
- id: verify_output
|
|
154
|
-
|
|
155
|
-
|
|
183
|
+
title: "完成·守门校验"
|
|
184
|
+
type: verify
|
|
185
|
+
checks:
|
|
186
|
+
- 'file_exists:./out/shorts.mp4'
|
|
156
187
|
onFail: "最终视频 ./out/shorts.mp4 未生成,请检查 video-compose 日志"
|
|
157
188
|
|
|
158
189
|
__meta:
|
package/MINIMAL-TRACE.md
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
# MINIMAL-TRACE —— 用最短路径读懂 agent 主循环
|
|
2
|
-
|
|
3
|
-
> 教学导读。本项目首要目标是「讲透一个 agent 从输入 → 工具循环 → 落盘」。
|
|
4
|
-
> 但 `src/loop.ts` 已含不少**生产硬化**(4 种压缩 / 反应式自救 / 并行事件队列 / 截断警告…),
|
|
5
|
-
> 初学者直接读会被淹没。这篇带你**第一遍只看主干**,把硬化层全部圈出来跳过。
|
|
6
|
-
|
|
7
|
-
## 一句话本质
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
用户输入 → 调 LLM → LLM 想调工具就执行 → 结果喂回 → 再调 LLM → … → 不调工具了,输出最终回答
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
整个 agent 就是这个循环。它写在 `src/loop.ts::runQuery`(一个 `async function*`,逐步 `yield` 事件给 UI)。
|
|
14
|
-
|
|
15
|
-
## 最小可读路径(第一遍只看这 6 步)
|
|
16
|
-
|
|
17
|
-
打开 `src/loop.ts`,找到 `runQuery`,顺着看这几段——**只看主干,遇到下面「进阶层」列出的东西先跳过**:
|
|
18
|
-
|
|
19
|
-
1. **用户消息入栈**:把 `{ role:'user', content: userInput }` push 进 `history`,`yield` 一个 `user_message_committed` 让 UI 先把它显示出来。`history` 是一个会被原地 mutate 的数组(调用方和 loop 共享同一引用)。
|
|
20
|
-
|
|
21
|
-
2. **进入 `while (turn < maxTurns)`**:每一轮 = 一次「调 LLM(可能带工具)」。`maxTurns`(默认 50)是失控保护。
|
|
22
|
-
|
|
23
|
-
3. **调 LLM、把流式响应拼成一条 assistant 消息**:`for await (const ev of chat({...}))` 逐块消费——`text_delta` 累积成答案文本并 `yield {type:'text'}`;`tool_call_delta` 累积成工具调用(OpenAI 协议下工具调用也是分片返回的,用 `mergeToolCallDelta` 合并)。循环结束后组装出 `assistantMsg` 推入 `history`、`yield assistant_message`。
|
|
24
|
-
|
|
25
|
-
4. **没有工具调用 → 这一轮就是最终回答,结束**:`if (toolCallsByIndex.length === 0)` → `yield {type:'turn_done'}` 然后 `return`。这是循环的正常出口。
|
|
26
|
-
|
|
27
|
-
5. **有工具调用 → 逐个执行、把结果按顺序回填 `history`**:对每个工具调用,`yield tool_start` → 调 `executeToolFn(name, argsJson, signal)` → `yield tool_end`,再把结果作为 `{ role:'tool', tool_call_id }` 消息 push 回 `history`。**关键**:tool 消息必须严格按 assistant 的 `tool_calls` 顺序回填(OpenAI 协议要求一一对应)。
|
|
28
|
-
|
|
29
|
-
6. **回到 `while` 顶部继续下一轮**:模型这次能看到上一轮的工具结果,于是接着推理——要么再调工具,要么给出最终答案(回到第 4 步出口)。
|
|
30
|
-
|
|
31
|
-
读完这 6 步,你就掌握了 agent 的全部本质。下面的都是「让它在生产环境不出岔子」的加固,第一遍可以完全不看。
|
|
32
|
-
|
|
33
|
-
## 进阶层(第一遍请跳过)
|
|
34
|
-
|
|
35
|
-
这些都是 `runQuery` 里为了**健壮/体验**加的料,每个解决一个具体问题,但都不影响你理解主循环:
|
|
36
|
-
|
|
37
|
-
| 你会看到 | 它解决什么 | 第一遍 |
|
|
38
|
-
|---|---|---|
|
|
39
|
-
| `autoCompactIfNeeded`(每轮开头) | 上下文快撑爆时,把旧对话压成摘要,防止超 contextWindow | 跳过 |
|
|
40
|
-
| `reactiveCompactIfApplicable`(catch 里) | 真撞上 prompt-too-long 时,压缩历史后**同轮重发**自救 | 跳过 |
|
|
41
|
-
| `snipCompactIfNeeded`(压缩失败兜底) | 连压缩都失败时,硬砍最老消息释放空间再继续 | 跳过 |
|
|
42
|
-
| `microCompact`(回填 tool 结果时) | 把单个超长工具输出就地压短,省 token | 跳过 |
|
|
43
|
-
| `allConcurrencySafe` 分支 + 事件队列 | 本轮工具**全是只读**才并行执行,否则串行(杜绝并行写同一文件) | 跳过 |
|
|
44
|
-
| `lastFinishReason === 'length'` 警告 | 模型答案被 max_tokens 截断时提醒用户「这是半截」 | 跳过 |
|
|
45
|
-
| `reasoningContent / reasoning / reasoning_details` | 累积思维链(DeepSeek-R1 / MiniMax 等),下一轮原样回传防「失忆」 | 跳过 |
|
|
46
|
-
| `error` 事件的 `code`(llm_error / max_turns / …) | 让 `-p --output-format json` 把终结原因映射成稳定的 stop_reason(给宿主 spawn 用) | 跳过 |
|
|
47
|
-
| `options.chat` / `options.executeTool` | 依赖注入:测试时传 stub,零进程污染;生产走真实模块单例 | 跳过 |
|
|
48
|
-
|
|
49
|
-
## 时序图(主干)
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
用户输入
|
|
53
|
-
│
|
|
54
|
-
▼
|
|
55
|
-
runQuery ──push user 消息──► history
|
|
56
|
-
│
|
|
57
|
-
├─◄─────────────────────────┐ (每轮 turn)
|
|
58
|
-
▼ │
|
|
59
|
-
chat(LLM) ──流式 text / tool_call──► 拼成 assistant 消息 → history
|
|
60
|
-
│ │
|
|
61
|
-
├── 无 tool_calls ──► turn_done ──► return(最终回答)
|
|
62
|
-
│ │
|
|
63
|
-
└── 有 tool_calls │
|
|
64
|
-
│ │
|
|
65
|
-
▼ │
|
|
66
|
-
executeTool ×N ──► tool 结果 → history ──┘(回到下一轮,模型看到结果再推理)
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## 延伸阅读(按需,第几步用到再看)
|
|
70
|
-
|
|
71
|
-
- **`src/types.ts`** —— 类型字典。先看 `Message`(4 种 role)、`ToolCall`、`LlmStreamEvent`(LLM 流式块)、`LoopEvent`(loop 给 UI 的事件)。读主循环前先扫一遍这四个就够。
|
|
72
|
-
- **`src/llm/client.ts`** —— `chat()` 的实现:把 provider 的 SSE 流解析成 `LlmStreamEvent`。对应主干第 3 步。
|
|
73
|
-
- **`src/tools/index.ts`** —— `ALL_TOOLS`(工具清单)+ `executeTool()`:参数防线(JSON.parse → Zod 校验 → 调 `tool.call()`,**工具失败不抛异常**,把 error 喂回 LLM 让它重试)。对应主干第 5 步。
|
|
74
|
-
- **`src/context/compact.ts`** —— 自动压缩入口(进阶层)。想搞懂「上下文怎么不撑爆」再看。
|
|
75
|
-
- **`src/loop.ts`** —— 主角本身。读完本文按上面 6 步对照源码,再回头看进阶层。
|
|
76
|
-
|
|
77
|
-
> 一句话给初学者:**先把 6 步主干跑通,把进阶层当黑盒**;等你能复述「输入怎么变成最终回答」了,再一个个揭开硬化层——每揭开一个,你就多懂一点「为什么生产级 agent 不只是一个 while 循环」。
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
# How to Write a minimal-agent Plugin
|
|
2
|
-
|
|
3
|
-
minimal-agent 的插件系统遵循 **drop-in** 原则:把目录扔进 `plugins/`,命令立即可用,**`src/` 一行不改**。
|
|
4
|
-
|
|
5
|
-
## 两种契约
|
|
6
|
-
|
|
7
|
-
### 1. 纯声明式(Anthropic 兼容,零 TS)
|
|
8
|
-
|
|
9
|
-
最小可用插件 = 一个 frontmatter 模板。框架替你拼 prompt 喂给 LLM。
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
plugins/hello-bot/
|
|
13
|
-
├── .claude-plugin/
|
|
14
|
-
│ └── plugin.json
|
|
15
|
-
└── commands/
|
|
16
|
-
└── hi.md
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
**`.claude-plugin/plugin.json`**
|
|
20
|
-
|
|
21
|
-
```json
|
|
22
|
-
{
|
|
23
|
-
"name": "hello-bot",
|
|
24
|
-
"version": "0.1.0",
|
|
25
|
-
"description": "Greets the user"
|
|
26
|
-
}
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
**`commands/hi.md`**
|
|
30
|
-
|
|
31
|
-
```markdown
|
|
32
|
-
---
|
|
33
|
-
description: "Greet the user"
|
|
34
|
-
argument-hint: "<name>"
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
你好 $ARGUMENTS!欢迎使用 minimal-agent。
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
**效果**:用户输入 `/hi 世界` → LLM 收到 `你好 世界!欢迎使用 minimal-agent。\n\n用户参数: 世界`。
|
|
41
|
-
|
|
42
|
-
支持的占位符:
|
|
43
|
-
- `$ARGUMENTS` / `${ARGUMENTS}` —— 用户在命令名后的全部文本
|
|
44
|
-
- `${CLAUDE_PLUGIN_ROOT}` —— 该插件目录的绝对路径(用于引用插件资源)
|
|
45
|
-
|
|
46
|
-
### 2. 声明式 + `plugin.ts`(富插件)
|
|
47
|
-
|
|
48
|
-
当模板不够(要跑循环 / 做 TS 校验 / 启动子进程 / 状态机),加一个 `plugin.ts`:
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
plugins/echo-bot/
|
|
52
|
-
├── .claude-plugin/plugin.json
|
|
53
|
-
├── commands/echo.md # 仍要存在!frontmatter 用于 listAvailableCommands
|
|
54
|
-
└── plugin.ts # PluginApi default export
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
**`plugin.ts`**
|
|
58
|
-
|
|
59
|
-
```typescript
|
|
60
|
-
import {
|
|
61
|
-
runQuery,
|
|
62
|
-
type PluginApi,
|
|
63
|
-
type LoopEvent,
|
|
64
|
-
} from '../../src/plugin-sdk.ts';
|
|
65
|
-
|
|
66
|
-
const api: PluginApi = {
|
|
67
|
-
async *runCommand(commandName, args, ctx): AsyncGenerator<LoopEvent> {
|
|
68
|
-
if (commandName === 'echo') {
|
|
69
|
-
// 直接 yield 自定义事件
|
|
70
|
-
yield { type: 'text', delta: `你输入了:${args}` };
|
|
71
|
-
yield { type: 'turn_done' };
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// 或者改写 prompt 后丢给 LLM
|
|
76
|
-
yield* runQuery(`请把以下内容重复 3 遍:${args}`, {
|
|
77
|
-
provider: ctx.provider,
|
|
78
|
-
history: ctx.history,
|
|
79
|
-
signal: ctx.signal,
|
|
80
|
-
});
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export default api;
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
**框架行为**:命中 `/echo abc` 时,`pluginRunner` 优先调用 `runCommand('echo', 'abc', ctx)`,不再走声明式 fallback。你完全接管事件流。
|
|
88
|
-
|
|
89
|
-
## `plugin-sdk.ts` 暴露的全部 API
|
|
90
|
-
|
|
91
|
-
**唯一稳定 import 路径**:`from '../../src/plugin-sdk.ts'`(相对你的 `plugin.ts`)。
|
|
92
|
-
|
|
93
|
-
| 名称 | 类型 | 用途 |
|
|
94
|
-
|------|------|------|
|
|
95
|
-
| `runQuery(input, opts)` | function | 标准 T-A-O-R 循环,AsyncGenerator |
|
|
96
|
-
| `chat(messages, provider, opts)` | function | 单次非流式 LLM 调用 |
|
|
97
|
-
| `executeTool(name, argsJson, ctx)` | function | 框架级工具调用入口 |
|
|
98
|
-
| `getToolByName(name)` | function | 取 Tool 定义 |
|
|
99
|
-
| `ALL_TOOLS` | const | 所有内置工具数组 |
|
|
100
|
-
| `getWorkingDir()` | function | 当前锁定的工作目录 |
|
|
101
|
-
| `getResourceSearchPaths(name, importMetaUrl)` | function | 双源资源路径(cwd + packageRoot) |
|
|
102
|
-
| `triggerHook(event, payload)` | function | 触发框架级 hook |
|
|
103
|
-
| `createSessionState()` | function | 新建 SessionState |
|
|
104
|
-
| `Message` / `Provider` / `LoopEvent` / `LlmStreamEvent` | type | 协议类型 |
|
|
105
|
-
| `Tool` / `ToolCall` / `ToolResult` | type | 工具协议类型 |
|
|
106
|
-
| `PluginApi` / `PluginContext` | type | 你的 plugin.ts 契约 |
|
|
107
|
-
| `ResourceName` / `HookEventName` / `HookDecision` / `SessionState` | type | 杂项 |
|
|
108
|
-
|
|
109
|
-
**不要**绕开 `plugin-sdk.ts` 直接 import `src/loop.ts` / `src/llm/client.ts` 等内部路径 —— 那些路径不是稳定 API,框架重构时会破坏你的插件。
|
|
110
|
-
|
|
111
|
-
## `PluginContext`
|
|
112
|
-
|
|
113
|
-
`runCommand` 收到的 ctx:
|
|
114
|
-
|
|
115
|
-
```typescript
|
|
116
|
-
interface PluginContext {
|
|
117
|
-
provider: Provider; // 当前 LLM provider 配置
|
|
118
|
-
history: Message[]; // 对话历史(你可以读 / 修改 / 替换)
|
|
119
|
-
signal?: AbortSignal; // 用户 ESC / Ctrl+C 时触发
|
|
120
|
-
sessionState?: SessionState; // 可选共享 session 状态
|
|
121
|
-
maxTurns?: number; // 工具循环最大轮数(runQuery 透传用)
|
|
122
|
-
}
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
## 事件 (`LoopEvent`)
|
|
126
|
-
|
|
127
|
-
你的 `runCommand` 必须 yield `LoopEvent`,UI 据此渲染。常用的有:
|
|
128
|
-
|
|
129
|
-
| type | 字段 | 用途 |
|
|
130
|
-
|------|------|------|
|
|
131
|
-
| `text` | `delta: string` | 流式文本片段 |
|
|
132
|
-
| `assistant_message` | (无) | 一次完整 assistant 消息已 push 进 history |
|
|
133
|
-
| `tool_start` | `toolName`, `argsPreview` | 工具开始执行 |
|
|
134
|
-
| `tool_end` | (无) | 工具结束 |
|
|
135
|
-
| `turn_done` | (无) | 整轮交互结束 |
|
|
136
|
-
| `interrupted` | (无) | 用户中断 |
|
|
137
|
-
| `error` | `error: string` | 红色错误提示 |
|
|
138
|
-
| `plugin_progress` | `pluginId`, `current`, `max?`, `message?` | 循环进度条(替代旧的 plugin_start / plugin_iteration) |
|
|
139
|
-
|
|
140
|
-
通常做法:复杂插件直接 `yield* runQuery(...)` 透传所有事件,自己额外 yield `plugin_progress` 做进度展示。
|
|
141
|
-
|
|
142
|
-
## 工作目录与持久化
|
|
143
|
-
|
|
144
|
-
- 状态写到 `getWorkingDir()/.minimal-agent-<your-plugin-id>/` 下,避免污染主 context 目录
|
|
145
|
-
- `/new` 命令会自动清这些 `.minimal-agent*` 目录,你不用管 cleanup
|
|
146
|
-
- 跨平台:Windows 没 bash,hooks/*.sh 静默跳过;其它 .ts 代码完全平台无关
|
|
147
|
-
|
|
148
|
-
## 命令默认值
|
|
149
|
-
|
|
150
|
-
框架**不再**注入命令默认参数(旧版 `COMMAND_DEFAULTS` 已删除)。如果你的命令需要默认值(如 `--max-iterations 50`),自己在 `plugin.ts` 里解析 args 时兜底。这样默认值的语义属于插件契约,不属于框架。
|
|
151
|
-
|
|
152
|
-
## 测试
|
|
153
|
-
|
|
154
|
-
- 把测试放在 `plugins/<id>/test/*.test.ts`
|
|
155
|
-
- `bunfig.toml` 的 `[test].root = ["./test", "./plugins"]` 让 `bun test` 自动发现
|
|
156
|
-
- 测试里 mock LLM / 工具时,用 `mock.module('../../../src/loop.ts', ...)` 等绝对到 src 的相对路径
|
|
157
|
-
|
|
158
|
-
## 参考实现
|
|
159
|
-
|
|
160
|
-
- **声明式 + plugin.ts 简单例**:`plugins/workflow-runner/plugin.ts`(~25 行接管 `/workflow` 与 `/workflows`)
|
|
161
|
-
- **重型循环例**:`plugins/ralph-wiggum/plugin.ts`(~270 行 do-while loop + FSM + sentinel + verification + stop-hook)
|
|
162
|
-
|
|
163
|
-
## Transcript 与 Hook:当前状态
|
|
164
|
-
|
|
165
|
-
框架提供了两套基础设施 —— 都**就绪、有测试、可独立调用**,但**主循环 `src/loop.ts` 不自动触发**:
|
|
166
|
-
|
|
167
|
-
| 模块 | 暴露 | 当前主循环触发? |
|
|
168
|
-
|------|------|------|
|
|
169
|
-
| `src/plugins/transcript.ts` | `initTranscript / appendUserMessage / appendAssistantMessage / appendToolResult` | 否 |
|
|
170
|
-
| `src/plugins/hookEngine.ts` | `loadHooks / triggerHook('UserPromptSubmit' \| 'PreToolUse' \| 'PostToolUse' \| 'SessionStart' \| 'SessionEnd', payload)` | 否 |
|
|
171
|
-
|
|
172
|
-
**插件如何使用**:
|
|
173
|
-
- 想写自己的 JSONL transcript → 在 `runCommand` 内 `import { initTranscript, appendUserMessage } from '../../src/plugin-sdk.ts'` 自己调
|
|
174
|
-
- 想响应 hook 事件 → 在 `runCommand` 内 `triggerHook('PreToolUse', { tool_name, ... })` 自己调;ralph-wiggum 走的就是这条路(vendored stop-hook 执行器在 `plugins/ralph-wiggum/src/stopHookRunner.ts`)
|
|
175
|
-
|
|
176
|
-
**为什么不在主循环自动触发**:当前没有 Anthropic 风格 `hooks/*.sh` 的真实用例驱动;自动触发会改主循环热路径但不解决实际问题。等真有跨插件的全局 hook 需求时再接也不迟。届时只需在 `src/loop.ts` 的 user/assistant/tool 三处 push 点加 `appendXxx` 与 `triggerHook` 调用即可,**不影响插件契约**。
|
|
177
|
-
|
|
178
|
-
## 不支持的 Anthropic 字段
|
|
179
|
-
|
|
180
|
-
minimal-agent 的插件契约是 Anthropic 上游的**子集**。当前未实现的字段:
|
|
181
|
-
|
|
182
|
-
- `mcp-servers/` —— MCP 服务器配置
|
|
183
|
-
- `agents/` —— 子 agent 定义
|
|
184
|
-
- `skills/` 在插件目录下 —— minimal-agent 的 skill 系统是独立顶层目录
|
|
185
|
-
|
|
186
|
-
未实现字段在 plugin.json 中存在不会报错,但被忽略。
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ralph-wiggum",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "Implementation of the Ralph Wiggum technique - continuous self-referential AI loops for interactive iterative development. Run Claude in a while-true loop with the same prompt until task completion.",
|
|
5
|
-
"author": {
|
|
6
|
-
"name": "Daisy Hollman",
|
|
7
|
-
"email": "daisy@anthropic.com"
|
|
8
|
-
}
|
|
9
|
-
}
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
# Ralph Wiggum Plugin
|
|
2
|
-
|
|
3
|
-
Implementation of the Ralph Wiggum technique for iterative, self-referential AI development loops in Minimal Agent.
|
|
4
|
-
|
|
5
|
-
## What is Ralph?
|
|
6
|
-
|
|
7
|
-
Ralph is a development methodology based on continuous AI agent loops. As Geoffrey Huntley describes it: **"Ralph is a Bash loop"** - a simple `while true` that repeatedly feeds an AI agent a prompt file, allowing it to iteratively improve its work until completion.
|
|
8
|
-
|
|
9
|
-
The technique is named after Ralph Wiggum from The Simpsons, embodying the philosophy of persistent iteration despite setbacks.
|
|
10
|
-
|
|
11
|
-
### Core Concept
|
|
12
|
-
|
|
13
|
-
This plugin implements Ralph using a **Stop hook** that intercepts Minimal Agent's exit attempts:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
# You run ONCE:
|
|
17
|
-
/ralph-loop "Your task description" --completion-promise "DONE"
|
|
18
|
-
|
|
19
|
-
# Then Claude Code automatically:
|
|
20
|
-
# 1. Works on the task
|
|
21
|
-
# 2. Tries to exit
|
|
22
|
-
# 3. Stop hook blocks exit
|
|
23
|
-
# 4. Stop hook feeds the SAME prompt back
|
|
24
|
-
# 5. Repeat until completion
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
The loop happens **inside your current session** - you don't need external bash loops. The Stop hook in `hooks/stop-hook.sh` creates the self-referential feedback loop by blocking normal session exit.
|
|
28
|
-
|
|
29
|
-
This creates a **self-referential feedback loop** where:
|
|
30
|
-
- The prompt never changes between iterations
|
|
31
|
-
- Claude's previous work persists in files
|
|
32
|
-
- Each iteration sees modified files and git history
|
|
33
|
-
- Claude autonomously improves by reading its own past work in files
|
|
34
|
-
|
|
35
|
-
## Quick Start
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
/ralph-loop "Build a REST API for todos. Requirements: CRUD operations, input validation, tests. Output <promise>COMPLETE</promise> when done." --completion-promise "COMPLETE" --max-iterations 50
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Claude will:
|
|
42
|
-
- Implement the API iteratively
|
|
43
|
-
- Run tests and see failures
|
|
44
|
-
- Fix bugs based on test output
|
|
45
|
-
- Iterate until all requirements met
|
|
46
|
-
- Output the completion promise when done
|
|
47
|
-
|
|
48
|
-
## Commands
|
|
49
|
-
|
|
50
|
-
### /ralph-loop
|
|
51
|
-
|
|
52
|
-
Start a Ralph loop in your current session.
|
|
53
|
-
|
|
54
|
-
**Usage:**
|
|
55
|
-
```bash
|
|
56
|
-
/ralph-loop "<prompt>" --max-iterations <n> --completion-promise "<text>"
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
**Options:**
|
|
60
|
-
- `--max-iterations <n>` - Stop after N iterations (default: 50, hard cap: 200)
|
|
61
|
-
- `--completion-promise <text>` - Phrase that signals completion (natively active; default: DONE / COMPLETE / GOAL_COMPLETE)
|
|
62
|
-
- `--verify "<CHECK>"` - Completion gate run after the promise tag. All checks must pass before the loop exits. Repeatable.
|
|
63
|
-
- `shell:<cmd>` — exit code 0 = pass (Windows: `cmd /c`, others: `bash -c`)
|
|
64
|
-
- `file_exists:<path>` — file must exist
|
|
65
|
-
- `file_contains:<file>:<regex>` — file content matches regex
|
|
66
|
-
- `test_count:<min>` — `bun test` pass count ≥ min
|
|
67
|
-
|
|
68
|
-
Example:
|
|
69
|
-
```bash
|
|
70
|
-
/ralph-loop "Implement and test cache layer" \
|
|
71
|
-
--verify "shell:bun test" \
|
|
72
|
-
--verify "file_exists:dist/index.js"
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### /cancel-ralph
|
|
76
|
-
|
|
77
|
-
Cancel the active Ralph loop.
|
|
78
|
-
|
|
79
|
-
**Usage:**
|
|
80
|
-
```bash
|
|
81
|
-
/cancel-ralph
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Prompt Writing Best Practices
|
|
85
|
-
|
|
86
|
-
### 1. Clear Completion Criteria
|
|
87
|
-
|
|
88
|
-
❌ Bad: "Build a todo API and make it good."
|
|
89
|
-
|
|
90
|
-
✅ Good:
|
|
91
|
-
```markdown
|
|
92
|
-
Build a REST API for todos.
|
|
93
|
-
|
|
94
|
-
When complete:
|
|
95
|
-
- All CRUD endpoints working
|
|
96
|
-
- Input validation in place
|
|
97
|
-
- Tests passing (coverage > 80%)
|
|
98
|
-
- README with API docs
|
|
99
|
-
- Output: <promise>COMPLETE</promise>
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### 2. Incremental Goals
|
|
103
|
-
|
|
104
|
-
❌ Bad: "Create a complete e-commerce platform."
|
|
105
|
-
|
|
106
|
-
✅ Good:
|
|
107
|
-
```markdown
|
|
108
|
-
Phase 1: User authentication (JWT, tests)
|
|
109
|
-
Phase 2: Product catalog (list/search, tests)
|
|
110
|
-
Phase 3: Shopping cart (add/remove, tests)
|
|
111
|
-
|
|
112
|
-
Output <promise>COMPLETE</promise> when all phases done.
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### 3. Self-Correction
|
|
116
|
-
|
|
117
|
-
❌ Bad: "Write code for feature X."
|
|
118
|
-
|
|
119
|
-
✅ Good:
|
|
120
|
-
```markdown
|
|
121
|
-
Implement feature X following TDD:
|
|
122
|
-
1. Write failing tests
|
|
123
|
-
2. Implement feature
|
|
124
|
-
3. Run tests
|
|
125
|
-
4. If any fail, debug and fix
|
|
126
|
-
5. Refactor if needed
|
|
127
|
-
6. Repeat until all green
|
|
128
|
-
7. Output: <promise>COMPLETE</promise>
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
Tag lessons inline with `<learning>…</learning>` — the driver archives them to `learnings.md` automatically, so subsequent iterations inherit the hard-won knowledge without repeating mistakes.
|
|
132
|
-
|
|
133
|
-
### 4. Escape Hatches
|
|
134
|
-
|
|
135
|
-
Always use `--max-iterations` as a safety net to prevent infinite loops on impossible tasks:
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
# Recommended: Always set a reasonable iteration limit
|
|
139
|
-
/ralph-loop "Try to implement feature X" --max-iterations 20
|
|
140
|
-
|
|
141
|
-
# In your prompt, include what to do if stuck:
|
|
142
|
-
# "After 15 iterations, if not complete:
|
|
143
|
-
# - Document what's blocking progress
|
|
144
|
-
# - List what was attempted
|
|
145
|
-
# - Suggest alternative approaches"
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
Claude can also signal early exit using two distinct tags:
|
|
149
|
-
- `<PROMISE>NEED_REPLAN</PROMISE>` — current approach is unworkable; loop returns to PLAN with the same goal
|
|
150
|
-
- `<PROMISE>NEED_GOAL_REVISION</PROMISE>` — the goal itself is unreachable; loop stops cleanly for human review. Use this when no approach can work, not just the current one.
|
|
151
|
-
|
|
152
|
-
**Note**: The `--completion-promise` uses exact string matching and is natively active (no external stop-hook required). It signals Claude's intent to complete; use `--verify` checks for objective verification of that intent.
|
|
153
|
-
|
|
154
|
-
## Philosophy
|
|
155
|
-
|
|
156
|
-
Ralph embodies several key principles:
|
|
157
|
-
|
|
158
|
-
### 1. Iteration > Perfection
|
|
159
|
-
Don't aim for perfect on first try. Let the loop refine the work.
|
|
160
|
-
|
|
161
|
-
### 2. Failures Are Data
|
|
162
|
-
"Deterministically bad" means failures are predictable and informative. Use them to tune prompts.
|
|
163
|
-
|
|
164
|
-
### 3. Operator Skill Matters
|
|
165
|
-
Success depends on writing good prompts, not just having a good model.
|
|
166
|
-
|
|
167
|
-
### 4. Persistence Wins
|
|
168
|
-
Keep trying until success. The loop handles retry logic automatically.
|
|
169
|
-
|
|
170
|
-
## When to Use Ralph
|
|
171
|
-
|
|
172
|
-
**Good for:**
|
|
173
|
-
- Well-defined tasks with clear success criteria
|
|
174
|
-
- Tasks requiring iteration and refinement (e.g., getting tests to pass)
|
|
175
|
-
- Greenfield projects where you can walk away
|
|
176
|
-
- Tasks with automatic verification (tests, linters)
|
|
177
|
-
|
|
178
|
-
**Not good for:**
|
|
179
|
-
- Tasks requiring human judgment or design decisions
|
|
180
|
-
- One-shot operations
|
|
181
|
-
- Tasks with unclear success criteria
|
|
182
|
-
- Production debugging (use targeted debugging instead)
|
|
183
|
-
|
|
184
|
-
## Real-World Results
|
|
185
|
-
|
|
186
|
-
- Successfully generated 6 repositories overnight in Y Combinator hackathon testing
|
|
187
|
-
- One $50k contract completed for $297 in API costs
|
|
188
|
-
- Created entire programming language ("cursed") over 3 months using this approach
|
|
189
|
-
|
|
190
|
-
## Learn More
|
|
191
|
-
|
|
192
|
-
- Original technique: https://ghuntley.com/ralph/
|
|
193
|
-
- Ralph Orchestrator: https://github.com/mikeyobrien/ralph-orchestrator
|
|
194
|
-
|
|
195
|
-
## For Help
|
|
196
|
-
|
|
197
|
-
Run `/help` in Claude Code for detailed command reference and examples.
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Cancel active Ralph Wiggum loop"
|
|
3
|
-
allowed-tools: ["Bash(test -f .minimal-agent/ralph-loop.local.md:*)", "Bash(rm .minimal-agent/ralph-loop.local.md)", "Read(.minimal-agent/ralph-loop.local.md)"]
|
|
4
|
-
hide-from-slash-command-tool: "true"
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Cancel Ralph
|
|
8
|
-
|
|
9
|
-
To cancel the Ralph loop:
|
|
10
|
-
|
|
11
|
-
1. Check if `.minimal-agent/ralph-loop.local.md` exists using Bash: `test -f .minimal-agent/ralph-loop.local.md && echo "EXISTS" || echo "NOT_FOUND"`
|
|
12
|
-
|
|
13
|
-
2. **If NOT_FOUND**: Say "No active Ralph loop found."
|
|
14
|
-
|
|
15
|
-
3. **If EXISTS**:
|
|
16
|
-
- Read `.minimal-agent/ralph-loop.local.md` to get the current iteration number from the `iteration:` field
|
|
17
|
-
- Remove the file using Bash: `rm .minimal-agent/ralph-loop.local.md`
|
|
18
|
-
- Report: "Cancelled Ralph loop (was at iteration N)" where N is the iteration value
|