@occasiolabs/occasio 0.8.1
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.
- package/LICENSE +202 -0
- package/NOTICE +10 -0
- package/README.md +216 -0
- package/bin/occasio-mcp.js +5 -0
- package/bin/occasio.js +2 -0
- package/bin/supervisor/README.md +90 -0
- package/bin/supervisor/com.occasio.proxy.plist.template +36 -0
- package/bin/supervisor/install-windows-task.ps1 +48 -0
- package/bin/supervisor/occasio.service +18 -0
- package/docs/AUDIT.md +120 -0
- package/docs/attest_verify.py +283 -0
- package/docs/audit_walker.py +65 -0
- package/docs/canonicalize.py +99 -0
- package/docs/compliance-mapping.md +93 -0
- package/docs/demos/mcp-block.md +148 -0
- package/docs/edr-calibration.md +73 -0
- package/docs/edr-demo.md +83 -0
- package/docs/python-verifier.md +74 -0
- package/docs/reference-pipeline.md +140 -0
- package/package.json +69 -0
- package/policy-templates/dev-default.yml +84 -0
- package/policy-templates/finance.yml +61 -0
- package/policy-templates/strict.yml +49 -0
- package/schemas/agent-attestation-v1.json +190 -0
- package/schemas/occasio-policy.schema.json +99 -0
- package/spec/agent-attestation/v1/README.md +137 -0
- package/src/adapters/claude-code.js +518 -0
- package/src/adapters/cline.js +161 -0
- package/src/adapters/computer-use-cli.js +198 -0
- package/src/adapters/computer-use.js +227 -0
- package/src/analyzer.js +170 -0
- package/src/anomaly/cli.js +143 -0
- package/src/anomaly/detectors/deny-rate.js +84 -0
- package/src/anomaly/detectors/file-read-volume.js +109 -0
- package/src/anomaly/detectors/secret-redact-rate.js +107 -0
- package/src/anomaly/detectors/unknown-tool-input.js +83 -0
- package/src/anomaly/index.js +169 -0
- package/src/attest/canonicalize.js +97 -0
- package/src/attest/index.js +355 -0
- package/src/attest/run-slice.js +57 -0
- package/src/attest/sign.js +186 -0
- package/src/attest/verify.js +192 -0
- package/src/audit/errors.js +21 -0
- package/src/audit/input-normalizer.js +121 -0
- package/src/audit/jsonl-auditor.js +178 -0
- package/src/audit/verifier.js +152 -0
- package/src/baseline.js +507 -0
- package/src/boundary.js +238 -0
- package/src/budget.js +42 -0
- package/src/classifier.js +115 -0
- package/src/context-budget.js +77 -0
- package/src/core/boundary-event.js +75 -0
- package/src/core/decision.js +61 -0
- package/src/core/pipeline.js +66 -0
- package/src/core/tool-names.js +105 -0
- package/src/dashboard.js +892 -0
- package/src/demo/README.md +31 -0
- package/src/demo/anomalies-demo.js +211 -0
- package/src/demo/attest-demo.js +198 -0
- package/src/distiller.js +155 -0
- package/src/embeddings.json +72 -0
- package/src/executor/dispatcher.js +230 -0
- package/src/harness.js +817 -0
- package/src/index.js +1711 -0
- package/src/inspect.js +329 -0
- package/src/interceptor.js +1198 -0
- package/src/lao.js +185 -0
- package/src/lao_prep.py +119 -0
- package/src/ledger.js +209 -0
- package/src/mcp-experiment.js +140 -0
- package/src/mcp-normalize.js +139 -0
- package/src/mcp-server.js +320 -0
- package/src/outbound-policy.js +433 -0
- package/src/policy/built-in-classifiers.js +78 -0
- package/src/policy/doctor.js +226 -0
- package/src/policy/engine.js +339 -0
- package/src/policy/init.js +153 -0
- package/src/policy/loader.js +448 -0
- package/src/policy/rules-default.js +36 -0
- package/src/policy/shell-path.js +135 -0
- package/src/policy/show.js +196 -0
- package/src/policy/validate.js +310 -0
- package/src/preflight/cli.js +164 -0
- package/src/preflight/miner.js +329 -0
- package/src/proxy/agent-router.js +93 -0
- package/src/redteam.js +428 -0
- package/src/replay.js +446 -0
- package/src/report/index.js +224 -0
- package/src/runtime.js +595 -0
- package/src/scanner/index.js +49 -0
- package/src/selftest.js +192 -0
- package/src/session.js +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LocalFirst
|
|
2
|
+
Copyright 2026 Leonard Brauer
|
|
3
|
+
|
|
4
|
+
This product includes software developed by the LocalFirst project
|
|
5
|
+
(https://github.com/occasio-ai/occasio).
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
8
|
+
|
|
9
|
+
Versions 0.6.6 and earlier of LocalFirst were released under the MIT License
|
|
10
|
+
and remain available under MIT in perpetuity for those releases.
|
package/README.md
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Occasio
|
|
2
|
+
|
|
3
|
+
> Cryptographically verifiable behavioral attestation for AI coding agents.
|
|
4
|
+
|
|
5
|
+
When an AI agent writes code in your CI, the question a reviewer or auditor will ask is not *"what did it produce"* — it is *"what did it actually do"*. Which files did it read. Which it was blocked from reading. Which secrets it tried to leak. Which policy was in effect. Whether that record can be trusted six months later.
|
|
6
|
+
|
|
7
|
+
Occasio sits between the agent and the cloud on your own machine, decides every tool call against one human-readable policy, writes a tamper-evident audit chain of every decision, and produces signed attestations that a third party can verify offline using only `cosign` or a 200-line Python script.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @occasiolabs/occasio
|
|
11
|
+
|
|
12
|
+
occasio demo attest # End-to-end attestation pipeline (30s, no API key)
|
|
13
|
+
occasio demo anomalies # Live EDR detection on a synthetic adversarial chain (5s)
|
|
14
|
+
occasio harness # Real Claude Code attacking a denied path — defense holds
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The first two demos run against synthetic data so you can see the full pipeline in under a minute with no external dependencies. The third spawns a real Claude Code subordinate under your Anthropic login (bundled auth — no API key required) and proves the defense end-to-end.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## What it does, in four layers
|
|
22
|
+
|
|
23
|
+
**Layer 1 — Tool-call interception.** A local proxy sits between the agent and the Anthropic API. `Read`, `Glob`, `Grep`, `TodoRead`/`TodoWrite`, and a curated set of read-only shell commands (`cat`, `head`, `git status`, `git log --oneline -N`, `ls`, `find`) run in-process on your machine. The file bytes never enter the outbound request.
|
|
24
|
+
|
|
25
|
+
**Layer 2 — Policy enforcement.** Every tool call hits one decision: `LOCAL` / `PASS` / `BLOCK` / `TRANSFORM`, driven by [`policy.yml`](policy-templates/dev-default.yml). `deny_paths` is enforced on the realpath-resolved absolute path so symlinks and traversal variants resolve to the same denial. `block_secrets_in_tool_results` redacts API keys and JWTs out of any tool output before it re-enters the prompt. Hot-reload: edits to `policy.yml` take effect on the next call, with a `policy_loaded` row written to the audit chain.
|
|
26
|
+
|
|
27
|
+
**Layer 3 — Behavioral attestation.** `occasio attest --run-id <uuid>` produces a self-contained JSON predicate that commits to the full audit-chain slice for one agent session: every tool call, every block, every transform, every redacted secret, plus the active policy's SHA-256 hash and rules digest. `--sign` wraps it in an [in-toto Statement v1](https://github.com/in-toto/attestation) and Sigstore-signs it using GitHub Actions OIDC (no key management). The predicate type URI is [`agent-attestation/v1`](spec/agent-attestation/v1/README.md). Two independent reference verifiers ship — Node (`occasio attest verify`) and Python ([`docs/attest_verify.py`](docs/attest_verify.py)) — and the test suite asserts they agree byte-for-byte on the same payload.
|
|
28
|
+
|
|
29
|
+
**Layer 4 — Anomaly detection (EDR).** `occasio anomalies` runs four detectors over a time window of the audit chain: deny-rate spike, file-read-volume burst, previously-unseen tool-input shape, secret-redaction-rate spike. Severity escalates against your historical baseline — a ×500 deviation from normal triggers HIGH; see [`docs/edr-demo.md`](docs/edr-demo.md) for the reproducible defense-in-depth walkthrough.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Why now
|
|
34
|
+
|
|
35
|
+
Three regulatory drivers, all converging on the same requirement: **runtime evidence of AI-agent behavior must be cryptographically verifiable.**
|
|
36
|
+
|
|
37
|
+
- **EU AI Act Art. 12** mandates comprehensive automated logging of high-risk AI systems. In effect from 2026 for regulated sectors.
|
|
38
|
+
- **NIST AI RMF (GOVERN, MEASURE, MANAGE families)** is becoming required in US Federal procurement and is influencing FedRAMP AI controls.
|
|
39
|
+
- **SOC 2 Common Criteria** are extending to AI-agent controls — auditors at major firms started asking "show me the agent's tool-call log" in 2026 audits.
|
|
40
|
+
|
|
41
|
+
There is currently no off-the-shelf product producing a signed, third-party-verifiable artifact for what an AI coding agent did inside your CI. Occasio fills that gap with an open schema (Apache-2.0) and ships the reference implementations for it.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Quickstart
|
|
46
|
+
|
|
47
|
+
Requires Node.js ≥ 18. Works on Windows, macOS, Linux.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install -g @occasiolabs/occasio # Install
|
|
51
|
+
occasio doctor # Verify setup (Node, claude CLI, port, profile)
|
|
52
|
+
occasio policy init # Write ~/.occasio/policy.yml (dev-default)
|
|
53
|
+
occasio register # Add 'claude' shell alias (one-time)
|
|
54
|
+
claude "read package.json and tell me the version"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
After the alias is registered, every `claude` invocation routes through Occasio transparently. Audit-chain rows accumulate at `~/.occasio/pipeline-events.jsonl`.
|
|
58
|
+
|
|
59
|
+
**Inspect the run:**
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
occasio status # Session totals
|
|
63
|
+
occasio replay --detail # Run-level audit
|
|
64
|
+
occasio audit verify # Re-walk the hash chain end-to-end
|
|
65
|
+
occasio anomalies # Run EDR detectors over the last 15 minutes
|
|
66
|
+
occasio attest --run-id <uuid> # Build a behavioral attestation for one session
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Commands
|
|
72
|
+
|
|
73
|
+
| Command | What it does |
|
|
74
|
+
|---|---|
|
|
75
|
+
| `occasio claude [args]` | Start Claude Code with Occasio proxy active |
|
|
76
|
+
| `occasio register` | Register `claude` shell alias |
|
|
77
|
+
| `occasio doctor` | Setup health-check |
|
|
78
|
+
| `occasio status` | Session totals + savings breakdown |
|
|
79
|
+
| `occasio replay` | Run-level audit (`--detail`, `--run <id>`, `--attribute`) |
|
|
80
|
+
| `occasio inspect` | Per-request cloud-boundary manifest |
|
|
81
|
+
| `occasio boundary` | Three-column view: produced / re-entered / prevented |
|
|
82
|
+
| `occasio ledger` | Per-request token ledger |
|
|
83
|
+
| `occasio distill` | Inspect distilled tool outputs |
|
|
84
|
+
| `occasio dashboard` | Live browser dashboard at http://localhost:3001 |
|
|
85
|
+
| `occasio audit verify` | Re-walk the SHA-256 audit chain end-to-end |
|
|
86
|
+
| `occasio report` | Governance summary export (`--days N`, `--format csv`) |
|
|
87
|
+
| `occasio anomalies` | EDR detection over the audit chain (`--window 15m`, `--json`) |
|
|
88
|
+
| `occasio attest --run-id <uuid>` | Build a behavioral attestation predicate v1 |
|
|
89
|
+
| `occasio attest --sign` | Sigstore-sign via GitHub Actions OIDC |
|
|
90
|
+
| `occasio attest verify <file>` | Re-verify a signed attestation end-to-end |
|
|
91
|
+
| `occasio policy [show \| validate \| init \| doctor]` | Policy authoring + diagnosis |
|
|
92
|
+
| `occasio harness` | Run scripted adversarial scenarios against your policy |
|
|
93
|
+
| `occasio redteam` | Autonomous tester-LLM probes a subject Claude Code session |
|
|
94
|
+
| `occasio computer-use --dry-run` | Apply a Computer-Use policy to synthetic tool_use blocks |
|
|
95
|
+
| `occasio demo attest` | End-to-end attestation pipeline against a synthetic chain |
|
|
96
|
+
| `occasio demo anomalies` | EDR smoke test: synthetic adversarial chain → all 4 detectors |
|
|
97
|
+
| `occasio selftest` | In-process governance self-checks on a scratch chain |
|
|
98
|
+
| `occasio baseline [learn \| compare]` | Per-project behavior baseline + drift detection |
|
|
99
|
+
| `occasio preflight` | Read-only mine of recent activity for policy suggestions |
|
|
100
|
+
|
|
101
|
+
Session-level overrides on top of `policy.yml`:
|
|
102
|
+
|
|
103
|
+
| Flag | Effect |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `--preset strict` | Forces `block_secrets_in_tool_results` on for the session |
|
|
106
|
+
| `--preset off` | Pure passthrough, log only |
|
|
107
|
+
| `--budget <N>` | Hard cap: HTTP 402 once session cost reaches $N |
|
|
108
|
+
| `--hardened` | Routes Read/Glob/Grep through unified runtime + distill + secret scan |
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Verification
|
|
113
|
+
|
|
114
|
+
Three independent checks, all required for a verified attestation:
|
|
115
|
+
|
|
116
|
+
1. **Sigstore signature** — Fulcio certificate chain + Rekor inclusion proof. Verifiable by any sigstore-conformant tool (`cosign verify-blob`, `sigstore-js`, `sigstore-python`).
|
|
117
|
+
2. **DSSE payload ↔ attestation predicate equivalence** — re-decode the in-toto Statement inside the bundle, canonicalise the predicate via [RFC 8785 subset](src/attest/canonicalize.js), compare byte-for-byte with the attestation predicate (minus the `signature` metadata field).
|
|
118
|
+
3. **Audit chain integrity** — SHA-256-walk every `prev_hash → hash` link from the GENESIS sentinel, then assert the attestation's `first_hash` and `last_hash` appear in the chain in the right relative order.
|
|
119
|
+
|
|
120
|
+
Two reference verifiers ship side by side:
|
|
121
|
+
|
|
122
|
+
- **Node**: `occasio attest verify <file>`
|
|
123
|
+
- **Python**: `python docs/attest_verify.py <file>` — stdlib + optional `sigstore-python`, reuses [`docs/audit_walker.py`](docs/audit_walker.py) for the chain step. See [`docs/python-verifier.md`](docs/python-verifier.md).
|
|
124
|
+
|
|
125
|
+
**Cross-language invariant** (asserted in the test suite as `xlang:` and `xlang-float:` cases): both verifiers agree byte-for-byte on the predicate-equivalence and audit-chain steps for the same payload, including tamper-detection cases. Non-integer numbers are rejected by both canonicalize implementations so a future schema cannot silently introduce divergence.
|
|
126
|
+
|
|
127
|
+
The **Sigstore signature step** uses the standard DSSE-wrapped in-toto Statement format; any sigstore-conformant tool verifies it (`cosign verify-blob`, `sigstore-js`, `sigstore-python`). The test suite mocks the signing path; a real-OIDC end-to-end signed-and-verified round-trip requires a GitHub Actions environment and is exercised by the [`integrations/attest-action/`](integrations/attest-action/) workflow in CI.
|
|
128
|
+
|
|
129
|
+
A third partial verifier runs in-browser at [`integrations/attest-view/`](integrations/attest-view/) for drag-and-drop inspection. The browser performs the predicate-equivalence and audit-chain steps but defers Sigstore certificate-chain verification to one of the two CLIs (bundling Fulcio/Rekor trust roots in-browser is intentionally not done; the page is explicit about it).
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Architecture
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
agent (Claude Code / Cline / MCP / Computer Use)
|
|
137
|
+
│
|
|
138
|
+
▼ tool call
|
|
139
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
140
|
+
│ Occasio proxy │
|
|
141
|
+
│ │
|
|
142
|
+
│ Layer 1: adapter parse → canonical event │
|
|
143
|
+
│ Layer 2: policy decision (LOCAL / PASS / BLOCK / TRANSFORM) │
|
|
144
|
+
│ Layer 2: deny_paths + deny_patterns + secret redaction │
|
|
145
|
+
│ Layer 2: native dispatch for LOCAL/TRANSFORM tools │
|
|
146
|
+
│ ──► row appended, SHA-256-chained │
|
|
147
|
+
│ Layer 4: anomaly detectors (windowed, on-demand or live) │
|
|
148
|
+
└──────────────────────────────────────────────────────────────┘
|
|
149
|
+
│
|
|
150
|
+
▼ cloud-bound: only PASS calls, with shaped result if TRANSFORM
|
|
151
|
+
Anthropic API
|
|
152
|
+
|
|
153
|
+
End of session
|
|
154
|
+
│
|
|
155
|
+
▼ occasio attest --run-id … --sign
|
|
156
|
+
Layer 3: signed in-toto Statement → Sigstore bundle → GitHub Check Run
|
|
157
|
+
│
|
|
158
|
+
▼ independent verifier
|
|
159
|
+
Node / Python / cosign — all must agree
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Log format
|
|
165
|
+
|
|
166
|
+
All data is stored locally at `~/.occasio/`:
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
~/.occasio/
|
|
170
|
+
pipeline-events.jsonl # tamper-evident audit chain (SHA-256 linked)
|
|
171
|
+
policy.yml # active policy
|
|
172
|
+
session.json # current run_id, totals
|
|
173
|
+
logs/YYYY-MM-DD.jsonl # per-request log
|
|
174
|
+
baseline/<cwd-hash>.json # per-project behavior baseline (opt-in)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
The audit-chain row schema is documented in [`docs/AUDIT.md`](docs/AUDIT.md). Each row carries `prev_hash` and `hash` (SHA-256 hex), with the first row chained from a fixed GENESIS sentinel (64 zeros). `occasio audit verify` and `docs/audit_walker.py` are independent implementations of the walker.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Demos
|
|
182
|
+
|
|
183
|
+
- [**EDR defense-in-depth**](docs/edr-demo.md) — real Claude Code attacking a denied path under your policy, all blocks held, EDR fires HIGH ×100–×1000 over baseline. Reproducible in <2 minutes.
|
|
184
|
+
- [**Reference Pipeline**](docs/reference-pipeline.md) — PR with AI-agent → GitHub Action signs attestation via Sigstore keyless → Check Run on the PR → independent verification offline.
|
|
185
|
+
- [**Cross-protocol governance**](docs/demos/mcp-block.md) — the same `deny_paths` rule producing identical `BLOCK` rows under Claude Code's HTTP proxy and the MCP server.
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Reference
|
|
190
|
+
|
|
191
|
+
- [`spec/agent-attestation/v1/README.md`](spec/agent-attestation/v1/README.md) — predicate type specification
|
|
192
|
+
- [`schemas/agent-attestation-v1.json`](schemas/agent-attestation-v1.json) — authoritative JSON Schema
|
|
193
|
+
- [`docs/AUDIT.md`](docs/AUDIT.md) — audit-chain row schema and canonical-serialisation rules
|
|
194
|
+
- [`docs/compliance-mapping.md`](docs/compliance-mapping.md) — SOC 2 Common-Criteria mapping
|
|
195
|
+
- [`docs/python-verifier.md`](docs/python-verifier.md) — independent Python verifier
|
|
196
|
+
- [`docs/edr-demo.md`](docs/edr-demo.md) — defense-in-depth walkthrough
|
|
197
|
+
- [`docs/reference-pipeline.md`](docs/reference-pipeline.md) — end-to-end CI pipeline
|
|
198
|
+
- [`integrations/attest-action/`](integrations/attest-action/) — GitHub Action that signs + posts a Check Run
|
|
199
|
+
- [`integrations/attest-view/`](integrations/attest-view/) — static browser viewer for attestation files
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Requirements
|
|
204
|
+
|
|
205
|
+
- **Node.js ≥ 18**
|
|
206
|
+
- **Claude Code** (`npm install -g @anthropic-ai/claude-code`) — or any agent that respects `ANTHROPIC_BASE_URL`
|
|
207
|
+
- **Python 3** (optional) — required for the independent verifier and LAO context trimming
|
|
208
|
+
- **`sigstore-python`** (optional) — adds the cryptographic Sigstore step to the Python verifier
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## License
|
|
213
|
+
|
|
214
|
+
Occasio is open source under the [Apache License 2.0](LICENSE), including an explicit patent grant for safe enterprise use. Versions 0.6.6 and earlier were released under the MIT License and remain MIT in perpetuity for those releases.
|
|
215
|
+
|
|
216
|
+
Contributions are accepted under Apache-2.0; please sign off your commits per the [DCO](https://developercertificate.org/) (`git commit -s`).
|
package/bin/occasio.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Occasio supervisor templates (v0.6.4)
|
|
2
|
+
|
|
3
|
+
Occasio aborts with exit code 1 when it cannot append to its audit log
|
|
4
|
+
(`~/.occasio/pipeline-events.jsonl`). This is intentional — a missing
|
|
5
|
+
audit row must not coexist with a successful tool dispatch. To keep the
|
|
6
|
+
proxy available, pair it with a small supervisor that respawns it on exit.
|
|
7
|
+
The templates below are starting points, not a daemon we ship.
|
|
8
|
+
|
|
9
|
+
## Validation status
|
|
10
|
+
|
|
11
|
+
| Template | Platform | Status |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| `install-windows-task.ps1` | Windows 11 / PowerShell 7+ | **manually validated** |
|
|
14
|
+
| `occasio.service` | Linux / systemd | shipped, **not yet manually validated** by maintainers |
|
|
15
|
+
| `com.occasio.proxy.plist.template` | macOS / launchd | shipped, **not yet manually validated** by maintainers |
|
|
16
|
+
|
|
17
|
+
The Linux and macOS templates are structurally analogous to the Windows
|
|
18
|
+
one and use standard mechanisms; please open an issue if you hit a
|
|
19
|
+
problem so we can fix the template rather than letting each pilot
|
|
20
|
+
re-derive it.
|
|
21
|
+
|
|
22
|
+
## Linux (systemd, user scope)
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
mkdir -p ~/.config/systemd/user
|
|
26
|
+
cp occasio.service ~/.config/systemd/user/occasio.service
|
|
27
|
+
systemctl --user daemon-reload
|
|
28
|
+
systemctl --user enable --now occasio
|
|
29
|
+
systemctl --user status occasio
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
To remove:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
systemctl --user disable --now occasio
|
|
36
|
+
rm ~/.config/systemd/user/occasio.service
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## macOS (launchd, user scope)
|
|
40
|
+
|
|
41
|
+
The plist is a template: replace `{{LOCALFIRST_BIN}}` with the absolute
|
|
42
|
+
path to your `occasio` binary first.
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
LF_BIN="$(command -v occasio)"
|
|
46
|
+
sed "s|{{LOCALFIRST_BIN}}|$LF_BIN|g" com.occasio.proxy.plist.template \
|
|
47
|
+
> ~/Library/LaunchAgents/ai.occasio.proxy.plist
|
|
48
|
+
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/ai.occasio.proxy.plist
|
|
49
|
+
launchctl print gui/$(id -u)/ai.occasio.proxy
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
To remove:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
launchctl bootout gui/$(id -u)/ai.occasio.proxy
|
|
56
|
+
rm ~/Library/LaunchAgents/ai.occasio.proxy.plist
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Windows (Scheduled Task, user scope)
|
|
60
|
+
|
|
61
|
+
From a PowerShell prompt in this directory:
|
|
62
|
+
|
|
63
|
+
```pwsh
|
|
64
|
+
pwsh ./install-windows-task.ps1
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
This registers a task named `Occasio` that runs `occasio start` at
|
|
68
|
+
each logon and restarts the process within one minute if it exits.
|
|
69
|
+
(Windows Scheduled Tasks enforce a one-minute minimum on restart
|
|
70
|
+
intervals; if your threat model requires faster recovery, run a
|
|
71
|
+
foreground supervisor instead.) The
|
|
72
|
+
task scope is the current user; Occasio's audit log is per-user, so
|
|
73
|
+
there is no benefit to running it as SYSTEM.
|
|
74
|
+
|
|
75
|
+
To remove:
|
|
76
|
+
|
|
77
|
+
```pwsh
|
|
78
|
+
Unregister-ScheduledTask -TaskName Occasio -Confirm:$false
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Notes
|
|
82
|
+
|
|
83
|
+
- These templates supervise the proxy process. They do **not** verify
|
|
84
|
+
the proxy is healthy beyond "the process exists." Pair with an
|
|
85
|
+
external health-check (`curl http://127.0.0.1:<port>/healthz`) if your
|
|
86
|
+
threat model requires it.
|
|
87
|
+
- The audit log itself is the source of truth for what was governed
|
|
88
|
+
while the proxy was running. Gaps in the log (sessions that started
|
|
89
|
+
with no rows) are a signal that the proxy was not running, not that
|
|
90
|
+
governance was bypassed silently.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!--
|
|
3
|
+
LocalFirst launchd template (v0.6.4).
|
|
4
|
+
|
|
5
|
+
This file is a TEMPLATE: replace {{LOCALFIRST_BIN}} with the absolute
|
|
6
|
+
path to your `occasio` executable before installing. See
|
|
7
|
+
bin/supervisor/README.md for the install command.
|
|
8
|
+
|
|
9
|
+
STATUS: shipped unvalidated on macOS in v0.6.4. The Linux systemd unit
|
|
10
|
+
is structurally analogous but only the Windows scheduled-task path has
|
|
11
|
+
been live-tested by the maintainers. Please report issues.
|
|
12
|
+
-->
|
|
13
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
14
|
+
<plist version="1.0">
|
|
15
|
+
<dict>
|
|
16
|
+
<key>Label</key>
|
|
17
|
+
<string>ai.occasio.proxy</string>
|
|
18
|
+
|
|
19
|
+
<key>ProgramArguments</key>
|
|
20
|
+
<array>
|
|
21
|
+
<string>{{LOCALFIRST_BIN}}</string>
|
|
22
|
+
<string>start</string>
|
|
23
|
+
</array>
|
|
24
|
+
|
|
25
|
+
<key>RunAtLoad</key>
|
|
26
|
+
<true/>
|
|
27
|
+
|
|
28
|
+
<key>KeepAlive</key>
|
|
29
|
+
<true/>
|
|
30
|
+
|
|
31
|
+
<key>StandardOutPath</key>
|
|
32
|
+
<string>/tmp/occasio.out.log</string>
|
|
33
|
+
<key>StandardErrorPath</key>
|
|
34
|
+
<string>/tmp/occasio.err.log</string>
|
|
35
|
+
</dict>
|
|
36
|
+
</plist>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<#
|
|
2
|
+
.SYNOPSIS
|
|
3
|
+
Register a Windows Scheduled Task that keeps `occasio` running for
|
|
4
|
+
the current user, restarting it within 30 seconds if it exits.
|
|
5
|
+
|
|
6
|
+
.DESCRIPTION
|
|
7
|
+
v0.6.4 of LocalFirst aborts with exit code 1 when it cannot append to
|
|
8
|
+
its audit log. This task brings the proxy back up so the agent can
|
|
9
|
+
resume work as soon as the underlying I/O issue clears.
|
|
10
|
+
|
|
11
|
+
.NOTES
|
|
12
|
+
Manually validated on Windows 11 Pro (PowerShell 7.x).
|
|
13
|
+
Tested-on: Windows.
|
|
14
|
+
|
|
15
|
+
The task runs at user logon, not at boot, because LocalFirst's audit
|
|
16
|
+
log lives in the user profile (~/.occasio/). Run from an elevated
|
|
17
|
+
shell only if you need the task to survive logoff.
|
|
18
|
+
#>
|
|
19
|
+
|
|
20
|
+
$Action = New-ScheduledTaskAction -Execute "occasio" -Argument "start"
|
|
21
|
+
$Trigger = New-ScheduledTaskTrigger -AtLogOn -User $env:USERNAME
|
|
22
|
+
|
|
23
|
+
$Settings = New-ScheduledTaskSettingsSet `
|
|
24
|
+
-RestartCount 999 `
|
|
25
|
+
-RestartInterval (New-TimeSpan -Minutes 1) `
|
|
26
|
+
-AllowStartIfOnBatteries `
|
|
27
|
+
-DontStopIfGoingOnBatteries `
|
|
28
|
+
-StartWhenAvailable
|
|
29
|
+
|
|
30
|
+
# -User <current user> + -RunLevel Limited keeps the task in the user
|
|
31
|
+
# scope so Register-ScheduledTask does not require an elevated shell.
|
|
32
|
+
$Principal = New-ScheduledTaskPrincipal `
|
|
33
|
+
-UserId $env:USERNAME `
|
|
34
|
+
-LogonType Interactive `
|
|
35
|
+
-RunLevel Limited
|
|
36
|
+
|
|
37
|
+
Register-ScheduledTask `
|
|
38
|
+
-TaskName "LocalFirst" `
|
|
39
|
+
-Description "LocalFirst — local AI-agent governance proxy (v0.6.4)" `
|
|
40
|
+
-Action $Action `
|
|
41
|
+
-Trigger $Trigger `
|
|
42
|
+
-Settings $Settings `
|
|
43
|
+
-Principal $Principal `
|
|
44
|
+
-Force
|
|
45
|
+
|
|
46
|
+
Write-Host "Registered scheduled task 'LocalFirst'."
|
|
47
|
+
Write-Host "It will start at next logon. To start now: Start-ScheduledTask -TaskName LocalFirst"
|
|
48
|
+
Write-Host "To remove: Unregister-ScheduledTask -TaskName LocalFirst -Confirm:`$false"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[Unit]
|
|
2
|
+
Description=LocalFirst — local AI-agent governance proxy
|
|
3
|
+
After=network-online.target
|
|
4
|
+
Wants=network-online.target
|
|
5
|
+
|
|
6
|
+
[Service]
|
|
7
|
+
Type=simple
|
|
8
|
+
ExecStart=/usr/bin/env occasio start
|
|
9
|
+
Restart=always
|
|
10
|
+
RestartSec=2
|
|
11
|
+
# v0.6.4: the proxy aborts with exit code 1 if it cannot append to its
|
|
12
|
+
# audit log. Restart=always plus a short RestartSec lets the chain resume
|
|
13
|
+
# as soon as the underlying I/O issue clears.
|
|
14
|
+
StandardOutput=journal
|
|
15
|
+
StandardError=journal
|
|
16
|
+
|
|
17
|
+
[Install]
|
|
18
|
+
WantedBy=default.target
|