Harden OpenPets memory capture and retrieval #1

Open
scriptoriumadmin wants to merge 1 commit from pr/memory-hardening into main

PR: Harden OpenPets memory capture and retrieval

Branch: pr/memory-hardening
Scope: Floating-chat memory reliability only.

Summary

Makes the local memory system more resilient in the floating chat path: capture is now logged and errors are caught instead of aborting the send, and retrieval gains a recall-intent fallback so questions like "what is my name?" still surface stored facts even when token overlap is low.

What changed

  • apps/desktop/src/openapi-chat.ts
    • Imports the logger error function correctly.
    • Wraps capturePromptMemories in try/catch and logs captured-count / failures.
  • apps/desktop/src/openpets-memory.ts
    • Adds a recall-intent regex (remember, recall, what is my name, who am i, etc.).
    • Falls back to the 3 most recent memories when the user is asking about themselves or no scored hits exist.
    • Refactors line-addition into a shared helper to keep scored hits + fallback + chat history under the character budget.
  • apps/desktop/src/renderer/src/main.tsx
    • Loads memories when the Settings view mounts so the Memory viewer is populated on open.

How to test

  1. Start the app and open floating chat.
  2. Send: remember that my favorite color is blue.
  3. Check the app log for memory captured.
  4. Start a new conversation and send: what is my favorite color?.
  5. The assistant reply should reference blue.

Backwards compatibility

  • Existing memory files are untouched.
  • Memory retrieval format remains the same for the model.
# PR: Harden OpenPets memory capture and retrieval **Branch:** `pr/memory-hardening` **Scope:** Floating-chat memory reliability only. ## Summary Makes the local memory system more resilient in the floating chat path: capture is now logged and errors are caught instead of aborting the send, and retrieval gains a recall-intent fallback so questions like "what is my name?" still surface stored facts even when token overlap is low. ## What changed - `apps/desktop/src/openapi-chat.ts` - Imports the logger `error` function correctly. - Wraps `capturePromptMemories` in try/catch and logs captured-count / failures. - `apps/desktop/src/openpets-memory.ts` - Adds a recall-intent regex (`remember`, `recall`, `what is my name`, `who am i`, etc.). - Falls back to the 3 most recent memories when the user is asking about themselves or no scored hits exist. - Refactors line-addition into a shared helper to keep scored hits + fallback + chat history under the character budget. - `apps/desktop/src/renderer/src/main.tsx` - Loads memories when the Settings view mounts so the Memory viewer is populated on open. ## How to test 1. Start the app and open floating chat. 2. Send: `remember that my favorite color is blue`. 3. Check the app log for `memory captured`. 4. Start a new conversation and send: `what is my favorite color?`. 5. The assistant reply should reference blue. ## Backwards compatibility - Existing memory files are untouched. - Memory retrieval format remains the same for the model.
scriptoriumadmin added 1 commit 2026-06-13 02:19:05 +00:00
- Catch and log memory capture failures in openapi-chat.
- Add recall-intent fallback for self-referential questions.
- Load memories when Settings view mounts.
This pull request has changes conflicting with the target branch.
  • apps/desktop/src/openapi-chat.ts
  • apps/desktop/src/openpets-memory.ts
  • apps/desktop/src/renderer/src/main.tsx
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin pr/memory-hardening:pr/memory-hardening
git checkout pr/memory-hardening

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git checkout main
git merge --no-ff pr/memory-hardening
git checkout pr/memory-hardening
git rebase main
git checkout main
git merge --ff-only pr/memory-hardening
git checkout pr/memory-hardening
git rebase main
git checkout main
git merge --no-ff pr/memory-hardening
git checkout main
git merge --squash pr/memory-hardening
git checkout main
git merge --ff-only pr/memory-hardening
git checkout main
git merge pr/memory-hardening
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: scriptoriumadmin/openpetswithchatandmcp#1
No description provided.