Skip to content

Add Ambient, a generative background driven by agent activity - #150

Merged
brsbl merged 116 commits into
mainfrom
bb/ambient
Sep 26, 2026
Merged

brsbl merged 116 commits into
mainfrom
bb/ambient

Conversation

@brsbl

@brsbl brsbl commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds Ambient, a plugin that paints a live GLSL scene behind bb's UI and drives it from what your agents are doing:

  • Working threads drift through the scene as lights, and threads waiting on you pulse.
  • A finished turn sends a ripple out from that agent's light; errors ripple red.
  • Sidebar footer → Ambient switches between Tide, Fireflies, Contour, and Poppy Hill in the Wind. Each scene gets its own sliders and four palette colors, plus Visibility, Motion, and Glass, a per-device Detail slider, test ripples, and a saved-scene library.
  • Agents get an ambient tool (get, set, look, library, load, save, brief). A scene that fails to compile returns the GLSL error and the previous scene is restored. look returns the scene behind bb's real panels with bb's text drawn as bars, so none of the user's screen text reaches the model, and flags scenes that are too faint or make text hard to read.
  • Edits and Reset: slider, color, and shader edits to the open scene save into that scene. Reset restores any edited scene: a built-in to its shipped version, a saved scene to the version first saved. A new scene whose name is taken gets a number instead of replacing the existing one. Reset and Delete both ask for a second click (Cancel / Reset scene or Delete scene) before they discard anything.
  • Daily scene: turning it on (or bb ambient daily on [hour] [time-zone]) creates one bb automation in the personal project. Its agent asks the tool for the day's brief, then paints, checks, and saves a scene. Paint now (bb ambient daily now) runs it on demand.
  • The panel's Display section has an icon-only light, dark, and system switch for bb's appearance, so scenes can be checked in both themes without leaving the panel.
  • bb ambient status|list|load|set|save|delete|on|off|daily covers the same controls from the CLI.

While Ambient is on, bb's surfaces turn into frosted glass so the scene shows through:

  • The sidebar, thread column, pages, settings cards, right panel, and top bar pills become translucent glass instead of solid color.
  • On Plugins, Settings, and Skills, Back to app becomes the first row of the section's glass card, with the same row hover as the rows below it.
  • Menus, the command palette, and mobile drawers and pickers get the same glass, and their inner headers stay clear of white strips.
  • On phones, the sidebar drawer width snaps to whole pixels (no seam), the closed drawer is hidden so it can't bleed through, and the home screen's recents and composer sit in one glass card.
  • Heavy scenes lower their own detail to stay within the frame budget. A scene that is too slow even at the lowest detail, or that loses the GPU context, is quarantined for the session and replaced by a fallback scene instead of being reloaded.

Performance

  • Frame pacing: 30 fps while you or an agent is active, about 10 fps when nothing is happening, and paused (one frame per change) when bb is hidden or unfocused. Reduced motion shows still frames except while a ripple plays.
  • Glass tiers by render detail: a 12px blur at full detail, 6px at low detail, and an opaque fill with no blur at the lowest detail. saturate() is gone, and there are no nested or sticky blurs.
  • Detail is per device (stored in this browser only), so a laptop can run lighter than a desktop. The shared quality control is removed; stored state upgrades in place.

Trace on the same isolated dev app at 1440×900, 2×, with Contour. WebGL draws per second were counted in the page:

State Before After
Idle, no agents working 29 8.4
Idle, one agent working 29 27.7
Pointer moving 28.4 23–28
bb in the background rendering 0 (0.2 ms/s main thread)
Backdrop-blur layers 8 × blur(24px) saturate(1.6) 5 × blur(12px); none at lowest detail

The machine was under heavy load (load average ~80) during the after trace, so the active rates are noisy and auto-scale lowered detail in some runs.

Screenshots

Same isolated dev app, threads, and viewport at 2×. The only difference is bb ambient off versus bb ambient on with Contour.

Desktop, 1440×900. Before (Ambient off)

Before: stock bb thread view on desktop

Desktop, 1440×900. After (Ambient on)

After: the Contour scene showing through bb's glass sidebar and thread column

Mobile, 390×844. Before (Ambient off)

