Skip to content

fix: preserve newlines and show metadata in auto-recall#602

Open
daniel-rudaev wants to merge 1 commit intoCortexReach:masterfrom
D1DX:fix/recall-format-metadata
Open

fix: preserve newlines and show metadata in auto-recall#602
daniel-rudaev wants to merge 1 commit intoCortexReach:masterfrom
D1DX:fix/recall-format-metadata

Conversation

@daniel-rudaev
Copy link
Copy Markdown

Summary

Two changes to improve auto-recall context injection quality:

  1. Preserve newlines in sanitizeForContext — replace \r\n with literal \n instead of collapsing to a space. Line breaks carry semantic weight, especially in non-Latin scripts (Hebrew, CJK, Arabic) where a newline separates distinct thoughts. Collapsing to space merges them into an unreadable run-on.

  2. Show entry metadata in recall line format — display folder, date, and source from entry metadata instead of the generic [category:scope]. Users who import memories via memory-pro import with rich metadata (folder organization, source tracking, timestamps) lose all of that context in the current display format. The agent can't tell where a recalled memory came from.

Before:

- [other:global] all text collapsed into one line no paragraph structure visible

After:

- [Goals] 2024-05-30 (apple_notes) text with\npreserved line breaks

Context

Discovered while building an Apple Notes → memory-pro import pipeline. 1,800+ personal notes imported with folder, source, author, and date metadata. Auto-recall surfaced them with no attribution and destroyed the original formatting.

Test plan

  • Verify auto-recall injection preserves \n in recalled text
  • Verify folder/date/source from metadata appear in the recall prefix
  • Verify entries without metadata fields degrade gracefully (empty prefix parts omitted)

🤖 Generated with Claude Code

Two changes to improve auto-recall context quality:

1. sanitizeForContext: replace newlines with literal \n instead of
   collapsing to spaces. Preserves paragraph structure and meaning,
   especially important for non-Latin scripts (Hebrew, CJK) where
   line breaks carry semantic weight.

2. Auto-recall line format: show folder, date, and source from entry
   metadata instead of category:scope. Users store rich metadata via
   memory-pro import — the recall display should surface it.

Before: - [other:global] all text on one line no structure
After:  - [Goals] 2024-05-30 (apple_notes) text with\npreserved structure

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant