Skip to content

Conversation

@amihos
Copy link
Contributor

@amihos amihos commented Nov 20, 2025

Summary

  • Fixes fundamental sector siloing issue in HSG algorithm
  • Enables cross-sector memory retrieval by searching ALL sectors
  • Adds tag matching to scoring formula for better relevance
  • Adds sector relationship matrix for graduated penalties

Problem

The HSG algorithm only searched within sectors matching the query's classification. A query "what did I do today" (classified as episodic) couldn't find memories stored in the reflective sector, even if they contained relevant information from today.

Solution

  • Search ALL 5 sectors by default instead of only classified sectors
  • Apply sector relationship penalties (0.3-0.8) based on semantic distance
  • Add tag matching score (0.10 weight) to boost memories with matching tags
  • Adjust scoring weights: similarity 0.6→0.4, recency 0.05→0.15
  • Add temporal marker detection for date-based queries

Test Results

Query Before After
"what did I do today 2025-11-20" ❌ NOT FOUND ✅ Position #4
"OpenMemory bug fix waypoint weight clamping migration" ❌ NOT FOUND ✅ Position #1 (score 2.065)
"PR 55 PR 56 embedding configuration mismatch" ❌ NOT FOUND ✅ Position #1 (score 2.895)

Test Plan

  • Verify cross-sector retrieval works (reflective memories found from episodic queries)
  • Verify tag matching boosts relevant results
  • Verify sector penalties don't over-penalize related sectors
  • Performance testing with large memory sets

🤖 Generated with Claude Code

The HSG algorithm had a fundamental flaw where it only searched within
sectors that matched the query's classification. This caused memories
stored in one sector (e.g., reflective) to be invisible to queries
classified as another sector (e.g., episodic).

Changes:
- Search ALL sectors by default instead of only classified sectors
- Add sector relationship matrix with graduated penalties (0.3-0.8)
- Add tag matching to scoring formula (0.10 weight)
- Adjust scoring weights: similarity 0.6→0.4, recency 0.05→0.15
- Add temporal marker detection for date-based queries
- Add compute_tag_match_score function for tag-based boosting
- Apply sector relationship penalty for cross-sector results

Before: Query "what did I do today 2025-11-20" couldn't find reflective
memories from today because it was classified as episodic and only
searched episodic sector.

After: Same query finds reflective memories and returns them with
appropriate sector penalty applied, enabling true cross-sector retrieval.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@nullure
Copy link
Member

nullure commented Nov 20, 2025

Hey amihos, thanks for your interest in OpenMemory. I appreciate your pull request but it has failed the Build Test, please resolve the issues.

Fixed TypeScript build errors by properly adding AWS_REGION,
AWS_ACCESS_KEY_ID, and AWS_SECRET_ACCESS_KEY properties to
the env configuration object. These properties were being
referenced in embed.ts but were missing from cfg.ts.

Changes:
- Removed incorrect aws_model property with 3-argument str() call
- Added AWS_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
  as individual properties with proper default values

Fixes TypeScript errors:
- cfg.ts(53,9): Expected 2 arguments, but got 3
- embed.ts: Property 'AWS_*' does not exist errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Member

@nullure nullure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nullure nullure merged commit 5321b25 into CaviraOSS:main Nov 22, 2025
1 check passed
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.

2 participants