workflows

package
v0.16.397 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package workflows reads the dynamic workflows of a Claude Code conversation: a script the agent hands to its Workflow tool, which runs in the background and starts many subagents phase by phase. Claude Code keeps a run beside the conversation's own transcript:

<session>/workflows/scripts/<name>-<run>.js         the script; its `meta` names the workflow and its phases
<session>/subagents/workflows/<run>/journal.jsonl   one line per agent started, returned or failed
<session>/subagents/workflows/<run>/agent-<id>.jsonl and agent-<id>.meta.json, the agent's own transcript
<session>/workflows/<run>.json                      the run's final state, written once it is over

The journal is read as it grows; the agents' files are read when they change.

Index

Constants

View Source
const (
	Running = "running"
	Done    = "done"
	Failed  = "failed"
	Stopped = "stopped"
)

States of a workflow's agent.

Variables

This section is empty.

Functions

func Files

func Files(transcript, runID string) (dir, state, scripts string)

Files are where a conversation keeps a run: its folder of agents, its final state and its scripts.

Types

type Agent

type Agent struct {
	ID        string
	Label     string
	Phase     string // the title of the phase it was started in
	Model     string
	State     string
	StartedAt float64
	EndedAt   float64
	Last      string // its last step, one line
	Result    string // the first words of what it returned
}

Agent is one agent a workflow started. Times are epoch milliseconds, 0 when unknown.

type Launch

type Launch struct {
	TaskID, RunID, Summary string
}

Launch is what the Workflow tool's result says of the run it started.

func ParseLaunch

func ParseLaunch(text string) (l Launch, ok bool)

ParseLaunch reads a Workflow tool result; ok is false when it started no run in the background.

type Meta

type Meta struct {
	Name, Description string
	Phases            []string
}

Meta is what a script's `export const meta = {...}` says.

func ParseMeta

func ParseMeta(script string) Meta

ParseMeta reads the meta of a workflow script; what it does not say is empty.

type Phase

type Phase struct {
	Title  string
	Agents []Agent
}

Phase is a stage of the workflow, as its script names it, with the agents started in it so far.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader keeps one cursor per run.

func (*Reader) Forget

func (r *Reader) Forget(transcript string)

Forget drops what is kept of a conversation's runs.

func (*Reader) Read

func (r *Reader) Read(transcript, runID string) (View, bool)

Read is the run of a conversation as its files are now; ok is false when the conversation has no such run.

type View

type View struct {
	Name        string
	Description string
	// Status is the final state's ("completed", "failed", "killed"), "" while the run has written none.
	Status    string
	StartedAt float64
	EndedAt   float64
	Phases    []Phase
}

View is a run as its files tell it.

func (View) Over

func (v View) Over() bool

Over says whether the run's final state was written.

func (View) Settle

func (v View) Settle(status string) View

Settle is the view of a run that ended with status: the agents it left at work were stopped with it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL