Skip to content
funsaizedPublic

About

Define project subagents in Markdown, delegate work in Pi, and follow each branch from assignment to result.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Repository files navigation

Define your own subagents. Watch them work together in Pi.

Give a lead agent a task, follow the specialists it brings in, and open any branch to see the work behind the result.

Pi in a Foot terminal. In the fleet tree, relay-lead branches into event-parser and incident-stats. The parser keeps valid events around a malformed line. The report shows 4 events and 1 failure.

Watch the full build (MP4)

pi install npm:pi-pinata

Define your first agent · Recording and text walkthrough

npm CI MIT

Install · Quick start · Fleet · Workflows · Agents · Configuration · Tools · CLI · API · Implementation · Development

Why Piñata

  • Delegate independent work in parallel and add workers as the task develops. Dependency graphs stage investigation, implementation and synthesis in one request.
  • Keep a worker's conversation and workspace across follow-ups. Each assignment retains its own result, so later answers preserve the original evidence.
  • Browse the fleet and message workers directly from Pi. Navigation and direct controls do not need a coordinator model turn.
  • Choose shared work for immediate collaboration or worktrees for explicit patch selection. Dirty starting content, manual commits and partial work stay inspectable.
  • Define specialists in Markdown or TypeScript. Select their models, tools, skills and output schemas through the same launch contract.
  • Inspect failed and cancelled work, recover an original supervised attempt, and reconcile interrupted patch application with its journal intact.
  • Use one command and event model from Pi tools, extension RPC or your own host.

Piñata handles orchestration. Your coordinator owns the workflow, including testing, review and acceptance. The shipped scout, builder and reviewer are editable agent definitions. Compose your own roles around the work you actually do.

Capability index

Capability Guide and reference
Parallel workers, staged graphs and dynamic additions Workflows
Steering, follow-ups, continuation and cancellation Control a worker
Fleet tree, transcripts, drafts, search and controls Fleet and conversations
Direct addressed input and explicit retry Agent mentions
Shared files, worktrees and explicit integration Workspaces
Worktree handoff, conflict checks and rollback Apply isolated work
Markdown agents, typed reports and frozen skills Custom agents
Models, reasoning, fallback candidates and tool providers Configuration
Filtered parent context and memory revision checks Context and memory
Scoped child delegation Nesting
In-process sessions, supervised processes and Herdr Backends and lifetimes
Embedded hosts and saved-run inspection Headless operation
Tools, schemas, commands and exports Tools, CLI, API
Extension RPC, durable events and usage Events and extension RPC
Recovery and trust Recovery, trust
Source map, platforms and verification Implementation index, platforms, development

Install

Use Node 22.19 or later and an installed Pi host:

pi install npm:pi-pinata

Restart Pi to load the extension, the subagents skill and five prompt templates: /scout, /builder, /reviewer, /pinata-review and /pinata-fix. Choose an available provider/model in Pi. Workers use it unless a definition, configuration or request selects another model.

For the standalone pinata command, install the package and Pi host peer in the same npm prefix:

npm install --global pi-pinata @earendil-works/pi-coding-agent@1.5.0
pinata help

Pi's managed extension install supplies host APIs inside Pi; it does not add the standalone CLI to your shell's PATH. From this checkout, use node bin/pinata.mjs instead of pinata after npm ci --ignore-scripts.

Piñata targets Linux, macOS and Windows. See platform prerequisites for worker launchers and the Windows compiler requirement. Running workers uses provider tokens. Schema discovery, input validation and ordinary tests make no model calls.

Let active work settle or cancel it before removal, then use pi remove npm:pi-pinata (or the exact registered local path). For the global CLI, use npm uninstall --global pi-pinata. Project files and run evidence remain after package removal.

Quick start

To try the fleet offline, run pinata demo in a terminal. From a source checkout, use node bin/pinata.mjs demo. The selected reviewer is waiting for the scout. Press Right, then Enter to open the scout’s conversation. Ask the scout to trace the HTTP parser. Press Escape to return to the reviewer’s dependencies, then press Left and Enter to open the reviewer. Send a message to finish. Press h in the fleet to inspect both results. The demo uses a temporary workspace and a scripted backend with zero provider calls.

Open a project in Pi and type:

@scout Map this project's entry points, data flow and tests.

Piñata starts the read-only scout and reports its assignment. Shift+Down opens the fleet; Enter opens the selected conversation. Shift+Left/Right changes workers; Shift+Up returns to the fleet and then to Pi.

After the scout finishes, send:

@scout Follow the parser's error path and identify missing tests.

This creates another assignment in the same conversation. The first result remains available. During active work, addressed input steers the current assignment instead.

For implementation, ask the coordinator for a concrete change:

Use Piñata builders to implement the parser and command help in parallel.
Agree on the parser interface first. Inspect the diff and run the project checks.

The coordinator can add workers, request review, send follow-ups or finish directly. Shared edits are already in the checkout. Completion means execution ended; the coordinator decides whether the change is ready.

For programs that own a fleet, use host API. Submit the command in examples/fleet.json, wait for the receipt's exact assignments and query their results. Inspect retained work with pinata status RUN_DIRECTORY --json.

Fleet and conversations

In Pi, coordinator calls to pinata_run watch the exact assignments they launch. The coordinator can keep working or use pinata_wait to collect results. When all outstanding watched assignments settle, Pi resumes an idle coordinator or continues an active coordinator at its next settlement boundary. One batch update includes completed, failed and canceled outcomes; the coordinator decides what to do next. Results already collected by a foreground wait or included in a provider request do not trigger another completion turn.

Use notify: "none" alongside command in a pinata_run call to launch work without an automatic return. The default is notify: "all". This setting applies to that call's new assignments; background releases a foreground wait and keeps existing completion watches. Direct @agent input and fleet controls remain available without starting a coordinator turn.

Completion watches persist in the Pi session. Aborting the coordinator pauses its automatic returns until the next user turn. Closing the session stops wake-ups; reopening it restores retained watches. These continuations use the shared engine's settled results. Embedded hosts own their notification policy.

The coordinator shows a compact Agents tree while work is active or queued. Real children branch beneath their parent; dependencies appear as after: references. Finished work disappears from the widget. /pinata opens the full fleet.

The fleet highlights the selected row and shows its last assistant message and prompt in a details pane. Wide terminals place it on the right. Smaller terminals stack it below the list. Right focuses details when the row has no dependencies or folded branch to open. Press d to expand and focus details on any assignment. Use Up and Down to scroll, and Left to return to the list. Press d again to collapse details. Cleanup problems stay visible in the preview. Page keys scroll the focused pane, and the wheel scrolls the pane under the pointer. Enter on an assignment opens its conversation.

The selected assignment groups its links under Prerequisites and Dependents. A group starts folded when every assignment completed with confirmed cleanup. Open a group to see each assignment’s status. A Braille spinner marks running work, an hourglass marks queued work, and a checkmark marks completed work. Failures and cleanup problems carry text labels. Reduced motion uses a static running icon. ASCII mode uses text glyphs.

Use Up and Down to move between assignments. Press Right to enter dependencies. If there’s one group, this opens it and moves to its first link. Inside dependencies, Up and Down browse links and group headings. Left returns directly to the originating assignment.

Enter toggles a group heading or opens a linked conversation. Clicking a link also opens its conversation. Escape returns to the originating fleet row with the scroll position and open groups restored. To show a linked assignment in the fleet, press Right on its link. This can reveal assignments hidden by a filter, search or collapsed branch. Backspace retraces those jumps. When a settlement makes a dependent ready, the inspector briefly shows a candy moving between their names. ASCII and reduced motion use a stationary arrow.

Finished assignments show their result summary. Expand the inspector for the report reference and handoff details. Enter opens the transcript, including any submitted report. For a worktree, p opens a patch preview in the owning host. It compares current files with the frozen base, including eligible untracked files, and displays up to 32 KiB. Later edits can change the preview. A saved viewer shows the checkout and Git inspection commands. Older assignments with a retained snapshot show their recorded file changes.

The filter strip counts Unfinished, Working, Queued, Attention and Finished work. Working includes preparing, running and stopping; rows keep those exact states. Attention includes unresolved cleanup and failed or interrupted assignments that are latest for their worker or still have queued dependents. Finished means execution ended with confirmed cleanup, not necessarily success or acceptance. Counts apply after search and before branch collapse; parents shown only for context do not add to counts. Tab advances to the next status. h selects Finished, including earlier assignments, and w selects Queued. Press h or w again to restore the previous filter and selection. Dependencies do not create parent/child branches.

Search with /, apply with Enter, cancel with Escape, or clear with Ctrl+U. Cancelling restores the previous query and selection. The Observed column measures time since this viewer witnessed execution start. A dash means the start is unknown; it is not an estimate of total execution time. Model settings live in the inspector.

Last-message previews use retained assistant text for the selected assignment, excluding thinking and tool payloads. Reads are bounded and cached by artifact; only the visible selection refreshes. Incomplete evidence and disconnected previews are labeled. A whole-worker checkpoint is never attributed to a later assignment.

