Skip to content

PR 2: Convert self-improvement loops to deterministic command+gate - #39

Merged
5uck1ess merged 3 commits into
mainfrom
feat/deterministic-pr2-self-improvement
Apr 9, 2026
Merged

PR 2: Convert self-improvement loops to deterministic command+gate#39
5uck1ess merged 3 commits into
mainfrom
feat/deterministic-pr2-self-improvement

Conversation

@5uck1ess

@5uck1ess 5uck1ess commented Apr 9, 2026

Copy link
Copy Markdown
Owner

Summary

Second PR of the deterministic workflow conversion project.

  • Workflows updated to use command steps for baseline/verify and gate on improvement loops — matching the self-lint.yml proof of concept from PR Add deterministic command steps and loop gates to workflow engine #34
    • self-test.yml: prompt baseline → command step, loop gains gate (max 8)
    • self-perf.yml: prompt baseline → command step, loop gains gate (max 5)
    • self-improve.yml: prompt baseline → command step, loop gains gate (max 10)
    • self-migrate.yml: new file with command+gate pattern (max 20)
    • self-lint.yml: unchanged (already deterministic)
  • Commands (5 files) converted to thin wrappers with invoke + fallback pattern

Net: -643 lines of markdown command logic, +140 lines of deterministic YAML + thin wrappers. All 5 self-improvement workflows now enforce step sequence via the Go engine.

Test plan

  • devkit workflow run self-test "npm test" — engine runs baseline command, gates fix loop
  • devkit workflow run self-lint "npx eslint ." — existing proof of concept still works
  • devkit workflow run self-improve "go vet ./..." — engine gates improvement loop
  • devkit workflow run self-perf "go test -bench=." — engine gates optimization loop
  • devkit workflow run self-migrate "npm test" — new workflow runs migration loop
  • Commands fall back to manual steps when engine unavailable

5uck1ess added 3 commits April 9, 2026 19:22
PR 2 of deterministic workflow conversion. Updates self-test, self-perf,
and self-improve workflows to use `command` steps for baseline/verify
and `gate` on improvement loops (matching self-lint proof of concept).
Creates new self-migrate.yml workflow. Converts all 5 commands to thin
wrappers.

Workflows: baseline prompt → command step, loop gains gate check
- self-test.yml: prompt baseline → command, add gate (max 8)
- self-perf.yml: prompt baseline → command, add gate (max 5)
- self-improve.yml: prompt baseline → command, add gate (max 10)
- self-migrate.yml: new file with command+gate (max 20)
- self-lint.yml: unchanged (already done in PR #34)

Commands: 5 files, ~643 lines removed
- Update README.md and ROADMAP.md: 15 → 16 workflows (new self-migrate.yml)
- Document exit-code semantics for self-perf: benchmark must exit non-zero
  when target not met
- Document gate semantics for self-migrate: use composite gate command
  for migration completeness detection
- Clarify self-improve: metric command must exit non-zero when needed
The engine checks `until` against the LLM's text output
(engine.go:460), not the gate command's exit code. Since all
prompts instruct the LLM to "say DONE", the until condition
must be "DONE" — not "exit code: 0" which never appears in
LLM output.

Without this fix, all self-improvement loops run to max
iterations even after the gate passes, wasting tokens.

Affects: self-lint, self-test, self-perf, self-improve, self-migrate
@5uck1ess
5uck1ess merged commit d0974b5 into main Apr 9, 2026
3 checks passed
@5uck1ess
5uck1ess deleted the feat/deterministic-pr2-self-improvement branch April 9, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant