Skip to main content
Type contracts exported by this package: interfaces, type aliases, and enums.

TaskRecord

Task object as stored in task data.
PropertyTypeRequiredDescription
idstringYesUnique task identifier (e.g. “T001”).
titlestringYesShort summary of the task.
descriptionstringYesFull task description.
statusstringYesCurrent status (pending, active, blocked, done, cancelled).
prioritystringYesPriority level (critical, high, medium, low).
typestring | undefinedNoTask type (task, epic, milestone, bug).
phasestring | undefinedNoProject phase this task belongs to.
createdAtstringYesISO timestamp when the task was created.
updatedAtstring | nullYesISO timestamp of the last update, or null.
completedAtstring | null | undefinedNoISO timestamp when the task was completed, or null.
cancelledAtstring | null | undefinedNoISO timestamp when the task was cancelled, or null.
parentIdstring | null | undefinedNoParent task ID for hierarchical nesting, or null for root tasks.
positionnumber | null | undefinedNoOrdering position among siblings.
positionVersionnumber | undefinedNoOptimistic concurrency version for position updates.
dependsstring[] | undefinedNoTask IDs this task depends on (must complete first).
relates{ taskId: string; type: string; reason?: string; }[] | undefinedNoRelated tasks with relationship type and optional reason.
filesstring[] | undefinedNoFile paths associated with this task.
acceptancestring[] | undefinedNoAcceptance criteria lines.
notesstring[] | undefinedNoFree-form notes.
labelsstring[] | undefinedNoClassification labels.
sizestring | null | undefinedNoComplexity sizing (small, medium, large).
epicLifecyclestring | null | undefinedNoEpic lifecycle state for epic-type tasks.
noAutoCompleteboolean | null | undefinedNoWhen true, prevents auto-completion on child task completion.
verificationimport("/mnt/projects/cleocode/packages/contracts/dist/task").TaskVerification | null | undefinedNoVerification gate state and round tracking.
originstring | null | undefinedNoHow the task was created (manual, decomposition, import).
createdBystring | null | undefinedNoAgent or user who created the task.
validatedBystring | null | undefinedNoAgent or user who validated the task.
testedBystring | null | undefinedNoAgent or user who tested the task.
lifecycleStatestring | null | undefinedNoCurrent lifecycle governance state.
validationHistoryRecord<string, unknown>[] | undefinedNoHistory of lifecycle validation transitions.
blockedBystring[] | undefinedNoTask IDs that are blocking this task.
cancellationReasonstring | undefinedNoReason provided when the task was cancelled.
pipelineStagestring | null | undefinedNoRCASD-IVTR+C pipeline stage (T060).

MinimalTaskRecord

Minimal task representation for find results.
PropertyTypeRequiredDescription
idstringYesUnique task identifier.
titlestringYesShort summary of the task.
statusstringYesCurrent status.
prioritystringYesPriority level.
parentIdstring | null | undefinedNoParent task ID, or null for root tasks.

GatewayMetaRecord

GatewayMeta with an index signature for DomainResponse._meta compatibility. All domain handlers receive this from createGatewayMeta(). T4655
GatewayMetaRecord

ShimOption

Parsed option definition.
PropertyTypeRequiredDescription
longNamestringYesLong flag name (camelCase), e.g. ‘dryRun’
shortNamestring | undefinedNoShort alias, e.g. ‘s’
takesValuebooleanYesWhether it takes a value (vs boolean flag)
descriptionstringYesDescription text
requiredbooleanYesWhether this option is required
parseFn((val: string) => unknown) | undefinedNoCustom parse function (e.g. parseInt)
defaultValueunknownYesDefault value

ShimArg

Positional argument definition.
PropertyTypeRequiredDescription
namestringYesname
requiredbooleanYesrequired
variadicboolean | undefinedNovariadic

CommanderCompatOption

Commander-compatible option view for tests.
PropertyTypeRequiredDescription
longstringYeslong
requiredbooleanYesrequired
defaultValueunknownYesdefaultValue

ActionHandler

Type for the action handler function - flexible to support various signatures
ActionHandler

LafsShapeViolation

The minimum shape invariants for a LAFS envelope, compatible with both minimal ({ok, r, _m}) and full ({success, result, _meta}) formats.
PropertyTypeRequiredDescription
isObjectbooleanYesTrue iff the input is a well-formed JSON object.
hasSuccessFieldbooleanYesTrue iff the envelope has exactly one success-indicator field.
successIsBooleanbooleanYesTrue iff the success-indicator is a boolean.
hasMetabooleanYesTrue iff a metadata field (_m or _meta) is present.
resultOrErrorValidbooleanYesTrue iff the result/error invariants hold for the indicated success value.
reasonsstring[]YesHuman-readable reasons the envelope failed validation (empty = valid).

CliOutputOptions

PropertyTypeRequiredDescription
commandstringYesCommand name (used to pick the correct human renderer).
messagestring | undefinedNoOptional success message for JSON envelope.
operationstring | undefinedNoOperation name for LAFS _meta.
pageimport("/mnt/projects/cleocode/packages/lafs/dist/src/types").LAFSPage | undefinedNoPagination for LAFS envelope.
extensionsRecord<string, unknown> | undefinedNoExtra LAFS extensions.

CliErrorDetails

Error details for structured error output.
PropertyTypeRequiredDescription
namestring | undefinedNoname
detailsunknownYesdetails
fixunknownYesfix

Gateway

CQRS gateway: read-only queries vs state-modifying mutations.
Gateway

Source

Where the request originated.
"cli"

Tier

Progressive disclosure tier. 0 = tasks + session (80% of agents) 1 = + memory + check (15% of agents) 2 = + pipeline + orchestrate + tools + admin + nexus (5%)
Tier

ParamType

The concrete value types a parameter can carry at runtime. Drives JSON Schema type and Commander argument/option parsing.
ParamType

ParamCliDef

CLI-specific decoration for a parameter. All fields are optional — omit the entire cli key for params with no CLI surface.
PropertyTypeRequiredDescription
positionalboolean | undefinedNoWhen true, registers as .argument('<name>') (positional). When false or omitted, registers as .option('--name <value>'). false
shortstring | undefinedNoShort flag alias, e.g. '-t' for --type, '-s' for --status. Only meaningful when positional is false/omitted.
flagstring | undefinedNoOverride the CLI flag name when it differs from the param’s name. e.g. name: 'includeArchive' but flag: 'include-archive' Defaults to kebab-case of name.
variadicboolean | undefinedNoFor array-type params on the CLI: when true the option can be repeated. When false/omitted, the CLI accepts a single comma-separated string. false
parse((value: string) => unknown) | undefinedNoCustom parse function applied by Commander (e.g. parseInt).

ParamDef

A fully-described parameter definition. One ParamDef entry drives Commander: .argument() (positional) or .option() (flag).
PropertyTypeRequiredDescription
namestringYesCanonical camelCase parameter name (matches the key in params dict).
typeParamTypeYesRuntime value type. Drives JSON Schema type and Commander parsing.
requiredbooleanYesWhen true, Commander registers as a positional argument (<name> or [name]).
descriptionstringYesHuman-readable description used in Commander help text.
cliParamCliDef | undefinedNoCLI-specific metadata. Omit entire key if this param has no CLI surface.
enumreadonly string[] | undefinedNoJSON Schema enum constraint for this parameter.
hiddenboolean | undefinedNoWhen true, the parameter is excluded from schema generation. Use for CLI-only params (e.g. --dry-run, --offset). false

CanonicalDomain

"memory" | "pipeline" | "session" | "tasks" | "check" | "orchestrate" | "tools" | "admin" | "nexus" | "sticky" | "conduit"

DispatchRequest

Canonical request shape that the CLI adapter produces. The dispatcher validates this against the OperationRegistry before passing it through the middleware pipeline and into a DomainHandler.
PropertyTypeRequiredDescription
gatewayGatewayYesCQRS gateway.
domainstringYesTarget domain (canonical name).
operationstringYesDomain-specific operation name.
paramsRecord<string, unknown> | undefinedNoOperation parameters (already sanitized by middleware).
source"cli"YesWhere this request came from.
requestIdstringYesUnique request identifier for tracing.
sessionIdstring | undefinedNoBound session ID, if any.
_fieldsstring[] | undefinedNoLAFS field selection: filter response data to these fields only.
_mviimport("/mnt/projects/cleocode/packages/lafs/dist/src/types").MVILevel | undefinedNoLAFS envelope verbosity. Defaults to ‘standard’. ‘custom’ is server-set via _fields.

RateLimitMeta

Rate limit metadata attached to every response.
PropertyTypeRequiredDescription
limitnumberYeslimit
remainingnumberYesremaining
resetMsnumberYesresetMs
categorystringYescategory

DispatchError

Structured error shape (LAFS-compatible).
PropertyTypeRequiredDescription
codestringYesMachine-readable error code (E_NOT_FOUND, E_VALIDATION_FAILED, …).
exitCodenumber | undefinedNoLAFS exit code (1-99).
messagestringYesHuman-readable message.
detailsRecord<string, unknown> | undefinedNoAdditional structured details.
fixstring | undefinedNoCopy-paste fix command.
alternatives{ action: string; command: string; }[] | undefinedNoAlternative actions the caller can try.
problemDetailsimport("/mnt/projects/cleocode/packages/core/dist/errors").ProblemDetails | undefinedNoRFC 9457 Problem Details (optional, populated from CleoError.toProblemDetails()).

DispatchResponse

Canonical response shape returned by the dispatcher. The CLI adapter translates this into cliOutput() / cliError() + process.exit().
PropertyTypeRequiredDescription
_meta{ [key: string]: unknown; gateway: Gateway; domain: string; operation: string; timestamp: string; duration_ms: number; source: Source; requestId: string; rateLimit?: RateLimitMeta; sessionId?: string; version?: string; }No_meta
successbooleanYessuccess
dataunknownYesdata
pageimport("/mnt/projects/cleocode/packages/lafs/dist/src/types").LAFSPage | undefinedNopage
partialboolean | undefinedNopartial
errorDispatchError | undefinedNoerror

DomainHandler

Contract for domain handlers. Each of the 9 target domains (tasks, session, memory, check, pipeline, orchestrate, tools, admin, nexus) implements this interface.
PropertyTypeRequiredDescription
query(operation: string, params?: Record<string, unknown>) => Promise<DispatchResponse>NoExecute a read-only query operation.
mutate(operation: string, params?: Record<string, unknown>) => Promise<DispatchResponse>NoExecute a state-modifying mutation operation.
getSupportedOperations() => { query: string[]; mutate: string[]; }YesDeclared operations for introspection and validation.

DispatchNext

Async function that produces a DispatchResponse.
DispatchNext

Middleware

Middleware function signature. Receives the request and a next continuation. Can short-circuit by returning early (e.g., rate-limit exceeded) or modify the request/response.
Middleware

OperationDef

Definition of a single dispatchable operation.
PropertyTypeRequiredDescription
gatewayGatewayYesThe CQRS gateway (‘query’ or ‘mutate’).
domain"memory" | "pipeline" | "session" | "tasks" | "check" | "orchestrate" | "tools" | "admin" | "nexus" | "sticky" | "conduit"YesThe canonical domain this operation belongs to.
operationstringYesThe specific operation name (e.g. ‘show’, ‘skill.list’).
descriptionstringYesBrief description of what the operation does.
tierTierYesAgent progressive-disclosure tier (0=basic, 1=memory/check, 2=full).
idempotentbooleanYesWhether the operation is safe to retry.
sessionRequiredbooleanYesWhether this operation requires an active session.
requiredParamsstring[]YesList of parameter keys that MUST be present in the request.
paramsParamDef[] | undefinedNoFully-described parameter list. Replaces requiredParams when populated. Empty array = “no declared params” (not “no params accepted”). Optional during T4897 migration — defaults to [] when absent.

Resolution

Resolution output for a dispatch request.
PropertyTypeRequiredDescription
domain"memory" | "pipeline" | "session" | "tasks" | "check" | "orchestrate" | "tools" | "admin" | "nexus" | "sticky" | "conduit"YesThe canonical domain.
operationstringYesThe operation name.
defOperationDefYesThe definition of the matched operation.

DispatcherConfig

PropertyTypeRequiredDescription
handlersMap<string, DomainHandler>Yeshandlers
middlewaresMiddleware[] | undefinedNomiddlewares

ProviderMatrixEntry

Coverage summary for a single provider in the hook matrix.
PropertyTypeRequiredDescription
providerIdstringYesCAAMP provider identifier (e.g. “claude-code”).
supportedCountnumberYesNumber of canonical events this provider supports.
totalCanonicalnumberYesTotal canonical events in the taxonomy.
coveragenumberYesCoverage percentage (0-100, integer).
supportedstring[]YesCanonical events supported by this provider.
unsupportedstring[]YesCanonical events not supported by this provider.

HookMatrixResult

Full hook matrix result.
PropertyTypeRequiredDescription
caampVersionstringYesCAAMP hook mappings version.
eventsstring[]YesAll canonical event names (rows).
providersstring[]YesProvider IDs included in the matrix (columns).
matrixRecord<string, Record<string, boolean>>YesTwo-dimensional matrix: event name → provider ID → support flag. true means the provider natively supports the canonical event.
summaryProviderMatrixEntry[]YesPer-provider summary with coverage stats.
detectedProviderstring | nullYesProvider ID detected as the current runtime, or null.

RuntimeData

RuntimeDiagnostics

DashboardData

Dashboard data shape returned by systemDash.
PropertyTypeRequiredDescription
projectstringYesProject name or directory basename.
currentPhasestring | nullYesCurrently active project phase, or null.
summary{ pending: number; active: number; blocked: number; done: number; cancelled: number; total: number; archived: number; grandTotal: number; }YesTask count breakdown by status.
taskWork{ currentTask: string | null; task: TaskRecord | null; }YesCurrently focused task work state.
activeSessionstring | nullYesActive session ID, or null.
highPriority{ count: number; tasks: TaskRecord[]; }YesHigh-priority tasks summary.
blockedTasks{ count: number; limit: number; tasks: TaskRecord[]; }YesBlocked tasks summary.
recentCompletionsTaskRecord[]YesRecently completed task records.
topLabels{ label: string; count: number; }[]YesMost frequently used labels with counts.

StatsData

Project statistics data shape returned by systemStats.
PropertyTypeRequiredDescription
currentState{ pending: number; active: number; done: number; blocked: number; cancelled: number; totalActive: number; archived: number; grandTotal: number; }YesCurrent task counts by status.
byPriorityRecord<string, number>YesTask counts grouped by priority level.
byTypeRecord<string, number>YesTask counts grouped by task type.
byPhaseRecord<string, number>YesTask counts grouped by project phase.
completionMetrics{ periodDays: number; completedInPeriod: number; createdInPeriod: number; completionRate: number; }YesCompletion rate metrics over the configured period.
activityMetrics{ createdInPeriod: number; completedInPeriod: number; archivedInPeriod: number; }YesActivity metrics over the configured period.
allTime{ totalCreated: number; totalCompleted: number; totalCancelled: number; totalArchived: number; archivedCompleted: number; }YesLifetime metrics across all time.
cycleTimes{ averageDays: number | null; samples: number; }YesAverage time from creation to completion.

LogQueryData

Paginated operation log query result.
PropertyTypeRequiredDescription
entries{ [key: string]: unknown; operation: string; taskId?: string; timestamp: string; }[]NoLog entries matching the query.
pagination{ total: number; offset: number; limit: number; hasMore: boolean; }YesPagination metadata.

ContextData

Context window monitoring data.
PropertyTypeRequiredDescription
availablebooleanYesWhether context data is available.
statusstringYesStatus level (ok, warning, caution, critical, emergency).
percentagenumberYesUsage percentage (0-100).
currentTokensnumberYesCurrent token usage.
maxTokensnumberYesMaximum context window size.
timestampstring | nullYesISO timestamp of last update, or null.
stalebooleanYesWhether the data is stale (older than configured threshold).
sessions{ file: string; sessionId: string | null; percentage: number; status: string; timestamp: string; }[]YesPer-session context state entries.

SequenceData

Task ID sequence state.
PropertyTypeRequiredDescription
counternumberYesCurrent counter value.
lastIdstringYesLast assigned task ID.
checksumstringYesIntegrity checksum.
nextIdstringYesNext task ID that would be assigned.

RoadmapData

Project roadmap data with upcoming epics and release history.
PropertyTypeRequiredDescription
currentVersionstringYesCurrent project version.
upcoming{ id: string; title: string; status: string; priority: string; phase?: string; childCount: number; completedChildren: number; }[]NoUpcoming epics and milestones.
releaseHistory{ version: string; date: string; }[] | undefinedNoPast releases.
completedEpicsnumber | undefinedNoTotal completed epics.
summary{ totalUpcoming: number; totalTasks: number; }YesSummary counts.

ComplianceData

Compliance monitoring data.
PropertyTypeRequiredDescription
totalEntriesnumberYesTotal compliance audit entries.
averagePassRatenumberYesAverage pass rate (0-100).
averageAdherencenumberYesAverage adherence score (0-100).
totalViolationsnumberYesTotal violation count.
trendstring | undefinedNoTrend direction (improving, declining, stable).
dataPoints{ date: string; entries: number; avgPassRate: number; violations: number; }[] | undefinedNoHistorical data points for charting.

HelpData

Help topic content and related commands.
PropertyTypeRequiredDescription
topicstring | undefinedNoTopic identifier.
contentstringYesHuman-readable help content.
relatedCommandsstring[] | undefinedNoRelated CLI commands for cross-reference.

SyncData

PropertyTypeRequiredDescription
directionstringYesdirection
syncednumberYessynced
conflictsnumberYesconflicts
messagestringYesmessage

PathsData

Summary of all resolved CleoOS paths (project + global hub).
PropertyTypeRequiredDescription
projectCleoDirstringYesProject-local .cleo directory (absolute).
cleoHomestringYesXDG-compliant global data root (Linux: ~/.local/share/cleo).
configDirstringYesXDG config dir (Linux: ~/.config/cleo).
hub{ globalRecipes: string; globalJustfile: string; piExtensions: string; cantWorkflows: string; globalAgents: string; }YesCleoOS Hub subdirectories under cleoHome.
scaffolded{ globalRecipes: boolean; globalJustfile: boolean; piExtensions: boolean; cantWorkflows: boolean; globalAgents: boolean; }YesScaffolding status — true if hub directories + seed files exist.

ScaffoldHubData

Result of scaffolding the CleoOS Hub.
PropertyTypeRequiredDescription
action"created" | "skipped" | "repaired"Yesaction
pathstringYespath
detailsstring | undefinedNodetails

SmokeProbe

Result for a single domain smoke probe.
PropertyTypeRequiredDescription
domainstringYesdomain
operationstringYesoperation
status"pass" | "fail" | "skip"Yesstatus
timeMsnumberYestimeMs
errorstring | undefinedNoerror

SmokeResult

Aggregate smoke test result.
PropertyTypeRequiredDescription
probesSmokeProbe[]Yesprobes
dbChecksSmokeProbe[]YesdbChecks
passednumberYespassed
failednumberYesfailed
skippednumberYesskipped
totalMsnumberYestotalMs

EngineResult

Engine result shape accepted by wrapResult. Matches the union of what all engine functions return.
PropertyTypeRequiredDescription
successbooleanYessuccess
dataunknownYesdata
pageimport("/mnt/projects/cleocode/packages/lafs/dist/src/types").LAFSPage | undefinedNopage
error{ code: string; message: string; details?: unknown; exitCode?: number; fix?: string; alternatives?: Array<{ action: string; command: string; }>; problemDetails?: ProblemDetails; } | undefinedNoerror

JobStatus

Background job status
JobStatus

BackgroundJob

Background job representation
PropertyTypeRequiredDescription
idstringYesid
operationstringYesoperation
statusJobStatusYesstatus
startedAtstringYesstartedAt
completedAtstring | undefinedNocompletedAt
resultunknownYesresult
errorstring | undefinedNoerror
progressnumber | undefinedNoprogress

BackgroundJobManagerConfig

Configuration for BackgroundJobManager
PropertyTypeRequiredDescription
maxJobsnumber | undefinedNomaxJobs
retentionMsnumber | undefinedNoretentionMs

SessionContext

Immutable snapshot of the bound session context.
PropertyTypeRequiredDescription
sessionIdstringYesActive session ID.
scope{ type: string; epicId?: string; }NoSession scope.
gradeModebooleanYesWhether full audit logging is enabled for behavioral grading.
agentPidnumberYesPID of the process that bound this context.
boundAtstringYesISO timestamp when this context was bound.

RateLimitConfig

Per-category rate limit thresholds.
PropertyTypeRequiredDescription
maxRequestsnumberYesMaximum number of requests allowed within the window.
windowMsnumberYesSliding window duration in milliseconds.

RateLimitingConfig

Full rate limiting configuration across all categories.
PropertyTypeRequiredDescription
enabledbooleanYesWhether rate limiting is active.
queryRateLimitConfigYesLimits for read-only query operations.
mutateRateLimitConfigYesLimits for mutate (write) operations.
spawnRateLimitConfigYesLimits for spawn (subagent launch) operations.

LifecycleEnforcementConfig

Lifecycle enforcement configuration (Section 12.2)
PropertyTypeRequiredDescription
mode"strict" | "advisory" | "off"YesEnforcement mode: strict blocks, advisory warns, off skips
allowSkipstring[]YesStages that may be skipped without failing gates
emergencyBypassbooleanYesEmergency bypass flag - disables all gate checks

ProtocolValidationConfig

Protocol validation configuration (Section 12.3)
PropertyTypeRequiredDescription
strictModebooleanYesEnable strict protocol validation
blockOnViolationbooleanYesBlock operations on protocol violations
logViolationsbooleanYesLog protocol violations to audit trail

DispatchConfig

PropertyTypeRequiredDescription
cliPathstringYesPath to CLEO CLI binary (default: ‘cleo’)
timeoutnumberYesOperation timeout in milliseconds (default: 30000)
logLevel"error" | "warn" | "info" | "debug"YesLogging verbosity level (default: ‘info’)
enableMetricsbooleanYesEnable token tracking metrics (default: false)
maxRetriesnumberYesRetry count for failed operations (default: 3)
queryCachebooleanYesEnable query cache (default: true)
queryCacheTtlnumberYesQuery cache TTL in milliseconds (default: 30000)
auditLogbooleanYesEnable audit logging (default: true)
strictValidationbooleanYesStrict validation mode (default: true)
lifecycleEnforcementLifecycleEnforcementConfigYesLifecycle enforcement configuration (Section 12.2)
protocolValidationProtocolValidationConfigYesProtocol validation configuration (Section 12.3)
rateLimitingRateLimitingConfigYesRate limiting configuration (Section 13.3)

MCPConfig

Alias for DispatchConfig.
DispatchConfig

ProgressOptions

PropertyTypeRequiredDescription
enabledbooleanYesWhether to show progress (true for human mode, false for JSON mode)
prefixstring | undefinedNoPrefix for progress messages

MviTier

Disclosure tier level for MVI (Minimum Viable Information) filtering.
MviTier

ProjectionConfig

Configuration for a single MVI projection tier.
PropertyTypeRequiredDescription
allowedDomainsstring[]YesOperations allowed at this tier
excludeFieldsstring[] | undefinedNoFields to exclude from responses
maxDepthnumber | undefinedNoMaximum depth for nested objects

ProjectionContext

PropertyTypeRequiredDescription
tierMviTierYestier
configProjectionConfigYesconfig