Skip to content

ADR-0007: Extension loading and updates

Status: Accepted — 2026-09-23. The project owner approved this decision. Acceptance establishes the architectural contract; it does not establish a completed implementation or successful execution of outstanding checks.

English | Русский

Refinement — 2026-09-24: shared CLI/MCP and agent-use additions are accepted under ADR-0013 and ADR-0014–0016. The original acceptance date and historical evidence remain unchanged; the new requirements are not claimed implemented or verified.

Extensions are published by different teams and delivered through OCI registries, hosted HTTPS or Git. The loader must turn an eligible catalog entry into a verified, selected release without executing package code during discovery or installation. Updates must not replace files underneath a running command or expose a partially updated command tree.

ADR-0005 defines permitted discovery through Security Broker; ADR-0006 defines descriptor meaning. This ADR defines release identity, source-adapter responsibilities and installation/activation semantics. These decisions are accepted; implementation evidence is recorded separately. Runtime preparation remains ADR-0008, distinct from installing an extension.

  • A package retains its identity across approved mirrors and delivery formats.
  • Permission, publisher trust, content integrity and compatibility are separate checks.
  • Installation and updates preserve a usable committed state on interruption.
  • Concurrent invocations keep their selected release and environment.
OptionBenefitLimitation
Install directly from mutable source referencesSimple deliveryA moved tag or partial overwrite can change an invocation’s code
Separate lifecycle for every registry typeUses each source’s conventionsDifferent trust, rollback and update behavior
Common verified release with source adapters and activation generationsOne lifecycle and pinned identityRequires immutable storage, a transaction boundary and recovery checks

Source adapters locate and retrieve bytes. The loader verifies a common release, stores it without in-place replacement, and activates commands by committing a complete configuration generation. Discovery, installation, activation and execution are distinct operations with their own checks.

A release is identified by (authority, package, version, releaseDigest). The authority is an owner-trusted publisher namespace, not a registry hostname or display name. Within that namespace, one package version binds to one digest; conflicting bytes are rejected, not selected by mirror order.

The versioned release envelope contains the authority/package/version claim, a descriptor reference with digest and size, target-specific payload references, and dependency artifact/lock references. releaseDigest is SHA-256 of the exact UTF-8 envelope bytes; it is not a field inside those bytes. The client does not reserialize before hashing. The owner-approved trust profile binds that digest to an authorized publisher, using an explicitly approved identity/digest binding or verified signature/provenance evidence. This does not define another release identity. Mirroring identical bytes preserves identity. A digest alone proves integrity, not publisher authority.

The owner supplies namespace trust and acceptable verification evidence. Installation requires an explicit trust decision and valid content binding; a publisher name or successful registry login is insufficient. The baseline can use a publisher/package/release digest explicitly approved in trusted owner configuration or in a catalog shipped by the owner. It does not require a signing service. A checksum obtained only from the same untrusted source is insufficient, and a simple trust profile cannot bypass a source/domain requirement for stronger evidence. Exact signing envelopes, trust-root distribution and metadata freshness/revocation are separate contracts. A loader adapter must report unavailable required trust evidence instead of silently treating a checksum as authorization.

The selected data format is rukh.release/1. It is a design contract, not a released SDK. A strict UTF-8 JSON object rejects duplicate keys, unknown fields, malformed numbers and unsupported format versions before payload retrieval. The descriptor and envelope must agree exactly on identity; the identifier and SemVer rules are those in ADR-0006. A namespace is an owner-bound name, not a requirement to own a DNS domain.

FieldMeaning and validation
formatExactly rukh.release/1
identityObject containing authority, package, version; no display name or source URL substitutes for identity
descriptor{digest, size} for exactly one supported JSON descriptor: rukh.extension/1 or rukh.extension/2, selected by its validated format
artifactsArray of unique {id, digest, size, mediaType} records; IDs use ADR-0006 local-ID syntax
targetsArray of {id, os, arch, abi, payloads, locks}; payloads maps artifact IDs to relative installation paths, locks names artifact IDs used as runtime dependency locks
annotationsOptional string map, at most 32 entries and 8 KiB in total; never affects execution, identity or authorization

