Skip to content

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

Merge remote-tracking branch 'origin/main' into claude/gallant-curie-cqv4rr-m-cursor

Claude28159e323f7c
diff --cc cli/beacon/internal/handoff/fixtures_test.go
index 1528b27d,ba0eb356..f08049eb
--- a/cli/beacon/internal/handoff/fixtures_test.go
+++ b/cli/beacon/internal/handoff/fixtures_test.go
@@@ -24,7 -24,7 +24,7 @@@ var
// runtime the fixture leaves at its default reads only the test's HOME.
func isolateRuntimeEnv(t *testing.T) {
t.Helper()
- for _, name := range []string{"PI_CODING_AGENT_DIR", "PRIME_AGENT_CODING_AGENT_DIR", "DSH_HOME", "XDG_CONFIG_HOME", "APPDATA", "CURSOR_CONFIG_DIR"} {
- for _, name := range []string{"PI_CODING_AGENT_DIR", "PRIME_AGENT_CODING_AGENT_DIR", "DSH_HOME", "OPENCLAW_STATE_DIR"} {
++ for _, name := range []string{"PI_CODING_AGENT_DIR", "PRIME_AGENT_CODING_AGENT_DIR", "DSH_HOME", "OPENCLAW_STATE_DIR", "XDG_CONFIG_HOME", "APPDATA", "CURSOR_CONFIG_DIR"} {
t.Setenv(name, "")
}
}
diff --cc cli/beacon/internal/handoff/resume_test.go
index dfce423e,c79bd8f1..e6c7962b
--- a/cli/beacon/internal/handoff/resume_test.go
+++ b/cli/beacon/internal/handoff/resume_test.go
@@@ -26,7 -26,7 +26,7 @@@ func installed(names ...string) func(st
var allRuntimes = installed("claude", "codex", "opencode", "cline", "pi", "prime-agent", "droid",
"omp", "gemini", "qwen", "kiro-cli", "agy", "devin", "muse", "openhands", "goose", "copilot",
- "hermes", "fx", "grok", "cursor-agent")
- "hermes", "fx", "grok", "openclaw")
++ "hermes", "fx", "grok", "openclaw", "cursor-agent")
// resumableSession is a session whose directory and session file both exist.
func resumableSession(t *testing.T, harness, id string) Session {
@@@ -86,7 -86,8 +86,9 @@@ func TestPlanResumeStartsANewSessionInE
{HarnessFactory, "droid", nil},
{HarnessCopilot, "copilot", []string{"-i"}},
{HarnessGrok, "grok", []string{"--permission-mode", "default"}},
+ // {key} stands for the fresh Gateway session key the prompt derives.
+ {HarnessOpenClaw, "openclaw", []string{"tui", "--session", "{key}", "--message"}},
+ {HarnessCursor, "cursor-agent", nil},
{HarnessOhMyPi, "omp", []string{"--approval-mode=always-ask"}},
{HarnessGemini, "gemini", []string{"--approval-mode", "default", "--prompt-interactive"}},
{HarnessQwen, "qwen", []string{"--approval-mode", "default", "--prompt-interactive"}},
diff --cc cli/beacon/internal/handoff/runtimes.go
index 3aa8ff0d,70c69c4f..ee116674
--- a/cli/beacon/internal/handoff/runtimes.go
+++ b/cli/beacon/internal/handoff/runtimes.go
@@@ -69,7 -69,7 +70,8 @@@ const
HarnessDSH = dshsession.Harness
HarnessFx = fxsession.Harness
HarnessGrok = groksession.Harness
+ HarnessOpenClaw = openclawsession.Harness
+ HarnessCursor = cursorsession.Harness
// Runtimes Beacon starts but whose sessions it reads only from the runtime log.
HarnessOhMyPi = "omp"
@@@ -282,26 -282,27 +284,47 @@@ var runtimes = []Runtime
ResumesInSessionDir: true,
},
},
+ {
+ Harness: HarnessOpenClaw,
+ Label: "OpenClaw Gateway",
+ Aliases: []string{"openclaw", "openclaw-gateway"},
+ NewSource: func(dir string) Source { return &openClawSource{dir: dir} },
+ // The TUI is a client of the Gateway: it needs the Gateway running, and a conversation lives
+ // on the Gateway under its session key, not its transcript id. --deliver stays off, so
+ // replies are not sent out through the Gateway's chat channels.
+ Command: &runtimeCommand{
+ Executable: "openclaw",
+ Resume: func(s Session) ([]string, bool) {
+ if s.Key == "" {
+ return nil, false
+ }
+ return []string{"tui", "--session", s.Key}, true
+ },
+ NewSession: func(prompt string) []string {
+ return []string{"tui", "--session", openClawNewSessionKey(prompt), "--message", prompt}
+ },
+ },
+ },
+ {
+ Harness: HarnessCursor,
+ Label: "Cursor",
+ NewSource: func(dir string) Source { return &cursorSource{dir: dir} },
+ // cursor-agent asks before running commands unless given --force; Beacon never passes it.
+ Command: &runtimeCommand{
+ Executable: "cursor-agent",
+ Resume: func(s Session) ([]string, bool) {
+ // --resume takes a CLI chat id. IDE conversations and subagent transcripts are not
+ // chats the CLI can load.
+ if !cursorCLIChat(s) {
+ return nil, false
+ }
+ return []string{"--resume", s.ID}, true
+ },
+ NewSession: func(prompt string) []string { return []string{prompt} },
+ // cursor-agent looks a chat id up under a hash of the directory it is started in.
+ ResumesInSessionDir: true,
+ },
+ },
// The runtimes below keep no session store Beacon reads. Their sessions come from Beacon's
// runtime log, so they always continue from a brief; each can also be the runtime another
diff --cc docs/cli/handoff.mdx
index aaa89ce5,0810ff2b..28f31cd5
--- a/docs/cli/handoff.mdx
+++ b/docs/cli/handoff.mdx
@@@ -31,11 -31,13 +31,14 @@@ Sessions come from each runtime's own l
| DeepSeek Harness | `~/.dsh/sessions` (or under `DSH_HOME`) | `dsh` |
| fx | `~/.fx/sessions` | `fx` |
| Grok Build | `~/.grok/sessions` | `grok` |
+ | OpenClaw Gateway | `~/.openclaw/agents/<agent>/sessions` for every agent (or under `OPENCLAW_STATE_DIR`) | `openclaw` |
+| Cursor | `~/.cursor/projects` (agent transcripts) and Cursor's global storage `state.vscdb` (Composer conversations) | `cursor` |
- When a Codex thread has more than one rollout file, `beacon handoff` lists it once, under its newest file. Cline can hold the same task both as a CLI session and in its older task history; the CLI session is the copy that is listed. Cline kanban cards are not sessions and are not listed. Prime Agent subagent transcripts, under `session-artifacts`, are listed as subagents of the session that started them. Hermes Agent delegate subagents are listed as subagents of the session that spawned them. When Hermes compresses a long conversation it continues it in a new session; each of those sessions is listed, and reopening any of them reopens the latest. A DeepSeek Harness session that DSH spawned for delegated work is listed as a subagent of the session that started it; a fork of a session is listed as a session of its own. Grok Build keeps its subagents' child sessions in the same tree as other sessions; those whose `summary.json` has a subagent `session_kind` are listed as subagents. A Cursor conversation can be stored both as a transcript and as a Composer record under one id; it is listed once, as the transcript when `cursor-agent` can reopen it and as the Composer record otherwise. Cursor subagent transcripts are listed as subagents of the conversation that started them.
-When a Codex thread has more than one rollout file, `beacon handoff` lists it once, under its newest file. Cline can hold the same task both as a CLI session and in its older task history; the CLI session is the copy that is listed. Cline kanban cards are not sessions and are not listed. Prime Agent subagent transcripts, under `session-artifacts`, are listed as subagents of the session that started them. Hermes Agent delegate subagents are listed as subagents of the session that spawned them. When Hermes compresses a long conversation it continues it in a new session; each of those sessions is listed, and reopening any of them reopens the latest. A DeepSeek Harness session that DSH spawned for delegated work is listed as a subagent of the session that started it; a fork of a session is listed as a session of its own. Grok Build keeps its subagents' child sessions in the same tree as other sessions; those whose `summary.json` has a subagent `session_kind` are listed as subagents. OpenClaw transcript ids are unique only within one agent. When two agents hold the same id, both are listed, and `export` and `resume` report the id as ambiguous rather than pick one.
++When a Codex thread has more than one rollout file, `beacon handoff` lists it once, under its newest file. Cline can hold the same task both as a CLI session and in its older task history; the CLI session is the copy that is listed. Cline kanban cards are not sessions and are not listed. Prime Agent subagent transcripts, under `session-artifacts`, are listed as subagents of the session that started them. Hermes Agent delegate subagents are listed as subagents of the session that spawned them. When Hermes compresses a long conversation it continues it in a new session; each of those sessions is listed, and reopening any of them reopens the latest. A DeepSeek Harness session that DSH spawned for delegated work is listed as a subagent of the session that started it; a fork of a session is listed as a session of its own. Grok Build keeps its subagents' child sessions in the same tree as other sessions; those whose `summary.json` has a subagent `session_kind` are listed as subagents. OpenClaw transcript ids are unique only within one agent. When two agents hold the same id, both are listed, and `export` and `resume` report the id as ambiguous rather than pick one. A Cursor conversation can be stored both as a transcript and as a Composer record under one id; it is listed once, as the transcript when `cursor-agent` can reopen it and as the Composer record otherwise. Cursor subagent transcripts are listed as subagents of the conversation that started them.
- `--store-dir <runtime>=<path>` takes the location in the table: for Pi its sessions directory, as `beacon endpoint pi sync --sessions-dir` does, and for Prime Agent the agent directory holding both of its roots. For Factory Droid it is the sessions directory, as `beacon endpoint factory sync --sessions-dir` does. For GitHub Copilot CLI it is the `~/.copilot` directory that holds `session-state`, as `beacon endpoint copilot sync --copilot-dir` does. For Hermes Agent it is the `state.db` file, as `beacon endpoint hermes sync --db` does. For DeepSeek Harness it is its `DSH_HOME`, as `beacon endpoint dsh sync --dsh-home` does. For fx it is its sessions directory, as `beacon endpoint fx sync --sessions-dir` does. For Grok Build it is its sessions directory, as `beacon endpoint grok sync --sessions-dir` does. Like that sync, `beacon handoff` does not read `GROK_HOME`; pass `--store-dir grok=$GROK_HOME/sessions` when it is set. For Cursor it is the projects directory, as `beacon endpoint cursor sync --projects-dir` does. Cursor's global storage database is always read from its default location.
+ OpenClaw Gateway sessions are read from the JSONL transcripts and the `sessions.json` index in each agent's `sessions` directory, as `beacon endpoint openclaw sessions sync` reads them. Recent OpenClaw releases keep live sessions in a per-agent SQLite database and treat that directory as legacy, so sessions that exist only in the database are not listed.
+
-`--store-dir <runtime>=<path>` takes the location in the table: for Pi its sessions directory, as `beacon endpoint pi sync --sessions-dir` does, and for Prime Agent the agent directory holding both of its roots. For Factory Droid it is the sessions directory, as `beacon endpoint factory sync --sessions-dir` does. For GitHub Copilot CLI it is the `~/.copilot` directory that holds `session-state`, as `beacon endpoint copilot sync --copilot-dir` does. For Hermes Agent it is the `state.db` file, as `beacon endpoint hermes sync --db` does. For DeepSeek Harness it is its `DSH_HOME`, as `beacon endpoint dsh sync --dsh-home` does. For fx it is its sessions directory, as `beacon endpoint fx sync --sessions-dir` does. For Grok Build it is its sessions directory, as `beacon endpoint grok sync --sessions-dir` does. Like that sync, `beacon handoff` does not read `GROK_HOME`; pass `--store-dir grok=$GROK_HOME/sessions` when it is set. For OpenClaw Gateway it is its state directory, as `beacon endpoint openclaw sessions sync --openclaw-dir` does.
++`--store-dir <runtime>=<path>` takes the location in the table: for Pi its sessions directory, as `beacon endpoint pi sync --sessions-dir` does, and for Prime Agent the agent directory holding both of its roots. For Factory Droid it is the sessions directory, as `beacon endpoint factory sync --sessions-dir` does. For GitHub Copilot CLI it is the `~/.copilot` directory that holds `session-state`, as `beacon endpoint copilot sync --copilot-dir` does. For Hermes Agent it is the `state.db` file, as `beacon endpoint hermes sync --db` does. For DeepSeek Harness it is its `DSH_HOME`, as `beacon endpoint dsh sync --dsh-home` does. For fx it is its sessions directory, as `beacon endpoint fx sync --sessions-dir` does. For Grok Build it is its sessions directory, as `beacon endpoint grok sync --sessions-dir` does. Like that sync, `beacon handoff` does not read `GROK_HOME`; pass `--store-dir grok=$GROK_HOME/sessions` when it is set. For OpenClaw Gateway it is its state directory, as `beacon endpoint openclaw sessions sync --openclaw-dir` does. For Cursor it is the projects directory, as `beacon endpoint cursor sync --projects-dir` does. Cursor's global storage database is always read from its default location.
fx records no session title, so an fx session is listed under its first prompt, and its directory is the workspace fx last bound it to.
@@@ -70,7 -72,7 +73,7 @@@ beacon handoff list --jso
| Flag | Description |
|------|-------------|
- | `--harness` | Only this runtime: `claude`, `codex`, `opencode`, `cline`, `pi`, `prime`, `droid`, `copilot`, `hermes`, `dsh`, `fx`, `grok` or `cursor`. |
-| `--harness` | Only this runtime: `claude`, `codex`, `opencode`, `cline`, `pi`, `prime`, `droid`, `copilot`, `hermes`, `dsh`, `fx`, `grok` or `openclaw`. |
++| `--harness` | Only this runtime: `claude`, `codex`, `opencode`, `cline`, `pi`, `prime`, `droid`, `copilot`, `hermes`, `dsh`, `fx`, `grok`, `openclaw` or `cursor`. |
| `--here` | Only sessions that ran in the current directory or below it. |
| `--dir` | Only sessions that ran in this directory or below it. |
| `--subagents` | Include subagent sessions. They are hidden by default, because resuming one resumes a fragment of its parent's task. |
@@@ -142,7 -144,7 +145,8 @@@ There are two ways to resume
| Hermes Agent | `hermes --resume <id>` |
| fx | `fx --resume <id>`, in the session's workspace |
| Grok Build | `grok --permission-mode default --resume <id>` |
+ | OpenClaw Gateway | `openclaw tui --session <session key>` |
+ | Cursor | `cursor-agent --resume <chat id>` (chats `cursor-agent` started only) |
- **Start a new session from a brief.** Otherwise, or with `--agent` naming another runtime or with `--new`, Beacon writes a brief (see `export`) and starts a new session. The first message of that session points at the brief:
@@@ -157,7 -159,7 +161,8 @@@
| Factory Droid | `droid "<prompt>"` |
| GitHub Copilot CLI | `copilot -i "<prompt>"` |
| Grok Build | `grok --permission-mode default "<prompt>"` |
+ | OpenClaw Gateway | `openclaw tui --session beacon-handoff-<hash> --message "<prompt>"` |
+ | Cursor | `cursor-agent "<prompt>"` |
| Oh My Pi | `omp --approval-mode=always-ask "<prompt>"` |
| Gemini CLI | `gemini --approval-mode default --prompt-interactive "<prompt>"` |
| Qwen Code | `qwen --approval-mode default --prompt-interactive "<prompt>"` |
@@@ -180,8 -182,8 +185,10 @@@ Beacon cannot start DeepSeek Harness, b
fx has no interactive session that starts from a prompt (`fx ask` runs one request and exits), so it is not in the new-session table. Beacon reopens an fx session natively, and continues it in another runtime with `--agent`; `--agent fx` for another runtime's session, `--new` on an fx session, and an fx session whose files are gone stop with an error rather than launching anything. fx looks a session id up within the workspace it runs in, so Beacon starts it in the session's workspace, and `--cwd` naming another directory stops with an error too, since fx could not find the session there. fx's default permission mode is `auto`, where a reviewer resolves permission requests, and fx has no command-line flag to change it. Beacon passes none: it reopens your own session under whatever permission mode your fx configuration sets.
+ OpenClaw's TUI is a client of the Gateway, so the Gateway must be running (`openclaw gateway run`, or its installed service) for either command to connect; Beacon does not start it. The Gateway reopens a conversation by its session key, such as `agent:main:main`, not by its transcript id, so an OpenClaw session is reopened natively only when the agent's `sessions.json` files the transcript under a key qualified with that agent (`agent:<agent>:...`); otherwise it continues from a brief. The Gateway answers for that key with whatever conversation it now holds under it: a key it no longer knows can open as an empty conversation. A new session gets a key of its own, `beacon-handoff-` and a hash of its prompt, because without `--session` the TUI would post into the agent's shared main session. Beacon never passes `--deliver`, so replies stay in the TUI and are not sent out through the Gateway's chat channels.
+
+`cursor-agent --resume` reopens only chats the CLI itself started, which it keeps under `~/.cursor/chats` (or `CURSOR_CONFIG_DIR`, or `$XDG_CONFIG_HOME/cursor`) keyed by the directory the chat ran in. Beacon reopens a Cursor session natively only when that chat store exists for the session's recorded directory, and only from that directory: with `--cwd` pointing elsewhere, it continues from a brief. Conversations from the Cursor IDE, Composer records, and subagent transcripts continue from a brief. Beacon never passes `--force` or `--yolo`, so `cursor-agent` still asks before running commands.
+
Cline approves every tool call by default. Beacon always passes `--auto-approve false`, so a session Beacon starts never gets auto-approval on Beacon's say-so. You can still turn it on inside the Cline TUI.
The same holds for every runtime Beacon starts. Oh My Pi and goose approve every tool call by default, so Beacon passes `--approval-mode=always-ask` to Oh My Pi and sets `GOOSE_MODE=approve` for goose. Where a CLI takes an approval mode, Beacon names the mode that asks (Gemini CLI, Qwen Code, Muse Code, and Devin CLI, whose `DEVIN_PERMISSION_MODE` could otherwise hold `dangerous`), so a user or project setting that approves everything does not carry over. Beacon never passes a flag that turns approvals off.
@@@ -227,7 -229,7 +234,7 @@@ The link event keeps the new session's
Two paths record the link:
- **Live hooks and plugins.** Every runtime whose prompts Beacon captures as they are sent records it: the shared prompt hook (Claude Code, Cursor, Factory Droid, Qwen Code, Kiro, Kimi Code, Devin, Muse Code, OpenHands, Grok Build, DeepSeek Harness, Hermes Agent, VS Code), Antigravity (including the prompt it recovers from its transcript when the prompt hook does not fire), the Cline, OpenCode and OpenClaw plugins, and the Pi, Oh My Pi, Prime Agent and Senpi extensions (`harness.collection_method` `hook` or `plugin`).
- - **Session-store sync.** `beacon endpoint claude sync`, `codex sync`, `opencode sync`, `cline sync`, `pi sync`, `prime sync`, `factory sync`, `copilot sync`, `hermes sync`, `dsh sync`, `fx sync`, `grok sync` and `cursor sync` record it when they read the prompt back from the runtime's store (`harness.collection_method: poll`).
-- **Session-store sync.** `beacon endpoint claude sync`, `codex sync`, `opencode sync`, `cline sync`, `pi sync`, `prime sync`, `factory sync`, `copilot sync`, `hermes sync`, `dsh sync`, `fx sync`, `grok sync` and `openclaw sessions sync` record it when they read the prompt back from the runtime's store (`harness.collection_method: poll`).
++- **Session-store sync.** `beacon endpoint claude sync`, `codex sync`, `opencode sync`, `cline sync`, `pi sync`, `prime sync`, `factory sync`, `copilot sync`, `hermes sync`, `dsh sync`, `fx sync`, `grok sync`, `openclaw sessions sync` and `cursor sync` record it when they read the prompt back from the runtime's store (`harness.collection_method: poll`).
Codex CLI prompts reach Beacon over OTLP and through `beacon endpoint codex sync`, not a prompt hook, so a session continued in Codex is linked by the sync. The same holds for GitHub Copilot CLI, whose live path is OTLP: `beacon endpoint copilot sync` records the link. For a runtime that also has a prompt hook or plugin, a sync can record the same link the hook already did; the two carry different `collection_method` values, as every other event those runtimes report through both paths does. A sync's link has a deterministic `event.id`, so syncing again never duplicates it.