[Core] Add delete_thought tool and expose thought IDs in search/list#127
[Core] Add delete_thought tool and expose thought IDs in search/list#127asherdiamant wants to merge 3 commits into
Conversation
|
@claude review this PR |
1 similar comment
|
@claude review this PR |
|
I'll analyze this and get back to you. |
|
@claude review this PR |
|
Claude finished @matthallett1's task in 1m 56s —— View job PR Review: [Core] Add delete_thought tool and expose thought IDs in search/list
Summary: This PR adds a useful capability to OB1 — the ability to clean up stale or incorrect thoughts from within an AI session. The core idea is solid and the implementation is mostly clean, but there are a few issues worth addressing before merging. What's Good
Issues to Address1. Undocumented The PR description says "three small changes to More importantly, this is a semantic regression: the previous 2. Multi-tenant deletion scope (security) The The existing tools have this same characteristic (list/search also don't filter by user), so this is a pre-existing pattern issue — but deletion is more destructive than reading. At minimum, a note in the tool description warning that this operates across the full database (not per-user) would help users make an informed choice about deployment. 3. No guard against mass deletion A single bad call can permanently destroy data. There's no soft-delete, no recycle bin, and no confirmation step beyond the fetch-to-preview. The preview truncates at 100 characters, which may not be enough context for the AI to verify it's deleting the right thought (especially for short thoughts). Consider whether the full content (or at least more than 100 chars) should be shown before deletion, or at minimum whether the tool description should warn that this action is irreversible. 4. Minor: The type annotation in OverallThe core feature is valuable and the implementation is correct. The two things that need resolution before merge:
The security concern about multi-tenant access is consistent with how the existing tools work, so it's not a blocker unique to this PR — but it's worth explicitly noting given that deletion is irreversible. |
matthallett1
left a comment
There was a problem hiding this comment.
Great addition — delete_thought fills a real gap and exposing IDs in search/list is the right prerequisite. Two things to address:
1. Scope the PR to what's advertised. The capture_thought refactor (two-step upsert → single parallel insert) is a separate change that isn't mentioned in the PR title or description. If you want to ship that optimization, please either:
- Split it into its own PR with a clear description of what changed and why, OR
- Revert the capture_thought changes in this PR and only ship delete_thought + ID exposure
2. Keep integrations/kubernetes-deployment/index.ts in sync. The k8s deployment still exposes the old 4-tool interface without delete_thought and without IDs in search/list results. After this PR, users on the self-hosted PostgreSQL deployment can't use the new delete workflow at all. Please add the same changes to the k8s server, or at minimum document the divergence in the PR description.
Happy to merge once these are addressed!
Without a delete tool, stale or incorrect thoughts can only be superseded by capturing new "correction" entries, leading to clutter over time. Changes: - Add delete_thought tool (Tool 5) that deletes by UUID with confirmation - Include thought IDs in search_thoughts output (ID: <uuid>) - Include thought IDs in list_thoughts output ([<uuid>] prefix) - The match_thoughts RPC already returns id; this surfaces it to the user Tested on a live Supabase instance with the standard thoughts table schema. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add delete_thought tool to kubernetes-deployment/index.ts - Add id field to search_thoughts and list_thoughts in k8s deployment - Update delete_thought description: irreversible warning + single-user scope note Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
7c80a49 to
ed29eda
Compare
|
Rebased onto main branch which advanced in the meantime |
|
Both review items from @matthallett1 have been addressed in commit ed29eda:
Ready for re-review. |
|
Can anyone review this? @matthallett1? It seems stuck in the process. I just brought it up to date with the main branch so it's ready. |
|
By the way, after updating the branch, I received this error: Invalid workflow file: .github/workflows/ob1-gate.yml#L1 |
|
Thanks for putting this together. I’m going to close this PR because it isn’t suitable for OB1 as a community PR. This introduces a destructive core MCP tool by editing If this is something we want upstream, it needs a separate product/design decision first. |
@justfinethanku So I am not sure what changed. How can we prevent chaff and noise accumulation in OB1 otherwise? Is there another solution? I came up with it due to necessity, I'm sure others need it too. I don't need this specific change, but the need for the tool is real. |
|
I think my agent framed it poorly. Sorry about that. This should not have been closed, and when I get back to the office, I will re-open it. But I do think it's important to make destructive actions less accessible. Depreciating and versioning in a database should be the priority, not deletion. |
|
@justfinethanku |
|
Agreed that the ability to delete thoughts is an absolute necessity over time especially as the brain grows. Also agree that adding a "recycle bin is a great idea". Its common to have a retention policy for projects like this. |
…release Removes the delete_thought tool registration, the README table row, and the 14 -> 13 tool count everywhere (README intro, Expected Outcome, Tool Surface Area, metadata.json description). Renumbers the remaining section comments in index.ts. Adds an "Intentionally Excluded From This Release" section to the README explaining why delete_thought will ship in a follow-up: hard DELETE has no tombstone path on the enhanced-thoughts schema today, and the maintainer's PR NateBJones-Projects#127 guidance was "depreciate and version rather than delete." Shipping a safe soft-delete requires a `deleted_at` column and a restore_thought sibling that don't exist yet. Why: the drafted implementation was hard DELETE on a row with no deleted_at column, no audit trail, no restore path. Aligning with PR NateBJones-Projects#127 posture is cheaper than trying to bolt on soft-delete here without schema support — we'll land both tool and schema changes together in a later PR.
…release Removes the delete_thought tool registration, the README table row, and the 14 -> 13 tool count everywhere (README intro, Expected Outcome, Tool Surface Area, metadata.json description). Renumbers the remaining section comments in index.ts. Adds an "Intentionally Excluded From This Release" section to the README explaining why delete_thought will ship in a follow-up: hard DELETE has no tombstone path on the enhanced-thoughts schema today, and the maintainer's PR NateBJones-Projects#127 guidance was "depreciate and version rather than delete." Shipping a safe soft-delete requires a `deleted_at` column and a restore_thought sibling that don't exist yet. Why: the drafted implementation was hard DELETE on a row with no deleted_at column, no audit trail, no restore path. Aligning with PR NateBJones-Projects#127 posture is cheaper than trying to bolt on soft-delete here without schema support — we'll land both tool and schema changes together in a later PR.

What this does
Adds a
delete_thoughttool to the core MCP server and surfaces thought IDs insearch_thoughtsandlist_thoughtsoutput so thoughts can be referenced for deletion.Problem: Without a delete tool, stale or incorrect thoughts can only be superseded by capturing new "correction" entries, leading to clutter over time. There's no way to clean up the knowledge base from within an AI session.
Solution: Three small changes to
server/index.ts:delete_thoughttool — Accepts a thought UUID, confirms the thought exists, deletes it, and returns a preview of what was removedsearch_thoughts— Now includesID: <uuid>in each resultlist_thoughts— Now includes[<uuid>]prefix in each result, and selects theidcolumnThe
match_thoughtsRPC already returns theidcolumn — this just surfaces it in the tool output.What it requires
No new services or dependencies. Uses the existing
thoughtstable and Supabase client. Thedelete_thoughttool requiresservice_rolepermissions (already used by all other tools).Tested
Deployed and tested on a live Supabase instance with the standard Open Brain schema. Confirmed: