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,109 @@
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
+ If you review AI-authored pull requests, the [`examples/ai-pr-review-receipts/`](../examples/ai-pr-review-receipts/) recipe shows the same gate as a GitHub Actions merge/check primitive for PR blast-radius evidence.
81
+
82
+ ```bash
83
+ node examples/review-primitive-gate/check-review-receipt.mjs \
84
+ examples/review-primitive-gate/pass-review-receipt.json
85
+
86
+ node examples/review-primitive-gate/check-review-receipt.mjs \
87
+ examples/review-primitive-gate/fail-review-receipt.json
88
+ ```
89
+
90
+ The gate passes only when:
91
+
92
+ - `type` is `agent.review_primitive_receipt.v1`;
93
+ - `assignment_id` and `run_id` exist;
94
+ - approved read/write boundaries are present;
95
+ - every scope/access change is explicitly approved;
96
+ - every required check/test passed;
97
+ - `resume_state` is `complete`.
98
+
99
+ 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.
100
+
101
+ ## What to keep out
102
+
103
+ 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.
104
+
105
+ ## Why this is different from a receipt field list
106
+
107
+ A field list says what happened. A review primitive says what the next system is allowed to do with that evidence.
108
+
109
+ 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,102 @@
1
+ # Skill install/load receipts
2
+
3
+ Privacy-safe receipts for answering a narrow setup question:
4
+
5
+ > After a skill installer ran, which agent targets can actually discover and load the installed skill, and what context budget did the install create?
6
+
7
+ This is not a skill marketplace, package manager, or telemetry backend. Use this receipt next to tools such as `npx skills add`, team setup scripts, Claude Code plugins, Codex/Cursor/OpenClaw skill folders, or internal bootstrap scripts when the risky part is crossing several boundaries at once:
8
+
9
+ 1. the installer selected a source package/ref;
10
+ 2. files were written into project or global skill roots;
11
+ 3. each target agent discovered the installed manifest/resource;
12
+ 4. the runtime either injected/read the skill on activation or deferred/skipped it; and
13
+ 5. the new always-loaded or advertised context cost did not make the first session unsafe.
14
+
15
+ The receipt should stay reviewable without raw skill bodies, private paths, prompts, transcripts, environment dumps, secrets, tool outputs, or customer data.
16
+
17
+ ## When to use it
18
+
19
+ Use a skill install/load receipt when:
20
+
21
+ - a setup command installs the same Skill into Claude Code, Codex, Cursor, OpenClaw, Zed/ACP, or another agent client;
22
+ - a plugin/installer claims "cross-agent" support but you need proof per target;
23
+ - a user says the Skill exists on disk but the runtime does not use it;
24
+ - an installer adds MCP, hooks, rules, commands, or skill folders and could increase startup context cost; or
25
+ - CI/review needs a compact proof that install succeeded without dumping the installed content.
26
+
27
+ For mutation planning before any writes begin, use [install-plan receipts](install-plan-receipts.md). For runtime-only debugging where the file already exists but disappears in ACP/Zed/CLI/chat, use [loaded-resource boundary receipts](loaded-resource-boundary.md). This receipt sits between them: installer result + per-target discovery/load/budget proof.
28
+
29
+ ## Minimum contract
30
+
31
+ ```json
32
+ {
33
+ "receipt_type": "agent.skill_install_receipt.v1",
34
+ "run_id": "skill-install-demo-001",
35
+ "installer": {
36
+ "name": "skills-cli",
37
+ "command_class": "skill_package_install",
38
+ "source": {
39
+ "kind": "git_ref",
40
+ "package": "vercel-labs/skills/context-budget-preflight",
41
+ "ref": "sha256:source-package-hash"
42
+ }
43
+ },
44
+ "mode_effective": "post_install_check",
45
+ "writes_completed": true,
46
+ "targets": [
47
+ {
48
+ "agent": "claude-code",
49
+ "scope": "project",
50
+ "required": true,
51
+ "install_status": "installed",
52
+ "discovery_status": "discovered",
53
+ "load_status": "activation_required",
54
+ "activation": "on_demand_skill_description",
55
+ "context_cost_bucket": "0-1k",
56
+ "safe_to_start_session": true
57
+ }
58
+ ],
59
+ "overall_safe_to_start_session": true,
60
+ "privacy_exclusions": ["raw_skill_body", "raw_prompt", "transcript", "secrets", "env_dump", "private_absolute_path"]
61
+ }
62
+ ```
63
+
64
+ ## Fields that matter most
65
+
66
+ - `installer.source` — package/ref/hash identity without embedded credentials.
67
+ - `targets[].agent` and `targets[].scope` — which client and project/global root were targeted.
68
+ - `targets[].install_status` — `installed`, `skipped`, or `failed`.
69
+ - `targets[].discovery_status` — whether the target client can discover the installed manifest/resource.
70
+ - `targets[].load_status` — `injected`, `readable`, `activation_required`, `deferred`, `not_tested`, or `failed`.
71
+ - `targets[].context_cost_bucket` — coarse estimate such as `0-1k`, `1k-5k`, `5k-20k`, `over_budget`, or `unknown`; do not log raw schemas or skill text.
72
+ - `targets[].safe_to_start_session` — false if a required target failed install/discovery, the runtime load test failed, or budget is already over cap.
73
+ - `overall_safe_to_start_session` — false unless every required target is safe.
74
+
75
+ ## Copyable smoke test
76
+
77
+ ```bash
78
+ node examples/skill-install-receipts/check-skill-install-receipt.mjs \
79
+ examples/skill-install-receipts/skill-install-receipt.json
80
+ ```
81
+
82
+ Expected output:
83
+
84
+ ```text
85
+ skill install receipt ok: 3 targets checked
86
+ ```
87
+
88
+ ## What this proves / does not prove
89
+
90
+ Proves:
91
+
92
+ - the installer wrote or skipped the intended targets;
93
+ - each required target has an explicit discovery/load status;
94
+ - context cost is bucketed before a session starts; and
95
+ - raw skill/source content stayed out of the receipt.
96
+
97
+ Does not prove:
98
+
99
+ - the Skill is semantically good;
100
+ - the agent will choose the Skill for every matching task;
101
+ - the source package is trustworthy beyond the pinned ref/hash; or
102
+ - runtime behavior in clients not listed in `targets`.
@@ -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,104 @@
1
+ # Skill use-rate receipts
2
+
3
+ Agent Skill installers are getting good at the first boundary: download a Skill and attach it to Claude Code, Cursor, Codex, OpenCode, or another harness. The next boundary is harder: **installed is not used**.
4
+
5
+ A skill use-rate receipt is a privacy-safe record that separates four states:
6
+
7
+ 1. **Discovered** — the installer/catalog found the Skill.
8
+ 2. **Installed/attached** — files or symlinks were written for a target agent/scope.
9
+ 3. **Invoked** — a session actually selected or loaded the Skill.
10
+ 4. **Useful enough to keep** — the Skill affected a reviewed action, check, or decision in a defined window.
11
+
12
+ This matters when a team installs many Skills, plugins, commands, or subagents and later cannot tell which ones are just prompt clutter. The receipt should prove lifecycle state and usage counters without logging raw Skill bodies, prompts, source code, transcripts, or tool output.
13
+
14
+ ## Minimal receipt shape
15
+
16
+ ```json
17
+ {
18
+ "schema": "pluribus.skill_use_rate_receipt.v1",
19
+ "run_id": "skills-audit-2026-06-05T13:00Z",
20
+ "generated_at": "2026-06-05T13:00:00Z",
21
+ "installer": {
22
+ "name": "skills",
23
+ "version": "1.5.9",
24
+ "command_digest": "sha256:..."
25
+ },
26
+ "window": {
27
+ "started_at": "2026-05-22T00:00:00Z",
28
+ "ended_at": "2026-06-05T13:00:00Z"
29
+ },
30
+ "skills": [
31
+ {
32
+ "skill_id": "frontend-design",
33
+ "source_ref": "github:vercel-labs/agent-skills/skills/frontend-design@main",
34
+ "target_agent": "claude-code",
35
+ "scope": "project",
36
+ "install_method": "symlink",
37
+ "discovered": true,
38
+ "installed": true,
39
+ "attached": true,
40
+ "invoked_count": 7,
41
+ "acted_on_count": 3,
42
+ "last_invoked_at": "2026-06-05T10:12:08Z",
43
+ "unused_since_install": false,
44
+ "context_cost_bucket": "small",
45
+ "evidence": [
46
+ {
47
+ "kind": "session_log_digest",
48
+ "ref": "sha256:0b7d..."
49
+ }
50
+ ]
51
+ }
52
+ ]
53
+ }
54
+ ```
55
+
56
+ ## Evaluation questions
57
+
58
+ Use this receipt to ask:
59
+
60
+ - Which Skills are installed but never discovered by the harness?
61
+ - Which Skills are discoverable but never invoked?
62
+ - Which Skills are invoked but never acted on?
63
+ - Which Skills are globally installed but only useful in one project?
64
+ - Which Skills should be detached, narrowed, or promoted to a hard policy/check?
65
+
66
+ ## Privacy boundary
67
+
68
+ Do record:
69
+
70
+ - source refs and commit/tag when available;
71
+ - target agent and scope;
72
+ - install method (`copy`, `symlink`, generated file, ephemeral use);
73
+ - boolean lifecycle states;
74
+ - invocation and acted-on counters;
75
+ - timestamps, hashes, and non-sensitive evidence refs.
76
+
77
+ Do **not** record:
78
+
79
+ - full Skill Markdown bodies;
80
+ - raw user prompts or transcripts;
81
+ - source code or tool output;
82
+ - private file paths beyond a reviewed alias;
83
+ - secrets, tokens, customer data, or unredacted environment values.
84
+
85
+ ## Copyable checker
86
+
87
+ The [skill use-rate receipt example](../examples/skill-use-rate-receipts/) includes a small checker that validates required lifecycle fields and prints installed-but-unused Skills as review warnings rather than pretending installation equals adoption.
88
+
89
+ ```bash
90
+ node examples/skill-use-rate-receipts/check-skill-use-rate.mjs \
91
+ examples/skill-use-rate-receipts/skill-use-rate-receipt.json
92
+ ```
93
+
94
+ Expected output:
95
+
96
+ ```text
97
+ skill use-rate receipt ok: 3 skills checked, 1 unused install warning
98
+ ```
99
+
100
+ ## Where this fits
101
+
102
+ This is adjacent to [Skill install/load receipts](skill-install-receipts.md), but it answers a different question. Install/load receipts decide whether it is safe to start a session after an installer runs. Skill use-rate receipts decide whether a Skill actually earned its place after real sessions.
103
+
104
+ The market signal behind this is current Skill/plugin consolidation pressure: teams can install many prompt resources, but the useful metric is not package count. It is `invoked / installed` and, when possible, `acted_on / invoked` over a reviewable window.
@@ -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,14 @@
1
+ # Agent firewall denial/audit example
2
+
3
+ This example turns an agent-firewall block into two privacy-safe artifacts:
4
+
5
+ - `denial-envelope.json` — what the model is allowed to see.
6
+ - `operator-audit-record.json` — what the operator/dashboard/CI can audit.
7
+
8
+ Run the checker:
9
+
10
+ ```bash
11
+ node check-denial-audit.mjs .
12
+ ```
13
+
14
+ The checker enforces the core invariant: blocks should be structured enough for the model to stop or ask for approval, but not detailed enough to reveal raw commands, secrets, private paths, or bypassable policy internals.