Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

handoff: keep a Cursor subagent a subagent when its Composer record is listed

Claude925609fd60ef
diff --git a/cli/beacon/internal/handoff/cursor.go b/cli/beacon/internal/handoff/cursor.go
index e8172abd..9da91725 100644
--- a/cli/beacon/internal/handoff/cursor.go
+++ b/cli/beacon/internal/handoff/cursor.go
@@ -51,8 +51,15 @@ func (s *cursorSource) List() ([]Session, error) {
}
// A conversation stored twice is listed once: as the transcript when cursor-agent can
// reopen it, else as the Composer record, which is Cursor's own conversation store.
- if prev, ok := byID[ref.ID]; ok && !cursorPrefer(session, prev) {
- continue
+ prev, seen := byID[ref.ID]
+ if seen && !cursorPrefer(session, prev) {
+ session, prev = prev, session
+ }
+ if seen {
+ // Only the transcript knows a conversation is a subagent's; the Composer record kept
+ // in its place is still that subagent.
+ session.Subagent = session.Subagent || prev.Subagent
+ session.ParentID = firstNonEmpty(session.ParentID, prev.ParentID)
}
byID[ref.ID] = session
}
diff --git a/cli/beacon/internal/handoff/cursor_test.go b/cli/beacon/internal/handoff/cursor_test.go
index fe63187f..766f0d85 100644
--- a/cli/beacon/internal/handoff/cursor_test.go
+++ b/cli/beacon/internal/handoff/cursor_test.go
@@ -115,6 +115,9 @@ func cursorFixture(t *testing.T) cursorStores {
"bubbleId:cli-1:b1": `{"type":1,"text":"tidy the router"}`,
"composerData:ide-2": composer("ide-2", "Plot the latency", cursorUpdated.Add(-time.Hour)),
"bubbleId:ide-2:b1": `{"type":1,"text":"plot the latency"}`,
+ // Cursor also keeps a Composer record for a subagent; only its transcript says it is one.
+ "composerData:sub-1": composer("sub-1", "read the csv", cursorUpdated.Add(-3*time.Hour)),
+ "bubbleId:sub-1:b1": `{"type":1,"text":"read the csv"}`,
} {
if _, err := db.Exec(`INSERT INTO cursorDiskKV(key, value) VALUES (?, ?)`, key, []byte(value)); err != nil {
t.Fatal(err)