Repository navigation
Discussion threads with agent sessions - #5
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ssion Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…_at, bounds, hygiene, smoke) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Agents and people working on the same issue can now talk to each other through discussion threads. A thread lives in a scope, follows the memory permissions, and is linked to the memories it is about.
Design: docs/superpowers/specs/2026-11-07-threads-design.md. Plan: docs/superpowers/plans/2026-11-07-threads.md.
What's in it
20261107180000_threads.sql:selectthem.created_sessionandupdated_session, with an RLS check that the session belongs to the caller.memory_viewgains two label columns, andmemory_historyrecords the session.adm_delete_thread/admin_delete_thread.purge_tombstones.adm_delete_scopenow refuses while the scope still holds threads.create_thread,post,resolve_thread,reopen_thread,subscribe) create a session when given none and return its id. The agent passes that id back, or the samesession_labelif the id is lost.whats_newlists the session's subscribed threads that have posts from other sessions.read_thread,whats_new,unsubscribe) never create a session. An unknown label givesSession not found.sequnder a row lock, so the "seen up to here" marker can't skip a post that was committed late. A session's own posts are excluded from its unread count by session id; the marker isn't moved past them.PgThreadStoreand 11 member tools:create_thread,post,read_thread,list_threads,resolve_thread,reopen_thread,link_memory,unlink_memory,subscribe,unsubscribe,whats_new. Admins also getadmin_delete_thread.store,store_batchandupdateaccept an optionalsessionorsession_label.createdSessionandupdatedSessionlabels.recallattachesthreadsto memories that have links. Only explicitly linked threads are listed in v1.delete-thread,restore-threadanderase-thread.docs/claude-md-sample.md: a section users can copy into their ownCLAUDE.md. It says when and why to use the shared memory and threads: scopes, keeping status memories true, session labels, thewhats_newloop, and resolving with a note. It doesn't repeat the tool descriptions. The README links to it.Nothing that works today changes: the new parameters are optional, and result shapes only gain optional fields.
Testing
All of these were run locally on the final head:
deno task checksmoke.tsagainst the locally served functionCI runs check, unit, pgTAP and integration.
Rollout (after merge, each step with the maintainer's go-ahead)
backup.ts, run from a worktree of the pre-mergemain. The new script reads the thread tables, so it fails on a database that hasn't been migrated. The backup file it writes still restores with the new script.supabase db push --remote --dry-run. Only20261107180000_threads.sqlshould be pending.smoke.tswith an admin token.The migration only adds things. The function code already in production keeps working between the migration push and the function deploy.
Known follow-ups (not blocking)
mark_seen(…, NULL)marks the whole thread as seen. No tool passes null today; the fix needs a new migration with acoalesce.Invalid cursordoesn't reach that code path. Use a date that passes the format check, such as2026-13-45.read_threadrejectsafter: 0, and a cursor with a timezone offset of +16h or more still returnsDatabase error.guardhelper, session resolution and scope-id lookups each exist in two stores or tool files.🤖 Generated with Claude Code