Skip to content

feat: worker-defined chat mentions (@kanban, @session, @trace) - #1334

Merged
sergiofilhowz merged 6 commits into
mainfrom
sergio/worker-mentions
Oct 8, 2026
Merged

sergiofilhowz merged 6 commits into
mainfrom
sergio/worker-mentions

Conversation

@sergiofilhowz

@sergiofilhowz sergiofilhowz commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Any worker can now make its records mentionable in chat as @<name>(id="<id>") — a ticket, a session, a trace today; an email, a calendar event, a Slack user tomorrow — and both the person and the agent understand it:

  • In the ADE composer, @ lists the workers that offer mentions beside functions and files. From two characters on it searches all of them at once, one group per worker. Tab (or Enter) on a worker scopes the menu to @kanban: and that worker's own search. A picked item becomes a pill (icon, color, name) that previews on hover and opens on click (a worker page, a chat, or a trace in the traces screen).
  • The agent receives every mention a user writes already resolved: a one-line summary plus a pre-verified call that returns the full record. It may write mentions in its replies too, and the ADE renders them as pills.
  • No console or harness change per worker. A worker declares a provider in the metadata of one function. The contract is a new shared crate, crates/mention-contract, and a new skill, ade/mentions, teaches agents to build their own providers.

This PR ships three providers: kanban tickets (@kanban), sessions (@session) and engine traces (@trace).

Follow-ups:

Evidence

Recorded against workers built from this branch (anderson-agora project, Claude Sonnet 5.5 via Claude Code, Judge on TypeSafe). The GIFs cut out the agent's thinking time; the MP4s are the full runs.

Composer: @ menu → Tab into a worker → global groups → hover preview

composer

Transcript: what the agent was told → open a ticket → mention a trace, open it in the traces screen

transcript

Full runs: light (MP4) · dark (MP4)

@ — the mention sources sit above functions & files
@kan → @kanban, Tab to search it
@kanban: — recent tickets, colored by priority
@kanban:login — the worker's own ranking
@webhook — one group per worker, above files
@session:hello — past conversations
Pills in the composer; the hover preview (generic card)
The reply writes mentions itself (headings are pills)
"Context for the agent": a quiet row; the agent used the pre-verified kanban::ticket::get
Expanded: each summary and details call
Hover a pill in the transcript
Click it: the ticket opens beside the chat
@trace:send — agent turns by name
Click a trace pill: the traces screen expands that trace
Dark: the @ menu
Dark: what the agent was told

How it works

A provider is two functions and a descriptor (crates/mention-contract)

  • Search: { query, limit?, context? } → { items: [{ id, label, hint?, description?, icon?, color? }] }, best match first. An empty query means recent items.
  • Get: { id } → a MentionView (or null for an unknown id). The view carries:
    • label, hint, description, icon, color;
    • up to six fields;
    • open — a page with context, a chat session, or an http(s) URL;
    • summary — one line for the agent;
    • data — the domain object, for a worker's own preview.
  • Descriptor: registered as metadata.mention on the get function. It holds name, label, description, icon, color, the search function id, and details (the agent-facing function that returns the full record, e.g. kanban::ticket::get). The mention functions are internal and trace_hidden.
  • Token: @<name>(id="<id>"), with the id as a JSON string literal. fixtures/tokens.json holds the grammar cases, and the Rust and TypeScript parsers both run every one of them. A missing closing quote is tolerated on read, never written: testing showed a model dropping it, which left a raw token in the reply.

Providers

