Repository navigation
feat(v2): species avatars — faces for humans, robots for agents - #1054
Conversation
Sam's ruling after eyeballing the full roster in six deterministic styles: humans render bigSmile, agents render bottts. Face = person, robot = agent — readable with zero badges, which most agent-team products need a label for. Deterministic local SVG from a seed: no image API, no art pipeline, so install #10,000 costs what install #1 did. Seeds are STABLE IDENTITY (agentName:instanceId / userId), not display names, so a rename never changes someone's face. The seeded palette tint becomes the character's background so the tier stays inside the existing palette. Returns null on empty seed or generation failure; callers fall back to the gradient+initials tier, which cannot fail.
Omitted kind keeps today's gradient+initials — a caller that cannot tell who it is drawing must not guess, because mislabelling the tier mislabels the PERSON. Photo always wins. Memoized: chat re-renders per message and the SVG build is not free.
The PG SELECT always fetched u.is_bot; the backend mapper now forwards it. undefined stays undefined — unknown renders the neutral tier rather than guessing a species.
Selected since the beginning, discarded at the mapper — the frontend could never tell an agent's message from a human's without a second lookup. Also adds is_bot to the second SELECT variant, which never fetched it.
Supersedes this morning's 'never the chat-stream default' sentence — Sam's ruling puts robots in the stream for agents, and the spec follows the decision rather than outliving it.
…lback Includes scout's per-user instances — a name-only seed would collapse 115 identities into one robot.
Both CI failures were this one line: the mapper now emits isBot but the FormattedMessage type did not admit it, so Test & Coverage failed the backend tsc check and E2E died at 'Start backend' before the frontend ever built. Verified with the backend's own tsc locally this time.
Each dicebear style module carries its own Options generic; the ternary made a union the Style<Options> parameter cannot accept. Same behaviour, per-call generic instantiation.
|
Execution review (design seat). Direction is settled — this is about the four questions asked plus what the diff itself surfaced. I re-ran the exact production logic against the pinned @dicebear 9.4.3 and rendered the real roster at 34/24/22/96px in a browser, both backings, plus a dense-stream simulation; the calls below cite that evidence rather than taste. 1. One must-fix: the agent seed is split-brained across surfaces. Chat seeds by 2. backgroundColor: soften it. Rendered side-by-side, the saturated tint behind multicolor characters vibrates — yellow robot on amber, red robot on rose, and bigSmile skin tones on saturated rose read harsh. Same hue blended ~82% toward white keeps the tint-agreement you wanted (hue still comes from 3. 22px floor: none needed. The species read (robot vs face) survives 22px cleanly in both backings — the silhouette is the badge and it holds. Individual recognition degrades below ~28px, which is fine: that was never the avatar's job at stream sizes (it's the name label's), exactly as under initials. No floor, no special-casing. 4. Profile hero: yes, go large. 96px robot on a soft disc is genuinely the character moment — the personality the whole package is chasing, on a surface with no attribution pressure. Recommend a hero treatment (~96px) on 5. Credit line: name the creator, link the license. CC BY 4.0 attribution runs to the author, not the aggregator — and the package's own metadata names her: Smaller, in the same files:
Backend |
CRA excludes node_modules from babel; @dicebear ships ESM, so every suite that transitively imports V2Avatar died with Cannot-use-import-outside-a-module. Same allowlist mechanism the config already uses for axios.
Sam's ruling after eyeballing the full roster in six deterministic styles side-by-side: humans render DiceBear Big Smile faces, agents render Bottts robots.
Why this shape
Face = person, robot = agent — readable with zero badges. Most agent-team products mark agents with a label; ours becomes visible at a glance in every stream.
Deterministic local SVG, not generated art. Same seed → same face, forever. No image API, no art pipeline — install #10,000 costs what install #1 did. This is what makes characters shippable where per-install generation was rejected.
Seeds are stable identity, not display names —
agentName:instanceIdfor agents,user_idfor humans — so a rename never changes someone's face. Identity-continuity (ADR-001), applied to pixels. The test suite includes Scout's per-user instances specifically: a name-seeded scheme would collapse its 115 identities into one robot.Photo always wins; gradient+initials is the fallback tier — for unknown kind, empty seed, or generation failure. A caller that can't tell who it's drawing renders neutral rather than guessing a species, because mislabeling the tier mislabels the person.
The backend one-liner that unblocked it
models/pg/Message.tsselectedu.is_botsince the beginning and dropped it at the mapper — the frontend could never tell an agent's message from a human's. Forwarded now (and added to the second SELECT variant, which never fetched it). Old cached payloads simply render the neutral tier.License compliance ships in the same PR
Big Smile is CC BY 4.0 — the DiceBear credit on the login screen is a license requirement, not decoration. Bottts is free for commercial use. The credit line, the license note in
avatars.ts, and the design-system README all say the same thing and name each other, so a future style swap re-checks all three together.The spec moves with the decision
This supersedes this morning's README sentence ("never the chat-stream default") — written before Sam ruled. Second spec update on this file today, both in the same PR as the change they describe, per the tokens-and-spec-move-together rule.
Verification, honestly stated
frontend/node_modulesis empty in this worktree, so local typecheck/jest were not possible (the earlier vacuous-pass lesson — I'm saying so rather than claiming green). What I did instead: executed the exact production logic against the real pinned library (@dicebear 9.4.3) — deterministic ✓, species differ from the same seed ✓, 8/8 roster distinct ✓,data:image/svg+xmlself-contained ✓. CI compiles and runs the suite; needs the real-browser check after deploy per the v2 CSS rule.Decision artifact (roster in all six styles, both sizes, licenses): claude.ai/code/artifact/49bc8fe3 — ux-lead has the same proposal for design review of the execution details.
🤖 Generated with Claude Code
https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8