Skip to content

Make the @logicsrc packages publishable - #133

Closed
ralyodio wants to merge 4 commits into
masterfrom
worktree-opencontext-v1
Closed

Make the @logicsrc packages publishable#133
ralyodio wants to merge 4 commits into
masterfrom
worktree-opencontext-v1

Conversation

@ralyodio

@ralyodio ralyodio commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

@logicsrc/opencontext could not be installed from npm. Found while attempting to publish after #132.

Three defects, each of which alone breaks a published tarball:

  1. opencontext had a file: dependency. It declared "@logicsrc/validators": "file:../validators". A file: specifier is unresolvable for anyone installing from the registry, so npm install @logicsrc/opencontext failed outright.

  2. validators imported schemas by a path that escapes its own package. All 50 schemas came in via "../../schemas/schemas/*.json" — correct inside the monorepo, outside the tarball once published. An installed @logicsrc/validators could not load a single schema. Now imported through @logicsrc/schemas package exports, with a real dependency declared.

  3. Three schemas had no export entry. repo, pull-request, and openprd-prd were unreachable by package specifier. Added. The exports map is now sorted so it stays readable as it grows.

validators also gained files, publishConfig, and license so it publishes the way its siblings do.

Verification

Verified the way a stranger would, not just by building:

npm pack --workspace @logicsrc/schemas --workspace @logicsrc/validators --workspace @logicsrc/opencontext
# install the three tarballs into a clean project outside the monorepo
opencontext version           -> 1.0
opencontext init demo         -> project created
opencontext validate --strict -> No problems found.   (exercises schema loading)
opencontext resolve --explain -> resolves, with a digest

validate --strict is the important one: it loads every schema through the package exports, which is exactly the path that was broken.

Full workspace test suite green.

ralyodio and others added 4 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>
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>
@logicsrc/opencontext could not be installed from npm. Three defects, each of
which alone breaks a published tarball:

1. opencontext depended on "@logicsrc/validators": "file:../validators". A
   file: specifier is unresolvable for anyone installing from the registry, so
   `npm install @logicsrc/opencontext` failed outright.

2. validators imported all 50 schemas by relative path across the repository
   ("../../schemas/schemas/*.json"). That resolves inside the monorepo and
   escapes the package once published, so an installed validators could not
   load a single schema. Now imported through @logicsrc/schemas package
   exports, with a real dependency declared.

3. Three of those schemas — repo, pull-request, openprd-prd — had no entry in
   the schemas exports map, so they were unreachable by package specifier.
   Added; the map is now sorted so it stays readable as it grows.

validators also gained files/publishConfig/license so it publishes the same way
its siblings do.

Verified the way a stranger would: npm pack all three, install the tarballs
into a clean project outside the monorepo, and run the installed binary —
version, init, validate --strict (which exercises schema loading through the
package exports), and resolve --explain all succeed. Full workspace suite green.

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

ralyodio commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Superseded: the branch still carries the pre-squash history from #132, so GitHub sees a conflict. Reopening from a clean branch off master with the same change.

@ralyodio ralyodio closed this Aug 9, 2026
@ralyodio
ralyodio deleted the worktree-opencontext-v1 branch August 9, 2026 19:33
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.

1 participant