Skip to main content
All usage examples from the package, aggregated for quick reference.

isProjectInitialized()

Check if a CLEO project is initialized at the given root. Checks for tasks.db. View in API reference

getCleoHome()

Get the global CLEO home directory. Respects CLEO_HOME env var; otherwise uses the OS-appropriate data path via env-paths (XDG_DATA_HOME on Linux, Library/Application Support on macOS, %LOCALAPPDATA% on Windows). View in API reference

getCleoTemplatesDir()

Get the global CLEO templates directory. View in API reference

getCleoSchemasDir()

Get the global CLEO schemas directory. View in API reference

getCleoDocsDir()

Get the global CLEO docs directory. View in API reference

getCleoDir()

Get the project CLEO data directory (relative). Respects CLEO_DIR env var, defaults to “.cleo”. View in API reference

getCleoDirAbsolute()

Get the absolute path to the project CLEO directory. View in API reference

getProjectRoot()

Get the project root from the CLEO directory. Respects CLEO_ROOT env var, then derives from CLEO_DIR. If CLEO_DIR is “.cleo”, the project root is its parent. View in API reference

resolveProjectPath()

Resolve a project-relative path to an absolute path. View in API reference

getTaskPath()

Get the path to the project’s tasks.db file (SQLite database). View in API reference

getConfigPath()

Get the path to the project’s config.json file. View in API reference

getSessionsPath()

Get the path to the project’s sessions.json file. View in API reference

getArchivePath()

Get the path to the project’s archive file. View in API reference

getLogPath()

Get the path to the project’s log file. Canonical structured runtime log path (pino). View in API reference

getBackupDir()

Get the backup directory for operational backups. View in API reference

getGlobalConfigPath()

Get the global config file path. View in API reference

getCleoGlobalRecipesDir()

Get the Global Justfile Hub directory. The hub stores cross-project recipe libraries agents can run in ANY project (cleo-bootstrap, rcasd-init, schema-validate, lint-standard). Both humans (via editor) and the meta Cleo Chef Agent write recipes here. View in API reference

getCleoGlobalJustfilePath()

Get the absolute path to the primary global justfile. View in API reference

getCleoPiExtensionsDir()

Get the Global Pi Extensions Hub directory. Houses the Pi extensions that drive the CleoOS UI and tools: orchestrator.ts (Conductor Loop), project-manager.ts (TUI dashboard), tilldone.ts (work visualization), cant-bridge.ts (CANT runtime), stage-guide.ts (before_agent_start hook). View in API reference

getCleoCantWorkflowsDir()

Get the Global CANT Workflows Hub directory. Stores compiled and parsed .cant workflows that agents can invoke globally across projects. Project-local agents still live in .cleo/agents/. View in API reference

getCleoGlobalAgentsDir()

Get the Global CLEO Agents directory. Holds globally-available CANT agent definitions (.cant files). Project-local agents still live in {projectRoot}/.cleo/agents/. View in API reference

getAgentOutputsDir()

Get the agent outputs directory (relative path) from config or default. Config lookup priority: 1. config.agentOutputs.directory 2. config.research.outputDir (deprecated) 3. config.directories.agentOutputs (deprecated) 4. Default: ‘.cleo/agent-outputs’ View in API reference

getAgentOutputsAbsolute()

Get the absolute path to the agent outputs directory. View in API reference

getManifestPath()

Get the absolute path to the legacy agent-outputs flat-file (deprecated per ADR-027). Checks config.agentOutputs.manifestFile for custom filename. View in API reference

getManifestArchivePath()

Get the absolute path to the MANIFEST.archive.jsonl file. View in API reference

isAbsolutePath()

Check if a path is absolute (POSIX or Windows). View in API reference

getCleoLogDir()

Get the OS log directory for CLEO global logs. Linux: ~/.local/state/cleo | macOS: ~/Library/Logs/cleo | Windows: %LOCALAPPDATA%cleoLog View in API reference

getCleoCacheDir()

Get the OS cache directory for CLEO. Linux: ~/.cache/cleo | macOS: ~/Library/Caches/cleo | Windows: %LOCALAPPDATA%cleoCache View in API reference

getCleoTempDir()

Get the OS temp directory for CLEO ephemeral files. View in API reference

getCleoConfigDir()

Get the OS config directory for CLEO. Linux: ~/.config/cleo | macOS: ~/Library/Preferences/cleo | Windows: %APPDATA%cleoConfig View in API reference

getCleoTemplatesTildePath()

Get the CLEO templates directory as a tilde-prefixed path for use in @ references (AGENTS.md, CLAUDE.md, etc.). Cross-platform: replaces the user’s home directory with ~ so the reference works when loaded by LLM providers that resolve ~ at runtime. Linux: ~/.local/share/cleo/templates macOS: ~/Library/Application Support/cleo/templates Windows: ~/AppData/Local/cleo/Data/templates (approximate) View in API reference

getAgentsHome()

Get the global agents hub directory. Respects AGENTS_HOME env var, defaults to ~/.agents. View in API reference

getClaudeAgentsDir()

Get the Claude Code agents directory (~/.claude/agents by default). View in API reference

getClaudeMemDbPath()

Get the claude-mem SQLite database path. View in API reference

cleanupBrainRefsOnTaskDelete()

Clean up brain.db references after a task is deleted from tasks.db. Handles: - XFKB-001/002: Nullify brain_decisions.context_epic_id / context_task_id - XFKB-003: Delete brain_memory_links rows where task_id matches - XFKB-005: Delete brain_page_nodes with id=‘task:’ and cascade brain_page_edges This is a best-effort cleanup — brain.db is a cognitive store and minor staleness is preferable to failing task deletions due to brain.db errors. View in API reference

cleanupBrainRefsOnSessionDelete()

Clean up brain.db references after a session is deleted from tasks.db. Handles: - XFKB-004: Nullify brain_observations.source_session_id where it matches View in API reference

taskExistsInTasksDb()

Verify a task ID exists in tasks.db before writing a cross-DB reference to brain.db. Returns true if the task exists, false otherwise. Provides write-guard for XFKB-001/002/003 on brain.db insert. View in API reference

buildStageGuidance()

Build structured stage guidance for a given pipeline stage. Resolves the primary skill for the stage from STAGE_SKILL_MAP, composes a prompt from the real SKILL.md files via prepareSpawnMulti(), and returns a StageGuidance object suitable for Pi extension injection or direct CLI rendering. If the skills cannot be resolved, returns a fallback prompt built from STAGE_DEFINITIONS metadata only — no hand-authored protocol text. View in API reference

formatStageGuidance()

Format stage guidance as a Markdown-wrapped system prompt. Since buildStageGuidance() now returns the already-composed prompt in .prompt, this helper simply passes it through with a header banner identifying which skills are loaded and which stage is active. View in API reference

PopulateEmbeddingsOptions

Options for the embedding backfill pipeline. View in API reference

initializePipeline()

Initialize a new pipeline for a task. Creates a new pipeline record in the database with all 9 stages initialized to ‘not_started’ status. The pipeline starts at the research stage by default. View in API reference

getPipeline()

Retrieve a pipeline by task ID. Returns the complete pipeline state including current stage and status. Returns null if no pipeline exists for the given task ID. View in API reference

advanceStage()

Advance a pipeline to the next stage. Performs atomic stage transition with prerequisite checking and audit logging. Validates the transition is allowed, updates stage statuses, and records the transition in the audit trail. View in API reference

getCurrentStage()

Get the current stage of a pipeline. Convenience method to quickly check which stage a task is currently in. View in API reference

listPipelines()

List pipelines with optional filtering. View in API reference

isValidPipelineStage()

Check whether a string is a valid pipeline stage name. View in API reference

validatePipelineStage()

Validate a pipeline stage name and throw a CleoError on failure. View in API reference

resolveDefaultPipelineStage()

Determine the default pipeline stage for a new task. Rules (in priority order): 1. If an explicit stage is provided and valid, use it. 2. If the task has a parent, inherit the parent’s pipelineStage. 3. If the task type is ‘epic’, default to ‘research’. 4. Otherwise default to ‘implementation’. View in API reference

getPipelineStageOrder()

Get the numeric order of a pipeline stage (1-based). View in API reference

isPipelineTransitionForward()

Check whether transitioning from currentStage to newStage is forward-only. “Forward” means the new stage’s order is greater than or equal to the current stage’s order (same stage is a no-op and is considered valid). View in API reference

validatePipelineTransition()

Validate a pipeline stage transition and throw if it would move backward. View in API reference

getLifecycleMode()

Read lifecycle.mode from config. Falls back to “strict” when unset (matches the DEFAULTS in config.ts). View in API reference

validateEpicCreation()

Validate that a new epic satisfies creation requirements. In strict mode: - At least EPIC_MIN_AC acceptance criteria must be provided. - description must be non-empty (treated as completion criteria). In advisory mode the same checks are run but violations do not block — they are returned as warning text for the caller to surface. In off mode this function is a no-op. View in API reference

validateChildStageCeiling()

Validate that a child task’s pipeline stage does not exceed its epic’s stage. Call this when: - A child task is created under an epic parent. - A child task’s pipelineStage is updated and it has an epic ancestor. The check walks the task’s ancestor chain to find the nearest epic ancestor. If none exists, the check is skipped. View in API reference

findEpicAncestor()

Find the nearest epic ancestor for a given task. Walks the ancestor chain (root-first) and returns the first task whose type is “epic”, or null if no epic ancestor exists. View in API reference

validateEpicStageAdvancement()

Validate that an epic can advance its pipeline stage. An epic is blocked from advancing to a later stage when it has at least one child that: - Has a pipeline stage equal to the epic’s current stage, AND - Has a status that is not “done” (i.e., is still in-flight). Rationale: the epic stage represents the stage the team is actively working in. Moving the epic forward while children are unfinished at the current stage violates the pipeline discipline. View in API reference

fileExists()

Check if a file exists and is readable. View in API reference

stripCLEOBlocks()

Strip legacy CLEO:START/CLEO:END blocks from a file. Called before CAAMP injection to prevent competing blocks. View in API reference

removeCleoFromRootGitignore()

Remove .cleo/ or .cleo entries from the project root .gitignore. View in API reference

getPackageRoot()

Resolve the package root directory (where schemas/ and templates/ live). scaffold.ts lives in packages/core/src/, so 1 level up reaches the package root. View in API reference

getGitignoreContent()

Load the gitignore template from the package’s templates/ directory. Falls back to embedded content if file not found. View in API reference

getCleoVersion()

Read CLEO version from package.json. View in API reference

createDefaultConfig()

Create default config.json content. View in API reference

ensureCleoStructure()

Create .cleo/ directory and all required subdirectories. Idempotent: skips directories that already exist. View in API reference

ensureGitignore()

Create or repair .cleo/.gitignore from template. Idempotent: skips if file already exists with correct content. View in API reference

ensureConfig()

Create default config.json if missing. Idempotent: skips if file already exists. View in API reference

ensureProjectInfo()

Create or refresh project-info.json. Idempotent: skips if file already exists (unless force). View in API reference

ensureContributorMcp()

No-op. Kept for API compatibility. View in API reference

ensureProjectContext()

Detect and write project-context.json. Idempotent: skips if file exists and is less than staleDays old (default: 30). View in API reference

ensureCleoGitRepo()

Initialize isolated .cleo/.git checkpoint repository. Idempotent: skips if .cleo/.git already exists. View in API reference

ensureSqliteDb()

Create SQLite database if missing. Idempotent: skips if tasks.db already exists. View in API reference

checkCleoStructure()

Verify all required .cleo/ subdirectories exist. View in API reference

checkGitignore()

Verify .cleo/.gitignore exists and matches template. View in API reference

checkConfig()

Verify config.json exists and is valid JSON. View in API reference

checkProjectInfo()

Verify project-info.json exists with required fields. View in API reference

checkProjectContext()

Verify project-context.json exists and is not stale (default: 30 days). View in API reference

checkCleoGitRepo()

Verify .cleo/.git checkpoint repository exists. View in API reference

checkSqliteDb()

Verify .cleo/tasks.db exists and is non-empty. View in API reference

ensureBrainDb()

Create brain.db if missing. Idempotent: skips if brain.db already exists. View in API reference

checkBrainDb()

Verify .cleo/brain.db exists and is non-empty. View in API reference

checkMemoryBridge()

Verify .cleo/memory-bridge.md exists. Warning level if missing (not failure) — it is auto-generated. View in API reference

ensureGlobalHome()

Ensure the global ~/.cleo/ home directory and its required subdirectories exist. Idempotent: skips directories that already exist. Also removes known stale project-level entries that old CLEO versions incorrectly placed at the global level (see STALE_GLOBAL_ENTRIES). This is the SSoT for global home scaffolding, replacing raw mkdirSync calls that were previously scattered across global-bootstrap.ts. View in API reference

ensureGlobalTemplates()

Ensure the global CLEO injection template is installed. Delegates to injection.ts for the template content, but owns the filesystem write to maintain SSoT for scaffolding. Idempotent: skips if the template already exists with correct content. View in API reference

ensureGlobalScaffold()

Perform a complete global scaffold operation: ensure home and templates are all present and current. This is the single entry point for global infrastructure scaffolding. Schemas are NOT copied here — they are read at runtime from the npm package path (getPackageRoot() + ‘/schemas/’). Use ensureGlobalSchemas() explicitly from init or upgrade if a copy is needed for a specific workflow. Used by: - CLI startup (via startupHealthCheck in health.ts) - init (for first-time global setup) - upgrade (for global repair) View in API reference

ensureCleoOsHub()

Ensure the CleoOS Hub subdirectories exist under the global CLEO home, and seed a starter Justfile Hub if none exists yet. This is the Phase 1 scaffolding entry point. Idempotent: re-running is safe and will not overwrite an existing user-edited justfile. View in API reference

checkGlobalHome()

Check that the global ~/.cleo/ home and its required subdirectories exist. Read-only: no side effects. View in API reference

checkGlobalTemplates()

Check that the global injection template is present and current. Read-only: no side effects. View in API reference

checkLogDir()

Check that the project log directory exists. Read-only: no side effects. View in API reference

classifyProject()

Classify a project directory as greenfield or brownfield. Read-only — never mutates the filesystem. Safe to call at any time. View in API reference

getAgentCapacity()

Get task-count-based remaining capacity for an agent. Remaining capacity = MAX_TASKS_PER_AGENT minus the number of tasks currently routed to this agent instance (tracked via the task_id column on agent_instances — each instance handles one task at a time; child agents spawned by an orchestrator appear as sibling rows referencing the same parent_agent_id). For capacity purposes the “active tasks” count is derived from the number of non-terminal sibling rows that share the same parent_agent_id as this agent, plus 1 for the agent’s own current task when task_id is set. View in API reference

getAgentsByCapacity()

List all non-terminal agents sorted by remaining task capacity (descending). Returns agents with the most available slots first, enabling callers to select the least-loaded agent for new work assignment. View in API reference

getAgentSpecializations()

Get the specialization/skills list for an agent. Specializations are stored as a string array under the specializations key in the agent’s metadata_json column. An empty array is returned when the field is absent or the agent is not found. View in API reference

updateAgentSpecializations()

Update the specializations list stored in an agent’s metadata. Merges the new list into the existing metadata_json object, preserving any other keys already present. Returns the updated specializations list, or null if the agent was not found. View in API reference

recordAgentPerformance()

Record agent performance metrics to the BRAIN execution history. Translates a simplified AgentPerformanceMetrics object into the AgentExecutionEvent format expected by execution-learning.ts and delegates to recordAgentExecution. The agent type is resolved from the agent_instances table so callers only need to supply the agent ID. View in API reference

recordHeartbeat()

Record a heartbeat for an agent instance. Updates last_heartbeat to the current time and returns the agent’s current AgentInstanceStatus. Returns null if the agent does not exist or is already in a terminal state (stopped / crashed). This is the primary mechanism by which long-running agents signal liveness. Call this every HEARTBEAT_INTERVAL_MS (30 s) from the agent loop. View in API reference

checkAgentHealth()

Check the health of a specific agent instance by ID. Queries the agent’s current record and returns a structured AgentHealthStatus describing staleness, heartbeat age, and whether the agent is considered healthy relative to thresholdMs. Returns null if the agent ID is not found in the database. View in API reference

detectStaleAgents()

Find all non-terminal agents whose last heartbeat is older than thresholdMs. “Stale” means an agent with status starting, active, or idle has not sent a heartbeat within the threshold window. This is a precursor to crash detection — a stale agent may still recover if it is under heavy load. Agents with status stopped or crashed are excluded — they are already in a terminal state and do not participate in the heartbeat protocol. View in API reference

detectCrashedAgents()

Find agents with status active whose heartbeat has been silent for longer than thresholdMs, and mark them as crashed in the database. An agent is considered crashed when it: 1. Has status active (not idle, starting, stopped, or crashed) 2. Has not sent a heartbeat for longer than thresholdMs Each detected agent is immediately marked crashed via markCrashed, incrementing its error count and writing a reason to agent_error_log. View in API reference

createRetryPolicy()

Create a retry policy by merging overrides with the default policy. View in API reference

calculateDelay()

Calculate the delay for a given retry attempt using exponential backoff. View in API reference

shouldRetry()

Determine whether an error should be retried based on its classification and the retry policy. View in API reference

withRetry()

Wrap an async function with retry logic using configurable exponential backoff. View in API reference

recoverCrashedAgents()

Attempt to recover crashed agents. Finds all agents with status ‘crashed’ and determines if they can be restarted based on their error history. Agents whose last error was classified as ‘permanent’ are abandoned. Agents with retriable errors are reset to ‘starting’ for the orchestration layer to re-assign. View in API reference

predictImpact()

Predict the downstream impact of a free-text change description. Uses fuzzy keyword matching to identify candidate tasks that relate to the change, then walks the reverse dependency graph to enumerate all downstream tasks that may be affected. View in API reference

SharingStatus

Result of a sharing status check. View in API reference

getSharingStatus()

Get the sharing status: which .cleo/ files are tracked vs ignored, plus git sync state for Nexus multi-project visibility. View in API reference

withRetry()

Execute an async function with automatic retry and exponential backoff. View in API reference

computeDelay()

Compute the wait time before the next attempt. View in API reference

addResearch()

Add a research entry. View in API reference

showResearch()

Show a specific research entry. View in API reference

listResearch()

List research entries with optional filtering. View in API reference

pendingResearch()

List pending research entries. View in API reference

linkResearch()

Link a research entry to a task. View in API reference

updateResearch()

Update research findings. View in API reference

statsResearch()

Get research statistics. View in API reference

linksResearch()

Get research entries linked to a specific task. View in API reference

archiveResearch()

Archive old research entries by status. Moves ‘complete’ entries to an archive and keeps non-complete ones. View in API reference

readManifest()

Read manifest entries from the legacy agent-outputs flat-file (deprecated per ADR-027). View in API reference

appendManifest()

Append a manifest entry. View in API reference

queryManifest()

Query manifest entries with filtering. View in API reference

readExtendedManifest()

Read all manifest entries as extended entries. View in API reference

filterManifestEntries()

Filter manifest entries by criteria. View in API reference

showManifestEntry()

Show a manifest entry by ID with optional file content. View in API reference

searchManifest()

Search manifest entries by text with relevance scoring. View in API reference

pendingManifestEntries()

Get pending manifest entries (partial, blocked, or needing followup). View in API reference

manifestStats()

Get manifest-based research statistics. View in API reference

linkManifestEntry()

Link a manifest entry to a task (adds taskId to linked_tasks array). View in API reference

appendExtendedManifest()

Append an extended manifest entry. Validates required fields before appending. View in API reference

archiveManifestEntries()

Archive manifest entries older than a date. View in API reference

findContradictions()

Find manifest entries with overlapping topics but conflicting key_findings. View in API reference

findSuperseded()

Identify research entries replaced by newer work on same topic. View in API reference

readProtocolInjection()

Read protocol injection content for a given protocol type. View in API reference

compactManifest()

Compact the legacy agent-outputs flat-file by removing duplicate/stale entries. View in API reference

validateManifestEntries()

Validate research entries for a task. View in API reference

getWorkflowComplianceReport()

Compute workflow compliance metrics from existing task, session, and audit data. Rules evaluated: WF-001: Tasks MUST have ≥3 acceptance criteria (T058) WF-002: Task completions MUST occur within an active session (T059) WF-003: Completed tasks SHOULD have verification gates set (T061) WF-004: Tasks with verification SHOULD have all 3 gates set WF-005: Tasks MUST have session binding on creation (non-epic) View in API reference

generateAcFromDescription()

Generate 3 baseline acceptance criteria from a task description. Uses simple text analysis — no LLM required. View in API reference

backfillTasks()

Retroactively populate AC and verification metadata for tasks that lack them. View in API reference

runBrainMaintenance()

Run a combined brain maintenance pass: decay, consolidation, and embeddings. The three steps always run in the same order: 1. applyTemporalDecay — decay stale learning confidence values 2. consolidateMemories — merge clustered old observations 3. populateEmbeddings — backfill missing vectors Each step is optional via the skip* flags. The function is idempotent: re-running it when there is nothing to process returns zero counts. View in API reference

memoryShow()

Look up a brain.db entry by ID. View in API reference

memoryBrainStats()

Aggregate stats from brain.db across all tables. View in API reference

memoryDecisionFind()

Search decisions in brain.db. View in API reference

memoryDecisionStore()

Store a decision to brain.db. View in API reference

memoryFind()

Token-efficient brain search returning compact results. View in API reference

memoryTimeline()

Chronological context around a brain entry anchor. View in API reference

memoryFetch()

Batch fetch brain entries by IDs. View in API reference

memoryObserve()

Save an observation to brain.db. View in API reference

memoryPatternStore()

Store a pattern to BRAIN memory. View in API reference

memoryPatternFind()

Search patterns in BRAIN memory. View in API reference

memoryPatternStats()

Get pattern memory statistics. View in API reference

memoryLearningStore()

Store a learning to BRAIN memory. View in API reference

memoryLearningFind()

Search learnings in BRAIN memory. View in API reference

memoryLearningStats()

Get learning memory statistics. View in API reference

memoryContradictions()

Find contradictory entries in brain.db. View in API reference

memorySuperseded()

Find superseded entries in brain.db. Identifies entries that have been superseded by newer entries on the same topic. View in API reference
Link a brain entry to a task. View in API reference
Remove a link between a brain entry and a task. View in API reference

memoryGraphAdd()

Add a node or edge to the PageIndex graph. View in API reference

memoryGraphShow()

Get a node and its edges from the PageIndex graph. View in API reference

