pluribus-context 0.3.34 → 0.3.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +2 -1
  3. package/bin/pluribus.js +12 -0
  4. package/docs/agent-firewall-denial-audit.md +95 -0
  5. package/docs/ai-pr-review-receipts.md +173 -0
  6. package/docs/canonical-output-receipts.md +107 -0
  7. package/docs/compaction-resume-receipts.md +43 -0
  8. package/docs/controlled-learning-queue.md +48 -0
  9. package/docs/dynamic-workflow-run-receipts.md +158 -0
  10. package/docs/install-plan-receipts.md +79 -0
  11. package/docs/loaded-resource-boundary.md +97 -0
  12. package/docs/mcp-tool-visibility-receipts.md +67 -0
  13. package/docs/memory-write-policy-receipts.md +41 -0
  14. package/docs/parallel-session-review-ledger.md +103 -0
  15. package/docs/phase-boundary-contracts.md +87 -0
  16. package/docs/review-primitive-gate.md +109 -0
  17. package/docs/skill-install-receipts.md +102 -0
  18. package/docs/skill-policy-receipts.md +87 -0
  19. package/docs/skill-use-rate-receipts.md +104 -0
  20. package/docs/subagent-role-receipts.md +95 -0
  21. package/docs/temporal-context-receipts.md +123 -0
  22. package/examples/agent-firewall-denial-audit/README.md +14 -0
  23. package/examples/agent-firewall-denial-audit/check-denial-audit.mjs +116 -0
  24. package/examples/agent-firewall-denial-audit/denial-envelope.json +9 -0
  25. package/examples/agent-firewall-denial-audit/operator-audit-record.json +20 -0
  26. package/examples/agent-skills/skill-policy-receipts/README.md +22 -0
  27. package/examples/agent-skills/skill-policy-receipts/SKILL.md +77 -0
  28. package/examples/ai-pr-review-receipts/.github/pull_request_template.md +31 -0
  29. package/examples/ai-pr-review-receipts/.github/workflows/ai-pr-review-receipt.yml +25 -0
  30. package/examples/ai-pr-review-receipts/README.md +55 -0
  31. package/examples/ai-pr-review-receipts/incomplete-review-primitive-receipt.json +43 -0
  32. package/examples/ai-pr-review-receipts/review-primitive-receipt.json +60 -0
  33. package/examples/canonical-output-receipts/canonical-output-receipt.json +55 -0
  34. package/examples/claude-code-review-hook/README.md +74 -0
  35. package/examples/claude-code-review-hook/check-review-receipt-hook.mjs +80 -0
  36. package/examples/claude-code-review-hook/sample-task-completed-event.json +6 -0
  37. package/examples/compaction-resume-receipts/README.md +12 -0
  38. package/examples/compaction-resume-receipts/check-resume-receipt.mjs +116 -0
  39. package/examples/compaction-resume-receipts/safe-resume-receipt.json +52 -0
  40. package/examples/compaction-resume-receipts/unsafe-resume-receipt.json +41 -0
  41. package/examples/controlled-learning-queue/README.md +26 -0
  42. package/examples/controlled-learning-queue/check-learning-queue.mjs +44 -0
  43. package/examples/controlled-learning-queue/leads/acme-job-card.md +12 -0
  44. package/examples/controlled-learning-queue/learning_queue.md +27 -0
  45. package/examples/controlled-learning-queue/memory/durable.md +10 -0
  46. package/examples/controlled-learning-queue/memory/working-notes.md +5 -0
  47. package/examples/controlled-learning-queue/role/job-contract.md +18 -0
  48. package/examples/controlled-learning-queue/skills/qualify-lead.md +17 -0
  49. package/examples/dynamic-workflow-run-receipts/README.md +18 -0
  50. package/examples/dynamic-workflow-run-receipts/workflow-run-receipt.json +112 -0
  51. package/examples/install-plan-receipts/README.md +34 -0
  52. package/examples/install-plan-receipts/agent-install-plan-receipt.json +56 -0
  53. package/examples/loaded-resource-boundary/README.md +22 -0
  54. package/examples/loaded-resource-boundary/check-loaded-resource-boundary.mjs +65 -0
  55. package/examples/loaded-resource-boundary/loaded-resource-boundary.json +69 -0
  56. package/examples/memory-write-policy/README.md +28 -0
  57. package/examples/memory-write-policy/approved-memory-update.json +48 -0
  58. package/examples/memory-write-policy/check-memory-update.mjs +120 -0
  59. package/examples/memory-write-policy/quarantined-memory-update.json +43 -0
  60. package/examples/parallel-session-review-ledger/README.md +13 -0
  61. package/examples/parallel-session-review-ledger/check-parallel-session-review-ledger.mjs +69 -0
  62. package/examples/parallel-session-review-ledger/parallel-session-review-ledger.json +72 -0
  63. package/examples/phase-boundary-contract/README.md +23 -0
  64. package/examples/phase-boundary-contract/check-phase-boundary.mjs +73 -0
  65. package/examples/phase-boundary-contract/phase-boundary-contract.json +68 -0
  66. package/examples/review-primitive-gate/README.md +19 -0
  67. package/examples/review-primitive-gate/check-review-receipt.mjs +100 -0
  68. package/examples/review-primitive-gate/fail-review-receipt.json +42 -0
  69. package/examples/review-primitive-gate/pass-review-receipt.json +54 -0
  70. package/examples/skill-install-receipts/README.md +31 -0
  71. package/examples/skill-install-receipts/check-skill-install-receipt.mjs +75 -0
  72. package/examples/skill-install-receipts/skill-install-receipt.json +79 -0
  73. package/examples/skill-use-rate-receipts/README.md +16 -0
  74. package/examples/skill-use-rate-receipts/check-skill-use-rate.mjs +89 -0
  75. package/examples/skill-use-rate-receipts/skill-use-rate-receipt.json +79 -0
  76. package/examples/subagent-role-receipts/README.md +15 -0
  77. package/examples/subagent-role-receipts/agents.toml +36 -0
  78. package/examples/temporal-context-receipts/CURRENT_STATE.md +13 -0
  79. package/examples/temporal-context-receipts/specs/2025-checkout-rewrite.md +10 -0
  80. package/examples/temporal-context-receipts/specs/2026-checkout-risk-notes.md +10 -0
  81. package/examples/temporal-context-receipts/temporal-authority-receipt.json +27 -0
  82. package/package.json +1 -1
  83. package/src/commands/demo.js +155 -0
  84. package/src/index.js +1 -0
  85. package/src/utils/version.js +1 -1
