pleach
Get Started

Ownership boundaries

Per SKU, what the package owns, what you configure, and what you must supply. The single-page map of where the substrate ends and your code begins.

This page answers one question per row: if I want to change behavior X, whose surface is X, and is it a config field, a plugin hook, or a fork? It complements the other orientation docs without duplicating them — Packages describes what each SKU does, Which SKU do I need? maps tasks to install lists, and this page draws the boundary between the SKU's locked surface and your host code.

Every row sorts into one of three columns:

ColumnWhat it means
Owned by the SKUFixed by the package. The audit gates refuse builds that try to alter it. Your only path here is upstream contribution.
You configureA typed config field, a plugin hook, or a registered registry. Supported, additive, no forking required.
You must supplyRequired at construction. The SKU throws or short-circuits without it.

Two structural pins hold across every SKU:

  • The four-stage latticeanchor-plan → tool-loop → synthesize → post-turn. Every node in every SKU belongs to one of the four stages; see Graph for the gate and Node catalog + Edge catalog for the enumerated surface.
  • The audit row — one AuditableCall row per LLM call, keyed by turnId. Every SKU writes through the same row shape; see AuditableCall row for the schema.

You can't disable, replace, or bypass either pin from any extension path. They're substrate, not policy.

@pleach/core — the substrate

The lattice and the audit ledger. Every other SKU plugs in through HarnessPlugin; @pleach/core is the only package whose absence breaks the build.

Owned by the SKUYou configureYou must supply
Four-stage latticellmExecutor — your LLM provider callAt least one LLM provider
Channel kinds and reducerstoolExecutor — tool dispatchA storage adapter (or the in-memory default)
Singleton synthesize seamsubagentExecutor — subagent runtime constructionThe SessionRuntime config object
AuditableCall row shapeplugins[] — a HarnessPlugin[] for extra graph nodes, tool registration, stream observers
Checkpoint formatThe 43-name Node catalog — register a subset by omitting the matching executor
StreamEvent shapesstorage — a StorageAdapter for session persistence
Determinism contract — five substrate rulesmetaToolNames — names the substrate should treat as meta-tools
Family locksetHarnessModuleLoaderhost-adapter seam for hosts mid-migration

The canonical decision tree: Runtime construction. The full plugin extension surface: Plugin contract.

@pleach/compliance — scrubbing, hash chain, GDPR

PII/PHI redaction, tamper-evident hash chain over the audit ledger, GDPR-style soft-delete (erasure tombstones).

Owned by the SKUYou configureYou must supply
Hash-chain middleware — the chained-hash formatPer-turn scrubber set via ComplianceRuntimeA ComplianceRuntime instance
GDPR erasure — tombstone shapeCustom Scrubbers (PII, PHI, PCI patterns)Storage that supports the tombstone write pattern
Attestation envelope shape (Attestation)Detector regexes per data class
The @pleach/compliance-contract typed surfaceThe audit gates the hash chain enforces

@pleach/compliance writes through the same audit row @pleach/core defines — it doesn't introduce a second ledger. See Compliance.

@pleach/gateway — multi-tenant routing + cost attribution

Per-tenant model routing, BYOK provider keys, rate limiting, cost event emission.

Owned by the SKUYou configureYou must supply
Cost event row shapeBYOK provider keys per tenantA GatewayClient instance
Routing logic (cost-aware, family-locked)Rate limits per tenant or per keyTenant identifier on every request
Per-tenant tenant facet — Tenant facetOTel destination for cost rollup
Migration from @pleach/core routing

Per-tenant cost attribution rolls up through the same AuditableCall row — tenantId is a column, not a side-table. See Gateway and Multi-tenant.

@pleach/observe — hosted observability + Export Bridge

OTel-instrumented spans across the lattice. Read Observe for the SKU framing.

Owned by the SKUYou configureYou must supply
Span structure across the four stagesDestinations — Postgres, Supabase, OTel collector, custom webhookAn OTel collector, Postgres, or destination of your choice
Trace ID propagation through AuditableCallPer-tenant routing of spans
Cost rollup integration with @pleach/gatewayRetention rules at the destination

@pleach/observe is destination-flexible. The library writes audit rows through existing @pleach/core ProviderDecisionLedger adapters; the destination is yours.

@pleach/eval — deterministic replay + diff

Regression testing against the audit ledger. Replays past turns through the same node graph and diffs the output.

Owned by the SKUYou configureYou must supply
Deterministic replay engineEval parity thresholdsA ReplayClient instance from @pleach/replay
Diff format over AuditableCall rowsReplay-time seam bindingSource audit rows to replay against
Lifecycle hook reads — onToolCompleted, onMessageAddedPer-eval node-graph subset

@pleach/eval consumes @pleach/replay's ReplayClient via DI. The split lifecycle hooks let it read the same ledger every SKU writes through. See @pleach/eval.

@pleach/replay — event-granular session forking

Forks a session from any checkpoint or any event. The substrate carrier for @pleach/eval but usable independently.

Owned by the SKUYou configureYou must supply
Fork algorithm (event-granular, not turn-granular)Checkpoint storage backend (via core's StorageAdapter)A source session to fork from
Lineage record formatPer-fork seam re-binding
Replay determinism contract — node-level

See Replay and Time travel.

@pleach/mcp — MCP server + client

Wraps Pleach sessions as Model Context Protocol servers, and consumes external MCP servers as Pleach tools.

Owned by the SKUYou configureYou must supply
MCP transport (Streamable HTTP per protocol 2025-06-18)Tool exposure — which Pleach tools become MCP toolsThe session config that backs the server
Resource and prompt handlersResource list
Tools/list, tools/call, ping, notifications handlersExternal MCP servers to consume as tools

See @pleach/mcp and MCP integration.

@pleach/tools + @pleach/base-tools — tool primitives

Generic tool primitives (@pleach/tools) and a curated base set (@pleach/base-tools).

Owned by the SKUYou configureYou must supply
Tool interface — name, schema, executorTool registration through SessionRuntimeConfig.toolRegistryThe tool's executor function
Structured-parse and filesystem primitivesPer-tool seam bindingPermissions and sandbox boundaries for filesystem/shell tools
Tool result row shape — feeds the post-tool chainTool result post-processing through plugin nodes

Pleach's tool contract is the same shape regardless of whether the tool comes from @pleach/base-tools, your own code, or an MCP server. See Tools.

@pleach/coding-agent + @pleach/sandbox — sandboxed code execution

A coding-agent recipe (@pleach/coding-agent) plus the sandbox primitives it sits on (@pleach/sandbox).

Owned by the SKUYou configureYou must supply
Sandbox lifecycle — boot, exec, snapshot, teardownSandbox provider (Vercel Sandbox, Docker, custom)Sandbox provider credentials
File tools — read, write, patchMulti-synthesize parametersThe repo or workspace to mount
Long-session checkpointingPer-task tool subset
SWE-bench recipe — eval shape

See @pleach/coding-agent.

@pleach/react — React hooks + components

Hook surface for client-side chat UI. Server-side runtime construction is in @pleach/core; this package owns the React-specific shape.

Owned by the SKUYou configureYou must supply
useChat, useSession, useStream hook shapesUI components, layout, stylingA backend route that proxies to the runtime (typically createPleachRoute)
HarnessProvider context shapeHook subscription behavior
Building chat UI component patterns

See @pleach/react.

@pleach/langchain — LangChain / LangGraph adapter

Adapter that lets a LangChain agent run as a Pleach node, and lets a Pleach session feed a LangGraph.

Owned by the SKUYou configureYou must supply
Adapter shapes both directionsPer-call adapter wiringA LangChain or LangGraph instance
State-mapping between LangChain BaseMessage and Pleach MessageTool-translation strategy

See @pleach/langchain and Migrating from LangChain.

Transport packages — @pleach/transport-bedrock, @pleach/transport-azure-openai, @pleach/transport-vertex

Provider-side transport adapters for AWS Bedrock, Azure OpenAI, and Google Vertex.

Owned by the SKUYou configureYou must supply
The transport's wire-shape translationPer-region endpointsProvider credentials
Provider-specific retry and backoffModel identifier mappingAccount or project ID
Streaming envelope adaptation

See @pleach/transport-bedrock, @pleach/transport-azure-openai, @pleach/transport-vertex.

Cross-SKU concerns

A few surfaces span multiple SKUs. The boundary on those is structural — the SKUs each own a slice but the contract is shared.

The audit ledger row

Every SKU writes through one AuditableCall row shape, keyed by turnId. See AuditableCall row.

SKUWritesReads
@pleach/coreThe row itself; nodeId, stageId, tokenUsage, toolName
@pleach/compliancehashChainPrev, hashChainSelf, scrubber tombstonesSelf-validates the chain at read
@pleach/gatewaytenantId, providerKey, costEventPer-tenant rollup
@pleach/observeOTel span IDs threaded onto the rowWhole row for span construction
@pleach/evalWhole row for replay
@pleach/replaylineageParent for forked sessionsSource row for the fork

Cost rollup

Two SKUs participate. @pleach/core rolls token usage per turn; @pleach/gateway rolls cost per tenant by joining the AuditableCall row to its costEvent extension. See Cost events.

Storage

@pleach/core defines the StorageAdapter interface; every SKU that persists data uses it. See Storage for the adapter shape and the bundled implementations.

Determinism

The five substrate-level rules are in Determinism. Every SKU that registers a node must satisfy them — same input state, same partial-state output.

Quick lookup — "I want to change X"

You want toSurfacePath
Add a node to the canonical graph@pleach/corePlugin — HarnessPlugin.extraGraphNodes(). See Node catalog — plugin path
Remove a node from the canonical graph@pleach/coreConfig — omit the gated executor. See Node catalog — config omission
Wire a fully custom topology@pleach/coreCustom builder — raw StateGraph. See Node catalog — custom builder
Add a new edge inside the lattice@pleach/corePlugin or custom builder; lattice gate still binds. See Edge catalog
Change the four-stage lattice itself@pleach/coreUpstream contribution only. See Edge catalog — removing an allowed pattern
Swap the LLM provider@pleach/coreConfig — llmExecutor. See Providers
Add a tool@pleach/core + @pleach/toolsConfig — toolRegistry or contributeTools plugin hook. See Tools
Scrub PII from prompts@pleach/complianceConfigured Scrubber set. See Scrubbers
Verify the audit chain hasn't been tampered with@pleach/complianceHash-chain middleware
Route per-tenant on a different provider key@pleach/gatewayBYOK
Send spans to Datadog / Honeycomb / your collector@pleach/observeDestination config — see Observe
Replay a past turn and diff@pleach/eval + @pleach/replayLifecycle hooks. See Eval and replay
Fork a session at an event@pleach/replayReplayClient.forkAt(eventId). See Replay
Expose Pleach as an MCP server@pleach/mcpMCP transport config. See @pleach/mcp
Run a coding agent against a repo@pleach/coding-agent + @pleach/sandboxSandbox provider config. See @pleach/coding-agent
Build a chat UI in React@pleach/reactHook surface. See Building chat UI
Stream from AWS Bedrock / Azure OpenAI / Vertexmatching transport SKUTransport package config. See Transport — Bedrock, Azure, Vertex
Migrate from LangChain@pleach/langchainAdapter. See Migrating from LangChain
Change the AuditableCall row shape@pleach/coreUpstream contribution only. The row shape is a cross-SKU contract
Change the determinism rules@pleach/coreUpstream contribution only. See Determinism

Where to go next

On this page