Every digest is sha256: followed by 64 lowercase hexadecimal characters; every size is an exact non-negative integer byte count. Payload/lock references must resolve in this envelope. No implicit dependency resolution, archive download or code generation follows from an annotation. mediaType selects only a registered data decoder: baseline payloads are raw files or gzip-compressed TAR, and locks are raw files. An unsupported decoder is a compatibility rejection. Extraction rules below apply equally to all decoders.

Targets have unique IDs using the same local-ID grammar. os and arch are concrete executor-supported identifiers; abi is an explicit supported ABI identifier or none. Exactly one compatible release target is selected, or an owner binding explicitly selects one of several matches; zero matches or unresolved ambiguity is rejected. The descriptor’s entry-point candidates are then restricted to this releaseTarget ID, after which ADR-0006 requires one matching entry-point binding. These are consecutive checks, not independent platform choices. A package may contain targets for platforms that this CLI does not support, without implying executor support. Entry points and lock references in the selected descriptor binding must resolve inside the selected verified payloads. Runtime build selection remains ADR-0008.

Locations are source-adapter data associated with these digests, outside the envelope’s identity. Moving identical content between approved mirrors does not change the release. A mutable source tag may help find an update but cannot override the expected release digest. Version ordering never authorizes a release: update selection excludes prereleases unless explicitly allowed, rejects same-version/different-digest conflicts, and never installs a lower version without an explicit rollback request. Equal SemVer precedence with different build metadata requires an exact version choice, not source order.

The catalog source is independent of artifact delivery. Under ADR-0009, one validated bundled/local JSON catalog is sufficient; Git or static HTTPS can distribute it without a catalog server, login or CI. A service-based catalog uses the same discovery contract. Catalog/group/rule publication and extension releases remain different versioned objects. For broker-dependent entries the permitted discovery path below still applies, even when that broker’s catalog and rule providers are local declarations.

SourceResolution to the common releaseWhat it does not establish
OCI registryResolve a selected reference to a pinned OCI manifest digest; retrieve the release envelope and referenced blobsOCI digest alone does not prove publisher authority or extension permission
Hosted HTTPSApproved catalog entry identifies the envelope and content hashes; fetch bounded metadata/blobs from permitted destinationsA mutable URL or JSON index alone is not trusted release metadata
GitApproved repository, full commit identity and explicit artifact paths; obtain the envelope and published payloads as dataA source commit is not proof of a reproducible binary build

OCI descriptors provide content references, and Git revision resolution identifies objects; neither defines Rukh’s complete release contract. OCI descriptors, Git revision resolution.

The selected OCI binding uses an artifact manifest with artifactType: application/vnd.rukh.release.v1+json, exactly one envelope layer of that media type, one descriptor layer whose media type matches its format (application/vnd.rukh.extension.v1+json for version 1 or application/vnd.rukh.extension.v2+json for version 2), and the declared artifact blobs as remaining layers. Unknown descriptor versions, mismatched media types or unsupported requirements are rejected without conversion or downgrade. The release envelope stays rukh.release/1; its content-addressed descriptor binding is unchanged. Descriptor/blob digests and sizes must agree with the envelope; an unexpected executable payload is not implicitly installed. OCI manifest digest and Rukh envelope digest remain different identifiers and are checked separately. An OCI image is not started as a container by this loader. HTTPS and Git bindings provide a bounded digest-to-location map; it selects a URL or a full-commit blob path, never filesystem destinations or shell commands. Required entries must resolve uniquely. All bindings return the same envelope and payload bytes to common verification.

Adapters use owner-controlled configuration and credentials. Git hooks, checkout filters, package installation hooks and publisher build scripts do not run in the ordinary loading path. Submodules, LFS and external blobs require explicit verified artifact treatment rather than implicit fetching/execution. A source-only repository must publish release artifacts or use a separate authorized build workflow; installation is not a hidden local build.

Each adapter implements resolve, fetch and cancel against the same bounded operation context. resolve returns the expected envelope digest, exact source revision and locations for content, without execution or installation; the loader compares it with the trusted catalog entry. fetch streams into loader-owned staging and reports exact size and digest; the loader independently verifies both. A fetch result cannot change identity, trust roots, destination paths or access domain. Cancellation stops new transfers and bounds cleanup; a failed fetch never publishes a partial object. An identical verified local object may be reused after checking current trust and installation permission.

Network locations use explicitly configured HTTPS origins; redirects are limited to three and each destination is checked again. Credentials stay with their configured origin and operation, and are never forwarded across origins. Git may additionally use an explicitly configured SSH endpoint with host-key verification; its object database is read without checkout filters or hooks. Ambient Git helpers, alternate transports and repository configuration cannot add executable hooks or destinations. A local source must lie inside an owner-approved root; links cannot escape it. The loader does not turn off TLS/host verification or request elevation as an automatic fallback. Git exposes direct object reads separately from filtered content. Git object access.

For broker-dependent extensions, Security Broker supplies permitted references, which the loader resolves through approved source bindings. Public/non-broker sources still follow explicit owner policy. Broker eligibility neither validates bytes nor grants every command. The loader preserves the bound access domain through mirrors and updates; a descriptor cannot remove that requirement. Catalog, install and activation decisions cannot substitute for execution checks.

This component view separates permission-aware discovery from artifact delivery. Arrows represent responsibilities, not a selected network protocol.

Accepted loader boundaries
Accepted loader boundariesThe loader combines permitted references from Security Broker or explicit owner source policy with bytes from approved source adapters. It verifies the common release and descriptor before committing command activation. Runtime preparation remains separate.Security BrokerExtension loaderCLI owner policyOCI, HTTPS and Git adaptersVerified immutable releasestoreComplete commandgenerationActive command treePermitted extension referencesTrust, sources and non-brokerdiscoveryPinned metadata and bytesIdentity, integrity and descriptorchecksSelected releases and mountsAtomic publicationAccepted loader boundariesThe loader combines permitted references from Security Broker or explicit owner source policy with bytes from approved source adapters. It verifies the common release and descriptor before committing command activation. Runtime preparation remains separate.Security BrokerExtension loaderCLI owner policyOCI, HTTPS and Git adaptersVerified immutable releasestoreComplete commandgenerationActive command treePermitted extension referencesTrust, sources and non-brokerdiscoveryPinned metadata and bytesIdentity, integrity and descriptorchecksSelected releases and mountsAtomic publication
StepResponsibility
DiscoverObtain visible candidates and compatibility metadata, with completeness/errors preserved; no extension execution or runtime preparation
ResolveSelect one exact release and target under owner policy; pin all mutable source references before downloading payloads
Stage and verifyFetch into a private bounded area; verify origin evidence, digests, sizes, descriptor and extraction safety
InstallPublish a complete immutable artifact record; installed does not mean active or authorized to execute
ActivateBuild and validate the entire candidate command tree and owner bindings, then commit one generation
InvokePin a committed generation/release, perform ADR-0002 checks and prepare the environment under ADR-0008 when needed

The portable payload profile contains only regular files and directories. Extraction rejects absolute/escaping paths, ./.. segments, NUL/control characters, backslashes, drive/UNC prefixes, alternate data streams, reserved device names, trailing dots/spaces, links, reparse points and special files. Relative paths use /; collisions after Unicode NFC normalization and case folding are rejected even on a case-sensitive target. The decoder does not apply archive ownership, ACLs or privileged mode bits. Only the selected verified entry points receive execution permission when the platform needs it. Creation is relative to a private loader-owned directory with no-follow checks, never by concatenating an untrusted absolute path. These restrictions are format rules, not a claim that publisher code is sandboxed.

The baseline limits are explicit so a loader cannot silently choose an unbounded implementation:

ResourceBaseline limit
Envelope / descriptor1 MiB each; JSON depth 32, 65,536 total members/elements
Artifacts / targets / path256 artifact records, 64 targets; 1,024 UTF-8 bytes per relative path and 32 path segments
Selected downloaded / expanded payload512 MiB / 2 GiB total; one file at most 512 MiB; 50,000 filesystem entries
One operationMetadata 30 s; download and extraction 15 min in total; no transfer progress for 60 s terminates that transfer
Concurrency and cleanupTwo installation preparations per profile, 64 waiting requests; lock wait 30 s; cleanup 5 s

