cli/architecture

lash-cli is a Host Application: it selects reusable Lash SDK crates and owns the executable's composition, configuration, presentation, operational policy, and releases.

Ownership boundary

The CLI depends on one reviewed Lash Git revision. Lash exposes runtime, protocol, provider, plugin, persistence, tracing, and language crates. The CLI turns those pieces into a terminal product.

lash-cli owns

Argument parsing, setup and stored configuration, provider materialization, concrete plugin wiring, execution-mode selection, TUI state, autonomous JSON/RPC surfaces, session navigation, export, update policy, installer assets, profiling, and binary releases.

Lash owns

The reusable runtime and facade, protocol implementations, provider factories, generic tools and plugins, stores, durable process machinery, Lashlang, trace contracts, and embedding documentation.

Workspace components

Every local crate is private to the terminal application unless another consumer justifies promoting a capability into the Lash SDK.

lash-cli

Binary bootstrap, configuration, providers, plugin composition, commands, session flows, autonomous modes, and terminal application state.

lash-tui

Terminal input, frame lifecycle, and rendering primitives.

lash-tui-extensions

Host-owned UI extension contracts and activity presentation.

lash-search-tools

FFF-backed local search and the optional Lashlang search surface.

lash-file-index

Ignore-aware file walking, filesystem notifications, and fuzzy file completion.

lash-export

Session-tree HTML and JSON export for CLI persistence and traces.

lash-autoresearch

CLI-owned applied workflow plugin and terminal extension.

harness + performance

The debug CLI harness and CLI performance helpers exercise product behavior without becoming runtime SDK contracts.

Composition flow

arguments + ~/.lash/config.json
              │
              ▼
host provider config + plugin factories + host policies
              │
              ▼
LashCore::{standard,rlm}_builder
  + ~/.lash/store/durable-core.db catalog
  + process / trigger / effect / artifact / env stores
  + attachment store + trace sink
              │
              ▼
         LashSession facade
              │
       ┌──────┴────────┐
       ▼               ▼
interactive TUI   --print / JSON / RPC

Execution modes such as standard and rlm are Lash protocol plugins. The CLI chooses and configures one for a session; it does not implement protocol semantics itself. Every session lives in one Lash catalog under ~/.lash/store/; listing, resume, startup, and tree discovery take durable identity from that catalog, while the CLI host roster supplies display metadata only. Catalog-only sessions remain addressable with fallback labels. Store preflight runs before provider or session startup, and shutdown flushes the trace sink before closing each core. This pin reads session schema 50, trace schema 18, and remote protocol 54.

Compatibility is a forward-only whole-home runtime-data cutover, including process, trigger, and effect-replay stores. Preflight refuses older homes without migration. After retaining needed data with the old binary, lash --reset clears the entire runtime store and host roster together while preserving configuration; individual database resets are unsupported.

The shared session opener reapplies charge_safety as live host policy on creation and reopen and supplies it to core defaults for child sessions and native queued work. Interactive cores still disable automatic queued execution; catalog refreshes drain their selected receipt and refuse model turns. Dock snapshots use filtered session observations with the existing ten-second retirement horizon and incarnation-aware identity. The observer registry still scans all observed records before filtering; the result horizon and batched lease read mitigate polling cost.

Attachment admission and unsupported-format diagnostics consume the model's shared attachment capability snapshot. RLM dialect decoding is fallible and remains session-scoped. RLM memory limits measure logical heap bytes, not resident process memory.

Dependency rule

lash-cli may depend on published or Git-pinned Lash SDK crates. Lash must not depend back on CLI crates. A second application that needs CLI-private code is evidence for extracting a focused SDK capability—not for making applications depend on one another.