Skip to content

feat(notes): agentic meeting notes for long meetings - #22853

Merged
Git-on-my-level merged 19 commits into
mainfrom
lane/agentic-notes
Oct 21, 2026
Merged

Git-on-my-level merged 19 commits into
mainfrom
lane/agentic-notes

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Agentic meeting notes for long and meeting-like conversations, on the shaped harness. Production notes for the 2026-10-20 weekly Zoom said "the other speaker" although the Zoom tile, calendar and screenshots named him. Three things caused it: the notes call was a tool-free one-shot (Budget(turns=1, tool_calls=0)), the writer ignored the roster and background pack that rich_notes_inputs already builds, and the conv-structure gateway lane rejects tools. In a blind review on 10 long meetings, the agentic prototype (lab v2) won 7, versus 1 for production.

What ships:

  1. Agentic notes on the shaped harness (utils/llm/notes_agent.py). The loop is shaped_agent.run_loop with read-only tools and a terminal submit_notes tool. The tool's payload validates as AgentNotesSubmission, a StructuredExtraction subclass that adds participants with evidence. Participants are stored on structured.participants with a new optional evidence field; there is no client UI work. The one-shot parser schema and its prompt bytes are unchanged.

  2. Owner-scoped, read-only tools (utils/conversations/notes_agent_tools.py). The server binds the owner UID and conversation id when it builds the toolbox, and no tool argument carries a uid. The tools reuse existing readers:

    • screen activity by time window (12 h cap; messaging-app OCR is dropped, as in the screen digest);
    • view_screenshot, which serves only the frames already loaded under the screenshot setting;
    • calendar; people; memories and tasks through Dream's OwnerSearch;
    • search_past_meetings (by person, title or topic) and get_past_meeting (ids seen in the packet or a search only).

    There are no write tools.

  3. Prefetched evidence packet: calendar overlap, top window titles, screenshot ids, listed participants (roster), the existing BACKGROUND CONTEXT block (screen moments with tile names, people facts, memories, corrections), and up to 3 related past meetings (same calendar series or same participants) with gist and open tasks. The packet seeds investigation; it does not replace it.

  4. Personal lexicon: the existing conversation_known_spellings block (Dream learn_term vocabulary plus trusted People). It now sits in the notes agent's stable per-user prefix.

  5. Formatting: nested bullets are required, with an example in the prompt. Length is scaled to the transcript (about 1.3–1.4× production on long meetings). Action-item and next-steps sections are not allowed. A first submission that breaks these rules is sent back once with the exact problems; anything after that is repaired statically.

  6. Task reconciliation stays with Dream: update/complete candidates are dropped, and new items are de-duplicated against open_tasks.

  7. Value-proportional budget: one function, notes_agent_policy.plan_notes_agent.

    • The agent runs for conversations over 1,500 words, or 300+ words with calendar/roster, call-screen or multi-source capture evidence.
    • Everything else, plus BYOK and non-gateway routes, keeps today's one-shot path unchanged.
    • Lookups are capped at 6, 10 or 15 by length; cost is capped at about 2¢; the next turn is forced to submit after 75 s; the deadline is 120 s.
    • Any failure falls back to the one-shot path through record_fallback(component=conversation_notes).
  8. Cache-friendly prefix: fixed order of shared contract + instructions → tools → lexicon + owner profile (breakpoint) → packet + transcript (breakpoint) → append-only tool turns. Nothing volatile goes in the prefix. The per-user prompt_cache_key is computed over the stable bytes, and the gateway scopes it to the owner again. A reusable omi_shaped_agent_input_tokens_total{feature,kind=cached|uncached} metric is added to the harness.

  9. Gateway: tools are enabled on the generated conv_structure lane (config_loader._capabilities_for_feature), so accounting and kill switches stay per feature. Image input already worked on this lane.

  10. Metrics:

    • omi_notes_agent_runs_total{stop}, _decisions_total{reason}, _tool_use_total{tool}, _repairs_total{kind}, _tokens_total{kind};
    • histograms for tool calls, turns, estimated cost, cache-hit ratio and latency;
    • a conversation_notes_agent_receipt log line.

Rollout and ramp plan

The agent is on by default with a kill switch, registered in config/feature-flags.yaml:

  • CONVERSATION_NOTES_AGENT_ENABLED (ops_kill, default on; false returns every conversation to the one-shot path);
  • CONVERSATION_NOTES_AGENT_PERCENT (stable conversation-hash cohort; unset = 100, unreadable = 0);
  • CONVERSATION_NOTES_AGENT_UID_ALLOWLIST.

Order matters. The gateway change must deploy first. Until it does, conv-structure returns capability_not_supported, every eligible conversation falls back to one-shot (fail-open, counted in omi_fallback_total{component=conversation_notes,reason=capability_mismatch}), and it pays one extra rejected request.

Step Cohort Owner Duration
1 Gateway deploy with conv_structure tools operator —
2 Backend deploy with ops env CONVERSATION_NOTES_AGENT_PERCENT=5, CONVERSATION_NOTES_AGENT_UID_ALLOWLIST=<David> operator 3 h
3 Unset CONVERSATION_NOTES_AGENT_PERCENT (100%) operator by 2026-10-27 (registry review date)

Metrics that must stay clean during step 2:

  • estimated cost per run (omi_notes_agent_estimated_cost_usd): p50 ≤ $0.007, p95 ≤ $0.015;
  • empty-notes rate (one-shot fallbacks via omi_fallback_total{component=conversation_notes} plus omi_notes_agent_runs_total{stop!~"submitted|forced_submit"}): ≤ 2% of eligible runs;
  • latency p95 (omi_notes_agent_latency_seconds) ≤ 45 s;
  • tool-call distribution (omi_notes_agent_tool_calls): median 5–8 on long meetings, p95 at the cap;
  • cache-hit ratio (omi_notes_agent_cache_hit_ratio, omi_shaped_agent_input_tokens_total{feature="conversation_notes_agent"}): ≥ 40%.

Rollback: set CONVERSATION_NOTES_AGENT_ENABLED=false.

Blind experiments

Round 3 (v3, 10 meetings): David's labels went v2-deep 7, v3 3, prod 0. v3 was about 1.05× production length and made a median of 0 lookups: the prefetched packet replaced investigation instead of seeding it.

v4 retuned toward v2-deep and keeps the plumbing (nesting, lexicon, past-meeting packet and tools, cache layout, caps, kill switch):

  • Investigation is required. The packet is presented as leads to check. Every named person, unnamed speaker and uncertain entity is verified with tools before submitting. Budgets now carry a minimum of 2, 4 or 5 lookups, inside the unchanged caps of 6, 10 or 15. A submission made earlier is sent back once to investigate, and it keeps its tool access for that.
  • Longer notes. The target is about 1.3–1.4× production on long meetings. The length bands are raised, and a length floor sends back a thin first submission.

Round 4 (4 fresh unseen meetings, 2.8k–10.8k words; no unused meeting with screenshots remained): task meeting-notes-v4-2026-10 (prod vs lab v2-deep vs v4), labels pending.

prod v2 deep v4 (this PR)
Notes with nested bullets 1/4 0/4 4/4
Body length vs prod (median) 1.0× 1.17× 1.41× (1.28–1.66)
Action-item sections 0 0 0
Lookups (median) — 6 8.5 (6–11)
Est. cost, median / max (Luna card) — $0.0027 / $0.0040 $0.0055 / $0.0097
Cached / total input — 44% 71%

Round 4b (4 single-sitting Mac calls) tied v2-deep 2–2, prod 0. v4 lost both of its cards because it did not name the other speaker, the original bug. The causes:

  • Tools took explicit start and end times. The model sent UTC clock times with a local offset, so get_screen_activity searched the wrong hours.
  • The packet carried screen evidence only as raw window titles. A Telegram call window "Kory Hoang" with "End call", or a "Sarath Donepudi | LinkedIn" page opened from the calendar invite, never reached the model as a person.
  • The prompt's caution ("screen listings are observations") outweighed its permission to name.
  • When a section used body instead of body_markdown, the one send-back was spent on a spurious "prose / 0 words" complaint.

v5 (this head):

  • people_on_screen leads (utils/conversations/screen_people_leads.py, pure). Built from window titles from 10 minutes before the call to its end:

    • call windows (messenger title plus call controls in OCR);
    • chat windows;
    • LinkedIn profile pages.

    The owner, AI agents (Boardy and similar), groups and channels are excluded. No OCR text is returned.

  • UTC everywhere. Packet times are …Z, and the tool time arguments are optional and default to the conversation window.

  • Positive naming rule. Name the other speaker whenever the evidence supports it, and record them in participants with speaker key and evidence. AI notetakers and matchmakers are never the speaker. A note that names nobody while strong leads exist is sent back once, and keeps tool access.

  • Body alias. body and similar keys are normalized to body_markdown before checking.

  • Regression tests:

    • a screen fixture with a call window and a profile page naming the other party;
    • group, owner and bot exclusion, and the time window;
    • the packet carrying the lead;
    • the send-back that gets the name into participants, title and notes.

