Parfii-bot
|
5b5e7c6d7b
|
feat(wave15): kei-fork — managed git-worktree + ledger lifecycle primitive
45 crates, 726 tests green (up from 713).
Closes the ad-hoc `cp files from worktree` workflow that lost data when
Claude Code auto-cleaned worktrees mid-session. After this crate ships,
orchestrator never touches `git worktree` or manual `cp` again.
## Public API
- `create(agent_id, base, kit_root)` → ForkHandle + ledger row
- `collect(agent_id, msg, kit_root)` → commit + merge --no-ff + archive
- `list(kit_root, status_filter)` → Active/Done/Stale/Merged enumeration
- `gc(kit_root, hours)` → prune stale forks (git + branch + ledger fail)
- `rescue(agent_id, kit_root, out)` → salvage files live or from archive
## Key design decisions
- Worktrees indexed by agent_id (`.claude/forks/<agent_id>/`), NOT uuid —
grepable, no more "which worktree has my files" confusion.
- `.DONE` marker gates collect — agent signals completion explicitly.
- Archive path `_archive/forks/YYYY-MM-DD/<agent_id>/` preserves history.
- `KEI_FORK_SKIP_LEDGER=1` env for hermetic tests.
- Constructor Pattern: 10 modules, largest file main.rs 137 LOC.
13 hermetic integration tests via tempfile + git-init kit_roots.
Next: wire kei-fork into kei-spawn for the three-role pipeline
(Writer → Auditor → Merger with branch-as-sandbox).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-04-23 17:43:20 +08:00 |
|