Before: stock bb mobile home with recents and composer

Mobile, 390×844. After (Ambient on)

After: mobile home with recents and composer in one glass card over the Contour scene

Validation

  • CI: the full ci.yml run passes remotely on the branch head after merging main.
  • Browser QA: Chrome for Testing through bb's Browser Automation plugin, against an isolated bb build, in light and dark mode:
    • Desktop (1440×900 at 2×): thread view, Plugins browse and detail pages, Settings, command palette, Category menu, right panel.
    • Mobile (390×844 at 2×): home recents and composer (scrolled and unscrolled), sidebar drawer, thread view, thread actions drawer, model and project pickers, right panel.
    • A sweep of 214 screenshots across these surfaces found opaque white surfaces in settings cards, menus, the palette, and drawer headers; all are fixed and rechecked.
  • Live agent signals: with real Claude Code threads, the panel's counts tracked working and waiting threads, and each working thread rendered as its own light.
  • Agent tool: an agent wrote a new scene with its own sliders, captured it, and got a broken scene back with the GLSL error while the previous scene was restored.
  • Daily scene: Paint one now started a real agent thread that painted, checked, and saved a visible scene.
  • Glass tiers: full detail shows blur(12px) in light and dark; Detail 0.2 switches to the solid tier with no backdrop filters.
  • Heavy shader: a scene running 4,000 fbm calls per pixel was accepted, dropped to about 47% detail on its own, and the page held 54 fps.

Known gaps:

  • The terminal tab stays opaque: bb creates xterm with an opaque theme background and no allowTransparency, so fixing it needs a bb change rather than plugin CSS.
  • The diff panel's file list is glass, but its code view wasn't checked: the QA checkout's changed files show "No renderable diff".

Follow-ups (not in this PR)

From the review's P2 findings and QA:

  • Stop the CLI's speed, motion, visibility, glass, and showthrough names from overriding a scene param with the same id.
  • Parse capture requests with the server's schema instead of payload as CaptureRequest.
  • Default the daily scene's time zone to the user's, not the server's.
  • Recover open windows when stored state resets to a lower revision.
  • Match the agent and CLI Visibility cap (1.0) to the panel's 0.8.
  • reset on a built-in turns Ambient back on because it restores all default controls.
  • Keep the daily automation's provider and model in step with the user's default.
  • Use a headless window for look when no bb window is open, excluded from the frame-cost and compile checks.
  • The terminal tab stays opaque until bb creates xterm with a transparent background.

Follow-up for a host-owned backdrop contract: get-bb/bb#4167.

BB-Thread-ID: thr_7awwywsg2c

🤖 Generated with Claude Code

AGENT GENERATED

brsbl and others added 9 commits September 22, 2026 17:29
Ambient paints a GLSL scene behind bb's UI. Working threads drift through
it as lights, threads waiting on the user pulse, and finished turns ripple
outward (red on errors). The sidebar footer panel switches scenes, exposes
each scene's sliders and palette, and sets show-through, speed, and
resolution. Agents can write and inspect scenes through the ambient tool,
and bb ambient covers the same controls from the CLI.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Vendor @get-bb/plugin-sdk 0.5.9 from the npm registry and bundle
packages/plugin-build from get-bb/bb 9b8c1d3457 as bb plugin build
0.43.4. Rebuild the tracked plugin artifacts with the new builder and
regenerate the lockfile.

Read engines.bbPluginSdk as a floor within the same major version, the
way bb's loader has since bb #1569, so existing ^0.4.1 floors stay
unchanged and still validate against the vendored SDK.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
- Plugin Finder: read catalog search entries from the results list and
  complete test fixtures with the catalog and inventory fields SDK 0.5.9
  now requires.
- Thread Organizer: accept bb's pending thread status in the local
  thread type (still not treated as running) and give agent
  configuration fixtures the new pluginMetadata field.
- Improve Prompt: expect the builder's :where() plugin scope instead of
  @scope.
- Write repository-relative paths into server source maps so committed
  artifacts rebuild identically on any machine.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
bb reports threads that have not been dispatched yet as pending. The
hover card contract rejected that status, so summaries for queued
threads failed with invalid_output. Accept it and label it Queued.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Its artifacts changed with the SDK 0.5.9 rebuild, and the existing
thread-organizer/v0.1.6 tag must not move.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Check out get-bb/bb 9b8c1d3457, the commit the vendored SDK 0.5.9 and
bb plugin build 0.43.4 come from, so the persisted SDK 0.4.6 scaffold
is loaded and updated on the host that ships this SDK.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A daily schedule starts an agent thread after the chosen hour in the
user's time zone to paint, check, and save a new scene; the panel,
`bb ambient daily`, and RPC share the same settings, and "Paint one now"
runs it on demand. `look` now measures how far a capture differs from
bb's background and flags scenes the veil would hide, and the shader
contract tells agents not to dim scenes for dark mode. `bb ambient
delete` removes saved scenes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Build Ambient against the shared vendored SDK archive like the other
plugins, with an engine floor of 0.5.8.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@brsbl
brsbl changed the base branch from main to bb/plugin-sdk-0.5.9 September 23, 2026 01:52
@brsbl
brsbl added this pull request to stack #152 September 23, 2026 01:52
brsbl and others added 10 commits September 22, 2026 19:01
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…y scenes

The panel moves to single-line thin sliders, pill scene chips, round
color swatches, and clearer names (Visibility, Motion, Detail, Preview a
ripple, New scene every morning), with built-in slider labels like Zoom
and Light glow instead of Scale and Agent glow.

Daily scenes now start from a rotating concept, avoid recent scenes, and
must move, give agents a role, and make ripples read as events. `look`
measures motion over one second on a downscaled frame and the cost of a
frame, flagging scenes that are nearly still or too heavy.

An agent-painted scene froze the page in QA, so the render loop now
lowers its resolution when frames run slow, drops to a low frame rate if
that is not enough, and the panel says when it has done so.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
On compact viewports bb's main pane slides over the sidebar drawer, so
making it translucent let the thread list show through every thread.
The main pane now keeps its opaque background there, and the scene
shows through the thread list when the drawer is open.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ing through

Keeping the thread view opaque on mobile hid the scene entirely. Instead,
hide the sidebar drawer while it is closed and not being swiped, so the
translucent thread view shows the scene rather than the thread list
underneath. The hide waits for the close slide to finish, and a swipe
keeps the drawer visible while it is dragged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Security: the daily painter no longer puts stored scene names or thread
titles in its prompt, spawns with the auto permission mode instead of
inheriting the user's last choice, and scene names must be one line of
plain text. applyValues ignores inherited keys and writeState validates
before saving.

Heavy scenes: after compiling, the page estimates the cost of a full
frame from two tiny off-screen renders. Scenes too slow even at the
lowest detail are rejected and the server restores the last scene a
window verified; others start at a detail that fits the frame budget.
Scenes no visible window verifies are not applied, and the daily
painter only runs while a bb window is open and never twice at once.

Frame pacing measures lateness instead of raw frame gaps, ignores
hidden-tab and sleep gaps, recovers from the stalled 4 fps mode, and
resets on scene changes. Shaders compile without blocking the page where
KHR_parallel_shader_compile exists, lost WebGL contexts are rebuilt,
failed compiles fall back to Tide with Tide's own settings, hidden
windows no longer answer compile or capture requests, and captures
encode asynchronously.

State and library: built-in scenes are rebuilt from code while keeping
the user's values and colors, unreadable state keeps whatever still
parses, failed-compile restores re-read state and keep controls, the
library keeps a small index, built-ins load by name, and saving under an
existing name updates that entry instead of adding a duplicate.