memoryGraphNeighbors()

Get neighbor nodes from the PageIndex graph. View in API reference

memoryReasonWhy()

Causal trace through task dependency chains. View in API reference

memoryReasonSimilar()

Find semantically similar entries. View in API reference

memorySearchHybrid()

Hybrid search across FTS5, vector, and graph. View in API reference

memoryGraphRemove()

Remove a node or edge from the PageIndex graph. View in API reference

coreTaskNext()

Suggest next task to work on based on priority, phase, age, and deps. View in API reference

coreTaskBlockers()

Show blocked tasks and analyze blocking chains. View in API reference

coreTaskTree()

Build hierarchy tree for tasks. View in API reference

coreTaskDeps()

Show dependencies for a task. View in API reference

coreTaskRelates()

Show task relations. View in API reference

coreTaskRelatesAdd()

Add a relation between two tasks. View in API reference

coreTaskAnalyze()

Analyze tasks for priority and leverage. View in API reference

coreTaskRestore()

Restore a cancelled task back to pending. View in API reference

coreTaskCancel()

Cancel a task (sets status to ‘cancelled’, a soft terminal state). Use restore to reverse. Use delete for permanent removal. View in API reference

coreTaskUnarchive()

Move an archived task back to active tasks. View in API reference

coreTaskReorder()

Change task position within its sibling group. View in API reference

coreTaskReparent()

Move task under a different parent. View in API reference

coreTaskPromote()

Promote a subtask to task or task to root. View in API reference

coreTaskReopen()

Reopen a completed task. View in API reference

coreTaskComplexityEstimate()

Deterministic complexity scoring from task metadata. View in API reference

coreTaskDepsOverview()

Overview of all dependencies across the project. View in API reference

coreTaskDepsCycles()

Detect circular dependencies across the project. View in API reference

coreTaskDepends()

List dependencies for a task in a given direction. View in API reference

coreTaskStats()

Compute task statistics. View in API reference

coreTaskExport()

Export tasks as JSON or CSV. View in API reference

coreTaskHistory()

Get task history from the audit log. View in API reference

coreTaskLint()

Lint tasks for common issues. View in API reference

coreTaskBatchValidate()

Validate multiple tasks at once. View in API reference

coreTaskImport()

Import tasks from a JSON source string. View in API reference

findResumablePipelines()

Query active pipelines that can be resumed. Searches the lifecycle_pipelines table for pipelines with status ‘active’ and joins with lifecycle_stages to determine current stage status. Also joins with tasks table to get task metadata. View in API reference

loadPipelineContext()

Load complete pipeline context for session resume. Uses SQL JOINs to efficiently load all related data: - Pipeline and current stage - All stages with their status - Gate results for current stage - Evidence linked to current stage - Recent transitions - Task details View in API reference

resumeStage()

Resume a specific stage in a pipeline. Updates the stage status from ‘blocked’ or ‘not_started’ to ‘in_progress’, records the transition, and returns the resume result. View in API reference

autoResume()

Auto-detect where to resume across all active pipelines. Finds the best candidate for resuming work based on: 1. Active stages (currently in progress) 2. Blocked stages (can be unblocked) 3. Failed stages (can be retried) 4. Priority ordering View in API reference

checkSessionResume()

Check for resumable work on session start. Integrates with session initialization to check for active pipelines and present resumable work to the user. Can auto-resume if there’s a clear single candidate. View in API reference

checkPrerequisites()

Check if prerequisites are met for a stage. Validates that all prerequisite stages are in an acceptable state (completed or skipped) for the target stage to proceed. View in API reference

validateTransition()

Validate a stage transition. Comprehensive validation that checks both transition rules and prerequisites. This is the core state machine validation logic. View in API reference

executeTransition()

Execute a state transition. Applies the transition to the state machine context, updating stage statuses and returning the new state. This function does NOT persist to database - that is handled by the pipeline module. View in API reference