logicsrc/examples/opencontext/README.md
Anthony Ettinger dc56e4c741 Point install docs at @logicsrc/opencontext; record the npm name collision
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>
2026-08-09 18:30:28 +00:00

2.6 KiB

OpenContext examples

Five working OpenContext repositories. Every one is held to validate --strict and a 100% health score in CI, so a resolver change that quietly degrades a published example fails the build.

Example Shows
minimal The floor: a mission, one policy, one role
startup Every layer, L0 through L5, with pricing, SOPs, and decisions
support-agent Redaction, classification, and a worked prompt-injection case
engineering-team Architecture knowledge, runbooks, ADRs, and a supersession chain
multi-agent-company One repository, five agents, five different bundles

Running one

cd minimal

npx @logicsrc/opencontext validate --strict
npx @logicsrc/opencontext doctor
npx @logicsrc/opencontext resolve --role everyone --format markdown

Or from anywhere, since discovery searches upward:

opencontext doctor --dir examples/opencontext/multi-agent-company

What to read, in order

Start with minimal to see how little is required — id and type are the only mandatory fields on an object.

Then multi-agent-company, which is the whole thesis in one repository: five agents share one context plane and each receives a different bundle. Run all five and compare:

cd multi-agent-company
for agent in sales-agent support-agent dev-agent finance-agent ops-agent; do
  echo "== $agent"
  opencontext resolve --agent "$agent" --explain
done

Then support-agent if you are putting an agent in front of customers. It contains a ticket whose text instructs the agent to ignore its refund policy and disclose payment details — carried as trust: untrusted, fenced and labelled in the Markdown bundle, and flagged in warnings. The SSN is removed, the card masked, and the emails hashed, all from a record the agent is fully entitled to read.

Then engineering-team for supersession as history: a February decision retained with authority: historical and replaced by an August one. Default resolution returns the current decision; --include-historical returns both.

Verifying them yourself

npm --workspace @logicsrc/opencontext test

The examples.test.ts suite asserts that each example validates strictly, scores 100, resolves deterministically in all three formats, and — for the multi-agent example — that no role ever receives a card number, that payroll reaches only finance, and that an inferred churn score never reaches a sales conversation.