Skip to main content

Kernel reference

Handwritten from src/PSLoom/PSLoom.psd1, Cmdlets, Verbs and runtime exception classes in PSLoom/PSLoom. Cmdlets appear in manifest order. Positions are zero-based; named means no positional binding. Common PowerShell parameters are omitted. SwitchParameter values are switches; ? denotes a nullable .NET value.

Cmdlets​

Invoke-Loom​

Provisions harnesses, validates and executes a draft once per session, then raises SessionStarting.

NameTypePositionMandatoryDescription
DraftScriptBlock0YesThe complete draft.
ValidateSwitchParameternamedNoImport installed harnesses and validate; no execution or installation.
ReweaveSwitchParameternamedNoReapply an edited draft in an already woven session.
Invoke-Loom -Draft { Style ':example:*' enabled $true }

Prepass/provisioning/scope errors block execution. Verb failures are collected and written once as non-terminating errors. An ordinary terminating PowerShell statement can end the draft; verb isolation does not make arbitrary scripts transactional.

Measure-Loom​

Reports the last draft's phase and verb timings, plus staged-application timings.

NameTypePositionMandatoryDescription
GroupByGrouping0NoNone (default), Harness, or Verb; grouping aggregates only verb rows.
Measure-Loom -GroupBy Harness

Get-Shed​

Lists staged statements, their timing, state, duration and failures.

NameTypePositionMandatoryDescription
StateShedState[]0NoFilter by Pending, Armed, Applied, Skipped, Failed, Superseded; omitted means all.
Get-Shed -State Failed,Pending

Armed is reserved for on-demand application, which is not implemented.

Update-Harness​

Updates installed first-party harness modules from PSGallery for the next session.

NameTypePositionMandatoryDescription
Namestring[]0NoHarness names; omitted means every installed first-party harness.

Supports -WhatIf and -Confirm. Does not install absent harnesses.

Update-Harness Reed -WhatIf

Register-Hook​

Registers a script handler and wires its hook kind on first use.

NameTypePositionMandatoryDescription
KindHookKind0YesHook kind from the guide.
ActionScriptBlock1YesReceives HookInvocation as $_ and first argument.
NamestringnamedNoSame kind/name replaces its prior registration.
Register-Hook PrePrompt { $global:lastPrompt = Get-Date } -Name clock

Unregister-Hook​

Removes a registration by identifier or kind/name; wiring stays installed.

NameTypePositionMandatoryDescription
IdGuid0Yes, ByIdDefault parameter set; binds pipeline property Id.
KindHookKindnamedYes, ByNameKind of the named registration.
NamestringnamedYes, ByNameName of the registration.
Unregister-Hook -Kind PrePrompt -Name clock

Get-Hook​

Lists registrations in registration order, optionally filtered by kind and case-insensitive name.

NameTypePositionMandatoryDescription
KindHookKind?0NoKind filter.
NamestringnamedNoRegistration name filter.
Get-Hook PrePrompt

Trace-Hook​

Lists recent invocations oldest first, including duration, slow flag and exception.

NameTypePositionMandatoryDescription
Lastint?0NoMost recent count, zero or greater; omitted returns all retained entries.
Trace-Hook -Last 10

Set-Style​

Defines or replaces a style value for a context pattern, then runs affected watchers.

NameTypePositionMandatoryDescription
Contextstring0YesCase-sensitive PowerShell wildcard pattern.
Namestring1YesStyle name.
Valueobject?2YesAllows null, empty string and empty collection.
Set-Style ':example:*' enabled $true

Get-Style​

Resolves a style for a concrete context, writing nothing when no pattern matches unless a default was supplied.

NameTypePositionMandatoryDescription
Contextstring0YesConcrete context.
Namestring1YesStyle name.
Defaultobject?namedNoValue when no definition resolves; allows null.
Get-Style ':example:git' enabled -Default $false

Test-Style​

Tests whether a resolved value means enabled.

NameTypePositionMandatoryDescription
Contextstring0YesConcrete context.
Namestring1YesStyle name.

True values include boolean true, nonzero integers, and strings true, yes, 1, on, enabled.

Test-Style ':example:git' enabled

Remove-Style​

Removes an exact stored context-pattern/name pair and runs affected watchers.

NameTypePositionMandatoryDescription
Contextstring0YesExact stored pattern; binds pipeline property.
Namestring1YesStyle name; binds pipeline property.
Remove-Style ':example:*' enabled

Get-StyleDefinition​

Lists stored definitions in definition order, without resolving a winning pattern.