Press r for runs in this project. Related Git worktrees share a run list, with workspace paths to distinguish them; non-Git folders use their canonical workspace root. Matching runs already bound to custom stores also appear. Opening saved evidence is read-only and does not acquire ownership or start workers. Each run keeps its selection, filters and drafts. Fleet controls target only the selected run, including its hidden assignments.

Fleet and conversation screens fill the terminal. Worker conversations in Pi use the host theme, Markdown spacing, thinking visibility, tool expansion state and keybindings when the fleet opens. Piñata key overrides take precedence, and conversation toggles apply within the fleet. Folded tool output summarizes dependency results and keeps the retained payload available when expanded. Folded completion cards show the worker, outcome, a short summary and the conversation command. Expand a card for its retained evidence, including small typed reports, worktree details and cleanup status when available.

Input Action
Shift+Down Open the fleet, including from a worker conversation.
Shift+Up or Escape Return to the parent screen.
Up/Down, Enter in the fleet Browse assignments or links, open chats, toggle groups.
Shift+Left/Right Select the previous/next worker.
Alt+Left/Right Browse earlier/later assignments for that worker.
Left/Right in the fleet Move between the list, branches, links and details.
Backspace in the fleet Return after showing a link in the fleet.
Mouse click/double click Toggle groups, open links or select/open assignments.
Mouse wheel, PageUp/PageDown, Alt+PageUp/PageDown Scroll the focused pane; wheel follows pointer.
/ in the fleet Search workers/tasks; Enter keeps the filter.
Tab in the fleet Show the next work status.
h in the fleet Select Finished; press again to restore the previous view.
w in the fleet Select Queued; press again to restore the previous view.
a in the fleet Show stop actions for an assignment, agent or entire fleet.
d in the fleet Expand and focus details, or collapse them.
r in the fleet Browse runs in the current project.
Tab in a conversation Switch composer/transcript focus.
Ctrl+O in a conversation Expand/collapse tool output.
Ctrl+T in a conversation Show/hide thinking output.
d, m with transcript focus Expand details, load older pages.
Ctrl+X Stop this agent's active/queued work, including children.
Ctrl+B Release a foreground wait; agents keep working.
Ctrl+R Recover the selected original assignment.
Ctrl+L Refresh the selected source.
? Show help for the current screen and focus.

Conversations follow the latest saved output. Scrolling away from the bottom holds history still; reaching the bottom resumes following. Visible live conversations refresh once per second while following. Reading mode, hidden views and saved sources do not poll. There is no separate follow toggle.

Short conversations sit above the composer. Message controls stay at the bottom when output, send feedback or terminal size changes. "Message queued" means the runtime saved your message; it does not confirm the worker has read it. Receipt IDs remain in the expanded Subagent update card in the coordinator conversation.

Each worker keeps its own message draft, separate from the coordinator draft. Tool and thinking toggles work from either focus and use Pi's configured shortcuts. They leave the message draft and assignment details unchanged. Standalone viewers use Ctrl+O and Ctrl+T; ui.keys.expandTools and ui.keys.toggleThinking override them. A control draft clears only after durable acceptance. The composer labels whether text will steer, follow up or continue. Question marks inside a draft remain text. Ctrl+arrow keys have no default Piñata actions. Ctrl+B and Ctrl+R retain editor behavior while composing; use Tab for transcript controls or the commands below. Help and back controls stay visible on narrow terminals; less common shortcuts remain in ? help. Help and definition previews support arrow and page scrolling. Shortcut overrides must use a modifier or function key and preserve the reserved navigation and editing keys.

Saved and disconnected views label their control limits. The actions menu explains unavailable controls and keeps inspection available. Message drafts remain editable for local commands; messages require a control connection. Earlier assignments identify when you need to select the latest assignment to send a message. Invalid navigation and replacement commands keep the draft and show usage or target errors.

Inside a worker screen, /worker <id> [assignment], /assignment <number>, /fleet and /main navigate. /steer <text>, /follow-up <text> and /continue <text> select the message action. /stop, /stop-assignment and /stop-run stop the selected agent, one assignment, or the entire fleet in the current run, respectively. Stops include child agents, interrupt active work and cancel queued work. The fleet action includes hidden and filtered agents and works without a selected row. Stop requests retain output and file edits; cleanup may take time. /background releases the coordinator's foreground wait while agents keep working. Esc closes the actions menu or leaves the view without stopping work.

Other controls are /inspect, /more, /refresh, /recover, /reconnect, /background, /queued, /scroll up|down|N, /palette <name> and /help. /replace <new-worker-id> <task> creates a worker with the selected assignment recorded as origin.

Agent mentions

Only leading user input is routed. A worker ID is its handle; when no worker matches, an exact definition name starts one.

Input Behavior
@scout Trace the parser Start the definition, steer pending work or follow up after completion.
@scout Navigate without launching work.
@run-prefix:scout Inspect errors Select a visible run explicitly.
An ambiguous handle/prefix Show candidates and retain the draft.
Embedded handles, quoted text, paths and file suffixes Ordinary Pi input handling.

The selected run wins when it contains that worker; otherwise Piñata looks for a unique visible match. Unknown definitions produce an error. Model output never becomes a mention command.

Piñata records the routed envelope before dispatch. If its reply is uncertain, use the displayed /pinata-retry run-prefix:input-token in the original Pi session and run. It reuses the request, message and target. Repeated callbacks for one input deduplicate; submitting identical text again is a new request. See recovery for session loss and retained envelopes.

Palettes and accessibility

/pinata-palette <name> or ui.palette selects a palette. The default, inherit, uses Pi's theme; the standalone viewer has its own fallback. Available names:

inherit             pinata              terminal-default
catppuccin-mocha     catppuccin-latte
gruvbox-dark        gruvbox-light       tokyo-night-night
rose-pine-main      rose-pine-dawn      dracula
nord                one-dark            one-light
solarized-dark      solarized-light

Palette changes preserve worker state and drafts. NO_COLOR, TERM=dumb and terminal-default disable palette escapes. PINATA_ASCII=1 or TERM=dumb selects ASCII glyphs. ui.motion accepts full, reduced or off; reduced/off use static activity markers. Worker text is sanitized for terminal escapes and bidirectional controls while preserving ordinary Unicode text.

mode: "lean" keeps activity compact; observe adds excerpts. Both retain conversations. Context utilization comes from a timed source observation or stays unknown. Cumulative tokens do not establish current context size. Elapsed values cover starts witnessed by that UI.

Workflows

A worker has a frozen definition, model, tools, grants and workspace. An assignment is one task or follow-up in its conversation, identified by {run, worker, assignment}. Use references returned by receipts for results, dependencies and patches.

Parallel work and staged graphs

Send this batch to the coordinator's pinata_run tool:

{
  "requestId": "parser-team/start",
  "command": {
    "kind": "create",
    "workers": [
      {
        "id": "parser",
        "agent": "builder",
        "task": "Implement the agreed parser in src/parser.ts. Preserve unrelated edits."
      },
      {
        "id": "help",
        "agent": "builder",
        "task": "Update src/help.ts for the agreed parser interface."
      },
      {
        "id": "review",
        "agent": "reviewer",
        "after": ["parser", "help"],
        "task": "Review the parser and help changes. Report defects with source references."
      }
    ]
  }
}

Use kind: "add" to extend a run. Acceptance validates the whole batch atomically, including forward references and cycles. Rejected batches reserve no worker names. dynamic-shared.json is a runnable starting point.

after binds a worker ID to its latest accepted assignment when the dependent is accepted. An explicit full reference selects an earlier assignment. Later follow-ups do not retarget edges or reopen downstream work. Dependencies become ready when exact predecessors end with confirmed cleanup; reported blockers or failed checks do not create an acceptance gate.

For report pipelines, declare known stages together. Workers receive previews and pinata_dependency to list/read complete frozen result JSON. Use the returned next as the next offset. List offsets count entries; result offsets count UTF-16 code units. Previews show at most eight short summaries. Pages fit within 32 KiB and retain artifact references without reading their contents. Use context for explicitly quoted report text. Share files through the checkout or ordinary Git operations.

Control a worker

Action Use
steer Send instructions to active or queued work.
follow_up Queue another assignment in the same conversation/workspace.
continue Explicitly resume stopped/failed work with recoverable context.
cancel Stop an assignment, worker or run; descendants default on.
background Release a foreground wait while work continues.
capacity Change active assignment capacity, including descendants.

A follow-up queues FIFO and keeps earlier results immutable:

{
  "requestId": "parser-team/error-cases",
  "command": {
    "kind": "follow_up",
    "worker": "parser",
    "messageId": "parser/error-cases",
    "text": "Add the agreed malformed-input case and report the checks you ran."
  }
}

Capacity defaults to unbounded. Set execution.maxConcurrent to a positive integer to queue ready work; null removes the limit. Lowering it leaves active work running. Aborting a wait releases the caller without cancelling workers. Cancellation retains partial output and checks cleanup separately.

Durable acceptance, backend transport and worker consumption are separate observations. After a lost reply, inspect the original receipt before retrying with the same request ID and payload. Changed payloads under accepted IDs conflict.

Build Relay

Relay parses JSONL service events, summarizes them and renders a Markdown report. The example exercises parallel modules and dependent integration:

scout -> parser -----+
      -> summarizer -+-> CLI integration -> reviewer
      -> renderer ---+

Create a disposable checkout; setup refuses an existing destination:

node examples/relay/setup.mjs /tmp/relay-exercise
cd /tmp/relay-exercise

Read REQUIREMENTS.md and select available models in fleet.json. In Pi, ask the coordinator to submit its command with pinata_run, inspect exact results and correct failures through follow-ups. The starter has unfinished stubs, so its verifier initially fails. Check the completed work:

node --test
node verify.mjs
git diff

One scout maps interfaces, three builders implement modules, a CLI builder integrates those exact assignments, and a reviewer reports findings. These are example choices. The coordinator chooses checks and follow-ups. Preserve the independent expected report and verifier while repairing implementation. Shared work needs no apply step; Piñata does not automatically commit it.

Workspaces

Mode Behavior
shared Work in the authorized checkout, including non-Git projects. Edits are immediately visible.
worktree Start from a frozen Git base and explicitly apply the worktree's current files.

Tool access and workspace mode are independent. Workers retain conversations, results and cleanup evidence without per-assignment file snapshots or completion commits. Shared edits are already in the checkout. The coordinator owns testing, review and integration; it can apply work within the user's authorization without asking for a separate approval each time.

In a shared checkout, give workers separate areas when possible and have them report overlaps to the coordinator. Use after when one assignment needs another's edits. Workers should reread files before editing and preserve changes they did not make. The coordinator resolves overlapping changes and chooses when to run checks or commit. Piñata does not register writers or lock project files.

New worktrees include dirty starting content by default; includeUncommitted: false selects committed content. Follow-ups keep the worktree; changing modes needs a new worker. Results expose worktree.path and worktree.base for inspection with Git. The worktree remains available after failure or cancellation. Its files are mutable: an old assignment reference does not preserve an old version. Use Git commits or patches when a workflow needs named versions or transfers between worktrees.

New requests no longer accept observeWorkspace or snapshot inputs. pinata.checkpoint in old definitions is ignored for new workspaces. Saved snapshots, input operations and checkpoint intents remain readable and recoverable; previously captured snapshots can still be applied. The legacy changes query reads that evidence and returns source: "unavailable" for new assignments, which says nothing about whether files changed. pinata_changes is no longer registered as a tool.

Dependencies and setup

Use after for assignment ordering and the dependency tool or quoted context for reports. Use shared files or coordinator-selected Git operations to transfer code.

The source checkout's .worktreeinclude selects ignored local regular files, such as .env.local or local/**. Piñata freezes their identities at acceptance and copies them during initial preparation. Changed sources, links and unsafe paths are refused or recorded as omitted; existing destination files and follow-up edits are preserved. Included contents are excluded from application even if ignore rules change. Limits are 1,000 files and 16 MiB per file. Use setup for dependencies.

Setup runs only in writable isolated work. setup: false disables it; a string selects a shell command; omission can detect a root lockfile and package manager. Shell capability is required. Detected setup without that grant is skipped with a reason; an explicit command is rejected. passEnv selects safe environment names; values are supplied at execution and are not serialized. Success is retained for the relevant worker and input identity. Failed setup preserves partial edits; inspect uncertain interrupted setup before deciding to run it again.

Apply isolated work

Submit the command in isolated-follow-up.json with pinata_run. Inspect its exact result with pinata_status and use the returned worktree.path and worktree.base:

git -C WORKTREE_PATH diff BASE_COMMIT
git -C WORKTREE_PATH status --short

Send corrections with pinata_run using follow_up, wait for that receipt's exact assignments, and call pinata_integrate with the latest stopped ref and destination. Embedded hosts use the same follow_up and apply commands.

Apply selects the current files, including untracked files, using the worker's latest stopped assignment reference. It does not select that assignment's past output. Inspect the accepted operationId and its outcome. Later applications deliver the delta from the last applied Git tree, even within the same assignment. Retry the same request ID to retrieve the original operation; use a new ID to select newer edits. Apply preserves HEAD and the index.

Before applying, arrange a handoff: let affected workers finish or cancel them and confirm cleanup, then keep the source worktree and affected destination files still until apply returns. Coordinate other sessions and editors too. Piñata checks the selected worker's stopped assignment, but does not track other checkout writers.

Apply checks paths, objects, destination identity and expected content. Conflicting edits are reported for the coordinator to resolve; apply does not merge them. These checks can detect changes, but cannot prevent concurrent edits. A small lock in .pinata/applications/lock/ serializes apply, rollback and recovery against the same application journal. It does not block workers or editors.

Each application journals before and after blobs and cursor meaning. rollback reverses only matching destination content; later edits conflict. reconcile selects the retained operation and owner epoch. Application blobs and helper evidence live in the destination's .pinata/applications/artifacts, so later runs can verify and recover earlier operations. Older journals copy missing blobs from the attached run when read. Reopen the originating run first if a legacy blob is unavailable; do not delete its artifacts. Preserve journals, worktrees and artifacts until the outcome is understood. See recovery.

Custom agents

Shipped agent Tools Purpose
scout read, grep, find, ls Trace code, data flow and risks.
builder read, write, edit, bash Implement a concrete task and report actual checks.
reviewer read, grep, find, ls, bash Find defects and missing evidence in a supplied change.

The reviewer requests write access because shell execution requires it. Its instructions leave source files and commits untouched; this is a behavioral instruction, and shell access can mutate files. The coordinator chooses checks and decides acceptance.

Define your first agent

Save a specialist as .pi/pinata/agents/api-scout.md:

---
schemaVersion: 1
name: api-scout
handoffDescription: Map API behavior and compatibility risks.
tools: [read, grep, find, ls]
pinata:
  access: read
  color: accent.cyan
---

Trace the assigned API from callers to implementation and tests. Return source
references, compatibility concerns and unresolved questions. Do not edit files.

Validate with pinata agents show api-scout --workspace . --json, then use @api-scout Trace authentication errors in Pi or "agent": "api-scout" in a worker command.

Discovery and fields

Definitions resolve from lowest to highest precedence:

  1. Packaged agents/.
  2. <Pi agent directory>/pinata/agents/, normally ~/.pi/agent/pinata/agents/.
  3. Project .pi/pinata/agents/.

Repeatable --definitions <directory> replaces the list in supplied order. Invalid selected overrides fail with path and field errors. Names match filenames and contain a lowercase letter followed by up to 31 lowercase letters, digits or hyphens. agents list|show <name>|validate --json returns source paths and digests.

Field Type/default and meaning
schemaVersion Required 1 in Markdown.
name, handoffDescription Stable handle and discovery description.
Markdown body Instructions; project instructions are discovered each assignment.
model Optional exact provider/id.
modelSettings.reasoning.effort off, minimal, low, medium, high, xhigh, max.
tools Default []; named tools checked against host grants/classifications.
handoffs Default []; allowed child definition names.
outputType Registered schema name, or a Zod schema in trusted TypeScript.
pinata.access read by default; write requires a grant.
pinata.workspace Default shared; explicit declaration overrides run workspace config.
pinata.skills Default []; files/directories relative to the definition source.
pinata.fallbacks Default []; up to five model candidates.
pinata.color accent.blue/cyan/green/yellow/orange/red/pink/purple or six-digit hex.
pinata.inheritContext Default none; parent requests a filtered checkpoint.
pinata.memory Default { "scope": "none", "access": "read" }.
pinata.delegation.maxDepth Default 0; requires handoffs and a scoped host grant.

Acceptance freezes the definition, model, grants, tool providers, skills and workspace plan. A new worker adopts edited frozen resources; follow-ups preserve the accepted worker. Project AGENTS.md discovery refreshes each assignment, including new or renamed files in non-Git projects.

Only explicitly selected skills load. Piñata freezes source and resources and materializes those bytes for execution. Skills cannot broaden tools or grants. Custom extension providers are trusted host code; their frozen source identity is checked before load. pinata agents validate also checks selected skill files and resources without opening a runtime or making model calls. Missing skills report the resolved path and pinata.skills field. Validation does not establish model or tool availability.

Typed definitions and reports

For a typed report, export an agents array from an explicit bootstrap module:

import { defineAgent } from "pi-pinata";
import { z } from "zod";

export const agents = [
  defineAgent({
    name: "api-auditor",
    handoffDescription: "Map API compatibility risks.",
    instructions: "Inspect the requested API and report concrete findings.",
    tools: ["read", "grep", "find", "ls"],
    outputType: z.strictObject({
      files: z.array(z.string()),
      risks: z.array(z.string()),
    }),
  }),
];
pinata agents show api-auditor --bootstrap ./pinata-agents.ts --json
pinata agents list --bootstrap ./pinata-agents.ts

defineAgent defaults schemaVersion to 1. Typed and Markdown definitions cannot share a name. The optional submit_result worker tool submits a final report and ends the assignment on success. Use it only when ready to finish, never for progress updates. Later tool calls in the same batch are blocked, and queued input does not continue a reported assignment. The coordinator can start an explicit follow-up. It accepts:

{
  "summary": "Traced authentication errors.",
  "data": { "files": ["src/auth.ts"], "risks": ["Missing expiry test"] },
  "assessment": {
    "findings": ["Expiry behavior has no regression test."],
    "claimedChecks": [],
    "blockers": []
  }
}

outputType validates data. Zod refinements, including asynchronous refinements, run in the original trusted validator. Discovery exposes input JSON Schema, which cannot recreate callbacks. Transforms and non-JSON types are rejected. Failed optional reports remain as reporting errors; ordinary final text remains valid output.

Workers freeze the selected bootstrap path, source bytes, digest and schema descriptor. Missing or changed bootstraps fail before execution. Editing an already loaded module requires a fresh host process and worker. Only host code or explicit --bootstrap can select executable definitions.

Worker messages

Workers can use pinata_message for progress, findings and questions while they continue working:

{
  "messageId": "registry-ready",
  "to": "coordinator",
  "text": "The initial registry is ready; discovery is continuing."
}

Omit to to address the worker's original parent assignment, or the coordinator for a root worker. Use "coordinator" explicitly to reach the primary agent, or {"worker":"builder"} to address another active or queued worker in the same run. Add assignment to select an exact assignment. Stopped or canceled recipients reject new messages; a message never starts or resumes an assignment.

The host supplies the sender identity. The receipt confirms durable recording; delivery and consumption remain separate observations. Reusing messageId with the same input returns the original receipt; changing its content rejects the retry. Messages arrive as attributed worker data and grant no command authority. Pi displays coordinator messages and includes them in its next provider request without starting an extra coordinator turn. Peer messages use the existing input queue, including its consumption checkpoints. Concurrent completion or cancellation can leave a recorded message unread.

Read retained messages with pinata_status and {"query":{"kind":"messages","since":0}}. The returned cursor is the next since value; an optional worker filter selects messages sent or received by that worker. The query also works through extension RPC, the CLI and saved-run viewer.

Configuration

Layers resolve from personal <Pi agent directory>/pinata.json, project .pi/pinata.json, then run config. Omitted fields preserve lower layers. models, fallbacks and toolProviders merge by entry; other supplied fields replace the corresponding field. Worker overrides resolve into frozen launch data.

{
  "schemaVersion": 1,
  "workspace": "shared",
  "backend": "in-process",
  "mode": "observe",
  "models": {
    "builder": { "provider": "provider", "id": "model", "thinking": "high" }
  },
  "execution": { "maxConcurrent": 4 },
  "ui": { "palette": "catppuccin-mocha", "motion": "reduced", "keys": {} }
}
Field Default/behavior
schemaVersion 1.
workspace shared; optional worktree.
backend in-process; optional process, herdr-pi.
models {}; per-agent model objects and optional default.
fallbacks {}; per-agent/default lists of up to five available-model candidates.
execution.maxConcurrent null (unbounded), or a positive active-assignment limit.
mode lean; observe adds activity excerpts.
toolProviders {}; named {extension, tools} providers.
webExtension Optional provider for web_enable, web_search, fetch_content, get_search_content.
passEnv []; safe setup environment names, with values excluded from evidence.
setup Omitted: detect root locked dependencies; false: disable; string: explicit command.
worktreeRoot Optional host worktree location.
codemode true; Pi coding wrapper with underlying capability checks.
includeUncommitted true; include dirty content in a new isolated base.
ui.palette, ui.motion, ui.keys inherit, full, {}.

Model precedence is worker request, per-agent config, definition, default config, then parent model. Definition reasoning defaults to off when its model is selected. Fallback candidates resolve before launch and retain provenance; execution failure does not silently rerun on another model. Model objects contain provider, id and thinking. Definition discovery alone does not promise model availability.

Key actions are openFleet, parentScreen, previousWorker, nextWorker, previousAssignment, nextAssignment, stop, background, recover, refresh, scrollUp and scrollDown. Invalid/reserved or duplicate bindings fail explicitly; screen help reflects configured bindings.

Built-in read, grep, find, ls have read access. write, edit, bash and powershell need write access. Custom providers default to write classification unless host code classifies them otherwise; known web-provider tools are read-oriented. Requests must fit the frozen tool list and grant. Loader and control environment names such as NODE_OPTIONS, LD_PRELOAD, DYLD_INSERT_LIBRARIES and PINATA_* are refused in passEnv.

Host grants

Authority comes from the host, separately from project config and model requests. The default host grants ordinary read/write tools and both workspace modes. Inheritance, memory and delegation default off.

In Pi, /pinata-grants <json> followed by /pinata-new selects grants for a new run. Personal <Pi agent directory>/pinata/grants.json supplies persistent grants across workspaces; command and integration grants take precedence. Invalid personal grants fail with their path. Accepted workers keep their grants.

Headless hosts use --grants <file>; integrations use HostOptions.grants. Inspect pinata.grants.v1 before editing it. The grant recipe contains every required field. Project config, skills, reports and memory cannot grant authority.

Context and memory

pinata.inheritContext: parent requests a filtered parent conversation. It requires a host grant, supporting backend and available checkpoint. Pi can supply the current parent branch; an independent headless host without parent context reports unavailable. Piñata retains supported messages, complete tool pairs and compaction provenance, excluding host controls and incomplete pairs. Import does not replay tools. Use task text or context for explicit quoted background.

Memory scope Use
none Default; no memory tools.
worker Retained notes for one worker.
project-agent Notes for one agent within one canonical project.

The host must grant the same scope and requested access. There is no cross-project global profile. pinata_memory_read returns a revision; edit/clear requires that revision. Concurrent writes conflict: read, merge and retry. Clear records an empty revision while preserving history. Model-written notes remain subordinate to current instructions and grants.

Pi provides direct controls without a model turn:

/pinata-memory inspect scout
/pinata-memory edit scout {"expectedRevision":0,"text":"Retained notes","data":{"checked":true}}
/pinata-memory clear scout 1

Use the inspected revision. Inspection reports scope, value and provenance; edit replaces the value, with optional data. These controls use the accepted worker's scope and write grant, accept no path override and preserve a newer editor draft.

Nested delegation

Enable nesting when a worker should divide a workstream and synthesize its children. Independent tasks can remain siblings. Child ancestry comes only from the bound pinata_children tool; after, names and origins do not establish parentage.

The delegator definition, fleet command and grants form a complete opt-in example. In Pi, copy the definition to .pi/pinata/agents/delegator.md, paste the grant JSON into /pinata-grants, then use /pinata-new. For persistent personal setup, use <Pi agent directory>/pinata/agents/ and pinata/grants.json.

Submit authorized-nested.json through an embedded host with the example definition directories and grants, or use its command in pinata_run after configuring Pi.

The parent needs positive depth and allowed handoffs. The host grant must permit depth, child definitions, tools and workspaces, and the backend must support nesting. pinata_agents reports effective delegation.enabled and each parent's usable scope or disabled reason. Plan from that discovery. Model config alone does not create an agent or enable delegation.

Children use their definitions within the parent's ceiling. Read-only parents cannot grant write access. Child tools control only descendants and never receive a root source or supervisor credentials. IDs share the run namespace; prefix them by workstream and batch independent children in one add call.

Descendants share root assignment capacity. A waiting parent occupies a slot. At capacity one, pinata_child_wait returns capacity_blocked: finish the parent with child references, let children settle, then have the coordinator follow up with that same parent and exact after references for synthesis. dependency_blocked also requires ending the parent. Polling cannot free its slot. Normal parent completion leaves accepted children running; cancellation includes descendants by default. Completion notices do not automatically start another parent turn. The shipped nested instructions contain exact patterns.

External triggers

Coordinators and integrations decide when to submit work. An external timer can call an embedded host or an extension adapter using canonical commands and durable request IDs. Piñata dispatches accepted assignments as dependencies and capacity allow; it does not own calendar schedules. See migration for retained schedule history.

Backends and lifetimes

Backend Execution
in-process Pi sessions in the host. Default; avoids worker process startup and releases idle sessions after persistence.
process The same Pi adapter in a supervised Node worker with durable transport and original-attempt reattachment.
herdr-pi The process protocol plus an owned Herdr monitor pane; requires an available Herdr session.

Backends share the frozen contract for tools, context, skills, memory, continuation and workspaces. Unsupported capabilities fail before launch. Missing Herdr does not switch the request to another backend. Its monitor displays observations; steering uses Runtime controls. Pane and terminal identity checks preserve other panes on close.

lifetime: "attached" stops with a lost owning host. surviving needs a supporting supervised backend and preserves the original attempt after unexpected host loss. Explicit shutdown stops both lifetimes. Waiting and lifetime are independent. Recovery inspects the retained attempt rather than creating an empty conversation.

Payload exit does not establish descendant cleanup or complete output. The POSIX supervisor controls its owned group through a live nonce-bound authenticated channel. Windows uses a creation-time Job Object. Stopped receipts require matching ownership and termination evidence. Missing, escaped or ambiguous activity stays unconfirmed; inspect and recover it before continuing that worker or handing off its files. Process output drains and synchronizes separately from payload exit. Each tiny streaming chunk incurs durable transport work, which can affect completion latency.

Headless operation

Programs own fleets through host API. Submit canonical commands, wait for exact assignments, retrieve results and close the host in finally. embedded-host.ts shows this lifecycle.

The CLI discovers schemas and definitions and reads retained runs directly:

pinata demo
pinata view RUN_DIRECTORY
pinata status RUN_DIRECTORY --json
pinata result RUN_DIRECTORY map 1 --json

Git projects use a store under the common Git directory; non-Git projects use .pinata/runs. openHost({directory}) selects a run store. Canonical workspace identity handles aliases consistently. Saved views never claim ownership or control workers. Recovery and patch application require Pi or an embedded owning host.

Tools

Pi supplies tool schemas automatically. Start with pinata_agents for definitions and effective capabilities. Inspect installed contracts with pinata tools --json, pinata schema <name> --json or the generated JSON catalog.

Coordinator tool Input/purpose
pinata_run command, optional requestId; create/add/follow-up/continue/capacity/background.
pinata_steer worker, messageId, text, optional requestId.
pinata_cancel scope, applicable worker/assignment, optional descendants, requestId.
pinata_wait Optional workers or exact targets, and next.
pinata_status Canonical query, default status.
pinata_agents Discover definitions, model defaults and effective grants.
pinata_integrate Exact ref, destination, optional requestId; observe its application operation.
pinata_rollback operation, destination, optional requestId.
pinata_recover Optional exact targets; inspect/reattach original attempts.
pinata_page cursor returned from a paged tool reply.
Worker tool Availability
submit_result Optional final report; ends the assignment on success. outputType can refine data.
pinata_message Send to the coordinator, parent or a pending peer without ending the assignment.
pinata_dependency Exact frozen dependency results only.
pinata_children Explicit scoped delegation grant.
pinata_child_status, pinata_child_wait Same grant; descendants only.
pinata_page Previously exposed child-tool output in this worker session.
pinata_memory_read Granted worker/project-agent memory.
pinata_memory_edit, pinata_memory_clear Scoped memory write grant and expected revision.

Coordinator details retain pinata.surface-reply.v1; pinata_page returns pinata.tool-page-reply.v1. Model content fits within 32 KiB. Larger replies return immutable UTF-8 JSON fragments with offsets, digest and nextCursor. Pass it as cursor to pinata_page and concatenate text in offset order. Details, CLI JSON and immutable evidence retain the full value. Cursors expire with the host and cannot address arbitrary files or artifacts. After reconnect, re-query the read or original receipt for fresh pages.

Commands and queries

Envelopes contain requestId, optional expectedRevision and command. Accepted receipts name the revision, exact assignments, messages and any application operation. Stale expected revisions reject. Stable IDs make acceptance retries idempotent; they do not promise exactly-once arbitrary external tool effects.

Command Behavior
create, add Atomically accept worker batches; create can include config.
follow_up Queue with worker, messageId, text, optional after.
steer, continue Address a worker with message ID/text.
cancel Assignment/worker/run scope; descendants default on.
background, capacity Release a wait or select positive/null maxConcurrent.
apply Apply current worktree files after coordinator handoff; check conflicts.
rollback, reconcile Recover a selected journaled application.

Worker requests require id, agent, task. Optional fields: origin, messageId, after, workspace, model, backend, lifetime, context, inheritContext, memory, delegation. origin identifies an earlier assignment in the same run. It copies no context or files and adds no dependency; supply these explicitly when replacing work.

Queries: status, messages, config, receipt, result, events, schemas, definitions, conversation, conversation_preview, changes, application, wait. Result, conversation, preview and changes select ref; receipt selects requestId; application selects operationId. Conversation paging uses returned cursor; events and messages use since. Messages can filter by worker. Unnamed model-facing schema discovery returns an index. Request a named schema or tool for its fields.

conversation_preview returns up to 4,096 code points of assistant text, with its source and completeness. It searches at most 512 recent entries within 2 MiB of retained evidence. A checkpoint fallback reports its source without attributing whole-worker history to the selected assignment. Full conversation queries retain their complete evidence checks.

Errors and versions

Domain error Meaning
invalid_input Malformed/rejected fields.
dependency_missing Unavailable assignment reference.
capability_denied Request exceeds authority.
unsupported Selected host/backend/resource lacks capability.
conflict Stale revision, changed accepted payload, state or content.
owner_unconfirmed Ownership/cleanup cannot be established.
context_unavailable Retained conversation/resource cannot be restored.
commit_unknown Durable write outcome is uncertain; inspect the receipt.

Surface errors also include internal_error, protocol_version, unauthenticated, transport_closed, transport_limit, with an optional field where useful.

Contract Version/schema
Config 1: pinata.config.v1, pinata.config-layer.v1.
Definition 1: pinata.definition.v1.
Manifest 1: pinata.manifest.v1.
Journal 1: pinata.journal.v1.
Event 1: pinata.event.v1.
Extension RPC 1: pinata.extension-*.v1.
Application journal 1: pinata.application-journal.v1.
Commands/workers/results/surfaces All named schemas use v1.

Package and data versions are independent; unknown versions fail explicitly. JSON Schema describes shape. Canonical validation also checks grants, graph references, resource identity and journal consistency. Pi may coerce scalar tool input before validation; CLI and extension RPC do not.

CLI reference

pinata help prints installed grammar; --json emits one JSON value per line. Use - for stdin where a file argument is accepted.

Command Purpose
view <directory> Saved viewer; optional --palette.
query <directory> <file> Read-only canonical query; - reads stdin.
status, logs Inspect a directory; logs accept --since <revision>.
result, conversation, changes <directory> <worker> [assignment]; omission selects latest.
schema [name], tools Discover canonical schemas and tool contracts.
agents list, agents show <name>, agents validate Discover/validate definitions.

Discovery accepts --workspace, --agent-dir, repeatable --definitions and a trusted --bootstrap <module>. Inspection accepts --cursor, --since, --palette and --json where applicable.

Exit codes: 0 observed, 1 failed/uncertain application evidence, 2 invalid or rejected request. Execution completion does not certify correctness.

Pi commands: /pinata, /pinata-main, /pinata-fleet, /pinata-conversation <worker> [assignment], /pinata-palette <name>, /pinata-schema <name>, /pinata-grants <json>, /pinata-new, /pinata-retry <run>:<input-token>, /pinata-memory inspect|edit|clear ....

Package API

Root pi-pinata exports defineAgent, openHost, Runtime, bindRuntime, openSavedSource, ToolPages, toolContentBytes, exportSchemas, parseSchema, schemaRegistry.

Public types: AgentDefinitionInput, DefinedAgent, Host, HostOptions, RuntimeOptions, RuntimeSource, AssignmentRef, CallerAuthority, CommandEnvelope, CommandReceipt, RuntimeEvent, SurfaceCall, SurfaceReply.

Entry Boundary/exports
pi-pinata Full root host API; loads Pi SDK.
pi-pinata/host openHost, defineAgent, builtinTools and host types.
pi-pinata/runtime Pi-independent Runtime and port/options types.
pi-pinata/contracts Schemas/types, versions, assignmentKey, canonicalJson, digestValue, DomainError, exportSchemas, parseSchema, schemaRegistry.
pi-pinata/sources RuntimeSource, bindRuntime, callRuntime, surfaceError, SurfaceFailure, ToolPages, toolContentBytes.

The .mjs bridges install a package-scoped TypeScript loader for node_modules on supported Node versions; native Pi/Bun uses its own support. Internal paths are outside the public compatibility API.

Open a host

import { openHost } from "pi-pinata";

const host = await openHost({
  workspace: "/path/to/project",
  parentModel: { provider: "provider", id: "model", thinking: "off" },
});

try {
  const receipt = await host.runtime.execute(
    {
      requestId: "api/map",
      command: {
        kind: "create",
        workers: [{ id: "map", agent: "scout", task: "Trace public entry points." }],
      },
    },
    host.caller,
  );
  if (receipt.status === "rejected") throw new Error(receipt.error.message);
  console.log(await host.runtime.wait({ targets: receipt.assignments }, host.caller));
} finally {
  await host.close("Integration finished");
}

openHost binds workspace identity, definitions, models, adapters and grants. It returns runtime, caller, source, workspace, directory, resolved config and asynchronous close(reason). Retained manifests must match the workspace/run. Close records cleanup, including unconfirmed ownership.

HostOptions accepts workspace, directory, run, agentDir, ordered definitionDirectories, layered config, parentModel, parentContext, grants, modelRuntime, bootstrapModule, nodeCommand, backends, tools, notifications, workspacePort, onDiagnostic. These are trusted integration inputs. The bootstrap can export agents and/or configureModelRuntime(runtime, manifest?). Injected model runtimes skip the hook in the owner; process workers invoke it for their runtime.