v5 replay on the four 4b meetings plus the original 79e8e434 audit conversation names the right person in participants, title and notes in 5/5, on two independent runs:

Conversation Should name v4 v5
5e899c20 Sarath Donepudi (LinkedIn from invite) "unnamed founding-engineer candidate" Sarath Donepudi
10c6ef0b Kory Hoang (Telegram call) "unidentified Stably collaborator" Kory Hoang
d2b9228b Nik Shevchenko Nik Nik Shevchenko
cca27ab4 Nik Shevchenko Nik Nik Shevchenko
79e8e434 Nik Shevchenko not run Nik Shevchenko

v5 on these 5:

  • nested bullets 5/5, no action-item sections;
  • length median 1.28× prod (0.90–1.59);
  • median 9 lookups;
  • est. cost median $0.0024, max $0.0039;
  • cache about 85%.

v4 ran the production modules from this PR unchanged, with a snapshot toolbox and the dev gateway's chat-agent lane (same gpt-6-luna; conv-structure gains tools only with this PR). Private data stayed local.

Out of scope, noted:

  • Frames whose storage_bucket is the dev bucket are currently dropped by own_frames; that is pending David's decision on dev screenshot writes.
  • Multi-device recording merge belongs to the episodes project.

Deferred:

  • Live STT keyterms from the same lexicon. The wiring already exists (utils/dream_vocabulary.keyterms, behind DREAM_AGENT_VOCABULARY_STT, default off, capped at 100 terms per fix(backend): refuse a custom vocabulary over 100 terms #22401). Adding trusted People names and turning it on changes live STT for every user, so it needs its own WER and cost check. It is a follow-up, not part of this PR.

Verification

  • Backend unit tests run with BACKEND_UNIT_TEST_FILE_LIST=<file> ./test.sh: the new tests/unit/test_notes_agent.py plus the existing suites for every module touched (shaped agent, notes v2, screen-frame evidence, known spellings, gateway config, dedupe, process_conversation callers). The new tests cover:
    • the budget gate and kill switch;
    • tool scoping (owner-only, read-only);
    • forced submit at the tool cap, last turn, cost cap and wall clock;
    • prefix stability and the cache-token metric;
    • the nesting, no-action-section and length validator;
    • participant and task repairs;
    • a synthetic replay through the shaped notes writer (tests/unit/fixtures/notes_agent/weekly_sync_replay.json, no real user data).
  • pyright reports 0 errors on the new modules; scripts/check_feature_flag_registry.py passes; make runtime-image-source-closure passes; the app-client OpenAPI export and the generated Swift, Dart and TS client types are regenerated for the additive Participant.evidence field.
  • Dev gateway probes: conv-structure with tools returns capability_not_supported today, as expected. chat-agent accepts tool_choice=required and a named function, multiple prompt_cache_breakpoints and prompt_cache_key, and a second call read 1,318 of 1,450 prompt tokens from cache across a tool_choice change.

Product invariants affected

  • INV-TASK-2 (capture proposes only where a Suggested surface exists): agent action items leave through the unchanged structured.action_items path and the same task_intelligence_capture policy, so desktop still gets Candidates and other clients still get the conservative filter. The agent prompt carries the same strict/loose split as the one-shot prompt (conservative filter when there is no Suggested surface). The notes pass never updates or completes tasks: those candidates are dropped, and reconciliation stays with Dream.
  • INV-MEM-4 (canonical promotion is the sole Long-term authority): notes never write memories. Tools only read memories through OwnerSearch, and participants are stored on the conversation's structured.participants, not in any memory tier.

UI-Evidence: none -- only the generated Swift DTO gains an optional Participant.evidence field; no rendered UI changes

🤖 Generated with Claude Code

Git-on-my-level and others added 10 commits October 20, 2026 17:34
Long and meeting-like conversations get notes from a bounded agent loop:
read-only owner-scoped tools (screen activity, this call's screenshots,
calendar, people, memories, past meetings, tasks), a prefetched evidence
packet, the personal lexicon in a cache-stable per-user prefix, and a
terminal submit_notes validated as StructuredExtraction plus evidenced
participants. Nested bullets are required, length scales with the
transcript, action-item sections are refused, and task reconciliation
stays with Dream.

One function (plan_notes_agent) gates and budgets the agent: >1500 words
or 300+ words with calendar, call-screen or multi-source evidence; <=15
lookups and ~2 cents, then a forced submit. Everything else, BYOK and
non-gateway routes keep the one-shot path unchanged, and any failure falls
back to it. Kill switch CONVERSATION_NOTES_AGENT_ENABLED (default on) with
a percent/allowlist ramp. The gateway conv_structure lane now accepts
tools. Adds notes-agent metrics and a reusable cached/total input-token
counter on the shaped harness.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… off Suggested surfaces

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mintlify

mintlify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
omi 🟢 Ready View Preview Oct 20, 2026, 7:14 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T20:25:27.437575Z 5eb0af0 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 50cdaa34c9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +126 to +130
lo = _as_utc(start) or self.started_at
hi = _as_utc(end) or self.finished_at
if hi < lo:
lo, hi = hi, lo
if hi - lo > timedelta(hours=MAX_WINDOW_HOURS):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Clamp tool windows to the current conversation

The start and end values are supplied by the model from untrusted evidence, but _window accepts any parsed timestamps and only limits their distance to 12 hours. A prompt-injected or mistaken tool call can therefore read screen OCR and calendar data from an unrelated period and incorporate it into the notes; clamp both bounds to self.started_at and self.finished_at before querying.

Useful? React with 👍 / 👎.

result = asyncio.run(invoke())
except Exception as error: # noqa: BLE001 - the one-shot path still writes the notes
reason = 'capability_mismatch' if 'capability' in type(error).__name__.lower() else 'other'
logger.warning('conversation notes agent failed uid=%s error=%s', uid, type(error).__name__)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Sanitize owner IDs in failure logs

When an agent invocation fails, this writes the stable owner UID directly to application logs; the newly added owner-profile and packet-read warnings repeat the same pattern. These failures are expected fallback paths, so production incidents will persist raw account identifiers in logs instead of sanitizing or omitting them. Use the repository sanitization helpers or content-free correlation data.

AGENTS.md reference: backend/AGENTS.md:L193-L195

Useful? React with 👍 / 👎.

Comment on lines 141 to +143
'tier_escalation': os.getenv('NOTES_TIER_ESCALATION_ENABLED', ''),
'shaped_notes_mode': os.getenv('OMI_SHAPED_AGENT_MODE', 'off'),
'notes_agent': os.getenv('CONVERSATION_NOTES_AGENT_ENABLED', 'true').strip().lower(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include rollout controls in the notes fingerprint

The selected notes implementation also depends on CONVERSATION_NOTES_AGENT_PERCENT and CONVERSATION_NOTES_AGENT_UID_ALLOWLIST, but only the enabled flag enters the persisted dedupe fingerprint. If an unchanged conversation was processed outside the cohort and the percentage is later raised—or its owner is allowlisted—a reprocess can reuse the earlier one-shot result without invoking the agent, undermining the staged rollout and its measurements. Include every decision control, or the resolved agent decision, in the fingerprint.

Useful? React with 👍 / 👎.

Comment on lines +59 to +61
if not text or _ROLE_PREFIX.match(text) or "'s " in text or '’s ' in text:
return False
return any(word[:1].isupper() for word in text.split())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Accept participant names from uncased scripts

For participants whose names use an uncased writing system, such as 王伟 or an Arabic name, every character returns false from isupper(), so is_named rejects the valid name and repair_notes silently removes that participant. Since notes can be generated in arbitrary response languages, detect role descriptions without requiring capitalization.

Useful? React with 👍 / 👎.

Comment on lines +146 to +149
except Exception as error: # noqa: BLE001 - the one-shot path still writes the notes
reason = 'capability_mismatch' if 'capability' in type(error).__name__.lower() else 'other'
logger.warning('conversation notes agent failed uid=%s error=%s', uid, type(error).__name__)
record_fallback(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Classify gateway capability errors by their response code

During the documented gateway-first rollout, the old lane returns HTTP 400 with code capability_not_supported; through ChatOpenAI this surfaces as a generic bad-request exception whose type name does not contain capability. This branch consequently records the fallback as other, so the expected capability_mismatch rollout signal never appears. Inspect the structured gateway error code rather than the Python exception class name.

Useful? React with 👍 / 👎.

Comment on lines +145 to +149
result = asyncio.run(invoke())
except Exception as error: # noqa: BLE001 - the one-shot path still writes the notes
reason = 'capability_mismatch' if 'capability' in type(error).__name__.lower() else 'other'
logger.warning('conversation notes agent failed uid=%s error=%s', uid, type(error).__name__)
record_fallback(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Record usage from agent runs that later fail

If a provider error occurs after one or more successful tool turns, run_notes_agent raises into this handler and record_run(result) below is skipped, even though those earlier turns were billed. During the rollout, failed multi-turn runs are therefore absent from the agent cost, token, latency, turn, and tool-call metrics, biasing the stated cost and latency thresholds toward successful runs. Preserve and record the partial result on failure before falling back.

Useful? React with 👍 / 👎.

Comment on lines +129 to +133
sections = [section for section in repaired.get('sections') or [] if isinstance(section, Mapping)]
kept = [section for section in sections if not is_action_heading(str(section.get('heading') or ''))]
if len(kept) != len(sections) and kept:
repairs.append('action_section_dropped')
repaired['sections'] = kept

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Drop action-only sections during static repair

After the first rejected submission, a later malformed submission is accepted and relies on this repair. If every section has an action-style heading, kept is empty and the and kept guard leaves all of those sections intact, so commitments remain duplicated in both the visible note body and action_items despite the stated no-action-section contract. Assign the filtered list even when it is empty; the overview can remain as the fallback note content.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c07289bf5b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +69 to +71
raw = os.getenv(PERCENT, '').strip()
if not raw:
return 100

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Declare the initial cohort before defaulting to 100%

When CONVERSATION_NOTES_AGENT_PERCENT is unset, this admits every eligible conversation, but the new flag registry explicitly says the first deployment should use 5%. I checked backend/deploy/runtime_env.yaml, the backend Helm values, and deployment workflows, and none declares this percentage or the allowlist, so the normal production rollout immediately runs the multi-turn agent at 100%, bypassing the planned cost, latency, and empty-note observation window. Add the initial rollout values to every conversation-processing host, or fail closed while the rollout variable is absent.

AGENTS.md reference: backend/AGENTS.md:L153-L153

Useful? React with 👍 / 👎.

Comment on lines +121 to +125
others = [
person
for person in people
if str(person.get('name') or '').strip().casefold() not in owners and is_named(str(person.get('name') or ''))
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Ground participant names before persisting them

When the model submits a plausible capitalized hallucination such as Jane Doe with an arbitrary evidence string, this filter retains it because it checks only that the name is not the owner and looks capitalized. Neither check_notes nor the subsequent conversion corroborates the name against the transcript, roster, packet, or tool results, so fabricated attendees and their purported evidence become persisted user-visible notes. Validate each participant against the available evidence before retaining it.

Useful? React with 👍 / 👎.

Comment on lines +73 to +74
has_calendar=roster is not None,
has_call_screen=bool(frames) or bool(kwargs.get('desktop_meeting_capture')),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Distinguish a roster from calendar evidence

A non-None roster does not prove that calendar evidence exists: _rich_meeting_roster also creates one for the multi-party-speech gate and returns an empty roster when context construction fails. Consequently, a 300–1499-word multi-speaker recording with no calendar, call screen, or multi-source capture is passed as has_calendar=True and enters the agent lane contrary to the documented eligibility policy; pass the actual calendar-context signal instead.

Useful? React with 👍 / 👎.

owner_names=owner_names,
)

result = asyncio.run(invoke())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Move the agent loop out of the postprocess worker

On the finalization and integration paths, process_conversation already occupies one of the 24 postprocess_executor workers, and this asyncio.run keeps that worker blocked while the agent awaits model and database operations for up to 120 seconds, potentially followed by the one-shot fallback. With 24 concurrent eligible meetings, all postprocess slots can therefore be occupied by sleeping coordinators and unrelated conversation finalizations queue behind them; run this long orchestration asynchronously or on a separately sized pool.

AGENTS.md reference: backend/AGENTS.md:L281-L281

Useful? React with 👍 / 👎.

Comment on lines +138 to +141
return (
(prompt - cached) * INPUT_USD_PER_MILLION
+ cached * CACHED_INPUT_USD_PER_MILLION
+ output * OUTPUT_USD_PER_MILLION

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Account for cache writes in the agent cost cap

Every agent run enables explicit prompt caching, and the pinned gateway rate card bills cache-write tokens at $0.125/M, but _usage returns only total input, cache reads, and output, so this estimator prices every non-read token at the ordinary $0.10/M rate. On the first turn for a conversation, the unique conversation prefix is written to cache, causing result.cost_usd, the cost histogram, and the force-submit guard to understate the billed cost and potentially let a run exceed the advertised $0.02 cap. Carry the reported cache_write_tokens and its rate through the local accounting.

Useful? React with 👍 / 👎.

Git-on-my-level and others added 2 commits October 20, 2026 23:28
Round 3 labels favored lab v2-deep 7-3: v3 ran ~1.05x production length
with a median of zero lookups, so the prefetched packet replaced
investigation. v4 presents the packet as leads, requires verifying every
person, unnamed speaker and uncertain entity with tools (minimum 2/4/5
lookups inside the unchanged 6/10/15 caps; one send-back that keeps tool
access), and raises length to ~1.3-1.4x production with a floor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level and others added 2 commits October 21, 2026 01:32
…le evidence

v4 lost both 4b cards for not naming the other speaker. The screen tool
took explicit times and the model sent UTC clock times with a local
offset; screen evidence reached the packet only as raw titles; the prompt's
caution outweighed its permission to name; and a body/body_markdown key
slip spent the one send-back on a spurious prose complaint.

Adds people_on_screen leads (call windows, chats, LinkedIn profile pages;
owner, AI agents and groups excluded; titles only), UTC packet times with
optional tool windows, a positive naming rule with participants speaker
mapping, a one-time naming send-back when strong leads exist, and section
body-key normalization, with regression tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 00cd221887

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +292 to +296
named = [
person
for person in arguments.get('participants') or []
if isinstance(person, dict) and str(person.get('name') or '').strip() and not person.get('is_ai_agent')
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject placeholders before counting named speakers

When naming_leads contains an evidenced counterpart, a submission containing only an owner entry or a placeholder such as Other attendee satisfies this named test because it checks only for nonempty text and is_ai_agent. The naming retry is therefore skipped, and repair_notes subsequently removes that participant, allowing the notes to persist without the evidenced speaker this check was added to require. Apply the same owner/role-name validity criteria here before deciding that somebody was named.

Useful? React with 👍 / 👎.

'arguments': kwargs,
'tier_escalation': os.getenv('NOTES_TIER_ESCALATION_ENABLED', ''),
'shaped_notes_mode': os.getenv('OMI_SHAPED_AGENT_MODE', 'off'),
'notes_agent': os.getenv('CONVERSATION_NOTES_AGENT_ENABLED', 'true').strip().lower(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add agent modules to the dedupe implementation digest

This makes agent selection part of the persisted notes fingerprint, but implementation_digest('notes') still omits every new agent implementation file, including the prompt, validation, tools, policy, and serving modules. After a prompt or repair fix changes one of those files without also touching an older file in the digest list, reprocessing an unchanged conversation can match the old hash and reuse notes produced by the previous implementation instead of running the fix.

Useful? React with 👍 / 👎.

SUBMIT,
'Submit the finished notes. Call exactly once, when done. A rejected submission explains what to fix.',
{
'title': {'type': 'string', 'description': 'At most 70 characters'},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Enforce the advertised title length limit

The title schema only describes the 70-character limit; it does not declare maxLength, AgentNotesSubmission.title has no maximum, and check_notes never checks the title. Consequently, any overlong title emitted by the model is accepted and persisted, while the later presentation pass intentionally does not truncate titles. Encode the limit in the schema or deterministic validation so long agent titles cannot violate the client-facing contract.

Useful? React with 👍 / 👎.

Comment on lines +459 to +460
agent_payload = agentic_notes_payload(
uid=uid, prefix=prefix, model=model, capture_evidence=context, words=words, frames=frames, kwargs=kwargs

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Count only transcript words for agent eligibility

The words value passed here is counted from prefix.shaped_context, which includes the serialized speaker map, calendar/screen metadata, and photo descriptions before FULL TRANSCRIPT. A transcript below the 300- or 1500-word thresholds can therefore enter a larger agent tier solely because its metadata is verbose; crossing 1500 also imposes the 480-word note floor, encouraging padded notes for a shorter conversation. Derive the eligibility and length-budget count from the transcript portion only.

Useful? React with 👍 / 👎.

Comment on lines +430 to +436
def to_participant(self) -> Participant:
return Participant(
name=self.name,
organization=self.organization,
is_ai_agent=self.is_ai_agent,
source='transcript' if self.evidence_kind in (None, 'transcript') else 'roster',
evidence=self.evidence,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve non-roster participant provenance

A participant grounded by people, memory, or past_meeting is unconditionally serialized with source='roster', even though the public field contract defines roster as meeting metadata. For example, a person identified from a People record and mapped to a current transcript speaker is exposed to clients as roster-confirmed attendance. Only actual calendar/screen-roster evidence should receive roster; other grounded speaker identities need transcript provenance or a distinct source value.

Useful? React with 👍 / 👎.

Comment on lines +280 to +284
AgentNotesSubmission.model_validate(arguments)
except ValidationError as error:
fields = sorted({'.'.join(map(str, row['loc'])) for row in error.errors(include_input=False)})[:6]
return 'Schema problems at: ' + ', '.join(fields), None
check = check_notes(arguments, transcript_words=transcript_words)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Validate the normalized submission instead of raw arguments

AgentNotesSubmission.model_validate(arguments) can silently drop malformed list elements through _keep_usable_content, but its normalized result is discarded and check_notes examines the original mapping. A section missing a required field can therefore supply enough bullets and words to pass check_notes, then disappear when the payload is parsed again before persistence, leaving the user with no section body. Run the checks and subsequent repairs against the validated model dump so rejected elements cannot count toward acceptance.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5eb0af0a85

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +349 to +351
rows: Any = screen_activity_db.get_screen_activity(
uid, start_date=start - timedelta(minutes=LEAD_MINUTES_BEFORE), end_date=end, limit=400
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Respect the production screen-context gate

When the agent lane runs in production, this unconditional query reads screen-activity rows for every eligible long transcript, even though word count alone admits the conversation and the production contract keeps OCR context reads off. build_packet then sends window titles and OCR-derived participant leads to the notes model, so long dictations and imported audio can acquire unrelated screen context without passing the existing meeting/context gate. Pass the context-read decision into the packet/toolbox and skip this read when production screen context is disabled.

AGENTS.md reference: backend/AGENTS.md:L134-L134

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit 87c5b14 into main Oct 21, 2026
71 of 73 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/agentic-notes branch October 21, 2026 02:39
Git-on-my-level added a commit that referenced this pull request Oct 21, 2026
…22988)

Four rules move from the notes agent's local fixes (#22853) into the harness so
Dream, chat and future agents get them from shared code:

1. Time windows default to context. A run carries a ContextWindow on its Mount
   (and Dream's Session): the conversation for notes, the trailing day for Dream,
   the attached chat timeframe or last 24 hours for chat. Time-range tools fill
   missing bounds with ContextWindow.resolve. Dream temporal search defaults to the
   day and reports the window it used; chat get_screen_activity_tool no longer
   requires start/end.
2. Times in UTC. model_json/model_view render every instant shown to the model with
   a trailing Z (notes tool results and packet, Dream seed and tool results).
   parse_tool_time converts offsets, reads naive times as UTC (chat: the user's
   zone, matching its labelled local display) and rejects nonsense with an error
   that names the field and the expected format. Dream search accepts offsets and
   naive times instead of rejecting them; chat screen search no longer silently
   drops an unreadable date.
3. Normalize before validating. Schemas declare near-miss keys as
   output_aliases data (ExtractedSection: body -> body_markdown);
   normalize_output/validate_output apply them recursively. Replaces the notes
   agent's ad-hoc normalize_submission; Dream tool arguments and the Dream
   verifier's structured output go through the same path.
4. Send-back budgets per failure class. SendBackBudget keeps one budget per class
   (notes: format, content, evidence). Format problems go back alone, so a format
   complaint can no longer spend the naming-evidence retry.

Documents the rules in backend/utils/llm/ARCHITECTURE.md; tests in
tests/unit/test_agent_tool_rules.py.

Co-authored-by: Claude Opus 5.5 <[email protected]>
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