Skip to content

[integrations] delete-thought-mcp: audit trail before hard delete - #449

Open
eazene wants to merge 1 commit into
NateBJones-Projects:mainfrom
eazene:contrib/eazene/delete-thought-audit-mcp
Open

[integrations] delete-thought-mcp: audit trail before hard delete#449
eazene wants to merge 1 commit into
NateBJones-Projects:mainfrom
eazene:contrib/eazene/delete-thought-audit-mcp

Conversation

@eazene

@eazene eazene commented Jul 14, 2026

Copy link
Copy Markdown

Contribution Type

  • Integration (/integrations)

What does this do?

Wires the existing delete-thought-mcp integration into the thought_audit schema. Before each hard delete, it writes an append-only audit row preserving the prior content and metadata (diff.previous_content / diff.previous_metadata), so a deleted thought is recoverable from the audit trail alone. This implements the "Extension hook" that the integration's header comment previously described but left unbuilt.

Requirements

  • The thought_audit schema (schemas/thought-audit) must be installed. The audit write targets public.thought_audit (service_role needs the SELECT/INSERT grants that schema provides).
  • No new external services or dependencies.

Behavior notes

  • The audit write is fire-and-forget by contract: a failure is logged via console.warn but never blocks the delete, matching the guarantee documented in schemas/thought-audit.
  • The write happens before the delete so prior content is preserved even if the delete step is interrupted.
  • The pre-flight fetch now also selects metadata, used to populate source / author_session_id and diff.previous_metadata.
  • Success message now signals whether the audit row was written.

Checklist

  • I've read CONTRIBUTING.md
  • Integration already has a README.md; header doc comment updated to describe the audit behavior
  • No metadata.json changes required (no new service/tool/primitive deps)
  • I tested this on my own Open Brain instance (schema installed; the exact service_role INSERT verified against grants + CHECK + JSONB shape; function redeployed and live)
  • No credentials, API keys, or secrets are included

🤖 Generated with Claude Code

Wire delete-thought-mcp into the thought_audit schema. Before each hard
delete, insert an append-only audit row preserving the prior content and
metadata under diff.previous_content / diff.previous_metadata, so a deleted
thought is recoverable from the audit trail alone.

The audit write is fire-and-forget by contract: a failure is logged via
console.warn but never blocks the delete (matches schemas/thought-audit).
The pre-flight fetch now also selects metadata so source / author_session_id
and previous_metadata can be preserved.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LxP7M99m4EF5Ve7rn3SNKH
@github-actions github-actions Bot added the integration Contribution: MCP extension or capture source label Jul 14, 2026
@github-actions

Copy link
Copy Markdown

OB1 PR Gate

Folder structure — All files are in allowed directories
Required files — README.md and metadata.json found in all contribution folders
Metadata valid — All metadata.json files passed JSON Schema validation
No credentials — No API keys, tokens, or secrets detected
SQL safety — No destructive SQL or core table modifications
Category artifacts — Required file types present for each category
PR format — Title follows [category] Description format
No binary blobs — No oversized or binary files
README completeness — All READMEs include Prerequisites, Steps, and Expected Outcome
Contribution dependencies — All declared skill and primitive dependencies exist and are linked in README
LLM clarity review — Covered by Claude PR Review workflow
Remote MCP pattern — No local MCP server patterns detected — uses remote MCP correctly
Tool audit link — Extensions/integrations link to the MCP Tool Audit guide
Scope check — All changes are within the contribution folder(s)
Internal links — All relative links in READMEs resolve to existing files

Result: All 15 checks passed! Ready for human review.


Post-Merge Tasks

These don't block merge — they're reminders for admins after this PR lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration Contribution: MCP extension or capture source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant