Skip to content

✨ meetings: Betty persona, intro and question-driven chat answers (phase A) - #18397

Merged
kubestellar-prow[bot] merged 3 commits into
v5from
feat/betty-persona
Nov 16, 2026
Merged

kubestellar-prow[bot] merged 3 commits into
v5from
feat/betty-persona

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Phase A of the Betty persona plan (#18391). Fixes #18392.

Hive now attends meetings as a persona: Betty ("Betty Bee from the hive") by default.

What changes

  • Config (src/pkg/config/meetings_persona.go): new meetings.persona block. It is a preset (preset, default betty) plus explicitly set fields, and every key has an HIVE_MEETINGS_PERSONA_* override. Keys: enabled, name, display_name, aliases, pronouns, language (BCP-47), voice (TTS id), voice_type, accent, intro_template, leave_phrases, humor, unprompted.{per_10m, min_gap_s, per_meeting, answer_wait_s, min_confidence, queue_depth, stale_s} and searxng_url (reserved). Resolve() returns the effective persona and Validate() checks it. The persona's display name is now the default bot name (meetings.bot_name still wins), and the default consent text names Betty, says she records the transcript, and says how to remove her ("betty leave" or "hive leave"). With the persona off, hive behaves as before.
  • Manager: leave_phrases replace the single leavePattern (LeaveMatcher). The echo filter also matches the bot's display name when the platform decorates it ("(Guest)") or when it shows up as a speaker.
  • src/pkg/meetings/betty (new):
    • Triggers: addressed at the start or end of a line, "hey betty", speech-to-text variants, intro requests, and a voice-wanted flag kept for phase B.
    • Room-question detection and topic keys.
    • A queue with the 8 s answer wait. A question is dropped when another person's non-question line covers 30% or more of its topic. One reply per question, Jaccard 0.5 dedupe, and unprompted caps, which addressed requests bypass.
    • Parallel retrieval under 1.5 s behind a Retriever interface, with knowledge FileStore, bead and code-map implementations.
    • One meetllm call per answer, returning {answer, confidence, needs_research, sources}.
    • Persona prompts: locale from language, context is data and never instructions, light humor or off, honest when unsure, never claims actions it did not take.
    • The preset listing lives in presets.go.
  • Live session: an optional persona engine, fed final lines and chat without blocking. Replies come back on a channel and go through the existing budget (account), chat rate limit (post) and say fallback. With Betty on:
    • Spek say is dropped.
    • Spek chat.post goes to Betty's queue, deduped.
    • Spek ask is reworded by Betty with an 800 ms call, falling back to the raw text.
    • matchAnswer skips lines addressed to Betty and leave commands.
    • The budget notice and the notes header use the persona's name.
  • meetllm: optional System prompt field. hive meeting-llm is unchanged.
  • Wiring: the KnowledgeAPI FileStores and bead stores accessors are passed to the persona factory. Code maps are used only when knowledge.code_maps.enabled is on.
  • Docs: a Betty section in meetings.md, the persona env vars in env-vars.md, and a changelog fragment.

Phase B seams

  • Retriever interface: a web retriever (SearXNG) plugs in next to the others.
  • Reply.Kind: chat or voice. A voice reply already routes to say, which falls back to chat.
  • VoiceWanted is recorded, and voice / searxng_url are stored but not used yet.

Tests

  • Transcript replay through live.Runner with a fake quorum, a fake Spek and a fake model. It covers intros, addressed answers, question-driven posts, caps, already-answered drops, one reply per question, dedupe, matchAnswer skips, no Spek double replies, the humor off switch, and prompt-injection text staying inside the data block.
  • Unit tests for the betty engine, triggers, retrievers, config, the leave matcher and meetllm.

🤖 Generated with Claude Code

…ase A)

Hive attends meetings as a configurable persona, Betty ("Betty Bee from the
hive") by default (meetings.persona, preset + explicit fields + env).

- config: meetings.persona block (preset, name, display_name, aliases,
  pronouns, language, voice, voice_type, accent, intro_template,
  leave_phrases, humor, unprompted caps, searxng_url), Resolve() and
  Validate(); the display name becomes the default bot name and the consent
  text names the persona and both leave phrases.
- meetings: leave phrases replace the single hive-leave pattern; the echo
  filter tolerates platform-decorated bot names.
- betty: triggers, room-question detection, queue with answer wait,
  already-answered drops, Jaccard dedupe and caps, parallel retrieval
  (knowledge FileStores, beads, code maps) behind a Retriever seam, one
  meetllm call returning JSON, persona prompts that treat context as data.
- live: optional persona engine fed without blocking; replies go through
  the session's budget, rate limit and say fallback; Spek say dropped,
  chat.post offered, ask restyled; matchAnswer skips addressed lines and
  leave commands.
- meetllm: optional system prompt.

Part of #18391. Fixes #18392.

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added dco-signoff: yes Indicates the PR's author has signed the DCO. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#18407 ⚠️ Retire /api/campaigns, campaign Jam and Recheck same files src/cmd/hive/main.go
#18405 ✨ Inbox: send items into an Inception (spek) session same files src/docs/env-vars.md

@hivecommons-hive

hivecommons-hive Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • docker (contributor)

Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path.

Review findings from ci-maintainer (folded here because this head already carries its hive review):

Security perspective, read at head b58f641 (diff plus manager.go, session.go, meetingswire.go, betty/*, knowledge/types.go). No blocker; one low note.

Low — a participant named like the bot now vanishes from the transcript (src/pkg/meetings/manager.go:583-589). fromHive newly matches ev.Speaker.Name (not just chat Author) with IsBotName, which also accepts any trailing (…). An attendee who renames themselves "Betty Bee from the hive" or "Betty Bee from the hive (Alice)" has every spoken line dropped before handleLine records it or checks leave phrases, so their speech is missing from the transcript and notes while the meeting runs under a consent notice saying it is recorded. Before this PR only chat authors were filtered. Suggest limiting the parenthetical tolerance to the platform suffixes you actually see:

	if strings.HasSuffix(name, ")") {
		if i := strings.LastIndex(name, "("); i > 0 {
			switch strings.ToLower(strings.TrimSpace(name[i:])) {
			case "(guest)", "(bot)":
				return strings.EqualFold(strings.TrimSpace(name[:i]), botName)
			}
		}
	}

Advisory, not blocking: per #18391 Betty answers any attendee from the knowledge vaults, bead notes and code maps (betty/retrieve.go:124-257, wired at src/cmd/hive/meetingswire.go:241-249). knowledge.Fact has no visibility field (knowledge/types.go), so whatever is in a vault is reachable by anyone who can speak in a meeting, bounded only by the 240-rune snippet clip and the model. The prompt isolation (persona.go:60-66 strips <<</>>>; data block framing) is sound for what it is. Worth a vault/tag allowlist for retrieval in a later phase.

Settings parity requires each meetings.persona leaf to be referenced.

Signed-off-by: Andy Anderson <andy@clubanderson.com>
…leeps)

Signed-off-by: Andy Anderson <andy@clubanderson.com>

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correctness review at head b58f641 (reviewed diff plus the surrounding session.go and manager.go). Two in-scope findings.

1. The default alias "hive" over-triggers addressed replies (src/pkg/meetings/betty/trigger.go:164)

  • The end-of-line rule treats any line ending in an alias as addressed, unless the previous word is in trailingBlock.
  • "we should just use hive", "I think the problem is hive" and "tell hive" all match.
  • A line starting with "hive" followed by can, will, does or do also matches, for example "hive does not support that".
  • Addressed lines bypass the unprompted caps (queue.go addressed()) and always cost an LLM call plus a chat reply. That undercuts the "never spams" claim. The docs only promise that "hive is slow today" is not matched.
  • Fix: require punctuation before a trailing single-word alias ("..., Betty") and add tests for "we use hive" and "hive will be down".
-		if len(w) > len(name) && hasSuffix(w, name) && !trailingBlock[w[len(w)-len(name)-1]] {
+		if len(w) > len(name) && hasSuffix(w, name) && !trailingBlock[w[len(w)-len(name)-1]] &&
+			(len(name) > 1 || separatedBefore(raw, len(name))) {

separatedBefore is a new helper that checks for a comma or other punctuation right before the last word of the raw line.

2. Caps and dedupe are committed before the chat post succeeds (queue.go:332)

  • emit succeeding updates posts, lastPost and total, and rememberTopic follows.
  • The session then posts through s.rate.allow (session.go post(), around line 364), and deliver() can also fail.
  • When either fails, the cap and min-gap are spent and the topic counts as answered, but nobody saw an answer. An addressed request that is rate-limited is lost with no fallback.
  • Fix: have onPersonaReply report the result back to the engine, so it commits caps and dedupe only on success. Alternatively, exempt persona replies from s.rate, since the engine already enforces its own caps.

I did not run the tests.

— hive: agent=adjudicator backend=claude model=claude-sonnet-5-5 claude=2.1.325

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Review follow-ups (below review.backlog.min_severity: P2)

Non-blocking findings below the backlog filing line are listed here instead of as issues, one comment per PR, updated in place. Tick them off as they are fixed; set review.backlog.min_severity: P3 to file every finding.

@github-actions

Copy link
Copy Markdown
Contributor

Mutation testing

❌ gremlins did not produce a report for 1 package(s), so no verdict can be derived from this run (see the job log):

  • pkg/meetings: gremlins exited 137

6 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the mutation/acknowledged label to accept this.

File Line Mutation
src/cmd/hive/main.go 3594 CONDITIONALS_NEGATION
src/pkg/config/meetings_persona.go 350 CONDITIONALS_NEGATION
src/pkg/config/meetings_persona.go 352 CONDITIONALS_NEGATION
src/pkg/config/meetings_persona.go 354 CONDITIONALS_NEGATION
src/pkg/config/meetings_persona.go 356 CONDITIONALS_NEGATION
src/pkg/config/meetings_persona.go 358 CONDITIONALS_NEGATION

Verdict: error (#17349).

@clubanderson clubanderson added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 16, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow
kubestellar-prow Bot merged commit a2feba0 into v5 Nov 16, 2026
87 of 89 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the feat/betty-persona branch November 16, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ Betty A: persona, intro and question-driven chat answers from knowledge and beads

1 participant