Space widgets

From agent0ai/space-agent · View interactive version

Space widgets is an AI agent skill from the GitHub repository agent0ai/space-agent. Create, patch, inspect, and remove widgets in the current space

How to use this skill

Skill file

Use this skill for widget work in the current open space

storage

transient

main helpers

catalog and readback

widgets (id|name|description)↓

example|Example|expanded, 4x3 widget

rendered↓

<div>Hello</div>

source↓

id: example

name: Example

cols: 4

rows: 3

renderer↓

0 async (parent, currentSpace, context) => {

1 console.log("hello");

2 }

staged turns

examples

Checking widget catalog

_javascript

return await space.current.listWidgets()

Reading the widget source

_javascript

return await space.current.readWidget("tetris-game")

Seeing the current rendered widget HTML

_javascript

return await space.current.seeWidget("tetris-game")

After the catalog already showed snake-game, reading Snake source

_javascript

return await space.current.readWidget("snake-game")

User asked for the snake widget, reading it directly

_javascript

return await space.current.readWidget("snake")

bad

Checking the current widget source

bad

_javascript

return await space.current.readWidget("snake-game")

bad

Which widget should I change?

bad

const widgets = await space.current.listWidgets();

const snake = widgets.widgets.find(...)

bad

return await space.current.readWidget("snake-game")

return await space.current.patchWidget("snake-game", ...)

bad

return await space.current.patchWidget("snake-game", ...)

// success came back

return await space.current.patchWidget("snake-game", ...)

bad

Updating the snake widget background now

Applying the color edits now

patch vs rewrite

example exact snippet patch

_javascript

return await space.current.patchWidget("snake-game", {

edits: [

{

find: "parent.style.background = '#6f8f54';",

replace: "parent.style.background = '#5f7f3f';"

}

]

})

write and reload behavior

renderer rules

flow

  1. listWidgets() if you need the live catalog
  2. readWidget(id) for any existing widget you will change
  3. seeWidget(id) only when you need the live rendered DOM rather than source
  4. Next turn: patchWidget(id, ...) or renderWidget(...)
  5. Next turn if needed: use the refreshed Current Widget, then continue
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.