Skip to content

feat: surface base + persona system prompts in observer feed#1103

Merged
wpfleger96 merged 2 commits into
mainfrom
duncan/observer-system-prompt-section
Jun 17, 2026
Merged

feat: surface base + persona system prompts in observer feed#1103
wpfleger96 merged 2 commits into
mainfrom
duncan/observer-system-prompt-section

Conversation

@wpfleger96

Copy link
Copy Markdown
Collaborator

The agent observer "Prompt context" panel showed only the per-turn sections (core memory, the triggering event) and never the base or persona system prompt — Will's screenshot showed "2 sections" with both system prompts absent. The data was already on the wire: session/new emits an acp_write observer frame carrying params.systemPrompt. The desktop transcript builder simply never parsed the session/new frame.

This surfaces the base + persona prompts as one collapsible "System prompt" metadata item with two labeled sub-sections (Base, System) — both are parts of the single systemPrompt field sent to the LLM, so they're grouped under one item.

Harness (crates/buzz-acp/src/pool.rs)

The modern path (protocol_version >= 2) joined base + persona with a bare \n\n, erasing the boundary. The new framed_system_prompt helper frames each present prompt with its own header, reusing queue::base_section as the single source of truth for [Base] framing:

  • both present -> [Base]\n{base}\n\n[System]\n{persona}
  • base only -> [Base]\n{base}
  • persona only -> [System]\n{persona} (a bare persona would be mislabeled Base downstream)
  • neither -> None

The legacy path (protocol_version < 2) is unchanged — it already frames [Base]/[System] in the per-turn message.

Desktop (agentSessionTranscript.ts, agentSessionTranscriptHelpers.ts)

A new method === "session/new" arm in the acp_write branch parses params.systemPrompt and emits the item via the existing upsertMetadata helper. The split is deterministic (parseSystemPromptSections) rather than the generic section parser:

  • Partitions on the first \n[System]\n boundary; each labeled body is read literally.
  • Embedded [...] lines inside a body never start a new section, so a persona containing a bracketed line can't inflate the section count.
  • An oversize-elided [System] header degrades to a single correctly-labeled Base section (truncated body) — never a dropped label, never a lying count.

The item is keyed system-prompt:${ch} (per channel-session): the session/new frame predates session creation and carries no session id, and the frame fires once per channel-session lifetime, so a re-created session correctly replaces the prior item. No change to PromptSection / TranscriptItem types.

Tests

  • framed_system_prompt: both-present, base-only, persona-only, neither.
  • parseSystemPromptSections: both-present (2 sections), base-only (1 Base), persona-only (1 System), embedded bracket lines stay literal, elided [System] header degrades to labeled Base, empty input -> no sections.

npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 and others added 2 commits June 17, 2026 19:33
The agent observer Prompt context panel parsed only per-turn session/prompt
frames, so the base and persona system prompts — which ride session/new's
systemPrompt field — never appeared. The data was already on the wire; the
desktop transcript builder just never read the session/new frame.

Frame the modern combined systemPrompt so each present prompt carries its own
[Base]/[System] header (reusing queue::base_section as the single source of
truth) instead of a bare newline join that erased the boundary. The desktop
arm splits it deterministically rather than via the generic section parser so
embedded bracket lines and oversize-elided headers can never drop a label or
inflate the section count. Key the item per channel-session — the session/new
frame predates session creation and carries no session id.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
The both-present match arm exceeded the line-length limit; rustfmt wraps
the format! call across lines. No behavior change.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
@wpfleger96 wpfleger96 merged commit 5004758 into main Jun 17, 2026
23 checks passed
@wpfleger96 wpfleger96 deleted the duncan/observer-system-prompt-section branch June 17, 2026 23:41
tlongwell-block pushed a commit that referenced this pull request Jun 18, 2026
…te-response

* origin/main: (194 commits)
  Fold agent core memory into the session system prompt (#1112)
  feat(cli): add patches and issues commands for NIP-34 git collaboration (#1073)
  fix(desktop): stop random timeline message loss + page reconnect replay (#1105)
  Update README.md
  fix(desktop): keep thread replies from scrolling channel (#1109)
  fix(buzz-acp): accept siblings under allowlist author gate (#1108)
  feat(deploy): add production Helm chart for Buzz (#990)
  fix(desktop): keep MembersSidebar input usable while an add is in flight (#1106)
  chore(release): release version 0.3.25 (#1102)
  fix(desktop): stop dimming deferred message lists (#1104)
  Smooth channel loading: single-surface timeline state machine (#1099)
  feat: surface base + persona system prompts in observer feed (#1103)
  ci: move reminder e2e to a dedicated backend-integration job (#1098)
  fix: give agent-observer sub a replay-capable limit (#1100)
  fix: make managed-agent spawn and teardown portable to Windows (#1097)
  fix(desktop): constrain message timeline width with min-w-0 (#1092)
  feat(desktop): reminders notifications, snooze, overlay, and inbox view mode (#1093)
  feat(prompt): add memory hygiene and hoist universal engineering discipline to base prompt (#1085)
  fix(desktop): correct thread-unread badge flicker, stale clear, phantom count, mention gate, and nested count (#1080)
  Fix mention chip alignment (#1094)
  ...

# Conflicts:
#	crates/buzz-cli/src/commands/workflows.rs
tlongwell-block pushed a commit that referenced this pull request Jun 18, 2026
…te-response

* origin/main: (194 commits)
  Fold agent core memory into the session system prompt (#1112)
  feat(cli): add patches and issues commands for NIP-34 git collaboration (#1073)
  fix(desktop): stop random timeline message loss + page reconnect replay (#1105)
  Update README.md
  fix(desktop): keep thread replies from scrolling channel (#1109)
  fix(buzz-acp): accept siblings under allowlist author gate (#1108)
  feat(deploy): add production Helm chart for Buzz (#990)
  fix(desktop): keep MembersSidebar input usable while an add is in flight (#1106)
  chore(release): release version 0.3.25 (#1102)
  fix(desktop): stop dimming deferred message lists (#1104)
  Smooth channel loading: single-surface timeline state machine (#1099)
  feat: surface base + persona system prompts in observer feed (#1103)
  ci: move reminder e2e to a dedicated backend-integration job (#1098)
  fix: give agent-observer sub a replay-capable limit (#1100)
  fix: make managed-agent spawn and teardown portable to Windows (#1097)
  fix(desktop): constrain message timeline width with min-w-0 (#1092)
  feat(desktop): reminders notifications, snooze, overlay, and inbox view mode (#1093)
  feat(prompt): add memory hygiene and hoist universal engineering discipline to base prompt (#1085)
  fix(desktop): correct thread-unread badge flicker, stale clear, phantom count, mention gate, and nested count (#1080)
  Fix mention chip alignment (#1094)
  ...

Co-authored-by: Tyler Longwell <tlongwell@squareup.com>
Signed-off-by: Tyler Longwell <tlongwell@squareup.com>

# Conflicts:
#	crates/buzz-cli/src/commands/workflows.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant