# Ledgers and optional execution

The foundational resources are Ledger, Record, Contract and File. Consumers
choose record meaning; no task schema, worker, session or workflow engine is
required. See [How ledgers work](/docs/raw/manuals/ledger-core.md) and
[Surrounding capabilities](/docs/raw/manuals/ledger-surrounding.md) for the current operations.

```sh
op-sys start
op-sys records append --payload '{"decision":"Proceed"}' --operation-id decision-1
op-sys records list
```

CLI, SDK and MCP core operations share the operation catalog and dispatch to the
selected local or hosted authority. Core capability discovery does not require
loading execution machinery. HTTP exposes service-owned capabilities; it does
not remotely operate another participant's local workers or credential store.

## Assessment of retained capabilities

The ledger-core cutover replaces earlier record interfaces. It does not, by
itself, replace these separate capabilities:

| Family | Why the core is not a replacement | Current boundary |
| --- | --- | --- |
| Entities, tasks, comments and relations | These are mutable workflow objects with application-specific rules. An accepted Record is immutable; references do not implement entity relationships. | Retained local execution integration through `client.ledger()` and its commands/tools. Consumers can instead build their own applications with records and configured state rules. |
| Claims, leases, heartbeats and execution batches | A view's expected-version check is not a claim scheduler, expiring lease or multi-entity transaction. | Retained execution operations; no implicit conversion into core admission rules. |
| Workflow definitions and transitions | A record contract validates submissions. It does not execute a workflow or schedule work. | Retained workflow modules and execution operations, separate from `contracts`. |
| Workers, sessions and supervisors | The core records submissions; it does not run agents, processes or supervise their work. | Explicit optional execution calls. Ordinary core use does not start a runtime. |
| Execution event queries, context and search | `records.list`, changes and collection queries retrieve core records. They do not replace entity timelines or the retained execution full-text search behavior. | Local `query` reads and hosted `/v1/query/*` reads remain separate from core record retrieval. |
| Local policy, approvals, audit, trust and recovery | Ledger grants and accepted records do not replace local process permissions, signing custody or governed state restoration. | Existing safeguards remain with the operations they protect. |
| Account, identity, teams, credentials, billing and deletion | Per-ledger access does not replace service/account administration. | Current account routes and named-connection credentials remain separate from ledger access rules. |
| Views, collections and groups | These compose the core without defining what all ledgers contain. | Current dedicated operation families; superseded record-namespace aliases have been removed. |

These retained behaviors have no equivalent replacement in the core patches.
They are preserved during this cutover. A future decision to remove them or ship
them separately needs an explicit product scope; this assessment does not make
execution part of the ledger primitive or promise a new execution product.

## Reads and destinations

Execution queries default to local reads. Explicit `scope="cloud"` reads use the
selected named connection and its credentials; `scope="all"` combines that
hosted query with the original local store. CLI, SDK and MCP follow this same
selection. Session identity is pinned during requests. A bounded page iterator
retains its original connection and identity even if the client selection later
changes. There is no fallback to old root-level credentials or default namespace
configuration. Namespace filters, where used for execution queries, are explicit.

Hosted execution queries read retained execution data only. Source registration,
event-batch upload and automatic execution-event synchronization are removed.
Execution writes remain local and are not automatically copied into ledgers.
To contribute to a ledger, use `records.append`; use the current replica
operations for replication. No record-adoption adapter remains.

## Implementation and storage boundary

Core CLI commands and capability discovery use the foundation path. Execution
commands load `op_sys.execution_cli` when selected. `client.ledger()` explicitly
opens the retained local `LedgerService`. Kernel and ledger imports are lazy;
state initialization and core calls do not start worker execution.

The distribution still includes execution modules and their tables. This is a
module boundary, not a claim that separate execution packages or a core-only
physical database have shipped. Existing stores are not reset by this cutover.
Canonical core storage cleanup must preserve the tables and behavior still owned
by retained capabilities. Old source-ingestion storage used by execution queries
must be assessed with those dependencies before being removed.

Source registration and event-batch upload, including the internal store writers
and synthetic ingest server, are retired. Hosted execution reads address retained
historical data; they do not imply an upload path. New shared records use core
record acceptance. Historical read fixtures are seeded directly, independently
of current acceptance and usage tests.