Worker Token Search Details call
kanban @kanban(id="<uuid>") key (KAN-12, 12, #12), then title prefix, title words, then description and labels; live tickets; most recent first kanban::ticket::get
session-manager @session(id="<session_id>") title words or id; top-level chats before sub-agents; e2e sessions and the asking session left out; never the parked draft session::get
ade (console) @trace(id="<trace_id>") engine::traces::list by span name across spans, or an exact trace id; newest first; an engine without the memory exporter answers empty engine::traces::tree

ADE

  • lib/mentions/:
    • the provider registry: engine::functions::list { include_internal: true }, refreshed when a worker joins or leaves;
    • cached, abortable fan-out search (2.5 s per provider);
    • a view cache shared by every pill;
    • the token grammar;
    • the parser for the judge's notes.
  • Lexical:
    • a WorkerMentionNode pill;
    • a text→pill transform (paste, restored drafts, edited queued messages);
    • MentionsPlugin builds its rows from a pure buildGlobalMenu / buildScopedMenu, so groups, "more …" rows and drill-down are tested without an editor;
    • in a scoped @worker: menu, Enter never sends the half-typed search.
  • Markdown: tokens in sent and received messages render as clickable pills; code stays literal.
  • Hover preview: the generic card, or the worker's own through the new host.mentions.registerRenderer (in types/injectable-ui.ts and packages/console-ui). It falls back to the generic card if the renderer throws.
  • The model's notes render as a quiet activity row instead of a raw block:
    • <mentions> reads as "Context for the agent" plus the pills;
    • other hook notes read as "Note to the model · memory";
    • <mention_providers> is hidden.
  • Traces: a @trace click opens the traces screen on that trace, and it wins over the session seed and over "follow turns".
  • Chat titles: a mention in the first prompt titles the chat by its item (where does @kan-8 …), not by the raw token.

Agent (judge + prompt)

The harness always runs judge, so the judge hosts the mention hook: judge::mentions::pre-generate, bound to harness::hook::pre-generate with fail_open.

  • <mention_providers>: the names an agent may write. Appended once per session, and again when the set of providers changes.
  • <mentions>: for each mention a user wrote that no earlier block resolved (at most 10, about 600 tokens), it adds:
    • the provider's summary;
    • details: <function> <payload> with the canonical id, offered only when the session's policy allows that function.

Both blocks are persisted and replayed by the harness, so the hook reads its own earlier blocks and never repeats one. It skips markdown code, attached files and other hooks' blocks. judge::mentions::resolve exposes the same resolution to any caller, and JUDGE_MENTIONS=false turns all of it off.

harness/prompts/default.txt teaches the token, both blocks, that details calls are pre-verified, and the fallback through discovery. It is mirrored byte for byte into iii-directory/prompts/iii.md, with a short version in default.md / iii-minimal.md.

Skills (for agents building their own mentions)

  • ade/mentions (new): the whole provider contract:
    • functions, descriptor, ranking and view rules;
    • icon/color vocabulary and open targets;
    • Node, Rust and any-language registration;
    • permissions and the optional renderer;
    • what the agent sees, and the definition of done.
  • Pointers:
    • ade/SKILL and ade/injectable-ui point to it and document host.mentions and the console::mentions::trace::* functions;
    • kanban's iii-node and ade-worker-design gain a "Chat mentions" section and the slot;
    • the kanban and judge skills say how agents read and write mentions, and how to verify a provider with judge::mentions::resolve.
  • Templates: the canonical harness-template skills get the same sections in docs(harness): mention items in chat; skills for building mention providers templates#107. The generated template/skills/harness copy here is left to the next sync.sh.

Tests

Where Result
crates/mention-contract 14 passed (shared grammar fixtures, descriptor validation, wire shapes)
kanban 42 passed (new tests/mentions.rs: ranking, view, descriptor)
session-manager lib 99 passed, schema goldens 4 passed (two new goldens); 159 engine-free BDD scenarios passed
ade (Rust) 163 passed. rebind_starts_new_port_before_stopping_old_listener is a flaky port test that failed once in a parallel run and passes alone
judge 30 passed (new tests/mentions.rs; the boot test expects the mention functions and the fail_open hook)
harness 693 lib passed (new worker_mention_syntax) and 6 prompt tests
iii-directory bundled prompt equality (12) passed
ade/web tsc clean; 3085 of 3087 passed

New web suites: token fixtures, menu builder, runtime parsing, view and search caches, the composer flow (@kan → Tab → pick), markdown pills, preview card and renderer fallback, note row, entry mapper, chat titles, trace focus.

The two web failures are already on main and untouched here:

The ADE web suite is not run in CI.

Clippy, cargo fmt --check and biome are clean on every changed crate and file.

Any worker can now let a chat mention its items as `@<name>(id="<id>")`:
it declares a mention provider in the metadata of a get function and
registers a search function (crates/mention-contract).

- ADE composer: `@` lists mention providers beside functions and files and
  searches every provider (one group each); Tab on a provider scopes the
  menu to `@<name>:` and its own search. Mentions render as pills (icon,
  color, name) in the composer and in messages, preview on hover (generic
  card or the worker's own via host.mentions.registerRenderer) and open
  their item on click.
- Providers: kanban tickets (kanban::mention::*), sessions
  (session::mention::*) and engine traces (console::mentions::trace::*).
- Agents: the judge binds a harness pre-generate hook that lists the
  mention names an agent may write and resolves the mentions users wrote
  into a one-line summary plus a pre-verified details call (offered only
  when the session's policy allows it); the default system prompt teaches
  the syntax.
- The chat shows what the model was told as a quiet "Context for the
  agent" row instead of the raw note.
- ade/mentions (new): the full provider contract — the search and get
  functions, the metadata descriptor, ranking and view rules, icon/color
  vocabulary, open targets, Node/Rust/any-language registration,
  permissions, the optional hover renderer and the definition of done.
- ade/SKILL, ade/injectable-ui: point to it; document host.mentions and the
  console's @trace provider functions.
- kanban iii-node and ade-worker-design: a "Chat mentions" section with the
  Node registration shape and the host.mentions slot.
- kanban and judge skills: how agents read and write mentions, and
  judge::mentions::resolve for verifying a provider.
A chat titled from its first prompt read the raw token
(`what happened in @session(id="co…`). Mention tokens now read as the
item's handle or name when its view is cached — it is, for an item just
picked from the @ menu — and as @<provider> otherwise.
- The global @text menu lists each mention provider's group before
  functions & files: ten file hits used to push the groups out of view.
- Opening a @trace pill while the traces screen follows turns no longer
  lands on the chat's latest turn: a turn that started before the explicit
  request is not new work to jump to.
- A mention pill squeezed by its row (the "Context for the agent" summary)
  truncates its name instead of overlapping the next pill.
@vercel

vercel Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
workers Ready Ready Preview Oct 8, 2026 11:06am UTC
workers-tech-spec Ready Ready Preview Oct 8, 2026 11:06am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 106 files, which is 6 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 686bbd09-0178-4153-884d-e62666566004
📥 Commits

Reviewing files that changed from the base of the PR and between 536a461 and 26e0201.

⛔ Files ignored due to path filters (5)
  • ade/Cargo.lock is excluded by !**/*.lock
  • crates/mention-contract/Cargo.lock is excluded by !**/*.lock
  • judge/Cargo.lock is excluded by !**/*.lock
  • kanban/Cargo.lock is excluded by !**/*.lock
  • session-manager/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (106)
  • ade/Cargo.toml
  • ade/README.md
  • ade/skills/SKILL.md
  • ade/skills/injectable-ui.md
  • ade/skills/mentions.md
  • ade/src/functions/mentions.rs
  • ade/src/functions/mod.rs
  • ade/web/src/components/chat/ChatView.tsx
  • ade/web/src/components/chat/Composer.stories.tsx
  • ade/web/src/components/chat/Composer.tsx
  • ade/web/src/components/chat/LexicalShell.tsx
  • ade/web/src/components/chat/ModelNoteMarker.test.tsx
  • ade/web/src/components/chat/ModelNoteMarker.tsx
  • ade/web/src/components/chat/SystemNotice.tsx
  • ade/web/src/components/chat/lexical/FlipMenu.tsx
  • ade/web/src/components/chat/lexical/MentionRow.tsx
  • ade/web/src/components/chat/lexical/MentionsPlugin.test.ts
  • ade/web/src/components/chat/lexical/MentionsPlugin.tsx
  • ade/web/src/components/chat/lexical/WorkerMentionNode.tsx
  • ade/web/src/components/chat/lexical/WorkerMentionTransformPlugin.tsx
  • ade/web/src/components/chat/lexical/WorkerMentions.test.tsx
  • ade/web/src/components/chat/mentions/MentionPreview.test.tsx
  • ade/web/src/components/chat/mentions/MentionPreviewCard.tsx
  • ade/web/src/components/chat/mentions/WorkerMentionPill.tsx
  • ade/web/src/components/chat/mentions/appearance.tsx
  • ade/web/src/components/chat/mentions/mentions.css
  • ade/web/src/components/chat/mentions/open-mention.ts
  • ade/web/src/hooks/derive-title.test.ts
  • ade/web/src/hooks/use-conversations.ts
  • ade/web/src/lib/conversations-context.tsx
  • ade/web/src/lib/export-session.ts
  • ade/web/src/lib/markdown.tsx
  • ade/web/src/lib/mentions/caches.test.ts
  • ade/web/src/lib/mentions/fixtures.ts
  • ade/web/src/lib/mentions/menu.test.ts
  • ade/web/src/lib/mentions/menu.ts
  • ade/web/src/lib/mentions/notes.ts
  • ade/web/src/lib/mentions/open-session.ts
  • ade/web/src/lib/mentions/providers.ts
  • ade/web/src/lib/mentions/runtime.test.ts
  • ade/web/src/lib/mentions/runtime.ts
  • ade/web/src/lib/mentions/search.ts
  • ade/web/src/lib/mentions/token.test.ts
  • ade/web/src/lib/mentions/token.ts
  • ade/web/src/lib/mentions/types.ts
  • ade/web/src/lib/mentions/views.ts
  • ade/web/src/lib/sessions/entry-mapper.test.ts
  • ade/web/src/lib/sessions/entry-mapper.ts
  • ade/web/src/lib/trace-focus.test.tsx
  • ade/web/src/lib/trace-focus.ts
  • ade/web/src/lib/ui-loader.tsx
  • ade/web/src/lib/ui-slots.ts
  • ade/web/src/pages/TracesV2/index.tsx
  • ade/web/src/types/chat.ts
  • ade/web/src/types/injectable-ui.ts
  • crates/mention-contract/Cargo.toml
  • crates/mention-contract/README.md
  • crates/mention-contract/fixtures/tokens.json
  • crates/mention-contract/src/lib.rs
  • crates/mention-contract/src/provider.rs
  • crates/mention-contract/src/token.rs
  • crates/mention-contract/src/wire.rs
  • crates/mention-contract/tests/contract.rs
  • crates/mention-contract/tests/tokens.rs
  • harness/prompts/default.txt
  • harness/src/prompt/tests.rs
  • iii-directory/prompts/default.md
  • iii-directory/prompts/iii-minimal.md
  • iii-directory/prompts/iii.md
  • judge/Cargo.toml
  • judge/README.md
  • judge/iii.worker.yaml
  • judge/reference.md
  • judge/skills/SKILL.md
  • judge/src/lib.rs
  • judge/src/main.rs
  • judge/src/mentions/hook.rs
  • judge/src/mentions/mod.rs
  • judge/src/mentions/registry.rs
  • judge/src/mentions/render.rs
  • judge/tests/boot.rs
  • judge/tests/mentions.rs
  • kanban/Cargo.toml
  • kanban/README.md
  • kanban/iii-permissions.yaml
  • kanban/skills/SKILL.md
  • kanban/skills/ade-worker-design/console-injectable-ui.md
  • kanban/skills/iii-node/index.md
  • kanban/src/board.rs
  • kanban/src/functions.rs
  • kanban/src/lib.rs
  • kanban/src/mentions.rs
  • kanban/tests/board.rs
  • kanban/tests/mentions.rs
  • kanban/ui/page.tsx
  • kanban/ui/src/renderers.tsx
  • packages/console-ui/index.d.ts
  • session-manager/Cargo.toml
  • session-manager/README.md
  • session-manager/src/functions/mention.rs
  • session-manager/src/functions/mod.rs
  • session-manager/src/service.rs
  • session-manager/src/surface.rs
  • session-manager/tests/golden/schemas/session.mention.get.json
  • session-manager/tests/golden/schemas/session.mention.search.json
  • session-manager/tests/schemas.rs

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

skill-check — worker

0 verified, 82 skipped (no docs/).

Layer Result
structure ✓
vale ✓
ai ✓
render ✓

Four for four. Nicely done.

The lockfiles this PR touches carried rustls 0.23.44 from main, which the
audit job flags; ade and judge are already on 0.23.45.
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Harness E2E · ade, harness, iii-directory, judge, session-manager @ 26e0201

0/4 passed

  • not measured: minimal_path; persistent_state; tool_contract_recovery; shell_coder_sandbox
    Run

Registers host.mentions.registerRenderer for the kanban provider, so
hovering a @kanban(id=…) pill shows the same ticket card a ticket function
result renders, drawn from the mention view's data (board projection plus
a description excerpt). Feature-detected; older consoles keep the generic
card, and a view without ticket data falls back to it too.

This branch was successfully deployed

2 active deployments
Preview – workers — 26e02018 Deployed Oct 8, 2026 by vercel[bot]
Preview – workers-tech-spec — 26e02018 Deployed Oct 8, 2026 by vercel[bot]
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.

2 participants