[integrations] update_thought MCP with if_unchanged_since#228
Open
txcfi-scott wants to merge 1 commit intoNateBJones-Projects:mainfrom
Open
[integrations] update_thought MCP with if_unchanged_since#228txcfi-scott wants to merge 1 commit intoNateBJones-Projects:mainfrom
txcfi-scott wants to merge 1 commit intoNateBJones-Projects:mainfrom
Conversation
Adds a standalone MCP Edge Function that exposes a single update_thought tool. Supports shallow metadata merges, content replacement with re-embedding, and optional if_unchanged_since optimistic concurrency for multi-writer setups. Deploys as its own Supabase Edge Function and registers as a separate custom connector — the core server/index.ts is untouched. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Hey @txcfi-scott — welcome to Open Brain Source! 👋 Thanks for submitting your first PR. The automated review will run shortly and check things like metadata, folder structure, and README completeness. If anything needs fixing, the review comment will tell you exactly what. Once the automated checks pass, a human admin will review for quality and clarity. Expect a response within a few days. If you have questions, check out CONTRIBUTING.md or open an issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does
Adds a standalone MCP Edge Function that exposes a single new tool:
update_thought(id, content?, metadata_patch?, if_unchanged_since?).The core
server/index.tsis curated and does not expose an update path. This integration adds one without touching the core server — it deploys as its own Supabase Edge Function and is registered as a separate custom connector alongside the main Open Brain connector.Why it matters
Once more than one agent writes to the same Open Brain (Claude Desktop + Codex + a background worker, or a shared brain across teammates), last-write-wins silently drops concurrent edits. Optimistic concurrency is the cheapest fix:
updated_at(T0).update_thoughtwithif_unchanged_since = T0.updated_atis still<= T0, the update proceeds. If another writer has advanced it past T0, the server rejects withSTALE_READand the caller can re-fetch and retry.Omitting
if_unchanged_sincekeeps the old last-write-wins behaviour — fully backward compatible.What it requires
thoughtstable + theupdate_updated_attrigger from the getting-started guide).content(re-embedding path).Tested
Deployed against a live Supabase Open Brain instance. Verified:
metadata_patch-only updates succeed without an OpenRouter key.contentupdates regenerate the embedding and the row'supdated_atadvances.if_unchanged_sincefrom its pre-mutation read, receive a clearSTALE_READerror once the first writer has committed.Files touched
Only
integrations/update-thought-mcp/— stays within the contribution scope check.Attribution
Adapted from a multi-participant capture design used across live Claude / ChatGPT / Codex sessions. Released here as a standalone integration so any Open Brain user can opt in without modifying the core server.