Skip to content

Add the LogicSRC OpenContext specification - #132

Merged
ralyodio merged 3 commits into
masterfrom
worktree-opencontext-v1
Aug 9, 2026
Merged

Add the LogicSRC OpenContext specification#132
ralyodio merged 3 commits into
masterfrom
worktree-opencontext-v1

Conversation

@ralyodio

@ralyodio ralyodio commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Adds OpenContext: an open specification for durable, portable, permissioned, provenance-aware context shared between humans and AI agents.

An agent should be replaceable without losing organizational knowledge.

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.

What's here

  • 8 JSON Schemas — manifest, object, bundle, role, provenance, decision, diagnostic, audit-event. Each self-contained (no cross-file $ref) so a third party can fetch one file and validate against it. Registered in @logicsrc/validators and schemas:validate.
  • @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.
  • Docs — 16 guides plus a hub at docs/opencontext.md.
  • Examples — 5 working repositories, held to --strict and a 100% health score in CI.
  • PRD 0003 — the OpenPRD record.

Design decisions worth reviewing

  • 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 computedgenerated_at/bundle_id/digest/as_of excluded, objects/lifecycle/exclusions/warnings 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 and is applied after scope, never merged into it, so a request can never widen what a role holds.

Verification

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 examples. Benchmarks meet every published budget — resolve 1,000 objects in ~33ms against a 2s target.

Known blocker before publication

The unscoped opencontext npm name is already taken by an unrelated third party (federicodeponte/opencontext, 2.0.0). Docs point at npx @logicsrc/opencontext; the bin stays named opencontext. Recorded in PRD 0003's risks, along with the fact that no @logicsrc spec package has ever been published, so there is no existing release path to slot into.

ralyodio and others added 2 commits August 9, 2026 18:22
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>
…ision

The unscoped `opencontext` name is already published on npm by an unrelated
third party (federicodeponte/opencontext, 2.0.0), so `npx opencontext` would
install a stranger's package. Docs now use `npx @logicsrc/opencontext`; the bin
stays named `opencontext` so the command reads as the PRD specifies once
installed.

Recorded in PRD 0003 as a blocker to resolve before any publication, along with
the fact that no @logicsrc spec package has ever been published, so there is no
existing release path to slot into.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ThreatCrush found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

ThreatCrush Security Scan

80 finding(s)

HIGH/CRITICAL: 9 | MEDIUM: 48 | LOW: 23

Severity Rule Location
HIGH manifest-typosquat apps/commandboard-web/package.json:20
HIGH manifest-typosquat apps/logicsrc-web/package.json:28
HIGH manifest-typosquat apps/pwa/package.json:19
HIGH js-ssrf-outbound-request apps/pwa/public/sw.js:45
HIGH secret-generic-credential plugins/agentgit/src/index.ts:12
HIGH secret-generic-credential plugins/c0mpute/src/index.ts:12
HIGH secret-generic-credential plugins/coinpay/src/index.ts:12
HIGH secret-generic-credential plugins/sh1pt/src/index.ts:11
HIGH secret-generic-credential plugins/ugig/src/index.ts:11
MEDIUM js-unescaped-html-sink apps/commandboard-web/src/main.ts:19
MEDIUM js-unescaped-html-sink apps/logicsrc-web/src/app/[[...slug]]/page.tsx:73
MEDIUM js-unescaped-html-sink apps/logicsrc-web/src/app/blog/[slug]/page.tsx:120
MEDIUM js-unescaped-html-sink apps/logicsrc-web/src/app/docs/[slug]/page.tsx:55
MEDIUM js-unescaped-html-sink apps/logicsrc-web/src/app/layout.tsx:83
MEDIUM js-unescaped-html-sink apps/logicsrc-web/src/app/pricing/page.tsx:46
MEDIUM js-unescaped-html-sink apps/logicsrc-web/src/components/site-shell.tsx:46
MEDIUM sql-template-interpolation packages/cli/src/index.ts:846
MEDIUM sql-template-interpolation packages/cli/src/index.ts:848
MEDIUM sql-template-interpolation packages/cli/src/index.ts:855
MEDIUM sql-template-interpolation packages/cli/src/teams.ts:286
MEDIUM sql-template-interpolation packages/cli/src/teams.ts:439
MEDIUM sql-template-interpolation packages/cli/src/teams.ts:442
MEDIUM sql-template-interpolation packages/opencontext/src/adapters/sqlite.ts:104
MEDIUM redos-nested-quantifier packages/opencontext/src/ids.ts:10
MEDIUM redos-nested-quantifier packages/opencontext/src/ids.ts:11
MEDIUM redos-nested-quantifier packages/opencontext/src/validate.ts:104
MEDIUM redos-nested-quantifier packages/openontology/src/ids.ts:20
MEDIUM redos-nested-quantifier packages/openprd/src/validate.ts:41
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-account-audit-event.schema.json:23
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-account-grant.schema.json:23
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-account-grant.schema.json:35
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-account-provider.schema.json:20
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-connected-account.schema.json:30
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-credential-audit-event.schema.json:14
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-opencontext-bundle.schema.json:206
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-opencontext-decision.schema.json:12
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-opencontext-decision.schema.json:131
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-opencontext-decision.schema.json:137
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-opencontext-decision.schema.json:193
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-opencontext-decision.schema.json:196
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-opencontext-decision.schema.json:200
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-opencontext-decision.schema.json:225
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-opencontext-diagnostic.schema.json:47
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-opencontext-manifest.schema.json:333
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-opencontext-object.schema.json:197
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-opencontext-object.schema.json:203
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-opencontext-object.schema.json:306
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-opencontext-provenance.schema.json:16
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-opencontext-provenance.schema.json:36
MEDIUM redos-nested-quantifier packages/schemas/schemas/logicsrc-opencontext-provenance.schema.json:70

…and 30 more. Full results in the Security tab.

Snippets are redacted; ThreatCrush never prints matched credential material.

@socket-security

socket-security Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​logicsrc/​cli@​0.1.2 ⏵ 0.1.2N/AN/AN/AN/AN/A

View full report

standards.test.ts asserts prd_next_id against the live prd/ directory, so
adding PRD 0003 makes the next free id 0004. The test's own comment
anticipates this: "advances with every PRD added".

Caught by CI, not locally — the earlier verification ran per-package tests for
the packages this branch touches, and logicsrc-mcp is coupled to the PRD
directory without importing from it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ralyodio
ralyodio merged commit 3ab8a4b into master Aug 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants