Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
fix(profile): keep page metadata fields an older harvest stored out of review
Felipe Neves Ricardo984f38539b96
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 5ab214a2..bedf9cc0 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -22,7 +22,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0habits waiting for promotion: a curated page's statement was its first lineof prose, which on an ADR-style page is a `**Status:** Accepted` or`**Date:**` field. Statements now skip those fields (a labelled sentence- such as `**Decision:** …` keeps its words). (#1175)+ such as `**Decision:** …` keeps its words), and fields harvested before the+ fix no longer reach `profile review` or the profile. (#1175)- Fixed `install-mcp --client claude-desktop` refusing to run on Linux:Anthropic ships Claude Desktop for Linux as a beta, and the command nowwrites `$XDG_CONFIG_HOME/Claude/claude_desktop_config.json` (defaultdiff --git a/crates/ai-memory-consolidate/src/profile.rs b/crates/ai-memory-consolidate/src/profile.rsindex 0836b4ce..9dc286fa 100644--- a/crates/ai-memory-consolidate/src/profile.rs+++ b/crates/ai-memory-consolidate/src/profile.rs@@ -28,7 +28,7 @@ use std::sync::Arc;use ai_memory_core::profile::{EffectiveProfileShare, PROFILE_CATEGORIES, PROFILE_PATH_PREFIX, ProfileCandidateSource,- ProfileEntry, ProfileGenerality, ProfileSettings,+ ProfileEntry, ProfileGenerality, ProfileSettings, is_metadata_field,};use ai_memory_core::{ActorContext, IdentityKey, PagePath, Tier, UserId, WorkspaceId};use ai_memory_llm::{ChatMessage, ChatRequest, LlmProvider, complete_structured};@@ -1172,6 +1172,13 @@ pub fn converge(candidates.iter().copied()+ // A page's metadata field (`**Status:** Accepted`) describes the+ // page, not a habit. Statements no longer start on one, but+ // candidates harvested before that still sit in the store.+ .filter(|row| {+ row.candidate.source != ProfileCandidateSource::Page+ || !is_metadata_field(&row.candidate.statement)+ }).partition(|row| row.candidate.source == ProfileCandidateSource::Stack);// Stack signals: one entry per language seen in enough projects.@@ -2478,6 +2485,33 @@ mod tests {1_790_000_000_000_000 + n * 86_400_000_000}+ /// A page metadata field stored by an earlier harvest never waits for+ /// promotion; the same page's real statement still does (control).+ #[test]+ fn a_stored_page_metadata_field_is_not_a_waiting_habit() {+ let page = |project: &str, statement: &str| {+ let mut r = row(project, statement, day(1), ProfileGenerality::Project);+ r.candidate.source = ProfileCandidateSource::Page;+ r.candidate.source_ref = format!("page:decisions/{project}.md");+ r+ };+ let status = page("alpha", "Status:** Accepted");+ let date = page("beta", "Date:** 2026-10-01");+ let decision = page("alpha", "Every store opens SQLite in WAL mode.");+ let plan = converge(&[&status, &date, &decision], &[], &[], 2, 1);+ let waiting: Vec<&str> = plan.waiting.iter().map(|w| w.statement.as_str()).collect();+ assert_eq!(waiting, ["Every store opens SQLite in WAL mode."]);++ // The same words from a prompt are not a page field and stay.+ let said = row(+ "alpha",+ "Status:** Accepted",+ day(1),+ ProfileGenerality::Project,+ );+ assert_eq!(converge(&[&said], &[], &[], 2, 1).waiting.len(), 1);+ }+/// Agent output in the prompt channel (a lead agent's brief, a pasted/// review) is not the user stating a preference (#1148).#[test]diff --git a/crates/ai-memory-core/src/profile.rs b/crates/ai-memory-core/src/profile.rsindex 3d8d83de..b9c69de8 100644--- a/crates/ai-memory-core/src/profile.rs+++ b/crates/ai-memory-core/src/profile.rs@@ -558,8 +558,11 @@ const FIELD_VALUE_MAX_WORDS: usize = 4;/// Whether `line` is a page metadata field: an emphasized label with a short/// value, the way ADR-style pages open (`**Status:** Accepted`,/// `**Date**: 2026-10-01`). It describes the page, so it is never the page's-/// statement.-fn is_metadata_field(line: &str) -> bool {+/// statement. The form with the leading `**` already trimmed+/// (`Status:** Accepted`), which candidates harvested before this check+/// still carry, counts too.+#[must_use]+pub fn is_metadata_field(line: &str) -> bool {field_value(line).is_some_and(|value| {value.split_whitespace().count() <= FIELD_VALUE_MAX_WORDS && !value.ends_with(['.', '!'])})