feat(cli): --init-from — seed a run from a previous run's best program (#28)#30
Merged
Conversation
Addresses #28 (item 2, the clearest missing one). `--init-from <run_dir>` resolves a previous run's best program (best/best_program.py, falling back to the latest checkpoint) and uses it as the initial program, so chaining cycles (evolve -> reseed from best -> evolve) is a one-liner instead of manual file copying. Includes a positional-shift convenience so you can pass just the evaluator: `kai run --init-from <run_dir> evaluator.py -c config.yaml`. 4 unit tests (resolver: best/ dir, checkpoint fallback, absent; arg wiring). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the top missing item from #28:
--init-from.Chaining cycles (evolve → reseed from best → evolve) currently means manually locating
run_0/best/best_program.pyand copying it overinitial_program.py. This flag makes it a one-liner.What it does
--init-from <run_dir>resolves that run's best program:best/best_program.py, falling back to the latestcheckpoints/checkpoint_*/best_program.py(numeric, not lexicographic).--init-fromset, a single positional is treated as the evaluator, sokai run --init-from <run_dir> evaluator.py -c config.yamlworks as written.cli.pyonly — no changes to the evolution core.Tests
4 unit tests (
tests/test_cli_init_from.py): resolver prefersbest/, falls back to the latest checkpoint by number, returnsNonewhen absent, and the flag parses.On the rest of #28
While here I checked the other items — several already exist:
kai compare(item 4 ✓),kai monitor(covers much of item 1's status/watch), and--target-score(partial item 3). Remaining nice-to-haves: a lightweight one-shotkai status <run_dir>andkai eval(item 5). Leaving #28 open for those.🤖 Generated with Claude Code