Resident binding
Pixling is preparing for Mac App Store release. Join the waitlist on pixling.app to hear when it launches.
resident.ensure binds a client-chosen namespace/key pair to one resident and returns that same resident on every subsequent call with the same pair. The MCP tool is pixling_resident_ensure; the CLI command is pixling resident ensure. Both invoke the same operation and return the same document.
For an end-to-end walkthrough of choosing, binding, writing, and receiving, see Give your agent a resident. For retry behavior, see Effects and retries.
Arguments
Section titled “Arguments”| Argument | Required | Value |
|---|---|---|
namespace |
Yes | 1–64 bytes of ASCII letters, digits, ., _, or -; case-sensitive. |
key |
Yes | 1–128 bytes of the same character set; case-sensitive. |
assetID |
For a new key | Field Guide resident (No.N, exact name, or pack/asset ID); at most 512 bytes. |
name |
No | Session label: 1–60 characters, at most 240 UTF-8 bytes, nonblank, no control characters. |
note |
No | Creation-only remarks for the session, at most 200 characters. |
initial |
No | Creation-only placement and settings (see initial). |
groupID |
No | Creation-only group UUID from group.list (see groupID). |
assetID accepts a Field Guide No.N, an exact name, or a pack/asset ID from zukan.list (entries[].id). No.N and names resolve using the same rules as resident.summon’s who:
- A name shared by two or more Field Guide residents fails with
targetAmbiguous, with a hint suggestingNo.N. - An unknown asset fails with
rejected/unknownResident. - A placed copy (
No.N#k) oreveryonefails withinvalidArgumentsonassetID. - Unknown arguments, wrong types, and invalid characters or lengths fail with
invalidArguments.
name labels only this session’s resident and never renames the shared asset. For note and initial.note, see Notes.
initial
Section titled “initial”{"placement": {"size": 80}, "settings": {"gravity": "down"}}placement:x,y,size,rotation,mirrored. Same fields asresident.place, withoutto.settings: Closed patch accepted byresident.setwithoutto. Omitted keys keep their values,nullrestores the default where allowed, and every value must appear underoptionsinresident.describe.note: Creation-only remarks for the resident itself, at most 200 characters.
Unknown fields or wrong types refuse the whole call. initial runs only when the key is new:
- Atomic transaction: Settings resolve first, the resident is placed with its final representation, and gravity settles it. Creation, placement, and settings commit together; if any step fails, no binding is left behind.
- Error details: Settings or placement errors return the same closed
rejecteddetail asresident.setorresident.place, such asdotsUnavailable,poseUnknown, oroffscreen. settings.dots: Accepted with the same refusals, though the result omitsdotsWrite. Dots whose picture the desk must render appear once ready, so inspect them withresident.describe.- Defaults without
initial: A new resident appears at the center of the display with motion off, at the default summon size (apparent idle body of about 160pt), on the floating layer so it can display questions. Explicitinitial.settingscan override both layer and motion.
groupID
Section titled “groupID”With groupID, the new resident joins that group in the same save and spawns beside an existing member on the desktop (macOS Space) where that member was last seen, even if another desktop is active now.
- Target desktop: Pixling prefers a member on the currently active desktop; otherwise it picks the first group member seen on any desktop.
- Exclusions: Hidden members and members shown on every desktop do not count.
- Fallback: If no member has been seen on a desktop, or if
initial.placementspecifies a position, the resident spawns as withoutgroupID. - Unknown group: Fails with
rejected/groupNotFoundand creates nothing.
Result
Section titled “Result”{ "binding": {"namespace": "…", "key": "…", "selector": "client:…/…", "entityID": "…", "assetID": "pack/asset", "name": "…", "note": "…"}, "state": "onDesk", "resident": {}}binding.selector: Alwaysclient:<namespace>/<key>. Use it to address your resident.- Ownership lock: Writes to a bound resident by
entityIDor any other selector fail withboundToAnotherClient. Anyone may still move it withresident.placeorresident.desktopVisibility. - Optional fields:
nameandnoteappear inbindingonly when set. - Cross-references:
residents.listandresident.describerows also includeclientBinding.
state describes the bound resident’s current presence:
state |
resident field |
Meaning |
|---|---|---|
onDesk |
Full residents.list row |
The resident is in the scene. |
stowed |
null |
The resident was put away. |
unavailable |
null |
The binding exists, but the resident cannot be listed. |
onDeskdoes not guarantee visibility: Checkvisibilityandconversationbefore asking a question.stowedstays stowed: Callingensureagain does not restore a stowed resident unless the binding was evicted (see Lifetime).unavailable: Occurs when the resident’s asset is missing or otherwise cannot be listed.
Resending and conflicts
Section titled “Resending and conflicts”- Passing
namespaceandkeyalone returns the current binding. Key lookup runs before checking the Field Guide or display. - Passing
assetIDornameon an existing key must match the stored binding; otherwise the call fails withrejected/clientKeyConflict. - An
assetIDthat no longer resolves uniquely (such as a name now shared by two assets) is not treated as a conflict. - For an existing key,
initial,note, andgroupIDare ignored, preserving the user’s own placement and settings. - A new key without
assetIDfails withrejected/creationRequiresAsset.
Refusals
Section titled “Refusals”Beyond the argument and conflict refusals above, ensure returns these scene refusals as rejected details (shared with place, set, duplicate, stow, summon, and sketch):
| Detail | Meaning |
|---|---|
appNotReady |
Pixling is starting, stopping, or reloading the desk. |
saveFailed |
The desk could not be saved; nothing changed. |
sceneInvalid |
The change failed validation; nothing changed. |
packLoadFailed |
The resident’s pack could not be read. |
noDisplay |
No display is available for placement. |
offscreen |
The requested placement is outside every display. |
unknownResident |
The assetID for a new key is not in the Field Guide. |
clientBindingLimit |
The 4096-binding limit is reached and every bound resident is currently on the desk. |
Any failure matching no typed refusal returns internalFailure, with only the error type’s name in detail.
Lifetime
Section titled “Lifetime”- Saved across restarts: Bindings persist locally with the desk across restarts, even after the resident is stowed.
- 4096-binding limit: Bindings do not expire. When a new key needs room at the limit, Pixling evicts the oldest binding whose resident is off the desk; that evicted key then counts as new again.
- Stowing preserves the tombstone: Stowing keeps the binding in
stowedstate until evicted as above. - Missing assets: An existing binding whose asset is missing reports
unavailable. - Starting fresh: Use a new
keyto start a new session explicitly. Creating a new resident under a new key does not recover a lost key’s resident. - Serialized mutations: Concurrent CLI and MCP calls to one app execute one at a time.
pixling zukan --jsonpixling resident ensure --namespace codex --key session-123 --asset-id No.7 --name Piko --initial '{"placement":{"size":80},"settings":{"gravity":"down"}}' --jsonpixling resident ensure --namespace codex --key session-123 --json| Flag | Argument |
|---|---|
--namespace |
namespace |
--key |
key |
--asset-id |
assetID (No.N, exact name, or ID) |
--name |
name |
--note |
note |
--initial JSON |
initial (a JSON object) |
--initial-note |
initial.note (pass this or initial.note, not both) |
--group-id |
groupID |
Pass client:<namespace>/<key> to --to in subsequent commands. When the user chooses to end the session, run pixling resident stow --to client:<namespace>/<key>; the key remains stowed as described in Lifetime.