Skip to content

chore(agent): drop noteChat and Mem0 leftovers now that the API has no memory - #2630

Merged
Chadpiha merged 4 commits into
mainfrom
chore/remove-notechat-memory-leftovers
Oct 20, 2026
Merged

Chadpiha merged 4 commits into
mainfrom
chore/remove-notechat-memory-leftovers

Conversation

@greatcoat

Copy link
Copy Markdown
Contributor

Problem

https://github.com/OpenWhispr/openwhispr-api/pull/243 removed assistant memory: /api/agent/stream no longer reads or writes Mem0, and the memoryEnabled policy flag was retired. The desktop still carried the leftovers:

Change

  • Remove noteChat end to end: useChatStreaming.ts (and its memory comment), ReasoningService (three option types plus the forward to IPC), src/types/electron.ts (startAgentStream opts), and the /api/agent/stream body in ipcHandlers.js. preload.js passes the opts object through unchanged, so it needed no edit.
  • CLAUDE.md §17: note chat requests are ordinary agent requests. The API keeps no memory and adds nothing to the prompt, so the client's own system prompt is what the model sees.
  • src/types/policy.ts: keep memoryEnabled, and change its comment to say the API retired it in openwhispr-api#243, older API versions may still send it, and the app ignores it. Nothing in the desktop reads the field, and policy validation already allows it.

The note chat still skips the up-front library search. That depends on openNoteRef, not on noteChat, and is unchanged.

Tests

  • I changed the tests first and ran them against the old code. All four failed: useChatStreamingTools (note chat), two cloud cases in noteEditSurfaces, and reasoningServiceStreamingThink.
  • The tests now check that no cloud request carries noteChat: not from the note chat hook, not from the shared edit surfaces, and not from ReasoningService even when an old caller still passes it. The old "tells main it is a note chat" test is replaced by its opposite.
  • The policy-validation test that accepts memoryEnabled stays, with its comment updated.
  • tsc --noEmit is clean. Prettier and ESLint are clean on the touched files.
  • npm test: 7761 tests, 7327 passed, 4 failed, 429 skipped, 1 todo. The 4 failures are in noteEditorSummaryDeletion and noteCreateReconciliation, which don't touch this code. Those two files give the same result with and without this change. The skips are the usual local Electron-ABI and native-module skips.

Compatibility

🤖 Generated with Claude Code

greatcoat and others added 2 commits October 12, 2026 12:47
openwhispr-api#243 removed assistant memory, so the noteChat flag added
for #2551 (openwhispr-api#249) no longer changes anything server-side.
Drop it from the note chat hook, ReasoningService, the preload type and
the main-process request body. The API still accepts the field as
optional, so not sending it is safe on every API version.

Tests now pin that no cloud request carries noteChat.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mments

CLAUDE.md said note chat requests made the API file Mem0 memories under a
past-conversations heading. The API now keeps no memory and sends the
client's system prompt as-is. The memoryEnabled policy field stays, since
older API versions may still send it, but its comment now says the API
retired it and the app ignores it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greatcoat
greatcoat marked this pull request as ready for review October 12, 2026 22:12
@greatcoat
greatcoat requested a review from Chadpiha October 12, 2026 22:12
ReasoningService builds the streamFromIPC options as an explicit object,
so checking that noteChat is absent could only fail if that one key came
back. Pin the full key set instead, which also catches any other stray
flag a caller passes.

@Chadpiha Chadpiha left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving. Removing noteChat is safe on every API version, and every path I traced behaves the same as before.

What I checked

  • API #243 (29b7b79) is on API main and in the latest Production deploy. agentStreamSchema still accepts noteChat, doesn't use it, and quietly drops unknown fields. So both older desktops that still send the flag and this build work.
  • Nothing in src/, main.js, preload.js or scripts/ sets or reads noteChat anymore. preload.js passes opts through unchanged, as you said.
  • On Cloud, note chat still skips the up-front library search. That depends on openNoteRef (useChatStreaming.ts:496), not on the flag. The open note, tools and screenContext are all still sent. BYOK/local, whole-note actions, ChatView, the assistant panel and the onboarding demo all run through the same unchanged path.
  • The admin console already dropped the memory switch (#21), and mobile never sent noteChat or read memoryEnabled.
  • The changed tests fail against the old source (1 + 2 + 1) and pass on this branch merged into current main. tsc, ESLint and Prettier are clean. On the full suite, PR+main and plain main fail the same tests, all because the local better-sqlite3 build targets the wrong ABI.

Nits, none blocking

  1. test/services/reasoningServiceStreamingThink.test.js — "a cloud stream never tells main it is a note chat": ReasoningService builds the streamFromIPC opts as an explicit { systemPrompt, tools, screenContext }, so this can only fail if someone types noteChat: config.noteChat back in. Its "caller built before the API dropped memory" doesn't exist either; useChatStreaming is the only caller. Pinning the key set (deepEqual(Object.keys(opts).sort(), ["screenContext", "systemPrompt", "tools"])) would catch any stray flag.
  2. test/hooks/noteEditSurfaces.test.js:247: the assertion now also runs for BYOK, where noteChat never existed, so that half always passes. It does no harm.
  3. CLAUDE.md §17: I'd drop "(the noteChat flag went once openwhispr-api#243 removed memory)". The section describes how things work now, not their history.
  4. PR description: between #249 and #243, noteChat also skipped saving the turn to Mem0 (useMemories && !noteChat), so the flag did more than change the heading. This only matters for a self-hosted or preview API still running that range. There, this build would start saving note-chat turns to Mem0 again. Production isn't affected.
  5. Nothing tests the /api/agent/stream body that ipcHandlers.js builds, so the one-line removal there has no test. Not worth holding the PR for.

Optional: nothing in the desktop reads memoryEnabled now, so you could delete the field outright instead of rewording its comment. Keeping it is fine too.

@Chadpiha
Chadpiha merged commit c0d0490 into main Oct 20, 2026
14 checks 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