diff --git a/README.md b/README.md index 1dff83d..fbb47a9 100644 --- a/README.md +++ b/README.md @@ -216,7 +216,9 @@ korg campaign --tui --prompt "Refactor the auth layer to use JWTs" # Web cockpit at localhost:8080 korg campaign --web --prompt "Optimize the database connection pool" -# Pure autonomous goal mode (--goal is a top-level flag) +# Pure autonomous goal mode (--goal is a top-level flag). Each persona works in +# its own git worktree and runs a real `cargo check`, so on a large repo a cold +# run takes minutes; `--speculative` pre-warms a shared target dir. korg --goal "Write and validate a full test suite for src/parser.rs" # Run the full multi-persona swarm on a REAL local model — every persona @@ -232,7 +234,10 @@ korg --preview "Refactor the main event loop" ### Rewind & Verify ```bash -# Rewind the capability journal to a specific ledger sequence point +# Rewind the capability journal (.korg/capability_journal.json) to a prior +# sequence point. It is populated by campaigns (`korg --goal`, `korg campaign`); +# on a fresh checkout there is nothing to rewind yet — `korg demo` shows the +# full rewind flow in a self-contained sandbox. korg rewind --seq 4 # Drive the honest pipeline on a fixture and emit a verifiable ledger diff --git a/crates/korg-runtime/src/harness.rs b/crates/korg-runtime/src/harness.rs index 40e1881..074fa25 100644 --- a/crates/korg-runtime/src/harness.rs +++ b/crates/korg-runtime/src/harness.rs @@ -243,6 +243,16 @@ impl SingleWorkerHarness { } let branch_name = format!("korg-branch-{}", routing_id); + + // A previous run that was interrupted (Ctrl-C, timeout) leaves its + // worktree registered in git even though the directory was removed + // above; `worktree add -B` then refuses to reset the branch it still + // holds. Pruning drops registrations whose directories are gone. + let _ = tokio::process::Command::new("git") + .args(&["worktree", "prune"]) + .output() + .await; + eprintln!( "[Harness] Spinning up physical worktree at {:?} from commit {} (branch: {})", worktree_path, snapshot_ref, branch_name diff --git a/demo.gif b/demo.gif index e9eb03a..3f3ab39 100644 Binary files a/demo.gif and b/demo.gif differ diff --git a/demo.mp4 b/demo.mp4 index 0ce3078..7db2e38 100644 Binary files a/demo.mp4 and b/demo.mp4 differ diff --git a/demo.tape b/demo.tape index d880a7d..fcbbae0 100644 --- a/demo.tape +++ b/demo.tape @@ -28,6 +28,12 @@ Set PlaybackSpeed 1 Hide Type "export PATH=$PWD/target/release:$PATH" Enter +# Seed a real capability journal for step 5: run an actual (hermetic, +# deterministic-provider) swarm campaign on a scratch copy of the fixture repo. +# This takes ~1 min and is hidden only to keep the GIF short. +Type "W=$(mktemp -d) && cp -r fixtures/honest-demo-repo/. $W && git -C $W init -q && git -C $W add -A && git -C $W -c user.email=demo@korg -c user.name=demo commit -qm init && (cd $W && korg --goal 'Fix the add function in src/lib.rs so it adds' >/dev/null 2>&1)" +Enter +Sleep 120s Type "clear" Enter Show @@ -66,10 +72,10 @@ Sleep 3s Ctrl+L # ── 5. Real reversible rewind of the capability journal ─────────────────────── -# Operates on this repo's real .korg/execution_journal.jsonl — a real -# hash-chained truncation + re-seal, not a scripted message. +# Operates on the real .korg/capability_journal.json the hidden setup's campaign +# wrote — a real hash-chained truncation + LedgerRewind seal, not a scripted message. Sleep 400ms -Type "korg rewind --seq 1" +Type "cd $W && korg rewind --seq 4" Enter Sleep 4s Ctrl+L @@ -83,11 +89,11 @@ Enter Sleep 600ms Type "echo ''" Enter -Type "echo 'A tamper-evident ledger for AI agent cognition — no trust in the tool.'" +Type "echo 'A tamper-evident ledger for AI agent cognition. No trust in the tool.'" Enter Sleep 600ms Type "echo ''" Enter -Type "echo 'cargo install korg → github.com/New1Direction/korg'" +Type "echo 'git clone github.com/New1Direction/korg && cargo build --release'" Enter Sleep 4s diff --git a/demo.webp b/demo.webp index 3a0c242..ccaf872 100644 Binary files a/demo.webp and b/demo.webp differ diff --git a/korg.toml b/korg.toml index 589de0a..d865d76 100644 --- a/korg.toml +++ b/korg.toml @@ -1,5 +1,7 @@ # korg Swarm cognitive configuration surface -default_llm = "ollama" +# Hermetic by default (no network, no model). Pass `--provider ollama` or set +# default_llm = "ollama" here to run every persona on a live local model. +default_llm = "deterministic" default_model = "llama3-70b-monochrome" [ollama] diff --git a/src/main.rs b/src/main.rs index 164d62a..aba9112 100644 --- a/src/main.rs +++ b/src/main.rs @@ -822,6 +822,14 @@ async fn main() -> Result<()> { Commands::Rewind { seq } => { let mut journal = korg_registry::CapabilityJournal::default_journal(); let prev_count = journal.events.len(); + if journal.events.is_empty() { + eprintln!( + "\n\x1b[38;2;255;0;180m❌ Nothing to rewind: no events in .korg/capability_journal.json yet.\x1b[0m\n \ + Record some first, e.g. `korg --goal \"\"`, or run `korg demo` for a\n \ + self-contained rewind walkthrough." + ); + std::process::exit(1); + } match journal.rewind_with_seal(seq, "korg:cli", "operator rewind") { Ok(()) => { let green = "\x1b[38;2;0;255;128m"; @@ -855,7 +863,7 @@ async fn main() -> Result<()> { let pink = "\x1b[38;2;255;0;180m"; let reset = "\x1b[0m"; eprintln!("\n{}❌ Rewind failed: {}{}", pink, e, reset); - return Err(anyhow::anyhow!("Rewind failed: {}", e)); + std::process::exit(1); } } }