@@ -0,0 +1,56 @@
1
+ {
2
+ "receipt_type": "agent.install.plan.v1",
3
+ "run_id": "demo-install-2026-05-29T16:00Z",
4
+ "installer": "example-agent-setup",
5
+ "mode_requested": "plan",
6
+ "mode_effective": "plan",
7
+ "agents_detected": [
8
+ "claude-code",
9
+ "cursor",
10
+ "codex",
11
+ "openclaw"
12
+ ],
13
+ "agents_selected": [
14
+ "claude-code",
15
+ "openclaw"
16
+ ],
17
+ "planned_writes": [
18
+ {
19
+ "kind": "mcp_config",
20
+ "target": "claude-code project config",
21
+ "operation": "add_local_mcp_server",
22
+ "backup_planned": true
23
+ },
24
+ {
25
+ "kind": "instruction_file",
26
+ "target": "AGENTS.md",
27
+ "operation": "append_usage_notes",
28
+ "backup_planned": true
29
+ },
30
+ {
31
+ "kind": "hook",
32
+ "target": "pre-tool hook config",
33
+ "operation": "register_receipt_guard",
34
+ "backup_planned": true
35
+ }
36
+ ],
37
+ "external_commands_planned": [
38
+ {
39
+ "phase": "apply",
40
+ "command_class": "package_manager_install"
41
+ }
42
+ ],
43
+ "network_after_install": "local_mcp_server_only",
44
+ "writes_started": false,
45
+ "next_safe_command": "example-agent-setup apply --from-plan install-plan.json",
46
+ "privacy_exclusions": [
47
+ "raw_source",
48
+ "secrets",
49
+ "env_dump",
50
+ "raw_prompt",
51
+ "transcript",
52
+ "raw_tool_output",
53
+ "customer_data",
54
+ "private_absolute_path"
55
+ ]
56
+ }
@@ -0,0 +1,22 @@
1
+ # Loaded-resource boundary example
2
+
3
+ This example turns "my Skill works in chat but disappears in ACP/Zed/CLI" into a stage-level receipt.
4
+
5
+ Run:
6
+
7
+ ```bash
8
+ node check-loaded-resource-boundary.mjs loaded-resource-boundary.json
9
+ ```
10
+
11
+ Expected output:
12
+
13
+ ```text
14
+ loaded-resource boundary ok: 1 required resource/runtime gap recorded
15
+ ```
16
+
17
+ The sample records the same project skills across two sessions:
18
+
19
+ - `chat` discovers, attaches, injects, and reads `skill:pr-review`;
20
+ - `acp`/`zed` discovers and attaches it, but never injects it, so the receipt records `runtime_does_not_inject_resources` and sets `safe_to_continue=false`.
21
+
22
+ Use this shape when prompt instructions cannot explain a missing Skill. The host/runtime needs to prove the resource crossed the boundary, not merely that it exists on disk.
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs';
3
+
4
+ const file = process.argv[2] ?? new URL('./loaded-resource-boundary.json', import.meta.url);
5
+ const receipt = JSON.parse(fs.readFileSync(file, 'utf8'));
6
+ const fail = (message) => {
7
+ console.error(`loaded-resource boundary invalid: ${message}`);
8
+ process.exit(1);
9
+ };
10
+
11
+ if (receipt.receipt_type !== 'pluribus.loaded_resource_boundary.v1') fail('unexpected receipt_type');
12
+ if (!Array.isArray(receipt.expected_resources) || receipt.expected_resources.length === 0) fail('expected_resources must be non-empty');
13
+ if (!Array.isArray(receipt.sessions) || receipt.sessions.length < 2) fail('sessions must include at least two runtimes for parity checks');
14
+
15
+ const expectedIds = new Set(receipt.expected_resources.map((resource) => resource.id));
16
+ const requiredIds = new Set(receipt.expected_resources.filter((resource) => resource.required !== false).map((resource) => resource.id));
17
+ for (const resource of receipt.expected_resources) {
18
+ if (!resource.id || !resource.kind || !resource.source_ref || !resource.source_hash?.startsWith('sha256:')) {
19
+ fail(`expected resource ${resource.id ?? '<missing>'} needs id, kind, source_ref, and sha256 source_hash`);
20
+ }
21
+ }
22
+
23
+ const allowedSkipReasons = new Set([
24
+ 'not_discovered',
25
+ 'not_attached_to_agent',
26
+ 'runtime_does_not_inject_resources',
27
+ 'trigger_not_matched',
28
+ 'resource_read_failed'
29
+ ]);
30
+
31
+ let mismatches = 0;
32
+ for (const session of receipt.sessions) {
33
+ for (const key of ['runtime', 'client', 'agent']) {
34
+ if (!session[key]) fail(`session ${session.session_id ?? '<missing>'} missing ${key}`);
35
+ }
36
+ for (const listName of ['discovered_resources', 'attached_resources', 'injected_resources', 'readable_resources', 'skipped_resources']) {
37
+ if (!Array.isArray(session[listName])) fail(`${session.session_id}: ${listName} must be an array`);
38
+ }
39
+
40
+ const stageSets = {
41
+ discovered: new Set(session.discovered_resources),
42
+ attached: new Set(session.attached_resources),
43
+ injected: new Set(session.injected_resources),
44
+ readable: new Set(session.readable_resources)
45
+ };
46
+ const skipped = new Map(session.skipped_resources.map((skip) => [skip.id, skip]));
47
+
48
+ for (const id of expectedIds) {
49
+ if (stageSets.readable.has(id)) continue;
50
+ const skip = skipped.get(id);
51
+ if (!skip) {
52
+ if (requiredIds.has(id)) fail(`${session.session_id}: ${id} is required, not readable, and has no skipped_resources entry`);
53
+ continue;
54
+ }
55
+ if (!allowedSkipReasons.has(skip.reason)) fail(`${session.session_id}: ${id} has unknown skip reason ${skip.reason}`);
56
+ if (!skip.stage) fail(`${session.session_id}: ${id} skip entry needs a stage`);
57
+ if (requiredIds.has(id)) mismatches += 1;
58
+ }
59
+ }
60
+
61
+ if (receipt.safe_to_continue !== false && mismatches > 0) {
62
+ fail('safe_to_continue must be false when expected resources are missing or skipped');
63
+ }
64
+
65
+ console.log(`loaded-resource boundary ok: ${mismatches} required resource/runtime gaps recorded`);
@@ -0,0 +1,69 @@
1
+ {
2
+ "receipt_type": "pluribus.loaded_resource_boundary.v1",
3
+ "scenario": "custom-agent skill parity across chat and ACP/Zed",
4
+ "expected_resources": [
5
+ {
6
+ "id": "skill:pr-review",
7
+ "kind": "skill",
8
+ "scope": "project",
9
+ "source_ref": ".kiro/skills/pr-review/SKILL.md",
10
+ "source_hash": "sha256:7fb8c53b1b1f9b0e0f5a6fdab315b748c64c8b926fdff3d1d6fe6b3f5c8c6a01",
11
+ "required": true
12
+ },
13
+ {
14
+ "id": "skill:release-notes",
15
+ "kind": "skill",
16
+ "scope": "project",
17
+ "source_ref": ".kiro/skills/release-notes/SKILL.md",
18
+ "source_hash": "sha256:290d6bbf8d43b5b3f9134718ce9f7b6d08cc25f1a0e9255f5b8ceadcab4e6c18",
19
+ "required": false
20
+ }
21
+ ],
22
+ "sessions": [
23
+ {
24
+ "session_id": "chat-reviewer-2026-06-03",
25
+ "runtime": "chat",
26
+ "client": "kiro-desktop",
27
+ "client_version": "2.5.1",
28
+ "agent": "reviewer",
29
+ "task_hash": "sha256:9ed0fd91ef88f64a7de10e7fbab4e979ec6b13701d8a7569e3d4ad4ed9932a9a",
30
+ "discovered_resources": ["skill:pr-review", "skill:release-notes"],
31
+ "attached_resources": ["skill:pr-review", "skill:release-notes"],
32
+ "injected_resources": ["skill:pr-review"],
33
+ "readable_resources": ["skill:pr-review"],
34
+ "skipped_resources": [
35
+ {
36
+ "id": "skill:release-notes",
37
+ "stage": "injected",
38
+ "reason": "trigger_not_matched"
39
+ }
40
+ ]
41
+ },
42
+ {
43
+ "session_id": "acp-zed-reviewer-2026-06-03",
44
+ "runtime": "acp",
45
+ "client": "zed",
46
+ "client_version": "2.5.1",
47
+ "agent": "reviewer",
48
+ "task_hash": "sha256:9ed0fd91ef88f64a7de10e7fbab4e979ec6b13701d8a7569e3d4ad4ed9932a9a",
49
+ "discovered_resources": ["skill:pr-review", "skill:release-notes"],
50
+ "attached_resources": ["skill:pr-review", "skill:release-notes"],
51
+ "injected_resources": [],
52
+ "readable_resources": [],
53
+ "skipped_resources": [
54
+ {
55
+ "id": "skill:pr-review",
56
+ "stage": "injected",
57
+ "reason": "runtime_does_not_inject_resources"
58
+ },
59
+ {
60
+ "id": "skill:release-notes",
61
+ "stage": "injected",
62
+ "reason": "trigger_not_matched"
63
+ }
64
+ ]
65
+ }
66
+ ],
67
+ "safe_to_continue": false,
68
+ "next_action": "file a host/runtime bug with stage-level evidence; do not fix this with stronger prompt wording alone"
69
+ }
@@ -0,0 +1,28 @@
1
+ # Memory write policy receipt gate
2
+
3
+ Shared memory systems are useful when many agents can read the same durable facts. They become risky when every run can also write to that memory without review.
4
+
5
+ This example treats a memory write like a code change:
6
+
7
+ 1. the agent proposes a memory diff;
8
+ 2. the diff is scoped to a repo/project/org/user boundary;
9
+ 3. the source is hashed instead of copied;
10
+ 4. stale facts get an expiry or review date;
11
+ 5. future sessions can see what memory was injected;
12
+ 6. private/sensitive writes are quarantined until a human or external policy approves them.
13
+
14
+ Run the passing fixture:
15
+
16
+ ```bash
17
+ node examples/memory-write-policy/check-memory-update.mjs \
18
+ examples/memory-write-policy/approved-memory-update.json
19
+ ```
20
+
21
+ Run the failing fixture:
22
+
23
+ ```bash
24
+ node examples/memory-write-policy/check-memory-update.mjs \
25
+ examples/memory-write-policy/quarantined-memory-update.json
26
+ ```
27
+
28
+ Use this shape when evaluating cross-agent memory MCPs, knowledge graphs, or shared `CLAUDE.md`/`AGENTS.md` update flows. The point is not to store the memory body in the receipt. The point is to prove that a durable memory update had source, scope, lifecycle, visibility, approval, and privacy checks before it could teach every harness the same fact.
@@ -0,0 +1,48 @@
1
+ {
2
+ "type": "agent.memory_update_receipt.v1",
3
+ "update_id": "memupd_2026_06_01_001",
4
+ "run_id": "agent_run_8742",
5
+ "source": {
6
+ "kind": "claude-code-session",
7
+ "ref": "repo:acme/shop#issue-4812",
8
+ "content_hash": "sha256:4df7b1b9d6f4a2c51ad3e1ce761a8f0f918c9a0f4d26c4c8fd9f1e21ad1a19f4"
9
+ },
10
+ "scope": {
11
+ "kind": "repo",
12
+ "id": "acme/shop",
13
+ "path_prefix": "apps/checkout"
14
+ },
15
+ "proposed_diff": {
16
+ "adds": [
17
+ {
18
+ "memory_ref": "memory:checkout:idempotency-key-policy",
19
+ "summary_hash": "sha256:dad59f7764d0a6dd8db8f2d6f23d9dd30b3e6b1e1197d5478c05f9d093bc5fed",
20
+ "reason": "captured repo-local invariant after failing duplicate-charge test"
21
+ }
22
+ ],
23
+ "updates": [],
24
+ "supersedes": [],
25
+ "expires": []
26
+ },
27
+ "write_policy": {
28
+ "status": "approved",
29
+ "policy_ref": "repo-memory-policy:v2",
30
+ "approved_by": "maintainer:checkout-platform",
31
+ "approval_channel": "pull-request-review",
32
+ "private_or_sensitive_detected": false
33
+ },
34
+ "lifecycle": {
35
+ "review_after": "2026-07-01T00:00:00Z",
36
+ "supersedes_required": false
37
+ },
38
+ "injection_visibility": {
39
+ "next_session_visible": true,
40
+ "preview_path": ".pluribus/memory-previews/checkout-idempotency-key-policy.md"
41
+ },
42
+ "privacy": {
43
+ "raw_memory_text_logged": false,
44
+ "raw_prompts_logged": false,
45
+ "raw_tool_output_logged": false,
46
+ "secrets_logged": false
47
+ }
48
+ }
@@ -0,0 +1,120 @@
1
+ #!/usr/bin/env node
2
+ import { readFileSync } from 'node:fs'
3
+
4
+ const [file] = process.argv.slice(2)
5
+
6
+ if (!file) {
7
+ console.error('Usage: node check-memory-update.mjs <memory-update-receipt.json>')
8
+ process.exit(2)
9
+ }
10
+
11
+ let receipt
12
+ try {
13
+ receipt = JSON.parse(readFileSync(file, 'utf8'))
14
+ } catch (error) {
15
+ console.error(JSON.stringify({ ok: false, file, errors: [`invalid JSON: ${error.message}`] }, null, 2))
16
+ process.exit(2)
17
+ }
18
+
19
+ const errors = []
20
+ const warnings = []
21
+
22
+ if (receipt.type !== 'agent.memory_update_receipt.v1') {
23
+ errors.push('type must be agent.memory_update_receipt.v1')
24
+ }
25
+
26
+ for (const key of ['update_id', 'run_id']) {
27
+ if (!receipt[key] || typeof receipt[key] !== 'string') {
28
+ errors.push(`${key} is required`)
29
+ }
30
+ }
31
+
32
+ const source = receipt.source || {}
33
+ if (!source.kind || typeof source.kind !== 'string') {
34
+ errors.push('source.kind is required')
35
+ }
36
+ if (!source.ref || typeof source.ref !== 'string') {
37
+ errors.push('source.ref is required')
38
+ }
39
+ if (!source.content_hash || typeof source.content_hash !== 'string') {
40
+ errors.push('source.content_hash is required; do not rely on raw memory text')
41
+ }
42
+
43
+ const scope = receipt.scope || {}
44
+ if (!scope.kind || !['repo', 'project', 'org', 'user'].includes(scope.kind)) {
45
+ errors.push('scope.kind must be repo, project, org, or user')
46
+ }
47
+ if (!scope.id || typeof scope.id !== 'string') {
48
+ errors.push('scope.id is required so a memory write cannot silently become global')
49
+ }
50
+ if (scope.kind === 'user') {
51
+ warnings.push('user-scoped durable memory is broad; prefer repo/project scope when possible')
52
+ }
53
+
54
+ const diff = receipt.proposed_diff || {}
55
+ const changed = ['adds', 'updates', 'supersedes', 'expires'].flatMap((key) => Array.isArray(diff[key]) ? diff[key] : [])
56
+ if (changed.length === 0) {
57
+ errors.push('proposed_diff must include at least one add, update, supersede, or expire entry')
58
+ }
59
+ for (const [index, item] of changed.entries()) {
60
+ if (!item.memory_ref || typeof item.memory_ref !== 'string') {
61
+ errors.push(`proposed_diff item ${index} is missing memory_ref`)
62
+ }
63
+ if (!item.summary_hash || typeof item.summary_hash !== 'string') {
64
+ errors.push(`proposed_diff item ${index} is missing summary_hash; log hashes, not raw memory bodies`)
65
+ }
66
+ if (item.raw_text) {
67
+ errors.push(`proposed_diff item ${index} must not include raw_text`)
68
+ }
69
+ }
70
+
71
+ const policy = receipt.write_policy || {}
72
+ if (policy.status !== 'approved') {
73
+ errors.push(`write_policy.status is ${policy.status || 'missing'}; shared memory write must remain proposed/quarantined until approved`)
74
+ }
75
+ if (!policy.policy_ref || typeof policy.policy_ref !== 'string') {
76
+ errors.push('write_policy.policy_ref is required')
77
+ }
78
+ if (!policy.approved_by || typeof policy.approved_by !== 'string') {
79
+ errors.push('write_policy.approved_by is required for durable writes')
80
+ }
81
+ if (policy.private_or_sensitive_detected !== false) {
82
+ errors.push('write_policy.private_or_sensitive_detected must be false before merge')
83
+ }
84
+
85
+ const lifecycle = receipt.lifecycle || {}
86
+ if (!lifecycle.expires_at && !lifecycle.review_after) {
87
+ errors.push('lifecycle.expires_at or lifecycle.review_after is required to avoid immortal stale facts')
88
+ }
89
+ if (lifecycle.supersedes_required === true && (!Array.isArray(diff.supersedes) || diff.supersedes.length === 0)) {
90
+ errors.push('lifecycle.supersedes_required is true but proposed_diff.supersedes is empty')
91
+ }
92
+
93
+ const visibility = receipt.injection_visibility || {}
94
+ if (visibility.next_session_visible !== true) {
95
+ errors.push('injection_visibility.next_session_visible must be true so future agents can see what memory was injected')
96
+ }
97
+ if (!visibility.preview_path || typeof visibility.preview_path !== 'string') {
98
+ warnings.push('injection_visibility.preview_path is recommended for human review')
99
+ }
100
+
101
+ const privacy = receipt.privacy || {}
102
+ for (const key of ['raw_memory_text_logged', 'raw_prompts_logged', 'raw_tool_output_logged', 'secrets_logged']) {
103
+ if (privacy[key] !== false) {
104
+ errors.push(`privacy.${key} must be false for this gate`)
105
+ }
106
+ }
107
+
108
+ const result = {
109
+ ok: errors.length === 0,
110
+ file,
111
+ update_id: receipt.update_id,
112
+ run_id: receipt.run_id,
113
+ scope: scope.kind && scope.id ? `${scope.kind}:${scope.id}` : undefined,
114
+ write_status: policy.status,
115
+ errors,
116
+ warnings
117
+ }
118
+
119
+ console.log(JSON.stringify(result, null, 2))
120
+ process.exit(result.ok ? 0 : 1)
@@ -0,0 +1,43 @@
1
+ {
2
+ "type": "agent.memory_update_receipt.v1",
3
+ "update_id": "memupd_2026_06_01_002",
4
+ "run_id": "agent_run_8743",
5
+ "source": {
6
+ "kind": "claude-code-session",
7
+ "ref": "repo:acme/shop#debug-chat",
8
+ "content_hash": "sha256:6d4fa2a2114f83fd8bd9d6eb3c632ff6f20252f978bc9deec0b9d85694e02d4b"
9
+ },
10
+ "scope": {
11
+ "kind": "user",
12
+ "id": "developer-laptop"
13
+ },
14
+ "proposed_diff": {
15
+ "adds": [
16
+ {
17
+ "memory_ref": "memory:global:production-debug-shortcut",
18
+ "summary_hash": "sha256:5ee95af43fd2fb8b90908ef8cc4a5e6f050a8f52c97c7c93fd7f37bd1dcf3c2a",
19
+ "raw_text": "do not store raw memory bodies here"
20
+ }
21
+ ],
22
+ "updates": [],
23
+ "supersedes": [],
24
+ "expires": []
25
+ },
26
+ "write_policy": {
27
+ "status": "quarantined",
28
+ "policy_ref": "repo-memory-policy:v2",
29
+ "private_or_sensitive_detected": true
30
+ },
31
+ "lifecycle": {
32
+ "supersedes_required": false
33
+ },
34
+ "injection_visibility": {
35
+ "next_session_visible": false
36
+ },
37
+ "privacy": {
38
+ "raw_memory_text_logged": true,
39
+ "raw_prompts_logged": false,
40
+ "raw_tool_output_logged": false,
41
+ "secrets_logged": false
42
+ }
43
+ }
@@ -0,0 +1,13 @@
1
+ # Parallel session review ledger example
2
+
3
+ This example is a copyable receipt for teams running multiple agent sessions at once. It is designed for the review bottleneck: deciding whether each session can be trusted, continued, or rejected without reading an entire transcript.
4
+
5
+ ```bash
6
+ node examples/parallel-session-review-ledger/check-parallel-session-review-ledger.mjs examples/parallel-session-review-ledger/parallel-session-review-ledger.json
7
+ ```
8
+
9
+ Expected output:
10
+
11
+ ```text
12
+ parallel session review ledger ok: 3 sessions checked
13
+ ```
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+
5
+ const file = process.argv[2] || path.join('examples', 'parallel-session-review-ledger', 'parallel-session-review-ledger.json');
6
+ const receipt = JSON.parse(fs.readFileSync(file, 'utf8'));
7
+ const errors = [];
8
+
9
+ const allowedStates = new Set(['complete', 'partial', 'blocked', 'unsafe_to_resume']);
10
+ const allowedNextActions = new Set([
11
+ 'review_diff',
12
+ 'run_missing_check',
13
+ 'continue_same_scope',
14
+ 'ask_human',
15
+ 'stop_manual_review'
16
+ ]);
17
+
18
+ function add(condition, message) {
19
+ if (!condition) errors.push(message);
20
+ }
21
+
22
+ function globPrefix(pattern) {
23
+ return pattern.replace(/\*\*.*$/, '').replace(/\*.*$/, '');
24
+ }
25
+
26
+ add(receipt.schema === 'pluribus.parallel_session_review_ledger.v1', 'schema must be pluribus.parallel_session_review_ledger.v1');
27
+ add(Array.isArray(receipt.sessions) && receipt.sessions.length > 0, 'sessions must be a non-empty array');
28
+
29
+ for (const session of receipt.sessions || []) {
30
+ const label = session.id || '<missing-id>';
31
+ add(Boolean(session.id), 'session id is required');
32
+ add(Boolean(session.assignment), `${label}: assignment is required`);
33
+ add(Boolean(session.branch), `${label}: branch is required`);
34
+ add(Boolean(session.allowed_scope), `${label}: allowed_scope is required`);
35
+ add(Array.isArray(session.allowed_scope?.files) && session.allowed_scope.files.length > 0, `${label}: allowed_scope.files must be non-empty`);
36
+ add(allowedStates.has(session.state), `${label}: invalid state ${session.state}`);
37
+ add(allowedNextActions.has(session.safe_next_action), `${label}: invalid safe_next_action ${session.safe_next_action}`);
38
+
39
+ const evidence = session.evidence || [];
40
+ const missingChecks = session.missing_checks || [];
41
+ const privacyFlags = session.privacy_flags || [];
42
+
43
+ if (session.state === 'complete') {
44
+ add(evidence.length > 0, `${label}: complete sessions need evidence`);
45
+ add(missingChecks.length === 0, `${label}: complete sessions cannot have missing_checks`);
46
+ add(privacyFlags.length === 0, `${label}: complete sessions cannot have privacy_flags`);
47
+ }
48
+
49
+ if (session.state === 'partial') {
50
+ add(missingChecks.length > 0, `${label}: partial sessions must name missing_checks`);
51
+ }
52
+
53
+ if (session.state === 'unsafe_to_resume') {
54
+ add(session.safe_next_action === 'stop_manual_review', `${label}: unsafe_to_resume must use stop_manual_review`);
55
+ }
56
+
57
+ const allowedPrefixes = (session.allowed_scope?.files || []).map(globPrefix);
58
+ for (const touched of session.touched_files || []) {
59
+ add(allowedPrefixes.some((prefix) => touched.startsWith(prefix)), `${label}: touched file outside allowed scope: ${touched}`);
60
+ }
61
+ }
62
+
63
+ if (errors.length > 0) {
64
+ console.error('parallel session review ledger invalid:');
65
+ for (const error of errors) console.error(`- ${error}`);
66
+ process.exit(1);
67
+ }
68
+
69
+ console.log(`parallel session review ledger ok: ${receipt.sessions.length} sessions checked`);
@@ -0,0 +1,72 @@
1
+ {
2
+ "schema": "pluribus.parallel_session_review_ledger.v1",
3
+ "generated_at": "2026-06-04T19:00:00Z",
4
+ "run": {
5
+ "orchestrator": "human",
6
+ "repo": "redacted-service",
7
+ "coordination_mode": "parallel_sessions"
8
+ },
9
+ "sessions": [
10
+ {
11
+ "id": "session-a",
12
+ "agent": "claude-code",
13
+ "assignment": "update validation for billing webhook retries",
14
+ "branch": "agent/billing-webhook-retry-validation",
15
+ "allowed_scope": {
16
+ "files": ["src/billing/**", "test/billing/**"],
17
+ "commands": ["npm test -- --test-name-pattern=billing"],
18
+ "network": "none"
19
+ },
20
+ "touched_files": ["src/billing/retries.js", "test/billing/retries.test.js"],
21
+ "agent_claim": "added retry validation and regression coverage",
22
+ "evidence": [
23
+ { "type": "commit", "ref": "abc1234" },
24
+ { "type": "test", "name": "billing retry validation", "status": "passed" }
25
+ ],
26
+ "missing_checks": [],
27
+ "privacy_flags": [],
28
+ "state": "complete",
29
+ "safe_next_action": "review_diff"
30
+ },
31
+ {
32
+ "id": "session-b",
33
+ "agent": "cursor-agent",
34
+ "assignment": "draft migration notes for webhook retry config",
35
+ "branch": "agent/retry-config-notes",
36
+ "allowed_scope": {
37
+ "files": ["docs/**"],
38
+ "commands": ["npm test -- --test-name-pattern=docs"],
39
+ "network": "none"
40
+ },
41
+ "touched_files": ["docs/webhook-retry-config.md"],
42
+ "agent_claim": "documented retry config and rollback notes",
43
+ "evidence": [
44
+ { "type": "diff", "ref": "docs-only" }
45
+ ],
46
+ "missing_checks": ["link-check docs/webhook-retry-config.md"],
47
+ "privacy_flags": [],
48
+ "state": "partial",
49
+ "safe_next_action": "run_missing_check"
50
+ },
51
+ {
52
+ "id": "session-c",
53
+ "agent": "codex-cli",
54
+ "assignment": "investigate retry metrics regression",
55
+ "branch": "agent/retry-metrics-investigation",
56
+ "allowed_scope": {
57
+ "files": ["src/metrics/**", "test/metrics/**"],
58
+ "commands": ["npm test -- --test-name-pattern=metrics"],
59
+ "network": "none"
60
+ },
61
+ "touched_files": ["src/metrics/retry-metrics.js"],
62
+ "agent_claim": "found possible metrics label mismatch, not fixed",
63
+ "evidence": [
64
+ { "type": "note", "ref": "suspected-label-mismatch" }
65
+ ],
66
+ "missing_checks": ["confirm label contract with owner"],
67
+ "privacy_flags": ["scope_expanded_without_approval"],
68
+ "state": "unsafe_to_resume",
69
+ "safe_next_action": "stop_manual_review"
70
+ }
71
+ ]
72
+ }
@@ -0,0 +1,23 @@
1
+ # Phase-boundary contract example
2
+
3
+ This example is for multi-model coding workflows where one phase plans, another phase applies, and another verifies. It records the exact handoff boundary without storing prompts, transcripts, raw source, secrets, or full command output.
4
+
5
+ Run:
6
+
7
+ ```bash
8
+ node check-phase-boundary.mjs phase-boundary-contract.json
9
+ ```
10
+
11
+ Expected output:
12
+
13
+ ```text
14
+ phase-boundary contract ok: checkout-refactor-2026-06-03 apply->verify
15
+ ```
16
+
17
+ Use the shape as a small gate before moving from Apply to Verify:
18
+
19
+ - approved plan/task refs and hashes entered the phase;
20
+ - output artifact hash exists;
21
+ - changed file-set hash and tests are present;
22
+ - open risks are explicit;
23
+ - stale exploration transcript or rejected designs are intentionally dropped.