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>
27 lines
653 B
TOML
27 lines
653 B
TOML
[package]
|
|
name = "kei-fork"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
rust-version = "1.75"
|
|
description = "Managed git-worktree + ledger lifecycle for agent spawns (Wave 15 foundation)"
|
|
|
|
[[bin]]
|
|
name = "kei-fork"
|
|
path = "src/main.rs"
|
|
|
|
[lib]
|
|
name = "kei_fork"
|
|
path = "src/lib.rs"
|
|
|
|
[dependencies]
|
|
kei-agent-runtime = { path = "../kei-agent-runtime" }
|
|
rusqlite = { version = "0.31", features = ["bundled"] }
|
|
clap = { version = "4", features = ["derive"] }
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
toml = "0.8"
|
|
thiserror = "1"
|
|
chrono = { version = "0.4", default-features = false, features = ["clock"] }
|
|
|
|
[dev-dependencies]
|
|
tempfile = "3"
|