Streaming counters enforce both advertised and observed sizes before allocation/write, including compressed data. These are selected default quotas, not measured performance claims. An owner may tighten them. A higher limit requires an explicit tested implementation profile; a package cannot raise its own allowance. Quota exhaustion produces resource_limit without evicting referenced releases. New foreground execution and its runtime preparation still follow ADR-0002/0004/0008, not this download timeout.

An immutable commandGeneration contains exact releases, target selections, mounts and canonical command/alias routes. An immutable ownerConfigRevision is the validated configuration snapshot from ADR-0009. One activeProfileRevision binds both, and only that combined revision is published. A policy-only update may reuse the command generation after validating it against the candidate configuration. Installation and activation require their own checks through the bound authority; immediately before commitment the loader rechecks the operation against the current configuration and validates the entire candidate tree, built-in commands included. A changed base revision causes revision_conflict, not an automatic overwrite or a replay of an external action. Permission decisions are never perpetual grants stored in a generation.

New lookups atomically capture this profile revision and obtain references before releasing the profile lock. Existing invocations retain their selected release, identity and core-service implementations. Their later protected actions still pass the applicable policy checks, bounded by the invocation’s original scope. A policy change does not silently widen that scope or rebind the caller to another authority. If a required binding can no longer validate the captured context, the new action fails with context_invalidated, as specified by ADR-0005/0009.

The state view concerns one installation candidate. Activation does not require an already installed language runtime; supported preparation can remain lazy. Failure before commitment leaves the previous generation intact.

Accepted release installation and activation
Accepted release installation and activationA pinned candidate is staged, verified and installed, then activated in a committed generation. Failure before activation does not replace the existing generation. Retired releases are collected only when no invocation or retained generation uses them.Pinned candidatePrivate stagingVerified and installedCommitted active generationRetained for referencesRemoved from managedstorageCandidate rejected orabandonedInstallation allowedRejection or cancellationComplete verification andpublicationFailure or cancellationValidate tree and commitgenerationActivation rejected, previousgeneration unchangedReplacement or disablegeneration committedNo retained references andcleanup allowedAccepted release installation and activationA pinned candidate is staged, verified and installed, then activated in a committed generation. Failure before activation does not replace the existing generation. Retired releases are collected only when no invocation or retained generation uses them.Pinned candidatePrivate stagingVerified and installedCommitted active generationRetained for referencesRemoved from managedstorageCandidate rejected orabandonedInstallation allowedRejection or cancellationComplete verification andpublicationFailure or cancellationValidate tree and commitgenerationActivation rejected, previousgeneration unchangedReplacement or disablegeneration committedNo retained references andcleanup allowed

Joint CLI and MCP publication — 2026-09-24

Section titled “Joint CLI and MCP publication — 2026-09-24”

ADR-0013 extends the candidate validation to the approved MCP projection of the same command generation. Installation alone does not expose a tool. The descriptor must be machine-compatible and the owner profile must select exposure; caller visibility and current action admission remain separate. Built-ins and extensions share identity/collision checks. Unsupported machine contracts do not silently produce a weaker export.

The existing profile commit publishes configuration and command generation once; CLI routes and MCP names are derived from that committed pair with no second mutable publication point. Profile records retain rukh.profile/1: the new projection is derived from versioned command metadata and configuration, not an extra independently committed field. A required projection validation failure rejects the whole candidate; a feature explicitly unselected by the owner remains absent. Cached projections verify their source revision before use. Policy-only updates revalidate the retained commands and projection before committing.

MCP binding names include the exact profile revision under ADR-0013. An obsolete or removed name cannot select its replacement by display text. Capture of a current binding and protective release references occurs under the same storage coordination used for CLI. Profile publication concurrent with capture either precedes capture and rejects the obsolete name, or follows capture and leaves the invocation pinned; later protected actions still require current validity. Notifications and cached lists never extend rights. A connection does not freeze a private generation for later calls.

Updates that add machine eligibility, required rights, effect classes or stronger runtime requirements need ordinary trust, compatibility and owner exposure checks. Neither semantic version order nor prior installation grants new authority. Installation, profile administration and source changes are separate protected operations; a general agent task cannot expose those powers to itself. Uncertain publication and uncertain external effects follow their respective reconciliation contracts, never automatic command replay.

An update is an explicit new candidate, not modification of installed bytes. A compatible update follows the same checks as installation; a newly requested operation, changed access domain or unsupported contract cannot bypass them. Route/alias conflicts reject the candidate tree. Incompatible updates require a deliberate owner/user choice allowed by policy; the loader never silently falls back to a different command or package.

Each invocation holds a reference to its release and environment through finalization. A reference is released only when execution and other uses are confirmed stopped; unresolved cleanup retains a protective reference for reconciliation even after the final outcome is committed. Committing an update changes new lookups, not running code. Disabling or uninstalling publishes a generation without the selected commands and schedules collection after references end; stopping already running work is a separate authorized lifecycle action. Failed or uncertain cleanup is reported, not recorded as successful deletion.

The baseline uses local files; it needs neither a database service nor a daemon. A per-profile OS-held lock serializes metadata writers and the short capture/reference step for readers. Staging downloads happen outside the lock. A PID file or an elapsed timeout is not enough to steal a live lock. Shared/network filesystems are not implicitly supported: a storage adapter must demonstrate the same locking, durable write and recovery guarantees for its selected filesystem.

Before commitment, the loader writes and verifies immutable release/configuration/generation records and makes their data and directory entries durable through the platform storage adapter. The profile record contains format: rukh.profile/1, ownerConfigRevision and commandGeneration; it contains no hash of itself. The loader then appends one commit record to a per-profile journal: transactionId, monotonic sequence, previousProfileRevision, activeProfileRevision, ownerConfigRevision, commandGeneration and record checksum. The record has a length prefix and completion marker, is at most 16 KiB, and is flushed before success is reported or readers are admitted. Revisions are SHA-256 digests of the corresponding immutable record bytes; transaction IDs are fresh opaque IDs and cannot be reused for a different candidate. One record publishes configuration and commands together.

The first record has sequence 1 and a null predecessor; later records increment the exact integer sequence and refer to the last committed profile. An uninitialized profile exposes no extension commands and does not imply public policy. Initialization validates an explicitly supplied owner configuration through the same commit path. Journal format, profile storage schema and release format have separate version checks; an unsupported storage version is rejected without rewriting it in place.

Recovery holds the same lock and reads the continuous committed chain. Only an incomplete trailing record is discarded as uncommitted; a complete record with a bad checksum, broken predecessor or missing/corrupt referenced data stops activation with storage_corrupt. It does not silently fall back to an older, possibly revoked policy. A valid committed record remains authoritative even if its caller did not receive success. An uncertain caller queries by transaction ID; reconciliation can report committed, not committed or still unknown, but does not replay external actions. Incomplete staging remains isolated for bounded cleanup. A process crash after commitment does not undo the committed revision.

The baseline journal is append-only with a 64 MiB per-profile limit; reaching it rejects new mutations with resource_limit while verified committed reads remain usable. It never deletes history automatically to make room. A storage adapter may implement checkpoint/compaction only with the same recovery guarantees and fault-injection checks; larger deployments can replace storage behind this contract. An atomic rename by itself is not proof of durability. The platform mapping must check flush errors and file/directory publication ordering; Windows provides an explicit file-buffer flush operation, but that operation alone is not the whole transaction. Windows file flushing.

This sequence makes the shared configuration/command commit explicit; verification and downloads do not hold the publication lock.

One configuration and command publication
One configuration and command publicationThe loader prepares immutable records, checks the expected profile under a lock, flushes one joint commit and only then exposes it to new invocations. A conflict does not overwrite the current state.New invocationProfile storageLoaderNew invocationProfile storageLoaderalt[Revision changed][Revision matches]Fetch, verify and prepare candidate recordsLock and compare expected revisionrevision_conflict, no publicationRecheck policy and complete command treePersist records and joint commit, flushCommitted profile revision, unlockLock, capture committed revision and referencesBound configuration and commands, unlockOne configuration and command publicationThe loader prepares immutable records, checks the expected profile under a lock, flushes one joint commit and only then exposes it to new invocations. A conflict does not overwrite the current state.New invocationProfile storageLoaderNew invocationProfile storageLoaderalt[Revision changed][Revision matches]Fetch, verify and prepare candidate recordsLock and compare expected revisionrevision_conflict, no publicationRecheck policy and complete command treePersist records and joint commit, flushCommitted profile revision, unlockLock, capture committed revision and referencesBound configuration and commands, unlock

