Sprinkles

From ai-ecoverse/slicc · View interactive version

Sprinkles is an AI agent skill from the GitHub repository ai-ecoverse/slicc. Use this when the user wants a persistent UI panel — a dashboard, form, editor, report, or visualization that lives alongside the chat. Sprinkles are `.shtml` files under `/shared/sprinkles/` rendered in the side rail or as a full-screen tab. For ephemeral inline widgets, use dips instead. Covers cr

How to use this skill

Skill file

Sprinkles

.shtml files in /shared/sprinkles/ become interactive UI panels. Use them for dashboards, forms, and visualizations that persist alongside the chat.

Two rendering modes

Pick full-document mode when you need custom CSS beyond .sprinkle-* classes, complex layouts (sidebar + main, split panes, tabs), or interactive canvas/SVG.

Light & dark mode

Theming is automatic. The parent injects its S2 tokens into every sprinkle and toggles a .theme-light class on the sprinkle root — the iframe's <html> in full-document mode, or the outermost container injected into the sidebar in fragment mode — whenever the user flips the parent theme. All var(--s2-*) tokens swap in lockstep. Never hard-code colors for one theme.

Layout & viewport

Sprinkles open in one of four viewport contexts, and you must design for the narrowest:

| Float | Default viewport | Multi-column safe? |

| -------------------------------- | -------------------------------------- | ----------------------- |

| Desktop (CLI / Electron) sidebar | Narrow rail (≈ 360 px) | No — single column only |

| Desktop full-screen pop-out | Full window | Yes |

| iOS / Sliccstart app frame | Full-width but always single-column UX | No |

| Chrome extension side panel | Narrow (≈ 360 px, fixed by Chrome) | No |

Default to a single-column layout. Multi-column layouts (sidebar + main, split panes, three-up grids) only render usefully when the user explicitly pops the sprinkle to full-screen on desktop. They look broken in the rail and on iOS.

If you genuinely need multi-column UI, do all of the following:

  1. Build it in full-document mode so you can use grid / flex / media queries cleanly.
  2. Use @media (max-width: 600px) (or similar) to collapse to single column at narrow widths so the sidebar/iOS view still works.
  3. Tell the user in your reply that this sprinkle is "best viewed full-screen — pop it out from the rail header."

For dashboards with many widgets, prefer a vertical stack of .sprinkle-card blocks over a grid. The card stack is responsive by default and looks good in both rail and full-screen.

Arranging panels with `layout`

The layout shell command arranges panels, independent of what's inside each one.

Every panel is the same kind of thing: chat, each tool panel, and each sprinkle.

layout list                         # shipped presets (there is one: the default)
layout set <preset>                 # reset to a shipped arrangement
layout save <name>                  # save the CURRENT arrangement as JSON
layout load <name>                  # load a saved layout or the shipped default
layout open <surfaceId> <zone>      # place a panel (zone: top|left|middle|right|bottom)
layout move <surfaceId> <zone>      # relocate a placed panel
layout close <surfaceId>            # remove it (chat is pinned; it can move, never close)
layout size <surfaceId> [--width <px|%>] [--height <px|%>]   # exact, pixel-perfect
layout chat <zone>                  # move the chat panel
layout reset                        # back to the default

SLICC ships exactly ONE arrangement (the default). To give a skill its own layout,

arrange the panels and layout save <name> — do not expect named presets beyond the

default to exist.

Opening a sprinkle auto-places it, so layout open is only for overriding that.

layout size is the programmatic counterpart to a user dragging a divider — use it

when you want an exact size rather than a proportion.

The five zones are top, left, center, right, bottom — Java BorderLayout.

They sit inside the fixed chrome, so top is below the scoop/budget strip and

left/right are inboard of the rails. A zone holds several panels at once, so

placing two sprinkles in left puts them both there (stacked by default).

Writing a layout JSON by hand

A layout document has two sections, and you only ever write zones:

{
  "version": 1,
  "id": "my-layout",
  "base": {
    // DO NOT AUTHOR. The fixed chrome — scoop/budget strip, both rails. Copy it
    // verbatim from an existing document, or omit it to keep the shipped chrome.
    "docks": [...],
    // YOURS. Which panels go in which of the five zones.
    "zones": {
      "top": ["sprinkle:status-panel"],
      "left": ["chat"],
      "right": ["sprinkle:main-window"],
      "sizes": { "top": "180px", "left": "40%" }
    }
  }
}

A "status bar across the top, below the SLICC bar, between the rails" is

zones.top — NOT a second docks entry with edge: "top". docks is the app's

own chrome; adding to it puts your panel in the same strip as the scoop switcher and

the price counter. Reach for zones every time.

Prefer layout save over hand-writing JSON: arrange the panels with `layout

open/move/size`, then save. Hand-editing is for shipping a layout with a skill.

The user can also rearrange by hand — there is no edit mode to enter. Hovering a

panel reveals a grip in its top-left corner; grabbing it shows the five zones as a

compass. Two kinds of seam drag to resize: between panels inside a zone, and

between the zones themselves. Their arrangement

persists across reloads, so do NOT re-issue layout commands to "restore" a layout

you set earlier — you would be overwriting what they did.

On a narrow viewport (extension side panel, iOS, ≤700px) multi-panel arrangements

collapse to chat alone, so still design each sprinkle single-column-safe per the

table above.

Are panels always sprinkles?

No — but a sprinkle is the only kind YOU can create, and that is the intended path.

| Kind | Who makes it | How |

| --------------- | ---------------- | -------------------------------------------------------------- |

| Sprinkle panel | you | write .shtml, sprinkle open <name> — this section |

| Built-in panel | ships with SLICC | chat, both rails, the top strip, files/terminal/memory/monitor |

| Layout document | you | JSON naming which panels go where; layout save/load |

So: to add UI, write a sprinkle. To rearrange existing UI, write a layout document

or issue layout commands. There is no third mechanism, and no need for one — a

sprinkle is a full HTML document with a bridge, which covers what a custom panel

would.

A sprinkle IS tied to a scoop, and that is deliberate: whoever creates one owns it

for its lifetime and handles its lick events (see "Handling lick events" below).

A layout document is not tied to anything — it only names panel ids.

Shipping UI with a skill

A layout document saved under /workspace/layouts/<name>.json can be loaded with

layout load <name>, so a skill can ship both its sprinkles and the arrangement

that presents them. Write the sprinkles, open them, arrange, then `layout save

<name>` to capture what is on screen.

Creating a sprinkle

  1. read_file /workspace/skills/sprinkles/style-guide.md — always read first before writing any sprinkle.
  2. Pick a rail icon that matches the sprinkle's purpose (see "Sprinkle icon" below). Every new sprinkle MUST declare an icon — the generic Sparkles default is reserved for sprinkles that genuinely have no thematic anchor.
  3. write_file to /shared/sprinkles/<name>/<name>.shtml (follow the style guide templates).
  4. bash → sprinkle open <name>.
  5. CRITICAL: do NOT finish or send a completion message. You own this sprinkle for its entire lifetime. The cone will send you follow-up instructions (modifications, lick events) via feed_scoop. If you finish, you lose your context and cannot handle future work on this sprinkle.

Where sprinkles are discovered

sprinkle list and the rail only see .shtml files under /shared,

/workspace, /scoops and /home, no more than six directory levels deep, and

never inside node_modules, dist, build, coverage, or any dot-directory.

A .shtml written to /tmp, /mnt, /etc or a deeply nested build folder

will not be listed — write to /shared/sprinkles/<name>/<name>.shtml. (`open

/path/to/file.shtml` still opens any path directly.)

Updating a sprinkle (when you receive follow-up instructions)

  1. Edit /shared/sprinkles/<name>/<name>.shtml with the requested changes.
  2. Reload: sprinkle reload <name> — keeps the panel in place and sized. Do not close+open unless the sprinkle is actually closed; open on an already-open sprinkle is a no-op.
  3. Do NOT finish — stay ready for more instructions.

Handling lick events (when the cone forwards a user interaction)

The cone will send you a message with the lick action and your sprinkle name. Only modify YOUR sprinkle — the one matching your scoop name. Process the action and push updates:

Sprinkle icon

Each sprinkle gets its own glyph in the rail so users can tell them apart at a glance. Declare it in the .shtml. Three formats, in order of preference:

1. Lucide icon name (preferred — covers ~1500 icons from lucide.dev/icons):

<link rel="icon" href="music" />

Use the kebab-case name from lucide.dev. Common picks: music, code, terminal, chart-bar, chart-line, calendar, calendar-clock, clock, image, file-text, globe, book-open, compass, gauge, wrench, palette, bug, flask-conical, database, cloud, package, shopping-cart, dollar-sign, mail, message-square, bell, users, user, settings, sparkles.

2. SVG file in the sprinkle's directory (when no Lucide icon fits):

<link rel="icon" href="/shared/sprinkles/<name>/icon.svg" />

Author the SVG with viewBox="0 0 24 24". Keep paths simple — the rail renders at 16×16. Note: only Lucide icons inherit currentColor from the rail; author-supplied SVGs render through <img> (script-disabled), so set explicit colors in the SVG itself.

3. Inline SVG or data URL (one-off icons, no extra file):

<link
  rel="icon"
  href='data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="..."/></svg>'
/>

Where to put it: inside <head> for full-document mode, or as the very first element in fragment mode.

Quoting tip: when the href value contains quotes (inline-SVG data URLs do), wrap the attribute in single quotes: href='data:image/svg+xml;utf8,<svg xmlns="...">...'.

Fallback: if the icon spec is missing or unresolvable, the rail uses a generic Sparkles glyph.

Cone orchestration rules

These are the rules the cone follows when sprinkles are involved. They are absolute.

Rule 1: One scoop per sprinkle, named identically

Scoop name MUST match sprinkle name. Sprinkle giro-winners = scoop giro-winners.

Rule 2: Cone never touches sprinkle files or commands

The cone MUST NOT: write/edit .shtml files, run sprinkle open / close / send, or handle lick events directly. ALL sprinkle work goes through scoops via feed_scoop. Never handle a lick in the cone.

Rule 3: Creating sprinkles

Create a scoop, then feed it a complete, self-contained brief:

scoop_scoop("giro-winners")
feed_scoop("giro-winners", "You own the sprinkle 'giro-winners'. Your job:
1. Run: read_file /workspace/skills/sprinkles/style-guide.md
2. Research the last 3 Giro d'Italia winners
3. Pick a rail icon — for cycling, use <link rel=\"icon\" href=\"bike\" /> in <head>. See the sprinkles SKILL.md \"Sprinkle icon\" section for the full list.
4. Write the sprinkle to /shared/sprinkles/giro-winners/giro-winners.shtml
5. Run: sprinkle open giro-winners
6. IMPORTANT: After opening the sprinkle, do NOT finish. Stay ready — you will receive follow-up instructions and lick events for this sprinkle via feed_scoop. Do not send a completion message.")

Rule 4: Modifying sprinkles

Feed the EXISTING scoop that owns it. Do NOT create a new scoop:

feed_scoop("giro-winners", "Modify YOUR sprinkle 'giro-winners' at /shared/sprinkles/giro-winners/giro-winners.shtml:
Add an 'Add Previous Year' button with onclick=\"slicc.lick({action: 'add-year'})\"
Then reload: sprinkle reload giro-winners
Stay ready for more work.")

Rule 5: Lick events

Forward to the owning scoop, never handle yourself:

feed_scoop("giro-winners", "Lick event on YOUR sprinkle 'giro-winners' (/shared/sprinkles/giro-winners/giro-winners.shtml):
Action: 'add-year'
Look up the next previous year's Giro d'Italia winner and update the sprinkle.
Use: sprinkle send giro-winners '<json>' to push data, or edit the .shtml and reload.
Stay ready for more lick events.")

Cheap interactions via `agent`

When a sprinkle button needs to do real work but the owning scoop should NOT be pulled into a turn (it's busy, or the work is purely transactional), route the lick handler through agent instead.

Pattern:

  1. User clicks → slicc.lick({action: 'lookup', data: {q: 'foo'}}).
  2. Cone sees the lick, forwards to the owning scoop with feed_scoop.
  3. The scoop's reply runs agent against a tight allow-list and writes the result back via sprinkle send.
# Inside the owning scoop's reply to a lick:
result=$(agent "$TMPDIR" "curl,jq" "Look up '$Q' in <api>, return the price.")
sprinkle send giro-winners "$(jq -n --arg r "$result" '{result:$r}')"

Why this matters: a busy scoop that owns a sprinkle can shell to agent to handle a click without growing its own conversation. agent is handoff-free — the ephemeral sub-scoop doesn't notify the cone or the owning scoop on completion. See /workspace/skills/delegation/SKILL.md for the full agent reference.

This is the difference between "every click adds a turn to your owning scoop" (expensive, drifts) and "every click is a clean transaction" (predictable, cheap).

Managing sprinkles via bash

sprinkle chat '<div class="sprinkle-action-card">
  <div class="sprinkle-action-card__header">Deploy to production?</div>
  <div class="sprinkle-action-card__actions">
    <button class="sprinkle-btn sprinkle-btn--secondary" onclick="slicc.lick({action:\"cancel\"})">Cancel</button>
    <button class="sprinkle-btn sprinkle-btn--primary" onclick="slicc.lick({action:\"deploy\",data:{env:\"prod\"}})">Deploy</button>
  </div>
</div>'

Bridge API

Available as slicc in <script> tags and onclick attributes:

Payload shape: the cone reads event.data as the payload — top-level extras outside action, data, and target are silently dropped by the sprinkle bridge. Always use slicc.lick({ action: 'deploy', data: { env: 'prod' } }), not slicc.lick({ action: 'deploy', env: 'prod' }).

Shell, agent, and jsh globals

The bridge also reaches the same worker shell that .jsh scripts and node -e run in, so a sprinkle can call any supplemental command, any .jsh script, or spawn a sub-scoop directly from a button. These mirror the capability bridges reached from .jsh via require('sliccy:<name>') (documented in /workspace/skills/skill-authoring/jsh-runtime-extensions.md). Sprinkle code keeps using the trust-gated slicc.* namespace; it does not call require('sliccy:…') directly.

// HID — stateful across the sprinkle's lifetime
slicc.hid.list(): Promise<HidDeviceInfo[]>
slicc.hid.request(filters?): Promise<HidDeviceInfo[]>    // Grant prompt → OS chooser
slicc.hid.open(handle): Promise<void>                    // auto-subscribes inputreport
slicc.hid.close(handle): Promise<void>
slicc.hid.sendReport(handle, reportId, data: Uint8Array): Promise<void>
slicc.hid.on('inputreport', cb): void                    // cb: ({ handle, reportId, data })
slicc.hid.off('inputreport', cb): void

// Serial — parity list/request/open/close; streaming I/O stays on the realm API.
slicc.serial.list() / request(filters?) / open(handle, options) / close(handle)

// USB — full transfer surface, so a sprinkle can drive a device itself.
slicc.usb.list(): Promise<UsbDeviceInfo[]>
slicc.usb.request(filters?): Promise<UsbDeviceInfo>      // Grant prompt → OS chooser
slicc.usb.open(handle) / close(handle, opts?) / reset(handle, opts?): Promise<void>
slicc.usb.selectConfiguration(handle, value): Promise<void>
slicc.usb.claimInterface(handle, n, opts?) / releaseInterface(handle, n): Promise<void>
slicc.usb.on('disconnect' | 'claim-lost', cb) / off(...): void
  // Handles are shared with the `usb` shell command and `require('sliccy:usb')`.
  // Interface claims are exclusive: a second claim is refused naming the
  // holder; close/reset refuse while another consumer holds a claim unless
  // `{ force: true }`. Forced displacement delivers claim-lost then disconnect.
slicc.usb.clearHalt(handle, 'in' | 'out', endpoint): Promise<void>
slicc.usb.transferIn(handle, endpoint, length): Promise<{ status, bytes: Uint8Array }>
slicc.usb.transferOut(handle, endpoint, bytes: Uint8Array): Promise<{ status, bytesWritten }>
slicc.usb.controlTransferIn(handle, setup, length): Promise<{ status, bytes: Uint8Array }>
slicc.usb.controlTransferOut(handle, setup, bytes): Promise<{ status, bytesWritten }>

Transfers are on the sprinkle surface, not realm-only, because a .jsh cannot

stream: realm stdout is buffered and delivered when the run completes. Anything

that reads a device for as long as it stays interesting — a video stream, a

sensor feed — has to drive the device from the sprinkle and render as it goes.

You hand in and get back real Uint8Arrays; the base64 the iframe boundary

needs is handled for you. UsbDeviceInfo also carries configurations, so an

interface can be located by class/subclass/protocol without a descriptor read.

<button
  id="connect"
  onclick="slicc.hid.request({vendorId:0x320f}).then(d => slicc.hid.open(d[0].handle))"
>
  Connect keyboard
</button>
<script>
  slicc.hid.on('inputreport', ({ reportId, data }) => {
    console.log('report', reportId, [...data].map((b) => b.toString(16)).join(' '));
  });
</script>
<button
  onclick="slicc.exec('git status -s').then(r => slicc.lick({action: 'status', data: r.stdout}))"
>
  Refresh status
</button>

Prefer slicc.exec/slicc.agent for transactional work that should NOT grow the owning scoop's conversation (see "Cheap interactions via agent" above). These run in the same worker shell, so all ~50 supplemental commands and any .jsh script are reachable.

onclick attributes: always use slicc — e.g. onclick="slicc.lick({action: 'add-year'})". The slicc variable is automatically resolved per-sprinkle, so multiple sprinkles won't collide. Do NOT use bridge or any other variable name in onclick.

CSS components: do NOT write custom CSS. Use the built-in .sprinkle-* classes: cards, tables, badges, buttons, text fields, progress bars, meters, layout utilities, and more. For inputs use class="sprinkle-text-field", never inline border/padding styles. Run read_file /workspace/skills/sprinkles/style-guide.md for the full component reference with markup examples.

Built-in sprinkles

SLICC no longer ships with a catalog of pre-built sprinkles. The only .shtml under /shared/sprinkles/ is welcome/, which backs the inline first-run welcome dip — not a panel sprinkle. Always create sprinkles from scratch for what the user is asking for, following the "Creating a sprinkle" flow above. Do not assume a built-in sprinkle name exists.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.