dsh-compound-engineering 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +160 -2
- package/README.zh.md +161 -0
- package/cordis.patch.yml +6 -0
- package/lib/frontmatter.js +167 -0
- package/lib/index.js +46 -0
- package/lib/provider.js +201 -0
- package/package.json +62 -4
- package/skills/CODING_STANDARDS.md +68 -0
- package/skills/ce-babysit-pr/SKILL.md +59 -0
- package/skills/ce-babysit-pr/references/branch-currency.md +22 -0
- package/skills/ce-babysit-pr/references/envelope.md +44 -0
- package/skills/ce-babysit-pr/references/pipeline.md +15 -0
- package/skills/ce-babysit-pr/references/report.md +20 -0
- package/skills/ce-babysit-pr/references/settle.md +37 -0
- package/skills/ce-babysit-pr/references/setup.md +33 -0
- package/skills/ce-babysit-pr/references/stack-commands.md +39 -0
- package/skills/ce-babysit-pr/references/stack.md +43 -0
- package/skills/ce-babysit-pr/references/tick.md +102 -0
- package/skills/ce-babysit-pr/references/watch-loop.md +222 -0
- package/skills/ce-babysit-pr/scripts/pr-snapshot +3656 -0
- package/skills/ce-bakeoff/SKILL.md +48 -0
- package/skills/ce-bakeoff/references/candidates.md +37 -0
- package/skills/ce-bakeoff/references/judging.md +19 -0
- package/skills/ce-bakeoff/references/output.md +11 -0
- package/skills/ce-bakeoff/references/verification.md +15 -0
- package/skills/ce-brainstorm/SKILL.md +69 -0
- package/skills/ce-brainstorm/references/agents/slack-researcher.md +127 -0
- package/skills/ce-brainstorm/references/approaches.md +57 -0
- package/skills/ce-brainstorm/references/bakeoff.md +9 -0
- package/skills/ce-brainstorm/references/blindspot-pass.md +70 -0
- package/skills/ce-brainstorm/references/brainstorm-sections.md +458 -0
- package/skills/ce-brainstorm/references/dialogue.md +89 -0
- package/skills/ce-brainstorm/references/handoff.md +187 -0
- package/skills/ce-brainstorm/references/html-rendering.md +638 -0
- package/skills/ce-brainstorm/references/interaction-rules.md +33 -0
- package/skills/ce-brainstorm/references/markdown-rendering.md +242 -0
- package/skills/ce-brainstorm/references/model-tiers.md +13 -0
- package/skills/ce-brainstorm/references/output-mode.md +26 -0
- package/skills/ce-brainstorm/references/phase-0.md +104 -0
- package/skills/ce-brainstorm/references/plan-write.md +32 -0
- package/skills/ce-brainstorm/references/product-pressure-test.md +42 -0
- package/skills/ce-brainstorm/references/reasoning-elevation.md +124 -0
- package/skills/ce-brainstorm/references/settled-decisions.md +45 -0
- package/skills/ce-brainstorm/references/synthesis-summary.md +149 -0
- package/skills/ce-brainstorm/references/universal-brainstorming.md +72 -0
- package/skills/ce-brainstorm/references/verdict-routing.md +26 -0
- package/skills/ce-brainstorm/references/visual-probes.md +164 -0
- package/skills/ce-brainstorm/scripts/elevation-dispatch.sh +288 -0
- package/skills/ce-brainstorm/scripts/light-webserver.js +1275 -0
- package/skills/ce-brainstorm/scripts/packs-resolve.py +737 -0
- package/skills/ce-brainstorm/scripts/peer-job-runner.py +2594 -0
- package/skills/ce-code-review/SKILL.md +40 -0
- package/skills/ce-code-review/references/action-class-rubric.md +67 -0
- package/skills/ce-code-review/references/cross-model-recovery.md +38 -0
- package/skills/ce-code-review/references/cross-model-review.md +191 -0
- package/skills/ce-code-review/references/depth-paths.md +32 -0
- package/skills/ce-code-review/references/diff-scope.md +59 -0
- package/skills/ce-code-review/references/dispatch-reviewers.md +135 -0
- package/skills/ce-code-review/references/findings-schema.json +125 -0
- package/skills/ce-code-review/references/finish-input.md +118 -0
- package/skills/ce-code-review/references/finish-review.md +202 -0
- package/skills/ce-code-review/references/intent-and-plan.md +73 -0
- package/skills/ce-code-review/references/modes-and-output.md +156 -0
- package/skills/ce-code-review/references/persona-catalog.md +66 -0
- package/skills/ce-code-review/references/personas/adversarial-reviewer.md +111 -0
- package/skills/ce-code-review/references/personas/agent-native-reviewer.md +173 -0
- package/skills/ce-code-review/references/personas/api-contract-reviewer.md +44 -0
- package/skills/ce-code-review/references/personas/correctness-reviewer.md +48 -0
- package/skills/ce-code-review/references/personas/data-migration-reviewer.md +111 -0
- package/skills/ce-code-review/references/personas/deployment-verification-agent.md +157 -0
- package/skills/ce-code-review/references/personas/julik-frontend-races-reviewer.md +45 -0
- package/skills/ce-code-review/references/personas/learnings-researcher.md +260 -0
- package/skills/ce-code-review/references/personas/maintainability-reviewer.md +85 -0
- package/skills/ce-code-review/references/personas/performance-reviewer.md +45 -0
- package/skills/ce-code-review/references/personas/previous-comments-reviewer.md +59 -0
- package/skills/ce-code-review/references/personas/project-standards-reviewer.md +77 -0
- package/skills/ce-code-review/references/personas/reliability-reviewer.md +49 -0
- package/skills/ce-code-review/references/personas/security-reviewer.md +50 -0
- package/skills/ce-code-review/references/personas/swift-ios-reviewer.md +99 -0
- package/skills/ce-code-review/references/personas/testing-reviewer.md +51 -0
- package/skills/ce-code-review/references/review-output-template.md +172 -0
- package/skills/ce-code-review/references/scope.md +176 -0
- package/skills/ce-code-review/references/select-and-route.md +93 -0
- package/skills/ce-code-review/references/subagent-template.md +206 -0
- package/skills/ce-code-review/references/validator-batch-template.md +67 -0
- package/skills/ce-code-review/scripts/cross-model-adversarial-review.sh +1275 -0
- package/skills/ce-code-review/scripts/findings-mechanics.py +274 -0
- package/skills/ce-code-review/scripts/packs-resolve.py +737 -0
- package/skills/ce-code-review/scripts/peer-job-runner.py +2594 -0
- package/skills/ce-code-review/scripts/review-scope.py +419 -0
- package/skills/ce-code-review/scripts/run-log.py +280 -0
- package/skills/ce-commit/SKILL.md +60 -0
- package/skills/ce-commit-push-pr/SKILL.md +69 -0
- package/skills/ce-commit-push-pr/references/apply-and-handoff.md +79 -0
- package/skills/ce-commit-push-pr/references/branch-creation.md +47 -0
- package/skills/ce-commit-push-pr/references/commit-and-push.md +26 -0
- package/skills/ce-commit-push-pr/references/compose.md +29 -0
- package/skills/ce-commit-push-pr/references/context.md +42 -0
- package/skills/ce-commit-push-pr/references/gh-stack-cli.md +83 -0
- package/skills/ce-commit-push-pr/references/pr-description-writing.md +208 -0
- package/skills/ce-commit-push-pr/references/stack-submit.md +81 -0
- package/skills/ce-compound/SKILL.md +79 -0
- package/skills/ce-compound/assets/resolution-template.md +96 -0
- package/skills/ce-compound/references/agents/best-practices-researcher.md +115 -0
- package/skills/ce-compound/references/agents/data-integrity-guardian.md +68 -0
- package/skills/ce-compound/references/agents/framework-docs-researcher.md +93 -0
- package/skills/ce-compound/references/agents/pattern-recognition-specialist.md +55 -0
- package/skills/ce-compound/references/agents/performance-oracle.md +108 -0
- package/skills/ce-compound/references/agents/security-sentinel.md +91 -0
- package/skills/ce-compound/references/agents/session-historian.md +82 -0
- package/skills/ce-compound/references/assembly.md +127 -0
- package/skills/ce-compound/references/concepts-vocabulary.md +98 -0
- package/skills/ce-compound/references/enhancement.md +42 -0
- package/skills/ce-compound/references/grounding-validation.md +89 -0
- package/skills/ce-compound/references/lightweight.md +56 -0
- package/skills/ce-compound/references/modes.md +13 -0
- package/skills/ce-compound/references/refresh-and-discoverability.md +96 -0
- package/skills/ce-compound/references/report.md +115 -0
- package/skills/ce-compound/references/research.md +144 -0
- package/skills/ce-compound/references/schema.yaml +236 -0
- package/skills/ce-compound/references/session-history.md +73 -0
- package/skills/ce-compound/references/yaml-schema.md +130 -0
- package/skills/ce-compound/scripts/packs-resolve.py +737 -0
- package/skills/ce-compound/scripts/session-history/__pycache__/dsh_session.cpython-314.pyc +0 -0
- package/skills/ce-compound/scripts/session-history/discover-sessions.sh +290 -0
- package/skills/ce-compound/scripts/session-history/discover_dsh.py +123 -0
- package/skills/ce-compound/scripts/session-history/dsh_session.py +225 -0
- package/skills/ce-compound/scripts/session-history/extract-errors.py +178 -0
- package/skills/ce-compound/scripts/session-history/extract-metadata.py +301 -0
- package/skills/ce-compound/scripts/session-history/extract-skeleton.py +346 -0
- package/skills/ce-compound/scripts/validate-doc-claims.py +497 -0
- package/skills/ce-compound/scripts/validate-frontmatter.py +137 -0
- package/skills/ce-compound-refresh/SKILL.md +88 -0
- package/skills/ce-compound-refresh/assets/resolution-template.md +96 -0
- package/skills/ce-compound-refresh/references/classify.md +42 -0
- package/skills/ce-compound-refresh/references/commit.md +7 -0
- package/skills/ce-compound-refresh/references/concepts-vocabulary.md +116 -0
- package/skills/ce-compound-refresh/references/discoverability.md +15 -0
- package/skills/ce-compound-refresh/references/investigate.md +23 -0
- package/skills/ce-compound-refresh/references/modes.md +27 -0
- package/skills/ce-compound-refresh/references/per-action-flows.md +142 -0
- package/skills/ce-compound-refresh/references/report.md +23 -0
- package/skills/ce-compound-refresh/references/schema.yaml +236 -0
- package/skills/ce-compound-refresh/references/scope.md +18 -0
- package/skills/ce-compound-refresh/references/worth-audit.md +35 -0
- package/skills/ce-compound-refresh/references/yaml-schema.md +130 -0
- package/skills/ce-compound-refresh/scripts/validate-doc-claims.py +497 -0
- package/skills/ce-compound-refresh/scripts/validate-frontmatter.py +137 -0
- package/skills/ce-debug/SKILL.md +122 -0
- package/skills/ce-debug/references/anti-patterns.md +91 -0
- package/skills/ce-debug/references/defense-in-depth.md +39 -0
- package/skills/ce-debug/references/fix.md +21 -0
- package/skills/ce-debug/references/investigate.md +114 -0
- package/skills/ce-debug/references/investigation-techniques.md +384 -0
- package/skills/ce-debug/references/pipeline-mode.md +78 -0
- package/skills/ce-debug/references/post-fix-handoff.md +60 -0
- package/skills/ce-debug/references/return-to-caller.md +57 -0
- package/skills/ce-doc-review/SKILL.md +75 -0
- package/skills/ce-doc-review/references/bulk-preview.md +146 -0
- package/skills/ce-doc-review/references/cross-model-review.md +207 -0
- package/skills/ce-doc-review/references/decision-primer.md +47 -0
- package/skills/ce-doc-review/references/dispatch.md +56 -0
- package/skills/ce-doc-review/references/document-intake.md +44 -0
- package/skills/ce-doc-review/references/findings-schema.json +85 -0
- package/skills/ce-doc-review/references/modes.md +20 -0
- package/skills/ce-doc-review/references/open-questions-defer.md +158 -0
- package/skills/ce-doc-review/references/persona-selection.md +41 -0
- package/skills/ce-doc-review/references/personas/adversarial-document-reviewer.md +109 -0
- package/skills/ce-doc-review/references/personas/coherence-reviewer.md +69 -0
- package/skills/ce-doc-review/references/personas/design-lens-reviewer.md +48 -0
- package/skills/ce-doc-review/references/personas/feasibility-reviewer.md +50 -0
- package/skills/ce-doc-review/references/personas/product-lens-reviewer.md +85 -0
- package/skills/ce-doc-review/references/personas/scope-guardian-reviewer.md +83 -0
- package/skills/ce-doc-review/references/personas/security-lens-reviewer.md +41 -0
- package/skills/ce-doc-review/references/personas/whole-doc-reviewer.md +25 -0
- package/skills/ce-doc-review/references/rendering-floor.md +175 -0
- package/skills/ce-doc-review/references/review-output-template.md +123 -0
- package/skills/ce-doc-review/references/subagent-template.md +188 -0
- package/skills/ce-doc-review/references/synthesis-and-presentation.md +350 -0
- package/skills/ce-doc-review/references/walkthrough.md +347 -0
- package/skills/ce-doc-review/scripts/cross-model-doc-review.sh +1270 -0
- package/skills/ce-doc-review/scripts/packs-resolve.py +737 -0
- package/skills/ce-doc-review/scripts/peer-job-runner.py +2594 -0
- package/skills/ce-dogfood/SKILL.md +66 -0
- package/skills/ce-dogfood/agents/openai.yaml +2 -0
- package/skills/ce-dogfood/references/dogfood-report-template.md +97 -0
- package/skills/ce-dogfood/references/phases.md +167 -0
- package/skills/ce-dogfood/references/test-matrix-taxonomy.md +62 -0
- package/skills/ce-dogfood/scripts/packs-resolve.py +737 -0
- package/skills/ce-explain/SKILL.md +81 -0
- package/skills/ce-explain/references/agents/behavior-trace-scout.md +19 -0
- package/skills/ce-explain/references/agents/work-recap-scout.md +23 -0
- package/skills/ce-explain/references/check-in.md +18 -0
- package/skills/ce-explain/references/destinations.md +35 -0
- package/skills/ce-explain/references/explainer-html.md +29 -0
- package/skills/ce-explain/references/explainer-markdown.md +24 -0
- package/skills/ce-explain/references/intake.md +50 -0
- package/skills/ce-explain/references/orchestration.md +46 -0
- package/skills/ce-handoff/SKILL.md +54 -0
- package/skills/ce-handoff/references/create.md +88 -0
- package/skills/ce-handoff/references/resume.md +46 -0
- package/skills/ce-ideate/SKILL.md +75 -0
- package/skills/ce-ideate/references/agents/issue-intelligence-analyst.md +166 -0
- package/skills/ce-ideate/references/agents/learnings-researcher.md +247 -0
- package/skills/ce-ideate/references/agents/slack-researcher.md +127 -0
- package/skills/ce-ideate/references/agents/web-researcher.md +121 -0
- package/skills/ce-ideate/references/decomposition.md +39 -0
- package/skills/ce-ideate/references/divergent-ideation.md +112 -0
- package/skills/ce-ideate/references/grounding.md +138 -0
- package/skills/ce-ideate/references/html-rendering.md +638 -0
- package/skills/ce-ideate/references/ideation-sections.md +191 -0
- package/skills/ce-ideate/references/issue-intelligence.md +44 -0
- package/skills/ce-ideate/references/markdown-rendering.md +242 -0
- package/skills/ce-ideate/references/output-mode.md +34 -0
- package/skills/ce-ideate/references/post-ideation-workflow.md +169 -0
- package/skills/ce-ideate/references/scope-gates.md +148 -0
- package/skills/ce-ideate/references/universal-ideation.md +119 -0
- package/skills/ce-ideate/references/user-research-artifacts.md +28 -0
- package/skills/ce-ideate/references/web-research-cache.md +56 -0
- package/skills/ce-noslop/SKILL.md +45 -0
- package/skills/ce-noslop/references/patterns.md +61 -0
- package/skills/ce-noslop/references/terminology.md +3 -0
- package/skills/ce-optimize/SKILL.md +64 -0
- package/skills/ce-optimize/references/agents/learnings-researcher.md +247 -0
- package/skills/ce-optimize/references/agents/repo-research-analyst.md +258 -0
- package/skills/ce-optimize/references/example-expensive-benchmark-spec.yaml +88 -0
- package/skills/ce-optimize/references/example-hard-spec.yaml +64 -0
- package/skills/ce-optimize/references/example-judge-spec.yaml +83 -0
- package/skills/ce-optimize/references/example-text-target-spec.yaml +80 -0
- package/skills/ce-optimize/references/experiment-log-schema.yaml +563 -0
- package/skills/ce-optimize/references/experiment-prompt-template.md +143 -0
- package/skills/ce-optimize/references/judge-prompt-template.md +117 -0
- package/skills/ce-optimize/references/loop.md +286 -0
- package/skills/ce-optimize/references/measurement.md +168 -0
- package/skills/ce-optimize/references/optimize-spec-schema.yaml +570 -0
- package/skills/ce-optimize/references/persistence.md +93 -0
- package/skills/ce-optimize/references/spec.md +107 -0
- package/skills/ce-optimize/references/text-targets.md +51 -0
- package/skills/ce-optimize/references/usage-guide.md +147 -0
- package/skills/ce-optimize/references/wrap-up.md +54 -0
- package/skills/ce-optimize/scripts/decide.mjs +676 -0
- package/skills/ce-optimize/scripts/experiment-worktree.sh +330 -0
- package/skills/ce-optimize/scripts/measure.sh +140 -0
- package/skills/ce-optimize/scripts/parallel-probe.sh +134 -0
- package/skills/ce-plan/SKILL.md +60 -0
- package/skills/ce-plan/references/agents/agent-native-planning-strategist.md +66 -0
- package/skills/ce-plan/references/agents/architecture-strategist.md +46 -0
- package/skills/ce-plan/references/agents/best-practices-researcher.md +118 -0
- package/skills/ce-plan/references/agents/data-integrity-guardian.md +68 -0
- package/skills/ce-plan/references/agents/framework-docs-researcher.md +97 -0
- package/skills/ce-plan/references/agents/git-history-analyzer.md +40 -0
- package/skills/ce-plan/references/agents/learnings-researcher.md +268 -0
- package/skills/ce-plan/references/agents/pattern-recognition-specialist.md +55 -0
- package/skills/ce-plan/references/agents/performance-oracle.md +108 -0
- package/skills/ce-plan/references/agents/repo-research-analyst.md +262 -0
- package/skills/ce-plan/references/agents/security-sentinel.md +91 -0
- package/skills/ce-plan/references/agents/slack-researcher.md +131 -0
- package/skills/ce-plan/references/agents/spec-flow-analyzer.md +84 -0
- package/skills/ce-plan/references/agents/web-researcher.md +125 -0
- package/skills/ce-plan/references/approach-altitude.md +55 -0
- package/skills/ce-plan/references/bakeoff.md +9 -0
- package/skills/ce-plan/references/deepening-workflow.md +263 -0
- package/skills/ce-plan/references/final-review.md +134 -0
- package/skills/ce-plan/references/html-rendering.md +638 -0
- package/skills/ce-plan/references/intake.md +158 -0
- package/skills/ce-plan/references/markdown-rendering.md +242 -0
- package/skills/ce-plan/references/output-contracts.md +29 -0
- package/skills/ce-plan/references/output-mode.md +45 -0
- package/skills/ce-plan/references/plan-handoff.md +116 -0
- package/skills/ce-plan/references/plan-sections.md +489 -0
- package/skills/ce-plan/references/reasoning-elevation.md +124 -0
- package/skills/ce-plan/references/research.md +211 -0
- package/skills/ce-plan/references/resume.md +61 -0
- package/skills/ce-plan/references/settled-decisions.md +45 -0
- package/skills/ce-plan/references/structure.md +207 -0
- package/skills/ce-plan/references/synthesis-summary.md +260 -0
- package/skills/ce-plan/references/universal-planning.md +170 -0
- package/skills/ce-plan/scripts/elevation-dispatch.sh +288 -0
- package/skills/ce-plan/scripts/packs-resolve.py +737 -0
- package/skills/ce-plan/scripts/peer-job-runner.py +2594 -0
- package/skills/ce-polish/SKILL.md +22 -0
- package/skills/ce-polish/agents/openai.yaml +2 -0
- package/skills/ce-polish/references/dev-server-astro.md +58 -0
- package/skills/ce-polish/references/dev-server-detection.md +40 -0
- package/skills/ce-polish/references/dev-server-next.md +61 -0
- package/skills/ce-polish/references/dev-server-nuxt.md +58 -0
- package/skills/ce-polish/references/dev-server-procfile.md +59 -0
- package/skills/ce-polish/references/dev-server-rails.md +50 -0
- package/skills/ce-polish/references/dev-server-remix.md +58 -0
- package/skills/ce-polish/references/dev-server-sveltekit.md +58 -0
- package/skills/ce-polish/references/dev-server-vite.md +48 -0
- package/skills/ce-polish/references/install-riffrec.md +35 -0
- package/skills/ce-polish/references/launch-json-schema.md +177 -0
- package/skills/ce-polish/references/live-loop.md +98 -0
- package/skills/ce-polish/references/live-remote.md +35 -0
- package/skills/ce-polish/references/live-start.md +93 -0
- package/skills/ce-polish/references/live-stream-contract.md +253 -0
- package/skills/ce-polish/references/run.md +67 -0
- package/skills/ce-polish/scripts/detect-project-type.sh +277 -0
- package/skills/ce-polish/scripts/detect-riffrec.sh +225 -0
- package/skills/ce-polish/scripts/live-endpoint.js +2841 -0
- package/skills/ce-polish/scripts/read-launch-json.sh +117 -0
- package/skills/ce-polish/scripts/resolve-package-manager.sh +95 -0
- package/skills/ce-polish/scripts/resolve-port.sh +307 -0
- package/skills/ce-pov/SKILL.md +64 -0
- package/skills/ce-pov/references/agents/external-evidence-researcher.md +26 -0
- package/skills/ce-pov/references/agents/pov-peer.md +43 -0
- package/skills/ce-pov/references/agents/precedent-activity-scout.md +21 -0
- package/skills/ce-pov/references/agents/project-grounding-scout.md +32 -0
- package/skills/ce-pov/references/boundaries.md +36 -0
- package/skills/ce-pov/references/cross-model-panel.md +596 -0
- package/skills/ce-pov/references/followup.md +9 -0
- package/skills/ce-pov/references/grounding.md +47 -0
- package/skills/ce-pov/references/intake.md +61 -0
- package/skills/ce-pov/references/invocation.md +47 -0
- package/skills/ce-pov/references/method.md +68 -0
- package/skills/ce-pov/references/pov-schema.json +56 -0
- package/skills/ce-pov/references/report.md +7 -0
- package/skills/ce-pov/scripts/cross-model-pov.sh +1110 -0
- package/skills/ce-pov/scripts/peer-job-runner.py +2594 -0
- package/skills/ce-product-pulse/SKILL.md +81 -0
- package/skills/ce-product-pulse/agents/openai.yaml +2 -0
- package/skills/ce-product-pulse/references/config.md +20 -0
- package/skills/ce-product-pulse/references/interview.md +260 -0
- package/skills/ce-product-pulse/references/report-template.md +89 -0
- package/skills/ce-product-pulse/references/run.md +46 -0
- package/skills/ce-product-pulse/references/setup.md +43 -0
- package/skills/ce-promote/SKILL.md +90 -0
- package/skills/ce-promote/agents/openai.yaml +2 -0
- package/skills/ce-promote/references/spiral-cli.md +149 -0
- package/skills/ce-proof/SKILL.md +65 -0
- package/skills/ce-proof/references/api.md +176 -0
- package/skills/ce-proof/references/workflows.md +124 -0
- package/skills/ce-prototype/SKILL.md +59 -0
- package/skills/ce-prototype/assets/annotate.css +206 -0
- package/skills/ce-prototype/assets/annotate.js +837 -0
- package/skills/ce-prototype/references/annotation-loop.md +32 -0
- package/skills/ce-prototype/references/build.md +39 -0
- package/skills/ce-prototype/references/craft-floor.md +43 -0
- package/skills/ce-prototype/references/preview.md +118 -0
- package/skills/ce-prototype/references/scoping.md +38 -0
- package/skills/ce-prototype/references/write-back.md +37 -0
- package/skills/ce-prototype/scripts/light-webserver.js +1275 -0
- package/skills/ce-resolve-pr-feedback/SKILL.md +60 -0
- package/skills/ce-resolve-pr-feedback/references/agents/pr-comment-resolver.md +59 -0
- package/skills/ce-resolve-pr-feedback/references/evaluation-rubric.md +141 -0
- package/skills/ce-resolve-pr-feedback/references/full-mode.md +336 -0
- package/skills/ce-resolve-pr-feedback/references/pipeline-mode.md +23 -0
- package/skills/ce-resolve-pr-feedback/references/resume.md +60 -0
- package/skills/ce-resolve-pr-feedback/references/return-to-caller.md +111 -0
- package/skills/ce-resolve-pr-feedback/references/targeted-mode.md +48 -0
- package/skills/ce-resolve-pr-feedback/scripts/get-pr-comments +176 -0
- package/skills/ce-resolve-pr-feedback/scripts/get-thread-for-comment +84 -0
- package/skills/ce-resolve-pr-feedback/scripts/pending-feedback.py +287 -0
- package/skills/ce-resolve-pr-feedback/scripts/reply-to-pr-thread +57 -0
- package/skills/ce-resolve-pr-feedback/scripts/resolve-pr-thread +23 -0
- package/skills/ce-retune/SKILL.md +42 -0
- package/skills/ce-retune/agents/openai.yaml +2 -0
- package/skills/ce-retune/references/baseline-mining.md +122 -0
- package/skills/ce-retune/references/corpus-audit.md +128 -0
- package/skills/ce-retune/references/cut-passes.md +129 -0
- package/skills/ce-retune/references/halt-taxonomy.md +123 -0
- package/skills/ce-retune/references/noise-floor.md +131 -0
- package/skills/ce-retune/references/workflow-shapes.md +73 -0
- package/skills/ce-riffrec-feedback-analysis/SKILL.md +33 -0
- package/skills/ce-riffrec-feedback-analysis/references/analyzer.md +18 -0
- package/skills/ce-riffrec-feedback-analysis/references/compound-engineering-feedback-format.md +116 -0
- package/skills/ce-riffrec-feedback-analysis/references/extensive-analysis.md +98 -0
- package/skills/ce-riffrec-feedback-analysis/references/install-riffrec.md +27 -0
- package/skills/ce-riffrec-feedback-analysis/references/quick-bug-report.md +38 -0
- package/skills/ce-riffrec-feedback-analysis/scripts/analyze_riffrec_zip.py +1306 -0
- package/skills/ce-setup/SKILL.md +103 -0
- package/skills/ce-setup/agents/openai.yaml +2 -0
- package/skills/ce-setup/assets/compounding-directive.md +11 -0
- package/skills/ce-setup/assets/noslop-directive.md +7 -0
- package/skills/ce-setup/assets/pack-rule-template.md +11 -0
- package/skills/ce-setup/references/acpx-cache-warm.md +14 -0
- package/skills/ce-setup/references/config-template.yaml +210 -0
- package/skills/ce-setup/references/legacy-codex-tool-map.md +15 -0
- package/skills/ce-setup/references/pack-scaffold.md +45 -0
- package/skills/ce-setup/references/repo-fixes.md +121 -0
- package/skills/ce-setup/scripts/check-health +929 -0
- package/skills/ce-setup/scripts/packs-resolve.py +737 -0
- package/skills/ce-simplify-code/SKILL.md +76 -0
- package/skills/ce-simplify-code/references/personas/code-quality-reviewer.md +17 -0
- package/skills/ce-simplify-code/references/personas/code-reuse-reviewer.md +7 -0
- package/skills/ce-simplify-code/references/personas/comment-reviewer.md +24 -0
- package/skills/ce-simplify-code/references/personas/efficiency-reviewer.md +11 -0
- package/skills/ce-simplify-code/references/personas/test-value-reviewer.md +23 -0
- package/skills/ce-simplify-code/references/reviewer-dispatch.md +11 -0
- package/skills/ce-simplify-code/references/standalone-report.md +25 -0
- package/skills/ce-strategy/SKILL.md +61 -0
- package/skills/ce-strategy/references/grounding.md +22 -0
- package/skills/ce-strategy/references/interview.md +179 -0
- package/skills/ce-strategy/references/strategy-template.md +94 -0
- package/skills/ce-strategy/references/update-run.md +33 -0
- package/skills/ce-sweep/SKILL.md +93 -0
- package/skills/ce-sweep/agents/openai.yaml +2 -0
- package/skills/ce-sweep/references/agents/media-analyzer.md +54 -0
- package/skills/ce-sweep/references/interview.md +208 -0
- package/skills/ce-sweep/references/model-tiers.md +13 -0
- package/skills/ce-sweep/references/plan-template.md +62 -0
- package/skills/ce-sweep/references/run.md +126 -0
- package/skills/ce-sweep/references/sources/email.md +57 -0
- package/skills/ce-sweep/references/sources/github-issues.md +59 -0
- package/skills/ce-sweep/references/sources/slack.md +61 -0
- package/skills/ce-sweep/references/state-schema.md +157 -0
- package/skills/ce-sweep/references/subagent-template.md +60 -0
- package/skills/ce-sweep/scripts/analyze_riffrec_zip.py +1306 -0
- package/skills/ce-sweep/scripts/sweep-state.py +793 -0
- package/skills/ce-test-browser/SKILL.md +50 -0
- package/skills/ce-test-browser/references/agent-browser-driver.md +47 -0
- package/skills/ce-test-browser/references/pipeline-orchestration.md +45 -0
- package/skills/ce-test-browser/references/route-and-report.md +129 -0
- package/skills/ce-test-browser/scripts/resolve-port.sh +41 -0
- package/skills/ce-test-xcode/SKILL.md +26 -0
- package/skills/ce-test-xcode/agents/openai.yaml +2 -0
- package/skills/ce-test-xcode/references/setup-and-build.md +32 -0
- package/skills/ce-test-xcode/references/test-and-report.md +64 -0
- package/skills/ce-work/SKILL.md +62 -0
- package/skills/ce-work/references/agents/figma-design-sync.md +27 -0
- package/skills/ce-work/references/agents/implementation-worker.md +17 -0
- package/skills/ce-work/references/cross-model-execution.md +191 -0
- package/skills/ce-work/references/execution-engines.md +64 -0
- package/skills/ce-work/references/execution-strategy.md +73 -0
- package/skills/ce-work/references/implementation-loop.md +107 -0
- package/skills/ce-work/references/implementation-result-schema.json +52 -0
- package/skills/ce-work/references/input-triage.md +50 -0
- package/skills/ce-work/references/non-code-execution.md +23 -0
- package/skills/ce-work/references/return-to-caller.md +33 -0
- package/skills/ce-work/references/review-findings-followup.md +82 -0
- package/skills/ce-work/references/shipping-workflow.md +89 -0
- package/skills/ce-work/references/tracker-defer.md +150 -0
- package/skills/ce-work/references/work-intake.md +51 -0
- package/skills/ce-work/references/workspace-setup.md +27 -0
- package/skills/ce-work/scripts/__pycache__/unit_workspace_jobs.cpython-314.pyc +0 -0
- package/skills/ce-work/scripts/__pycache__/unit_workspace_state.cpython-314.pyc +0 -0
- package/skills/ce-work/scripts/cross-model-work.sh +1385 -0
- package/skills/ce-work/scripts/peer-job-runner.py +2594 -0
- package/skills/ce-work/scripts/unit-workspace.py +215 -0
- package/skills/ce-work/scripts/unit_workspace_ignored.py +93 -0
- package/skills/ce-work/scripts/unit_workspace_integration.py +677 -0
- package/skills/ce-work/scripts/unit_workspace_jobs.py +1216 -0
- package/skills/ce-work/scripts/unit_workspace_lifecycle.py +981 -0
- package/skills/ce-work/scripts/unit_workspace_state.py +1379 -0
- package/skills/ce-work/scripts/unit_workspace_transaction.py +612 -0
- package/skills/ce-worktree/SKILL.md +54 -0
- package/skills/lfg/SKILL.md +59 -0
- package/skills/lfg/references/debug-return.md +25 -0
- package/skills/lfg/references/intake.md +30 -0
- package/skills/lfg/references/next-work-handoff.md +96 -0
- package/skills/lfg/references/plan-brief.md +36 -0
- package/skills/lfg/references/review-followup.md +78 -0
- package/skills/lfg/references/shipping.md +65 -0
- package/skills/lfg/references/stage-routing.md +49 -0
- package/skills/lfg/references/task-visibility.md +11 -0
- package/skills/lfg/references/tracker-defer.md +150 -0
- package/skills/lfg/references/work-return.md +27 -0
- package/skills/wtf/SKILL.md +33 -0
- package/skills/wtf/agents/openai.yaml +2 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Experiment Worker Prompt Template
|
|
2
|
+
|
|
3
|
+
This template is used by the orchestrator to dispatch each experiment to a subagent or Codex. Variable substitution slots are filled at spawn time.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Template
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
You are an optimization experiment worker.
|
|
11
|
+
|
|
12
|
+
Your job is to implement a single hypothesis to improve a measurable outcome. You will modify code within a defined scope, then stop. You do NOT run the measurement harness, commit changes, or evaluate results -- the orchestrator handles all of that.
|
|
13
|
+
|
|
14
|
+
<experiment-context>
|
|
15
|
+
Experiment: #{iteration} for optimization target: {spec_name}
|
|
16
|
+
Hypothesis: {hypothesis_description}
|
|
17
|
+
Category: {hypothesis_category}
|
|
18
|
+
|
|
19
|
+
Current best metrics:
|
|
20
|
+
{current_best_metrics}
|
|
21
|
+
|
|
22
|
+
Baseline metrics (before any optimization):
|
|
23
|
+
{baseline_metrics}
|
|
24
|
+
</experiment-context>
|
|
25
|
+
|
|
26
|
+
<scope-rules>
|
|
27
|
+
You MAY modify files in these paths:
|
|
28
|
+
{scope_mutable}
|
|
29
|
+
|
|
30
|
+
You MUST NOT modify files in these paths:
|
|
31
|
+
{scope_immutable}
|
|
32
|
+
|
|
33
|
+
CRITICAL: Do not modify any file outside the mutable scope. The measurement harness and evaluation data are immutable, which means the metric cannot be changed, not that it cannot be gamed: a gain from anything other than doing the work the metric stands for, or one that breaks a constraint below, is reverted by the orchestrator however well it scores.
|
|
34
|
+
</scope-rules>
|
|
35
|
+
|
|
36
|
+
<constraints>
|
|
37
|
+
{constraints}
|
|
38
|
+
</constraints>
|
|
39
|
+
|
|
40
|
+
<approved-dependencies>
|
|
41
|
+
You may add or use these dependencies without further approval:
|
|
42
|
+
{approved_dependencies}
|
|
43
|
+
|
|
44
|
+
If your implementation requires a dependency NOT in this list, STOP and note it in your output. Do not install unapproved dependencies.
|
|
45
|
+
</approved-dependencies>
|
|
46
|
+
|
|
47
|
+
<source-digest>
|
|
48
|
+
What you need to know about the material this target works on and the current approach:
|
|
49
|
+
|
|
50
|
+
{source_digest}
|
|
51
|
+
</source-digest>
|
|
52
|
+
|
|
53
|
+
<failure-evidence>
|
|
54
|
+
Worst cases from the current best that bear on this hypothesis, with what went wrong. Use them to check your change against real failures. The hypothesis still decides what you implement, and it may replace the approach rather than fix these cases:
|
|
55
|
+
|
|
56
|
+
{failure_cases}
|
|
57
|
+
</failure-evidence>
|
|
58
|
+
|
|
59
|
+
<previous-experiments>
|
|
60
|
+
Recent experiments and their outcomes (for context -- avoid re-trying approaches that already failed):
|
|
61
|
+
|
|
62
|
+
{recent_experiment_summaries}
|
|
63
|
+
</previous-experiments>
|
|
64
|
+
|
|
65
|
+
<instructions>
|
|
66
|
+
1. Read the mutable files your change touches. Rely on the source digest for the rest of the material, and open other files only when the hypothesis depends on a detail the digest lacks
|
|
67
|
+
2. Implement the hypothesis described above
|
|
68
|
+
3. Make your changes focused and minimal -- change only what is needed for this hypothesis
|
|
69
|
+
4. Do NOT run the measurement harness (the orchestrator handles this)
|
|
70
|
+
5. Do NOT commit (the orchestrator will commit the winning diff before merge if this experiment succeeds)
|
|
71
|
+
6. Do NOT modify files outside the mutable scope
|
|
72
|
+
7. When done, run `git diff --stat` so the orchestrator can see your changes
|
|
73
|
+
8. If you discover you need an unapproved dependency, note it and stop
|
|
74
|
+
|
|
75
|
+
Focus on implementing the hypothesis well. The orchestrator will measure and evaluate the results.
|
|
76
|
+
</instructions>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Delta for `execution.backend: remote`: measure and report
|
|
80
|
+
|
|
81
|
+
A remote worker has its own checkout on its own machine, so the orchestrator cannot measure its tree. Append this block to the template above (inside the same prompt) and replace the template's instruction 4 ("Do NOT run the measurement harness") with it. Nothing else in the template changes: scope, constraints, and dependency rules are identical.
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
<remote-worker>
|
|
85
|
+
You are running detached, on your own checkout. The orchestrator will not see your tree; it sees only the branch you push and the result you report.
|
|
86
|
+
|
|
87
|
+
Base: commit {base_sha} on branch {optimization_branch}. Before changing anything, verify your HEAD is exactly {base_sha}. If it is not, check it out; if you cannot, stop and report that.
|
|
88
|
+
|
|
89
|
+
After implementing the hypothesis, measure PAIRED on this machine, using the immutable harness as-is:
|
|
90
|
+
1. Baseline: check out {base_sha} (stash or branch your change), run `{measurement_command}` {sample_count} time(s), record every sample.
|
|
91
|
+
2. Candidate: restore your change, run the same command the same number of times, record every sample.
|
|
92
|
+
Alternate baseline and candidate runs when {sample_count} > 1. Never edit the measurement command, its working directory, or any file in the immutable scope; a changed harness makes your result unusable.
|
|
93
|
+
|
|
94
|
+
Commit your mutable-scope changes, and nothing else, with the message `optimize({spec_name}): exp-{iteration} <hypothesis, short>`. That commit is the candidate; its SHA is `head_sha`.
|
|
95
|
+
|
|
96
|
+
Then write `result.yaml` at the repo root of your checkout with exactly this shape:
|
|
97
|
+
experiment: {iteration}
|
|
98
|
+
base_sha: {base_sha}
|
|
99
|
+
head_sha: <the candidate commit's SHA>
|
|
100
|
+
machine: <a stable identifier for this machine or worker>
|
|
101
|
+
measured_at: <ISO 8601>
|
|
102
|
+
baseline: { gates: {...}, metrics: { <name>: { aggregate: <n>, samples: [...] } }, diagnostics: {...} }
|
|
103
|
+
candidate: { gates: {...}, metrics: { <name>: { aggregate: <n>, samples: [...] } }, diagnostics: {...} }
|
|
104
|
+
correctness: <checks you ran and their results, or "none">
|
|
105
|
+
Include the harness's per-case `cases` object and any cost, tokens, or latency fields in each snapshot only when the harness emits them; do not compute them yourself.
|
|
106
|
+
Commit `result.yaml` alone on top of the candidate commit, so the pushed tip's parent is `head_sha`, and push to `{result_ref}`. Do not push to {optimization_branch} or any other branch.
|
|
107
|
+
|
|
108
|
+
Your final message is the structured result: the pushed ref, head_sha, machine, and the two aggregates. Report an unapproved dependency, a base mismatch, or a harness you could not run as a blocker instead of a result.
|
|
109
|
+
</remote-worker>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The worker's numbers are its own claim. The orchestrator runs `decide.mjs` on the paired snapshots and, before any keep, obtains a confirmation measurement the worker did not produce (`references/loop.md` 3.4).
|
|
113
|
+
|
|
114
|
+
## Variable Reference
|
|
115
|
+
|
|
116
|
+
| Variable | Source | Description |
|
|
117
|
+
|----------|--------|-------------|
|
|
118
|
+
| `{iteration}` | Experiment counter | Sequential experiment number |
|
|
119
|
+
| `{spec_name}` | Spec file `name` field | Optimization target identifier |
|
|
120
|
+
| `{hypothesis_description}` | Hypothesis backlog | What this experiment should try |
|
|
121
|
+
| `{hypothesis_category}` | Hypothesis backlog | Category (signal-extraction, algorithm, etc.) |
|
|
122
|
+
| `{current_best_metrics}` | Experiment log `best` section | Current best metric values (compact YAML or key: value pairs) |
|
|
123
|
+
| `{baseline_metrics}` | Experiment log `baseline` section | Original baseline before any optimization |
|
|
124
|
+
| `{scope_mutable}` | Spec `scope.mutable` | List of files/dirs the worker may modify |
|
|
125
|
+
| `{scope_immutable}` | Spec `scope.immutable` | List of files/dirs the worker must not touch |
|
|
126
|
+
| `{constraints}` | Spec `constraints` | Free-text constraints to follow |
|
|
127
|
+
| `{approved_dependencies}` | Spec `dependencies.approved` | Dependencies approved for use |
|
|
128
|
+
| `{source_digest}` | `source-digest.md` in the run's scratch directory | What workers need to know about the target's material and current approach |
|
|
129
|
+
| `{failure_cases}` | `worst_cases` on the current best (kept experiment entry, or baseline) | The cases relevant to this hypothesis, with reasons; "none recorded" when absent |
|
|
130
|
+
| `{recent_experiment_summaries}` | Rolling window (last 10) from experiment log | Compact summaries: hypothesis, outcome, learnings |
|
|
131
|
+
| `{base_sha}` (remote only) | `git rev-parse optimize/<spec-name>` at dispatch | The commit the worker must start from and measure as baseline |
|
|
132
|
+
| `{optimization_branch}` (remote only) | `optimize/<spec-name>` | Named so the worker knows what not to push to |
|
|
133
|
+
| `{result_ref}` (remote only) | `optimize-exp/<spec-name>/exp-<NNN>` | The branch the worker pushes; the orchestrator fetches it to collect |
|
|
134
|
+
| `{measurement_command}` (remote only) | Spec `measurement.command` (+ `working_directory`) | Run verbatim; the harness is immutable |
|
|
135
|
+
| `{sample_count}` (remote only) | `1` for the exploratory pair in `ladder` mode; `repeat_count` for `repeat`; `1` for `stable` | Paired samples per side; `decide.mjs` may ask for more via a follow-up dispatch |
|
|
136
|
+
|
|
137
|
+
## Notes
|
|
138
|
+
|
|
139
|
+
- This template works for subagent, Codex, and remote dispatch. No platform-specific assumptions. Only `remote` appends the measure-and-report delta.
|
|
140
|
+
- For Codex dispatch: write the filled template to a temp file and pipe via stdin (`cat /tmp/optimize-exp-XXXXX.txt | codex exec --skip-git-repo-check - 2>&1`).
|
|
141
|
+
- For subagent dispatch: pass the filled template as the subagent prompt.
|
|
142
|
+
- Keep `{recent_experiment_summaries}` concise -- 2-3 lines per experiment, last 10 only. Do not include the full experiment log.
|
|
143
|
+
- The worker should NOT read the full experiment log or strategy digest. It receives only what the orchestrator provides.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Judge Evaluation Prompt Template
|
|
2
|
+
|
|
3
|
+
This template is used by the orchestrator to dispatch batched LLM-as-judge evaluation calls. Each judge sub-agent evaluates a batch of sampled output items and returns structured JSON scores.
|
|
4
|
+
|
|
5
|
+
The orchestrator:
|
|
6
|
+
1. Reads the experiment's output
|
|
7
|
+
2. Selects samples per the stratification config (using fixed seed)
|
|
8
|
+
3. Groups samples into batches of `judge.batch_size`
|
|
9
|
+
4. Dispatches `ceil(sample_size / batch_size)` parallel sub-agents using this template
|
|
10
|
+
5. Aggregates returned JSON scores
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Item Evaluation Template
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
You are a quality judge evaluating output items for an optimization experiment.
|
|
18
|
+
|
|
19
|
+
Your job is to score each item using the rubric below and return structured JSON. Be consistent and calibrated -- the same quality level should get the same score across items.
|
|
20
|
+
|
|
21
|
+
<rubric>
|
|
22
|
+
{rubric}
|
|
23
|
+
</rubric>
|
|
24
|
+
|
|
25
|
+
<items>
|
|
26
|
+
{items_json}
|
|
27
|
+
</items>
|
|
28
|
+
|
|
29
|
+
<output-contract>
|
|
30
|
+
Return ONLY a valid JSON array. No prose, no markdown, no explanation outside the JSON.
|
|
31
|
+
|
|
32
|
+
Each element must have:
|
|
33
|
+
- "item_id": the identifier of the item being evaluated (string or number, matching the input)
|
|
34
|
+
- All fields requested by the rubric (scores, counts, etc.)
|
|
35
|
+
- "reason": one short sentence naming what most held this item's score down, or what earned it the score when nothing did
|
|
36
|
+
- "feedback": one or two sentences naming what is wrong with this item and what change would fix it. For an item at the top of the scale, name what keeps it there. This text drives the next round of hypotheses, so name the defect, not the score.
|
|
37
|
+
- "ambiguous": true if you cannot confidently score this item (e.g., insufficient context, borderline case). When ambiguous, still provide your best-guess score but flag it.
|
|
38
|
+
|
|
39
|
+
Example output format (adapt field names to match the rubric):
|
|
40
|
+
[
|
|
41
|
+
{"item_id": "cluster-42", "score": 4, "distinct_topics": 1, "outlier_count": 0, "reason": "One coherent topic; the title undersells it.", "ambiguous": false, "feedback": "The topic is coherent but the title is vague; name the shared login issue in the title."},
|
|
42
|
+
{"item_id": "cluster-17", "score": 2, "distinct_topics": 3, "outlier_count": 2, "reason": "Three unrelated topics merged because all mention 'timeout'.", "ambiguous": false, "feedback": "Three unrelated topics grouped on the shared word 'timeout'; splitting on the affected component would fix it."},
|
|
43
|
+
{"item_id": "cluster-99", "score": 3, "distinct_topics": 2, "outlier_count": 1, "reason": "Two related topics; unclear whether the rubric wants them split.", "ambiguous": true, "feedback": "Two sub-topics (import and export failures) that could reasonably be one or two clusters."}
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
Rules:
|
|
47
|
+
- Evaluate each item independently
|
|
48
|
+
- Score the same content the same way every time: the same item must receive the same score and the same fields on a repeat call
|
|
49
|
+
- Score based on the rubric, not on how other items in this batch scored
|
|
50
|
+
- If an item is empty or has only 1 element when it should have more, score it based on what is present
|
|
51
|
+
- For very large items (many elements), focus on a representative subset and note if quality varies across the item
|
|
52
|
+
- Every item in the batch MUST appear in your output
|
|
53
|
+
</output-contract>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Singleton Evaluation Template
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
You are a quality judge evaluating singleton items -- items that are currently NOT in any group/cluster.
|
|
60
|
+
|
|
61
|
+
Your job is to determine whether each singleton should have been grouped with an existing cluster, or whether it is genuinely unique. Return structured JSON.
|
|
62
|
+
|
|
63
|
+
<rubric>
|
|
64
|
+
{singleton_rubric}
|
|
65
|
+
</rubric>
|
|
66
|
+
|
|
67
|
+
<singletons>
|
|
68
|
+
{singletons_json}
|
|
69
|
+
</singletons>
|
|
70
|
+
|
|
71
|
+
<existing-clusters>
|
|
72
|
+
A summary of existing clusters for reference (titles/themes only, not full contents):
|
|
73
|
+
{cluster_summaries}
|
|
74
|
+
</existing-clusters>
|
|
75
|
+
|
|
76
|
+
<output-contract>
|
|
77
|
+
Return ONLY a valid JSON array. No prose, no markdown, no explanation outside the JSON.
|
|
78
|
+
|
|
79
|
+
Each element must have:
|
|
80
|
+
- "item_id": the identifier of the singleton
|
|
81
|
+
- All fields requested by the singleton rubric (should_cluster, best_cluster_id, confidence, etc.)
|
|
82
|
+
|
|
83
|
+
Example output format (adapt field names to match the rubric):
|
|
84
|
+
[
|
|
85
|
+
{"item_id": "issue-1234", "should_cluster": true, "best_cluster_id": "cluster-42", "confidence": 4},
|
|
86
|
+
{"item_id": "issue-5678", "should_cluster": false, "best_cluster_id": null, "confidence": 5}
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
Rules:
|
|
90
|
+
- A singleton that genuinely has no match in existing clusters should get should_cluster: false
|
|
91
|
+
- A singleton that clearly belongs in an existing cluster should get should_cluster: true with the cluster ID
|
|
92
|
+
- High confidence (4-5) means you are very sure. Low confidence (1-2) means the item is borderline.
|
|
93
|
+
- Every singleton in the batch MUST appear in your output
|
|
94
|
+
</output-contract>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Variable Reference
|
|
98
|
+
|
|
99
|
+
| Variable | Source | Description |
|
|
100
|
+
|----------|--------|-------------|
|
|
101
|
+
| `{rubric}` | Spec `metric.judge.rubric` | User-defined scoring rubric |
|
|
102
|
+
| `{items_json}` | Sampled output items | JSON array of items to evaluate (one batch worth) |
|
|
103
|
+
| `{singleton_rubric}` | Spec `metric.judge.singleton_rubric` | User-defined rubric for singleton evaluation |
|
|
104
|
+
| `{singletons_json}` | Sampled singleton items | JSON array of singleton items to evaluate |
|
|
105
|
+
| `{cluster_summaries}` | Experiment output | Summary of existing clusters (titles/themes) for singleton reference |
|
|
106
|
+
|
|
107
|
+
## Notes
|
|
108
|
+
|
|
109
|
+
- Written for the `cheap` judge tier by default (`metric.judge.model`) -- prompts are concise and well-structured for smaller models; the harness resolves the tier to a concrete model
|
|
110
|
+
- Where the dispatch surface exposes sampling controls, use the most deterministic setting available; the same item must score the same on a repeat call, which is what makes the run's judge cache and the calibration check valid
|
|
111
|
+
- The rubric is part of the immutable measurement harness -- the experiment agent cannot modify it
|
|
112
|
+
- The `reason` field does not change the score. The orchestrator keeps the reasons for the worst-scoring items so later hypotheses and workers can see why items failed, not just how much
|
|
113
|
+
- The `feedback` field is required on every item. The orchestrator persists it under `judge.items[]`, groups it into the digest's failure themes, and generates hypotheses from those themes; a batch without feedback gives the loop nothing to act on
|
|
114
|
+
- The `ambiguous` flag on items helps the orchestrator identify noisy evaluations without forcing bad scores
|
|
115
|
+
- For singleton evaluation, the orchestrator provides cluster summaries (not full contents) to keep judge context lean
|
|
116
|
+
- Each sub-agent evaluates one batch independently -- sub-agents do not see each other's results
|
|
117
|
+
- **That independence is required, not merely preferred.** These scores decide accept or revert, so a judge must be a separate context from the one that authored the hypothesis and ran the experiment. Where no dispatch is available, block the judge pass rather than scoring inline. An orchestrator grading its own experiment is not a measurement.
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# Phases 2-3: hypotheses and the optimization loop
|
|
2
|
+
|
|
3
|
+
Read this before generating hypotheses and follow it for the whole loop. The SKILL.md body states the dependency pre-approval gate (the check that stops the run until the user has approved new dependencies) and the stopping criteria. This file carries hypothesis generation, batch selection, experiment dispatch, result collection and persistence, batch evaluation, the state update, the tick boundary, and the cross-cutting concerns. `<state-root>` is the run's ledger directory resolved in Phase 0 (`references/persistence.md`).
|
|
4
|
+
|
|
5
|
+
## Phase 2: Hypothesis Generation
|
|
6
|
+
|
|
7
|
+
### 2.1 Analyze Current Approach
|
|
8
|
+
|
|
9
|
+
Read the code within `scope.mutable` to understand:
|
|
10
|
+
- The current implementation approach
|
|
11
|
+
- Obvious improvement opportunities
|
|
12
|
+
- Constraints and dependencies between components
|
|
13
|
+
|
|
14
|
+
When the baseline recorded `worst_cases`, read them. They show where the current approach fails and are one source of hypotheses, beside the code, attribution, and prior learnings. They do not limit the search: a hypothesis may replace the approach instead of fixing those cases.
|
|
15
|
+
|
|
16
|
+
Write `source-digest.md` in the run's scratch directory once, now. It holds what an experiment worker needs to know about the material the target works on (evaluation data, corpora, large inputs, and how the harness uses them) and about the current approach, short enough to include in every worker prompt. Each worker starts with an empty context, so without the digest every experiment pays to read that material again. Rewrite the digest only when a keep changes something it describes.
|
|
17
|
+
|
|
18
|
+
The next action is the cheapest executable step that would change what gets implemented. A locating measurement is one that finds where the cost actually sits (a profile, per-stage timing, a query count) rather than testing a change. It belongs in this phase when it is cheaper than an implementation experiment, would change whether a hypothesis is worth keeping or skipping, and can be taken. For a named workload's cost, the locating measurement is attribution: shares by stage, query, or call. Take it before an implementation experiment when the Phase 1 baseline total cannot say which hypothesis is worth keeping and those same conditions hold. The baseline total stays the scoring reference; the shares only decide what to try. A scored variant space does not require a performance profile: rubric evidence decides what to try, and numerical benefit may stay unknown.
|
|
19
|
+
|
|
20
|
+
Do not treat the implementation backlog as empty, and do not proceed to wrap-up, while a cheaper locating measurement can still be taken and would change whether a hypothesis is kept or skipped. If such a measurement would change that decision but cannot be obtained, wrap up and say what blocked it. Do not implement without that measurement.
|
|
21
|
+
|
|
22
|
+
Optionally read `references/agents/repo-research-analyst.md` and dispatch a generic subagent seeded with that local prompt for deeper codebase analysis if the scope is large or unfamiliar. Do not dispatch a standalone agent by type/name. Pass the active project and optimization context, request only question-specific scopes such as `patterns`, and go directly to current owning code. If the optimization cannot be scoped, allow one targeted root or workspace probe.
|
|
23
|
+
|
|
24
|
+
A generic subagent is one whose whole brief is the prompt you send it. When the host's subagent tool makes you name an agent, use only a name you have seen the host list, and list its agents before the first dispatch if you have not. Pick the plain one that adds no role of its own, which still counts as a generic subagent. Never pick a specialist, such as a reviewer or worker agent, whose own role prompt, output format, or tool limits would replace or narrow your prompt.
|
|
25
|
+
|
|
26
|
+
### 2.2 Generate Hypothesis List
|
|
27
|
+
|
|
28
|
+
Generate an initial set of hypotheses. Each hypothesis should have:
|
|
29
|
+
- **Description**: what to try
|
|
30
|
+
- **Category**: one of the standard categories (signal-extraction, graph-signals, embedding, algorithm, preprocessing, parameter-tuning, architecture, data-handling) or a domain-specific category
|
|
31
|
+
- **Priority**: high, medium, or low as a summary label
|
|
32
|
+
- **Required dependencies**: any new packages or tools needed
|
|
33
|
+
- **Opportunity**: the log schema's `opportunity` record (estimate or explicit unknown)
|
|
34
|
+
|
|
35
|
+
Include user-provided hypotheses if any were given as input.
|
|
36
|
+
|
|
37
|
+
Record an `opportunity` on every hypothesis using the log schema before implementation. Connect whatever observed cost or rubric evidence exists to the expected change in the target metric, with units, a comparison baseline, and the assumptions behind the estimate. Prefer a supported range or upper bound over a point estimate. If the benefit or the cost share cannot be estimated, record it as unknown and name the cheapest measurement that would resolve the uncertainty. A subjective priority score is not a measured benefit. The `priority` field does not rank the backlog.
|
|
38
|
+
|
|
39
|
+
An unknown opportunity may sit on the backlog. It is not a runnable implementation experiment while a cheaper locating measurement would change whether it is kept or skipped.
|
|
40
|
+
|
|
41
|
+
The backlog contains the credible opportunities supported by current evidence, not a required number of ideas. Rank by expected target benefit, confidence, implementation and measurement cost, and behavioral risk. Persist and verify the ranked opportunities and estimates at CP-2. Follow the SKILL.md body's reporting rule when you tell the user the findings that explain the chosen direction. The full backlog remains available on disk.
|
|
42
|
+
|
|
43
|
+
### 2.3 Dependency Pre-Approval
|
|
44
|
+
|
|
45
|
+
The SKILL.md body states this gate. A dependency the user does not approve stays in the backlog, is skipped in batch selection, and comes back at wrap-up. Record its outcome on each hypothesis as `dep_status: approved` or `needs_approval`, which is what batch selection reads.
|
|
46
|
+
|
|
47
|
+
### 2.4 Record Hypothesis Backlog (CP-2)
|
|
48
|
+
|
|
49
|
+
**MANDATORY CHECKPOINT.** Write the initial backlog to the experiment log file and verify. CP-2 is incomplete until each hypothesis in that write carries its opportunity record.
|
|
50
|
+
```yaml
|
|
51
|
+
hypothesis_backlog:
|
|
52
|
+
- description: "Remove template boilerplate before embedding"
|
|
53
|
+
category: "signal-extraction"
|
|
54
|
+
priority: high
|
|
55
|
+
dep_status: approved
|
|
56
|
+
required_deps: []
|
|
57
|
+
opportunity:
|
|
58
|
+
workload: "notification-clustering fixture"
|
|
59
|
+
baseline: "CP-1 baseline"
|
|
60
|
+
evidence: "judge rubric: boilerplate dilutes embeddings; no profile"
|
|
61
|
+
expected_benefit: "unknown; cheapest resolve: one judged stripped-vs-current sample"
|
|
62
|
+
confidence: "low: unmeasured"
|
|
63
|
+
cost_and_risk: "small edit; judge sample; no new deps"
|
|
64
|
+
- description: "Try HDBSCAN clustering algorithm"
|
|
65
|
+
category: "algorithm"
|
|
66
|
+
priority: medium
|
|
67
|
+
dep_status: needs_approval
|
|
68
|
+
required_deps: ["scikit-learn"]
|
|
69
|
+
opportunity:
|
|
70
|
+
workload: "notification-clustering fixture"
|
|
71
|
+
baseline: "CP-1 baseline"
|
|
72
|
+
evidence: "algorithm family untried on this fixture"
|
|
73
|
+
expected_benefit: "unknown; cheapest resolve: one exploratory run after dep approval"
|
|
74
|
+
confidence: "low: unmeasured"
|
|
75
|
+
cost_and_risk: "new dependency scikit-learn; judge sample"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Phase 3: Optimization Loop
|
|
81
|
+
|
|
82
|
+
This phase runs in ticks until a stopping criterion is met. One tick is one batch: select (3.1), dispatch (3.2), collect and persist each result as it lands (3.3), evaluate (3.4), update state (3.5), check the stopping criteria (3.6). The tick boundary is the only place a turn may end with work outstanding; what that requires is stated there. A tick reaches the tick boundary after 3.6, or earlier at any step that cannot go further until results arrive for receipts recorded in `run_state.pending_waits` and has nothing else it can do first. An early crossing leaves the rest of the tick undone. It writes `run_state` with the in-tick time not yet counted added to `active_seconds`, and it leaves `tick` unchanged. When the awaited results land, the resumed turn continues the same batch at the step that was waiting. It does not select a new batch at 3.1. In a session with no wake capability, ticks follow one another in this session exactly as batches did before, and nothing in this file asks you to do anything else.
|
|
83
|
+
|
|
84
|
+
### 3.1 Batch Selection
|
|
85
|
+
|
|
86
|
+
Select hypotheses for this batch:
|
|
87
|
+
- Build a runnable backlog by excluding hypotheses with `dep_status: needs_approval`
|
|
88
|
+
- A hypothesis is not runnable while a cheaper locating measurement would still change whether it is kept or skipped
|
|
89
|
+
- If `execution.mode` is `serial`, or the current decision needs to attribute a cost change to one lever, force `batch_size = 1`
|
|
90
|
+
- Otherwise, `batch_size = min(runnable_backlog_size, execution.max_concurrent)`, further capped by `execution.max_experiments_per_tick` when the spec sets it
|
|
91
|
+
- Shrink the batch until its estimated worker and judge cost fits every configured spend cap (3.6). If not even one experiment fits, stop with that criterion
|
|
92
|
+
- Select by the ranked expected benefit, confidence, cost, and risk above; the priority label does not decide order. Category diversity breaks remaining ties.
|
|
93
|
+
|
|
94
|
+
When a cheaper locating measurement can be taken and would still change whether a hypothesis is kept or skipped, take that measurement and update the backlog before selecting a batch. Do not treat that state as an empty backlog.
|
|
95
|
+
|
|
96
|
+
When no executable next action remains, proceed to Phase 4 (wrap-up). An action is executable only if it can be taken now. A locating measurement that would change a keep-or-skip decision but cannot be obtained is a blocker, not a reason to keep the loop open. Wrap up and say what blocked it. Deferred dependencies are presented at wrap-up instead of the loop spinning forever.
|
|
97
|
+
|
|
98
|
+
### 3.2 Dispatch Experiments
|
|
99
|
+
|
|
100
|
+
The experiment's forecast is the backlog `opportunity` as of dispatch. Do not reconstruct it from later results. Copy that backlog value into the experiment entry at its first CP-3 write, including when that write recovers a `result.yaml` marker that has no forecast. Revised estimates for later experiments must not overwrite an earlier experiment's forecast. Missing forecasts in resumed legacy runs stay unrecorded.
|
|
101
|
+
|
|
102
|
+
For each hypothesis in the batch, dispatch according to `execution.mode`. In `serial` mode, run exactly one experiment to completion before selecting the next hypothesis. In `parallel` mode, dispatch the batch concurrently.
|
|
103
|
+
|
|
104
|
+
**Bounded dispatch.** Do not assume the host will accept all concurrent subagents at once; the active-subagent cap varies by host and profile and is independent of `execution.max_concurrent` (which caps worktrees, a separate budget). Queue the selected experiments, dispatch only as many as the host accepts, and when a capacity or active-agent-limit error appears, treat it as backpressure: retry the queued experiment after a slot frees rather than marking it failed. Mark an experiment failed only when dispatch fails for a non-capacity reason that survives correcting the invocation, or a successfully dispatched experiment errors/times out.
|
|
105
|
+
|
|
106
|
+
The Phase 3 blocks below each set `SKILL_DIR` inline as well (the loaded `ce-optimize` skill directory; see the Bundled scripts note in Phase 1). Shell state does not persist from Phase 1, so each block carries its own assignment.
|
|
107
|
+
|
|
108
|
+
**One dispatch recipe, per experiment.** The backend changes where the experiment runs and how its result comes back, not what the worker is told.
|
|
109
|
+
|
|
110
|
+
1. **Isolate.** For `worktree` and `codex`, create the experiment worktree on the optimization branch:
|
|
111
|
+
```bash
|
|
112
|
+
SKILL_DIR="<absolute path of the directory containing this SKILL.md>";
|
|
113
|
+
WORKTREE_PATH=$(bash "$SKILL_DIR/scripts/experiment-worktree.sh" create "<spec_name>" <exp_index> "optimize/<spec_name>" <shared_files...>) # creates optimize-exp/<spec_name>/exp-<NNN>
|
|
114
|
+
```
|
|
115
|
+
Apply port parameterization if configured (set env vars for the measurement script). For `remote`, isolation is the worker's own checkout: record `base_sha` (`git rev-parse optimize/<spec_name>`) and make sure that commit is pushed to the remote the worker will fetch from.
|
|
116
|
+
2. **Brief.** Fill the experiment prompt template (`references/experiment-prompt-template.md`): iteration number and spec name; hypothesis description and category; current best and baseline metrics; mutable and immutable scope; constraints and approved dependencies; the rolling window of the last 10 experiments as concise summaries; the source digest; and the current best's relevant `worst_cases`, from its kept entry or the baseline before any keep. For `remote`, append the template's measure-and-report delta with `base_sha`, the result ref `optimize-exp/<spec_name>/exp-<NNN>`, the measurement command, and the paired sample count the current ladder step needs.
|
|
117
|
+
3. **Dispatch** by `execution.backend`, then record the return shape.
|
|
118
|
+
|
|
119
|
+
| Backend | Dispatch | What returns |
|
|
120
|
+
|---|---|---|
|
|
121
|
+
| `worktree` | A subagent with the filled prompt, working in the experiment worktree | The subagent's completion, with its edits in the worktree |
|
|
122
|
+
| `codex` | Write the filled prompt to a temp file and run `cat /tmp/optimize-exp-XXXXX.txt \| codex exec --skip-git-repo-check - 2>&1`, with the security posture from `execution.codex_security` (ask once per session when unset) | The process exit, with its edits in the worktree |
|
|
123
|
+
| `remote` | The detached-worker dispatch the body's Execution Surface names, with the filled prompt; when no such capability is in the tool list, use the `worktree` row for the whole run and log the fallback | A receipt naming the launch. The result is the pushed result ref (`result.yaml` at its root) or, when the host delivers results as a store file or terminal message, that file or message |
|
|
124
|
+
|
|
125
|
+
**Codex delegation condition.** Delegate to `codex exec` only when this session is not itself running inside a Codex sandbox and `.git` is writable; otherwise use the `worktree` row for that experiment and log the fallback. A set sandbox marker in your environment is proof you are inside one; an unset marker proves nothing on its own, which is why the writable-`.git` check stays in the test:
|
|
126
|
+
```bash
|
|
127
|
+
# any true branch means: do not delegate this experiment to codex
|
|
128
|
+
test -n "${CODEX_SANDBOX:-}" || test -n "${CODEX_SESSION_ID:-}" || test ! -w .git
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Return shape.** A dispatch returns either a **result** (the work is done and its edits are where the table says) or a **receipt** (a handle for work that will finish after this call returns). A result goes straight to 3.3. A receipt is a pending wait: record it in `run_state.pending_waits` as `references/persistence.md` specifies, including the observable that will carry the result and the action to take (collect it through 3.3), and verify the write before dispatching the next experiment. Collect a receipt's result when that observable arrives, never by polling in a foreground loop.
|
|
132
|
+
|
|
133
|
+
### 3.3 Collect and Persist Results
|
|
134
|
+
|
|
135
|
+
Persist a `comparisons` record for each distinct reference, candidate, and workload pairing used in a decision. Each side's identity must uniquely identify the bytes that were measured; a shared HEAD is not enough when the candidate is uncommitted. Record the workload, both snapshots, and the decision's uncertainty and correctness evidence. Standalone and integrated pairings stay distinct in this array; a later in-place update must not replace a previously persisted distinct pairing. A runner-up's contribution is its confirmed change against the branch it was added to, not its standalone gain. These records explain results. `decide.mjs` still makes the accept or revert decision, using the existing snapshot fields.
|
|
136
|
+
|
|
137
|
+
Process experiments as they complete: do NOT wait for the entire batch to finish before writing results. An experiment dispatched as a receipt completes when its recorded observable arrives; collect it through the same steps, then clear its `pending_waits` entry in the CP-3 write.
|
|
138
|
+
|
|
139
|
+
**Collecting a `remote` result.** Fetch the result ref and read `result.yaml` from it. Accept it only when `base_sha` equals the `base_sha` you dispatched, the result ref's tip adds only `result.yaml` and its parent is `head_sha`, the commit range `base_sha..head_sha` touches only `scope.mutable`, and both `baseline` and `candidate` snapshots are present with the required objectives. A result failing any of these is `error` with the reason, logged and closed like a failed measurement; never repair a worker's numbers. An accepted result replaces steps 1 and 2 below: the worker's paired snapshots are the measurement and its `result.yaml` is the marker (copy it into `<state-root>/exp-<NNN>-result.yaml` so recovery does not depend on the remote ref). Continue from step 3 with the worker's `baseline` as the reference snapshot for `decide.mjs`, and record `machine` and `measured_by: worker` on the `comparisons` entry. A worker's `result.yaml` carries only the selection pairing, so a configured holdout answers a would-be keep with `next_measurement: holdout` exactly as for any other backend; that holdout is collected by the independent confirmation in 3.4, on the confirming machine, never by the worker that wrote the candidate. When `decide.mjs` asks for more selection samples (`add_sample`, `confirm`), re-dispatch the same worker (or a new one from the same `head_sha`) for that count; the entry stays one experiment.
|
|
140
|
+
|
|
141
|
+
For each completed experiment, **immediately**:
|
|
142
|
+
|
|
143
|
+
1. **Run measurement** in the experiment's worktree. Spend only the measurement the current decision needs (see Phase 1). When `stability.mode` is `ladder` and a smoke command is set, run that smoke check first. A smoke failure is terminally `degenerate`, and success proceeds to the first exploratory sample of `measurement.command` before comparison. Otherwise start with one exploratory sample. Pass `CE_OPTIMIZE_CENSOR_AFTER` to `measure.sh` only when elapsed wall time itself proves the candidate cannot become eligible, meaning every required objective is already hopeless, not merely the primary. Otherwise let measurement finish so other required objectives can still win, and let `decide.mjs` assess futility after the payload is complete.
|
|
144
|
+
```bash
|
|
145
|
+
SKILL_DIR="<absolute path of the directory containing this SKILL.md>";
|
|
146
|
+
bash "$SKILL_DIR/scripts/measure.sh" "<measurement.command>" <timeout_seconds> "<worktree_path>/<measurement.working_directory or .>" <env_vars...>
|
|
147
|
+
```
|
|
148
|
+
When mode is `repeat`, keep running `repeat_count` times and aggregating as in Phase 1. When mode is `stable`, run once.
|
|
149
|
+
|
|
150
|
+
2. **Write crash-recovery marker.** Immediately after measurement, write `result.yaml` in the experiment worktree containing the raw metrics. This keeps the measurement recoverable even if the agent crashes before updating the main log.
|
|
151
|
+
|
|
152
|
+
3. **Read raw JSON output** from the measurement script. When it reports per-case results, keep the worst few, with what went wrong, as `worst_cases` for step 7.
|
|
153
|
+
|
|
154
|
+
4. **Evaluate degenerate gates** (the cheap hard checks in `metric.degenerate_gates` that reject obviously broken output):
|
|
155
|
+
- For each gate in `metric.degenerate_gates`, parse the operator and threshold
|
|
156
|
+
- Compare the metric value against the threshold
|
|
157
|
+
- If ANY gate fails, mark the outcome `degenerate` and skip judge evaluation. This saves money.
|
|
158
|
+
|
|
159
|
+
5. **If the degenerate gates pass AND primary type is `judge`**:
|
|
160
|
+
- **Check judge independence before dispatching.** A judge must not have authored the hypothesis or run the experiment it is scoring, and must not see other judges' results. That independence is what makes these scores usable for the accept or revert decision. If the host exposes no way to dispatch judges as separate agents, do **not** score inline. Mark the experiment's outcome `error` with the reason (judges undispatchable), skip judge evaluation exactly as a failed degenerate gate does, and continue to the log-and-append step so the entry is still written to disk. An experiment stopped here never carries judge metrics, so it is not eligible to become `best` and does not enter the accept/revert comparison. It is unmeasured, not poor-scoring. Report the blocker and its effect on the run to the user.
|
|
161
|
+
- Read the experiment's output (cluster assignments, search results, etc.)
|
|
162
|
+
- Apply stratified sampling per `metric.judge.stratification` config (using `sample_seed`)
|
|
163
|
+
- Group samples into batches of `metric.judge.batch_size`
|
|
164
|
+
- **Judge cache.** Before filling a batch, hash each sampled item's bytes and look the hash up in `judge-cache.yaml` beside the experiment log. An item already scored in this run under this rubric reuses its cached result (scores, `reason`, `feedback`, `ambiguous`); only uncached items are dispatched, and their results are written to the cache as they land. Identical output is scored once per run.
|
|
165
|
+
- Fill the judge prompt template (`references/judge-prompt-template.md`) for each batch
|
|
166
|
+
- Dispatch the `ceil(sample_size / batch_size)` judge sub-agents using the same bounded dispatch as Phase 3.2: queue them, dispatch to whatever concurrency the host accepts, and treat a capacity error as backpressure (retry the queued batch after a slot frees) rather than a scoring failure. These judge sub-agents are a separate budget from the experiment worktrees.
|
|
167
|
+
- Each sub-agent returns structured JSON scores with a `feedback` string per item. A batch that comes back without `feedback` is re-dispatched once; persist what the second call returns. Store every item under the entry's `judge.items[]` with its `content_hash`; the digest reads that feedback in step 3.5.
|
|
168
|
+
- Aggregate scores: compute the configured primary judge field from `metric.judge.scoring.primary` (which should match `metric.primary.name`) plus any `scoring.secondary` values
|
|
169
|
+
- Keep the items that scored worst by `metric.primary.direction`, about five, with their `reason` as `worst_cases` for step 7
|
|
170
|
+
- If `singleton_sample > 0`: also dispatch singleton evaluation sub-agents
|
|
171
|
+
|
|
172
|
+
6. **Compare with `decide.mjs`.** Invoke it only after the degenerate gates pass and the payload holds every required objective value, meaning the hard metrics from measurement and the judge scores when those were collected. The payload is the spec as loaded plus the baseline and candidate snapshots. The script reads the nested spec (`metric`, `measurement.stability`) and decides eligibility, noise, and the ladder next step. Do not reconstruct a flattened payload, and do not re-derive the threshold in prose.
|
|
173
|
+
```bash
|
|
174
|
+
SKILL_DIR="<absolute path of the directory containing this SKILL.md>";
|
|
175
|
+
NODE="$(for c in node nodejs; do command -v "$c" >/dev/null 2>&1 && "$c" -e '' >/dev/null 2>&1 && { echo "$c"; break; }; done)";
|
|
176
|
+
[ -n "$NODE" ] || { echo "no working Node runtime on PATH (tried node, nodejs)" >&2; exit 1; };
|
|
177
|
+
"$NODE" "$SKILL_DIR/scripts/decide.mjs" "<payload.json>"
|
|
178
|
+
```
|
|
179
|
+
If that probe finds no runtime, do not invoke an empty command. Mark the experiment `error` with that reason and continue the batch. Use `decision` and `next_measurement`. Collect the requested measurement and repeat this sequence whenever `next_measurement` is not `none`. Do not keep a candidate until `next_measurement` is `none`. Record `inconclusive` and `censored` as those outcomes, not as `reverted`. Each extra sample belongs to this same experiment: write it onto the existing entry at CP-3, then decide again.
|
|
180
|
+
|
|
181
|
+
**Held-out confirmation.** When the spec configures a holdout, `decide.mjs` answers a would-be keep with `next_measurement: holdout` until the payload carries a `holdout` snapshot pair. Collect it then and not before: the holdout depends on the selection decision, so it is never dispatched alongside the selection measurement, however independent the two calls look. Scoring it early spends on candidates that would have been rejected anyway and puts held-out feedback in front of you before the next hypothesis. Run `measurement.holdout.command` (or, for a judge primary, the judge sample under `metric.judge.confirmation_seed`, drawn only from items of each output that the selection sample did not draw) on the reference and on the candidate, persist the pairing as `kind: holdout` in `comparisons`, and decide again. The holdout result decides keep or not; it does not enter the digest, the rolling window summaries, or hypothesis generation. A holdout that does not confirm the gain withholds the keep; record the outcome the script returned.
|
|
182
|
+
|
|
183
|
+
**Per-experiment diagnostics.** When the harness or the judge dispatch reports cost, tokens, or latency, record them under the entry's `cost`. When `measurement.per_case` is true, record the script's `regressions` on the entry. Neither changes the decision.
|
|
184
|
+
|
|
185
|
+
7. **IMMEDIATELY persist this experiment on disk (CP-3).** Do not defer this to batch evaluation. The durable unit is one log entry per experiment at `<state-root>/experiment-log.yaml`. After the first measurement, append that entry, including any `worst_cases`. After every later ladder sample for the same experiment, write the accumulated metrics and current outcome onto that same entry. Do not append a second entry for the same hypothesis, and do not rewrite a different experiment's samples. Write a decide terminal only when `next_measurement` is `none`. Until then the entry stays nonterminal, `promising` while the keep path still needs samples and `measured` otherwise (including an inconclusive result that still wants samples). When `next_measurement` is `none`, an eligible result stays `measured` until its diff is on the optimization branch; a non-eligible result gets the decide terminal (`reverted`, `inconclusive`, `censored`, `degenerate`). `kept` and `runner_up_kept` wait until that integration. The raw metrics are on disk and safe from context compaction.
|
|
186
|
+
|
|
187
|
+
8. **VERIFY the write (CP-3 verification).** Read the experiment log back from disk and confirm the entry just written is present. If verification fails, retry the write. Do NOT proceed to the next experiment until this entry is confirmed on disk.
|
|
188
|
+
|
|
189
|
+
**Why immediately + verify?** The agent's context window is NOT a durable store. Context compaction, session crashes, and restarts are expected during long runs, so results that exist only in the agent's memory are lost. The verification step catches silent write failures that would otherwise lose data.
|
|
190
|
+
|
|
191
|
+
### 3.4 Evaluate Batch
|
|
192
|
+
|
|
193
|
+
Every retained change must have earned its gain by doing the work the metric stands for. Before retaining any integration, including a runner-up, read the combined diff against the spec's `description` and `constraints`; a gain beyond the hypothesis's recorded opportunity upper bound calls for a slower read. A gain that comes from what the harness does not observe, or from breaking a `constraints` entry the harness does not check, is not a keep even though the gates, the ladder, and the holdout passed: revert it, record in the entry's `learnings` which observation or constraint the harness lacks, and carry that gap into the report. Closing the gap is a harness or spec change for a new run, not something this run patches.
|
|
194
|
+
|
|
195
|
+
After all experiments in the batch have been measured:
|
|
196
|
+
|
|
197
|
+
1. **Decide eligibility from `decide.mjs`, not from the primary metric alone.** An experiment is eligible when it improves at least one required objective beyond the configured comparison threshold and does not violate any other required objective. When `metric.objectives` is absent, the primary is the only required objective. `inconclusive` is not a keep.
|
|
198
|
+
|
|
199
|
+
2. **Rank** the eligible experiments in the batch by the script's `rank_score` (primary relative gain when the primary moved; otherwise the strongest required-objective relative gain). Identify that winner as the experiment to keep. An eligible experiment may be kept even if the ranking primary did not move.
|
|
200
|
+
|
|
201
|
+
3. **Confirm a `remote` winner independently before the keep test.** A `remote` winner enters this step when the decision on the worker's pair is eligible and asks for nothing more than the holdout: `keep` with `next_measurement: none`, or `promising` with `next_measurement: holdout`. For that winner, one independent measurement owns both the confirmation and the holdout: obtain a pairing the candidate's author did not produce by fetching `head_sha`, inspecting the diff against `base_sha`, and measuring it paired on this checkout or through a fresh confirmation worker that did not implement it, at the full configured protocol. When the worker's decision asked for `holdout`, that same measurement also runs the holdout on the reference and the candidate. Persist each pairing in `comparisons` (`kind: standalone` for the confirmation pair, `kind: holdout` for the holdout pair), every one with the `machine` and `measured_by` that produced it. Run `decide.mjs` on the payload built from those independent snapshots, never from the worker's. When that decision is not `keep` with `next_measurement: none`, the experiment takes that decide terminal and the worker's own claim is recorded as unconfirmed. The same independence that makes judge scores usable makes a self-measured keep usable.
|
|
202
|
+
|
|
203
|
+
4. **If the winner's deciding result is `keep` with `next_measurement: none`: KEEP**
|
|
204
|
+
- For a `remote` winner, the deciding result is the independent decision from step 3. For any other winner, it is the last `decide.mjs` result from 3.3.
|
|
205
|
+
- A `keep` has already passed held-out confirmation when the spec configures one; an entry whose last decision is `promising` with `next_measurement: holdout` is not a keep until the holdout pair is collected and the script decides again
|
|
206
|
+
- Commit the experiment branch first so the winning diff exists as a real commit before any merge or cherry-pick (a `remote` winner is already a commit at `head_sha`; merge `head_sha`, not the result ref's tip, which only adds `result.yaml`)
|
|
207
|
+
- Include only mutable-scope changes in that commit; if no eligible diff remains, treat the experiment as non-improving and revert it
|
|
208
|
+
- Merge the committed experiment branch into the optimization branch
|
|
209
|
+
- Use the message `optimize(<spec-name>): <hypothesis description>` for the experiment commit
|
|
210
|
+
- After the merge succeeds, clean up the winner's experiment worktree and branch; the integrated commit on the optimization branch is the durable artifact
|
|
211
|
+
- This is now the new baseline for subsequent batches
|
|
212
|
+
|
|
213
|
+
5. **Check file-disjoint runners-up** (up to `max_runner_up_merges_per_batch`):
|
|
214
|
+
- For each runner-up that also improved, check file-level disjointness with the kept experiment
|
|
215
|
+
- **File-level disjointness**: two experiments are disjoint if they modified completely different files. Same file = overlapping, even if different lines.
|
|
216
|
+
- If disjoint, cherry-pick the runner-up onto the new baseline and run the same decide loop as step 3.3 against a fresh sample set for that combined snapshot. Do not reuse the standalone experiment's accumulated samples; they were measured against the previous baseline. Collect further measurement whenever `next_measurement` is not `none`. Persist the combined pairing as `kind: integrated` on that same log entry without replacing the standalone comparison. Keep the original standalone log entry for audit.
|
|
217
|
+
- Keep the cherry-pick only when that result is eligible and `next_measurement` is `none` (outcome: `runner_up_kept`); then clean up that runner-up's experiment worktree and branch
|
|
218
|
+
- Otherwise revert the cherry-pick, log it as "promising alone but neutral/harmful in combination" (outcome: `runner_up_reverted`), then clean up the runner-up's experiment worktree and branch
|
|
219
|
+
- Stop after first failed combination
|
|
220
|
+
|
|
221
|
+
6. **Handle deferred dependencies.** Experiments that need unapproved dependencies get outcome `deferred_needs_approval`
|
|
222
|
+
|
|
223
|
+
7. **Close the rest.** Cleanup worktrees; a `remote` result ref may be deleted once its entry is verified in the log and its `result.yaml` copy is in `<state-root>`. `kept` and `runner_up_kept` are only for diffs on the optimization branch. Eligible candidates that were not integrated become `not_selected`. Leave `inconclusive`, `censored`, and `degenerate` as `decide.mjs` returned them.
|
|
224
|
+
|
|
225
|
+
### 3.5 Update State (CP-4)
|
|
226
|
+
|
|
227
|
+
**MANDATORY CHECKPOINT.** By this point, individual experiment results are already on disk (written in step 3.3). This step updates aggregate state and verifies.
|
|
228
|
+
|
|
229
|
+
1. **Re-read the experiment log from disk.** Do not trust in-memory state. The log is the source of truth.
|
|
230
|
+
|
|
231
|
+
2. **Finalize outcomes.** Update experiment entries from the step 3.4 evaluation (mark `kept`, `reverted`, `runner_up_kept`, etc.). Write these outcome updates to disk immediately.
|
|
232
|
+
|
|
233
|
+
3. **Update the `best` section** in the experiment log if a new best was found. Update the running spend totals there too: judge spend, and the estimated spend of the whole run, which counts experiment workers, judges, and research subagents. Use the usage the host reports where it reports any, estimate the rest from the work dispatched, and record which parts are estimates. Write to disk.
|
|
234
|
+
|
|
235
|
+
4. **Write strategy digest** to `<state-root>/strategy-digest.md`:
|
|
236
|
+
- Categories tried so far (with success/failure counts)
|
|
237
|
+
- Key learnings from this batch and overall
|
|
238
|
+
- Failure patterns that recur across `worst_cases`, and which ones the current best still shows
|
|
239
|
+
- Remaining opportunities, their supporting evidence, and whether current measurements still support their estimates; mark stale estimates for reassessment before selecting them
|
|
240
|
+
- Current best metrics and improvement from baseline
|
|
241
|
+
- **Failure themes:** the recurring `feedback` strings from the current best's `judge.items[]` (or its failing `cases` when `measurement.per_case` is set), grouped by what is wrong, each with a count and one representative item. Selection-sample items only; holdout items never enter the digest
|
|
242
|
+
|
|
243
|
+
5. **Generate new hypotheses** based on learnings:
|
|
244
|
+
- Re-read the strategy digest from disk (not from memory)
|
|
245
|
+
- Read the rolling window (last 10 experiments from the log on disk)
|
|
246
|
+
- Do NOT read the full experiment log -- use the digest for broad context
|
|
247
|
+
- Start from the failure themes: a theme with a count worth acting on becomes at most one hypothesis that addresses the theme, with the representative item as its evidence. A rule per failing item is not a hypothesis; it is the pattern that overfits the selection sample
|
|
248
|
+
- After a keep on a cost target, re-measure how the cost divides among the parts before adding implementation hypotheses only when the keep leaves the current shares unable to say whether the next hypothesis is worth keeping
|
|
249
|
+
- Add new hypotheses to the backlog and write the updated backlog to disk
|
|
250
|
+
|
|
251
|
+
6. **Write the updated hypothesis backlog to disk.** The backlog section of the experiment log must reflect newly added hypotheses and removed (tested) ones.
|
|
252
|
+
|
|
253
|
+
7. **Write `run_state`.** Add the in-tick time not yet counted to `active_seconds`, increment `tick`, set `status`, and preserve all outstanding waits in `pending_waits`, including the deadline timer (`references/persistence.md`).
|
|
254
|
+
|
|
255
|
+
**CP-4 Verification:** Read the experiment log back from disk. Confirm: (a) all experiment outcomes from this batch are finalized, (b) the `best` section reflects the current best, (c) the hypothesis backlog is updated, (d) `run_state` reflects this tick. Read `strategy-digest.md` back and confirm it exists. Only THEN proceed to the stopping criteria check.
|
|
256
|
+
|
|
257
|
+
**Checkpoint: at this point, all state for this tick is on disk. If the agent crashes and restarts, it can resume from the experiment log without loss.**
|
|
258
|
+
|
|
259
|
+
### 3.6 Check Stopping Criteria
|
|
260
|
+
|
|
261
|
+
Stop the loop as soon as any one of these holds. Two clocks are involved: `run_state.active_seconds` counts time spent inside ticks since Phase 3 started, summed across ticks and excluding time spent waiting; `run_state.phase3_started_at` anchors calendar time. In a single uninterrupted session the two clocks read the same.
|
|
262
|
+
|
|
263
|
+
- **Target reached**: `stopping.target_reached` is true and the current best meets every declared required target (`decide.mjs` `target_reached` on the current-best snapshot). When `metric.objectives` is absent, that is the single `metric.primary.target` if set. Do not stop for a primary-only hit while another required target is still unmet.
|
|
264
|
+
- **Max iterations**: total experiments run >= `stopping.max_iterations`
|
|
265
|
+
- **Max active hours**: `run_state.active_seconds` (not time since the invocation, not time spent waiting) >= `stopping.max_hours`
|
|
266
|
+
- **Wall-clock backstop**: calendar time since `run_state.phase3_started_at` >= `stopping.max_wall_hours`. No wake extends it. A wake that fires after it has passed collects any arrived results, then goes to Phase 4.
|
|
267
|
+
- **Spend cap reached**: the spend already recorded plus the estimated cost of the next dispatch would pass a configured cap: `metric.judge.max_total_cost_usd` for judge spend, `stopping.max_total_cost_usd` for whole-run spend. A cap limits spend; it does not trigger after spend passes it. Check it before every dispatch that costs money, including Phase 2 research and each batch with its judge passes, not only at this step
|
|
268
|
+
- **Plateau**: no improvement for `stopping.plateau_iterations` **consecutive** experiments
|
|
269
|
+
- **Manual stop**: the user interrupts. Save state, then go to Phase 4.
|
|
270
|
+
- **No runnable hypothesis left**: no executable next action remains
|
|
271
|
+
|
|
272
|
+
If none is met, cross the tick boundary.
|
|
273
|
+
|
|
274
|
+
**Tick boundary.** Check the wall deadline before crossing, including an early crossing while results are missing. At or after the deadline, persist already-arrived results and go to Phase 4 without waiting or integrating candidates. Otherwise, with experiment receipts pending, apply `references/persistence.md` (The Wait Record and Ticks) to continue an attached wait, park with bounded automatic resumption, or hand back a manual-resume checkpoint. Resume the same batch at its waiting step. With no experiment receipts pending, start the next tick at 3.1; a deadline timer alone is not an experiment to wait for.
|
|
275
|
+
|
|
276
|
+
### 3.7 Cross-Cutting Concerns
|
|
277
|
+
|
|
278
|
+
**Codex failure cascade**: Track consecutive Codex delegation failures. After 3 consecutive failures, auto-disable Codex for remaining experiments and fall back to subagent dispatch. Log the switch.
|
|
279
|
+
|
|
280
|
+
**Error handling**: Classify a failed measurement from what `measure.sh` actually signaled. The censored stderr marker (with exit 125) is `censored`. Exit 124 is `timeout`. Any other non-zero exit (including 125 without that marker) is `error`. Log that outcome with the error message, revert the experiment, and continue the batch.
|
|
281
|
+
|
|
282
|
+
**Progress reporting:** follow the SKILL.md body's reporting rule. Base any reported improvement on persisted, verified measurements, distinguish preliminary from confirmed results, and state what was measured and any limits on the claim. Batch counts and cumulative scoring cost remain in the log for wrap-up. Report them to the user during the run when they affect a decision.
|
|
283
|
+
|
|
284
|
+
**Crash recovery**: See the Persistence Discipline section. Per-experiment `result.yaml` markers are written in step 3.3. Individual experiment results are appended to the log immediately in step 3.3. Tick-level state (outcomes, best, digest, `run_state`) is written in step 3.5. On resume (Phase 0.4), the log at `<state-root>` is the ground truth. Scan for any `result.yaml` markers not yet reflected in the log, then collect any pending wait whose result has arrived.
|
|
285
|
+
|
|
286
|
+
---
|