Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
fix(consolidate): key a non-Latin rule name on the folded title
AkitaOnRails1756694f7c32
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex db537eb1..289bd063 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -12,7 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0and others) overwriting each other: multi-page consolidation named every suchrule page `_rules/rule.md`, so only the last survived in the live rules list.Each rule now gets a `_rules/rule-<hash>.md` name derived from its title. Rule- titles in Latin scripts are named as before. (#1191)+ titles in Latin scripts are named as before. A restated non-Latin title+ (case, spacing or punctuation aside) updates its own page. An existing+ `_rules/rule.md` is left in place; delete it once its rule is restated.+ (#1191)- Fixed generated TypeScript integrations (OpenCode, OpenCode 2, OMP,Pi, OpenClaw) flashing a console window on Windows.`discoverRemoteIdentity` spawned `git config --get remote.<name>.url`diff --git a/crates/ai-memory-consolidate/src/consolidator.rs b/crates/ai-memory-consolidate/src/consolidator.rsindex 813709de..9be9d776 100644--- a/crates/ai-memory-consolidate/src/consolidator.rs+++ b/crates/ai-memory-consolidate/src/consolidator.rs@@ -1732,9 +1732,19 @@ fn slugify_for_rule(title: &str) -> String {// A title with no ASCII letter or digit (Cyrillic, CJK, ...) would// share one name with every other such title, and each rule would// overwrite the last. Name it after the title instead. A title with- // no letter or digit at all has nothing to name it by.- if decomposed.chars().any(char::is_alphanumeric) {- let digest = Sha256::digest(decomposed.trim().as_bytes());+ // no letter or digit at all has nothing to name it by. The hash takes+ // the same fold as the ASCII slug (lower-cased words, separators+ // collapsed) so a restated rule updates its own page; combining+ // marks stay with their letter so `й` and `и` remain distinct.+ let in_word = |c: char| c.is_alphanumeric() || ('\u{0300}'..='\u{036F}').contains(&c);+ let key = decomposed+ .split(|c: char| !in_word(c))+ .filter(|word| !word.is_empty())+ .map(str::to_lowercase)+ .collect::<Vec<_>>()+ .join("-");+ if key.chars().any(char::is_alphanumeric) {+ let digest = Sha256::digest(key.as_bytes());let hex: String = digest.iter().take(4)@@ -3255,6 +3265,15 @@ mod tests {slugify_for_rule("\u{439}\u{43e}"),slugify_for_rule("\u{438}\u{306}\u{43e}"));+ // A restated title updates its own page, as an ASCII one does: case,+ // spacing and punctuation do not name a new rule.+ assert_eq!(slugify_for_rule("не коммитить секреты!"), russian);+ assert_eq!(slugify_for_rule("НЕ КОММИТИТЬ, СЕКРЕТЫ."), russian);+ // A combining mark is part of its letter, not a separator.+ assert_ne!(+ slugify_for_rule("\u{439}\u{43e}"),+ slugify_for_rule("\u{438} \u{43e}")+ );for slug in [chinese, russian] {let path = format!("_rules/{slug}.md");let path = PagePath::new(path).unwrap();