NameTypePositionMandatoryDescription
Contextstring0NoExact stored context-pattern filter.
Namestring1NoName filter.
Get-StyleDefinition -Name enabled

Register-StyleWatcher​

Registers a script receiving StyleChange as $_ and its first argument.

NameTypePositionMandatoryDescription
Contextstring0YesConcrete context, or pattern with -Pattern.
Namestring1YesStyle name.
ActionScriptBlock2YesHandler after committed writes.
PatternSwitchParameternamedNoObserve every matching written context pattern.
ReplaySwitchParameternamedNoImmediately replay resolved value, or each matching stored definition in pattern mode.
$watcher = Register-StyleWatcher ':example:git' enabled { param($change) $global:lastStyleChange = $change } -Replay

Unregister-StyleWatcher​

Removes a style watcher by registration identifier.

NameTypePositionMandatoryDescription
IdGuid0YesWatcher identifier; binds pipeline property Id.
$watcher | Unregister-StyleWatcher

Trace-Style​

Lists recent watcher runs oldest first, with duration and exception.

NameTypePositionMandatoryDescription
Lastint?0NoMost recent count, zero or greater; omitted returns all retained entries.
Trace-Style -Last 10

New-Treadle​

Defines a global function that invokes a command with baked arguments followed by caller arguments.

NameTypePositionMandatoryDescription
Namestring0YesNonempty treadle name.
Commandobject1YesNon-null string or script block containing one constant command.
ForceSwitchParameternamedNoReplace a colliding command.
PassThruSwitchParameternamedNoEmit the TreadleDefinition.
New-Treadle glog { git log --oneline } -PassThru

Get-Treadle​

Lists all treadles or those matching supplied names.

NameTypePositionMandatoryDescription
Namestring[]0NoCase-insensitive names or wildcard patterns.
Get-Treadle 'g*'

Remove-Treadle​

Removes treadles and their installed functions while leaving unrelated same-named commands alone.

NameTypePositionMandatoryDescription
Namestring[]0YesNonempty names; accepts pipeline values and properties.
Remove-Treadle glog

Draft verbs​

These are scoped vocabulary, not exported cmdlets. All three are valid in DraftScope; none opens a nested scope.

Thread​

Declares a first-party harness for provisioning before execution. Reweave behavior: Additive; key: Name.

NameTypePositionMandatoryDescription
Namestring0YesTop-level literal harness name.
VersionVersion?namedNoLiteral pinned module version.
Invoke-Loom { Thread Reed }

Style​

Defines a style as Set-Style does. Reweave behavior: Replay; keys: Context, Name; removed definitions can be reverted.

NameTypePositionMandatoryDescription
Contextstring0YesContext pattern.
Namestring1YesStyle name.
Valueobject?2YesAllows null, empty string and empty collection.
Invoke-Loom { Style ':example:*' enabled $true }

Treadle​

Defines a shortcut as New-Treadle does, without a force switch. Reweave behavior: Replay; key: Name; removal can be reverted.

NameTypePositionMandatoryDescription
Namestring0YesTreadle name.
BodyScriptBlock1YesSingle constant command template; not an [OpensScope] body.
Invoke-Loom { Treadle glog { git log --oneline } }

Shed​

The kernel parses this top-level modifier before execution; it is not a [LoomVerb] class and does not accept ordinary cmdlet common parameters. It applies to the next statement. No positional arguments and no modifiers are mandatory.

NameTypePositionMandatoryDescription
WaitswitchnamedNoQueue in default slot 0a.
Slotliteral stringnamedNoQueue in numeric slot plus a, b or c, e.g. '1b'.
OnDemandswitchnamedNoReserved; currently rejected for every statement.
LoadIfScriptBlocknamedNoEvaluate a condition at application time.
RequiresCommandliteral stringnamedNoRequire a discoverable command at application time.
LucidswitchnamedNoSuppress success output.
SilentswitchnamedNoSuppress the deferred failure summary warning at the prompt.
AtLoadScriptBlocknamedNoRun after successful application.
Invoke-Loom {
Shed -Wait -Lucid
Get-Date
}
Get-Shed

Only one of Wait, Slot, OnDemand is permitted. It cannot precede Thread, another Shed, or the end of a draft. See sheds.

Error ids​

Runtime exceptions use the following identifiers. PowerShell may append the cmdlet's type to FullyQualifiedErrorId. LOOM_REWEAVE_REQUIRES_RESTART is warning text rather than an exception.

