Psi can delegate reusable tasks to named workflows.
A workflow is a named prompt or orchestration loaded from .psi/workflows/*.md
by the psi/workflow-loader extension. Some workflows are single focused agents;
others are multi-step flows that pass results from one step to the next.
This document covers the user-facing workflow surface: how to enable workflows, list them, run them, reload them during development, and understand the basic shape of workflow definitions.
Workflows are provided by the psi/workflow-loader extension.
Project-local example:
{:deps {psi/workflow-loader {}
psi/mementum {}}}
Put that in one of the supported extension manifest locations, then start psi.
For manifest details and install options, see doc/extensions-install.md.
Workflow definitions are discovered from:
.psi/workflows/*.md
This repository includes many examples there, including:
plan-build-reviewplannerbuilderreviewergh-bug-triagegh-issue-ingestgh-pr-heal-check-loopWhen psi/workflow-loader is active, psi exposes:
/delegate <workflow> <prompt>/delegate-reloadTypical usage:
/delegate planner analyze the scope of the current refactor
/delegate plan-build-review add user-facing workflow docs
/delegate gh-bug-triage
/delegate gh-bug-triage issue 123
What happens:
If you want a workflow to continue from a narrow request, put that request after the workflow name as the prompt text.
The workflow system also has a delegate tool with a list action. In normal
interactive use, the simplest path is usually to:
.psi/workflows/ directory.psi/prompts/ for example invocations/delegate <workflow> <prompt> directly when you already know the nameFor extension/runtime-oriented details on the delegate tool surface, see
doc/extensions.md.
When editing .psi/workflows/*.md, reload them without restarting psi:
/delegate-reload
Reloading:
Use this during workflow authoring or prompt iteration.
Use /delegate when you know the workflow name.
Examples:
/delegate reviewer review the current branch changes
/delegate lambda-build derive a concise lambda from this prompt
This repository also contains prompt examples under .psi/prompts/ such as:
.psi/prompts/gh-bug-triage.md.psi/prompts/gh-issue-ingest.mdThese document phrases like:
Run workflow gh-bug-triageRun workflow gh-bug-triage for issue 123Run workflow gh-issue-ingestUse those as operator examples and as reusable prompt patterns.
A single-step workflow is a named focused agent profile. For example, a workflow can describe tools, skills, and instructions for one bounded job.
Example shape:
---
name: gh-bug-triage
description: Find labeled GitHub bug-triage issues...
---
{:tools ["read" "bash" "edit" "write" "work-on"]
:skills ["issue-bug-triage"]
:thinking-level :high}
You are executing a focused GitHub bug-triage workflow in this repository.
This kind of workflow behaves like a reusable specialist session configuration.
A multi-step workflow orchestrates several named workflows in sequence.
Example shape:
---
name: plan-build-review
description: Plan, build, and review code changes
---
{:steps [{:name "plan"
:workflow "planner"
:session {:input {:from :workflow-input}
:reference {:from :workflow-original}}
:prompt "$INPUT"}
{:name "build"
:workflow "builder"
:session {:input {:from {:step "plan" :kind :accepted-result}}
:reference {:from :workflow-original}}
:prompt "Execute this plan:\n\n$INPUT\n\nOriginal request: $ORIGINAL"}]}
This kind of workflow passes outputs from earlier steps into later ones.
In multi-step workflows, child sessions use explicit :session data flow.
The most important pieces are:
:session :input — what becomes $INPUT:session :reference — what becomes $ORIGINAL:session :preload — extra context loaded into the child session without
changing $INPUT or $ORIGINALInterpretation:
$INPUT is the immediate task for the current step$ORIGINAL is the original workflow request/reference context:preload is supporting contextWhen a step references a previous step, it uses that step's author-facing name, for example:
{:step "plan" :kind :accepted-result}
Prefer:
name and description:session wiring in multi-step workflowsGood first workflow authoring loop:
.psi/workflows/<name>.md/delegate-reload/delegate <name> <prompt>doc/extensions-install.md — enable psi/workflow-loaderdoc/extensions.md — extension/tool details for workflow-loaderdoc/tui.md — general in-session command usageREADME.md — top-level project overviewCan you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |