Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
fix(mcp): keep the trailing # of patch headings such as C#
Vinícius DS Andrade8d1b816e59c4
diff --git a/crates/ai-memory-mcp/src/page_patch.rs b/crates/ai-memory-mcp/src/page_patch.rsindex 977058dd..9bdce439 100644--- a/crates/ai-memory-mcp/src/page_patch.rs+++ b/crates/ai-memory-mcp/src/page_patch.rs@@ -312,8 +312,11 @@ fn heading(line: &str) -> Option<(u8, String)> {return None;}let mut title = trimmed[hashes..].trim().to_owned();- if let Some(without_closing) = title.strip_suffix('#') {- title = without_closing.trim_end_matches('#').trim_end().to_owned();+ // A trailing `#` run closes the heading only after a space or tab+ // (CommonMark), so `## C#` keeps its `#`.+ let without_closing = title.trim_end_matches('#');+ if without_closing.is_empty() || without_closing.ends_with([' ', '\t']) {+ title = without_closing.trim_end().to_owned();}(!title.is_empty()).then_some((hashes as u8, title))}