IdRaised when
LOOM_NO_RUNSPACENo current runspace exists.
LOOM_NO_ENGINEEngine intrinsics are unavailable.
LOOM_HARNESS_NAME_INVALIDA harness name is not a letter followed by letters/digits.
LOOM_HARNESS_DUPLICATEAnother type already owns the harness name.
LOOM_HARNESS_COMPOSE_FAILEDHarness composition throws; registrations are rolled back.
LOOM_HARNESS_NOT_COMPOSEDA harness is requested before composition.
LOOM_HARNESS_NOT_INSTALLEDRequired module/version is absent when it cannot be installed.
LOOM_HARNESS_IMPORT_FAILEDModule import fails.
LOOM_NOT_A_HARNESSImported module did not register the expected harness.
LOOM_API_DUPLICATEAnother harness already published the API type.
LOOM_VERB_ATTRIBUTE_MISSINGRegistered verb lacks [LoomVerb].
LOOM_VERB_NAME_INVALIDInvalid DSL verb identifier.
LOOM_VERB_NO_SCOPEVerb attribute lists no scope.
LOOM_VERB_DUPLICATEName already registered in a scope.
LOOM_VERB_OUT_OF_SCOPEVerb is used outside its allowed scopes.
LOOM_THREAD_NOT_TOP_LEVELThread is nested.
LOOM_THREAD_NAME_NOT_LITERALThread name is computed.
LOOM_THREAD_NOT_PREPAREDHarness was not loaded before execution.
LOOM_DRAFT_STATEMENT_FAILEDStatement failure has no more specific PowerShell error record.
LOOM_HARNESS_NOT_FIRST_PARTYThread/update names a harness outside the allowlist.
LOOM_HARNESS_INSTALL_FAILEDMissing module cannot be installed.
LOOM_HARNESS_UPDATE_FAILEDExplicit update fails.
LOOM_HARNESS_VERSION_CONFLICTRequested harness version differs from the loaded version.
LOOM_THREAD_VERSION_NOT_LITERALVersion is not a valid literal.
LOOM_THREAD_VERSION_CONFLICTDuplicate thread declarations request differing versions.
LOOM_REWEAVE_REQUIRES_RESTARTRemoved invocation cannot be reverted (warning).
LOOM_REWEAVE_REVERT_FAILEDReverting a removed invocation fails.
LOOM_SHED_NOT_TOP_LEVELShed is nested.
LOOM_SHED_DANGLINGNo statement follows Shed.
LOOM_SHED_STACKEDTwo Shed statements occur consecutively.
LOOM_SHED_NOT_LITERALModifier value has the wrong literal/script-block form.
LOOM_SHED_TIMING_CONFLICTMultiple timing modifiers are supplied.
LOOM_SHED_NOT_ON_DEMANDTarget does not support on-demand application (all current targets).
LOOM_SHED_NOT_APPLICABLETarget cannot be staged, such as Thread.
LOOM_SHED_UNKNOWN_MODIFIERModifier is unknown or ambiguous.
LOOM_SHED_APPLY_FAILEDStaged application fails outside a more specific error channel.
STYLE_INVALID_KEYEmpty context or style name.
STYLE_WATCHER_RECURSIONWatcher nesting exceeds the limit.
STYLE_WATCHER_FAILEDWatcher throws after a committed write.
HOOK_WIRING_FAILEDWiring a hook kind fails.
HOOK_UNKNOWN_KINDInvalid hook enum value.
HOOK_HANDLER_FAILEDHook handler throws.
TREADLE_BODY_NOT_SINGLE_COMMANDBody contains nonconstant arguments or is not one command.
TREADLE_NAME_COLLISIONExisting command collides without -Force.
TREADLE_INVALID_NAMEName contains unsupported characters.
TREADLE_SUBSCRIBER_FAILEDCatalog subscriber fails after a change.

The contract assembly can additionally report these identifiers during kernel/harness use:

IdRaised when
WARP_CONTRACT_MISMATCHHarness lacks a Warp reference or targets another contract major.
WARP_HARNESS_ATTRIBUTE_MISSINGHarness type lacks [Harness].
WARP_KERNEL_UNAVAILABLENo kernel is attached.
WARP_KERNEL_ALREADY_ATTACHEDA different kernel is already attached to the process.
WARP_FRAME_MISSINGRequired enclosing DSL frame is absent.
WARP_VERB_OUTSIDE_LOOMA verb runs outside a loom/DSL invocation.
WARP_VERB_UNHANDLED_EXCEPTIONVerb throws an exception without a more specific contract error.
WARP_SCOPE_INVALIDReferenced scope type does not satisfy DSL scope rules.
CREEL_PATH_ESCAPEStorage path is rooted, invalid, escapes the root or crosses an escaping link.