Runtime and sources

Runtime.open(options) is the command authority. RuntimeOptions supplies a durable directory and optional manifest, worker and config resolvers, definition discovery, execution backends and workspace, application port, notifications and diagnostics. fault and effectPort are deterministic test seams.

Method Contract
execute(envelope, caller) Durably accept/reject; accepted retries return the original receipt.
query(query, caller) Typed state, results, receipts, events, definitions, schemas and observations.
wait(request, caller, signal?) Freeze targets; abort leaves work running.
subscribe(request, caller, consume) History/snapshot then live events; returns unsubscribe.
recover(request, caller) Inspect/reattach original attempts.
close({reason}) Stop owned work and report cleanup.
bindChild(parentRef) Authority-bound child port.
parentCheckpoint(ref, caller) Supported parent conversation checkpoint.
deliverNotifications(caller, {notificationId}?) Deliver one durable notice, or retry the outbox when no ID is supplied.
acknowledgeNotification(request, caller) Durably accept delivery responsibility without model-consumption evidence.
recordNotificationConsumption(id, artifact, caller) Record exact notice consumption with retained checkpoint.
diagnostics() Observer/execution diagnostics.
dispatch(ref, caller) Injected inert test effect port.

bindRuntime(runtime, caller) binds request, snapshot, subscribe to fixed authority. RuntimeSource also reports run/capabilities. openSavedSource(directory) reads retained data without connecting to a live owner.

new ToolPages({artifacts, scope}) binds a trusted ArtifactPort and run/worker scope. format(value) preserves small JSON and stores larger immutable replies; read(cursor) returns exact UTF-8 fragments. Cursors authorize only already-exposed output. Paging failures retain original details and recovery guidance without changing command receipts.

Extension ports

WorkerResolver freezes definitions, grants, loadouts and workspace plans before acceptance. BackendPort advertises restoration, steering, context, skill, memory, delegation, fallback, lifetime and cleanup capabilities. Start and reattach handles own input receipts, observations, completion, checkpoints and stop receipts.

WorkspacePort supplies workspace lifecycle methods: prepare, recover and release. The runtime calls release after confirmed worker cleanup, passing the assignment reference and cleanup receipt. Adapters return a working directory, an identity and retained artifacts for recovery. The built-in adapter provides shared directories and Git worktrees; shared release leaves files in place. Its optional capture method only reconciles older recorded capture intents; new assignments do not call it.

openHost({workspacePort}) can inject a WorkspacePort for environment setup and teardown. Pair it with a suitable BackendPort when execution also needs a container, VM or remote host. Runtime subscriptions provide observations; use the lifecycle methods for work that must finish before launch or release. There is no required checkout lock protocol for adapters.

Runtime.bindMessages(ref) supplies a worker-bound MessagePort independently of child delegation. Built-in hosts attach it to each backend; custom hosts can provide it through the backend's messages option. RuntimeApplicationPort performs journaled application outside command serialization. NotificationPort distinguishes stable notice transport from model consumption; Pi needs the complete notice in the outgoing provider payload and a retained parent branch to record consumption. onDiagnostic observes adapter/subscriber failures. New surfaces should use RuntimeSource and preserve cancellation, context and recovery through these ports.

Events and extension RPC

pinata.event.v1 distinguishes durable committed transitions, replay snapshot projections and transient activity. Revisions order history; ownerEpoch identifies ownership generations. Activity source and ordinal support deduplication. Activity gaps do not imply missing commits.

The Pi adapter emits pinata:ready, pinata:event and pinata:closed. It binds only after session startup establishes a run and authority, and detaches on shutdown or rebinding. Events cover tool calls, RPC and every delegation depth visible to that host. Durable events carry stable IDs, revision, transition, session/run identity, exact assignment references, parent assignment and depth where applicable. Batched acceptance emits one event per assignment. Activity text is bounded to 4,096 characters. Outcome and cleanup are separate observations; a settled result does not imply confirmed process cleanup.

Events are best effort. Queries and retained journals are authoritative. A late listener uses ping, then queries status, receipts or exact results. Listener failure cannot roll back acceptance or block worker cleanup. See the event observer and RPC caller.

Send requests on pinata:rpc:request; receive replies on pinata:rpc:reply. extensionChannels, extensionProtocolVersion, extensionRequestSchema, extensionReplySchema, extensionReadySchema and extensionEventSchema are available from pi-pinata/contracts. Generated pinata.extension-*.v1 schemas specify strict envelopes. Each request has protocolVersion: 1, correlation id and operation. All operations except discovery ping require sessionId and run from ready/ping. Unaddressed ping discovers all bound hosts; targeted requests are answered only by the matching binding.

Operation Input and semantics
ping Availability, capabilities, operations and schema names; optional target.
spawn Canonical create/add envelope in input.
stop, steer Canonical cancel or steer envelope in input.
execute Any authorized canonical command envelope.
wait Exact targets in input, including completed assignments.
query Canonical query in input, including receipt/result/events.
recover Canonical recovery request in input.
consume Exact notice id, ref and integration recipient label in input.
cancel_wait Correlation waitId; aborts that wait only.

Replies retain id, operation, sessionId, run and the standard reply success/error envelope. Concurrent reuse of a correlation ID is rejected. Durable input.requestId is independent: after losing a reply, query that receipt or retry the same command with the same request ID and a fresh correlation ID.

wait and query-waits accept optional timeoutMs (1 through 2,147,483,647). Timeout, cancel_wait and binding shutdown release the wait without cancelling workers. Shutdown stops accepting requests and drains accepted calls. A new binding requires a fresh target. Bus routing is cooperative and is not authentication or process isolation. Input cannot supply authority; the runtime checks its bound grants.

RPC spawn/execute default to notify: "none"; notify: "all" adds Pi completion watches. Reading a result does not acknowledge it. consume durably acknowledges responsibility for presenting one exact notice under an integration-supplied recipient label. It suppresses a still-pending delivery, preserves delivery already in flight and never records that the coordinator model consumed a result. Existing delivery and consumption evidence stays intact. Acknowledgment cannot retract a previously saved Pi message; automatic completion watches exclude acknowledged notices.

Process workers retain authenticated supervisor transport, including nested calls, lifecycle observations and coalesced activity. Reconnection replays the latest activity tail; durable writes remain the source for outcomes, usage and cleanup.

Usage is per assignment and attempt, with response identities for deduplication. Own usage is separate from descendant totals. Incomplete coverage leaves totals unknown and preserves observed partial usage. Accepted events expose frozen resolved model/backend/workspace/lifetime; model_observed reports the effective Pi session model and thinking level separately. Price estimates, invoices and context utilization are separate concepts.

Simplification migration

Job documents, pinata run, pinata serve, attached controller/viewer transport, remote CLI controls and active schedules have been removed. The root exports AttachedSource and startIpcServer, job/IPC schema families and scheduling tools are gone. Move {workers, config} from a job into a canonical create command with a durable request ID. Submit it through Pi tools, extension RPC or an embedded host. All schema families, including commands, envelopes and extension RPC, use v1. Stored manifest, journal and runtime event versions also use v1.

Replace attach with view; saved inspection no longer needs --saved. Replace CLI mutation commands with canonical commands on the owning runtime. Integrations own external timers and service transports. Herdr and worker supervision remain supported independently of these removals.

Historical schedule transitions remain readable through an inert compatibility reducer. They restore accepted assignments, receipts, artifacts and recovery evidence. Reopening a run never evaluates a calendar or generates occurrences. Unfinished accepted work still follows normal recovery and cleanup rules. Inspect legacy records with status/events queries; do not delete their journals.

Recovery

Start with pinata status RUN_DIRECTORY --json, then inspect exact assignments with pinata result RUN_DIRECTORY WORKER ASSIGNMENT and pinata conversation RUN_DIRECTORY WORKER ASSIGNMENT. These commands read saved data without an owning runtime. Inspect current worktree files with Git; use pinata changes for legacy snapshots. Shared files, worktrees and previously captured snapshots remain inspectable after failure or cancellation.

Large conversations use immutable chunks and flat manifests that share unchanged prefixes. Restoration preserves exact Pi JSONL bytes and branch identities. Native session files and old artifacts remain available. Fresh first pages validate the whole conversation; continuation pages verify the chunks they read, including after cache eviction. Engine state checkpoints remain optional projections: recovery verifies journal evidence and recomputes their prefix state before using them.

Situation Action
Lost integration connection Rediscover the Pi session/run through RPC ping, then query retained state.
Uncertain mutation reply Query original requestId, then retry the same payload/ID if appropriate.
Uncertain mentioned input Use displayed /pinata-retry in original session/run.
Host died Reconcile any retained run owner as described below, then resume the Pi session or use openHost({directory: RUN_DIRECTORY}).
Stopped work has context Submit canonical continue through pinata_run, RPC or the host; otherwise create a replacement with origin/context.
Interrupted application Query the operation and reconcile journal/owner first.
Rollback conflicts Preserve later edits and resolve explicitly.

