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
Link a handed-off session to the one it continues
Claudebb79cd8565d1
diff --git a/cli/beacon-hooks/cmd/cline_event.go b/cli/beacon-hooks/cmd/cline_event.goindex 61fee0f3..aba25d2d 100644--- a/cli/beacon-hooks/cmd/cline_event.go+++ b/cli/beacon-hooks/cmd/cline_event.go@@ -113,7 +113,7 @@ func clineEndpointEvents(input map[string]interface{}, sessionID string) []norma// recorded from the same payload rather than waiting for a prompt hook that only the// file-based surface has.if prompt := clinePromptText(input); prompt != "" {- events = append(events, clinePromptEvent(cloneFields(fields), prompt))+ events = append(events, clinePromptEvents(cloneFields(fields), prompt)...)}return eventscase clineStagePrompt:@@ -121,7 +121,7 @@ func clineEndpointEvents(input map[string]interface{}, sessionID string) []normaif prompt == "" {return nil}- return []normalizedEvent{clinePromptEvent(fields, prompt)}+ return clinePromptEvents(fields, prompt)case clineStageToolBefore:mergeMap(fields, clineToolFields(input, false))return one("tool.invoked", "tool", "info", "Cline tool invoked", fields)@@ -197,6 +197,16 @@ func clineBaseFields(input map[string]interface{}, sessionID string) map[string]return fields}+// clinePromptEvents is the prompt event plus, when the prompt carries a handoff marker, the+// session.handoff link.+func clinePromptEvents(fields map[string]interface{}, prompt string) []normalizedEvent {+ events := []normalizedEvent{clinePromptEvent(fields, prompt)}+ if link, ok := handoffLinkEvent(fields, prompt); ok {+ events = append(events, link)+ }+ return events+}+func clinePromptEvent(fields map[string]interface{}, prompt string) normalizedEvent {fields["prompt"] = map[string]interface{}{"text": prompt}fields["gen_ai"] = mergeNested(fields["gen_ai"], map[string]interface{}{diff --git a/cli/beacon-hooks/cmd/handoff_link.go b/cli/beacon-hooks/cmd/handoff_link.gonew file mode 100644index 00000000..d1f1d652--- /dev/null+++ b/cli/beacon-hooks/cmd/handoff_link.go@@ -0,0 +1,34 @@+package cmd++import (+ "github.com/asymptote-labs/agent-beacon/pkg/asymptoteobserve"+)++// handoffLinkEvent is the session.handoff event a prompt implies when it carries the marker+// `beacon handoff resume` puts in a new session's first prompt. fields are the prompt event's own+// fields; the link keeps the session, workspace and harness from them and drops the prompt text,+// which the prompt event already records.+//+// The event is observed: the marker was in the prompt. It is not verified, since anyone can type+// the marker; it records the claim.+func handoffLinkEvent(fields map[string]interface{}, prompt string) (normalizedEvent, bool) {+ info, ok := asymptoteobserve.ParseHandoffMarker(prompt)+ if !ok {+ return normalizedEvent{}, false+ }+ linked := cloneFields(fields)+ for _, key := range []string{"prompt", "gen_ai", "content"} {+ delete(linked, key)+ }+ linked["handoff"] = map[string]interface{}{+ "source_harness": info.SourceHarness,+ "source_session_id": info.SourceSessionID,+ }+ return normalizedEvent{+ action: "session.handoff",+ category: "session",+ severity: "info",+ message: "Session continued from a " + info.SourceHarness + " session",+ fields: linked,+ }, true+}diff --git a/cli/beacon-hooks/cmd/handoff_link_test.go b/cli/beacon-hooks/cmd/handoff_link_test.gonew file mode 100644index 00000000..58caa337--- /dev/null+++ b/cli/beacon-hooks/cmd/handoff_link_test.go@@ -0,0 +1,135 @@+package cmd++import (+ "path/filepath"+ "testing"++ "github.com/asymptote-labs/agent-beacon/pkg/asymptoteobserve"+)++const handoffTestPrompt = "Continue the work from an earlier Claude Code session. Beacon wrote a handoff brief of it at /home/me/.beacon/endpoint/handoffs/b.md.\n\n[beacon-handoff from=claude_code session=src-session-1]"++func eventsWithAction(t *testing.T, logPath, action string) []map[string]interface{} {+ t.Helper()+ var out []map[string]interface{}+ for _, event := range endpointEvents(t, logPath) {+ meta, _ := event["event"].(map[string]interface{})+ if meta["action"] == action {+ out = append(out, event)+ }+ }+ return out+}++func assertHandoffLink(t *testing.T, event map[string]interface{}, sessionID, harness string) {+ t.Helper()+ handoff, _ := event["handoff"].(map[string]interface{})+ if handoff["source_harness"] != "claude_code" || handoff["source_session_id"] != "src-session-1" {+ t.Fatalf("handoff = %#v", event["handoff"])+ }+ session, _ := event["session"].(map[string]interface{})+ if session["id"] != sessionID {+ t.Fatalf("session.id = %v, want the new session %s", session["id"], sessionID)+ }+ meta, _ := event["event"].(map[string]interface{})+ if meta["category"] != "session" || meta["fidelity"] != asymptoteobserve.FidelityObserved {+ t.Fatalf("event = %#v, want an observed session event", meta)+ }+ if h, _ := event["harness"].(map[string]interface{}); h["name"] != harness {+ t.Fatalf("harness = %#v, want %s", event["harness"], harness)+ }+ for _, key := range []string{"prompt", "content"} {+ if _, ok := event[key]; ok {+ t.Fatalf("the link must not repeat the prompt's %s: %#v", key, event[key])+ }+ }+ if genAI, ok := event["gen_ai"].(map[string]interface{}); ok && genAI["input"] != nil {+ t.Fatalf("the link must not repeat the prompt text: %#v", genAI)+ }+}++func TestPromptSubmitRecordsAHandoffLink(t *testing.T) {+ setupHookConfigDirs(t)+ platformFlag = "claude"+ logPath := filepath.Join(t.TempDir(), "runtime.jsonl")+ t.Setenv("BEACON_ENDPOINT_LOG", logPath)++ runHookWithInput(t, runPromptSubmit, map[string]interface{}{+ "session_id": "new-session-1",+ "cwd": "/work/api",+ "prompt": handoffTestPrompt,+ })++ if got := len(eventsWithAction(t, logPath, "prompt.submitted")); got != 1 {+ t.Fatalf("prompt events = %d, want the prompt recorded as usual", got)+ }+ links := eventsWithAction(t, logPath, "session.handoff")+ if len(links) != 1 {+ t.Fatalf("session.handoff events = %d, want 1", len(links))+ }+ assertHandoffLink(t, links[0], "new-session-1", "claude_code")+ if session, _ := links[0]["session"].(map[string]interface{}); session["working_directory"] != "/work/api" {+ t.Fatalf("the link keeps the prompt's workspace: %#v", links[0]["session"])+ }+}++func TestPromptSubmitWithoutAMarkerRecordsNoLink(t *testing.T) {+ setupHookConfigDirs(t)+ platformFlag = "claude"+ logPath := filepath.Join(t.TempDir(), "runtime.jsonl")+ t.Setenv("BEACON_ENDPOINT_LOG", logPath)++ for _, prompt := range []string{"fix the tests", "[beacon-handoff from=claude_code]", ""} {+ runHookWithInput(t, runPromptSubmit, map[string]interface{}{"session_id": "s-2", "prompt": prompt})+ }+ if links := eventsWithAction(t, logPath, "session.handoff"); len(links) != 0 {+ t.Fatalf("session.handoff without a marker: %#v", links)+ }+}++func TestClinePromptRecordsAHandoffLink(t *testing.T) {+ for _, tc := range []struct {+ name string+ input map[string]interface{}+ }{+ {"prompt hook", map[string]interface{}{"hookName": "UserPromptSubmit", "taskId": "cline-new-1", "prompt": handoffTestPrompt}},+ {"run start", map[string]interface{}{"type": "runStart", "taskId": "cline-new-1", "prompt": handoffTestPrompt}},+ } {+ t.Run(tc.name, func(t *testing.T) {+ logPath := clineTestLog(t)+ runHookWithInput(t, runClineEvent, tc.input)+ links := eventsWithAction(t, logPath, "session.handoff")+ if len(links) != 1 {+ t.Fatalf("actions = %v, want one session.handoff", clineEventActions(t, logPath))+ }+ assertHandoffLink(t, links[0], "cline-new-1", "cline")+ if len(eventsWithAction(t, logPath, "prompt.submitted")) != 1 {+ t.Fatalf("actions = %v, want the prompt recorded too", clineEventActions(t, logPath))+ }+ })+ }+}++func TestOpenCodePromptRecordsAHandoffLink(t *testing.T) {+ events := opencodeEndpointEvents(map[string]interface{}{+ "type": "chat.message", "sessionID": "ses_new", "prompt": handoffTestPrompt,+ }, "ses_new")+ if len(events) != 2 || events[0].action != "prompt.submitted" || events[1].action != "session.handoff" {+ t.Fatalf("events = %+v", events)+ }+ handoff, _ := events[1].fields["handoff"].(map[string]interface{})+ if handoff["source_session_id"] != "src-session-1" {+ t.Fatalf("handoff = %#v", events[1].fields["handoff"])+ }+ if _, ok := events[1].fields["prompt"]; ok {+ t.Fatal("the link must not repeat the prompt")+ }+ if _, ok := events[0].fields["prompt"]; !ok {+ t.Fatal("building the link must not strip the prompt event's own fields")+ }++ plain := opencodeEndpointEvents(map[string]interface{}{"type": "chat.message", "prompt": "hello"}, "ses_new")+ if len(plain) != 1 {+ t.Fatalf("a prompt without a marker yields only the prompt event, got %+v", plain)+ }+}diff --git a/cli/beacon-hooks/cmd/opencode_event.go b/cli/beacon-hooks/cmd/opencode_event.goindex 12d9496e..d550f732 100644--- a/cli/beacon-hooks/cmd/opencode_event.go+++ b/cli/beacon-hooks/cmd/opencode_event.go@@ -64,7 +64,11 @@ func opencodeEndpointEvents(input map[string]interface{}, sessionID string) []no})fields["content"] = retainedContentFields(prompt)}- return one("prompt.submitted", "prompt", "info", "Prompt submitted to opencode", fields)+ events := one("prompt.submitted", "prompt", "info", "Prompt submitted to opencode", fields)+ if link, ok := handoffLinkEvent(fields, opencodePromptText(input)); ok {+ events = append(events, link)+ }+ return eventscase "tool.execute.before":mergeMap(fields, opencodeToolFields(input, false))return one("tool.invoked", "tool", "info", "opencode tool invoked", fields)diff --git a/cli/beacon-hooks/cmd/prompt_submit.go b/cli/beacon-hooks/cmd/prompt_submit.goindex 8dd50761..ce4bd720 100644--- a/cli/beacon-hooks/cmd/prompt_submit.go+++ b/cli/beacon-hooks/cmd/prompt_submit.go@@ -61,6 +61,9 @@ func runPromptSubmit(cmd *cobra.Command, args []string) {fields["content"] = retainedContentFields(prompt)}emitHookEvent(logger, "prompt.submitted", "prompt", "info", "Prompt submitted to agent", input, fields)+ if link, ok := handoffLinkEvent(fields, prompt); ok {+ emitHookEvent(logger, link.action, link.category, link.severity, link.message, input, link.fields)+ }if platformFlag == "antigravity" && sessionID != "" && hasPrompt {st := state.NewSessionState(sessionID, "antigravity")diff --git a/cli/beacon/internal/handoff/resume.go b/cli/beacon/internal/handoff/resume.goindex 8b406e7a..918a30be 100644--- a/cli/beacon/internal/handoff/resume.go+++ b/cli/beacon/internal/handoff/resume.go@@ -8,6 +8,7 @@ import ("strings""github.com/asymptote-labs/agent-beacon/cli/beacon/internal/clinesession"+ "github.com/asymptote-labs/agent-beacon/pkg/asymptoteobserve")// Resume modes.@@ -201,10 +202,17 @@ func resumeDir(session Session, override string) (string, error) {// NewSessionPrompt is the first message of a session started from a brief. It names the brief by// path rather than inlining it: the brief carries prompt text and command output, and a command// line is visible to every local user through the process table.+//+// The prompt ends with the handoff marker, so whatever records the new session's first prompt can+// link it to the session it continues (a session.handoff event).func NewSessionPrompt(session Session, briefPath string) string {- return fmt.Sprintf("Continue the work from an earlier %s session. Beacon wrote a handoff brief of it at %s. "++ prompt := fmt.Sprintf("Continue the work from an earlier %s session. Beacon wrote a handoff brief of it at %s. "+"Read that file first, then tell me what you understand the task to be and wait for me to confirm before changing anything.",RuntimeLabel(session.Harness), briefPath)+ if marker := asymptoteobserve.HandoffMarker(session.Harness, session.ID); marker != "" {+ prompt += "\n\n" + marker+ }+ return prompt}// ReasonText explains a new-session reason to a person.diff --git a/cli/beacon/internal/handoff/resume_test.go b/cli/beacon/internal/handoff/resume_test.goindex b7e35ed5..95993d9e 100644--- a/cli/beacon/internal/handoff/resume_test.go+++ b/cli/beacon/internal/handoff/resume_test.go@@ -9,6 +9,7 @@ import ("testing""github.com/asymptote-labs/agent-beacon/cli/beacon/internal/testenv"+ "github.com/asymptote-labs/agent-beacon/pkg/asymptoteobserve")// installed resolves the named executables to /bin/<name>, as if they were on PATH.@@ -99,6 +100,20 @@ func TestPlanResumeStartsANewSessionInEachRuntime(t *testing.T) {}}+func TestNewSessionPromptCarriesTheHandoffMarker(t *testing.T) {+ prompt := NewSessionPrompt(Session{Harness: HarnessCodex, ID: "019a-thread"}, "/tmp/b.md")+ info, ok := asymptoteobserve.ParseHandoffMarker(prompt)+ if !ok || info.SourceHarness != HarnessCodex || info.SourceSessionID != "019a-thread" {+ t.Fatalf("prompt %q carries marker %+v, %v", prompt, info, ok)+ }+ if !strings.HasSuffix(prompt, "\n\n[beacon-handoff from=codex_cli session=019a-thread]") {+ t.Fatalf("the marker is the prompt's last line: %q", prompt)+ }+ if strings.Contains(NewSessionPrompt(Session{Harness: HarnessCline, ID: "has space"}, "/tmp/b.md"), "[beacon-handoff") {+ t.Fatal("an id the marker cannot carry gets no marker rather than a wrong one")+ }+}+func TestNewSessionPromptPointsAtTheBriefWithoutInliningIt(t *testing.T) {prompt := NewSessionPrompt(Session{Harness: HarnessClaude}, "/tmp/b.md")for _, want := range []string{"earlier Claude Code session", "/tmp/b.md", "Read that file first", "wait for me to confirm"} {diff --git a/docs/cli/handoff.mdx b/docs/cli/handoff.mdxindex dd1e1851..8616894f 100644--- a/docs/cli/handoff.mdx+++ b/docs/cli/handoff.mdx@@ -113,7 +113,7 @@ There are two ways to resume:| OpenCode | `opencode --prompt "<prompt>"` || Cline | `cline --tui --auto-approve false "<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 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).Claude Code and Cline subagent sessions, and Cline's older task history, can't be reopened by their CLIs, so they always continue from a brief. A session known only from Beacon's runtime log also continues from a brief, and it needs `--agent` if its own runtime isn't one of the four above.@@ -130,3 +130,27 @@ The runtime runs in this terminal, in the session's recorded directory. If that| `--json` | With `--print`, describe the plan as JSON (`mode`, `reason`, `target`, `executable`, `args`, `dir`, `brief_path`). || `--yes` | Launch without asking. || `--output-dir`, `--log-path`, `--harness`, and the `--*-dir` flags | As for `export`. |++## Linking a new session to the one it continues++A session started from a brief has a new session id. So that the two stay connected in the telemetry, the first prompt of the new session ends with a handoff marker:++```text+[beacon-handoff from=claude_code session=ea7f210f-402b-53b1-aec2-864a488dfcd3]+```++When Beacon's hook adapter records a prompt carrying this marker, it writes a second event, `session.handoff`, next to the usual `prompt.submitted`:++```json+{+ "event": { "action": "session.handoff", "category": "session", "fidelity": "observed" },+ "session": { "id": "<the new session>", "working_directory": "/work/api" },+ "handoff": { "source_harness": "claude_code", "source_session_id": "ea7f210f-402b-53b1-aec2-864a488dfcd3" }+}+```++The link event keeps the new session's id, workspace and harness, and leaves the prompt text to the prompt event. Rules can match on `e.handoff.source_harness` and `e.handoff.source_session_id`.++The live hook paths for Claude Code, Cline and OpenCode record the link. Codex CLI prompts reach Beacon over OTLP and through `beacon endpoint codex sync`, not through a prompt hook, so a session continued in Codex is not linked yet.++The marker is a claim made in prompt text, not a verified identity: anyone can type it. `fidelity: observed` records that the marker was seen, not that `beacon handoff resume` wrote it. A native resume keeps the session's own id, so it needs no link.diff --git a/docs/telemetry-schema/fields.mdx b/docs/telemetry-schema/fields.mdxindex cbe20dba..3a38c3db 100644--- a/docs/telemetry-schema/fields.mdx+++ b/docs/telemetry-schema/fields.mdx@@ -27,6 +27,7 @@ Beacon models each event as an action plus a set of typed entities. The [`event`| `command` | Shell or process execution context | `command`, `exit_code`, `duration_ms` || `mcp` | MCP server, tool, method, protocol, resource, and session context | `server`, `tool`, `method.name`, `protocol.version`, `resource.uri`, `session.id` || `approval` | Approval or policy decision context | `required`, `decision`, `reason` |+| `handoff` | On a `session.handoff` event, the session this one continues from a [handoff brief](/cli/handoff#linking-a-new-session-to-the-one-it-continues) | `source_harness`, `source_session_id` || `policy` | Policy metadata when available from a runtime or integration | `id`, `name`, `decision`, `enforcement`, `reason` || `prompt` | Prompt text when the source emits it and content handling allows it | `text` || `content` | Content handling state for the event | `retention`, `included`, `redacted`, `truncated` |@@ -72,6 +73,7 @@ Optional context fields add detail when available:| `mcp` | MCP server, tool, method, protocol, resource, or session metadata || `jsonrpc`, `rpc`, `network`, `server`, `error` | MCP client-span context projected from OpenTelemetry semantic conventions when available || `approval` | Approval requirement, decision, or reason |+| `handoff` | The session a handed-off session continues: source harness and session id || `policy` | Policy ID, name, decision, enforcement mode, or reason || `content` | Content inclusion, redaction, and truncation state || `gen_ai` | OpenTelemetry GenAI request, response, usage, message, tool, retrieval, evaluation, provider, and workflow metadata |diff --git a/pkg/asymptoteobserve/event.go b/pkg/asymptoteobserve/event.goindex ae536963..2be21dca 100644--- a/pkg/asymptoteobserve/event.go+++ b/pkg/asymptoteobserve/event.go@@ -467,6 +467,7 @@ type Event struct {Error *ErrorInfo `json:"error,omitempty"`Run *RunInfo `json:"run,omitempty"`Session *SessionInfo `json:"session,omitempty"`+ Handoff *HandoffInfo `json:"handoff,omitempty"`Trace *TraceInfo `json:"trace,omitempty"`JSONRPC *JSONRPCInfo `json:"jsonrpc,omitempty"`Network *NetworkInfo `json:"network,omitempty"`diff --git a/pkg/asymptoteobserve/handoff.go b/pkg/asymptoteobserve/handoff.gonew file mode 100644index 00000000..69e2dff5--- /dev/null+++ b/pkg/asymptoteobserve/handoff.go@@ -0,0 +1,43 @@+package asymptoteobserve++import (+ "fmt"+ "regexp"+)++// HandoffInfo links a session to the session it was handed off from: the one whose brief+// `beacon handoff resume` pointed it at.+type HandoffInfo struct {+ SourceHarness string `json:"source_harness,omitempty"`+ SourceSessionID string `json:"source_session_id,omitempty"`+}++// The handoff marker is the one line `beacon handoff resume` adds to a new session's first prompt so+// that whatever records the prompt can link the new session to the old one. It is a claim made in+// prompt text, not a verified identity: anyone can type it, and a session.handoff event records that+// the marker was observed, nothing more.+var (+ handoffMarkerPattern = regexp.MustCompile(`\[beacon-handoff from=([a-z0-9_]{1,64}) session=([A-Za-z0-9._:\-]{1,200})\]`)+ handoffHarnessChars = regexp.MustCompile(`^[a-z0-9_]{1,64}$`)+ handoffSessionChars = regexp.MustCompile(`^[A-Za-z0-9._:\-]{1,200}$`)+)++// HandoffMarker returns the marker naming harness's session sessionID, or "" when either value+// cannot be carried in one (an id with spaces, for instance), so a caller never writes a marker+// that parses back differently.+func HandoffMarker(harness, sessionID string) string {+ harness = NormalizeHarnessName(harness)+ if !handoffHarnessChars.MatchString(harness) || !handoffSessionChars.MatchString(sessionID) {+ return ""+ }+ return fmt.Sprintf("[beacon-handoff from=%s session=%s]", harness, sessionID)+}++// ParseHandoffMarker finds the first handoff marker in text.+func ParseHandoffMarker(text string) (HandoffInfo, bool) {+ match := handoffMarkerPattern.FindStringSubmatch(text)+ if match == nil {+ return HandoffInfo{}, false+ }+ return HandoffInfo{SourceHarness: NormalizeHarnessName(match[1]), SourceSessionID: match[2]}, true+}diff --git a/pkg/asymptoteobserve/handoff_test.go b/pkg/asymptoteobserve/handoff_test.gonew file mode 100644index 00000000..c2b6d969--- /dev/null+++ b/pkg/asymptoteobserve/handoff_test.go@@ -0,0 +1,58 @@+package asymptoteobserve++import (+ "strings"+ "testing"+)++func TestHandoffMarkerRoundTrips(t *testing.T) {+ for _, tc := range []struct{ harness, id, wantHarness string }{+ {"claude_code", "ea7f210f-402b-53b1-aec2-864a488dfcd3", "claude_code"},+ {"claude", "s-1", "claude_code"},+ {"codex_cli", "019a2b3c-thread", "codex_cli"},+ {"opencode", "ses_4f2a1b", "opencode"},+ {"cline", "subagent:lead-1:child.2", "cline"},+ } {+ marker := HandoffMarker(tc.harness, tc.id)+ if marker == "" {+ t.Fatalf("HandoffMarker(%q, %q) is empty", tc.harness, tc.id)+ }+ got, ok := ParseHandoffMarker("Continue the work.\n\n" + marker + "\n")+ if !ok || got.SourceHarness != tc.wantHarness || got.SourceSessionID != tc.id {+ t.Fatalf("ParseHandoffMarker(%q) = %+v, %v", marker, got, ok)+ }+ }+}++func TestHandoffMarkerRefusesValuesItCannotCarry(t *testing.T) {+ for _, tc := range []struct{ harness, id string }{+ {"claude_code", ""},+ {"claude_code", "has space"},+ {"claude_code", "close]bracket"},+ {"claude_code", strings.Repeat("a", 201)},+ {"", "s-1"},+ } {+ if got := HandoffMarker(tc.harness, tc.id); got != "" {+ t.Fatalf("HandoffMarker(%q, %q) = %q, want no marker", tc.harness, tc.id, got)+ }+ }+}++func TestParseHandoffMarkerIgnoresLookalikes(t *testing.T) {+ for _, text := range []string{+ "",+ "no marker here",+ "[beacon-handoff from=claude_code]",+ "[beacon-handoff session=s-1 from=claude_code]",+ "[beacon-handoff from=Claude session=s-1]",+ "[beacon-handoff from=claude_code session=s 1]",+ } {+ if got, ok := ParseHandoffMarker(text); ok {+ t.Fatalf("ParseHandoffMarker(%q) = %+v, want no match", text, got)+ }+ }+ got, ok := ParseHandoffMarker("[beacon-handoff from=codex_cli session=a] and [beacon-handoff from=cline session=b]")+ if !ok || got.SourceSessionID != "a" {+ t.Fatalf("the first marker wins, got %+v", got)+ }+}diff --git a/spec/threat-rules/FIELDS.md b/spec/threat-rules/FIELDS.mdindex e1e9e92b..75c273ad 100644--- a/spec/threat-rules/FIELDS.md+++ b/spec/threat-rules/FIELDS.md@@ -87,6 +87,8 @@ Regenerate with `beacon rules fields --markdown > spec/threat-rules/FIELDS.md`.| `e.gen_ai.usage.output_tokens` | int || `e.gen_ai.usage.reasoning.output_tokens` | int || `e.gen_ai.workflow.name` | string |+| `e.handoff.source_harness` | string |+| `e.handoff.source_session_id` | string || `e.harness.collection_method` | string || `e.harness.config_path` | string || `e.harness.executable_path` | string |