engineError(code, message, options)
Create a typed engine error result with pino logging and correct exit code. Signature
Returns — EngineResult with success=false and properly structured error
Example
engineSuccess(data)
Create an engine success result. Signature
Returns — EngineResult with success=true
Example
taskShow(projectRoot, taskId)
Get a single task by ID. Signature
Returns — EngineResult containing the task record
Example
taskList(projectRoot, params)
List tasks with optional filters. Signature
Returns — EngineResult with task array, total count, and filtered count
Example
taskFind(projectRoot, query, limit, options)
Fuzzy search tasks by title/description/ID. Signature
Returns — EngineResult with matching tasks and total count
Example
taskExists(projectRoot, taskId)
Check if a task exists. Signature
Returns — EngineResult with exists flag and the queried taskId
Example
taskCreate(projectRoot, params)
Create a new task. Signature
Returns — EngineResult with the created task record and duplicate flag
Example
taskUpdate(projectRoot, taskId, updates)
Update a task’s fields. Signature
Returns — EngineResult with the updated task record and list of changes
Example
taskComplete(projectRoot, taskId, notes)
Complete a task (set status to done). Signature
Returns — EngineResult with the completed task, auto-completed parents, and unblocked tasks
Example
taskDelete(projectRoot, taskId, force)
Delete a task. Signature
Returns — EngineResult with the deleted task and optional cascade info
Example
taskArchive(projectRoot, taskId, before)
Archive completed tasks. Moves done/cancelled tasks from active task data to archive. Signature
Returns — EngineResult with count and list of archived task IDs
Example
taskNext(projectRoot, params)
Suggest next task to work on based on priority, phase alignment, age, and dependency readiness. Signature
Returns — EngineResult with scored suggestions and total candidate count
Example
taskBlockers(projectRoot, params)
Show blocked tasks and analyze blocking chains. Signature
Returns — EngineResult with blocked tasks, critical blockers, and summary
Example
taskTree(projectRoot, taskId)
Build hierarchy tree. Signature
Returns — EngineResult with the hierarchical tree data
Example
taskDeps(projectRoot, taskId)
Show dependencies for a task - both what it depends on and what depends on it. Signature
Returns — EngineResult with dependency information in both directions
Example
taskRelates(projectRoot, taskId)
Show task relations (existing relates entries). Signature
Returns — EngineResult with relations array and count
Example
taskRelatesAdd(projectRoot, taskId, relatedId, type, reason)
Add a relation between two tasks. Signature
Returns — EngineResult confirming the relation was added
Example
taskAnalyze(projectRoot, taskId, params)
Analyze a task for description quality, missing fields, and dependency health. Signature
Returns — EngineResult with recommended task, bottlenecks, tiers, and metrics
Example
taskImpact(projectRoot, change, matchLimit)
Predict downstream impact of a free-text change description. Delegates topredictImpact from the intelligence module. Uses keyword matching against task titles/descriptions, then traces the reverse dependency graph for transitive effects.
Signature
Returns — Impact prediction report
Example
taskRestore(projectRoot, taskId, params)
Restore a cancelled task back to pending. Signature
Returns — EngineResult with restored task IDs and count
Example
taskUnarchive(projectRoot, taskId, params)
Move an archived task back to active task data with status ‘done’ (or specified status). Signature
Returns — EngineResult with the unarchived task info
Example
taskReorder(projectRoot, taskId, position)
Change task position within its sibling group. Signature
Returns — EngineResult with new position and total siblings
Example
taskReparent(projectRoot, taskId, newParentId)
Move task under a different parent. Signature
Returns — EngineResult with old and new parent information
Example
taskPromote(projectRoot, taskId)
Promote a subtask to task or task to root (remove parent). Signature
Returns — EngineResult with promotion details
Example
taskReopen(projectRoot, taskId, params)
Reopen a completed task (set status back to pending). Signature
Returns — EngineResult with reopen details including previous and new status
Example
taskCancel(projectRoot, taskId, reason)
Cancel a task (soft terminal state — reversible via restore). Signature
Returns — EngineResult with cancellation details
Example
taskComplexityEstimate(projectRoot, params)
Deterministic complexity scoring from task metadata. Signature
Returns — EngineResult with size, score, factors, and structural metrics
Example
taskDepends()
List dependencies for a task in a given direction. T4657 T4790 T4654 SignaturetaskDepsOverview()
Overview of all dependencies across the project. T5157 SignaturetaskDepsCycles()
Detect circular dependencies across the project. T5157 SignaturetaskStats()
Compute task statistics, optionally scoped to an epic. T4657 T4790 T4654 SignaturetaskExport()
Export tasks as JSON or CSV. T4657 T4790 T4654 SignaturetaskHistory()
Get task history from the log file. T4657 T4790 T4654 SignaturetaskLint()
Lint tasks for common issues. T4657 T4790 T4654 SignaturetaskBatchValidate()
Validate multiple tasks at once. T4657 T4790 T4654 SignaturetaskImport()
Import tasks from a JSON source string or export package. T4790 SignaturetaskPlan()
Compute a ranked plan: in-progress epics, ready tasks, blockers, bugs. T4815 SignaturetaskRelatesFind()
Find related tasks using semantic search or keyword matching. T5672 SignaturetaskLabelList()
List all labels used in tasks. T5672 SignaturetaskLabelShow()
Show tasks associated with a label. T5672 SignaturetaskSyncReconcile()
Reconcile external tasks with CLEO as SSoT. SignaturetaskSyncLinks()
List external task links by provider or task ID. SignaturetaskSyncLinksRemove()
Remove all external task links for a provider. SignaturetaskClaim()
Atomically claim a task for an agent. Fails if the task is already claimed by a different agent. No-op if the task is already claimed by the same agent (idempotent). SignaturetaskUnclaim()
Release an agent’s claim on a task, setting assignee to null. No-op if the task is not currently claimed. SignaturesessionStatus(projectRoot)
Get current session status. Signature
Returns — EngineResult with active session flag, session record, and task work state
Example
sessionList(projectRoot, params)
List sessions with budget enforcement. When a limit is applied (explicit or default), the response includes_meta.truncated and _meta.total so agents know the result set was capped.
Signature
Returns — EngineResult with sessions array, total, filtered count, and truncation metadata
Example
sessionFind(projectRoot, params)
Lightweight session discovery — returns minimal session records. Signature
Returns — EngineResult with array of minimal session records
Example
sessionShow(projectRoot, sessionId)
Show a specific session by ID. Signature
Returns — EngineResult with the full Session record
Example
taskCurrentGet()
Get current task being worked on. Delegates to core/task-work/currentTask. T4782 SignaturetaskStart()
Start working on a specific task. Delegates to core/task-work/startTask. T4782 SignaturetaskStop()
Stop working on the current task. Delegates to core/task-work/stopTask. T4782 SignaturetaskWorkHistory()
Get task work history from session notes. T5323 SignaturesessionStart()
Start a new session. Note: This function has engine-specific logic for task file focus management and session store updates, so it remains in the engine layer. T4782 SignaturesessionEnd()
End the current session. Note: This function has engine-specific logic for task file focus management and session store management, so it remains in the engine layer. T4782 T140 T134 - Summarization wiring SignaturesessionResume()
Resume an ended or suspended session. Note: This function has engine-specific logic for task file focus sync, so it remains in the engine layer. T4782 SignaturesessionGc()
Garbage collect old sessions. T4782 SignaturesessionSuspend()
Suspend an active session. T4782 SignaturesessionHistory()
List session history with focus changes and completed tasks. T4782 SignaturesessionCleanup()
Remove orphaned sessions and clean up stale data. T4782 SignaturesessionRecordDecision()
Record a decision to the audit trail. T4782 SignaturesessionDecisionLog()
Read the decision log, optionally filtered by sessionId and/or taskId. T4782 SignaturesessionContextDrift()
Compute context drift score for the current session. T4782 SignaturesessionRecordAssumption()
Record an assumption made during a session. T4782 SignaturesessionStats()
Compute session statistics, optionally for a specific session. T4782 SignaturesessionSwitch()
Switch to a different session. T4782 SignaturesessionArchive()
Archive old/ended sessions. T4782 SignaturesessionHandoff()
Get handoff data for the most recent ended session. T4915, T5123 SignaturesessionComputeHandoff()
Compute and persist handoff data for a session. T4915 SignaturesessionBriefing()
Compute session briefing - composite view for session start. Aggregates data from handoff, current focus, next tasks, bugs, blockers, and epics. T4916 SignaturesessionComputeDebrief()
Compute and persist rich debrief data for a session. Persists as both handoffJson (backward compat) and debriefJson (rich data). T4959 SignaturesessionDebriefShow()
Read a session’s debrief data. Falls back to handoff data if no debrief is available. T4959 SignaturesessionChainShow()
Show the session chain for a given session. Returns ordered list of sessions linked via previousSessionId/nextSessionId. T4959 SignaturesessionContextInject()
Inject context protocol content. T5673 SignaturelistRcsdEpics()
List all epic IDs that have RCASD pipeline data. SignaturelifecycleStatus()
lifecycle.check / lifecycle.status - Get lifecycle status for epic. T4785 SignaturelifecycleHistory()
lifecycle.history - Stage transition history. T4785 SignaturelifecycleGates()
lifecycle.gates - Get all gate statuses for an epic. T4785 SignaturelifecyclePrerequisites()
lifecycle.prerequisites - Get required prior stages for a target stage. T4785 SignaturelifecycleCheck()
lifecycle.check - Check if a stage’s prerequisites are met. T4785 SignaturelifecycleProgress()
lifecycle.progress / lifecycle.record - Record stage completion. T4785 SignaturelifecycleSkip()
lifecycle.skip - Skip a stage with reason. T4785 SignaturelifecycleReset()
lifecycle.reset - Reset a stage (emergency). T4785 SignaturelifecycleGatePass()
lifecycle.gate.pass - Mark gate as passed. T4785 SignaturelifecycleGateFail()
lifecycle.gate.fail - Mark gate as failed. T4785 SignaturecreateGatewayMeta(gateway, domain, operation, startTime)
Create a fully typed GatewayMeta for domain responses. Signature
Returns — GatewayMeta with all LAFS and CLEO-specific fields T4700 T4663
enforceBudget(response, budget)
Apply budget enforcement to a dispatch response envelope. Converts the DomainResponse into an LAFSEnvelope shape for budget checking, then applies truncation if the response exceeds the budget. Signature
Returns — The response, potentially truncated, with budget metadata T4701 T4663
isWithinBudget()
Quick check whether a response exceeds a token budget without modifying it. T4701 T4663 SignatureShimCommand
Minimal Commander-compatible Command class. Captures command definitions for later translation into citty commands. Signaturecommand()
Register a subcommand. Returns the new subcommand for chaining.description()
Set description (chaining).description()
Get description (Commander compat).description()
alias()
option()
requiredOption()
argument()
Add a positional argument after command creation. Commander compat: .argument(‘[name]’, ‘description’)action()
allowUnknownOption()
No-op for Commander compatibility. citty handles unknown options gracefully.allowExcessArguments()
No-op for Commander compatibility.name()
Get the command name. Commander compat method.optsWithGlobals()
Return parsed global flags from process.argv. Commander compat: returns parent + own options merged.opts()
Return parsed options. For shim purposes, same as optsWithGlobals().setFieldContext()
Set the field extraction context for this CLI invocation. Called once from the preAction hook in src/cli/index.ts. SignaturegetFieldContext()
Get the current field extraction context. SignatureresolveFieldContext()
Parse global field options from Commander.js parsed opts and resolve via the canonical LAFS SDK resolver (conflict detection, type narrowing). SignaturesetFormatContext()
Set the resolved format for this CLI invocation. Called once from the preAction hook in src/cli/index.ts. SignaturegetFormatContext()
Get the current resolved format. SignatureisJsonFormat()
Check if output should be JSON format. SignatureisHumanFormat()
Check if output should be human-readable format. SignatureisQuiet()
Check if quiet mode is enabled (suppress non-essential output). SignatureresolveFormat(opts, defaults)
Resolve output format from Commander.js option values. Reads —json, —human, and —quiet flags and delegates to the canonical LAFS resolveOutputFormat(). Project/user defaults can be passed via the optionaldefaults parameter.
Signature
Returns — Resolved format with source provenance T4703 T4663
validateLafsShape(envelope)
Validate a LAFS envelope shape and report violations. Full envelopes are delegated to@cleocode/lafs.validateEnvelope() (which uses the canonical schema via lafs-napi/AJV). Minimal envelopes are checked against the lightweight invariants in this module.
Signature
Returns — A
LafsShapeViolation report. .reasons.length === 0 when valid.
assertLafsShape(envelope)
Assert that a LAFS envelope conforms to the shape contract, throwing an error with a LAFS-shaped diagnostic if it does not. Used by the renderer middleware to fail LOUDLY when CLEO itself emits a malformed envelope — this is a developer bug, not an operator issue. Signature
Throws
LafsViolationErrorif the envelope fails any shape invariant
LafsViolationError
Error thrown byassertLafsShape when an envelope fails validation. Carries the full LafsShapeViolation report so diagnostic tooling can report which specific invariants were violated.
Signature
emitLafsViolation()
Emit a LAFS-shaped error envelope describing a validation failure and setprocess.exitCode to ExitCode.LAFS_VIOLATION. Called by the renderer middleware as a recovery path when a previously- emitted envelope turns out to be malformed.
Signature
normalizeForHuman()
Normalize data shape for human renderers. Each command expects data with specific named keys (e.g.,data.task for ‘show’, data.tasks for ‘list’). This function detects and corrects flat/array data from the engine layer.
Signature
statusSymbol()
Map task status to a display symbol. Falls back to ’?’ for unknown values. SignaturestatusColor()
Map task status to a color escape. SignatureprioritySymbol()
Map task priority to a display symbol. SignaturepriorityColor()
Map task priority to a color escape. SignaturehRule()
Create a horizontal rule with box-drawing characters. SignatureshortDate()
Format a date string as YYYY-MM-DD. SignaturerenderDoctor()
SignaturerenderStats()
SignaturerenderNext()
SignaturerenderBlockers()
SignaturerenderTree()
SignaturerenderStart()
SignaturerenderStop()
SignaturerenderCurrent()
SignaturerenderSession()
SignaturerenderVersion()
SignaturerenderPlan()
SignaturerenderGeneric()
Generic human renderer for commands that don’t have a specific renderer. Renders data as indented key-value pairs. SignaturerenderShow()
Render a single task in a box format (mirrors bash display_text). SignaturerenderList()
Render a list of tasks (mirrors bash list.sh text output). SignaturerenderFind()
Render search results. SignaturerenderAdd()
Render add result. SignaturerenderUpdate()
Render update result. SignaturerenderComplete()
Render complete result. SignaturerenderDelete()
Render delete result. SignaturerenderArchive()
Render archive result. SignaturerenderRestore()
Render restore result. SignaturecliOutput()
Output data to stdout in the resolved format (JSON or human-readable). Replacesconsole.log(formatSuccess(data)) in all V2 commands. When format is ‘human’, normalizes the data shape then dispatches to the appropriate renderer. When format is ‘json’, delegates to existing formatSuccess(). T4665 T4666 T4813
Signature
cliError()
Output an error in the resolved format. For JSON: delegates to formatError (already handled in command catch blocks). For human: prints a plain error message to stderr. T4666 T4813 SignaturecreateDispatchMeta(gateway, domain, operation, startTime, source, requestId, sessionId)
Create metadata for a dispatch response. Signature
Returns — Metadata conforming to DispatchResponse[‘_meta’] T4772 T4959
compose(middlewares)
Composes an array of Middleware functions into a single Middleware function. Execution flows through the array from first to last, and returns bubble back up from last to first. Signature
Returns — A single composed Middleware function
Example
deriveGatewayMatrix()
Derive a gateway operation matrix from the registry. ReturnsRecord<string, string[]> containing: - All canonical domains with their operations This is the SINGLE derivation point — gateways use this instead of maintaining independent operation lists.
Signature
getGatewayDomains()
Get all accepted domain names for a gateway (canonical only). Signatureresolve()
Resolves a domain + operation to its registered definition. SignaturevalidateRequiredParams()
Validates that all required parameters are present in the request. Returns an array of missing parameter keys. SignaturegetByDomain()
Get all operations for a specific canonical domain. SignaturegetByGateway()
Get all operations for a specific gateway. SignaturegetByTier()
Get all operations available at or below a specific tier. SignaturegetActiveDomains()
Get a list of canonical domains that actually have operations registered. SignaturegetCounts()
Returns summary counts of operations for module validation. SignatureDispatcher
Signaturedispatch()
mapCodebase(projectRoot, options)
Analyze a codebase and return structured mapping. When storeToBrain is true, findings are persisted to brain.db. Signature
Returns — EngineResult containing the structured codebase map
Example
configGet()
Get config value by key (dot-notation supported) SignatureconfigSet()
Set a config value by key (dot-notation supported) SignatureconfigSetPreset()
Apply a strictness preset to the project config. T067 SignatureconfigListPresets()
List all available strictness presets. T067 SignaturequeryHookProviders(event)
Query providers that support a specific hook event Returns detailed provider information including which hooks each provider supports, enabling intelligent routing and filtering of hook handlers. Signature
Returns — Engine result with provider hook capability data
queryCommonHooks(providerIds)
Get hook events common to specified providers Analyzes which hook events are supported by all providers in the given list, useful for determining the intersection of hook capabilities. Signature
Returns — Engine result with common hook events
systemHooksMatrix(params)
Build a cross-provider hook support matrix using CAAMP APIs. CallsbuildHookMatrix() to assemble the two-dimensional grid, then augments each provider row with getProviderSummary() coverage stats. Optionally runs detectAllProviders() to surface the active runtime.
Signature
Returns — Engine result with the full hook matrix T167
initProject()
Initialize a CLEO project directory. Creates the .cleo/ directory structure with empty data files. Returns error if already initialized (unless force=true). SignatureisAutoInitEnabled()
Check if auto-init is enabled via environment variable SignatureensureInitialized()
Check initialization status and auto-init if configured SignaturegetVersion()
Get current version (native implementation) SignatureorchestrateStatus()
orchestrate.status - Get orchestrator status T4478 SignatureorchestrateAnalyze()
orchestrate.analyze - Dependency analysis T4478 SignatureorchestrateReady()
orchestrate.ready - Get parallel-safe tasks (ready to execute) T4478 SignatureorchestrateNext()
orchestrate.next - Next task to spawn T4478 SignatureorchestrateWaves()
orchestrate.waves - Compute dependency waves T4478 SignatureorchestrateContext()
orchestrate.context - Context usage check T4478 SignatureorchestrateValidate()
orchestrate.validate - Validate spawn readiness for a task T4478 SignatureorchestrateSpawnSelectProvider()
orchestrate.spawn.select - Select best provider for spawn based on required capabilities T5236 SignatureorchestrateSpawnExecute()
orchestrate.spawn.execute - Execute spawn for a task using adapter registry T5236 SignatureorchestrateSpawn()
orchestrate.spawn - Generate spawn prompt for a task T4478 SignatureorchestrateStartup()
orchestrate.startup - Initialize orchestration for an epic T4478 SignatureorchestrateBootstrap()
orchestrate.bootstrap - Load brain state for agent bootstrapping T4478 T4657 SignatureorchestrateCriticalPath()
orchestrate.critical-path - Find the longest dependency chain T4478 SignatureorchestrateUnblockOpportunities()
orchestrate.unblock-opportunities - Analyze dependency graph for unblocking opportunities T4478 SignatureorchestrateParallel()
orchestrate.parallel - Manage parallel execution (start/end) T4632 SignatureorchestrateParallelStart()
orchestrate.parallel.start - Start parallel execution for a wave T4632 SignatureorchestrateParallelEnd()
orchestrate.parallel.end - End parallel execution for a wave T4632 SignatureorchestrateCheck()
orchestrate.check - Check current orchestration state T4632 SignatureorchestrateSkillInject()
orchestrate.skill.inject - Read skill content for injection into agent context T4632 SignatureorchestrateHandoff()
orchestrate.handoff - Composite session handoff + successor spawn Step order is explicit and fixed: 1) session.context.inject 2) session.end 3) orchestrate.spawn Idempotency policy: - Non-idempotent overall. A retry after step 2 can duplicate spawn output. - Failures include exact step state and a safe retry entry point. SignaturephaseList()
phase.list - List all project phases SignaturephaseShow()
phase.show - Show details of a specific phase SignaturephaseSet()
phase.set - Set the current phase SignaturephaseStart()
phase.start - Start a pending phase SignaturephaseComplete()
phase.complete - Complete an active phase SignaturephaseAdvance()
phase.advance - Advance to the next phase SignaturephaseRename()
phase.rename - Rename a phase SignaturephaseDelete()
phase.delete - Delete a phase SignaturereleasePrepare()
release.prepare - Prepare a release T4788 SignaturereleaseChangelog()
release.changelog - Generate changelog T4788 SignaturereleaseList()
release.list - List all releases (query operation via data read) T4788 SignaturereleaseShow()
release.show - Show release details (query operation via data read) T4788 SignaturereleaseCommit()
release.commit - Mark release as committed (metadata only) T4788 SignaturereleaseTag()
release.tag - Mark release as tagged (metadata only) T4788 SignaturereleaseGatesRun()
release.gates.run - Run release gates (validation checks) T4788 SignaturereleaseRollback()
release.rollback - Rollback a release T4788 SignaturereleaseCancel()
release.cancel - Cancel and remove a release in draft or prepared state T5602 SignaturereleasePush()
release.push - Push release to remote via git Uses execFileSync (no shell) for safety. Respects config.release.push policy. Agent protocol guard (T4279): When running in agent context (detected via CLEO_SESSION_ID or CLAUDE_AGENT_TYPE env vars), requires a release manifest entry for the version. This ensures agents go through the proper release.ship workflow rather than calling release.push directly, maintaining provenance tracking. T4788 T4276 T4279 SignaturereleaseShip()
release.ship - Composite release operation Sequence: validate gates → epic completeness → double-listing check → write CHANGELOG → git commit/tag/push (or PR) → record provenance T5582 T5586 T5576 SignaturesystemDash(projectRoot, params)
Project dashboard: task counts by status, active session info, current focus, recent completions. Signature
Returns — EngineResult with comprehensive dashboard data
Example
systemStats()
Detailed statistics: tasks by status/priority/type/phase, completion rate, average cycle time. SignaturesystemLabels()
List all unique labels across tasks with counts and task IDs per label. SignaturesystemArchiveStats()
Archive metrics: total archived, by reason, average cycle time, archive rate. SignaturesystemLog()
Query audit log with optional filters. Reads from SQLite audit_log table. T4837 SignaturesystemContext()
Context window tracking: estimate token usage from current session/state. SignaturesystemSequence()
Read task ID sequence state from canonical SQLite metadata. Supports ‘show’ and ‘check’ actions. T4815 SignaturesystemInjectGenerate()
Generate Minimum Viable Injection (MVI). SignaturesystemMetrics()
System metrics: token usage, compliance summary, session counts. T4631 SignaturesystemHealth()
System health check: verify core data files exist and are valid. T4631 SignaturesystemDiagnostics()
System diagnostics: extended health checks with fix suggestions. T4631 SignaturesystemHelp()
Return help text for the system. T4631 SignaturesystemRoadmap()
Generate roadmap from pending epics and optional CHANGELOG history. T4631 SignaturesystemCompliance()
System compliance report from COMPLIANCE.jsonl. T4631 SignaturesystemBackup()
Create a backup of CLEO data files. T4631 SignaturesystemListBackups()
List available system backups (read-only). T4783 SignaturesystemRestore()
Restore from a backup. T4631 SignaturebackupRestore()
Restore an individual file from backup. T5329 SignaturesystemMigrate()
Check/run schema migrations. T4631 SignaturesystemCleanup()
Cleanup stale data (sessions, backups, logs). T4631 SignaturesystemAudit()
Audit data integrity. T4631 SignaturesystemSync()
Sync check (no external sync targets in native mode). T4631 SignaturesystemSafestop()
Safe stop: signal clean shutdown for agents. T4631 SignaturesystemUncancel()
Uncancel a cancelled task (restore to pending). T4631 SignaturesystemDoctor()
Run comprehensive doctor diagnostics. T4795 SignaturesystemFix()
Run auto-fix for failed doctor checks. T4795 SignaturesystemRuntime()
Runtime/channel diagnostics for CLI installation mode checks. T4815 SignaturesystemPaths()
Report all resolved CleoOS paths (project + global hub). Backs thecleo admin paths CLI command. Read-only: reports current state without mutating the filesystem. Use systemScaffoldHub() to create missing hub directories and seed the starter justfile. Phase 1 — XDG Foundation + Justfile Hub Skeleton
Signature
systemScaffoldHub()
Create the CleoOS Hub directories and seed the starter justfile if absent. Idempotent: safe to call repeatedly. Never overwrites existing user-edited justfile or README content. Backs thecleo admin scaffold-hub CLI command and is invoked automatically by cleo init (Phase 5). Phase 1 — XDG Foundation + Justfile Hub Skeleton
Signature
systemSequenceRepair()
Repair task ID sequence using canonical core implementation. T4815 SignaturesystemSmoke()
Run operational smoke tests across all domains. Dispatches one read-only query per domain through the full CLI dispatch pipeline and reports pass/fail with timing. Catches crashes (TypeError, ReferenceError, etc.) not just structured error responses. T130 SignatureparseIssueTemplates(projectRoot)
Parse all templates from the repo’s .github/ISSUE_TEMPLATE/ directory. Signature
Returns — EngineResult containing the parsed template configuration
Example
getTemplateForSubcommand(projectRoot, subcommand)
Get template config for a specific subcommand (bug/feature/help). Signature
Returns — EngineResult containing the matched issue template
Example
generateTemplateConfig(projectRoot)
Generate and cache the config as .cleo/issue-templates.json. Signature
Returns — EngineResult containing the generated template configuration
Example
validateLabels(labels, repoLabels)
Validate that labels exist on a GitHub repo. Signature
Returns — EngineResult with existing and missing label lists
Example
validateSchemaOp()
validate.schema - JSON Schema validation T4477 SignaturevalidateTask()
validate.task - Anti-hallucination task validation T4477 SignaturevalidateProtocol()
validate.protocol - Protocol compliance check T4477 SignaturevalidateManifest()
validate.manifest - Manifest entry validation T4477 SignaturevalidateOutput()
validate.output - Output file validation T4477 SignaturevalidateComplianceSummary()
validate.compliance.summary - Aggregated compliance metrics T4477 SignaturevalidateComplianceViolations()
validate.compliance.violations - List compliance violations T4477 SignaturevalidateComplianceRecord()
validate.compliance.record - Record compliance check result T4477 SignaturevalidateTestStatus()
validate.test.status - Test suite status T4477 SignaturevalidateCoherenceCheck()
validate.coherence-check - Cross-validate task graph for consistency T4477 SignaturevalidateTestRun()
validate.test.run - Execute test suite via subprocess T4632 SignaturevalidateBatchValidate()
validate.batch-validate - Batch validate all tasks against schema and rules T4632 SignaturevalidateTestCoverage()
validate.test.coverage - Coverage metrics T4477 SignaturevalidateProtocolConsensus()
check.protocol.consensus - Validate consensus protocol compliance T5327 SignaturevalidateProtocolContribution()
check.protocol.contribution - Validate contribution protocol compliance T5327 SignaturevalidateProtocolDecomposition()
check.protocol.decomposition - Validate decomposition protocol compliance T5327 SignaturevalidateProtocolImplementation()
check.protocol.implementation - Validate implementation protocol compliance T5327 SignaturevalidateProtocolSpecification()
check.protocol.specification - Validate specification protocol compliance T5327 SignaturevalidateProtocolResearch()
check.protocol.research - Validate research protocol compliance T260 SignaturevalidateProtocolArchitectureDecision()
check.protocol.architecture-decision - Validate ADR protocol compliance T260 SignaturevalidateProtocolValidation()
check.protocol.validation - Validate validation-stage protocol compliance T260 SignaturevalidateProtocolTesting()
check.protocol.testing - Validate testing-stage protocol compliance (IVT loop) T260 SignaturevalidateProtocolRelease()
check.protocol.release - Validate release protocol compliance T260 SignaturevalidateProtocolArtifactPublish()
check.protocol.artifact-publish - Validate artifact-publish protocol compliance T260 SignaturevalidateProtocolProvenance()
check.protocol.provenance - Validate provenance protocol compliance T260 SignaturevalidateGateVerify()
check.gate.verify - View or modify verification gates for a task T5327 SignaturedispatchMeta(gateway, domain, operation, startTime, source)
Build metadata for a dispatch domain response. Signature
Returns — Metadata conforming to DispatchResponse[‘_meta’] T4772
wrapResult()
Wrap a native engine result into a DispatchResponse. Handles success data, page metadata, and structured errors. SignatureerrorResult()
Return a standard error response. SignatureunsupportedOp()
Return a standard “unsupported operation” error response. SignaturegetListParams()
Extract limit and offset pagination params from a params dict. SignaturehandleErrorResult()
Handle a caught error: extract message and return an internal error response. Callers should log the error themselves (with their domain-specific logger) before or after calling this. SignaturerouteByParam()
Shared parameter-based routing for merged operations. DRY utility — all domain handlers use this instead of re-implementing action dispatch. T5671 SignatureBackgroundJobManager
Manages background jobs for long-running operations SignaturestartJob()
Start a new background jobgetJob()
Get a specific job by IDlistJobs()
List all jobs, optionally filtered by statuscancelJob()
Cancel a running jobupdateProgress()
Update job progress (0-100)cleanup()
Cleanup old completed/failed/cancelled jobs past retention perioddestroy()
Destroy the manager: cancel all running jobs and clear stateexecuteJob()
Execute a job’s executor function and update status on completion/failuresetJobManager()
SignaturegetJobManager()
SignatureAdminHandler
Signaturequery()
mutate()
getSupportedOperations()
CheckHandler
Signaturequery()
mutate()
getSupportedOperations()
ConduitHandler
Conduit dispatch handler for agent messaging operations. Signaturequery()
mutate()
getSupportedOperations()
resolveCredential()
Resolve agent credential from the registry.getStatus()
Get connection status and unread count.peek()
One-shot peek for messages.startPolling()
Start continuous polling via cleocode/runtime AgentPoller.stopPolling()
Stop the active polling loop.sendMessage()
Send a message to an agent or conversation.MemoryHandler
Signaturequery()
mutate()
getSupportedOperations()
nexusStatus()
Get nexus status (initialized, project count, last updated). SignaturenexusListProjects()
List all registered projects. SignaturenexusShowProject()
Show a single project by name. SignaturenexusResolve()
Resolve a cross-project task query. SignaturenexusDepsQuery()
Get cross-project dependencies for a task query. SignaturenexusGraph()
Build the global dependency graph. SignaturenexusCriticalPath()
Get the critical path across projects. SignaturenexusBlockers()
Analyze blockers for a task query. SignaturenexusOrphans()
List orphaned cross-project tasks. SignaturenexusDiscover()
Discover tasks related to a given task query across projects. Delegates all business logic to src/core/nexus/discover.ts. SignaturenexusSearch()
Search for tasks across all registered projects. Delegates all business logic to src/core/nexus/discover.ts. SignaturenexusInitialize()
Initialize the nexus. SignaturenexusRegisterProject()
Register a project in the nexus. SignaturenexusUnregisterProject()
Unregister a project from the nexus. SignaturenexusSyncProject()
Sync a specific project or all projects. SignaturenexusSetPermission()
Set permission level for a project. SignaturenexusReconcileProject()
Reconcile the nexus registry with the filesystem. SignaturenexusShareStatus()
Get sharing status for a project. SignaturenexusShareSnapshotExport()
Export a snapshot of the project’s tasks. SignaturenexusShareSnapshotImport()
Import a snapshot into the project. SignaturenexusTransferPreview()
Preview a cross-project task transfer (dry run). SignaturenexusTransferExecute()
Execute a cross-project task transfer. SignatureNexusHandler
Signaturequery()
mutate()
getSupportedOperations()
OrchestrateHandler
Signaturequery()
mutate()
getSupportedOperations()
PipelineHandler
Signaturequery()
mutate()
getSupportedOperations()
queryStage()
mutateStage()
queryRelease()
mutateRelease()
queryManifest()
queryPhase()
mutateManifest()
mutatePhase()
queryChain()
mutateChain()
bindSession()
Bind a session to the current process. Called by session.start mutation handler after successful session creation. Signature- if a session is already bound (call unbindSession first).
getBoundSession()
Get the currently bound session context, or null if none is bound. SignaturehasSession()
Check whether a session is currently bound. SignatureunbindSession()
Unbind the current session context. Called by session.end mutation handler. SignatureresetSessionContext()
Reset the session context (for testing only). SignatureSessionHandler
Signaturequery()
mutate()
getSupportedOperations()
stickyAdd(projectRoot, params)
Create a new sticky note. Signature
Returns — EngineResult with created sticky note
stickyList(projectRoot, params)
List sticky notes with optional filtering. Signature
Returns — EngineResult with array of sticky notes
stickyShow(projectRoot, id)
Get a single sticky note by ID. Signature
Returns — EngineResult with sticky note or null
stickyConvertToTask(projectRoot, stickyId, title)
Convert a sticky note to a task. Signature
Returns — EngineResult with new task ID
stickyConvertToMemory(projectRoot, stickyId, memoryType)
Convert a sticky note to a memory observation. Signature
Returns — EngineResult with new memory entry ID
stickyArchive(projectRoot, id)
Archive a sticky note. Signature
Returns — EngineResult with archived sticky note
stickyConvertToTaskNote(projectRoot, stickyId, taskId)
Convert a sticky note to a task note. Signature
Returns — EngineResult with updated task ID
stickyConvertToSessionNote(projectRoot, stickyId, sessionId)
Convert a sticky note to a session note. Signature
Returns — EngineResult with session ID
stickyPurge(projectRoot, id)
Purge (permanently delete) a sticky note. Signature
Returns — EngineResult with purged sticky note
StickyHandler
Signaturequery()
mutate()
getSupportedOperations()
TasksHandler
Signaturequery()
mutate()
getSupportedOperations()
codeOutline()
code.outline — file structural skeleton. SignaturecodeSearch()
code.search — cross-codebase symbol search. SignaturecodeUnfold()
code.unfold — single symbol extraction. SignaturecodeParse()
code.parse — raw AST parse for a single file. SignaturetoolsIssueDiagnostics()
Collect issue diagnostics. SignaturetoolsSkillList()
List all discovered skills. SignaturetoolsSkillShow()
Show a single skill by name. SignaturetoolsSkillFind()
Find skills matching a query string. SignaturetoolsSkillDispatch()
Get dispatch matrix entries for a skill. SignaturetoolsSkillVerify()
Verify a skill’s installation and catalog status. SignaturetoolsSkillDependencies()
Get dependency tree for a skill. SignaturetoolsSkillSpawnProviders()
Get spawn-capable providers by capability. SignaturetoolsSkillCatalogInfo()
Get catalog info (protocols, profiles, resources, or summary). SignaturetoolsSkillCatalogProtocols()
List catalog protocols. SignaturetoolsSkillCatalogProfiles()
List catalog profiles. SignaturetoolsSkillCatalogResources()
List catalog shared resources. SignaturetoolsSkillPrecedenceShow()
Show skill precedence map. SignaturetoolsSkillPrecedenceResolve()
Resolve skill paths for a specific provider. SignaturetoolsSkillInstall()
Install a skill to one or more providers. SignaturetoolsSkillUninstall()
Uninstall a skill from all providers. SignaturetoolsSkillRefresh()
Refresh all tracked skills that have updates available. SignaturetoolsProviderList()
List all registered providers. SignaturetoolsProviderDetect()
Detect all available providers in the environment. SignaturetoolsProviderInjectStatus()
Check injection status for all installed providers. SignaturetoolsProviderSupports()
Check if a provider supports a specific capability. SignaturetoolsProviderHooks()
Query hook providers for a specific event. SignaturetoolsProviderInject()
Inject CLEO directives into all installed provider instruction files. SignaturetoolsAdapterList()
List all discovered adapters. SignaturetoolsAdapterShow()
Show a single adapter by ID. SignaturetoolsAdapterDetect()
Detect active adapters. SignaturetoolsAdapterHealth()
Get adapter health status. SignaturetoolsAdapterActivate()
Activate an adapter by ID. SignaturetoolsAdapterDispose()
Dispose one or all adapters. SignatureToolsHandler
Signaturequery()
mutate()
getSupportedOperations()
queryIssue()
mutateIssue()
querySkill()
mutateSkill()
queryProvider()
mutateProvider()
queryAdapter()
queryCode()
mutateAdapter()
handleError()
createDomainHandlers()
Create a Map of all canonical domain handlers. SignatureRateLimiter
Sliding-window rate limiter for the dispatch pipeline. Signaturecheck()
resolveCategory()
getLimitConfig()
createRateLimiter(config)
Creates a rate limiting middleware for the dispatch pipeline. Signature
Returns — Middleware function that enforces rate limits
Example
ConfigValidationError
Configuration validation error SignaturevalidateConfig()
Validate complete configuration SignatureloadConfig()
Load configuration from all sources Priority order: 1. Environment variables (CLEO_*) 2. Config file (.cleo/config.json) 3. Defaults SignaturegetConfig()
Get global configuration (singleton) SignatureresetConfig()
Reset global configuration (for testing) SignaturecreateAudit()
Creates an audit middleware that logs all mutate operations (and query operations during grade sessions) to Pino + SQLite. SignaturecreateFieldFilter()
Create the LAFS field-filter middleware. Handles: - _fields: filter response data to specified fields (delegates to SDK applyFieldFilter) - _mvi: envelope verbosity — stored on request for downstream use _fields and _mvi are extracted from req.params (for callers that pass them as params) and stored on the DispatchRequest before the domain handler runs. SignaturecreateSanitizer(getProjectRoot)
Creates a middleware that sanitizes incoming request parameters. Uses the canonical sanitization logic from security.ts to handle Task IDs, paths, string lengths, and enum validation. Signature
Returns — Middleware function that sanitizes request params
Example
createSessionResolver(cliSessionLookup)
Creates the session resolver middleware. SignaturegetCliDispatcher()
Get or create the singleton CLI dispatcher. Creates a Dispatcher with all 9 domain handlers and sanitizer middleware. No rate limiter — CLI is a single-user tool. SignaturecreateCliDispatcher()
Factory: creates a Dispatcher with all domain handlers + session-resolver, sanitizer, field-filter, and audit middleware. T4959 — added session-resolver + audit to CLI pipeline SignatureresetCliDispatcher()
Reset the singleton dispatcher (for testing). SignaturedispatchFromCli()
Build a DispatchRequest, dispatch it, and handle output/errors. This is the primary entry point for migrated CLI commands: await dispatchFromCli(‘query’, ‘tasks’, ‘show’, taskId , command: ‘show’ ); Automatically honors global —field/—fields/—mvi flags from the FieldContext: - —field → plain-text extraction, no JSON envelope - —fields → field-filter middleware filters the JSON response - —mvi → envelope verbosity passed to field-filter middleware On success: calls cliOutput(response.data, outputOpts) On error: calls cliError(message, exitCode) + process.exit(exitCode) T4953 T4955 SignaturehandleRawError()
Handle an error response from dispatchRaw(). Calls cliError() and process.exit() when the response indicates failure. No-op when response.success is true. SignaturedispatchRaw()
Dispatch and return the raw response without handling output. For commands that need custom output logic (pagination, conditional messages, etc.), call this instead of dispatchFromCli(). SignatureregisterAddCommand()
Register the add command. T4460 SignatureregisterAdminCommand()
Register the admin command group. SignatureregisterAdrCommand()
SignatureregisterAgentCommand()
Register thecleo agent command group.
Signature
registerAgentsCommand()
Registeragents as an alias that prints deprecation notice. Health monitoring is now under cleo agent health.
Signature
registerAnalyzeCommand()
Register the analyze command. T4538 SignatureregisterArchiveCommand()
Register the archive command. T4461 SignatureregisterArchiveStatsCommand()
Register the archive-stats command. Routes through dispatch layer to admin.archive.stats. T4555 SignatureregisterBackfillCommand(program)
Register thecleo backfill CLI command.
Signature
Example
registerBackupCommand()
SignatureregisterBlockersCommand()
SignatureregisterBrainCommand(program)
Register thecleo brain command group. Registers a brain parent command and a maintenance subcommand that combines temporal decay, memory consolidation, and embedding backfill into one idempotent pass.
Signature
Example
registerBriefingCommand()
Register the briefing command. T4916 SignatureregisterBugCommand()
Register the bug command. T4913 SignatureregisterCantCommand()
SignatureregisterCheckCommand()
Register the check command group. SignatureregisterCheckpointCommand()
Register the checkpoint command. Delegates to src/store/git-checkpoint.ts for isolated .cleo/.git operations. T4551 T4872 SignatureregisterCommandsCommand()
Register the commands command. T4551, T5671 SignatureregisterCompleteCommand()
Register the complete command. T4461 SignatureregisterComplianceCommand()
SignatureregisterConfigCommand()
SignatureregisterConsensusCommand()
Register the consensus command group. T4537 SignatureregisterContextCommand()
SignatureregisterContributionCommand()
Register the contribution command group. T4537 SignatureregisterCurrentCommand()
Register the current command. T4756 T4666 SignatureregisterDashCommand()
Register the dash command. T4535 SignatureregisterDecompositionCommand()
Register the decomposition command group. T4537 SignatureregisterDeleteCommand()
Register the delete command. T4461 SignatureregisterDepsCommand(program)
Register the deps command group and its subcommands. SignatureregisterTreeCommand(program)
Register the tree command. SignatureregisterDetectCommand()
SignatureregisterDetectDriftCommand()
SignatureregisterDocsCommand()
Register the docs command. T4551 SignatureProgressTracker
Simple progress tracker for CLI operations. Signaturestart()
Start the progress tracker.step()
Update to a specific step.next()
Move to next step.complete()
Mark as complete with optional summary.error()
Report an error.Spinner
Simple spinner for indeterminate progress. Signaturestart()
Start the spinner.stop()
Stop the spinner.update()
Update the spinner message.createSelfUpdateProgress()
Create a progress tracker for self-update operations. SignaturecreateDoctorProgress()
Create a progress tracker for doctor operations. SignaturecreateUpgradeProgress()
Create a progress tracker for upgrade operations. SignatureregisterDoctorCommand()
SignatureregisterEnvCommand()
Register the env command group. T4581 SignatureregisterExistsCommand(program)
Register the exists command. Signature
Example
registerExportCommand()
SignatureregisterExportTasksCommand()
SignatureregisterFindCommand()
Register the find command. T4460 T4668 SignatureregisterGenerateChangelogCommand()
Register the generate-changelog command. T4555 SignatureregisterGradeCommand()
SignatureregisterHistoryCommand()
SignatureregisterImplementationCommand()
Register the implementation command group. T4537 SignatureregisterImportCommand()
SignatureregisterImportTasksCommand()
SignaturegetGitignoreTemplate()
Load the gitignore template from the package’s templates/ directory. Falls back to embedded content if file not found. Kept as export for backward compatibility (used by upgrade.ts). T4700 SignatureregisterInitCommand()
Register the init command. T4681 T4663 SignatureregisterInjectCommand()
SignatureregisterIssueCommand()
Register the issue command with all subcommands. T4555 SignatureregisterLabelsCommand()
Register the labels command group. T4538 SignatureregisterLifecycleCommand()
SignatureregisterListCommand()
Register the list command. T4460 T4668 SignatureregisterLogCommand()
Register the log command. T4538 SignatureregisterMapCommand()
Register the map command. SignatureregisterMemoryBrainCommand()
SignatureregisterMigrateClaudeMemCommand()
Register themigrate claude-mem command under a migrate parent command. Usage: cleo migrate claude-mem [—dry-run] [—source ] [—project ]
Signature
registerNextCommand()
SignatureregisterNexusCommand()
Register the nexus command group. T4554 SignatureregisterObserveCommand()
SignatureregisterOpsCommand()
Register the ops command. SignatureregisterOrchestrateCommand()
SignatureregisterOtelCommand()
Register the otel command group. T4535 SignatureregisterPhaseCommand()
Register the phase command group. T4464, T5326 SignatureregisterPhasesCommand()
Register the phases command group. T4538, T5326 SignatureregisterPlanCommand()
SignatureregisterPromoteCommand()
SignatureregisterReasonCommand(program)
Register thecleo reason command group and its subcommands.
Signature
Example
registerRefreshMemoryCommand()
SignatureregisterRelatesCommand()
Register the relates command group. T4538 SignatureregisterReleaseCommand()
SignatureregisterRemoteCommand()
Register the remote command with add/remove/list/push/pull subcommands. T4884 SignatureregisterReorderCommand()
SignatureregisterReparentCommand()
SignatureregisterResearchCommand()
SignatureregisterRestoreCommand()
SignatureregisterRoadmapCommand()
SignatureregisterSafestopCommand()
Register the safestop command. T4551 SignatureregisterSelfUpdateCommand()
SignatureregisterSequenceCommand()
SignatureregisterSessionCommand()
Register the session command group. T4463 SignatureregisterShowCommand()
Register the show command. T4460 T4666 SignatureregisterSkillsCommand()
Register the skills command with all subcommands. T4555 SignatureregisterSnapshotCommand()
SignatureregisterSpecificationCommand()
Register the specification command group. T4537 SignatureregisterStartCommand()
Register the start command. T4756 T4666 SignatureregisterStatsCommand()
Register the stats command. T4535 SignatureregisterStickyCommand()
Register the sticky command group. T5281 SignatureregisterStopCommand()
Register the stop command. T4756 T4666 SignatureregisterTestingCommand()
Register the testing command. T4551 SignatureregisterTokenCommand()
SignatureregisterUpdateCommand()
Register the update command. T4461 SignatureregisterUpgradeCommand()
SignatureregisterValidateCommand()
SignatureregisterVerifyCommand()
SignatureregisterWebCommand()
Register the web command. T4551 SignatureinitCliLogger()
Initialize CLI logger with optional projectHash correlation context. SignatureregisterDynamicCommands()
Register dynamically-generated commands onto the Commander program. Stub implementation: no commands registered until T4897 populates OperationDef.params arrays for all operations. SignaturerenderErrorMarkdown()
Render a CleoError as structured markdown for CLI display. SignaturecreateProtocolEnforcement(strictMode)
Creates a middleware that enforces protocol compliance. Delegates to ProtocolEnforcer.enforceProtocol() which: - Passes through query operations untouched - Passes through mutate operations that don’t require validation - Validates protocol compliance on validated mutate operations after execution - In strict mode, blocks operations with protocol violations (exit codes 60-70) Signature
Returns — Middleware function that enforces protocol compliance
Example
createVerificationGates(strictMode)
Creates a middleware that enforces verification gates on task operations. Signature
Returns — Middleware function that enforces verification gates
Example
getOperationSchema(domain, operation, gateway)
Look up an operation in the OPERATIONS registry and return a JSON Schema object suitable for use asinput_schema.properties.params or as a stand-alone per-operation schema.
Signature
Returns — JSONSchemaObject derived from ParamDef[], or permissive fallback
getAllOperationSchemas()
Return schemas for ALL operations of a given gateway. Useful for documentation generation and tool introspection endpoints. SignatureresolveTier(params, sessionScope)
Resolve tier from request params, defaulting to ‘standard’. Signature
Returns — The resolved MVI tier
Example