On the owning runtime, use pinata_recover, RPC recover, or host.runtime.recover({targets}, host.caller) with exact assignment references. Recovery returns reattached, finalizing, active, unavailable or uncertain. It never automatically launches a replacement. Missing sessions remain explicit errors.

Checksum-verified mention envelopes sync to RUN_DIRECTORY/mention-inputs/ before dispatch, even if Pi never saved its first custom-only session. Direct Pi retry still requires the original session binding. If lost, inspect the retained envelope and use explicit canonical request recovery; do not infer a new action from text.

Owner claims have exact identities and epochs and never expire by age. Reconciliation needs current proof the selected owner is inactive. Live, remote or uncertain owners stay blocked for their matching host. Preserve before and after blobs, journals, worktrees and cleanup receipts. Deleting ownership files or resetting the checkout discards recovery evidence.

For an abandoned run claim, use the storage recovery API from a matching source checkout; it is not a package export or CLI command. Read the claim with readOwner(directory) and inspect its host, PID and token. Call reconcileStore({directory, expectedOwnerToken: owner.token, reason}) with that inspected identity and a reason describing the recovery. It checks owner liveness and retains evidence before releasing the claim. A torn journal tail requires explicit isolateTornTail: true after inspection. An interrupted reconciliation keeps its fence for manual inspection. Once reconciliation succeeds, reopen the run and inspect recovery results through the owning runtime.

Upgrading from checkout gates

Stop older Piñata runs before using this version in the same checkout. Finish any pending application or uncertain helper cleanup with the version that created it. A retained .pinata/checkout-gate/exclusive.json blocks new application until that recovery finishes. Completed application journals and legacy workspace records remain readable. Old writer records are ignored and left intact; new workers do not create them. The bind-checkout command has been removed.

The application lock retains an interrupted operation until explicit reconciliation. Unconfirmed application helper cleanup blocks further handoffs, while ordinary workers remain available. On Linux, an owner from a different recorded boot is inactive even if its PID has been reused; a live PID from the same boot stays blocked.

Trust boundaries

The host binds caller identity, workspace roots, tools and grants. Model requests, definitions, skills, memory and output are data validated within those bindings. They cannot replace their caller, select a root token or broaden authority.

Worktrees isolate patches. Shell tools and custom extensions execute with the host account's operating-system permissions. Use an external sandbox for untrusted code. Run claims and application locks coordinate cooperating processes; they do not stop other tools from editing files. Shared edits and worktree handoff are the coordinator's responsibility.

Durable recording, transport delivery, consumption, execution, worker assessments, reported checks, coordinator acceptance, application and oracle correctness remain distinct. Piñata imposes no automatic reviewer, mandatory ownership allocation, production token or time budget, or verification-dependent access to completed work.

Durability assumes local atomic create and link operations and file fsync. POSIX directory fsync is exercised; equivalent Windows directory durability, machine power loss and network filesystems are outside demonstrated coverage. Torn or corrupt records and ambiguous effects require explicit inspection and reconciliation.

Platforms

Platform Prerequisites/validation
Linux/macOS Node 22.19+. CI runs full offline tests, Pi/package smokes and advisory measurements on Node 22.19/24.
Windows x64/ARM64 Node 22.19+ and .NET Framework 4 C# compiler. Targeted CI covers portable contracts/storage, supervision, Pi process workers, package installation and native-host default workers.
Herdr Available local session; unavailable conditional cases are skips.

Development pins Pi SDK 1.5.0. CI exercises native Pi 1.1.0 compatibility and selects native Pi 1.5.0 for benchmarks. Native hosts and Node workers are separate environments. Native Pi launches workers through node on PATH; trusted hosts can select HostOptions.nodeCommand. A Node Pi host uses its current Node executable.

Windows builds packaged PinataJobLauncher.cs on first use, caching under %LOCALAPPDATA%\\Pinata\\job-launcher by source/compiler/architecture. A receipt verifies the executable; no runtime or helper is downloaded. A missing compiler or changed cache fails launch. Job membership is established during CreateProcessW with PROC_THREAD_ATTRIBUTE_JOB_LIST and restricted inherited handles. The job handle is not inherited; kill-on-close owns descendant lifetime.

Executable arguments and Unicode environments are preserved. .cmd/.bat disables delayed expansion and rejects special shell characters; use an executable for arbitrary ordinary argument data. Cleanup requires matching empty-and-closed job evidence and guardian termination. Lost acknowledgments stay unconfirmed. Saved PIDs, job names and taskkill are not cleanup authority. Job inheritance is not a permission sandbox.

Windows tests cover creation crashes, nested jobs, descendant-held pipes, arguments, cancellation, reconnect and host loss. Full workspace and application fault matrices and terminal navigation run on Linux/macOS. Test reports identify the actual host and worker runtimes; an executable label alone does not establish runtime coverage.

Architecture and implementation index

Every surface uses one Runtime, command authority and event model. Pure contracts and core rules stay independent of Pi and filesystem effects.

flowchart TD
  Pi[Pi tools and fleet UI] --> Source[RuntimeSource]
  CLI[Headless CLI] --> Source
  RPC[Pi extension event bus] --> Source
  Source --> Runtime[Runtime command authority]
  Runtime --> Core[Pure acceptance and lifecycle rules]
  Runtime --> Store[Journal, artifacts and owner claims]
  Runtime --> Backends[In-process, process and Herdr]
  Runtime --> Workspace[Workspace and application ports]
Loading

The journal records acceptance and effect intent before dispatch. Immutable artifacts sync before committed references. Checkpoints and projections speed reads while committed history stays authoritative. Long workspace and application operations stay outside command serialization. Recovery uses saved launch, session and cleanup evidence to reattach the original attempt or report uncertainty.

The source tree groups implementation by responsibility. Regression suites live in test/engine/ alongside scripted fixtures.

pinata/
|-- engine/
|   |-- contracts/       # Schemas, versions, events and public boundaries
|   |   `-- schemas.ts   # Named schema registry
|   |-- core/            # Pure acceptance, graph, readiness and lifecycle rules
|   |-- runtime/         # Command authority, execution and controls
|   |-- storage/         # Journal, replay, artifacts and owner claims
|   |-- definitions/     # Markdown and typed agent definitions, frozen loadouts
|   |-- host/            # Workspace, models, adapters and grants
|   |-- agent/           # Pi sessions, tools, reporting and guards
|   |-- backends/        # In-process, process and Herdr execution
|   |   `-- supervision/ # Process ownership, output and Windows Job Objects
|   |-- workspace/       # Worktrees, setup and legacy capture
|   |-- application/     # Journaled apply, rollback and reconciliation
|   |-- context/         # Instructions, filtering and restoration
|   |-- memory/          # Scoped memory and revision history
|   |-- pi/              # Extension tools, mentions, grants and notices
|   |-- sources/         # Live and saved runtime access, paging
|   |-- headless/        # CLI arguments, commands and output
|   |-- viewer/          # Standalone terminal viewer
|   `-- ui/              # Fleet, transcripts, palettes and drafts
|-- bin/pinata.mjs       # CLI launcher
|-- agents/              # Shipped agent definitions
|-- prompts/             # Coordinator and workflow prompts
|-- skills/              # Pi subagent skill
|-- examples/            # Fleet commands, recipes and integrations
|-- docs/reference/      # Generated schema and tool catalog
|-- test/engine/         # Contract, runtime and integration regressions
|-- bench/               # Scripted and loopback overhead measurements
|-- scripts/             # Catalog generation, checks and package releases
`-- .github/workflows/   # CI, npm publishing and package mirror

Development

Use Node 22.19+ and retain the lockfile. Pin direct development dependencies; Pi stays an optional host peer. Read STYLE.md and AGENTS.md before editing source.

The Node loader enables the compile cache when available and shares it with owned children. Set NODE_DISABLE_COMPILE_CACHE=1 to disable it, or NODE_COMPILE_CACHE to select its directory. Unavailable caches do not prevent execution.

npm ci --ignore-scripts
npm run check
npm test

check runs Oxfmt, Oxlint and TypeScript. Format changed files with npm exec -- oxfmt --write <paths>. The scripted test suite makes no paid model calls. It runs ordinary files with at most two concurrent files, then exhaustive apply and rollback fault matrices separately. Each matrix reports named fault cases with 30-second timeouts and allows 15 minutes for the complete file. A timed-out case reports its phase and last write boundary and aborts its fixture Git command. These limits supervise tests; production workers have no such deadlines.

Focused and integration checks:

node --test test/engine/rewrite-contracts.test.ts
node --test test/engine/rewrite-child-backends.test.ts
node test/engine/pi-smoke.ts
node test/engine/package-smoke.ts
node scripts/reference.ts --check
node scripts/public-api.ts --check

Pi smoke uses the public RPC host with a scripted provider. Package smoke packs the manifest, installs runtime dependencies in a scratch prefix, imports public APIs and loads the extension, skill and prompts through Pi. PINATA_PI selects an absolute executable. Test native Pi's default worker launcher with PINATA_PI=/path/to/native/pi node test/engine/native-backend-smoke.ts. PINATA_NATIVE_BACKEND_ALLOW_NODE=1 explicitly permits and labels a Node host instead.

Terminal captures and live integration

The offline terminal driver uses an isolated agent directory, rejects provider requests and retains PTY bytes, events and colored frame HTML:

python3 test/readiness/rewrite-ui-pty.py --root "$PWD" \
  --out bench/results/rewrite-ui-unique \
  --pi node "$PWD/node_modules/@earendil-works/pi-coding-agent/dist/cli.js"

It checks widths, palettes, streaming, navigation, drafts and disposal. F12 is test instrumentation. Render requests and actual terminal paint are separate measurements.

The Live Pinata/Pi contract workflow uses OPENAI_API_KEY on trusted PRs, master pushes and manual runs. Fork/Dependabot PRs skip it. It uses gpt-5.4-mini-2026-03-17, thinking off, at most 256 output tokens and 64 KiB of input per request. Two assignments permit at most 24 HTTP attempts total, with HTTP retries disabled. It checks read-only grants, typed reporting, continuation, usage, cleanup and saved replay. Failed attempts retain request and usage evidence too; credential directories stay outside uploads.

With token-spend authorization and the key already set, run node test/engine/live-openai-smoke.ts. Ordinary tests use a fake transport.

Writing and Vale

This README is the maintained guide and reference. Tools consume the separate JSON catalog. Agent definitions, prompts, skills, repository instructions and executable example fixtures remain separate functional inputs. The checked-in code, contracts, tests and evaluation harness define the release behavior.

npm run docs:setup
npm run docs:lint:changed
npm run docs:lint:agents -- --changed

Setup installs checksum-verified Vale 3.26.0, Google 0.7.1 and ai-tells 1.37.0 in ignored .vale/ directories. It supports x64/ARM64 on Linux/macOS/Windows and uses system tar. Ordinary scans need no network/model calls.

docs:lint checks reader prose; the agents profile checks spelling, repetition and terminology in operational inputs. --changed covers staged/unstaged/untracked prose against HEAD. Include branch commits with npm run docs:lint:changed -- --base origin/master. node scripts/vale.mjs --json emits JSON; CI retains both profile reports.

All v1 findings are advisory; missing tools, invalid configuration and execution errors fail. Inspect output and fix useful findings. Preserve technical qualifications when a suggestion changes meaning. Review claims against code and use a humanizer pass to remove filler, inflated claims and repetitive phrasing while preserving commands, grants, recovery steps and evidence limits. .vale.ini selects rules; local terminology/vocabulary live under .vale/styles/. Use inline code for identifiers.

Performance

Scripted and HTTP loopback benchmarks measure coordination, storage, sessions and cleanup. Coding quality is evaluated separately.

npm run bench
npm run bench:loopback
npm run bench:process -- --repeat 5 --scenario fanout-1 --scenario fanout-8
PINATA_PI=/path/to/pi npm run bench -- --host tui --scenario ux-8
node --expose-gc bench/viewer.ts --repeat 3
node bench/fleet-navigation.ts

The navigation probe times arrow-key input through the render request and composed viewport with 8 running workers, 8 queued workers, and 1 or 1,024 older assignments.

Workloads cover fan-out at 1/8/32/64 workers, dependencies, mixed work and streaming. Scale probes are scale-queue-1000, scale-fanin-256, scale-batches-8; select with --scenario. --sweep --workers 1,8 --histories 1,128 controls retained history. Independent axes: --mode lean|observe, --viewer attached|detached, --workspace shared|worktree, --backend in-process|process|herdr-pi, --lifetime attached|surviving.

Measurement gates and interpretation

bench/budgets.json retains accepted named profiles and the 2× CI tolerance. On controlled hardware, enforce them with:

PINATA_PI=/path/to/pi node scripts/bench-ci.mjs engine --expose-gc bench/run.ts --ci --host pi

Shared-runner CI gates execution, accounting and cleanup and reports timing as advisory. The wrapper uses os.tmpdir() unless PINATA_BENCH_ROOT selects a root. CI uses /dev/shm on Linux and runner temporary storage on macOS. It retains complete successes/failures under bench/results/ with original-path mapping and filesystem identity. Direct bench/run.ts measures beside --out; --ci does not select a medium. Comparisons require matching storage provenance and named profiles.

A complete in-process over-budget attempt may retry twice; all attempts remain. Missing measurements, incomplete usage, failed execution or unconfirmed cleanup fail immediately. Process and Herdr timing is advisory without matching baselines. Unavailable backends stay unavailable. Mac/APFS profile selection needs observed filesystem and device proof; Linux limits remain unchanged.

Startup covers committed preparation through the first ordinary workload provider request. Setup, acceptance, command-to-request and dependency dispatch use different boundaries. Compaction requests retain separate identities; full elapsed time, CPU and usage includes compaction. RSS samples are lower bounds with host and child coverage labeled. Collected heap can grow with history; descriptor counts do not establish timer coverage.

The UI target is p95 event/key-to-render-request at most 100 ms with eight scripted workers. Terminal paint is measured separately. Resource probes require stable owned counts and confirmed runtime and supervisor cleanup. The HTTP fixture observes closure of its own idle connections before sampling.

Retain raw cells and incomplete and failed attempts at unique paths. The wrapper forwards interrupts and waits to retain files; SIGKILL cannot run the final copy, so synced command status identifies the original directory. Match source, lockfile, scripts, tools, runtime, hardware, storage and launcher. Compare measurements only when their boundaries and coverage match. No Windows latency baseline is accepted.

Before attributing a runtime performance improvement, matched profiles must show coordination overhead accounts for at least 10% of the affected path. Smaller changes remain local improvements. Retain source closures, raw attempts and the exact measurement profile with each result.

Publication

The npm package is pi-pinata, published by funsaized under MIT. Zod are pinned runtime dependencies; Pi SDK packages are optional host peers. Releases require authorization for the target commit and version, pushes, tags and publication. Inspect registry state before choosing a version and keep credentials out of logs.

On an authorized release branch:

RELEASE_VERSION="<version>"
npm version "$RELEASE_VERSION" --no-git-tag-version
npm run check
npm test
node test/engine/pi-smoke.ts
node test/engine/package-smoke.ts
npm pack --dry-run --json --ignore-scripts

Inspect packed metadata, README/LICENSE, engine/public APIs, the subagents skill, five prompts, three presets, examples and the JSON catalog. Exclude run state, logs, tests, credentials and development dependencies. Record checks in the PR. After review and green CI, merge and tag that exact commit:

git fetch origin
git push origin "origin/master:refs/tags/v${RELEASE_VERSION}"
Registry verification, retries and GitHub mirror

The release workflow checks tests and style, tag, lockfile, package identity and packed paths, then publishes the exact tarball with provenance through NPM_TOKEN. Stable tags use npm latest; vX.Y.Z-next.N uses next and a GitHub prerelease. The token must belong to funsaized and permit pi-pinata. CI checks integrity before mirroring, then creates the GitHub release after both registries succeed.

Check npm view pi-pinata name version maintainers --json; for manual publication, npm whoami must identify funsaized. Do not read credential files. Stop if another project or account owns the package. Registry absence does not reserve a name. Publish the inspected tarball with npm publish "./pi-pinata-${RELEASE_VERSION}.tgz" --access public using current authentication/MFA.

Verify registry version/integrity/repository/maintainers, download a fresh tarball, compare paths and content, install in a scratch prefix and load it through an isolated Pi agent directory. Exercise pinata help and retain the tested install evidence.

Inspect failed or uncertain publication before retrying. Existing npm versions must match integrity. Retry an existing tag with gh workflow run release.yml --ref master -f tag="v${RELEASE_VERSION}". Never move published tags or overwrite package versions. Corrective releases, deprecation, unpublishing and dist-tag changes need their own authorization.

The mirror workflow downloads npm artifacts and changes only package name/manifest formatting to @funsaized/pi-pinata. It verifies contents, executable bits and other metadata before/after publication with GITHUB_TOKEN package-write access. It neither rebuilds nor publishes to npm. Repeats verify existing artifacts.

The release calls it immediately; the daily 07:23 UTC job mirrors npm's current latest. Backfill with gh workflow run sync-github-package.yml --ref master -f version="$RELEASE_VERSION". Only npm's current latest gets GitHub's latest; older/prerelease backfills use mirror. Existing tags stay unchanged. Mismatches need investigation, not deletion/recreation. Future upstream publishConfig stops for review.

GitHub registry installs need authentication even for public packages. Enter a classic token with read:packages only at the password prompt:

npm login --scope=@funsaized --auth-type=legacy --registry=https://npm.pkg.github.com
pi install npm:@funsaized/pi-pinata

Most users can install from npm. Remove the old source before switching because both copies register identical skills and prompts. New GitHub packages are private by default; visibility changes are separate, and public visibility is permanent. Authentication failures or 404s can mean repository/package access problems, not permission to delete an existing version.

License

MIT.

About

Define project subagents in Markdown, delegate work in Pi, and follow each branch from assignment to result.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages