Add the LogicSRC OpenContext specification

OpenContext is an open specification for durable, portable, permissioned,
provenance-aware context shared between humans and AI agents. It defines how
organizational knowledge is described, authorized, versioned, resolved,
audited, and handed between replaceable workers without losing institutional
state.

Follows the OpenPRD/OpenOntology pattern already in the repo: self-contained
JSON Schemas in @logicsrc/schemas, a reference implementation package, CLI
subcommands, docs, examples, and an OpenPRD record.

Schemas (8, all self-contained so a third party can fetch one file and
validate against it with no further resolution):
  manifest, object, bundle, role, provenance, decision, diagnostic,
  audit-event — registered in @logicsrc/validators and schemas:validate.

Reference implementation (@logicsrc/opencontext):
  loader with upward manifest discovery, the full resolution pipeline,
  authority/supersession, permissions, redaction, lifecycle, provenance,
  deterministic digests, doctor, search, graph, history/diff, guarded writes,
  audit events, and file/http/git/sqlite adapters.

CLI: all 15 specified commands, as a standalone `opencontext` binary and as
`logicsrc context`, sharing one implementation so the two cannot drift.

Design decisions worth noting:

- Supersession is declared, never inferred from version numbers. Inferring it
  would hide the governance failure it represents and make
  multiple-active-versions and duplicate-canonical impossible to detect.

- The bundle digest identifies the resolved context, not the moment it was
  computed, so generated_at/bundle_id/digest/as_of are excluded while objects,
  lifecycle states, exclusions and warnings are covered. That is what lets a
  decision record cite exactly the context that produced it.

- A role's own max_classification beats an inherited one, so a ceiling on a
  shared base role cannot silently cap a role deliberately granted more;
  requesting several roles at once still takes the lowest, so combining roles
  never escalates.

- Scope wildcards match whole dotted segments only. A trailing .* covers a
  subtree; an interior * matches exactly one segment. Substring matching here
  would be an access-control bug.

- --include narrows an existing scope and is applied after it, never merged
  into it, so a request can never widen what a role holds.

Verified: 226 tests across core primitives, permissions/redaction, the
resolution pipeline, security, the published conformance fixtures (13 valid,
35 invalid, 8 resolution scenarios), project behaviour, and the five shipped
examples — which are held to --strict and a 100% health score. Benchmarks meet
every published budget (resolve 1,000 objects in ~33ms against a 2s target).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-08-09 18:22:42 +00:00
parent 1bb7ba6e60
commit ec3ed64f20
211 changed files with 17234 additions and 6 deletions

View file

@ -14,6 +14,7 @@ apps/
commandboard-web PWA shell
packages/
cli logicsrc OpenSpec CLI
opencontext OpenContext reference implementation (resolver, scopes, bundles, adapters)
openontology OpenOntology reference engine (entities, claims, queries, change sets)
openprd OpenPRD reference implementation (numbered PRDs, lifecycle, task bridge)
logicsrc-mcp @profullstack/logicsrc-mcp standards MCP server
@ -31,6 +32,7 @@ docs/
specs, CLI conventions, permissions, and roadmap notes
examples/
openontology/ethereum-ecosystem fictional ecosystem map demonstrating OpenOntology
opencontext/* five OpenContext repositories, from minimal to multi-agent
prd/
numbered OpenPRD proposals
scripts/
@ -104,6 +106,48 @@ that propose rather than apply, keyboard-first TUI panels, and a read-only web e
[governance](docs/openontology-governance.md) and
[interoperability](docs/openontology-interoperability.md).
## OpenContext
[LogicSRC OpenContext](docs/opencontext.md) is an open specification for durable, portable,
permissioned, provenance-aware context shared between humans and AI agents. It defines how
organizational knowledge is described, authorized, versioned, resolved, audited, and handed between
replaceable workers without losing institutional state.
> An agent should be replaceable without losing organizational knowledge.
```bash
npx opencontext init my-context
npx opencontext validate --strict
npx opencontext resolve --role support --task "customer asked for a refund" --explain
```
```txt
Included:
✓ mission canonical
✓ policies.refunds canonical
✓ procedures.refund approved
Excluded:
- decisions.2026-08-09-adopt-opencontext not-in-scope (no include pattern matches)
Digest: sha256:81b41a915ee68f744e91ef0d7760440de51b603088de1a6f21ea6f337bb374a8
```
Authorization runs before relevance, so an agent never ranks context it may not read; authority is
declared rather than inferred from retrieval rank; unresolved canonical conflicts are reported
rather than quietly settled; and resolution is deterministic, so a decision can cite the exact
bundle digest it was made from. Untrusted content — tickets, chats, scraped pages — keeps its trust
level through resolution and is fenced and labelled in rendered bundles.
It is not a memory database. Memory is one possible context source; OpenContext is the control
plane above systems that remain the sources of truth. It runs from a folder and a Git repository
with no account, no server, and no telemetry.
Also available as `logicsrc context <command>`, sharing one implementation with the standalone
binary. See the [specification](docs/opencontext/spec.md), [CLI](docs/opencontext/cli.md),
[SDK](docs/opencontext/sdk.md), [security model](docs/opencontext/security.md), and
[conformance guide](docs/opencontext/conformance.md).
## MCP
LogicSRC exposes a standards-focused MCP server as `@profullstack/logicsrc-mcp`.