pluribus-context 0.3.34 → 0.3.35

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 (35) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +2 -1
  3. package/docs/ai-pr-review-receipts.md +153 -0
  4. package/docs/canonical-output-receipts.md +107 -0
  5. package/docs/dynamic-workflow-run-receipts.md +158 -0
  6. package/docs/install-plan-receipts.md +77 -0
  7. package/docs/mcp-tool-visibility-receipts.md +67 -0
  8. package/docs/review-primitive-gate.md +107 -0
  9. package/docs/skill-policy-receipts.md +87 -0
  10. package/docs/subagent-role-receipts.md +95 -0
  11. package/docs/temporal-context-receipts.md +123 -0
  12. package/examples/agent-skills/skill-policy-receipts/README.md +22 -0
  13. package/examples/agent-skills/skill-policy-receipts/SKILL.md +77 -0
  14. package/examples/ai-pr-review-receipts/.github/pull_request_template.md +31 -0
  15. package/examples/ai-pr-review-receipts/README.md +5 -0
  16. package/examples/canonical-output-receipts/canonical-output-receipt.json +55 -0
  17. package/examples/claude-code-review-hook/README.md +74 -0
  18. package/examples/claude-code-review-hook/check-review-receipt-hook.mjs +80 -0
  19. package/examples/claude-code-review-hook/sample-task-completed-event.json +6 -0
  20. package/examples/dynamic-workflow-run-receipts/README.md +18 -0
  21. package/examples/dynamic-workflow-run-receipts/workflow-run-receipt.json +112 -0
  22. package/examples/install-plan-receipts/README.md +34 -0
  23. package/examples/install-plan-receipts/agent-install-plan-receipt.json +56 -0
  24. package/examples/review-primitive-gate/README.md +19 -0
  25. package/examples/review-primitive-gate/check-review-receipt.mjs +100 -0
  26. package/examples/review-primitive-gate/fail-review-receipt.json +42 -0
  27. package/examples/review-primitive-gate/pass-review-receipt.json +54 -0
  28. package/examples/subagent-role-receipts/README.md +15 -0
  29. package/examples/subagent-role-receipts/agents.toml +36 -0
  30. package/examples/temporal-context-receipts/CURRENT_STATE.md +13 -0
  31. package/examples/temporal-context-receipts/specs/2025-checkout-rewrite.md +10 -0
  32. package/examples/temporal-context-receipts/specs/2026-checkout-risk-notes.md +10 -0
  33. package/examples/temporal-context-receipts/temporal-authority-receipt.json +27 -0
  34. package/package.json +1 -1
  35. package/src/utils/version.js +1 -1