Rollback selects an exact retained release and repeats current compatibility, trust and permission checks; it is not a bypass for revoked content. A failed candidate does not remove the old committed generation, but that generation remains subject to applicable access/trust policy. Garbage collection only removes loader-owned, unreferenced resources and never arbitrary user paths or shared system runtimes. Package removal from a registry does not itself define local revocation behavior.

References and collection use the same storage boundary: a release cannot become deletable between selection and reference acquisition. Active generations, explicitly retained rollback generations and live/protective invocation references all prevent collection. Retention is bounded by owner quotas, but reaching a quota rejects new preparation instead of deleting in-use content. On restart, an unresolved reference is reconciled with the owning execution; lack of a process with the same numeric PID is insufficient proof because IDs can be reused. If ownership or termination cannot be established, retain and report the reference. A repeated removal request may confirm already absent content, but must not claim successful cleanup while references remain.

Loader operations return a stage, stable reason code, exact candidate identity and known committed profile revision when one exists. Reasons include not_permitted, trust_failed, integrity_failed, unsupported_target, invalid_descriptor, route_conflict, revision_conflict, source_unavailable, resource_limit, storage_corrupt, commit_unknown and cancelled. They are structured loader diagnostics, not replacement numeric CLI exit codes. Installation success means verified installed bytes; activation success means a durable profile commit; uninstall may have committed command removal with cleanup_pending. These are distinct results.

Cancellation before journal publication begins leaves the previous active revision. Once the commit record starts being written, cancellation or a flush error cannot by itself prove that publication failed: the loader reconciles transactionId and reports the committed revision, confirmed non-commitment or commit_unknown. It does not admit new readers to an uncertain revision until recovery has validated and durably confirmed the authoritative record. Once the commit is durable, cancellation cannot pretend it never happened; the operation reports that revision and any pending cleanup. If this operation is invoked through a core service, the enclosing invocation’s final outcome still follows ADR-0002/0004; it may be cancelled after a side effect committed, and that side effect must not be repeated. Errors disclose neither inaccessible catalog entries nor source credentials. No automatic fallback to another authority, weaker trust profile or alternative version follows from a failure.

  • OCI, HTTPS and Git share release and update semantics without being forced into one transport.
  • Installation can succeed while a command remains inactive, unauthorized or awaiting an environment; those states must be reported distinctly.
  • Persistent transaction/retention rules and publisher trust are real implementation requirements. This decision does not claim they are provided by the website repository.

The 2026-09-24 refinement checks remain unrun. Verify the shared CLI/MCP path, unsupported result-feature rejection, current profile/task binding, bounded data, absence of replay and channel separation within this ADR’s responsibility. Historical results below do not cover these additions.

The project owner accepted this decision on 2026-09-23. The following list remains required implementation verification, not a claim that these checks passed at acceptance.

The envelope, baseline pinned-trust profile, quotas and storage algorithm above are selected decisions. For implementation verification, implement a reference mapping and check:

  1. Deliver identical releases through all three sources; moved tags, conflicting version digests and changed access domains do not substitute another release.
  2. Invalid signatures/bindings, archive traversal, normalized-path collisions and oversized content fail without executing publisher code or altering active commands.
  3. Concurrent configuration and command updates, cancellation at commitment, interrupted writes and recovery expose one verified profile revision. Fault injection at each write/flush boundary distinguishes an incomplete tail from corruption and reconciles an unknown commit without retrying effects.
  4. Running invocations retain their files/environment during update or uninstall; collection waits for references and reports incomplete cleanup.
  5. A single static catalog with explicit owner-pinned trust works without sign-in or a remote catalog service. Replacing catalog delivery with a service preserves release identity, owner trust and mandatory access-domain bindings; untrusted checksums cannot substitute for approval.

These checks have not been run for ADR-0007. Catalog freshness, revocation and credentials require their own contracts; this ADR does not choose extension connectivity modes.

Diagram

Drag to move · + / − to zoom · 0 to fit · Esc to closeDrag to move and pinch to zoom

100%