← Catalog

@agimon-ai/po-workflow

GitHub Actions-style workflow graphs, artifacts, recovery, and asynchronous runs for Po.

Extension

Install

Install with PiG

pig install npm:@agimon-ai/po-workflow

Install with Pi

pi install npm:@agimon-ai/po-workflow
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

README

Written by the package's publisher, shown as published in version 0.0.0-alpha.197 (README.md). PiG does not review it.

@agimon-ai/po-workflow

Discover, launch, monitor, control, and recover asynchronous Po workflows.

Part of the Po distribution.

This package owns the workflow engine. Runs execute inside the Po host; there is no standalone CLI. Workflow files describe job dependencies and host-executed steps, while Po provides session-scoped tools.

Alpha: workflow and recovery contracts may change between releases.

Requirements

  • Node.js 24 or newer

Install

The seeded presets.yaml selects the workflow layer in minimal, copilot and examples. Remove it from a preset to omit Workflow there. No mode activation is required.

Define a workflow

Create a *.workflow.yml file:

name: verify

jobs:
  test:
    steps:
      - name: Run tests
        run: pnpm test

  lint:
    needs: test
    steps:
      - name: Lint
        run: pnpm lint

run commands execute on the host with the workflow process's environment and privileges. There is no VM, container, or sandbox. Review workflow files as executable code. Runner-specific interactiveRun mappings are available for commands that require a TTY.

A step can also declare runConfig (preset, modes, profile, domains, model, thinking) and customRun (a prompt). Launched from the Po server, a customRun step runs as a child session of the launching session with those settings, until the agent has recorded what the step needs, and run and interactiveRun steps each get their own RMUX pane. Each run keeps its engine log in engine.log in its run directory. See automation for the user workflow and the maintenance guide for authoring details.

Job-specific tools

Managed Po agent steps can receive a workflow-owned jobTools code-mode namespace and a pinned workflow-job-tools skill. Select a folder at workflow level as a default, or override it per job:

name: summarize
runConfig:
  preset: copilot
tools: ./tools/shared
jobs:
  report:
    tools: ./tools/report
    steps:
      - name: Summarize
        customRun: Read workflow-job-tools, discover jobTools, then summarize this job.

The folder must contain JavaScript index.mjs and a non-empty SKILL.md. Paths are resolved relative to the YAML that declares them, before imports and job-template inheritance. Empty paths, control characters and URL specifiers are rejected. Parsing, listing and inspection never execute the module. A job's main steps, preJob and postJob use its selection or the workflow default. repair.tools overrides the default for repair triage. Global phases use the workflow default.

Only trusted, managed Po customRun and in-process interactiveRun agent sessions receive these tools, not shell steps, ordinary sessions, or external Claude/Codex CLI runners. Each session uses its captured workflow config. Global pre can run before the worktree YAML is reparsed, so its tools are not necessarily selected from that worktree. Step cwd, WORKTREE_PATH and environment variables do not select or resolve the tools folder.

index.mjs default-exports a factory, called once per managed session with:

  • sessionId and the admitted working directory cwd.
  • workflow: the trusted PoWorkflowContextService, including the captured config, job/step identity, admitted jobEnvironment and stepEnvironment, and workflow state reader.
  • Injected fs and shell capabilities. Their methods take a call context as the last argument.
  • signal: the session tools lifetime, aborted on session disposal or mounting failure.
  • context: a call context for fs and shell, aborted with signal. Inside bind(run), pass run.context instead, which also aborts when that exec ends.

Return the existing PoCodemodeNamespace contract: name jobTools, a non-empty one-line summary (maximum 600 characters), TypeScript declarations for discovery, and bind(run). Bind returns flat named async methods with JSON arguments and results. Each exec gets a fresh binding; keep per-session state inside the factory, not at module scope. Validate method inputs and honour run.signal in long operations. Use run.onDispose for exec-owned cleanup. The host refuses foreign sessions and calls after cancellation/disposal, and detaches JSON values in both directions. Return null, not undefined, for no output.

Agents read the selected folder's pinned skill, discover jobTools, then call its typed methods through exec. Keep usage judgment in SKILL.md and signatures in declarations; the maintenance guide covers authoring. Optional approval policies must name returned methods and use the existing approval path, never bypass it.

Tools are trusted workflow code running with the host's privileges, not sandboxed code. Review the folder before launching. Native import caches modules by file URL; editing index.mjs at the same path requires a host restart. There is no direct TypeScript loading, hot reload, or external CLI bridge. A missing file or invalid factory fails the managed step session rather than silently omitting its selected tools. The namespace and skill mount and dispose together; disposing them does not stop the owning workflow or change its recovery rules.

Step instructions

A workflow can give its managed Po agent steps their own instructions file:

instructions: ./AGENTS.md

The file replaces the AGENTS.md files the step session would discover from its working directory; it does not add to them. The path resolves relative to the declaring YAML and is inherited through imports as a default, like tools. A missing or unreadable file fails the step session rather than running it without instructions. Shell steps and external Claude/Codex CLI runners ignore it.

Explicit role allocation

For a workflow declaring identity.roles, first call workflow.requirements({ workflowPath }), then launch with an exact assignments map from every required role to a stable profile reference. Roles used together by one job, reachable child or repair triage must select the same reference. Saved teams, a launch profile, environment variables and workflow inputs never fill missing assignments.

The slash equivalent is /workflow-launch <workflow> assign.writer=<stable-ref>. Public tools and code mode accept assignments only, never provider bindings or an allocation snapshot. The launch freezes the effective definition and provider evidence; retries, child execution, reload, resume and recovery revalidate that evidence without reallocating. Legacy role-bound runs without a snapshot must be launched fresh or repaired through the existing approved revision-checked repair path.

Allocated agent steps require managed in-process execution and a compatible po-profile admission capability. Help and external agent execution are refused. Roleless phases in an allocated graph run with no profile. Allocations never grant product authority; the provider derives scope from trusted host configuration.

Launch and monitor

Core tools are:

  • list_workflows: discover workflows.
  • launch_workflow: register and start an asynchronous run.
  • workflow_run: inspect or control a run through supported actions.
  • workflow_tools (server/web sessions): read failed-run recovery evidence or resume the existing run.

Launch returns after the run is registered, not after all jobs complete. Use status for progress and wait for a completion notification.

Dynamic workflows

The package also supplies the dynamicWorkflow code-mode namespace: tracked Mastra workflows composed with then, parallel, branch and bounded foreach, with live team.run transcripts. It is available when the workflow layer is selected, with no mode gate. Inside a YAML run, a customRun step's agent can use it for fan-out whose shape is only known at run time, and the run view shows those runs under that step. See the code-mode guide. Tracker state is in memory per session; it is not persisted with the run record.

Existing default-package entries still work and deduplicate with the layer. No configuration migration runs, and persisted modes: [workflow] has no effect.

Storage, concurrency, and lifecycle

Registry data defaults to $HOME/.workflow-mcp; set WORKFLOW_MCP_HOME to relocate it. Persisted records contain workflow and run identity, job and step state, ownership, output locations, and recovery evidence. The default concurrency ceiling is five runs.

When Team is loaded, Workflow contributes active session runs through Team's po/background-work service. That contribution reconnects after Team is replaced and is removed when Workflow unloads. Reconciliation distinguishes stale registry records from live runs; do not assume every run outlives its parent session.

Each workflow or repair step can launch commands and model-backed agents, consuming provider quota and repeating external side effects.

Recovery

Recovery is available only for records in a terminal failure state. A recovery claim atomically adopts the eligible failure, validates the evidence, and transfers ownership to the replay session. Live controls remain scoped to the owning session. Recovery does not launch a second copy beside a still-running job and does not guarantee that parent-session work survives shutdown.

The package ships two skills: pinned, ungated codemode-how-to-workflow for workflow code-mode namespaces and selected job tools, and unpinned, Help-gated help-how-to-workflow for authoring and maintenance. A selected tools folder also supplies the managed session's pinned workflow-job-tools skill.

Workflow sessions

In a server (web cockpit) session, a launch does not run in the session that asked for it. The session creates a child workflow session (provenance workflow-session), nested under it in the rail, and hands it the launch. The workflow session owns the run (PO_SESSION_ID), runs its step sessions, so its agent can troubleshoot and recover the run without a workflow mode. The run's environment also carries PO_WORKFLOW_LAUNCHER_SESSION_ID, naming the launching session, which lists the run in its Activity group, is told when it ends, and may read its status.

  • Pass sessionName to launch_workflow, workflow.launch, or the po/workflow-launch service's overrides to name the new workflow session. It defaults to the workflow's name, then its filename. name still names the run context directory; existing owner sessions are not renamed.
  • The workflow session's rail row shows the run (workflow · build › test · 4m, or a failure or pause marked like a pending question) through the host's per-session activity line.
  • Success is posted without starting a turn. Failure wakes the workflow owner for local diagnosis; the launcher receives a notification only. The owner gets a live brief on every turn.
  • After a success, a workflow session nobody interacted with asks its launcher to release it, and it becomes stopped · open to wake. A session whose run failed or paused, or whose agent you prompted, stays live until you remove it. Removing or restarting a live workflow session stops its run.
  • Recovery is refused from any session other than the owner while the owner is live.

Native execution contract

Agent steps require an effective runConfig.preset; delegated workflows require top-level runConfig.preset before their owner child is created. Selection projects preset, modes, profile and domains unchanged. subagentModel and subagentThinking set Team preferences independently of the step model.

The native host requires execution-state inspection before creating agent steps. After settlement it waits for idle, no pending messages and a known background snapshot without core holds or holding-provider errors before checking decisions. Unknown ownership waits closed without consuming reminders; stops interrupt reads and retry delays. Running commands stop holding an inline step after five idle minutes, but its decision gate still runs before session release.

A delegated success is informational in the workflow owner and wakes the launcher to continue its applicable playbook. Errors wake the owner through durable custom-message admission; the launcher receives an error notification, not a competing recovery turn. The owner checks evidence and repairs within its authority. A parked run waits for the person's approval decision. User-requested stops do not trigger diagnosis or automatic restart.

Development

pnpm exec nx run-many -t lint typecheck build test -p @agimon-ai/po-workflow

Upgrading from the CLI releases

The workflow-mcp and po-workflow-mcp commands, launch-command and run-local launchers were removed. A workflow that still declares launch-command or launcher is rejected; delete the key. Storage paths and registry records are unchanged. Let runs started by a CLI release finish on that release before upgrading, and remove any .po/hooks.yaml entry that points at the old CLI path.

License

Functional Source License 1.1, MIT Future License (FSL-1.1-MIT): free for any purpose except a Competing Use; each version converts to MIT two years after release. See LICENSE.