@@ -0,0 +1,107 @@
1
+ # Review primitive gate for agent handoffs
2
+
3
+ Use this when a parallel-agent run, Claude Code hook/workflow, Codex/OpenClaw handoff, or local control-plane wrapper needs to prove more than "the agent said it was done".
4
+
5
+ The market question is not just what to log after a run. It is whether a reviewer or CI job can make a decision:
6
+
7
+ - **continue** because the assignment stayed inside approved scope and required checks passed;
8
+ - **review first** because the run is partial or has explicit unverified assumptions;
9
+ - **reject / stop** because scope changed without approval, required checks were skipped or failed, or the run is unsafe to resume.
10
+
11
+ Pluribus should not be the execution control plane. Worktrees, VMs, hooks, masks, and vendor guardrails can enforce parts of the run. The useful Pluribus layer is a small, privacy-safe receipt that turns those controls into reviewable evidence across tools.
12
+
13
+ ## Receipt shape
14
+
15
+ Attach this receipt to a PR body, CI artifact, run summary, or handoff packet.
16
+
17
+ ```json
18
+ {
19
+ "type": "agent.review_primitive_receipt.v1",
20
+ "assignment_id": "agent-auth-audit-42",
21
+ "run_id": "run-2026-05-31T17-00Z",
22
+ "agent": {
23
+ "tool": "claude-code",
24
+ "role": "auth-reviewer"
25
+ },
26
+ "approved_boundaries": {
27
+ "read": ["src/auth/**", "tests/auth/**"],
28
+ "write": ["tests/auth/**"],
29
+ "network": false
30
+ },
31
+ "scope_access_changes": [
32
+ {
33
+ "change": "read docs/security/**",
34
+ "reason": "needed policy wording for test fixture",
35
+ "approved": true,
36
+ "approved_by": "human-reviewer"
37
+ }
38
+ ],
39
+ "commands_and_checks": [
40
+ {
41
+ "name": "npm test -- tests/auth",
42
+ "kind": "required_test",
43
+ "status": "passed",
44
+ "evidence": "ci://job/123#auth-tests"
45
+ },
46
+ {
47
+ "name": "npm run lint",
48
+ "kind": "required_check",
49
+ "status": "passed",
50
+ "evidence": "ci://job/123#lint"
51
+ }
52
+ ],
53
+ "refused_operations": [
54
+ {
55
+ "operation": "write src/auth/session.ts",
56
+ "reason": "outside approved write boundary"
57
+ }
58
+ ],
59
+ "handoff": {
60
+ "changed_files_bucket": "under_5",
61
+ "evidence_path": "artifacts/agent-auth-audit-42.json",
62
+ "next_safe_action": "review tests/auth/session.test.ts before merge"
63
+ },
64
+ "resume_state": "complete",
65
+ "privacy": {
66
+ "raw_prompts_logged": false,
67
+ "raw_tool_output_logged": false,
68
+ "source_code_logged": false,
69
+ "secrets_logged": false
70
+ }
71
+ }
72
+ ```
73
+
74
+ ## Minimal gate
75
+
76
+ The copyable demo in [`examples/review-primitive-gate/`](../examples/review-primitive-gate/) turns the receipt into a CI/reviewer decision.
77
+
78
+ If you use Claude Code hooks, the [`examples/claude-code-review-hook/`](../examples/claude-code-review-hook/) bridge shows how to run the same gate from `TaskCompleted`, `PostCompact`, or `SessionEnd` without logging raw prompts, transcripts, tool output, source code, or secrets.
79
+
80
+ ```bash
81
+ node examples/review-primitive-gate/check-review-receipt.mjs \
82
+ examples/review-primitive-gate/pass-review-receipt.json
83
+
84
+ node examples/review-primitive-gate/check-review-receipt.mjs \
85
+ examples/review-primitive-gate/fail-review-receipt.json
86
+ ```
87
+
88
+ The gate passes only when:
89
+
90
+ - `type` is `agent.review_primitive_receipt.v1`;
91
+ - `assignment_id` and `run_id` exist;
92
+ - approved read/write boundaries are present;
93
+ - every scope/access change is explicitly approved;
94
+ - every required check/test passed;
95
+ - `resume_state` is `complete`.
96
+
97
+ The gate fails when a run is `partial` or `unsafe-to-resume`, when a required check is skipped/failed, or when scope changed without approval. That is intentional: partial work can be valuable, but it should not silently pass a merge gate.
98
+
99
+ ## What to keep out
100
+
101
+ Do not put raw prompts, full transcripts, source code, exact proprietary paths, secrets, customer data, or raw tool output in the receipt. Use coarse globs, hashes, CI URLs, artifact IDs, pass/fail states, and human-readable next safe actions.
102
+
103
+ ## Why this is different from a receipt field list
104
+
105
+ A field list says what happened. A review primitive says what the next system is allowed to do with that evidence.
106
+
107
+ If the artifact cannot reject a PR, pause a handoff, or force review when the run became partial/unsafe, it is probably just a nicer `plan.md`.
@@ -0,0 +1,87 @@
1
+ # Skill policy receipts
2
+
3
+ Use this when an Agent Skill, `CLAUDE.md`, hook, or project rule says "do not touch X" but the agent can still drift into the forbidden path.
4
+
5
+ The goal is not to log prompts or source code. The goal is a tiny, privacy-safe receipt that proves the run checked the policy boundary before writing code and again after writing code.
6
+
7
+ This was prompted by a live `r/ClaudeCode` thread where a Skill told Claude Code not to create unit tests for internal services, but the run still generated one. Natural-language policy alone was too soft; the missing piece was an inspectable guard.
8
+
9
+ ## Boundary to prove
10
+
11
+ For every requested change, capture:
12
+
13
+ ```json
14
+ {
15
+ "receipt_type": "skill.policy.v1",
16
+ "skill": "unit-test-boundary",
17
+ "request_id": "local-run-2026-05-28T12:00Z",
18
+ "policy_scope": "unit-test targets",
19
+ "targets": [
20
+ {
21
+ "target": "src/public-api/client.test.ts",
22
+ "decision": "allowed",
23
+ "reason": "public API surface"
24
+ },
25
+ {
26
+ "target": "src/internal/billing/reconciler.test.ts",
27
+ "decision": "refused",
28
+ "reason": "internal service tests are out of scope for this Skill"
29
+ }
30
+ ],
31
+ "write_started": false,
32
+ "post_write_guard": "not_run",
33
+ "stopped_at": "policy_refused"
34
+ }
35
+ ```
36
+
37
+ Keep values coarse. Do not include code, secrets, customer names, stack traces, raw tool output, or full transcripts.
38
+
39
+ ## Minimal Skill guard
40
+
41
+ Add a short preflight before the Skill writes files:
42
+
43
+ ```markdown
44
+ ## Policy preflight
45
+
46
+ Before writing tests:
47
+
48
+ 1. List the intended test targets.
49
+ 2. Mark each target as `allowed` or `refused`.
50
+ 3. Refuse before writing if any target imports or exercises internal services.
51
+ 4. Emit a `skill.policy.v1` receipt with target names or coarse globs, decision, reason, and `write_started=false` when refused.
52
+ 5. Only after every target is allowed, write files.
53
+ 6. After writing, run the post-write guard and emit whether it passed.
54
+ ```
55
+
56
+ Then add a post-write check that is simple enough for an agent to run reliably:
57
+
58
+ ```bash
59
+ # Example: fail if generated unit tests import internal services.
60
+ grep -R "from ['\"]\.\./\.\./internal\|from ['\"]@/internal\|require(['\"]@/internal" \
61
+ -- '*test.*' '*spec.*'
62
+ ```
63
+
64
+ Adjust the grep for your repo. The important part is the receipt shape:
65
+
66
+ - `policy_target_listed`
67
+ - `policy_decision_allowed` / `policy_decision_refused`
68
+ - `refusal_reason`
69
+ - `write_started`
70
+ - `post_write_guard_passed` / `post_write_guard_failed`
71
+ - `stopped_at`
72
+
73
+ ## Why this belongs next to context receipts
74
+
75
+ A Skill can be loaded and still fail to obey the boundary. That is the same class of problem as a healthy MCP server with tools invisible in the client, or a context file generated but not actually selected by the agent.
76
+
77
+ The useful question is: **where did the boundary proof stop?**
78
+
79
+ - Skill loaded, but no target list: policy was never made operational.
80
+ - Target list exists, but no decisions: policy was considered but not enforced.
81
+ - Refused target exists, but `write_started=true`: refusal came too late.
82
+ - Post-write guard failed: generated code crossed the forbidden boundary.
83
+ - Guard passed: the run has a small, reviewable receipt instead of only a confident claim.
84
+
85
+ ## Try the copyable Skill recipe
86
+
87
+ See [`examples/agent-skills/skill-policy-receipts/`](../examples/agent-skills/skill-policy-receipts/) for a small `SKILL.md` recipe you can copy into Claude Code/OpenClaw-style Skill workflows.
@@ -0,0 +1,95 @@
1
+ # Subagent role receipts
2
+
3
+ Custom subagents are useful only if the caller can tell which role instructions actually governed the delegated work.
4
+
5
+ Use this recipe when a project defines Codex/Claude Code/Cursor/OpenClaw-style subagents and wants a privacy-safe receipt for the role boundary: which role was requested, which instruction source was loaded, which tools/capabilities were allowed or deferred, and where the subagent stopped before crossing an unsafe boundary.
6
+
7
+ This is not a claim that every agent runner uses the same file format. Treat `agents.toml` as a portable **example** for role definitions, and treat the receipt as the stable artifact: evidence about the role boundary without logging raw prompts, source code, transcripts, tool output, secrets, or customer data.
8
+
9
+ ## When this helps
10
+
11
+ Use a subagent role receipt when:
12
+
13
+ - a manager agent delegates work to a specialist reviewer, tester, security checker, migration planner, or docs writer;
14
+ - the role has a narrower policy than the main agent;
15
+ - the subagent has restricted tools, MCP servers, or write permissions;
16
+ - the role should refuse mutation and only report findings;
17
+ - a human reviewer needs to know which role instructions were loaded before trusting the result.
18
+
19
+ ## Example role definition
20
+
21
+ The example in [`examples/subagent-role-receipts/agents.toml`](../examples/subagent-role-receipts/agents.toml) defines two project-local roles:
22
+
23
+ - `blast-radius-reviewer` — reviews AI-generated PRs by operational boundaries before merge;
24
+ - `temporal-authority-checker` — checks whether docs/specs are current or superseded before an agent writes code.
25
+
26
+ The file is intentionally small so it can be adapted to the runner you use.
27
+
28
+ ## Receipt shape
29
+
30
+ Attach this to a PR body, task handoff, review-bot comment, or run summary.
31
+
32
+ ```json
33
+ {
34
+ "type": "subagent.role_boundary.v1",
35
+ "delegation": {
36
+ "requested_role": "blast-radius-reviewer",
37
+ "effective_role": "blast-radius-reviewer",
38
+ "role_source": "agents.toml",
39
+ "role_source_hash": "sha256:example-only",
40
+ "caller": "manager-agent"
41
+ },
42
+ "instructions": {
43
+ "loaded": true,
44
+ "source_kind": "project-local-role-definition",
45
+ "raw_instruction_logged": false,
46
+ "policy_summary": [
47
+ "review by blast radius, not diff size",
48
+ "do not approve merge when boundary evidence is ambiguous"
49
+ ]
50
+ },
51
+ "capabilities": {
52
+ "writes_allowed": false,
53
+ "tools_allowed": ["read", "grep", "test-summary"],
54
+ "tools_deferred_or_unavailable": ["shell-write", "deploy", "migration-apply"],
55
+ "mcp_servers_allowed": []
56
+ },
57
+ "boundary_decisions": [
58
+ {
59
+ "boundary": "schema_or_data_contract",
60
+ "status": "ambiguous",
61
+ "decision": "blocks_merge",
62
+ "reason": "migration rollback evidence missing"
63
+ }
64
+ ],
65
+ "handoff": {
66
+ "result_kind": "review_receipt",
67
+ "stopped_at": "ambiguous boundary before merge approval",
68
+ "next_safe_action": "ask backend owner to confirm rollback and reader compatibility"
69
+ },
70
+ "privacy": {
71
+ "raw_prompt_logged": false,
72
+ "raw_source_logged": false,
73
+ "raw_tool_output_logged": false,
74
+ "transcript_logged": false,
75
+ "secrets_logged": false,
76
+ "customer_data_logged": false
77
+ }
78
+ }
79
+ ```
80
+
81
+ ## Minimal checklist
82
+
83
+ Before trusting a delegated subagent result, ask for:
84
+
85
+ - requested role and effective role match;
86
+ - role definition source and coarse hash/version;
87
+ - whether role instructions loaded through the intended path;
88
+ - allowed/refused tool and write capabilities;
89
+ - boundary decisions made by the role;
90
+ - where the role stopped and the next safe action;
91
+ - explicit privacy flags showing raw prompts/source/tool output were not logged.
92
+
93
+ ## What not to log
94
+
95
+ Do not include raw prompts, full instructions, transcripts, source code, file paths that expose private structure, tool output, secrets, credentials, customer data, stack traces, or proprietary diffs. Prefer coarse names, hashes, counts, decision states, and review-owner labels.
@@ -0,0 +1,123 @@
1
+ # Temporal context receipts
2
+
3
+ Use this when a long-lived AI coding project has old specs, ADRs, plans, or TODOs that still match grep but are no longer the current authority.
4
+
5
+ The goal is not to delete history or log raw project content. The goal is a tiny, privacy-safe receipt that proves the agent separated **current authority** from **historical citation** before it edits code.
6
+
7
+ This was prompted by a live `r/ClaudeCode` thread about the temporal problem in long-running projects: Claude Code can find every old plan, but grep is blind to time. If old docs do not carry status, date, and supersession metadata, the agent can treat a stale architecture note as current truth.
8
+
9
+ ## Boundary to prove
10
+
11
+ For every coding run that reads design/context docs, capture a coarse receipt like this:
12
+
13
+ ```json
14
+ {
15
+ "receipt_type": "context.temporal_authority.v1",
16
+ "request_id": "local-run-2026-05-28T16:00Z",
17
+ "current_authority": {
18
+ "file": "CURRENT_STATE.md",
19
+ "status": "current",
20
+ "as_of": "2026-05-28",
21
+ "scope": "checkout-flow"
22
+ },
23
+ "sources_considered": [
24
+ {
25
+ "file": "specs/2025-checkout-rewrite.md",
26
+ "status": "superseded",
27
+ "superseded_by": "CURRENT_STATE.md#checkout-flow",
28
+ "decision": "historical_citation_only"
29
+ },
30
+ {
31
+ "file": "specs/2026-checkout-risk-notes.md",
32
+ "status": "current",
33
+ "scope": "checkout-flow",
34
+ "decision": "allowed_as_supporting_context"
35
+ }
36
+ ],
37
+ "ambiguous_sources": [],
38
+ "write_started": true,
39
+ "stopped_at": "temporal_authority_resolved"
40
+ }
41
+ ```
42
+
43
+ Keep values coarse. Do not include source code, raw plans, prompts, transcripts, secrets, customer names, stack traces, private paths, or raw tool output.
44
+
45
+ ## Minimal doc convention
46
+
47
+ Give every long-lived context file a small frontmatter header:
48
+
49
+ ```markdown
50
+ ---
51
+ status: current # current | superseded | archived
52
+ scope: checkout-flow
53
+ date: 2026-05-28
54
+ superseded_by: null
55
+ ---
56
+ ```
57
+
58
+ For old specs:
59
+
60
+ ```markdown
61
+ ---
62
+ status: superseded
63
+ scope: checkout-flow
64
+ date: 2025-11-10
65
+ superseded_by: ../CURRENT_STATE.md#checkout-flow
66
+ ---
67
+ ```
68
+
69
+ Then make `CURRENT_STATE.md` the short authority file an agent must read first:
70
+
71
+ ```markdown
72
+ # Current state
73
+
74
+ ## checkout-flow
75
+
76
+ - status: current
77
+ - as_of: 2026-05-28
78
+ - current authority: this section
79
+ - related historical specs:
80
+ - specs/2025-checkout-rewrite.md (superseded)
81
+ - specs/2026-checkout-risk-notes.md (current supporting context)
82
+
83
+ Agents may cite superseded specs for rationale, but must not implement from them unless the current authority explicitly reactivates that behavior.
84
+ ```
85
+
86
+ ## Agent preflight
87
+
88
+ Before editing code in a long-lived project, ask the agent to do this:
89
+
90
+ ```markdown
91
+ ## Temporal authority preflight
92
+
93
+ Before writing code:
94
+
95
+ 1. Read `CURRENT_STATE.md` or the repo's current-state equivalent.
96
+ 2. List design/spec/TODO/context files found for the requested scope.
97
+ 3. Mark each source as `current`, `superseded`, `archived`, or `ambiguous`.
98
+ 4. If any relevant source is `ambiguous` or lacks `superseded_by` while contradicting current authority, stop before writing.
99
+ 5. Emit a `context.temporal_authority.v1` receipt with coarse file names/globs, status, decision, `write_started`, and `stopped_at`.
100
+ 6. Only use superseded docs as historical citations, not as implementation authority.
101
+ ```
102
+
103
+ Useful receipt markers:
104
+
105
+ - `context_current_authority`
106
+ - `historical_spec_citation`
107
+ - `status_superseded`
108
+ - `superseded_by_resolved`
109
+ - `ambiguous_temporal_source`
110
+ - `stale_source_ignored`
111
+ - `write_refused_until_authority_resolved`
112
+ - `preflight_temporal_decision`
113
+
114
+ ## Where this catches failures
115
+
116
+ - Old spec matches grep, but has `status: superseded`: agent can cite it but should not implement from it.
117
+ - Old spec conflicts with `CURRENT_STATE.md` and has no `superseded_by`: agent should stop and ask for authority resolution.
118
+ - Multiple current files claim the same scope: agent should stop before writing.
119
+ - Current authority exists, but the run never read it: the receipt should show `stopped_at=current_authority_missing` or `write_started=false`.
120
+
121
+ ## Try the copyable example
122
+
123
+ See [`examples/temporal-context-receipts/`](../examples/temporal-context-receipts/) for a minimal `CURRENT_STATE.md`, superseded spec, current supporting note, and receipt example.
@@ -0,0 +1,22 @@
1
+ # Skill policy receipts recipe
2
+
3
+ This is a copyable Agent Skill recipe for cases where a natural-language rule needs an inspectable guard.
4
+
5
+ Example use cases:
6
+
7
+ - a Skill must not generate tests for internal services;
8
+ - an agent must not edit generated files;
9
+ - a hook must not call production APIs;
10
+ - a migration helper must default to preview/dry-run unless `--apply` is explicit.
11
+
12
+ Copy `SKILL.md` into your Skill registry, adjust the policy and post-write guard, then ask the agent to emit `skill.policy.v1` receipts before writes and after guard checks.
13
+
14
+ The receipt should prove:
15
+
16
+ - intended targets were listed;
17
+ - each target was allowed or refused;
18
+ - refusal happened before writes;
19
+ - post-write guard passed or failed;
20
+ - no raw prompt, code, secret, customer data, stack trace, or full transcript was logged.
21
+
22
+ Related guide: [`docs/skill-policy-receipts.md`](../../../docs/skill-policy-receipts.md).
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: skill-policy-receipts
3
+ description: Use when a task must obey a hard project policy, such as "do not generate tests for internal services", "do not call production APIs", or "do not edit generated files". Emits a privacy-safe receipt before writes and after guard checks.
4
+ ---
5
+
6
+ # Skill Policy Receipts
7
+
8
+ This Skill turns natural-language guardrails into an inspectable policy receipt.
9
+
10
+ ## Preflight: decide before writing
11
+
12
+ Before creating or editing files:
13
+
14
+ 1. List intended targets using coarse paths or globs.
15
+ 2. For each target, decide `allowed` or `refused`.
16
+ 3. Give a short reason.
17
+ 4. If any target is refused, stop before writing.
18
+ 5. Emit a receipt with `write_started=false` and `stopped_at="policy_refused"`.
19
+
20
+ Receipt shape:
21
+
22
+ ```json
23
+ {
24
+ "receipt_type": "skill.policy.v1",
25
+ "skill": "skill-policy-receipts",
26
+ "policy_scope": "<short policy name>",
27
+ "targets": [
28
+ {
29
+ "target": "<coarse path or glob>",
30
+ "decision": "allowed|refused",
31
+ "reason": "<short reason>"
32
+ }
33
+ ],
34
+ "write_started": false,
35
+ "post_write_guard": "not_run",
36
+ "stopped_at": "policy_refused|all_targets_allowed"
37
+ }
38
+ ```
39
+
40
+ Do not include raw prompts, code, secrets, customer data, stack traces, or full tool output.
41
+
42
+ ## Write only after all targets are allowed
43
+
44
+ If every target is allowed:
45
+
46
+ 1. Emit or state `stopped_at="all_targets_allowed"`.
47
+ 2. Perform the write.
48
+ 3. Run the configured post-write guard.
49
+ 4. Emit whether the guard passed or failed.
50
+
51
+ Post-write receipt shape:
52
+
53
+ ```json
54
+ {
55
+ "receipt_type": "skill.policy.v1",
56
+ "skill": "skill-policy-receipts",
57
+ "policy_scope": "<short policy name>",
58
+ "write_started": true,
59
+ "post_write_guard": "passed|failed|not_configured",
60
+ "stopped_at": "guard_passed|guard_failed"
61
+ }
62
+ ```
63
+
64
+ ## Example policy: no internal-service unit tests
65
+
66
+ Policy:
67
+
68
+ > Do not generate unit tests for internal services. If the requested test imports `internal/`, `@/internal`, or a known private service module, refuse before writing and explain the safer target.
69
+
70
+ Example guard:
71
+
72
+ ```bash
73
+ grep -R "from ['\"]\.\./\.\./internal\|from ['\"]@/internal\|require(['\"]@/internal" \
74
+ -- '*test.*' '*spec.*'
75
+ ```
76
+
77
+ If the grep finds a match in generated tests, stop and report `post_write_guard="failed"`.
@@ -0,0 +1,31 @@
1
+ ## AI PR review receipt
2
+
3
+ This PR was prepared or modified by an AI coding agent. Review by blast radius, not by diff size alone.
4
+
5
+ ### Boundary receipt
6
+
7
+ | Boundary | Status | Evidence | Risk tier | Owner / blocker |
8
+ | --- | --- | --- | --- | --- |
9
+ | Schema / persisted data contract | `touched / not_touched / ambiguous` | | | |
10
+ | Live reader/writer compatibility | `checked / missing / n/a` | | | |
11
+ | Async jobs / queues / cron / webhooks | `touched / not_touched / ambiguous` | | | |
12
+ | Rollout gate / feature flag / kill switch | `present / missing / n/a` | | | |
13
+ | External side effects | `declared / not_touched / ambiguous` | | | |
14
+ | Generated files / public API / plugin config | `touched / not_touched / ambiguous` | | | |
15
+
16
+ ### Checks
17
+
18
+ - [ ] Tests relevant to touched boundaries passed.
19
+ - [ ] Migration/backfill/rollback behavior is explicit, or not applicable.
20
+ - [ ] External side effects are declared, or not touched.
21
+ - [ ] Any `ambiguous` boundary has an owner before merge.
22
+
23
+ ### Privacy
24
+
25
+ This receipt does not include raw prompts, transcripts, source code, secrets, customer data, stack traces, or raw tool output.
26
+
27
+ ### Decision
28
+
29
+ `merge_ready: yes/no`
30
+
31
+ `next_safe_action:`
@@ -0,0 +1,5 @@
1
+ # AI PR review receipts example
2
+
3
+ This example contains a copyable GitHub PR template for agent-generated or agent-modified pull requests.
4
+
5
+ Use it when review risk depends on blast radius: schema/data contracts, async paths, rollout gates, external side effects, generated/public interfaces, or security-sensitive config.
@@ -0,0 +1,55 @@
1
+ {
2
+ "type": "canonical.output.receipt.v1",
3
+ "artifact": {
4
+ "stable_id": "project-alpha-master-prompt-2026-05-30",
5
+ "name": "Project Alpha master prompt",
6
+ "kind": "master_prompt",
7
+ "canonical_path": "docs/prompts/project-alpha-master-prompt.md",
8
+ "current_version": "2026-05-30.1",
9
+ "content_hash": "sha256:example-only",
10
+ "status": "current",
11
+ "owner_label": "product-ops",
12
+ "created_at": "2026-05-30T21:40:00Z",
13
+ "last_reviewed_at": "2026-05-30T21:58:00Z"
14
+ },
15
+ "source": {
16
+ "workspace": "claude-project-alpha",
17
+ "source_session_id": "session-redacted-2026-05-30",
18
+ "source_tool": "claude-projects",
19
+ "source_chat_title": "Master prompt rebuild",
20
+ "source_url_or_path_redacted": true,
21
+ "raw_transcript_logged": false
22
+ },
23
+ "index": {
24
+ "exact_phrases_worth_grepping": [
25
+ "do not collapse escalation paths into summaries",
26
+ "billing exports are evidence, not source of truth",
27
+ "final prompt contract v3"
28
+ ],
29
+ "tags": ["master-prompt", "billing", "escalation", "current-state"],
30
+ "related_artifacts": ["billing-escalation-runbook-2026-05-28"]
31
+ },
32
+ "decisions": {
33
+ "accepted": [
34
+ "Use repo-owned markdown as the canonical copy, not old chats",
35
+ "Keep escalation criteria in the prompt body and test cases in a separate appendix"
36
+ ],
37
+ "rejected": [
38
+ {
39
+ "option": "Rely on Claude Project conversation search for recovery",
40
+ "reason": "exact phrase and project-scoped search were unreliable during rebuild"
41
+ }
42
+ ],
43
+ "open_questions": [
44
+ "Does support need a shorter handoff summary for weekend rotations?"
45
+ ],
46
+ "next_action": "Open a PR that adds the canonical prompt and this receipt to docs/prompts/"
47
+ },
48
+ "privacy": {
49
+ "raw_prompt_logged": false,
50
+ "raw_chat_logged": false,
51
+ "customer_data_logged": false,
52
+ "secrets_logged": false,
53
+ "proprietary_paths_logged": false
54
+ }
55
+ }
@@ -0,0 +1,74 @@
1
+ # Claude Code review hook bridge
2
+
3
+ This example wires the [review primitive gate](../review-primitive-gate/) into Claude Code hooks so a long agent run can be blocked at handoff time when the receipt says `partial` or `unsafe-to-resume`.
4
+
5
+ Use it when you already have Claude Code hooks, a local control-plane wrapper, or CI emitting `agent.review_primitive_receipt.v1` receipts and you want Claude Code to treat the receipt as a gate rather than a note.
6
+
7
+ ## Copy the hook
8
+
9
+ ```bash
10
+ mkdir -p .claude/hooks .pluribus/receipts
11
+ cp examples/claude-code-review-hook/check-review-receipt-hook.mjs .claude/hooks/
12
+ cp examples/review-primitive-gate/check-review-receipt.mjs .claude/hooks/
13
+ ```
14
+
15
+ Then add this to `.claude/settings.json`:
16
+
17
+ ```json
18
+ {
19
+ "hooks": {
20
+ "TaskCompleted": [
21
+ {
22
+ "matcher": "*",
23
+ "hooks": [
24
+ {
25
+ "type": "command",
26
+ "command": "node ${CLAUDE_PROJECT_DIR}/.claude/hooks/check-review-receipt-hook.mjs ${CLAUDE_PROJECT_DIR}/.pluribus/receipts/latest-review-receipt.json"
27
+ }
28
+ ]
29
+ }
30
+ ],
31
+ "PostCompact": [
32
+ {
33
+ "matcher": "*",
34
+ "hooks": [
35
+ {
36
+ "type": "command",
37
+ "command": "node ${CLAUDE_PROJECT_DIR}/.claude/hooks/check-review-receipt-hook.mjs ${CLAUDE_PROJECT_DIR}/.pluribus/receipts/latest-review-receipt.json"
38
+ }
39
+ ]
40
+ }
41
+ ]
42
+ }
43
+ }
44
+ ```
45
+
46
+ The same bridge can be attached to `SessionEnd` if your workflow writes the receipt only when a session exits.
47
+
48
+ ## What the hook does
49
+
50
+ Claude Code passes hook event JSON on stdin. The bridge reads that event for traceability, runs the review gate against the receipt path, and:
51
+
52
+ - exits `0` when the receipt is complete and privacy-safe;
53
+ - exits non-zero when required evidence is missing, checks failed/skipped, scope changes were unapproved, or `resume_state` is `partial` / `unsafe-to-resume`;
54
+ - prints a small JSON result that names the hook event, receipt path, and next safe action.
55
+
56
+ It does **not** log raw prompts, transcripts, tool output, source code, exact proprietary paths, secrets, or customer data.
57
+
58
+ ## Smoke test
59
+
60
+ ```bash
61
+ node examples/claude-code-review-hook/check-review-receipt-hook.mjs \
62
+ examples/review-primitive-gate/pass-review-receipt.json \
63
+ < examples/claude-code-review-hook/sample-task-completed-event.json
64
+
65
+ node examples/claude-code-review-hook/check-review-receipt-hook.mjs \
66
+ examples/review-primitive-gate/fail-review-receipt.json \
67
+ < examples/claude-code-review-hook/sample-task-completed-event.json
68
+ ```
69
+
70
+ The first command should pass. The second should fail and tell the reviewer why the handoff should not continue.
71
+
72
+ ## Why this exists
73
+
74
+ Claude Code hooks are good at triggering automation around `TaskCompleted`, `PostCompact`, and `SessionEnd`. Pluribus should not replace that control plane. This bridge makes the missing handoff proof explicit: before the next agent resumes, prove the assignment boundary, required checks, privacy flags, evidence path, and `complete / partial / unsafe-to-resume` state.