mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-08-14 06:47:28 +00:00
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:
parent
1bb7ba6e60
commit
ec3ed64f20
211 changed files with 17234 additions and 6 deletions
279
packages/schemas/fixtures/opencontext/conformance.json
Normal file
279
packages/schemas/fixtures/opencontext/conformance.json
Normal file
|
|
@ -0,0 +1,279 @@
|
|||
{
|
||||
"opencontextConformance": "1.0",
|
||||
"description": "Conformance fixtures for LogicSRC OpenContext. A third-party implementation can run these against the published JSON Schemas with no LogicSRC code: every valid fixture MUST validate, and every invalid fixture MUST fail for the stated reason. The resolution/ scenarios go further and pin resolver behaviour — scope, authority, supersession, lifecycle, and redaction — which schemas alone cannot express.",
|
||||
"schemas": {
|
||||
"manifest": "https://logicsrc.com/schemas/opencontext/manifest.schema.json",
|
||||
"object": "https://logicsrc.com/schemas/opencontext/object.schema.json",
|
||||
"bundle": "https://logicsrc.com/schemas/opencontext/bundle.schema.json",
|
||||
"role": "https://logicsrc.com/schemas/opencontext/role.schema.json",
|
||||
"provenance": "https://logicsrc.com/schemas/opencontext/provenance.schema.json",
|
||||
"decision": "https://logicsrc.com/schemas/opencontext/decision.schema.json",
|
||||
"diagnostic": "https://logicsrc.com/schemas/opencontext/diagnostic.schema.json",
|
||||
"audit-event": "https://logicsrc.com/schemas/opencontext/audit-event.schema.json"
|
||||
},
|
||||
"valid": [
|
||||
{
|
||||
"fixture": "valid/manifest.json",
|
||||
"kind": "opencontext-manifest"
|
||||
},
|
||||
{
|
||||
"fixture": "valid/manifest-minimal.json",
|
||||
"kind": "opencontext-manifest"
|
||||
},
|
||||
{
|
||||
"fixture": "valid/object-policy.json",
|
||||
"kind": "opencontext-object"
|
||||
},
|
||||
{
|
||||
"fixture": "valid/object-minimal.json",
|
||||
"kind": "opencontext-object"
|
||||
},
|
||||
{
|
||||
"fixture": "valid/object-structured.json",
|
||||
"kind": "opencontext-object"
|
||||
},
|
||||
{
|
||||
"fixture": "valid/object-untrusted.json",
|
||||
"kind": "opencontext-object"
|
||||
},
|
||||
{
|
||||
"fixture": "valid/decision.json",
|
||||
"kind": "opencontext-decision"
|
||||
},
|
||||
{
|
||||
"fixture": "valid/role.json",
|
||||
"kind": "opencontext-role"
|
||||
},
|
||||
{
|
||||
"fixture": "valid/provenance.json",
|
||||
"kind": "opencontext-provenance"
|
||||
},
|
||||
{
|
||||
"fixture": "valid/provenance-canonical.json",
|
||||
"kind": "opencontext-provenance"
|
||||
},
|
||||
{
|
||||
"fixture": "valid/bundle.json",
|
||||
"kind": "opencontext-bundle"
|
||||
},
|
||||
{
|
||||
"fixture": "valid/diagnostic.json",
|
||||
"kind": "opencontext-diagnostic"
|
||||
},
|
||||
{
|
||||
"fixture": "valid/audit-event.json",
|
||||
"kind": "opencontext-audit-event"
|
||||
}
|
||||
],
|
||||
"invalid": [
|
||||
{
|
||||
"fixture": "invalid/manifest-missing-version.json",
|
||||
"kind": "opencontext-manifest",
|
||||
"why": "manifest has no opencontext version"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/manifest-bad-id.json",
|
||||
"kind": "opencontext-manifest",
|
||||
"why": "namespace id must be a lowercase slug"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/manifest-unknown-key.json",
|
||||
"kind": "opencontext-manifest",
|
||||
"why": "unknown top-level key (contexts vs context)"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/manifest-bad-authority.json",
|
||||
"kind": "opencontext-manifest",
|
||||
"why": "authority precedence contains a level that is not defined"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/manifest-bad-ttl.json",
|
||||
"kind": "opencontext-manifest",
|
||||
"why": "duration must look like 30d"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/manifest-role-bad-pattern.json",
|
||||
"kind": "opencontext-manifest",
|
||||
"why": "a wildcard must be a whole segment, never a substring"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/manifest-bad-extension.json",
|
||||
"kind": "opencontext-manifest",
|
||||
"why": "extension keys must be reverse-DNS namespaced"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-missing-type.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "type is required"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-missing-id.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "id is required"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-bad-id.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "id must be a dotted lowercase slug"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-unknown-authority.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "authority must be one of the six defined levels"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-unknown-classification.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "classification must be public/internal/confidential/restricted"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-unknown-trust.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "trust must be trusted/verified/untrusted"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-extra-property.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "unknown field must go under extensions"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-confidence-out-of-range.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "confidence must be between 0 and 1"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-bad-digest.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "source digest must be sha256:<64 hex>"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-bad-layer.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "layer must be L0 to L5"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-source-without-uri.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "every source needs a uri"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-bad-supersedes.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "version pin must be @<integer>"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-bad-redaction-mode.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "redaction mode must be remove/mask/hash"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/decision-missing-decision.json",
|
||||
"kind": "opencontext-decision",
|
||||
"why": "a decision record must state the decision"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/decision-wrong-type.json",
|
||||
"kind": "opencontext-decision",
|
||||
"why": "type must be decision"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/decision-bad-status.json",
|
||||
"kind": "opencontext-decision",
|
||||
"why": "status must be proposed/accepted/rejected/superseded/deprecated"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/bundle-missing-digest.json",
|
||||
"kind": "opencontext-bundle",
|
||||
"why": "a bundle must carry a digest"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/bundle-bad-digest.json",
|
||||
"kind": "opencontext-bundle",
|
||||
"why": "digest must be sha256:<64 hex>"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/bundle-bad-id.json",
|
||||
"kind": "opencontext-bundle",
|
||||
"why": "bundle_id must be prefixed ocb_"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/bundle-unknown-exclusion-reason.json",
|
||||
"kind": "opencontext-bundle",
|
||||
"why": "exclusion reasons are a closed set"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/role-bad-classification.json",
|
||||
"kind": "opencontext-role",
|
||||
"why": "max_classification must be one of the four bands"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/role-bad-include.json",
|
||||
"kind": "opencontext-role",
|
||||
"why": "scope patterns are lowercase"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/provenance-no-source.json",
|
||||
"kind": "opencontext-provenance",
|
||||
"why": "must declare sources or canonical_source"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/provenance-canonical-false.json",
|
||||
"kind": "opencontext-provenance",
|
||||
"why": "canonical_source: false does not satisfy the requirement"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/diagnostic-unknown-code.json",
|
||||
"kind": "opencontext-diagnostic",
|
||||
"why": "diagnostic codes are normative and closed"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/diagnostic-missing-ok.json",
|
||||
"kind": "opencontext-diagnostic",
|
||||
"why": "ok is required — it is what the exit code follows"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/audit-event-unknown-event.json",
|
||||
"kind": "opencontext-audit-event",
|
||||
"why": "event names are a closed set"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/audit-event-missing-actor.json",
|
||||
"kind": "opencontext-audit-event",
|
||||
"why": "an audit event without an actor is not attributable"
|
||||
}
|
||||
],
|
||||
"resolution": [
|
||||
{
|
||||
"scenario": "resolution/authority-conflict",
|
||||
"expected": "resolution/authority-conflict/expected.json"
|
||||
},
|
||||
{
|
||||
"scenario": "resolution/classification-ceiling",
|
||||
"expected": "resolution/classification-ceiling/expected.json"
|
||||
},
|
||||
{
|
||||
"scenario": "resolution/deny-overrides-allow",
|
||||
"expected": "resolution/deny-overrides-allow/expected.json"
|
||||
},
|
||||
{
|
||||
"scenario": "resolution/duplicate-canonical",
|
||||
"expected": "resolution/duplicate-canonical/expected.json"
|
||||
},
|
||||
{
|
||||
"scenario": "resolution/lifecycle",
|
||||
"expected": "resolution/lifecycle/expected.json"
|
||||
},
|
||||
{
|
||||
"scenario": "resolution/object-permissions",
|
||||
"expected": "resolution/object-permissions/expected.json"
|
||||
},
|
||||
{
|
||||
"scenario": "resolution/redaction",
|
||||
"expected": "resolution/redaction/expected.json"
|
||||
},
|
||||
{
|
||||
"scenario": "resolution/supersession",
|
||||
"expected": "resolution/supersession/expected.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
177
packages/schemas/fixtures/opencontext/invalid-manifest.json
Normal file
177
packages/schemas/fixtures/opencontext/invalid-manifest.json
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
[
|
||||
{
|
||||
"fixture": "invalid/manifest-missing-version.json",
|
||||
"kind": "opencontext-manifest",
|
||||
"why": "manifest has no opencontext version"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/manifest-bad-id.json",
|
||||
"kind": "opencontext-manifest",
|
||||
"why": "namespace id must be a lowercase slug"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/manifest-unknown-key.json",
|
||||
"kind": "opencontext-manifest",
|
||||
"why": "unknown top-level key (contexts vs context)"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/manifest-bad-authority.json",
|
||||
"kind": "opencontext-manifest",
|
||||
"why": "authority precedence contains a level that is not defined"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/manifest-bad-ttl.json",
|
||||
"kind": "opencontext-manifest",
|
||||
"why": "duration must look like 30d"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/manifest-role-bad-pattern.json",
|
||||
"kind": "opencontext-manifest",
|
||||
"why": "a wildcard must be a whole segment, never a substring"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/manifest-bad-extension.json",
|
||||
"kind": "opencontext-manifest",
|
||||
"why": "extension keys must be reverse-DNS namespaced"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-missing-type.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "type is required"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-missing-id.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "id is required"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-bad-id.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "id must be a dotted lowercase slug"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-unknown-authority.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "authority must be one of the six defined levels"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-unknown-classification.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "classification must be public/internal/confidential/restricted"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-unknown-trust.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "trust must be trusted/verified/untrusted"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-extra-property.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "unknown field must go under extensions"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-confidence-out-of-range.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "confidence must be between 0 and 1"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-bad-digest.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "source digest must be sha256:<64 hex>"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-bad-layer.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "layer must be L0 to L5"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-source-without-uri.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "every source needs a uri"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-bad-supersedes.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "version pin must be @<integer>"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/object-bad-redaction-mode.json",
|
||||
"kind": "opencontext-object",
|
||||
"why": "redaction mode must be remove/mask/hash"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/decision-missing-decision.json",
|
||||
"kind": "opencontext-decision",
|
||||
"why": "a decision record must state the decision"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/decision-wrong-type.json",
|
||||
"kind": "opencontext-decision",
|
||||
"why": "type must be decision"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/decision-bad-status.json",
|
||||
"kind": "opencontext-decision",
|
||||
"why": "status must be proposed/accepted/rejected/superseded/deprecated"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/bundle-missing-digest.json",
|
||||
"kind": "opencontext-bundle",
|
||||
"why": "a bundle must carry a digest"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/bundle-bad-digest.json",
|
||||
"kind": "opencontext-bundle",
|
||||
"why": "digest must be sha256:<64 hex>"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/bundle-bad-id.json",
|
||||
"kind": "opencontext-bundle",
|
||||
"why": "bundle_id must be prefixed ocb_"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/bundle-unknown-exclusion-reason.json",
|
||||
"kind": "opencontext-bundle",
|
||||
"why": "exclusion reasons are a closed set"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/role-bad-classification.json",
|
||||
"kind": "opencontext-role",
|
||||
"why": "max_classification must be one of the four bands"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/role-bad-include.json",
|
||||
"kind": "opencontext-role",
|
||||
"why": "scope patterns are lowercase"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/provenance-no-source.json",
|
||||
"kind": "opencontext-provenance",
|
||||
"why": "must declare sources or canonical_source"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/provenance-canonical-false.json",
|
||||
"kind": "opencontext-provenance",
|
||||
"why": "canonical_source: false does not satisfy the requirement"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/diagnostic-unknown-code.json",
|
||||
"kind": "opencontext-diagnostic",
|
||||
"why": "diagnostic codes are normative and closed"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/diagnostic-missing-ok.json",
|
||||
"kind": "opencontext-diagnostic",
|
||||
"why": "ok is required \u2014 it is what the exit code follows"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/audit-event-unknown-event.json",
|
||||
"kind": "opencontext-audit-event",
|
||||
"why": "event names are a closed set"
|
||||
},
|
||||
{
|
||||
"fixture": "invalid/audit-event-missing-actor.json",
|
||||
"kind": "opencontext-audit-event",
|
||||
"why": "an audit event without an actor is not attributable"
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"event": "context.read",
|
||||
"at": "2026-08-09T15:00:00Z"
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"event": "context.peek",
|
||||
"at": "2026-08-09T15:00:00Z",
|
||||
"actor": {
|
||||
"type": "agent",
|
||||
"id": "a"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"bundle_id": "ocb_abc",
|
||||
"generated_at": "2026-08-09T15:00:00Z",
|
||||
"consumer": {
|
||||
"type": "agent",
|
||||
"id": "a"
|
||||
},
|
||||
"objects": [],
|
||||
"digest": "sha1:abc"
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"bundle_id": "bundle-1",
|
||||
"generated_at": "2026-08-09T15:00:00Z",
|
||||
"consumer": {
|
||||
"type": "agent",
|
||||
"id": "a"
|
||||
},
|
||||
"objects": [],
|
||||
"digest": "sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"bundle_id": "ocb_abc",
|
||||
"generated_at": "2026-08-09T15:00:00Z",
|
||||
"consumer": {
|
||||
"type": "agent",
|
||||
"id": "a"
|
||||
},
|
||||
"objects": []
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"bundle_id": "ocb_abc",
|
||||
"generated_at": "2026-08-09T15:00:00Z",
|
||||
"consumer": {
|
||||
"type": "agent",
|
||||
"id": "a"
|
||||
},
|
||||
"objects": [],
|
||||
"excluded": [
|
||||
{
|
||||
"id": "x",
|
||||
"reason": "vibes"
|
||||
}
|
||||
],
|
||||
"digest": "sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"id": "decision.2026-08-09-x",
|
||||
"type": "decision",
|
||||
"title": "X",
|
||||
"decision": "Do X.",
|
||||
"status": "maybe"
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"id": "decision.2026-08-09-x",
|
||||
"type": "decision",
|
||||
"title": "X"
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"id": "decision.2026-08-09-x",
|
||||
"type": "policy",
|
||||
"title": "X",
|
||||
"decision": "Do X."
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"findings": []
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"ok": false,
|
||||
"findings": [
|
||||
{
|
||||
"code": "vibes-off",
|
||||
"severity": "error",
|
||||
"message": "x"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"id": "acme",
|
||||
"authority": {
|
||||
"precedence": [
|
||||
"gospel",
|
||||
"canonical"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"id": "acme",
|
||||
"extensions": {
|
||||
"risk": {
|
||||
"score": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"id": "ACME Corp"
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"id": "acme",
|
||||
"freshness": {
|
||||
"default_ttl": "30 days"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"id": "acme"
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"id": "acme",
|
||||
"roles": {
|
||||
"support": {
|
||||
"include": [
|
||||
"policies.*support"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"id": "acme",
|
||||
"contexts": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"id": "policy.refunds",
|
||||
"type": "policy",
|
||||
"sources": [
|
||||
{
|
||||
"uri": "https://example.com/p",
|
||||
"digest": "md5:abc"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"id": "Policy Refunds",
|
||||
"type": "policy"
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"id": "policy.refunds",
|
||||
"type": "policy",
|
||||
"layer": "L6"
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"id": "c.acme",
|
||||
"type": "customer",
|
||||
"redact": [
|
||||
{
|
||||
"path": "ssn",
|
||||
"mode": "shred"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"id": "policy.refunds",
|
||||
"type": "policy",
|
||||
"supersedes": [
|
||||
"policy.refunds@v2"
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"id": "policy.refunds",
|
||||
"type": "policy",
|
||||
"confidence": 1.5
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"id": "policy.refunds",
|
||||
"type": "policy",
|
||||
"authorship": "support"
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"type": "policy"
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"id": "policy.refunds"
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"id": "policy.refunds",
|
||||
"type": "policy",
|
||||
"sources": [
|
||||
{
|
||||
"type": "document"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"id": "policy.refunds",
|
||||
"type": "policy",
|
||||
"authority": "gospel"
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"id": "policy.refunds",
|
||||
"type": "policy",
|
||||
"classification": "secret"
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"id": "policy.refunds",
|
||||
"type": "policy",
|
||||
"trust": "probably-fine"
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"id": "policies.refunds",
|
||||
"canonical_source": false
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"id": "policies.refunds"
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"id": "support",
|
||||
"max_classification": "top-secret"
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"id": "support",
|
||||
"include": [
|
||||
"Policies.*"
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
id: policies.refunds-observed
|
||||
type: policy
|
||||
layer: L3
|
||||
authority: observed
|
||||
owner: support
|
||||
canonical_source: true
|
||||
---
|
||||
|
||||
An agent observed staff granting refunds up to 60 days.
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
id: policies.refunds
|
||||
type: policy
|
||||
layer: L3
|
||||
authority: canonical
|
||||
owner: support
|
||||
canonical_source: true
|
||||
conflicts_with:
|
||||
- policies.refunds-observed
|
||||
---
|
||||
|
||||
Refunds within 30 days.
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"description": "A declared conflict that authority settles is still reported, never silently hidden. Canonical outranks observed, and the losing side is named in the warning.",
|
||||
"resolve": {
|
||||
"role": "everyone",
|
||||
"at": "2026-08-09T12:00:00Z"
|
||||
},
|
||||
"expect": {
|
||||
"included": [
|
||||
"policies.refunds",
|
||||
"policies.refunds-observed"
|
||||
],
|
||||
"warnings": [
|
||||
"conflict-declared"
|
||||
]
|
||||
},
|
||||
"validate": {
|
||||
"expectDiagnostics": [
|
||||
"conflict-declared"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
opencontext: "1.0"
|
||||
id: conflict-test
|
||||
name: Declared conflicts
|
||||
|
||||
collections:
|
||||
policies: ./context/policies/**
|
||||
|
||||
roles:
|
||||
everyone:
|
||||
include:
|
||||
- policies.*
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
id: docs.handbook
|
||||
type: knowledge
|
||||
layer: L2
|
||||
authority: approved
|
||||
owner: ops
|
||||
classification: internal
|
||||
canonical_source: true
|
||||
---
|
||||
|
||||
How we work.
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
id: docs.litigation
|
||||
type: knowledge
|
||||
layer: L2
|
||||
authority: approved
|
||||
owner: legal
|
||||
classification: restricted
|
||||
canonical_source: true
|
||||
---
|
||||
|
||||
Privileged and confidential.
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"description": "Classification bounds a role regardless of scope: support includes docs.* and is still denied the restricted document, while legal is not.",
|
||||
"resolve": {
|
||||
"role": "support",
|
||||
"at": "2026-08-09T12:00:00Z"
|
||||
},
|
||||
"expect": {
|
||||
"included": [
|
||||
"docs.handbook"
|
||||
],
|
||||
"excluded": [
|
||||
{
|
||||
"id": "docs.litigation",
|
||||
"reason": "classification-denied"
|
||||
}
|
||||
]
|
||||
},
|
||||
"also": [
|
||||
{
|
||||
"resolve": {
|
||||
"role": "legal",
|
||||
"at": "2026-08-09T12:00:00Z"
|
||||
},
|
||||
"expect": {
|
||||
"included": [
|
||||
"docs.handbook",
|
||||
"docs.litigation"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
opencontext: "1.0"
|
||||
id: classification-test
|
||||
name: Classification ceiling
|
||||
|
||||
collections:
|
||||
docs: ./context/docs/**
|
||||
|
||||
roles:
|
||||
support:
|
||||
include:
|
||||
- docs.*
|
||||
max_classification: internal
|
||||
legal:
|
||||
include:
|
||||
- docs.*
|
||||
max_classification: restricted
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
id: mission
|
||||
type: mission
|
||||
layer: L0
|
||||
authority: canonical
|
||||
owner: founders
|
||||
canonical_source: true
|
||||
---
|
||||
|
||||
Make refunds boring.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
id: policies.internal.margins
|
||||
type: policy
|
||||
layer: L3
|
||||
authority: canonical
|
||||
owner: finance
|
||||
canonical_source: true
|
||||
---
|
||||
|
||||
Gross margin floor is 62%.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
id: policies.refunds
|
||||
type: policy
|
||||
layer: L3
|
||||
authority: canonical
|
||||
owner: support
|
||||
canonical_source: true
|
||||
---
|
||||
|
||||
Refunds within 30 days.
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"description": "An exclude pattern beats an include that also matches. Deny overrides allow, unconditionally.",
|
||||
"resolve": {
|
||||
"role": "support",
|
||||
"at": "2026-08-09T12:00:00Z"
|
||||
},
|
||||
"expect": {
|
||||
"included": [
|
||||
"mission",
|
||||
"policies.refunds"
|
||||
],
|
||||
"excluded": [
|
||||
{
|
||||
"id": "policies.internal.margins",
|
||||
"reason": "scope-exclusion"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
opencontext: "1.0"
|
||||
id: scope-test
|
||||
name: Deny overrides allow
|
||||
|
||||
context:
|
||||
mission: ./context/mission.md
|
||||
|
||||
collections:
|
||||
policies: ./context/policies/**
|
||||
|
||||
roles:
|
||||
support:
|
||||
include:
|
||||
- mission
|
||||
- policies.*
|
||||
exclude:
|
||||
- policies.internal.*
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
id: policies.refunds
|
||||
type: policy
|
||||
layer: L3
|
||||
version: 2
|
||||
authority: canonical
|
||||
owner: support
|
||||
canonical_source: true
|
||||
updated: 2026-08-01T00:00:00Z
|
||||
---
|
||||
|
||||
Refunds within 60 days. Nobody added supersedes.
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
id: policies.refunds
|
||||
type: policy
|
||||
layer: L3
|
||||
version: 1
|
||||
authority: canonical
|
||||
owner: support
|
||||
canonical_source: true
|
||||
updated: 2026-01-01T00:00:00Z
|
||||
---
|
||||
|
||||
Refunds within 30 days.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"description": "Two active canonical objects for one id, with no supersession linking them. Canonical means exactly one source of truth, so this is an error a strict run must fail on.",
|
||||
"validate": {
|
||||
"expectDiagnostics": [
|
||||
"duplicate-canonical",
|
||||
"multiple-active-versions"
|
||||
],
|
||||
"expectFailure": true
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
opencontext: "1.0"
|
||||
id: duplicate-test
|
||||
name: Duplicate canonical
|
||||
|
||||
collections:
|
||||
policies: ./context/policies/**
|
||||
|
||||
roles:
|
||||
everyone:
|
||||
include:
|
||||
- policies.*
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
id: notes.current
|
||||
type: note
|
||||
layer: L2
|
||||
authority: reference
|
||||
owner: ops
|
||||
canonical_source: true
|
||||
updated: 2026-08-01T00:00:00Z
|
||||
---
|
||||
|
||||
Fresh, inside the 30d window.
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
id: notes.expired
|
||||
type: note
|
||||
layer: L2
|
||||
authority: reference
|
||||
owner: ops
|
||||
canonical_source: true
|
||||
updated: 2026-08-01T00:00:00Z
|
||||
expires: 2026-08-05T00:00:00Z
|
||||
---
|
||||
|
||||
Expired before the resolution timestamp.
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
id: notes.future
|
||||
type: note
|
||||
layer: L2
|
||||
authority: reference
|
||||
owner: ops
|
||||
canonical_source: true
|
||||
updated: 2026-08-01T00:00:00Z
|
||||
valid_from: 2027-01-01T00:00:00Z
|
||||
---
|
||||
|
||||
Not valid until next year.
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
id: notes.stale
|
||||
type: note
|
||||
layer: L2
|
||||
authority: reference
|
||||
owner: ops
|
||||
canonical_source: true
|
||||
updated: 2026-01-01T00:00:00Z
|
||||
---
|
||||
|
||||
Outside the 30d window, so stale — resolved anyway, and reported.
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"description": "Lifecycle is computed against the resolution timestamp. Expired and not-yet-valid context is excluded; stale context is still resolved, and warned about \u2014 silence would be worse than staleness.",
|
||||
"resolve": {
|
||||
"role": "everyone",
|
||||
"at": "2026-08-09T12:00:00Z"
|
||||
},
|
||||
"expect": {
|
||||
"included": [
|
||||
"notes.current",
|
||||
"notes.stale"
|
||||
],
|
||||
"excluded": [
|
||||
{
|
||||
"id": "notes.expired",
|
||||
"reason": "expired"
|
||||
},
|
||||
{
|
||||
"id": "notes.future",
|
||||
"reason": "not-yet-valid"
|
||||
}
|
||||
],
|
||||
"warnings": [
|
||||
"stale"
|
||||
],
|
||||
"lifecycle": {
|
||||
"notes.current": "current",
|
||||
"notes.stale": "stale"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
opencontext: "1.0"
|
||||
id: lifecycle-test
|
||||
name: Lifecycle
|
||||
|
||||
collections:
|
||||
notes: ./context/notes/**
|
||||
|
||||
freshness:
|
||||
default_ttl: 30d
|
||||
|
||||
roles:
|
||||
everyone:
|
||||
include:
|
||||
- notes.*
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
id: policies.payroll
|
||||
type: policy
|
||||
layer: L3
|
||||
authority: canonical
|
||||
owner: finance
|
||||
canonical_source: true
|
||||
permissions:
|
||||
read: [finance]
|
||||
---
|
||||
|
||||
Payroll runs on the 25th.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
id: policies.refunds
|
||||
type: policy
|
||||
layer: L3
|
||||
authority: canonical
|
||||
owner: support
|
||||
canonical_source: true
|
||||
---
|
||||
|
||||
Refunds within 30 days.
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"description": "An object-level read grant narrows a role that would otherwise include it. Both roles include policies.*; only finance may read the payroll policy.",
|
||||
"resolve": {
|
||||
"role": "support",
|
||||
"at": "2026-08-09T12:00:00Z"
|
||||
},
|
||||
"expect": {
|
||||
"included": [
|
||||
"policies.refunds"
|
||||
],
|
||||
"excluded": [
|
||||
{
|
||||
"id": "policies.payroll",
|
||||
"reason": "permission-denied"
|
||||
}
|
||||
]
|
||||
},
|
||||
"also": [
|
||||
{
|
||||
"resolve": {
|
||||
"role": "finance",
|
||||
"at": "2026-08-09T12:00:00Z"
|
||||
},
|
||||
"expect": {
|
||||
"included": [
|
||||
"policies.payroll",
|
||||
"policies.refunds"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
opencontext: "1.0"
|
||||
id: permissions-test
|
||||
name: Object-level permissions
|
||||
|
||||
collections:
|
||||
policies: ./context/policies/**
|
||||
|
||||
roles:
|
||||
support:
|
||||
include:
|
||||
- policies.*
|
||||
finance:
|
||||
include:
|
||||
- policies.*
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"id": "customers.acme",
|
||||
"type": "customer",
|
||||
"layer": "L2",
|
||||
"title": "ACME Inc.",
|
||||
"authority": "reference",
|
||||
"owner": "support",
|
||||
"classification": "confidential",
|
||||
"canonical_source": true,
|
||||
"content": {
|
||||
"name": "ACME Inc.",
|
||||
"plan": "enterprise",
|
||||
"ssn": "000-00-0000",
|
||||
"contacts": [
|
||||
{
|
||||
"name": "Dana",
|
||||
"email": "dana@acme.example"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"description": "Redaction runs after authorization: the consumer is entitled to the record, and still does not receive the SSN. The bundle discloses that redaction happened without disclosing what was redacted.",
|
||||
"resolve": {
|
||||
"role": "support",
|
||||
"at": "2026-08-09T12:00:00Z"
|
||||
},
|
||||
"expect": {
|
||||
"included": [
|
||||
"customers.acme"
|
||||
],
|
||||
"redacted": {
|
||||
"customers.acme": [
|
||||
"ssn",
|
||||
"contacts[*].email"
|
||||
]
|
||||
},
|
||||
"contentAbsent": {
|
||||
"customers.acme": [
|
||||
"ssn"
|
||||
]
|
||||
},
|
||||
"contentEquals": {
|
||||
"customers.acme": {
|
||||
"contacts.0.email": "[REDACTED]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
opencontext: "1.0"
|
||||
id: redaction-test
|
||||
name: Redaction
|
||||
|
||||
collections:
|
||||
customers: ./context/customers/**
|
||||
|
||||
roles:
|
||||
support:
|
||||
include:
|
||||
- customers.*
|
||||
max_classification: confidential
|
||||
redact:
|
||||
- path: ssn
|
||||
mode: remove
|
||||
reason: PII
|
||||
- path: contacts[*].email
|
||||
mode: mask
|
||||
replacement: "[REDACTED]"
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
id: pricing.enterprise
|
||||
type: policy
|
||||
layer: L3
|
||||
version: 1
|
||||
authority: canonical
|
||||
owner: sales
|
||||
canonical_source: true
|
||||
updated: 2026-01-01T00:00:00Z
|
||||
---
|
||||
|
||||
Enterprise plans start at $1,800/month.
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
id: pricing.enterprise
|
||||
type: policy
|
||||
layer: L3
|
||||
version: 2
|
||||
authority: canonical
|
||||
owner: sales
|
||||
canonical_source: true
|
||||
updated: 2026-08-01T00:00:00Z
|
||||
supersedes:
|
||||
- pricing.enterprise@1
|
||||
---
|
||||
|
||||
Enterprise plans start at $2,500/month.
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"description": "Superseded versions are retained on disk and excluded from default resolution; --include-historical brings them back so a past view can be reconstructed.",
|
||||
"resolve": {
|
||||
"role": "sales",
|
||||
"at": "2026-08-09T12:00:00Z"
|
||||
},
|
||||
"expect": {
|
||||
"included": [
|
||||
"pricing.enterprise"
|
||||
],
|
||||
"includedVersions": {
|
||||
"pricing.enterprise": 2
|
||||
},
|
||||
"excluded": [
|
||||
{
|
||||
"id": "pricing.enterprise",
|
||||
"reason": "superseded"
|
||||
}
|
||||
]
|
||||
},
|
||||
"also": [
|
||||
{
|
||||
"resolve": {
|
||||
"role": "sales",
|
||||
"at": "2026-08-09T12:00:00Z",
|
||||
"includeHistorical": true
|
||||
},
|
||||
"expect": {
|
||||
"objectCount": 2
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
opencontext: "1.0"
|
||||
id: supersession-test
|
||||
name: Supersession
|
||||
|
||||
collections:
|
||||
pricing: ./context/pricing/**
|
||||
|
||||
roles:
|
||||
sales:
|
||||
include:
|
||||
- pricing.*
|
||||
26
packages/schemas/fixtures/opencontext/valid/audit-event.json
Normal file
26
packages/schemas/fixtures/opencontext/valid/audit-event.json
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"event": "context.resolve",
|
||||
"at": "2026-08-09T15:00:00Z",
|
||||
"actor": {
|
||||
"type": "agent",
|
||||
"id": "support-agent",
|
||||
"roles": [
|
||||
"support"
|
||||
],
|
||||
"on_behalf_of": "dana@acme.example"
|
||||
},
|
||||
"task": "Handle refund request for ACME",
|
||||
"objects": [
|
||||
"mission",
|
||||
"policies.refunds"
|
||||
],
|
||||
"bundle": {
|
||||
"bundle_id": "ocb_3b541a2e1a933b60",
|
||||
"digest": "sha256:eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
|
||||
"object_count": 2
|
||||
},
|
||||
"outcome": "partial",
|
||||
"reason": "3 objects excluded by scope",
|
||||
"namespace": "acme"
|
||||
}
|
||||
67
packages/schemas/fixtures/opencontext/valid/bundle.json
Normal file
67
packages/schemas/fixtures/opencontext/valid/bundle.json
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"bundle_id": "ocb_3b541a2e1a933b60",
|
||||
"generated_at": "2026-08-09T15:00:00Z",
|
||||
"namespace": "acme",
|
||||
"consumer": {
|
||||
"type": "agent",
|
||||
"id": "support-agent",
|
||||
"roles": [
|
||||
"support"
|
||||
]
|
||||
},
|
||||
"task": "Handle refund request for ACME",
|
||||
"as_of": "2026-08-09T15:00:00Z",
|
||||
"objects": [
|
||||
{
|
||||
"id": "mission",
|
||||
"type": "mission",
|
||||
"layer": "L0",
|
||||
"title": "Why ACME exists",
|
||||
"content": "ACME exists to make refunds boring.",
|
||||
"authority": "canonical",
|
||||
"trust": "trusted",
|
||||
"owner": "founders",
|
||||
"lifecycle": "current",
|
||||
"classification": "public"
|
||||
}
|
||||
],
|
||||
"excluded": [
|
||||
{
|
||||
"id": "finance.payroll",
|
||||
"reason": "permission-denied",
|
||||
"detail": "outside the support scope"
|
||||
},
|
||||
{
|
||||
"id": "policies.refunds.v1",
|
||||
"reason": "superseded",
|
||||
"outranked_by": "policies.refunds"
|
||||
}
|
||||
],
|
||||
"warnings": [
|
||||
{
|
||||
"code": "stale",
|
||||
"message": "procedures.refund is stale.",
|
||||
"id": "procedures.refund",
|
||||
"severity": "warning"
|
||||
}
|
||||
],
|
||||
"provenance": [
|
||||
{
|
||||
"id": "mission",
|
||||
"canonical_source": true
|
||||
}
|
||||
],
|
||||
"permissions": [
|
||||
"customer.read",
|
||||
"ticket.write"
|
||||
],
|
||||
"stats": {
|
||||
"considered": 12,
|
||||
"included": 1,
|
||||
"excluded": 2,
|
||||
"redacted": 0,
|
||||
"characters": 38
|
||||
},
|
||||
"digest": "sha256:dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"
|
||||
}
|
||||
51
packages/schemas/fixtures/opencontext/valid/decision.json
Normal file
51
packages/schemas/fixtures/opencontext/valid/decision.json
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"id": "decision.2026-08-09-model-provider",
|
||||
"type": "decision",
|
||||
"layer": "L5",
|
||||
"title": "Default model provider",
|
||||
"authority": "approved",
|
||||
"owner": "platform",
|
||||
"status": "accepted",
|
||||
"decision": "Use provider X as the default runtime.",
|
||||
"rationale": [
|
||||
"latency",
|
||||
"cost",
|
||||
"reliability"
|
||||
],
|
||||
"alternatives": [
|
||||
{
|
||||
"option": "provider Y",
|
||||
"rejected_because": "no EU region"
|
||||
}
|
||||
],
|
||||
"consequences": [
|
||||
"Re-evaluate at renewal."
|
||||
],
|
||||
"approved_by": [
|
||||
{
|
||||
"role": "CTO",
|
||||
"at": "2026-08-09T15:00:00Z"
|
||||
}
|
||||
],
|
||||
"decided_by": {
|
||||
"type": "human",
|
||||
"id": "cto@acme.example"
|
||||
},
|
||||
"bundle": {
|
||||
"bundle_id": "ocb_3b541a2e1a933b60",
|
||||
"digest": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
||||
"generated_at": "2026-08-09T15:00:00Z"
|
||||
},
|
||||
"created": "2026-08-09T15:00:00Z",
|
||||
"updated": "2026-08-09T15:00:00Z",
|
||||
"durability": "long-lived",
|
||||
"classification": "internal",
|
||||
"canonical_source": true,
|
||||
"references": [
|
||||
"policies.vendor-selection"
|
||||
],
|
||||
"tags": [
|
||||
"platform"
|
||||
],
|
||||
"version": 1
|
||||
}
|
||||
37
packages/schemas/fixtures/opencontext/valid/diagnostic.json
Normal file
37
packages/schemas/fixtures/opencontext/valid/diagnostic.json
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"ok": false,
|
||||
"generated_at": "2026-08-09T15:00:00Z",
|
||||
"namespace": "acme",
|
||||
"score": 91.5,
|
||||
"counts": {
|
||||
"objects": 42,
|
||||
"errors": 1,
|
||||
"warnings": 3,
|
||||
"info": 0,
|
||||
"stale": 3,
|
||||
"expired": 0,
|
||||
"conflicting": 1,
|
||||
"orphaned": 7,
|
||||
"missing_owner": 3,
|
||||
"broken_sources": 1
|
||||
},
|
||||
"findings": [
|
||||
{
|
||||
"code": "duplicate-canonical",
|
||||
"severity": "error",
|
||||
"message": "2 active canonical objects share the id \"policies.refunds\".",
|
||||
"id": "policies.refunds",
|
||||
"ids": [
|
||||
"context/policies/refunds.md",
|
||||
"context/policies/refunds-new.md"
|
||||
],
|
||||
"file": "context/policies/refunds.md",
|
||||
"line": 3,
|
||||
"field": "authority",
|
||||
"expected": "exactly one canonical object per id",
|
||||
"actual": 2,
|
||||
"remediation": "Supersede the older one, or lower its authority to reference."
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"id": "example"
|
||||
}
|
||||
134
packages/schemas/fixtures/opencontext/valid/manifest.json
Normal file
134
packages/schemas/fixtures/opencontext/valid/manifest.json
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
{
|
||||
"opencontext": "1.0",
|
||||
"id": "acme",
|
||||
"name": "ACME Corporation",
|
||||
"description": "Every durable thing ACME's humans and agents need to know.",
|
||||
"context": {
|
||||
"mission": "./context/mission.md",
|
||||
"glossary": "./context/glossary.md"
|
||||
},
|
||||
"collections": {
|
||||
"policies": "./context/policies/**",
|
||||
"procedures": {
|
||||
"source": "./context/sops/**",
|
||||
"type": "procedure",
|
||||
"layer": "L4",
|
||||
"owner": "support"
|
||||
}
|
||||
},
|
||||
"roles": {
|
||||
"support": {
|
||||
"description": "Front-line support.",
|
||||
"include": [
|
||||
"mission",
|
||||
"glossary",
|
||||
"policies.*",
|
||||
"procedures.*"
|
||||
],
|
||||
"exclude": [
|
||||
"policies.internal.*"
|
||||
],
|
||||
"permissions": [
|
||||
"customer.read",
|
||||
"ticket.write"
|
||||
],
|
||||
"max_classification": "internal",
|
||||
"redact": [
|
||||
{
|
||||
"path": "customer.ssn",
|
||||
"mode": "remove",
|
||||
"reason": "PII"
|
||||
}
|
||||
]
|
||||
},
|
||||
"finance": {
|
||||
"include": [
|
||||
"mission",
|
||||
"policies.*"
|
||||
],
|
||||
"max_classification": "confidential",
|
||||
"inherits": [
|
||||
"support"
|
||||
]
|
||||
}
|
||||
},
|
||||
"agents": {
|
||||
"support-agent": {
|
||||
"roles": [
|
||||
"support"
|
||||
],
|
||||
"description": "Handles tickets."
|
||||
}
|
||||
},
|
||||
"authority": {
|
||||
"precedence": [
|
||||
"canonical",
|
||||
"approved",
|
||||
"reference",
|
||||
"observed",
|
||||
"inferred",
|
||||
"historical"
|
||||
],
|
||||
"tie_breakers": [
|
||||
"version",
|
||||
"updated",
|
||||
"confidence",
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"freshness": {
|
||||
"default_ttl": "30d",
|
||||
"stale_is_error": false,
|
||||
"exclude_expired": true
|
||||
},
|
||||
"provenance": {
|
||||
"required": true,
|
||||
"digest": "sha256",
|
||||
"require_digest": false
|
||||
},
|
||||
"audit": {
|
||||
"context_reads": true,
|
||||
"context_writes": true,
|
||||
"decisions": true,
|
||||
"sink": "file://./context/.audit/events.ndjson"
|
||||
},
|
||||
"redact": [
|
||||
{
|
||||
"path": "payment.card",
|
||||
"mode": "mask",
|
||||
"replacement": "[REDACTED]"
|
||||
}
|
||||
],
|
||||
"review": {
|
||||
"interval": "180d",
|
||||
"required_approvers": 2
|
||||
},
|
||||
"adapters": {
|
||||
"https": {
|
||||
"enabled": true,
|
||||
"trust": "untrusted",
|
||||
"timeout_ms": 5000
|
||||
}
|
||||
},
|
||||
"defaults": {
|
||||
"classification": "internal",
|
||||
"trust": "trusted"
|
||||
},
|
||||
"health": {
|
||||
"minimum_score": 90,
|
||||
"fail_on": "error",
|
||||
"require_owner": true,
|
||||
"weights": {
|
||||
"stale": 0.2
|
||||
}
|
||||
},
|
||||
"related": {
|
||||
"prd": "./openprd.yaml",
|
||||
"topology": "./opentopology.yaml"
|
||||
},
|
||||
"extensions": {
|
||||
"com.acme.region": {
|
||||
"primary": "eu-west-1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"id": "policy.refunds",
|
||||
"type": "policy"
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
"id": "pricing.enterprise",
|
||||
"type": "policy",
|
||||
"layer": "L3",
|
||||
"title": "Enterprise Pricing",
|
||||
"content": "Enterprise plans start at $2,500/month.\n",
|
||||
"content_type": "text/markdown",
|
||||
"authority": "canonical",
|
||||
"trust": "trusted",
|
||||
"owner": "sales",
|
||||
"status": "approved",
|
||||
"version": 3,
|
||||
"created": "2026-07-01T00:00:00Z",
|
||||
"updated": "2026-08-09T00:00:00Z",
|
||||
"valid_from": "2026-08-01T00:00:00Z",
|
||||
"expires": null,
|
||||
"durability": "long-lived",
|
||||
"classification": "internal",
|
||||
"permissions": {
|
||||
"read": [
|
||||
"sales-agent",
|
||||
"finance-agent"
|
||||
],
|
||||
"write": [
|
||||
"sales-admin"
|
||||
]
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"uri": "crm://pricing/enterprise",
|
||||
"type": "canonical-record",
|
||||
"retrieved_at": "2026-08-09T15:00:00Z",
|
||||
"digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
"trust": "verified"
|
||||
}
|
||||
],
|
||||
"supersedes": [
|
||||
"pricing.enterprise@2"
|
||||
],
|
||||
"confidence": 1.0,
|
||||
"tags": [
|
||||
"pricing",
|
||||
"enterprise"
|
||||
],
|
||||
"applies_to": [
|
||||
"sales"
|
||||
],
|
||||
"references": [
|
||||
"policies.discounts"
|
||||
],
|
||||
"approval": {
|
||||
"required": true,
|
||||
"roles": [
|
||||
"finance"
|
||||
],
|
||||
"minimum": 1,
|
||||
"approved_by": [
|
||||
{
|
||||
"role": "finance",
|
||||
"id": "cfo@acme.example",
|
||||
"at": "2026-08-08T10:00:00Z"
|
||||
}
|
||||
]
|
||||
},
|
||||
"review": {
|
||||
"interval": "180d",
|
||||
"next_review": "2027-02-09",
|
||||
"last_review": "2026-08-09"
|
||||
},
|
||||
"extensions": {
|
||||
"com.acme.risk": {
|
||||
"score": 0.25
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"id": "customers.acme",
|
||||
"type": "customer",
|
||||
"layer": "L2",
|
||||
"title": "ACME Inc.",
|
||||
"content": {
|
||||
"name": "ACME Inc.",
|
||||
"plan": "enterprise",
|
||||
"ssn": "000-00-0000",
|
||||
"contacts": [
|
||||
{
|
||||
"name": "Dana",
|
||||
"email": "dana@acme.example"
|
||||
}
|
||||
]
|
||||
},
|
||||
"content_type": "application/json",
|
||||
"authority": "reference",
|
||||
"owner": "support",
|
||||
"classification": "confidential",
|
||||
"redact": [
|
||||
{
|
||||
"path": "ssn",
|
||||
"mode": "remove"
|
||||
},
|
||||
{
|
||||
"path": "contacts[*].email",
|
||||
"mode": "hash"
|
||||
}
|
||||
],
|
||||
"canonical_source": true,
|
||||
"durability": "operational",
|
||||
"trust": "verified"
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"id": "operations.ticket-4821",
|
||||
"type": "operational",
|
||||
"layer": "L5",
|
||||
"title": "Ticket 4821",
|
||||
"content_uri": "https://support.example.com/tickets/4821",
|
||||
"authority": "observed",
|
||||
"trust": "untrusted",
|
||||
"owner": "support",
|
||||
"durability": "session",
|
||||
"classification": "internal",
|
||||
"sources": [
|
||||
{
|
||||
"uri": "https://support.example.com/tickets/4821",
|
||||
"type": "conversation",
|
||||
"trust": "untrusted"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"id": "mission",
|
||||
"canonical_source": true
|
||||
}
|
||||
14
packages/schemas/fixtures/opencontext/valid/provenance.json
Normal file
14
packages/schemas/fixtures/opencontext/valid/provenance.json
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"id": "policies.refunds",
|
||||
"sources": [
|
||||
{
|
||||
"uri": "git://github.com/acme/context/policies/refunds.md",
|
||||
"type": "document",
|
||||
"retrieved_at": "2026-08-09T15:00:00Z",
|
||||
"digest": "sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
|
||||
"trust": "trusted",
|
||||
"author": "support"
|
||||
}
|
||||
],
|
||||
"retrieved_at": "2026-08-09T15:00:00Z"
|
||||
}
|
||||
38
packages/schemas/fixtures/opencontext/valid/role.json
Normal file
38
packages/schemas/fixtures/opencontext/valid/role.json
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"id": "support",
|
||||
"description": "Front-line customer support.",
|
||||
"include": [
|
||||
"mission",
|
||||
"organization.public",
|
||||
"products.*",
|
||||
"customers.current",
|
||||
"policies.support.*"
|
||||
],
|
||||
"exclude": [
|
||||
"finance.payroll.*",
|
||||
"legal.privileged.*"
|
||||
],
|
||||
"permissions": [
|
||||
"customer.read",
|
||||
"ticket.read",
|
||||
"ticket.write"
|
||||
],
|
||||
"max_classification": "internal",
|
||||
"redact": [
|
||||
{
|
||||
"path": "customer.ssn"
|
||||
},
|
||||
{
|
||||
"path": "payment.card",
|
||||
"mode": "mask"
|
||||
}
|
||||
],
|
||||
"inherits": [
|
||||
"everyone"
|
||||
],
|
||||
"extensions": {
|
||||
"com.acme.tier": {
|
||||
"level": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue