Skip to content
pleach
Reference

Subpath exports

Every named import path under @pleach/core, what ships from it, and whether it's load-bearing.

@pleach/core ships an ESM-first export map with both import and require entries (the package is type: module; CommonJS consumers get .cjs builds). Below: the named subpaths consumers should rely on, plus the one remaining wildcard and what it costs you.

Snapshot is for @pleach/core@0.1.0 — 180 named entries as of 2026-09-06. The canonical list lives in the package's package.json and is watched by audit:package-export-validation upstream, and mirrored on this site by audit:docs-vs-contract's export-map check, which fails any specifier below that would throw ERR_PACKAGE_PATH_NOT_EXPORTED.

Named subpaths

stable means the path is named in the published exports map and watched by the upstream package-export audit. Removal or rename goes through a deprecation cycle. Each subpath ships ESM (.js), CJS (.cjs), and types (.d.ts) — see Dual-format builds.

Substrate runtime

ImportShipsStability
@pleach/coreRoot barrel — SessionRuntime, factories, runtime typesstable
@pleach/core/SessionRuntimeSessionRuntime class, direct entry (barrel sidesteps tree-shaking)stable
@pleach/core/runtimeProcess-scoped registries + module-loader indirectionstable
@pleach/core/runtime/createPleachRuntimecreatePleachRuntime, TurnOrchestrator, host-injection typesstable
@pleach/core/quickstartZero-config starter surface — createPleachRoute (fetch-handler factory), useChat (Pleach-native React hook), <ChatBox /> (unstyled, accessible), defaultPlugin, createBenchmarkPlugin, providerDetection (detectProvider, detectAvailableProviders, DEFAULT_PROVIDER_ENV_VARS, DEFAULT_PROVIDER_PRIORITY). What npx pleach init scaffolds against. See The quickstart subpath.stable

Type subpaths

Narrowed deep-path type entries landed via the pa3prep cluster 15 sweep — type-only deep paths were promoted from wildcard reach to named entries so consumers don't pay the wildcard's instability cost on contracts.

ImportShipsStability
@pleach/core/typesPublic type definitions (re-exports)stable
@pleach/core/types/commandCommand + isCommand brandstable
@pleach/core/types/dynamicAppModulesDynamic-app-module type registrystable
@pleach/core/types/genericGeneric runtime typesstable
@pleach/core/types/singleTurnSingle-turn body contract typesstable
@pleach/core/types/strategiesStrategy registration typesstable

Persistence + state

ImportShipsStability
@pleach/core/sessionsSession-state adapters — MemoryAdapter, IndexedDBAdapter, SupabaseAdapterstable
@pleach/core/checkpointingCheckpoint savers — MemorySaver, IndexedDBSaver, SupabaseSaverstable
@pleach/core/syncVersion-vector sync utilitiesstable
@pleach/core/storeNamespaced KV store — BaseStore (abstract: get / put / delete / search over hierarchical namespaces), MemoryStore, SupabaseStore, MemoryNamespaces. MemoryStore is the ship-a-default binding when config.store is unset.stable
@pleach/core/cacheIn-memory cache backend (createMemoryCacheBackend) + content-hash deriver (deriveContentHashKey, canonicalizeKeyInput, ContentHashKeyInput — re-exported by @pleach/replay/cache)stable
@pleach/core/schemaGenerated row-shape types + SQL bundlestable
@pleach/core/schema/postgres/*.sqlRaw SQL migrations (asset import)stable

Event log + projections

ImportShipsStability
@pleach/core/eventLogEventLogWriter, EventLogClient, hydrateFromEvents, GraphProjection<T>stable
@pleach/core/eventLog/durableFlushThe serverless durability seam — setWaitUntilImpl, deferFlush, awaitPendingFlushes. Register your platform's waitUntil so the event log survives a function returning. See Deployment.stable
@pleach/core/manifestChat-manifest — createDefaultChatManifestProvider (the [Session Manifest] ledger + section render), checkpoint/reload persistence (stampManifestIntoState, restoreManifestFromState), and chatManifestProjection / foldChatManifest (the manifest as an event-log projection)experimental

Audit, attestation, scrub

ImportShipsStability
@pleach/core/auditAuditableCall ledger primitives + no-op plug-pointsstable
@pleach/core/attestationAttestation module — signer, verifier, canonical envelopestable
@pleach/core/attestation/keyStoresPluggable key-store backends (memory, env, KMS adapters)stable
@pleach/core/attestation/testingTest fixtures + harness for attestation flowsstable
@pleach/core/attestation/cmsDetached CMS (RFC 5652) SignedData over an attestation's canonical bytes — buildAttestationDetachedCms, buildDetachedCmsSignedData, extractSignedAttributesFromArtifact, CmsAttestationError. Additive: a CMS artifact is emitted alongside the bespoke AttestationV1.signature, never instead of it. The ASN.1 encoders are optional peers loaded by dynamic import — see Attestation § The CMS envelope.stable
@pleach/core/cryptoCrypto-shred (GDPR Article 17) primitives — createPayloadCipher (AES-256-GCM over named audit-payload fields), SubjectKeyRegistry (per-subject DEK lifecycle, fail-closed after shred), createAesGcmKekProvider. Phase 1 only: cipher + DEK lifecycle, no write path, read path, or erasure orchestration. Verify wrapped_dek and iv are nullable before minting the first DEK — on a NOT NULL schema shred() raises SQLSTATE 23502 while getOrCreateDek still succeeds, which mints ciphertext that can never be erased.experimental
@pleach/core/scrubbersC8 redaction surface — SCRUBBABLE_FIELDS allowlist + scrubber registrystable

Prompts + prompt-builder

ImportShipsStability
@pleach/core/promptsC12 prompt-contribution contract — PromptContributionRegistry, PromptContribution, 41 Phase H universal templatesstable
@pleach/core/prompts/examplesReference prompt contributorsstable
@pleach/core/prompt-builderPhase F generic composition — composeBudgetedPrompt + diagnosticsstable
@pleach/core/prompt-builder/sectionsSection primitivesstable
@pleach/core/prompt-builder/examplesReference section assembliesstable

| @pleach/core/context | Context-window budget — computeContextBudget, resolveCompactionThreshold, estimateMessageTokens, and the DEFAULT_COMPACTION_TRIGGER_TOKENS / DEFAULT_COMPACTION_RATIO / DEFAULT_CONTEXT_WINDOW_TOKENS defaults. One shared token budget across prompt + history, which is what the context gauge reads. | stable |

Model pipeline

ImportShipsStability
@pleach/core/hooksPre/post-model hooks — PreModelHook, PostModelHook, ModelProfile + four shipped hooks (historyTrimmerHook, lazyModelDefaultsHook, toolCallValidatorHook, repetitionDetectorHook). See Model hooks.stable
@pleach/core/middlewareOrchestrator middleware — OrchestratorMiddleware, MiddlewareStack, ResultEvictionMiddleware, SummarizationMiddleware, the AI-SDK-compatible LanguageModelMiddleware, CHARS_PER_TOKEN. See Orchestrator middleware.stable
@pleach/core/synthesisSynthesis stream surface — SynthesisEmitter (emits the synthesize-stage stream events) + enrichOffloadedToolPreviews (folds offloaded tool summaries back into previews).stable
@pleach/core/pricingCost math — computeTurnCost, DEFAULT_PRICING_MATRIX, createPricingResolver, fetchOpenRouterPricing / applyToMatrix, resolveCostEventUsd, parseModelSlug. See Pricing math.stable
@pleach/core/model-familyThe RoutingDecision audit contract — buildBaseRoutingDecision, appendFallbackStep, markUserInitiatedUpgrade — plus the model-family matrix, cascade logic, and the Transport union. Previously internal; now the published surface @pleach/gateway routes through instead of a host-path alias.stable

Safety

ImportShipsStability
@pleach/core/safetySafetyPolicyRegistry, composeSafetyContent, contribution registrystable
@pleach/core/safety/examplesReference safety contributorsstable

Access control + export

ImportShipsStability
@pleach/core/rbaccreateRbacApprovalFlow — adapts a host-supplied RbacRuntime (from @pleach/rbac-contract) into the ApprovalFlowContribution plugin-hook shape. No new hook: this reuses the existing pre-execution checkApprovalNeeded gate. That hook has no shipped consumer in the reference host today — read it as advisory pre-wiring, not an enforcement boundary, until you wire contributeApprovalFlow() yourself.experimental
@pleach/core/exportexportRows(rows, columns, format) — a pure, zero-dependency row exporter to JSON, CSV, or Markdown from a typed row array + column mapping. Guards CSV formula injection (a cell starting with =, +, -, or @ is quote-prefixed before it can execute as a formula in Excel or Sheets).stable

Lineage + fingerprint + observability

ImportShipsStability
@pleach/core/lineageLineageTracker + 6 lineage types (Layer-4 lineage primitives)stable
@pleach/core/fingerprintcomputeFingerprint — platform-uniform pure hashstable
@pleach/core/otelOpenTelemetry no-op + adapter seamsstable
@pleach/core/inspectorinspectRuntime, InspectionReport, CapabilityReport, PluginReport, CapabilityDescriptor, the 35 known-capability list (31 modern + 4 deprecated)stable
@pleach/core/harnessTurn-report folding for the headless self-observation loop (the harness chatinit flag + pleach dev plugin-test harness) — foldTurnReport, foldTurnReportFromEvents, createHarnessCapture, projectInspector, diffReports, evaluateAssertions, buildReportMarkdown ({ verbose } for the audit-ledger/runtime-log/tool-card sections), TurnReport. Also the answer-quality battery detectEdgeCases (+ EdgeCaseFinding, hasSubstantiveAnswerBody, PLAN_NARRATION_PATTERNS), the default defaultAnswerSufficiencyBackstop, and the headless-diagnostics pub/sub (getDiagnosticsBus, DiagnosticsBus). See Playground & DevTools.stable
@pleach/core/instrumentationUX-parity probes + observer-vs-legacy divergence telemetrystable, internal-leaning

Strategies + streaming

ImportShipsStability
@pleach/core/strategiesStrategy barrel — fabrication detector + named detectors + guard typesstable
@pleach/core/strategies/schemaCondensationcondenseSchemas + the budget-decision types (SchemaCondensationBudgetDecisions, SchemaCondensationDecline, SchemaCondensationDeclineGate, SchemaCondensationDeclinePass, CondensableTool, SchemaCondensationConfig). The decisions also land durably on tool_offer.snapshot.condensation_budget — see Audit ledger.stable
@pleach/core/strategies/fabricationDetectorDirect fabrication detector entrystable
@pleach/core/strategies/fabricationDetectorsNamed fabrication detector cohortstable
@pleach/core/strategies/fabricationGuardTypesGuard type contractsstable
@pleach/core/strategies/hallucinationDetectorHallucinated tool-call detectorstable
@pleach/core/strategies/toolResultStateTool-result state reducer strategystable
@pleach/core/strategies/continuationStreamGateContinuation stream-gate strategystable
@pleach/core/strategies/continuationSignalsContinuation signal primitivesstable
@pleach/core/strategies/contextInitializerGenericGeneric context initializerstable
@pleach/core/strategies/planCoverageReviewPlan-coverage review strategystable
@pleach/core/strategies/hedgePolicyHedge-policy strategystable
@pleach/core/streamingProducer side — StreamManager, asyncEventChannelstable
@pleach/core/streaming/dsmlSanitizerDSML sanitizer (chunk-time amend observer)stable
@pleach/core/streaming/bracketNarratedToolExtractorBracket-narrated tool-call extractorstable
@pleach/core/streaming/hallucinatedToolDetectorHallucinated tool-call detector entrystable
@pleach/core/streaming/streamDegenerationGuardsStream degeneration guard primitivesstable
@pleach/core/finalizationFinalization barrelstable
@pleach/core/finalization/finalizeContentfinalizeContent direct entrystable

Providers

ImportShipsStability
@pleach/core/providersProvider-failure taxonomy + reasoning-only recovery precondition — FailureCategory, FailureClassification, BillingDisposition, ModelUnavailableReason, classifyEmptyStream. The seam recovery arm keys on these; the reasoning-model set + provider string→category matchers stay host-injected (SessionRuntimeConfig.reasoningRecovery). See Providers § Reasoning-only completion recovery.stable

Graph + planning + execution

ImportShipsStability
@pleach/core/graph/planningPlanning substrate — plan-channel utilitiesstable
@pleach/core/graph/seamsSeam constructors + holders — createSeam, createSynthesizeSeam, createReasoningSeam, createConverseSeam, SynthesizeSeamHolder / ReasoningSeamHolder / ConverseSeamHolder, UnknownShapeRegistry, createTrivialSynthesizeCounterstable
@pleach/core/graph/seams/typesSeam type contractsstable
@pleach/core/graph/recoveryRecovery graph nodes — createRecoveryGraphNode, createRefusalHintNode, createRetryNarrationNode, recoveryDispatch, dispatchArmToRecoveryKindstable
@pleach/core/graph/defaultAgentStateThe default agent-state channel shapestable
@pleach/core/graph/topologyNODE_STAGE_MAP + stage lookup (getStageForNode) and the plugin-node stage overlaystable
@pleach/core/graph/defaultAgentGraphbuildDefaultAgentGraph + its DefaultAgentGraphConfig and the executor/contributor types it takes. The canonical builder, and the only published home for it — the bare @pleach/core/graph is not an export.stable
@pleach/core/graph/seams/callClassConstantsUTILITY_CALL_CLASS, REASONING_CALL_CLASS, CONVERSE_CALL_CLASS, SYNTHESIZE_CALL_CLASS — name a call class without minting a literal lint:callclass-literals would reject. See Call classes.stable
@pleach/core/graph/tuningShadow-tuning barrel — TuningKnobId, KnobDerivationPolicy, buildTuningShadowSnapshot, the snapshot holder (installTuningShadowSnapshot / readTuningShadowSnapshot) + env installer, emitTuningShadowDelta. For scripts, tests, and hosts — graph read sites import the holder and emit modules directly, never the barrel. See Graph § Tuning shadow.experimental
@pleach/core/engineRetryPolicy, AbortComposer, SuperstepRunner, createPromiseBarrier, shouldTriggerNodestable
@pleach/core/channelsTyped state containers — LastValue, BinaryOperatorAggregate, Topic, EphemeralValue, NamedBarrierstable
@pleach/core/detectorsDetector primitives — syntheticExpansionDetectorstable

Tools + plugins + meta

ImportShipsStability
@pleach/core/toolsToolRegistryWrapper, ToolBatchExecutor, catalog re-exportsstable
@pleach/core/tools/executionTool-execution pipeline stages + resolved-tools registry (recordRegistryResolvedTool, getRegistryResolvedToolNames, hasRegistryResolvedTool, resetRegistryResolvedTools)stable
@pleach/core/pluginsPluginManager + HarnessPlugin interfacestable
@pleach/core/asyncLong-running task orchestration — AsyncTaskManager, executor contract, task reducerstable
@pleach/core/plansPlan substrate — PlanManager, plan/step/revision typesstable
@pleach/core/subagentsConcurrent subagent execution — SubagentManager, LightweightRuntimestable
@pleach/core/memoryAuto-extracted user facts + per-agent memory scopingstable
@pleach/core/feedbackHuman-feedback write API — recordFeedback (rating / correction / preference into a durable domain.<ns>.feedback.recorded row + a meta-namespace memory write), feedbackEventType, the FEEDBACK_TEXT_MAX_CHARS / FEEDBACK_METADATA_JSON_MAX_CHARS caps, and the FeedbackKind / RecordFeedbackResult types. See Memory § Human feedback.stable
@pleach/core/queryRead-side query helpersstable
@pleach/core/skillsSkill substrate — loader + frontmatter parsing. @pleach/core/skills/loader (SkillLoader, invalidateSkillLoaderMemo, SKILL_LOADER_MEMO_TTL_MS) and @pleach/core/skills/types (Skill, SkillFrontmatter) are the narrower named entries. See Skills.stable
@pleach/core/runtime/facets/{context,model,prompts,tools}The client-facet surface a host implements to supply context, model resolution, prompt building, and tool resolution — createClientContextFacet, createClientModelFacet, createClientPromptsFacet, createClientToolsFacet and their *FacetHost contracts. See Facets.experimental
@pleach/core/testingHeadless turn driver — runScriptedTurn, collectTurn, createScriptedAdapter, createScriptedClient, runProviderTurn, benchmarkProviders, captureProbes. See Testing.stable

Re-exports

ImportShipsStability
@pleach/core/reactRe-export of @pleach/react — hooks + HarnessProvider + DevToolsstable
@pleach/core/react/labCanonical home for the lab component kit — PleachLab + panels + useLatticeState (@pleach/react/lab aliases it). See React § The composable kit.stable
@pleach/core/react/pureBrowser-pure component variants — SessionSwitcherView, SessionCheckpointTimelineView, RecallPanelView — with zero useHarnessContext dependency, for fetch-split apps where the runtime lives server-side and the client only fetches. Mirrors the existing pure/wired split already shipped for InterruptApprovalCard.stable
@pleach/core/adaptersStorage + streaming adaptersstable

Runtime registries + auth + utils

ImportShipsStability
@pleach/core/runtimeRegistryProcess-scoped runtime registrystable
@pleach/core/guestInterruptBusGuest interrupt bus (registry seam)stable
@pleach/core/guestInterruptCallbackGuest interrupt callback (registry seam)stable
@pleach/core/authAuth providers — ApiKeyAuth, BearerTokenAuth, AuthProviderstable
@pleach/core/utilsUUIDv7, typed EventEmitter, SHA-256 integrity helpersstable

Wildcard

ImportShipsStability
@pleach/core/internal/*Scoped hatch over dist/ — implementation detail, no deprecation cycleunstable

stable means: the path is named in the published exports map and watched by the upstream package-export audit. Removal or rename goes through a deprecation cycle.

The wildcard surface

The bare `@pleach/core/*` wildcard is gone

It was replaced by the scoped @pleach/core/internal/*. A deep import that used to resolve through @pleach/core/* — say @pleach/core/graph or @pleach/core/replay/types — now throws ERR_PACKAGE_PATH_NOT_EXPORTED. Node's exports map is a closed surface: the file existing in dist/ does not make it importable.

@pleach/core shipped a bare ./* wildcard during the named-barrel narrowing project, so the published surface wouldn't lag the source tree. That hatch is closed. Every path a consumer should reach for is now a named entry in the table above, and the only wildcard left is ./internal/* — deliberately scoped, so the internal/ segment in the specifier tells you what you're doing.

If a deep import stopped resolving, one of three things is true:

  1. It was promoted to a named barrel. Check the table above first — this is the common case. @pleach/core/graph/topology, @pleach/core/graph/seams, and @pleach/core/graph/planning are all named; the bare @pleach/core/graph is not.
  2. It's reachable from the root barrel. StateGraph, Annotation, AnnotationRoot, CompiledGraph, Send, and isSend re-export from @pleach/core itself.
  3. It has no published home yet. START, END, buildDefaultAgentGraph, and DEFAULT_TURN_FLAGS are declared in the package but reachable through no exports entry today. Compose a StateGraph directly, or open an issue against pleachhq/core asking for the barrel. The named-barrel pipeline takes requests.

graph/* stays deliberately un-barrelled beyond the four named entries. The internal graph topology is not a public API — don't build one on top of it.

Internal surfaces

Not a public import surface

Paths under @pleach/core/internal/… are implementation details, not a supported public API. The internal/ segment is the signal: they resolve today, but they are not stable — they can move or change shape between releases with no deprecation cycle. Don't build against them; use the public alternatives below.

PathWhat it isPublic alternative
@pleach/core/internal/strategies/streamSingleTurn/helpers (+ its safeStringifyArgs, parseToolArgs, forceSynthesisEchoDispatch, imperativeProviderAttemptCallback direct entries)The streamSingleTurn body's own helper barrel — typed contracts (TurnAccumulator, OrchestratorMessage, ProviderFallbackConfig, ToolDefinition) plus runtime utilities the default body uses inline. See streamSingleTurn § The helpers barrel.Public types via the named type subpaths — e.g. ToolDefinition from @pleach/core/types/generic. A custom body registers through the module-loader seam, not by importing these helpers.
@pleach/core/internal/tools/execution/registryResolvedToolsResolved-tools registry surface.@pleach/core/tools/execution re-exports the supported functions (recordRegistryResolvedTool, getRegistryResolvedToolNames, hasRegistryResolvedTool, resetRegistryResolvedTools).

Dual-format builds

Each named subpath ships three artifacts:

{
  "import":  "./dist/sessions/index.js",
  "require": "./dist/sessions/index.cjs",
  "types":   "./dist/sessions/index.d.ts"
}

ESM consumers resolve .js; CommonJS consumers resolve .cjs; TypeScript reads the .d.ts. Bundlers respect sideEffects: false on the package — tree-shaking the runtime is supported and gives roughly a 30% bundle reduction in apps that only import a handful of named subpaths.

First-publish packaging contract

Every @pleach/* package adopts the same baseline at its first 1.x publish. Dual ESM/CJS emit, types-first exports ordering per the Node resolution spec, dir-style tsup entries, and DTS produced by tsc --build against the public surface.

Tarballs ship without sourcemaps. Peer-dep ranges tighten at the 1.x cut. Each package carries a NOTICE, a CHANGELOG.md, npm provenance attestation, and a sideEffects declaration that matches what its modules actually do.

Consumers benefit from knowing the shape: install or import failures debug faster when the resolution order is predictable. Forkers and vendored installs need to hold the line — diverging from the contract breaks the audit gates upstream that enforce it.

For the full write-up — field-by-field package.json requirements, the audit job names, and the migration recipe for pre-1.x packages — see Publishing contract.

Where to go next