@lssm-tech/lib.companyos-runtime
Canonical Work reducers and persistence ports live in
@lssm-tech/lib.work-runtime; CompanyOS runtime projections consume Work refs without duplicating task or project state.
Company Intelligence graph runtime
./company-intelligence-graph provides deterministic, provider-free graph integrity, SHA-256 replay, immutable bitemporal versions, as-of/diff, bounded traversal and tenant-authorized hybrid lexical/structured search. It preserves tombstone history while excluding tombstoned current state, and rejects orphan, conflicting, predicate-prohibited cyclic, cross-tenant, stale and unauthorized state with stable CI_GRAPH_* codes. Stable SHA-256 identifier digests match deterministically; label-only matches remain review-required and only trusted, candidate-bound decisions produce reversible aliases.
Run bun run test:company-intelligence:graph.
Pure, backend-neutral CompanyOS runtime helpers for deterministic V0 replay and V1 operating-loop projections.
This package consumes public contracts from @lssm-tech/lib.companyos-spec and provides reusable helpers for:
- explaining authority for an action proposal
- classifying autonomy requests into safe policy decisions
- routing approval/reserved-risk decisions into operator inbox items
- summarizing a CompanyOS V0 operating review
- projecting V1 objectives, temporal memory, operating cadence review packets, agent handoffs, execution readiness/dispatch/receipt evidence, correction/outcome receipt linkage, agent-native operation access, surface profile selection, CompanyOS operating graph views, and evidence-backed outcome value reports
- normalizing rich reply/call/meeting/CRM/deal observations into deterministic, evidence-backed ContractSpec outcome claims with explicit correction lineage and correlation-only attribution windows
- converting schema-constrained Company Intelligence candidates into canonical evidence-linked records, with deterministic review gates, redacted receipts, and immutable correction lineage
Positioning
Long-term governance/runtime layer behind proofs like CompanyOS VoiceOps.
Boundary
The runtime package has no providers, I/O, modules, bundles, apps, integrations, or UI. It does not execute actions. It only projects deterministic decisions, packets, selections, dispatch drafts, receipts, inbox items, and summaries over CompanyOS spec objects.
Public entrypoints
@lssm-tech/lib.companyos-runtime — root barrel
@lssm-tech/lib.companyos-runtime/authority — authority explanation helpers
@lssm-tech/lib.companyos-runtime/autonomy — autonomy classification helpers
@lssm-tech/lib.companyos-runtime/inbox — operator inbox routing helpers
@lssm-tech/lib.companyos-runtime/review — operating review summarization helpers
@lssm-tech/lib.companyos-runtime/objectives — V1 objective health and drift projections
@lssm-tech/lib.companyos-runtime/memory — V1 temporal memory snapshot projections
@lssm-tech/lib.companyos-runtime/cadence — V1 operating cadence review packet builders
@lssm-tech/lib.companyos-runtime/execution — V1 execution readiness, dispatch draft, policy-gate, receipt, and inbox projections
@lssm-tech/lib.companyos-runtime/execution-receipts — deterministic execution receipt summaries and correction/outcome linkage projections
@lssm-tech/lib.companyos-runtime/agent-org — V1 agent delegation and handoff planners
@lssm-tech/lib.companyos-runtime/operations — V1 agent-native operation access classifiers
@lssm-tech/lib.companyos-runtime/surfaces — V1 dynamic surface profile selectors
@lssm-tech/lib.companyos-runtime/operating-graph — deterministic graph snapshot, source-record replay, and idempotent change helpers over CompanyOS spec node kinds
@lssm-tech/lib.companyos-runtime/identity-resolution — cross-source identity candidate and link decision projections
@lssm-tech/lib.companyos-runtime/ingress — fixture-only tenant-bound HMAC ingress verification, replay rejection, outbox retry, and redacted dead-letter evidence
@lssm-tech/lib.companyos-runtime/graph-permissions — actor-bound graph filtering and required-field redaction projections
@lssm-tech/lib.companyos-runtime/graph-realtime — data-transmission-compatible event envelope and replay projections
@lssm-tech/lib.companyos-runtime/runbooks — fail-closed runbook readiness projections for stale, conflicted, unauthorized, or low-confidence graph evidence
@lssm-tech/lib.companyos-runtime/substrate-adapters — thin adapter-shaped projections for AuthOS/RBAC decisions and data-transmission refs
@lssm-tech/lib.companyos-runtime/layer0-policy — sponsor-neutral Layer 0 policy summary and accountable packet transition helpers
@lssm-tech/lib.companyos-runtime/layer0-routing — deterministic Layer 0 routing matcher that refuses unreviewed active rules
@lssm-tech/lib.companyos-runtime/layer0-replay — deterministic Layer 0 replay projection helpers
@lssm-tech/lib.companyos-runtime/outcome-value-projections — deterministic business value reports, review queues, readiness signals, sales reports, and prompt/skill influence grouping over ContractSpec outcome claim refs
@lssm-tech/lib.companyos-runtime/outcome-ingestion — deterministic normalized observation, correction/supersession, correlation-window, OutcomeClaim, and learning-ref projection
@lssm-tech/lib.companyos-runtime/temporal-store — deterministic, fault-injectable in-memory reference fake and conformance semantics for the storage-neutral temporal store port; not a durable adapter
Operating graph / AI OS projections
The operating graph helpers consume CompanyOS spec-compatible node kinds and stay provider-free. They preserve source-record evidence during realtime replay, bind permission decisions to the requesting actor, and union required redactions before returning graph fields. Permissioned graph query projections filter requested nodes, deny or redline unsafe nodes before agent use, and expose only redacted fields plus evidence refs. Runbook conformance helpers derive pass/fail evidence from procedures, readiness records, and conformance cases without provider execution. Examples should call these runtime helpers and keep deterministic sandbox adapters only at execution boundaries.
Layer 0 projections
@lssm-tech/lib.companyos-runtime/layer0-policy, /layer0-routing, and /layer0-replay provide sponsor-neutral, deterministic helpers over the additive Layer 0 CompanyOS contracts. Policy summaries expose stable Layer 0 reason-code constants while preserving upstream free-form reasons. Routing refuses unreviewed active rules, exported packet transitions require both an accountable actor and evidence, and replay summaries are order-stable with policy, CompanyBrain, and routing governance ref ids derived from existing packet refs.
Outcome value projections
projectBusinessValueReport and projectSalesValueReport consume structural ContractSpec outcome claim data without owning the generic claim schema. Claims with no evidence are excluded, low-confidence/high-impact/unreviewed claims enter the review queue, corrections reduce readiness, and prompt/skill attribution groups are reported as correlation unless upstream claims explicitly prove causality. The helpers are deterministic and side-effect-free.
Safety model
extractCompanyIntelligenceCandidates accepts untrusted model output only at a strict schema boundary. It resolves evidence IDs and exact locators solely from the caller-supplied authorized evidence set, rejects instruction-like content and policy override attempts, and requires a separately supplied trusted review decision for confidence below 0.75 or high/critical risk. Exact replay is deterministic; corrections create a new record/receipt version and supersede the prior accepted record without mutating history.
Authority and autonomy remain separate. Authority explains whether a principal has a matching capability grant and accountable owner path. Autonomy classifies how far a proposed operation may proceed. Customer-facing, approval-required, and reserved-human-only operations are never escalated to autonomous execution by this package. Execution helpers preserve policy-gate verdicts and only return dispatch drafts or operator inbox projections.
Policy Runtime Projections
@lssm-tech/lib.companyos-runtime/policy-runtime provides pure fail-closed projections for CompanyOS policy evaluation packets: readiness, missing evidence, next operator action, reserved-human-only enforcement, dry-run-before-execute state, assurance coverage, and fallback/failure explanations.
These helpers are deterministic and side-effect-free. They do not call providers, storage, queues, modules, or adapters.
Company Intelligence Brain runtime
@lssm-tech/lib.companyos-runtime/company-intelligence-brain provides pure entry versioning/review/diff/filter/projection, exact immutable edition build, validation/compare/as-of selection, gap/remediation classification, and bounded policy/procedure compilation. Unsafe inputs fail with stable CI_BRAIN_*
reasons. Compiled artifacts preserve owner, evidence, policy and approval paths while explicitly granting and executing no action.
Run bun run test:company-intelligence:brain for the frozen fingerprint, reason-code, replay, bitemporal, redaction, gap, and compile corpus.
@lssm-tech/lib.companyos-runtime/company-intelligence-brain-public-projection
provides the public API entry projection, separate from projectBrainEntry:
projectPublicBrainEntry, matchesPublicBrainEntryFilter,
readProjectedPublicBrainEntry and listProjectedPublicBrainEntries drop tombstoned entries and report only the withheld public fields (title,
content, ownerRef, domain) in redactedFields, whereas projectBrainEntry
keeps tombstoned entries as historicalOnly and reports every sensitive field. The list/read helpers take rows already read by a host (newest first per entry) and do no I/O; tenant-scoped storage stays in the host.
Published browser conditions select the emitted browser artifacts alongside existing Node/Bun/type targets. Export keys and source behavior are preserved; this packaging metadata does not activate providers or grant execution authority.
The existing ./outbox/types, ./outbox/in-memory, ./outbox/dispatcher and
./outbox/backoff exports now forward to the canonical generic Jobs outbox exports (@lssm-tech/lib.jobs/outbox/*). Class, function and constant identities are preserved; Company composition stays here. The in-memory adapter remains single-process test/bootstrap support, not a production persistence substitute.
Status: decided (D36, owner decision 2026-10-15), implemented in @lssm-tech/lib.companyos-spec.
extractCompanyIntelligenceCandidates sends every candidate below COMPANY_INTELLIGENCE_REVIEW_CONFIDENCE (0.9), or with high/critical risk, to review instead of recording it.
Decision (option 1): validateCompanyIntelligenceRecordSemantics accepts a claim, entity or relation record below 0.9 when its reviewState is approved and its payload carries a reviewDecision attestation by a human reviewer whose reviewerRef differs from the extracting agent (extractedByRef, the extraction modelRef). The model confidence is recorded unchanged. Every other record below 0.9 still needs review_required (CI_REVIEW_REQUIRED).
The extraction runtime writes that attestation only when the trusted review decision declares reviewerKind. Decisions without it keep the previous behaviour: an approved low-confidence record still fails canonical validation, so hosts must supply reviewerKind: 'human' from their reviewer identity, never from model output.
Managed CompanyOS host policy
These subpaths own reusable behavior that the managed CompanyOS API host used to keep locally. Hosts keep SQL, environment reads, secrets and composition, and implement the declared ports.
./context-authority-refs, ./context-authority-projection, ./context-authority-resolver — HMAC-opaque context/team/workspace refs and projection digest (on lib.crypto-utils), the context.list projection, and active scope resolution over a structural verified-authority input
./personal-context-lifecycle, ./personal-context-lifecycle-types — personal-context ensure/disable use cases behind PersonalContextAuthorityStore (receipt replay, version checks, authority proof, fixed revocation cascade)
./self-service-organization, ./self-service-organization-policy, ./self-service-membership, ./self-service-membership-types — self-service organization creation and membership (DNS-TXT domain claims, joins, access requests) behind store ports; randomness is injectable
./design-partner-scope-admission, ./design-partner-readiness-projection, ./design-partner-approval-types, ./design-partner-approval-workflow — cutover scope admission, entitlement/health/readiness projection, and attestation/founder-approval transitions behind DesignPartnerApprovalStore
./company-intelligence-graph-persistence — graph projection and identity candidate/decision admission validators
./company-intelligence-ingestion (plus /orchestrator, /ports, /types, /submission, /connector-registry, /idempotency, /testing) — ingestion job state machine, connector registry, budget, control jobs and deterministic test doubles. Run bun run test:company-intelligence:ingestion.
./company-intelligence-tombstones — source deletion / ACL revocation tombstones and propagation packet assembly
./calendar-intelligence-run, ./calendar-intelligence-run-types — briefing run (gating, due windows, event cap, idempotency keys, claim/finish receipts) behind delivery-store, sender, composer, meeting-loader, clock, digest and logger ports
./calendar-intelligence-email — localized briefing email renderer
Founder context store
@lssm-tech/lib.companyos-runtime/founder-context owns the append-only store port for founder account bindings, executive federation grants, context slot resolutions, context associations, bootstrap receipts and desired operating outcomes. Records are scoped to (tenantId, ownerSubjectRef); revocation and correction append a new version and never update or delete.
FounderContextStore port with idempotent append (replay, stale and idempotency-conflict results), current, listCurrent and history.
createInMemoryFounderContextStore for tests; payloads are validated on write and read and must match their record identity and owner.
founderContextPostgresMigrationStatements() (founder-context:0001):
founder_context.records with forced owner-scoped RLS (app.tenant_id / app.actor_ref) and triggers rejecting UPDATE, DELETE and TRUNCATE. Hosts register it in their migration catalog.
createStoredBindingSource feeds createAccountAuthorityResolver and
createAccountContextResolver from the store.