Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
fix(run): parse the copilot harness name back out of the recovery journal
Rudy Mizrahi Celekli6e88eb46df9e
diff --git a/crates/ai-memory-cli/src/commands/run.rs b/crates/ai-memory-cli/src/commands/run.rsindex 7445f72e..78438148 100644--- a/crates/ai-memory-cli/src/commands/run.rs+++ b/crates/ai-memory-cli/src/commands/run.rs@@ -4595,6 +4595,7 @@ pub(crate) fn harness_from_journal_name(name: &str) -> Option<ManagedHarness> {"kiro-v3" => Some(ManagedHarness::KiroV3),"grok" => Some(ManagedHarness::Grok),"antigravity" => Some(ManagedHarness::Antigravity),+ "copilot" => Some(ManagedHarness::Copilot),_ => None,}}@@ -4622,6 +4623,65 @@ mod tests {JailPlan { warn, mode }}+ /// Every harness a journal entry can name.+ const EVERY_MANAGED_HARNESS: &[ManagedHarness] = &[+ ManagedHarness::Claude,+ ManagedHarness::Codex,+ ManagedHarness::OpenCode,+ ManagedHarness::OpenCode2,+ ManagedHarness::Pi,+ ManagedHarness::Crush,+ ManagedHarness::Omp,+ ManagedHarness::Kimi,+ ManagedHarness::CommandCode,+ ManagedHarness::Kiro,+ ManagedHarness::KiroV3,+ ManagedHarness::Grok,+ ManagedHarness::Antigravity,+ ManagedHarness::Copilot,+ ];++ /// The exact spelling `append_journal_entry` records for each harness,+ /// pinned here so a rename cannot silently orphan existing journals. This+ /// match is also the compile-time lever: a new `ManagedHarness` variant+ /// fails to build until it is given a journal name and listed in+ /// `EVERY_MANAGED_HARNESS` above, which drags it into the round trip.+ const fn journal_name(harness: ManagedHarness) -> &'static str {+ match harness {+ ManagedHarness::Claude => "claude",+ ManagedHarness::Codex => "codex",+ ManagedHarness::OpenCode => "opencode",+ ManagedHarness::OpenCode2 => "opencode2",+ ManagedHarness::Pi => "pi",+ ManagedHarness::Crush => "crush",+ ManagedHarness::Omp => "omp",+ ManagedHarness::Kimi => "kimi",+ ManagedHarness::CommandCode => "command-code",+ ManagedHarness::Kiro => "kiro",+ ManagedHarness::KiroV3 => "kiro-v3",+ ManagedHarness::Grok => "grok",+ ManagedHarness::Antigravity => "antigravity",+ ManagedHarness::Copilot => "copilot",+ }+ }++ #[test]+ fn the_journal_round_trips_every_managed_harness_name() {+ for &harness in EVERY_MANAGED_HARNESS {+ let name = journal_name(harness);+ assert_eq!(+ harness.as_str(),+ name,+ "{harness:?} no longer writes {name:?} into the recovery journal"+ );+ assert_eq!(+ harness_from_journal_name(name),+ Some(harness),+ "the recovery journal writes {name:?} for {harness:?} but cannot parse it back"+ );+ }+ }+#[test]fn run_sends_the_remote_identity_only_for_the_name_it_derives() {let tmp = tempfile::TempDir::new().unwrap();