Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
fix(auto-improve): accept body field aliases
AkitaOnRailsaff0599955a0
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2bc1481b..7419bfbb 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -39,9 +39,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- `auto-improve` now tolerates common malformed LLM proposal shapes found duringlive testing: evidence arrays may contain bare quote strings instead of`{ page, quote }` objects, a missing `operation` defaults to the only supported- `create_or_update` operation, and proposals still missing required target data- are rejected by validation instead of turning the whole dry-run review into a- 502 response.+ `create_or_update` operation, markdown bodies can arrive as `body`,+ `markdown`, or `content`, and proposals still missing required target data are+ rejected by validation instead of turning the whole dry-run review into a 502+ response.- Admin destructive ops (`/admin/purge-project`, `/admin/move-project`) nowpropagate the authenticated actor (from the auth middleware's`Extension<ActorContext>`) into the admission context, so a `scope-guard`diff --git a/crates/ai-memory-consolidate/src/auto_improve.rs b/crates/ai-memory-consolidate/src/auto_improve.rsindex 1c37df73..2cdca631 100644--- a/crates/ai-memory-consolidate/src/auto_improve.rs+++ b/crates/ai-memory-consolidate/src/auto_improve.rs@@ -155,7 +155,7 @@ pub struct AutoImproveProposal {#[serde(default)]pub evidence: Vec<AutoImproveEvidence>,/// Markdown body without frontmatter.- #[serde(default)]+ #[serde(default, alias = "body", alias = "markdown", alias = "content")]pub body_markdown: String,}@@ -1106,6 +1106,36 @@ mod tests {assert!(warnings.is_empty());}+ #[test]+ fn proposal_body_accepts_common_markdown_aliases() {+ let raw: AutoImproveLlmResponse = serde_json::from_value(serde_json::json!({+ "summary": "ok",+ "proposals": [{+ "path": "procedures/release.md",+ "title": "Release Procedure",+ "kind": "procedure",+ "confidence": 0.91,+ "rationale": "The session repeated a release workflow with verification.",+ "evidence": ["run the full gate before release"],+ "body": "# Release Procedure\n\nRun the full gate before release."+ }],+ "rejected_candidates": []+ }))+ .unwrap();++ assert!(+ raw.proposals[0]+ .body_markdown+ .starts_with("# Release Procedure")+ );++ let (accepted, rejected, warnings) =+ validate_response(raw, &cfg(), &ExistingPageIndex::default());+ assert_eq!(accepted.len(), 1);+ assert!(rejected.is_empty());+ assert!(warnings.is_empty());+ }+#[test]fn prompt_uses_session_page_and_samples_high_signal_long_sessions() {let session_id = SessionId::new();