@haposoft/cafekit 0.16.0-rc.7 → 0.16.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 +116 -27
- package/bin/__tests__/codex-hooks-ownership.test.js +239 -0
- package/bin/__tests__/codex-hooks.test.js +295 -0
- package/bin/__tests__/codex-native.test.js +2289 -34
- package/bin/__tests__/develop-contract.test.js +400 -23
- package/bin/__tests__/installer-safety.test.js +3 -3
- package/bin/__tests__/optional-skill-inventory.test.js +249 -0
- package/bin/__tests__/output-styles.test.js +214 -0
- package/bin/__tests__/package-inventory.test.js +2131 -16
- package/bin/__tests__/runtime-schema.test.js +111 -0
- package/bin/__tests__/secret-output-guardrail.test.js +122 -0
- package/bin/__tests__/skill-routing-source.test.js +172 -0
- package/bin/__tests__/specs-v2-execution-closeout.test.js +1 -1
- package/bin/install.js +10 -0
- package/bin/lib/codex-install.js +170 -5
- package/bin/lib/context.js +14 -0
- package/bin/lib/i18n.js +12 -6
- package/bin/lib/skill-deps.js +5 -5
- package/bin/phases/claude-runtime.js +23 -0
- package/bin/phases/claude-settings.js +8 -0
- package/bin/phases/codex-hooks.js +156 -0
- package/bin/phases/codex-runtime.js +29 -38
- package/bin/phases/copy-payload.js +8 -2
- package/bin/phases/select-skill-bundles.js +96 -0
- package/bin/phases/skill-inventory.js +71 -0
- package/bin/phases/skills-setup.js +9 -2
- package/bin/phases/write-metadata.js +8 -5
- package/package.json +8 -2
- package/src/claude/CLAUDE.md +3 -3
- package/src/claude/agents/brainstormer.md +52 -69
- package/src/claude/agents/code-auditor.md +32 -14
- package/src/claude/agents/debugger.md +35 -20
- package/src/claude/agents/deployer.md +12 -5
- package/src/claude/agents/docs-keeper.md +11 -1
- package/src/claude/agents/implementer.md +25 -13
- package/src/claude/agents/inspector.md +6 -3
- package/src/claude/agents/project-manager.md +1 -1
- package/src/claude/agents/researcher.md +26 -55
- package/src/claude/agents/spec-maker.md +24 -13
- package/src/claude/agents/strategist.md +52 -0
- package/src/claude/agents/test-runner.md +117 -132
- package/src/claude/agents/ui-ux-designer.md +1 -1
- package/src/claude/hooks/__tests__/fixtures/statusline-default.golden +1 -0
- package/src/claude/hooks/__tests__/precompact.test.js +158 -0
- package/src/claude/hooks/__tests__/spec-gate.test.js +87 -4
- package/src/claude/hooks/__tests__/state.test.js +254 -3
- package/src/claude/hooks/__tests__/statusline.test.js +196 -0
- package/src/claude/hooks/agent.cjs +1 -1
- package/src/claude/hooks/docs-sync.cjs +12 -10
- package/src/claude/hooks/inspect-block.cjs +1 -1
- package/src/claude/hooks/lib/config.cjs +3 -0
- package/src/claude/hooks/lib/hook-state-dir.cjs +39 -0
- package/src/claude/hooks/lib/secret-keywords.cjs +42 -0
- package/src/claude/hooks/precompact.cjs +105 -0
- package/src/claude/hooks/rules.cjs +1 -1
- package/src/claude/hooks/secret-output-guardrail.cjs +43 -0
- package/src/claude/hooks/session.cjs +27 -1
- package/src/claude/hooks/spec-gate.cjs +3 -3
- package/src/claude/hooks/spec-state.cjs +32 -5
- package/src/claude/hooks/state.cjs +1 -1
- package/src/claude/hooks/task-scaffold-guard.cjs +1 -1
- package/src/claude/hooks/usage.cjs +1 -1
- package/src/claude/migration-manifest.json +29 -15
- package/src/claude/output-styles/coding-level-0-eli5.md +103 -0
- package/src/claude/output-styles/coding-level-1-junior.md +124 -0
- package/src/claude/output-styles/coding-level-2-mid.md +146 -0
- package/src/claude/output-styles/coding-level-3-senior.md +148 -0
- package/src/claude/output-styles/coding-level-4-lead.md +159 -0
- package/src/claude/output-styles/coding-level-5-god.md +91 -0
- package/src/claude/references/debugger/core-philosophy.md +5 -3
- package/src/claude/references/debugger/frontend-verification.md +2 -2
- package/src/claude/references/debugger/log-ci-analysis.md +13 -1
- package/src/claude/references/debugger/parallel-agent-hydration.md +19 -34
- package/src/claude/references/debugger/performance-diagnostics.md +2 -2
- package/src/claude/references/debugger/root-cause-tracing.md +37 -6
- package/src/claude/references/debugger/side-effect-gate.md +3 -1
- package/src/claude/references/debugger/verification-protocol.md +13 -12
- package/src/claude/rules/orchestrator.md +7 -1
- package/src/claude/rules/process-management.md +39 -0
- package/src/claude/rules/review-audit-self-decision.md +48 -0
- package/src/claude/rules/skill-domain-routing.md +26 -24
- package/src/claude/rules/skill-workflow-routing.md +22 -14
- package/src/claude/rules/workflow.md +3 -3
- package/src/claude/runtime.json +1 -0
- package/src/claude/runtime.schema.json +205 -0
- package/src/claude/scripts/generate-skill-catalog.cjs +156 -122
- package/src/claude/scripts/provenance.cjs +18 -5
- package/src/claude/scripts/spec-receipt.cjs +76 -21
- package/src/claude/scripts/spec-resolver.cjs +144 -4
- package/src/claude/scripts/workflow-policy.cjs +1 -1
- package/src/claude/settings/settings.json +16 -0
- package/src/claude/skills/agent-browser/SKILL.md +1 -1
- package/src/claude/skills/ai-multimodal/SKILL.md +1 -1
- package/src/claude/skills/brainstorm/SKILL.md +193 -172
- package/src/claude/skills/brainstorm/references/question-framework.md +105 -167
- package/src/claude/skills/chrome-devtools/SKILL.md +1 -1
- package/src/claude/skills/code-review/SKILL.md +43 -25
- package/src/claude/skills/code-review/references/spec-compliance-review.md +3 -4
- package/src/claude/skills/code-review/references/verification-gate.md +1 -1
- package/src/claude/skills/debug/SKILL.md +48 -19
- package/src/claude/skills/delegate/SKILL.md +1 -1
- package/src/claude/skills/develop/SKILL.md +92 -65
- package/src/claude/skills/develop/references/parallel-waves.md +36 -63
- package/src/claude/skills/develop/references/quality-gate.md +31 -4
- package/src/claude/skills/develop/references/subagent-patterns.md +21 -7
- package/src/claude/skills/docs/SKILL.md +42 -23
- package/src/claude/skills/docs/references/init-workflow.md +4 -4
- package/src/claude/skills/docs/references/reconstruct-workflow.md +6 -6
- package/src/claude/skills/docs/references/standard-docs-workflow.md +6 -2
- package/src/claude/skills/docs/references/summarize-workflow.md +2 -2
- package/src/claude/skills/docs/references/update-workflow.md +9 -7
- package/src/claude/skills/docs/templates/requirements-as-is.md +1 -1
- package/src/claude/skills/docx/SKILL.md +1 -1
- package/src/claude/skills/git/SKILL.md +1 -1
- package/src/claude/skills/git/references/commit-protocols.md +1 -1
- package/src/claude/skills/git/references/finish-branch.md +1 -1
- package/src/claude/skills/hotfix/SKILL.md +159 -170
- package/src/claude/skills/hotfix/references/diagnosis-protocol.md +14 -9
- package/src/claude/skills/hotfix/references/parallel-patterns.md +27 -13
- package/src/claude/skills/hotfix/references/prevention-gate.md +5 -0
- package/src/claude/skills/hotfix/references/review-cycle.md +21 -15
- package/src/claude/skills/hotfix/references/workflow-specialized.md +53 -21
- package/src/claude/skills/inspect/SKILL.md +55 -46
- package/src/claude/skills/inspect/references/internal-inspection.md +21 -5
- package/src/claude/skills/loop/SKILL.md +114 -0
- package/src/claude/skills/loop/references/bounded-loop-protocol.md +104 -0
- package/src/claude/skills/loop/references/metric-and-guard-contract.md +76 -0
- package/src/claude/skills/pdf/SKILL.md +1 -1
- package/src/claude/skills/pptx/SKILL.md +1 -1
- package/src/claude/skills/question/SKILL.md +16 -13
- package/src/claude/skills/research/SKILL.md +70 -43
- package/src/claude/skills/route/SKILL.md +94 -0
- package/src/claude/skills/route/references/agent-timing.md +46 -0
- package/src/claude/skills/route/references/chaining-patterns.md +53 -0
- package/src/claude/skills/route/references/task-taxonomy.md +48 -0
- package/src/claude/skills/specs/SKILL.md +48 -57
- package/src/claude/skills/specs/references/review.md +26 -8
- package/src/claude/skills/specs/references/templates.md +76 -31
- package/src/claude/skills/specs/templates/requirements-init.md +1 -1
- package/src/claude/skills/specs/templates/research.md +2 -2
- package/src/claude/skills/sync/SKILL.md +6 -6
- package/src/claude/skills/sync/references/sync-protocols.md +1 -1
- package/src/claude/skills/test/SKILL.md +120 -120
- package/src/claude/skills/test/references/execution-strategy.md +208 -361
- package/src/claude/skills/test/references/failure-triage.md +55 -121
- package/src/claude/skills/test/references/test-memory.md +20 -34
- package/src/claude/skills/ui-ux-pro-max/SKILL.md +1 -1
- package/src/claude/skills/web-testing/SKILL.md +1 -1
- package/src/claude/skills/xlsx/SKILL.md +1 -1
- package/src/claude/status.cjs +135 -33
- package/src/codex/AGENTS.md +14 -4
- package/src/codex/hooks/docs-sync.cjs +8 -3
- package/src/codex/hooks/lib/hook-context.cjs +18 -4
- package/src/codex/hooks/rules.cjs +29 -1
- package/src/codex/hooks/secret-output-guardrail.cjs +30 -0
- package/src/codex/hooks/spec-gate.cjs +3 -8
- package/src/codex/hooks/spec-state.cjs +34 -5
- package/src/codex/hooks.json +5 -0
- package/src/codex/runtime.json +2 -0
- package/src/common/.env.example +1 -1
- package/src/claude/skills/backend-development/SKILL.md +0 -101
- package/src/claude/skills/backend-development/references/backend-api-design.md +0 -495
- package/src/claude/skills/backend-development/references/backend-architecture.md +0 -454
- package/src/claude/skills/backend-development/references/backend-authentication.md +0 -338
- package/src/claude/skills/backend-development/references/backend-code-quality.md +0 -659
- package/src/claude/skills/backend-development/references/backend-debugging.md +0 -904
- package/src/claude/skills/backend-development/references/backend-devops.md +0 -491
- package/src/claude/skills/backend-development/references/backend-mindset.md +0 -387
- package/src/claude/skills/backend-development/references/backend-performance.md +0 -397
- package/src/claude/skills/backend-development/references/backend-security.md +0 -342
- package/src/claude/skills/backend-development/references/backend-technologies.md +0 -256
- package/src/claude/skills/backend-development/references/backend-testing.md +0 -429
- package/src/claude/skills/devops/.env.example +0 -76
- package/src/claude/skills/devops/SKILL.md +0 -102
- package/src/claude/skills/devops/references/browser-rendering.md +0 -305
- package/src/claude/skills/devops/references/cloudflare-d1-kv.md +0 -123
- package/src/claude/skills/devops/references/cloudflare-platform.md +0 -271
- package/src/claude/skills/devops/references/cloudflare-r2-storage.md +0 -280
- package/src/claude/skills/devops/references/cloudflare-workers-advanced.md +0 -312
- package/src/claude/skills/devops/references/cloudflare-workers-apis.md +0 -309
- package/src/claude/skills/devops/references/cloudflare-workers-basics.md +0 -418
- package/src/claude/skills/devops/references/docker-basics.md +0 -297
- package/src/claude/skills/devops/references/docker-compose.md +0 -292
- package/src/claude/skills/devops/references/gcloud-platform.md +0 -297
- package/src/claude/skills/devops/references/gcloud-services.md +0 -304
- package/src/claude/skills/devops/references/kubernetes-basics.md +0 -95
- package/src/claude/skills/devops/references/kubernetes-helm-advanced.md +0 -70
- package/src/claude/skills/devops/references/kubernetes-helm.md +0 -81
- package/src/claude/skills/devops/references/kubernetes-kubectl.md +0 -74
- package/src/claude/skills/devops/references/kubernetes-security-advanced.md +0 -94
- package/src/claude/skills/devops/references/kubernetes-security.md +0 -89
- package/src/claude/skills/devops/references/kubernetes-troubleshooting-advanced.md +0 -74
- package/src/claude/skills/devops/references/kubernetes-troubleshooting.md +0 -49
- package/src/claude/skills/devops/references/kubernetes-workflows-advanced.md +0 -75
- package/src/claude/skills/devops/references/kubernetes-workflows.md +0 -76
- package/src/claude/skills/devops/scripts/cloudflare_deploy.py +0 -269
- package/src/claude/skills/devops/scripts/docker_optimize.py +0 -332
- package/src/claude/skills/devops/scripts/requirements.txt +0 -20
- package/src/claude/skills/devops/scripts/tests/requirements.txt +0 -3
- package/src/claude/skills/devops/scripts/tests/test_cloudflare_deploy.py +0 -285
- package/src/claude/skills/devops/scripts/tests/test_docker_optimize.py +0 -436
- package/src/claude/skills/frontend-design/SKILL.md +0 -135
- package/src/claude/skills/frontend-design/references/ai-multimodal-overview.md +0 -165
- package/src/claude/skills/frontend-design/references/analysis-best-practices.md +0 -80
- package/src/claude/skills/frontend-design/references/analysis-prompts.md +0 -141
- package/src/claude/skills/frontend-design/references/analysis-techniques.md +0 -118
- package/src/claude/skills/frontend-design/references/animejs.md +0 -396
- package/src/claude/skills/frontend-design/references/anti-slop-rules.md +0 -103
- package/src/claude/skills/frontend-design/references/asset-generation.md +0 -337
- package/src/claude/skills/frontend-design/references/bento-motion-engine.md +0 -142
- package/src/claude/skills/frontend-design/references/design-extraction-overview.md +0 -71
- package/src/claude/skills/frontend-design/references/extraction-best-practices.md +0 -141
- package/src/claude/skills/frontend-design/references/extraction-output-templates.md +0 -162
- package/src/claude/skills/frontend-design/references/extraction-prompts.md +0 -127
- package/src/claude/skills/frontend-design/references/magicui-components.md +0 -129
- package/src/claude/skills/frontend-design/references/performance-guardrails.md +0 -169
- package/src/claude/skills/frontend-design/references/premium-design-patterns.md +0 -93
- package/src/claude/skills/frontend-design/references/redesign-audit-checklist.md +0 -114
- package/src/claude/skills/frontend-design/references/technical-accessibility.md +0 -119
- package/src/claude/skills/frontend-design/references/technical-best-practices.md +0 -97
- package/src/claude/skills/frontend-design/references/technical-optimization.md +0 -44
- package/src/claude/skills/frontend-design/references/technical-overview.md +0 -90
- package/src/claude/skills/frontend-design/references/technical-workflows.md +0 -150
- package/src/claude/skills/frontend-design/references/visual-analysis-overview.md +0 -95
- package/src/claude/skills/frontend-design/references/workflow-3d.md +0 -102
- package/src/claude/skills/frontend-design/references/workflow-describe.md +0 -87
- package/src/claude/skills/frontend-design/references/workflow-immersive.md +0 -87
- package/src/claude/skills/frontend-design/references/workflow-quick.md +0 -57
- package/src/claude/skills/frontend-design/references/workflow-screenshot.md +0 -63
- package/src/claude/skills/frontend-design/references/workflow-video.md +0 -74
- package/src/claude/skills/frontend-development/SKILL.md +0 -406
- package/src/claude/skills/frontend-development/resources/common-patterns.md +0 -331
- package/src/claude/skills/frontend-development/resources/complete-examples.md +0 -872
- package/src/claude/skills/frontend-development/resources/component-patterns.md +0 -502
- package/src/claude/skills/frontend-development/resources/data-fetching.md +0 -767
- package/src/claude/skills/frontend-development/resources/file-organization.md +0 -502
- package/src/claude/skills/frontend-development/resources/loading-and-error-states.md +0 -501
- package/src/claude/skills/frontend-development/resources/performance.md +0 -406
- package/src/claude/skills/frontend-development/resources/routing-guide.md +0 -364
- package/src/claude/skills/frontend-development/resources/styling-guide.md +0 -428
- package/src/claude/skills/frontend-development/resources/typescript-standards.md +0 -418
- package/src/claude/skills/mobile-development/SKILL.md +0 -218
- package/src/claude/skills/mobile-development/references/mobile-android.md +0 -604
- package/src/claude/skills/mobile-development/references/mobile-best-practices.md +0 -544
- package/src/claude/skills/mobile-development/references/mobile-debugging.md +0 -1089
- package/src/claude/skills/mobile-development/references/mobile-frameworks.md +0 -465
- package/src/claude/skills/mobile-development/references/mobile-ios.md +0 -496
- package/src/claude/skills/mobile-development/references/mobile-mindset.md +0 -542
- package/src/claude/skills/react-best-practices/AGENTS.md +0 -2249
- package/src/claude/skills/react-best-practices/README.md +0 -123
- package/src/claude/skills/react-best-practices/SKILL.md +0 -128
- package/src/claude/skills/react-best-practices/metadata.json +0 -15
- package/src/claude/skills/react-best-practices/rules/_sections.md +0 -46
- package/src/claude/skills/react-best-practices/rules/_template.md +0 -28
- package/src/claude/skills/react-best-practices/rules/advanced-event-handler-refs.md +0 -55
- package/src/claude/skills/react-best-practices/rules/advanced-use-latest.md +0 -49
- package/src/claude/skills/react-best-practices/rules/async-api-routes.md +0 -38
- package/src/claude/skills/react-best-practices/rules/async-defer-await.md +0 -80
- package/src/claude/skills/react-best-practices/rules/async-dependencies.md +0 -36
- package/src/claude/skills/react-best-practices/rules/async-parallel.md +0 -28
- package/src/claude/skills/react-best-practices/rules/async-suspense-boundaries.md +0 -99
- package/src/claude/skills/react-best-practices/rules/bundle-barrel-imports.md +0 -59
- package/src/claude/skills/react-best-practices/rules/bundle-conditional.md +0 -31
- package/src/claude/skills/react-best-practices/rules/bundle-defer-third-party.md +0 -49
- package/src/claude/skills/react-best-practices/rules/bundle-dynamic-imports.md +0 -35
- package/src/claude/skills/react-best-practices/rules/bundle-preload.md +0 -50
- package/src/claude/skills/react-best-practices/rules/client-event-listeners.md +0 -74
- package/src/claude/skills/react-best-practices/rules/client-swr-dedup.md +0 -56
- package/src/claude/skills/react-best-practices/rules/js-batch-dom-css.md +0 -82
- package/src/claude/skills/react-best-practices/rules/js-cache-function-results.md +0 -80
- package/src/claude/skills/react-best-practices/rules/js-cache-property-access.md +0 -28
- package/src/claude/skills/react-best-practices/rules/js-cache-storage.md +0 -70
- package/src/claude/skills/react-best-practices/rules/js-combine-iterations.md +0 -32
- package/src/claude/skills/react-best-practices/rules/js-early-exit.md +0 -50
- package/src/claude/skills/react-best-practices/rules/js-hoist-regexp.md +0 -45
- package/src/claude/skills/react-best-practices/rules/js-index-maps.md +0 -37
- package/src/claude/skills/react-best-practices/rules/js-length-check-first.md +0 -49
- package/src/claude/skills/react-best-practices/rules/js-min-max-loop.md +0 -82
- package/src/claude/skills/react-best-practices/rules/js-set-map-lookups.md +0 -24
- package/src/claude/skills/react-best-practices/rules/js-tosorted-immutable.md +0 -57
- package/src/claude/skills/react-best-practices/rules/rendering-activity.md +0 -26
- package/src/claude/skills/react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -47
- package/src/claude/skills/react-best-practices/rules/rendering-conditional-render.md +0 -40
- package/src/claude/skills/react-best-practices/rules/rendering-content-visibility.md +0 -38
- package/src/claude/skills/react-best-practices/rules/rendering-hoist-jsx.md +0 -46
- package/src/claude/skills/react-best-practices/rules/rendering-hydration-no-flicker.md +0 -82
- package/src/claude/skills/react-best-practices/rules/rendering-svg-precision.md +0 -28
- package/src/claude/skills/react-best-practices/rules/rerender-defer-reads.md +0 -39
- package/src/claude/skills/react-best-practices/rules/rerender-dependencies.md +0 -45
- package/src/claude/skills/react-best-practices/rules/rerender-derived-state.md +0 -29
- package/src/claude/skills/react-best-practices/rules/rerender-functional-setstate.md +0 -74
- package/src/claude/skills/react-best-practices/rules/rerender-lazy-state-init.md +0 -58
- package/src/claude/skills/react-best-practices/rules/rerender-memo.md +0 -44
- package/src/claude/skills/react-best-practices/rules/rerender-transitions.md +0 -40
- package/src/claude/skills/react-best-practices/rules/server-after-nonblocking.md +0 -73
- package/src/claude/skills/react-best-practices/rules/server-cache-lru.md +0 -41
- package/src/claude/skills/react-best-practices/rules/server-cache-react.md +0 -26
- package/src/claude/skills/react-best-practices/rules/server-parallel-fetching.md +0 -79
- package/src/claude/skills/react-best-practices/rules/server-serialization.md +0 -38
|
@@ -4,16 +4,16 @@ How to handle code review results after a fix is implemented. Ensures quality wi
|
|
|
4
4
|
|
|
5
5
|
## Default Review Handling
|
|
6
6
|
|
|
7
|
-
The agent reviews its own fix using `
|
|
7
|
+
The agent reviews its own fix using `cf:code-review` and applies the verdict. Every review returns exactly one verdict from the shared surface: `PASS | PASS_WITH_WARNINGS | FAIL | BLOCKED`. The definition of `PASS` defers to `cf:code-review`; Fix never redefines it with local severity thresholds.
|
|
8
8
|
|
|
9
9
|
```
|
|
10
10
|
attempt = 0
|
|
11
11
|
LOOP:
|
|
12
|
-
1. Trigger
|
|
12
|
+
1. Trigger cf:code-review → receives: verdict and severity-classified findings
|
|
13
13
|
|
|
14
14
|
2. Evaluate:
|
|
15
|
-
IF verdict == PASS
|
|
16
|
-
→ ACCEPT. Log: "✓ Review PASS
|
|
15
|
+
IF verdict == PASS:
|
|
16
|
+
→ ACCEPT. Log: "✓ Review PASS"
|
|
17
17
|
→ Proceed to Step 6 (Finalize)
|
|
18
18
|
|
|
19
19
|
ELSE IF verdict == BLOCKED:
|
|
@@ -21,29 +21,33 @@ LOOP:
|
|
|
21
21
|
→ Present the blocker and required execution proof, permission, environment,
|
|
22
22
|
or user-owned decision to the user.
|
|
23
23
|
|
|
24
|
-
ELSE IF verdict == FAIL AND attempt < 3:
|
|
25
|
-
→
|
|
24
|
+
ELSE IF (verdict == FAIL OR verdict == PASS_WITH_WARNINGS) AND attempt < 3:
|
|
25
|
+
→ REMEDIATE the reported findings (or pause for the user when the
|
|
26
|
+
Required User Pause conditions below apply)
|
|
26
27
|
→ Re-run verification (typecheck + lint + test)
|
|
27
28
|
→ attempt += 1
|
|
28
29
|
→ GOTO LOOP
|
|
29
30
|
|
|
30
|
-
ELSE IF
|
|
31
|
+
ELSE IF attempt >= 3:
|
|
31
32
|
→ HALT. Present findings to user:
|
|
32
|
-
"3 auto-fix cycles exhausted. [N]
|
|
33
|
-
Options: "
|
|
33
|
+
"3 auto-fix cycles exhausted. [N] findings remain."
|
|
34
|
+
Options: "Revise scope and re-review" | "Stop incomplete" | "Abort"
|
|
34
35
|
```
|
|
35
36
|
|
|
36
|
-
`BLOCKED` is terminal for this review cycle. Only `FAIL`
|
|
37
|
+
`BLOCKED` is terminal for this review cycle. Only `FAIL` and `PASS_WITH_WARNINGS` enter remediation retry; neither verdict can enter
|
|
38
|
+
finalization through user approval. If the user changes scope or accepts a
|
|
39
|
+
different contract, update the review target and obtain a fresh literal `PASS`.
|
|
40
|
+
A blocked review is never retried unchanged.
|
|
37
41
|
|
|
38
42
|
## Required User Pause
|
|
39
43
|
|
|
40
44
|
When the fix touches production-critical code, changes public contracts, introduces a behavior change, or the user explicitly requests review control:
|
|
41
45
|
|
|
42
|
-
1. Run `
|
|
46
|
+
1. Run `cf:code-review` → collect verdict + severity findings
|
|
43
47
|
2. Present a structured summary to user:
|
|
44
48
|
```
|
|
45
49
|
┌──────────────────────────────────┐
|
|
46
|
-
│ Review Verdict: [
|
|
50
|
+
│ Review Verdict: [verdict] │
|
|
47
51
|
├──────────────────────────────────┤
|
|
48
52
|
│ Critical: [list or "none"] │
|
|
49
53
|
│ High: [list or "none"] │
|
|
@@ -53,9 +57,11 @@ When the fix touches production-critical code, changes public contracts, introdu
|
|
|
53
57
|
```
|
|
54
58
|
3. Ask user for direction:
|
|
55
59
|
- If verdict is `BLOCKED` → resolve the blocker; do not retry this review cycle unchanged.
|
|
56
|
-
- If verdict is `FAIL` with Critical or High findings → "Fix blocking findings" | "Fix all" | "
|
|
57
|
-
- If verdict is `FAIL` with only Medium/Low findings → "
|
|
58
|
-
4. Execute user's
|
|
60
|
+
- If verdict is `FAIL` with Critical or High findings → "Fix blocking findings" | "Fix all" | "Revise scope" | "Abort"
|
|
61
|
+
- If verdict is `FAIL` or `PASS_WITH_WARNINGS` with only Medium/Low findings → "Address findings" | "Revise scope" | "Stop incomplete"
|
|
62
|
+
4. Execute the user's remediation or scope decision, then re-run verification
|
|
63
|
+
and review. Max 3 remediation cycles for `FAIL` and `PASS_WITH_WARNINGS`;
|
|
64
|
+
only a fresh literal `PASS` enters finalization. `BLOCKED` never enters this retry limit.
|
|
59
65
|
|
|
60
66
|
## When To Pause vs Continue
|
|
61
67
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# Specialized Workflows
|
|
2
2
|
|
|
3
|
-
Targeted procedures for common bug categories.
|
|
3
|
+
Targeted procedures for common bug categories. Load only the matching section
|
|
4
|
+
after the main workflow has scouted the affected area. Each overlay adds a
|
|
5
|
+
category-specific baseline and completion proof; it never replaces diagnosis,
|
|
6
|
+
the bounded repair frame, or the side-effect gate.
|
|
4
7
|
|
|
5
8
|
---
|
|
6
9
|
|
|
@@ -8,14 +11,20 @@ Targeted procedures for common bug categories. Use these as supplements to the m
|
|
|
8
11
|
|
|
9
12
|
When GitHub Actions or CI/CD is failing:
|
|
10
13
|
|
|
11
|
-
1. **
|
|
12
|
-
|
|
14
|
+
1. **Baseline:** identify the exact failing workflow, job, step, commit, runner,
|
|
15
|
+
and attempt. Preserve the failing command and log excerpt.
|
|
16
|
+
2. **Inspect safely:** use the project-native CI surface; for GitHub Actions,
|
|
17
|
+
`gh run list --status failure -L 5` and `gh run view <ID> --log-failed` are
|
|
18
|
+
examples, not permission to rerun, cancel, or mutate remote state.
|
|
13
19
|
3. **Common traps:**
|
|
14
20
|
- Environment setup step failed silently (DB container didn't start, npm ci cache corrupted)
|
|
15
21
|
- Secrets/env vars missing in the CI environment
|
|
16
22
|
- Version mismatch between local Node/Python and CI runner
|
|
17
23
|
- Flaky tests (passes locally, fails on CI) — check for timezone, file ordering, or race conditions
|
|
18
|
-
4. **
|
|
24
|
+
4. **Proof:** reproduce locally when parity is available, run the affected job
|
|
25
|
+
command, and verify workflow/config syntax. A local pass is not CI proof; if
|
|
26
|
+
a remote rerun is not authorized, report it as unverified. Never push blind
|
|
27
|
+
fixes to CI.
|
|
19
28
|
|
|
20
29
|
---
|
|
21
30
|
|
|
@@ -23,11 +32,15 @@ When GitHub Actions or CI/CD is failing:
|
|
|
23
32
|
|
|
24
33
|
When unit/integration/e2e tests are failing:
|
|
25
34
|
|
|
26
|
-
1. **
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
1. **Baseline:** record runner, exact failing command, test name, seed/shard,
|
|
36
|
+
environment, and assertion output. Use the repository's runner rather than
|
|
37
|
+
assuming Jest.
|
|
38
|
+
2. **Isolate:** run the smallest native selector that preserves the failure.
|
|
39
|
+
3. **Check for pollution:** Does it pass alone but fail in suite? → Test order dependency or shared state leaking.
|
|
40
|
+
4. **Check for staleness:** Did implementation behavior intentionally change, or is the assertion exposing a regression? Never weaken the assertion merely to turn the suite green.
|
|
41
|
+
5. **Snapshot drift:** Review the semantic diff; regenerate only when the changed output is accepted behavior.
|
|
42
|
+
6. **Flaky async:** Replace arbitrary sleeps with condition-based waits for observable state, DOM condition, network completion, queue drain, or an explicit event.
|
|
43
|
+
7. **Proof:** show fail-before/pass-after for the regression selector, then run the owning suite and any shared-state/order-sensitive suite.
|
|
31
44
|
|
|
32
45
|
---
|
|
33
46
|
|
|
@@ -35,13 +48,17 @@ When unit/integration/e2e tests are failing:
|
|
|
35
48
|
|
|
36
49
|
When `tsc` is throwing type errors:
|
|
37
50
|
|
|
38
|
-
1. **
|
|
39
|
-
|
|
40
|
-
|
|
51
|
+
1. **Baseline:** record the exact compiler command, diagnostic code, source
|
|
52
|
+
location, and affected type relationship.
|
|
53
|
+
2. **Never** suppress with `any`, `@ts-ignore`, or `as unknown as X` unless the
|
|
54
|
+
public contract itself explicitly requires an unsafe boundary and the risk is called out.
|
|
55
|
+
3. **Trace the type chain:** Where was the type originally defined? Follow the generic flow.
|
|
56
|
+
4. **Common roots:**
|
|
41
57
|
- Library update changed return types → check CHANGELOG/migration guide
|
|
42
58
|
- Missing null check → add proper narrowing
|
|
43
59
|
- Generic type inference failure → provide explicit type argument
|
|
44
|
-
|
|
60
|
+
5. **Fix pattern:** Fix the owned contract at its source. Do not "fix all" unrelated pre-existing diagnostics outside the blast radius.
|
|
61
|
+
6. **Proof:** rerun the exact failing compiler command plus tests covering runtime narrowing or serialization behavior affected by the type change.
|
|
45
62
|
|
|
46
63
|
---
|
|
47
64
|
|
|
@@ -49,10 +66,17 @@ When `tsc` is throwing type errors:
|
|
|
49
66
|
|
|
50
67
|
When the interface is broken, misaligned, or not rendering:
|
|
51
68
|
|
|
52
|
-
1. **
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
1. **Baseline:** capture the failing route, viewport, theme, browser/runtime,
|
|
70
|
+
interaction sequence, screenshot, console, and relevant network state with
|
|
71
|
+
the available project/browser tooling.
|
|
72
|
+
2. **Inspect structure:** compare DOM/ARIA and computed layout at the failing
|
|
73
|
+
element; visual similarity alone does not prove interaction behavior.
|
|
74
|
+
3. **Trace runtime state:** preserve console errors, hydration warnings, failed
|
|
75
|
+
requests, and state transitions that explain the symptom.
|
|
76
|
+
4. **Proof:** repeat the exact interaction and compare before/after at the
|
|
77
|
+
failing viewport, then test affected responsive states, keyboard/accessibility
|
|
78
|
+
behavior, console, and network. If the host cannot perform visual interaction,
|
|
79
|
+
report it as unverified instead of inferring a pass from static code.
|
|
56
80
|
5. **Common traps:**
|
|
57
81
|
- CSS specificity wars (use browser DevTools or ARIA snapshot to verify computed styles)
|
|
58
82
|
- Hydration mismatch in SSR frameworks (server HTML differs from client render)
|
|
@@ -65,10 +89,18 @@ When the interface is broken, misaligned, or not rendering:
|
|
|
65
89
|
|
|
66
90
|
When investigating production or server-side log errors:
|
|
67
91
|
|
|
68
|
-
1. **
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
92
|
+
1. **Baseline:** preserve the source, environment, time range, timezone,
|
|
93
|
+
request/trace/job ID, exact error, and surrounding events. Do not expose
|
|
94
|
+
secrets or personal data in reports.
|
|
95
|
+
2. **Correlate:** normalize timestamps and cross-reference relevant app, DB,
|
|
96
|
+
proxy, queue, or provider logs. Ordering is evidence, not automatic causation.
|
|
97
|
+
3. **Measure:** establish frequency, first/last occurrence, affected cohort, and
|
|
98
|
+
whether the error is isolated or load-dependent using the available native tools.
|
|
99
|
+
4. **Proof:** replay a safe deterministic trigger when possible, confirm the
|
|
100
|
+
expected state transition and absence of the same correlated error, then
|
|
101
|
+
verify metrics/alerts or report live recurrence as unverified when observation
|
|
102
|
+
time is insufficient.
|
|
103
|
+
5. **Common traps:**
|
|
72
104
|
- Silent exception swallowing upstream (the real error was caught and logged as a warning 50 lines earlier)
|
|
73
105
|
- Database connection pool exhaustion (errors appear random but correlate with connection count)
|
|
74
106
|
- Memory leaks (errors start appearing after extended uptime, not immediately)
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: "Fast codebase discovery using
|
|
2
|
+
name: cf:scout
|
|
3
|
+
description: "Fast scoped codebase discovery using local search first and user-permitted Explore delegation only for broad independent scopes. Use for file discovery, task context, entrypoints, call paths, and blast radius."
|
|
4
4
|
user-invocable: true
|
|
5
|
-
when_to_use: "Invoke for fast
|
|
5
|
+
when_to_use: "Invoke for fast scoped codebase discovery and file location."
|
|
6
6
|
category: discovery
|
|
7
|
-
keywords: [discovery, search,
|
|
7
|
+
keywords: [scout, inspect, discovery, search, context]
|
|
8
8
|
argument-hint: "[search-target]"
|
|
9
9
|
metadata:
|
|
10
10
|
author: haposoft
|
|
11
11
|
version: "2.1.0"
|
|
12
12
|
---
|
|
13
|
-
#
|
|
13
|
+
# Scout
|
|
14
14
|
|
|
15
|
-
Fast, token-efficient codebase discovery
|
|
15
|
+
Fast, token-efficient codebase discovery that uses focused local search by default
|
|
16
|
+
and delegates only when parallel scouting has a concrete benefit.
|
|
16
17
|
|
|
17
18
|
## Arguments
|
|
18
|
-
- Default:
|
|
19
|
+
- Default: Scout the named target with local `rg` and targeted reads. For a
|
|
20
|
+
genuinely broad scope, use the conditional delegation route in
|
|
21
|
+
`./references/internal-inspection.md`.
|
|
19
22
|
|
|
20
23
|
## When to Use
|
|
21
24
|
|
|
@@ -30,24 +33,29 @@ Before scanning:
|
|
|
30
33
|
2. Apply the built-in no-scan lists below.
|
|
31
34
|
3. Prefer file-type or glob hints whenever possible.
|
|
32
35
|
|
|
33
|
-
**When scope is too broad:** use a **2-phase approach** — lightweight
|
|
36
|
+
**When scope is too broad:** use a **2-phase approach** — lightweight structure
|
|
37
|
+
mapping first, then parallel agents only when the Delegation Gate is open.
|
|
34
38
|
|
|
35
|
-
### Phase 1 — Structure
|
|
39
|
+
### Phase 1 — Structure Map
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
Map the top-level layout in the main agent. A single Explore agent may do this
|
|
42
|
+
only when the Delegation Gate below is already open:
|
|
38
43
|
1. List immediate children of the scope root (dirs + key config; monorepo markers)
|
|
39
44
|
2. Rough file count per discovered directory
|
|
40
45
|
3. Return a division plan of 1–10 logical sub-scopes (path/glob, est. files, focus)
|
|
41
46
|
|
|
42
|
-
|
|
47
|
+
Complete the structure map before Phase 2.
|
|
43
48
|
|
|
44
|
-
### Phase 2 — Parallel Explore
|
|
49
|
+
### Phase 2 — Conditional Parallel Explore
|
|
45
50
|
|
|
46
|
-
1. Follow
|
|
47
|
-
2.
|
|
48
|
-
|
|
51
|
+
1. Follow the structure map; merge scopes < 10 files; split scopes > 100 files
|
|
52
|
+
2. If the Delegation Gate is open, spawn Explore agents on distinct sub-scopes;
|
|
53
|
+
otherwise scout the sub-scopes sequentially in the main agent
|
|
54
|
+
3. Aggregate into the Scout Report; offer deeper follow-up on specific areas
|
|
49
55
|
|
|
50
|
-
**Fallback to AskUserQuestion:** if
|
|
56
|
+
**Fallback to AskUserQuestion:** if the structure map still leaves multiple
|
|
57
|
+
plausible targets and the choice would materially change the scan, offer 2–4
|
|
58
|
+
concrete scopes from findings, then continue with the selected scope.
|
|
51
59
|
|
|
52
60
|
## Built-in No-Scan Guidance
|
|
53
61
|
|
|
@@ -63,50 +71,51 @@ Wait for Scout before Phase 2.
|
|
|
63
71
|
|
|
64
72
|
### 1. Analyze Task
|
|
65
73
|
- Parse search targets; identify directories, patterns, file types
|
|
66
|
-
-
|
|
74
|
+
- Estimate scan size and whether the work divides into independent scopes
|
|
67
75
|
|
|
68
|
-
|
|
69
|
-
```
|
|
70
|
-
SCALE = ceil(estimated_files_to_scan / 50)
|
|
71
|
-
```
|
|
76
|
+
### 2. Choose The Smallest Route
|
|
72
77
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
| Condition | Route |
|
|
79
|
+
|---|---|
|
|
80
|
+
| Named files/directories or focused scope (about 50 files or fewer) | Main-agent `rg` plus targeted reads; do not delegate |
|
|
81
|
+
| Medium scope that still fits one coherent search | Main-agent scouting; narrow before considering delegation |
|
|
82
|
+
| Broad scope with two or more independent areas | Structure map, then evaluate the Delegation Gate |
|
|
77
83
|
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
Do not use the file estimate alone to justify agents. A focused 100-file search
|
|
85
|
+
may still be cheaper locally; a smaller cross-system search may justify two
|
|
86
|
+
independent scopes.
|
|
80
87
|
|
|
81
|
-
### 3.
|
|
82
|
-
- **Skip if:** Agent count ≤ 2
|
|
83
|
-
- `TaskList` first; if none, `TaskCreate` per agent with scope metadata
|
|
84
|
-
- See `./references/internal-inspection.md` for patterns
|
|
88
|
+
### 3. Delegation Gate
|
|
85
89
|
|
|
86
|
-
|
|
90
|
+
Delegate only when all are true:
|
|
87
91
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
- The user explicitly requested or permitted subagents, delegation, or parallel work.
|
|
93
|
+
- The active runtime exposes an Explore/delegation capability.
|
|
94
|
+
- At least two non-overlapping scopes have useful independent work.
|
|
91
95
|
|
|
92
|
-
|
|
96
|
+
If any condition is false, continue in the main agent with scoped `rg`, file
|
|
97
|
+
listing, and targeted reads. Do not ask for delegation merely to complete an
|
|
98
|
+
ordinary focused scout.
|
|
93
99
|
|
|
94
|
-
###
|
|
100
|
+
### 4. Divide And Scout
|
|
95
101
|
|
|
96
|
-
|
|
102
|
+
For local scouting, search the shortlisted scopes sequentially and stop when the
|
|
103
|
+
question is answered. For delegated scouting, load
|
|
104
|
+
`./references/internal-inspection.md`, split by logical boundaries, and ensure
|
|
105
|
+
no overlap.
|
|
97
106
|
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
107
|
+
- Skip task registration for two or fewer agents.
|
|
108
|
+
- For three or more agents, use the live task/plan surface when available.
|
|
109
|
+
- Prompt each agent with exact directories/files and a read-only boundary.
|
|
101
110
|
|
|
102
|
-
###
|
|
111
|
+
### 5. Collect Results
|
|
103
112
|
- Timeout: 3 minutes per agent (skip non-responders; log in report)
|
|
104
|
-
-
|
|
113
|
+
- Update live task/plan state when one was used; aggregate; list unresolved questions at end
|
|
105
114
|
|
|
106
115
|
## Report Format
|
|
107
116
|
|
|
108
117
|
```markdown
|
|
109
|
-
#
|
|
118
|
+
# Scout Report
|
|
110
119
|
|
|
111
120
|
## Relevant Files
|
|
112
121
|
- `path/to/file.ts` - Brief description
|
|
@@ -121,7 +130,7 @@ Dispatch native Explore agents with breadth medium/very-thorough + the Scope Gat
|
|
|
121
130
|
|
|
122
131
|
## Rules
|
|
123
132
|
|
|
124
|
-
- Keep scope narrow. Do not use `
|
|
133
|
+
- Keep scope narrow. Do not use `cf:scout` as a runtime policy engine.
|
|
125
134
|
- Prefer listing files first, then reading only the shortlisted files.
|
|
126
135
|
- Never encourage scanning ignored/generated/sensitive areas from the no-scan list.
|
|
127
136
|
- Keep reports concise and actionable.
|
|
@@ -130,4 +139,4 @@ Dispatch native Explore agents with breadth medium/very-thorough + the Scope Gat
|
|
|
130
139
|
|
|
131
140
|
## References
|
|
132
141
|
|
|
133
|
-
- `./references/internal-inspection.md` -
|
|
142
|
+
- `./references/internal-inspection.md` - Conditional Explore delegation
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Conditional Discovery with Explore Subagents
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Use native Explore agents only after the `SKILL.md` Delegation Gate passes.
|
|
4
|
+
Focused discovery stays in the main agent even when Explore is available.
|
|
5
|
+
|
|
6
|
+
## Delegation Preconditions
|
|
7
|
+
|
|
8
|
+
All are required:
|
|
9
|
+
|
|
10
|
+
1. The user explicitly requested or permitted delegation or parallel agents.
|
|
11
|
+
2. The active runtime exposes an Explore/delegation capability.
|
|
12
|
+
3. The structure map identifies at least two distinct, non-overlapping scopes
|
|
13
|
+
with useful independent work.
|
|
14
|
+
|
|
15
|
+
If any precondition fails, use scoped `rg`, file listing, and targeted reads in
|
|
16
|
+
the main agent. Do not request extra authority for an ordinary focused scout.
|
|
4
17
|
|
|
5
18
|
## Agent Tool Configuration
|
|
6
19
|
|
|
@@ -26,7 +39,9 @@ Report format:
|
|
|
26
39
|
|
|
27
40
|
## Spawning Strategy
|
|
28
41
|
|
|
29
|
-
Split by logical dirs (`src/`, `lib/`, `tests/`, `config/`, `api/`, `types/`).
|
|
42
|
+
Split by logical dirs (`src/`, `lib/`, `tests/`, `config/`, `api/`, `types/`).
|
|
43
|
+
Spawn agents concurrently only when the runtime supports it; keep scopes
|
|
44
|
+
distinct and non-overlapping.
|
|
30
45
|
|
|
31
46
|
**Example** (auth): A1 `src/auth/, middleware/`; A2 `api/, routes/`; A3 `tests/`; A4 `lib/, utils/`; A5 `config/`; A6 `types/`.
|
|
32
47
|
|
|
@@ -37,7 +52,9 @@ Split by logical dirs (`src/`, `lib/`, `tests/`, `config/`, `api/`, `types/`). S
|
|
|
37
52
|
| ≤ 2 | No (overhead) |
|
|
38
53
|
| ≥ 3 | Yes |
|
|
39
54
|
|
|
40
|
-
|
|
55
|
+
Use the live task or plan surface when available. Record scope and ownership
|
|
56
|
+
before spawn, then completion or timeout after collection. Do not create task
|
|
57
|
+
state solely for one or two short probes.
|
|
41
58
|
|
|
42
59
|
## Timeout, Aggregation, Reading
|
|
43
60
|
|
|
@@ -51,4 +68,3 @@ Start from concrete directories (not repo root); prefer scoped globs; skip `NO_S
|
|
|
51
68
|
## Output Contract
|
|
52
69
|
|
|
53
70
|
Return: file paths, brief description per file, notable relationships/patterns, unresolved questions.
|
|
54
|
-
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cf:loop
|
|
3
|
+
description: "Run an explicit, bounded optimization loop against a numeric metric while a separate correctness guard protects the result."
|
|
4
|
+
user-invocable: true
|
|
5
|
+
when_to_use: "Use only when the user explicitly requests measurable iterative optimization and supplies a safe Metric and Guard contract."
|
|
6
|
+
category: utilities
|
|
7
|
+
keywords: [loop, optimization, benchmark, metric, experiment]
|
|
8
|
+
argument-hint: "<goal>"
|
|
9
|
+
metadata:
|
|
10
|
+
author: haposoft
|
|
11
|
+
version: "1.0.0"
|
|
12
|
+
---
|
|
13
|
+
# Loop — bounded metric optimization
|
|
14
|
+
|
|
15
|
+
Loop is explicit-only. Never auto-route ordinary implementation, debugging, or
|
|
16
|
+
research into Loop. It optimizes one numeric outcome under a separate correctness
|
|
17
|
+
Guard; it does not guarantee improvement or replace Test/Review.
|
|
18
|
+
|
|
19
|
+
Live-agent adherence to this written contract is `[UNPROVEN]` without a host run.
|
|
20
|
+
The safety boundary is cooperative: commands must already be trusted by the user
|
|
21
|
+
or repository. No instruction-only workflow can contain a malicious executable
|
|
22
|
+
without an OS sandbox.
|
|
23
|
+
|
|
24
|
+
## 1. Preflight before mutation
|
|
25
|
+
|
|
26
|
+
Load `references/metric-and-guard-contract.md` and freeze every field before any
|
|
27
|
+
worktree, process, patch, or file mutation:
|
|
28
|
+
|
|
29
|
+
- Goal and canonical repository root.
|
|
30
|
+
- Scope: contained regular tracked text paths; symlink, untracked, binary, and
|
|
31
|
+
submodule policy. Default is reject each unsupported kind.
|
|
32
|
+
- Pinned base OID plus primary tracked/untracked status. Reject dirty in-scope
|
|
33
|
+
state; record but never import or clean out-of-scope dirt.
|
|
34
|
+
- Metric argv, unit, `higher|lower`, sample count, IEEE-754 binary64 numeric and
|
|
35
|
+
rounding policy, fixed aggregation/noise rule, minimum delta, timeout, and
|
|
36
|
+
reproducible baseline environment.
|
|
37
|
+
- Distinct immutable Guard argv and timeout for code mutation. Metric and Guard
|
|
38
|
+
may not be the same command or validate the same sole outcome.
|
|
39
|
+
- Frozen positive iteration and wall-clock budgets; explicit success,
|
|
40
|
+
no-improvement, drift, failure, timeout, and cancellation stops.
|
|
41
|
+
- Unique run identity, exact disposable root, ownership marker, upfront cleanup
|
|
42
|
+
consent, handoff mode/destination, retention, and cleanup owner.
|
|
43
|
+
|
|
44
|
+
Missing, ambiguous, unsafe, or non-reproducible input returns `BLOCKED` without
|
|
45
|
+
mutation. A subjective score, a metric that can be edited by the loop, or code
|
|
46
|
+
mutation without a distinct Guard is ineligible.
|
|
47
|
+
|
|
48
|
+
## 2. Establish isolation and baseline
|
|
49
|
+
|
|
50
|
+
Load `references/bounded-loop-protocol.md`. Create a never-reused canonical temp
|
|
51
|
+
root and ownership marker, then add a detached Git worktree at the pinned OID.
|
|
52
|
+
Do not create a branch or commit. Necessary common-Git-dir worktree metadata is
|
|
53
|
+
the only allowed primary-repository metadata effect; primary worktree bytes,
|
|
54
|
+
index, branch, and refs remain untouched.
|
|
55
|
+
|
|
56
|
+
Screen each trusted command as an argv vector and run it with `cwd` fixed to the
|
|
57
|
+
canonical detached root. The executable is a separately approved external
|
|
58
|
+
realpath; only path-valued target arguments must resolve inside the detached
|
|
59
|
+
root. Never use `eval`, `sh -c`, `bash -c`, `zsh -c`,
|
|
60
|
+
`cmd /c`, PowerShell `-Command`, inline interpreter code, Git `-C`, `--git-dir`,
|
|
61
|
+
`--work-tree`, destructive Git operations, path traversal, or an absolute target
|
|
62
|
+
outside the detached root. Use a minimal fixed environment and redact secrets.
|
|
63
|
+
|
|
64
|
+
Capture the complete detached-worktree tracked/untracked manifest before and
|
|
65
|
+
after every Metric and Guard run, subtracting only an exact immutable cache
|
|
66
|
+
allowlist frozen at preflight. Any other oracle mutation is drift. Establish
|
|
67
|
+
baseline samples on pinned bytes before allowing a candidate.
|
|
68
|
+
|
|
69
|
+
## 3. Iterate one attributable change
|
|
70
|
+
|
|
71
|
+
For every iteration:
|
|
72
|
+
|
|
73
|
+
1. Create a fresh unique detached worktree from pinned base and apply only the
|
|
74
|
+
accepted-best patch, if one exists. Never restore in place.
|
|
75
|
+
2. Make exactly one bounded hypothesis change inside Scope. Multiple unrelated
|
|
76
|
+
changes are forbidden. Reject unexpected,
|
|
77
|
+
untracked, binary, symlink, submodule, or out-of-scope bytes.
|
|
78
|
+
3. Fingerprint candidate bytes, run Metric samples, fingerprint again, then run
|
|
79
|
+
Guard on those identical bytes and fingerprint once more.
|
|
80
|
+
4. Reject on nonzero exit, timeout, malformed/non-finite/multi-value output,
|
|
81
|
+
oracle mutation, Guard failure, or any source/environment/contract drift.
|
|
82
|
+
5. Accept only when Guard passes and improvement over current best is strictly
|
|
83
|
+
greater than both the frozen minimum delta and calculated noise threshold.
|
|
84
|
+
Record the candidate as a base-bound accepted-best patch; otherwise discard
|
|
85
|
+
only that iteration's owned disposable environment.
|
|
86
|
+
|
|
87
|
+
Do not edit Metric, Guard, tests, benchmarks, datasets, budgets, or thresholds
|
|
88
|
+
to win; their frozen digests are revalidated before every candidate.
|
|
89
|
+
Stop at the first budget, cancellation, drift, ownership, cleanup, or repeated
|
|
90
|
+
no-improvement condition named in preflight.
|
|
91
|
+
|
|
92
|
+
## 4. Failure and process ownership
|
|
93
|
+
|
|
94
|
+
Launch every command in an isolated process group on POSIX or Job Object on
|
|
95
|
+
Windows. If the runtime cannot terminate the whole process tree, refuse to run.
|
|
96
|
+
On timeout/cancel, terminate, escalate to kill, reap, and verify quiescence before
|
|
97
|
+
cleanup. Never reuse a timed-out path. If descendants, path ownership, or cleanup
|
|
98
|
+
is uncertain, retain exact residue and return `BLOCKED`; never use
|
|
99
|
+
`git reset --hard`, `git clean`, broad deletion, or unrelated recovery.
|
|
100
|
+
|
|
101
|
+
## 5. Handoff
|
|
102
|
+
|
|
103
|
+
Return baseline, best value/noise, the exact keep formula, accepted/rejected
|
|
104
|
+
iteration ledger, Guard evidence, stop reason, remaining limits, and live-proof
|
|
105
|
+
status. A successful handoff is a redacted tracked-text patch bound to base OID,
|
|
106
|
+
complete scoped file manifest, and lowercase SHA-256. Reject secret-bearing,
|
|
107
|
+
untracked, binary, incomplete, or stale output unless a separately approved
|
|
108
|
+
bundle contract exists.
|
|
109
|
+
|
|
110
|
+
Use only the preflight-selected handoff mode: inline ephemeral patch, or an exact
|
|
111
|
+
user-approved path outside the primary worktree with retention and cleanup owner.
|
|
112
|
+
Never apply, commit, push, merge, cherry-pick, deploy, publish, or write an
|
|
113
|
+
artifact into the primary worktree implicitly. The user reviews and explicitly
|
|
114
|
+
authorizes any later application through the normal Develop/Test/Review flow.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Bounded Loop protocol
|
|
2
|
+
|
|
3
|
+
This is a cooperative instruction contract, not a sandbox or a production
|
|
4
|
+
runtime. Live-agent adherence remains `[UNPROVEN]` until separately observed.
|
|
5
|
+
|
|
6
|
+
## Run identity and filesystem boundary
|
|
7
|
+
|
|
8
|
+
1. Resolve the repository root and pinned base OID without changing checkout.
|
|
9
|
+
2. Capture primary tracked and untracked status. Reject any dirty path that is
|
|
10
|
+
inside Scope; never import, stash, clean, or overwrite primary dirt.
|
|
11
|
+
3. Create a unique temp directory using the platform's secure temp API. Resolve
|
|
12
|
+
its lexical and canonical path, require it outside the repository, and refuse
|
|
13
|
+
a symlink, pre-existing reused run path, broad root, or ownership ambiguity.
|
|
14
|
+
4. Write an ownership marker containing a random run ID, base OID, canonical
|
|
15
|
+
root, and creation time. Acquire one exclusive run lock; contention blocks.
|
|
16
|
+
5. With upfront consent for this exact path, use `git worktree add --detach`
|
|
17
|
+
against the pinned OID. Do not use `-b`, create refs, or commit.
|
|
18
|
+
|
|
19
|
+
Every later path must be a lexical and canonical descendant of the owned root.
|
|
20
|
+
Reject `..`, symlink traversal, mount redirection, absolute external targets,
|
|
21
|
+
submodules, and paths that changed identity after validation.
|
|
22
|
+
|
|
23
|
+
## Command trust and screening
|
|
24
|
+
|
|
25
|
+
Commands are supplied or already owned by the trusted repository/user. Record
|
|
26
|
+
the separately trusted/allowlisted executable realpath (which may be outside the
|
|
27
|
+
worktree), argv, fixed cwd, timeout, output limit, and allowlisted
|
|
28
|
+
environment before execution. Do not pass secrets; redact credentials, tokens,
|
|
29
|
+
cookies, authorization headers, PII, and secret-looking patch lines from reports.
|
|
30
|
+
|
|
31
|
+
Refuse general shell evaluation, inline code flags, Git external targeting
|
|
32
|
+
(`-C`, `--git-dir`, `--work-tree`), destructive Git (`reset --hard`, `clean`,
|
|
33
|
+
branch/ref deletion), recursive deletion, privilege escalation, deploy/publish,
|
|
34
|
+
and any path-valued target argument that resolves outside the detached root,
|
|
35
|
+
including response/config/output targets. Do not apply the target-path rule to
|
|
36
|
+
the separately approved executable itself. A trusted script file may run through
|
|
37
|
+
its declared interpreter, but inline `-c`, `-e`, `--eval`, and equivalent dynamic
|
|
38
|
+
code are forbidden.
|
|
39
|
+
|
|
40
|
+
This screening reduces mistakes; it cannot contain arbitrary side effects from
|
|
41
|
+
a malicious or compromised executable. If that threat is material, return
|
|
42
|
+
`BLOCKED` and require an OS sandbox outside this skill's scope.
|
|
43
|
+
|
|
44
|
+
## Iteration lifecycle
|
|
45
|
+
|
|
46
|
+
- Revalidate base OID, primary status, contract digests, lock, ownership marker,
|
|
47
|
+
and canonical roots before every iteration.
|
|
48
|
+
- Build a new never-reused detached worktree from pinned base plus the current
|
|
49
|
+
accepted-best tracked-text patch. Do not repair a rejected candidate in place.
|
|
50
|
+
- Capture a complete Scope manifest of path, type, mode, size, and SHA-256 before
|
|
51
|
+
mutation; lstat paths and reject symlink/type/identity changes.
|
|
52
|
+
- Permit one hypothesis patch. Its post-change manifest must be contained in
|
|
53
|
+
Scope and attributable to that hypothesis.
|
|
54
|
+
- Capture the complete detached-worktree tracked/untracked fingerprint around
|
|
55
|
+
every Metric and Guard command. Subtract only exact immutable cache paths
|
|
56
|
+
frozen at preflight; every other oracle-created file or byte/mode/type/path
|
|
57
|
+
change, inside or outside Scope, rejects the candidate as drift.
|
|
58
|
+
- Record command exit/signal/timeout, bounded redacted output, raw finite samples,
|
|
59
|
+
median/noise, Guard verdict, patch digest, and keep/discard reason.
|
|
60
|
+
|
|
61
|
+
Parallel iterations are forbidden: one run, one lock, one candidate at a time.
|
|
62
|
+
An external source/base/contract change stops the run; it never triggers an
|
|
63
|
+
automatic rebase, new baseline, threshold change, or wider Scope.
|
|
64
|
+
|
|
65
|
+
## Process-tree timeout and cancellation
|
|
66
|
+
|
|
67
|
+
Spawn a new process group on POSIX or Job Object on Windows. On timeout or user
|
|
68
|
+
cancellation, stop scheduling, terminate the whole tree, wait the frozen grace
|
|
69
|
+
period, escalate to kill, reap, and verify no owned descendant remains. The run
|
|
70
|
+
path is permanently retired after timeout.
|
|
71
|
+
|
|
72
|
+
If the platform cannot own/observe descendants, termination fails, a process
|
|
73
|
+
survives, or quiescence cannot be proven, do not clean. Preserve the exact path,
|
|
74
|
+
PID/process evidence, and ownership marker; return `BLOCKED` for operator action.
|
|
75
|
+
|
|
76
|
+
## Cleanup and recovery
|
|
77
|
+
|
|
78
|
+
Clean only a canonical path whose run ID, lock, marker, base OID, and inode/path
|
|
79
|
+
identity still match the run and whose process tree is quiescent. Release the
|
|
80
|
+
detached worktree through Git, then remove only that exact temp root using the
|
|
81
|
+
pre-approved cleanup action. Never broaden a glob or follow a symlink.
|
|
82
|
+
|
|
83
|
+
No `git reset --hard`, `git clean`, force checkout, stash, branch deletion,
|
|
84
|
+
primary-index edit, or unrelated recovery is permitted. Cleanup uncertainty is
|
|
85
|
+
a retained residue plus `BLOCKED`, not a reason to become more destructive.
|
|
86
|
+
|
|
87
|
+
## Patch handoff
|
|
88
|
+
|
|
89
|
+
Default handoff supports tracked regular UTF-8 text files only. Generate a
|
|
90
|
+
reviewable unified patch against the pinned base, then bind:
|
|
91
|
+
|
|
92
|
+
- `base_oid`;
|
|
93
|
+
- sorted complete Scope manifest before/after with file SHA-256;
|
|
94
|
+
- patch byte length and lowercase SHA-256;
|
|
95
|
+
- Metric/Guard contract digests and evidence;
|
|
96
|
+
- accepted/rejected iteration ledger and stop reason;
|
|
97
|
+
- secret/redaction scan result;
|
|
98
|
+
- mode: inline ephemeral, or exact approved external path;
|
|
99
|
+
- creation time, retention/expiry, cleanup owner, and application authority.
|
|
100
|
+
|
|
101
|
+
Reject missing/untracked/binary/symlink/submodule/secret-bearing/incomplete or
|
|
102
|
+
stale patch bytes. Never store the artifact in the primary worktree implicitly.
|
|
103
|
+
Never apply or commit it. A later authorized workflow revalidates base, patch,
|
|
104
|
+
tests, review, and current repository state before application.
|