Surfaces: the veil also tints the mobile right panel and bb's top bar,
and sticky headers inside panes go transparent with a blur so content
scrolling beneath stays hidden. Detail is now per device. The CLI and
agent tool can set Visibility, Motion, and Detail, the CLI sets the
palette, the tool can delete saved scenes, `daily on <zone>` parses, and
status output uses the panel's names.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
"New scene every morning" now creates, resumes, pauses, and reschedules
an agent automation in the personal project instead of a plugin-owned
timer, so runs get history, pause, and editing in Automations. The
automation's prompt stays fixed and asks the ambient tool for
action=brief, which builds the day's concept and instructions at run
time and tells the agent to stop when no bb window is open to verify
the scene. Paint now runs the same automation. The agent inherits the
personal project's defaults, falling back to the most recent thread's.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
bg-surface-scrim also dims full-screen overlays such as the server move
dialog, which should keep their scrim.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
brsbl and others added 8 commits September 23, 2026 08:16
A failed lookup used to read as a deleted automation, so a transient error
created a duplicate. Look the automation up in the list instead and let
errors surface.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The promotional video shows an agent painting this scene, so it now ships
alongside Tide, Fireflies, and Contour with the agent's shader, palette,
and controls.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ambient makes --background translucent so the shader shows through, which
left text-background and bg-background nearly transparent. Use the opaque
--canvas color instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Poppy Hill's size slider set grid density, so raising it made the
poppies smaller. It now sets the cell size directly; the default of 18
renders the same field as before.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The previous mark read as a face at sidebar sizes. The new one keeps the
window-and-landscape idea, with three lights climbing a diagonal so they
read as agents in the scene rather than eyes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…er it

Paint a scene in the Ambient panel (and bb ambient paint) starts a thread
where an agent paints the user's own description. The ambient tool's brief
now takes that request and has the agent expand it into a full concept
first: art style, palette, motion, what agents and ripples become, and a
name, which is the tuning the poppy scene needed by hand.

A Backing control, on by default, puts soft rounded backings under
messages, the composer, and the side panel while a thread is open, so busy
scenes stay readable behind thread text. Stored controls without it keep
parsing and default to on.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Also narrows the CLI's numeric control keys so the new boolean Backing
control can't be assigned a number.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
brsbl and others added 27 commits September 24, 2026 21:27
…nd plugin page bottoms, and remove the drawer seam

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Stop restoring the same failing scene, which looped recompiles across windows.
Keep thread side margins scrollable by clipping only the bottom edge.
Never overwrite a saved scene with a different shader on save or autosave.
Roll back the daily switch and show the error when setup fails.
Keep the thread composer solid so the timeline can't show through it.
Match the mobile right-panel toggle to the sidebar toggle.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The in-context capture drew every visible word of the user's screen and
quoted the hardest-to-read words, which sent screen text to the model,
including during unattended daily runs. The readability check only needs
each word's position, size, and color, so words are now solid bars and
examples report positions only.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Edits to the open scene, including an agent's shader changes, now save
into that scene. A built-in keeps its shipped version for Reset, and a
saved scene remembers the version first saved, so Reset works for every
scene. A new scene whose name is already taken gets a number instead of
replacing the existing one.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Portaled menus kept bb's opaque --sidebar and --sidebar-accent, so sticky
selected rows painted white and hovered rows painted gray over the glass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sticky sidebar tiers were transparent inside the glass cards, so scrolled
rows painted through them. The mobile new-thread page now gives Recent room
above it and rounds the composer's top corners.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Performance
- FrameScheduler draws at 30 fps while you or an agent is active, ~10 fps
  when idle, and pauses (one frame per change) when bb is hidden or
  unfocused. Reduced motion shows still frames except while ripples play.
- Glass blur is tiered by render detail: 12px (full), 6px (low), or a solid
  fill (no blur). saturate() is gone, and there are no nested or sticky blurs.
- The veil is applied through CSS variables instead of rewriting rules.
- The GL context is released only on unmount.

Structure
- app.tsx is split into veil.ts, scheduler.ts and capture.ts. scene.ts is
  split into contract.ts and builtins.ts (with a fallback shader).
  server.ts is split into operations, daily, reports, pixels and rpc.
- One control-spec table drives the server, the CLI and the panel sliders.
- The scene ref is {kind,id}, with one uniqueName helper. Legacy state
  upgrades in place.

Behavior
- Detail is per device only (localStorage bb-ambient:detail). The shared
  quality control is removed, and `set detail=` explains why.
- Revert only when a set is pending. Debounced calls flush on unmount.
  Undo restores only params that still exist.
- A scene that loses the GPU context or is too heavy is quarantined for the
  session and replaced by the fallback, instead of being reloaded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@brsbl
brsbl merged commit 521672a into main Sep 26, 2026
22 checks passed
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