Skip to content

Add memory retention cleanup during consolidation#17

Open
coe0718 wants to merge 2 commits intoghostwright:mainfrom
coe0718:memory-retention-policy
Open

Add memory retention cleanup during consolidation#17
coe0718 wants to merge 2 commits intoghostwright:mainfrom
coe0718:memory-retention-policy

Conversation

@coe0718
Copy link
Copy Markdown
Contributor

@coe0718 coe0718 commented Mar 31, 2026

Part of #1.

What changed

  • add retention filter helpers plus Qdrant scroll support for cleanup queries
  • prune stale low-signal episodic memories after consolidation
  • prune long-expired superseded semantic facts after consolidation
  • document the retention step and cover it with focused memory tests

Why

The earlier memory PRs improved ranking, contradiction handling, and startup context, but stale memories were still only being down-ranked at retrieval time. This change adds the forgetting side of the system so low-value episodes and obsolete facts can age out during consolidation.

Validation

  • bun test src/memory/__tests__/episodic-retention.test.ts src/memory/__tests__/semantic-retention.test.ts src/memory/__tests__/consolidation.test.ts src/memory/__tests__/qdrant-client.test.ts
  • bun run typecheck
  • bun run lint
  • bun test

@coe0718 coe0718 marked this pull request as ready for review March 31, 2026 21:30
@coe0718
Copy link
Copy Markdown
Contributor Author

coe0718 commented Apr 8, 2026

Ill fix these if they are still wanted, if not close them

imonlinux added a commit to imonlinux/phantom that referenced this pull request Apr 24, 2026
Complete security review and implementation of fixes for Nextcloud Talk
integration based on comprehensive security audit findings.

HIGH PRIORITY fixes (security-critical):
- ghostwright#1: Implement replay attack protection with LRU cache (5-minute TTL)
- ghostwright#2: Add 64KB request size limit before body buffering
- ghostwright#4: Replace Date.now() with crypto.randomUUID() for unique IDs
- ghostwright#7: Fix JSON unwrap logic for ActivityStreams Note objects
- ghostwright#11: Replace 'Error:' text sniffing with runtime error events

Logic and security fixes:
- ghostwright#3: Fix msgId/msg name collision in error handling
- ghostwright#5: Improve parseConversationId to handle colons in tokens
- ghostwright#6: Reject webhooks without target.id instead of silent fallback
- ghostwright#8: Normalize emoji to avoid variation selector validation issues
- ghostwright#9: Handle 404/409 reaction responses as success conditions
- ghostwright#10: Make setReaction return boolean for proper error handling
- ghostwright#12: Improve bot loop guard with actorId checking

Best practices and polish:
- ghostwright#13: Make port configurable instead of hardcoded 3200
- ghostwright#14: Move webhookPath default normalization to constructor
- ghostwright#15: Fix health check path precedence (check webhook first)
- ghostwright#16: Add exponential backoff retry for 5xx/429 responses
- ghostwright#17: Add URL validation and encoding for talkServer config
- ghostwright#18: Document HMAC signing asymmetry (inbound vs outbound)
- ghostwright#20: Import randomUUID explicitly from node:crypto
- ghostwright#21: Add reactions: true to channel capabilities
- ghostwright#22: Namespace environment variables with NEXTCLOUD_ prefix

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