The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
handoff: start sessions in the hook-only runtimes
Claude24a5f409e685
diff --git a/cli/beacon/cmd/handoff_resume_test.go b/cli/beacon/cmd/handoff_resume_test.goindex 049de73a..1830a9cd 100644--- a/cli/beacon/cmd/handoff_resume_test.go+++ b/cli/beacon/cmd/handoff_resume_test.go@@ -357,3 +357,28 @@ func TestHandoffResumeMakesRelativePathsAbsolute(t *testing.T) {t.Fatalf("dir %q, brief %q", plan.Dir, plan.BriefPath)}}++// A runtime Beacon reads only from the runtime log continues its own sessions in a new session of+// that runtime, with the environment its command asks for.+func TestHandoffResumeStartsALogOnlyRuntime(t *testing.T) {+ f := newResumeFixture(t)+ handoffLookPath = func(name string) (string, error) { return "/bin/" + name, nil }+ logPath := handoffLog(t, "goose", "goose-sess-1", "port the parser")+ dir := t.TempDir()+ out, _, err := runResume(t, f, "goose-sess-1", "--log-path", logPath, "--cwd", dir, "--print")+ if err != nil {+ t.Fatalf("resume --print: %v", err)+ }+ for _, want := range []string{"Starting a new goose session from goose session goose-sess-1", "env: GOOSE_MODE=approve", "/bin/goose run --interactive --text"} {+ if !strings.Contains(out, want) {+ t.Fatalf("plan output missing %q:\n%s", want, out)+ }+ }+ if _, _, err := runResume(t, f, "goose-sess-1", "--log-path", logPath, "--cwd", dir, "--yes"); err != nil {+ t.Fatalf("resume: %v", err)+ }+ plan := f.launched[len(f.launched)-1]+ if plan.Target != handoff.HarnessGoose || plan.Env["GOOSE_MODE"] != "approve" || plan.Reason != handoff.ReasonFromRuntimeLog {+ t.Fatalf("plan = %+v", plan)+ }+}diff --git a/cli/beacon/internal/handoff/resume_test.go b/cli/beacon/internal/handoff/resume_test.goindex 54ed8c2d..5059148a 100644--- a/cli/beacon/internal/handoff/resume_test.go+++ b/cli/beacon/internal/handoff/resume_test.go@@ -24,7 +24,8 @@ func installed(names ...string) func(string) (string, error) {}}-var allRuntimes = installed("claude", "codex", "opencode", "cline", "pi", "prime-agent")+var allRuntimes = installed("claude", "codex", "opencode", "cline", "pi", "prime-agent",+ "omp", "gemini", "qwen", "kiro-cli", "agy", "devin", "muse", "openhands", "goose")// resumableSession is a session whose directory and session file both exist.func resumableSession(t *testing.T, harness, id string) Session {@@ -80,6 +81,15 @@ func TestPlanResumeStartsANewSessionInEachRuntime(t *testing.T) {{HarnessCline, "cline", []string{"--tui", "--auto-approve", "false"}},{HarnessPi, "pi", []string{"--"}},{HarnessPrime, "prime-agent", []string{"--"}},+ {HarnessOhMyPi, "omp", []string{"--approval-mode=always-ask"}},+ {HarnessGemini, "gemini", []string{"--approval-mode", "default", "--prompt-interactive"}},+ {HarnessQwen, "qwen", []string{"--approval-mode", "default", "--prompt-interactive"}},+ {HarnessKiro, "kiro-cli", []string{"chat"}},+ {HarnessAntigravity, "agy", []string{"--prompt-interactive"}},+ {HarnessDevin, "devin", []string{"--permission-mode", "auto", "--"}},+ {HarnessMuse, "muse", []string{"--approval-mode", "on-request"}},+ {HarnessOpenHands, "openhands", []string{"--task"}},+ {HarnessGoose, "goose", []string{"run", "--interactive", "--text"}},} {t.Run(tc.target, func(t *testing.T) {source := HarnessCodex@@ -345,3 +355,60 @@ func TestLaunchAppliesThePlansEnvironment(t *testing.T) {t.Fatalf("runtime saw %q", got)}}++// A runtime whose sessions Beacon knows only from the runtime log continues them in a new session+// of its own, with its approvals left on.+func TestPlanResumeContinuesARuntimeLogSessionInItsOwnRuntime(t *testing.T) {+ brief := filepath.Join(t.TempDir(), "brief.md")+ session := Session{Harness: HarnessGoose, ID: "goose-1", Directory: t.TempDir()}+ plan, err := PlanResume(session, PlanOptions{FromRuntimeLog: true, BriefPath: brief, LookPath: allRuntimes})+ if err != nil {+ t.Fatalf("PlanResume: %v", err)+ }+ if plan.Mode != ModeNewSession || plan.Reason != ReasonFromRuntimeLog || plan.Target != HarnessGoose {+ t.Fatalf("plan = %+v", plan)+ }+ if !reflect.DeepEqual(plan.Env, map[string]string{"GOOSE_MODE": "approve"}) {+ t.Fatalf("env = %v, want goose held to approve mode", plan.Env)+ }+}++func TestRegistryIsConsistent(t *testing.T) {+ seen := map[string]string{}+ for _, r := range runtimes {+ if r.Label == "" {+ t.Errorf("%s has no label", r.Harness)+ }+ // Events name a runtime by its normalized harness; one the schema spells differently+ // would never match its own sessions.+ if got := asymptoteobserve.NormalizeHarnessName(r.Harness); got != r.Harness {+ t.Errorf("%s normalizes to %s", r.Harness, got)+ }+ for _, name := range append([]string{r.Harness}, r.Aliases...) {+ if other, dup := seen[name]; dup {+ t.Errorf("%q names both %s and %s", name, other, r.Harness)+ }+ seen[name] = r.Harness+ if got, err := ParseHarness(name); err != nil || got != r.Harness {+ t.Errorf("ParseHarness(%q) = %q, %v; want %s", name, got, err, r.Harness)+ }+ }+ if r.NewSource == nil && r.Command == nil {+ t.Errorf("%s can neither be read nor started", r.Harness)+ }+ if c := r.Command; c != nil {+ if c.Executable == "" || (c.Resume == nil && c.NewSession == nil) {+ t.Errorf("%s has a command that starts nothing", r.Harness)+ }+ if r.NewSource == nil && c.Resume != nil {+ t.Errorf("%s reopens sessions by id but Beacon reads none of its sessions to reopen", r.Harness)+ }+ if c.NewSession != nil {+ args := c.NewSession("PROMPT")+ if len(args) == 0 || args[len(args)-1] != "PROMPT" {+ t.Errorf("%s does not pass the prompt as its last argument: %q", r.Harness, args)+ }+ }+ }+ }+}diff --git a/cli/beacon/internal/handoff/runtimes.go b/cli/beacon/internal/handoff/runtimes.goindex 76162102..496ff434 100644--- a/cli/beacon/internal/handoff/runtimes.go+++ b/cli/beacon/internal/handoff/runtimes.go@@ -53,6 +53,17 @@ const (HarnessCline = clinesession.HarnessHarnessPi = pisession.HarnessHarnessPrime = primesession.Harness++ // Runtimes Beacon starts but whose sessions it reads only from the runtime log.+ HarnessOhMyPi = "omp"+ HarnessGemini = "gemini_cli"+ HarnessQwen = "qwen_code"+ HarnessKiro = "kiro"+ HarnessAntigravity = "antigravity_cli"+ HarnessDevin = "devin"+ HarnessMuse = "muse_code"+ HarnessOpenHands = "openhands"+ HarnessGoose = "goose")// runtimes lists every runtime handoff supports, in display order.@@ -149,6 +160,101 @@ var runtimes = []Runtime{NewSession: func(prompt string) []string { return []string{"--", prompt} },},},++ // 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+ // session continues in. Where a CLI lets its approval mode be set, the command pins the mode+ // that asks, so a user or project setting that approves everything does not carry over to a+ // session Beacon starts.+ {+ Harness: HarnessOhMyPi,+ Label: "Oh My Pi",+ Aliases: []string{"oh-my-pi"},+ // Oh My Pi approves every tool call by default (tools.approvalMode "yolo").+ Command: &runtimeCommand{+ Executable: "omp",+ NewSession: func(prompt string) []string { return []string{"--approval-mode=always-ask", prompt} },+ },+ },+ {+ Harness: HarnessGemini,+ Label: "Gemini CLI",+ Aliases: []string{"gemini", "gemini-cli"},+ Command: &runtimeCommand{+ Executable: "gemini",+ NewSession: func(prompt string) []string {+ return []string{"--approval-mode", "default", "--prompt-interactive", prompt}+ },+ },+ },+ {+ Harness: HarnessQwen,+ Label: "Qwen Code",+ Aliases: []string{"qwen", "qwen-code"},+ // A positional prompt is one-shot in Qwen Code; --prompt-interactive keeps the session open.+ Command: &runtimeCommand{+ Executable: "qwen",+ NewSession: func(prompt string) []string {+ return []string{"--approval-mode", "default", "--prompt-interactive", prompt}+ },+ },+ },+ {+ Harness: HarnessKiro,+ Label: "Kiro",+ Aliases: []string{"kiro-cli"},+ Command: &runtimeCommand{+ Executable: "kiro-cli",+ NewSession: func(prompt string) []string { return []string{"chat", prompt} },+ },+ },+ {+ Harness: HarnessAntigravity,+ Label: "Antigravity CLI",+ Aliases: []string{"antigravity", "agy"},+ Command: &runtimeCommand{+ Executable: "agy",+ NewSession: func(prompt string) []string { return []string{"--prompt-interactive", prompt} },+ },+ },+ {+ Harness: HarnessDevin,+ Label: "Devin CLI",+ Aliases: []string{"devin-cli"},+ // DEVIN_PERMISSION_MODE can hold "dangerous", which approves every tool; the flag wins over+ // it. Devin reads a bare argument as a path to open, so the prompt follows --.+ Command: &runtimeCommand{+ Executable: "devin",+ NewSession: func(prompt string) []string { return []string{"--permission-mode", "auto", "--", prompt} },+ },+ },+ {+ Harness: HarnessMuse,+ Label: "Muse Code",+ Aliases: []string{"muse", "muse-code"},+ Command: &runtimeCommand{+ Executable: "muse",+ NewSession: func(prompt string) []string { return []string{"--approval-mode", "on-request", prompt} },+ },+ },+ {+ Harness: HarnessOpenHands,+ Label: "OpenHands",+ Command: &runtimeCommand{+ Executable: "openhands",+ NewSession: func(prompt string) []string { return []string{"--task", prompt} },+ },+ },+ {+ Harness: HarnessGoose,+ Label: "goose",+ // goose approves every tool call by default and has no flag for its mode, only GOOSE_MODE.+ Command: &runtimeCommand{+ Executable: "goose",+ NewSession: func(prompt string) []string { return []string{"run", "--interactive", "--text", prompt} },+ Env: map[string]string{"GOOSE_MODE": "approve"},+ },+ },}// Harnesses lists the runtimes handoff supports, in display order.diff --git a/docs/cli/handoff.mdx b/docs/cli/handoff.mdxindex 4b458e2b..c9db8ccc 100644--- a/docs/cli/handoff.mdx+++ b/docs/cli/handoff.mdx@@ -30,6 +30,24 @@ When a Codex thread has more than one rollout file, `beacon handoff` lists it on`--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.+### Runtimes Beacon starts but does not read++Beacon keeps no reader for these runtimes' own session stores, so `list` does not show their sessions. `export` and `resume` still find one by id in Beacon's runtime log, and they can be the runtime another session continues in (`--agent`):++| Runtime | `--agent` |+|---------|-----------|+| Oh My Pi | `omp` |+| Gemini CLI | `gemini` |+| Qwen Code | `qwen` |+| Kiro | `kiro` |+| Antigravity CLI | `agy` |+| Devin CLI | `devin` |+| Muse Code | `muse` |+| OpenHands | `openhands` |+| goose | `goose` |++Kimi Code can only take a prompt non-interactively, and Senpi (`omo`) moves Pi's agent directory into its own the first time it runs, so Beacon does not start them.+## `beacon handoff list`Lists resumable sessions, newest first.@@ -121,6 +139,15 @@ There are two ways to resume:| Cline | `cline --tui --auto-approve false "<prompt>"` || Pi | `pi -- "<prompt>"` || Prime Agent | `prime-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>"` |+ | Kiro | `kiro-cli chat "<prompt>"` |+ | Antigravity CLI | `agy --prompt-interactive "<prompt>"` |+ | Devin CLI | `devin --permission-mode auto -- "<prompt>"` |+ | Muse Code | `muse --approval-mode on-request "<prompt>"` |+ | OpenHands | `openhands --task "<prompt>"` |+ | goose | `GOOSE_MODE=approve goose run --interactive --text "<prompt>"` |The prompt names the brief by its path and asks the agent to read it, then confirm the task before changing anything. The brief is never inlined into the command line, because a command line is visible to every local user through the process table. The prompt ends with a handoff marker (see below).@@ -128,11 +155,13 @@ Claude Code, Cline and Prime Agent subagent sessions, and Cline's older task hisCline 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.+The runtime runs in this terminal, in the session's recorded directory. If that directory no longer exists, Beacon stops rather than starting somewhere else; pass `--cwd` to choose a directory. Beacon prints the plan and asks `Continue? [Y/n]` before launching. Without a terminal, it launches only with `--yes`. `beacon handoff resume` exits with the runtime's own exit code.| Flag | Description ||------|-------------|-| `--agent` | Runtime to continue in: `claude`, `codex`, `opencode`, `cline`, `pi` or `prime`. Defaults to the session's own runtime. |+| `--agent` | Runtime to continue in, by the names in the tables above. Defaults to the session's own runtime. || `--new` | Start a new session from a brief even when the session could be reopened. || `--cwd` | Directory to start the runtime in. || `--print` | Show the plan and command without writing a brief or launching anything. |