@sunaiva/gate 1.1.0 → 1.1.2

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 (56) hide show
  1. package/BUSINESS_LICENSE.md +70 -70
  2. package/CHANGELOG.md +254 -148
  3. package/README.md +451 -451
  4. package/README.md.bak-v1.0.0-stale-MIT +59 -0
  5. package/SUPPORT.md +75 -0
  6. package/TIER_DEFINITIONS.md +161 -0
  7. package/dist/config/loader.d.ts.map +1 -1
  8. package/dist/config/loader.js +1 -1
  9. package/dist/config/loader.js.map +1 -1
  10. package/dist/engine/backend-client.d.ts.map +1 -1
  11. package/dist/engine/backend-client.js +2 -2
  12. package/dist/engine/backend-client.js.map +1 -1
  13. package/dist/engine/hmac-verifier.d.ts +19 -0
  14. package/dist/engine/hmac-verifier.d.ts.map +1 -1
  15. package/dist/engine/hmac-verifier.js +1 -3
  16. package/dist/engine/hmac-verifier.js.map +1 -1
  17. package/dist/engine/immutability.d.ts.map +1 -1
  18. package/dist/engine/immutability.js.map +1 -1
  19. package/dist/engine/pattern-matcher.d.ts.map +1 -1
  20. package/dist/engine/pattern-matcher.js.map +1 -1
  21. package/dist/engine/rule-engine.d.ts.map +1 -1
  22. package/dist/engine/rule-engine.js +5 -3
  23. package/dist/engine/rule-engine.js.map +1 -1
  24. package/dist/engine/session-state.d.ts.map +1 -1
  25. package/dist/engine/session-state.js.map +1 -1
  26. package/dist/engine/ship-confidence-gate.d.ts +48 -0
  27. package/dist/engine/ship-confidence-gate.d.ts.map +1 -1
  28. package/dist/engine/ship-confidence-gate.js +2 -2
  29. package/dist/engine/ship-confidence-gate.js.map +1 -1
  30. package/dist/index.js +27 -23
  31. package/dist/rules/rules.json +168 -200
  32. package/dist/tools/audit.d.ts.map +1 -1
  33. package/dist/tools/audit.js.map +1 -1
  34. package/dist/tools/bypass.d.ts.map +1 -1
  35. package/dist/tools/bypass.js +1 -1
  36. package/dist/tools/bypass.js.map +1 -1
  37. package/dist/tools/export-attestation.d.ts +45 -0
  38. package/dist/tools/export-attestation.d.ts.map +1 -0
  39. package/dist/tools/export-attestation.js +152 -0
  40. package/dist/tools/export-attestation.js.map +1 -0
  41. package/dist/tools/ship-confidence.d.ts +6 -0
  42. package/dist/tools/ship-confidence.d.ts.map +1 -1
  43. package/dist/tools/ship-confidence.js.map +1 -1
  44. package/dist/tools/update.d.ts.map +1 -1
  45. package/dist/tools/update.js +1 -1
  46. package/dist/tools/update.js.map +1 -1
  47. package/dist/tools/validate.d.ts.map +1 -1
  48. package/dist/tools/validate.js +1 -1
  49. package/dist/tools/validate.js.map +1 -1
  50. package/dist/types/backend.d.ts +1 -1
  51. package/dist/types/backend.d.ts.map +1 -1
  52. package/dist/types/backend.js +1 -1
  53. package/dist/types/backend.js.map +1 -1
  54. package/package.json +83 -73
  55. package/dist/index.d.ts.map +0 -1
  56. package/dist/index.js.map +0 -1
package/README.md CHANGED
@@ -1,451 +1,451 @@
1
- # @sunaiva/gate
2
-
3
- **Stop documenting rules your agents ignore. Start enforcing them.**
4
-
5
- `@sunaiva/gate` is an MCP server that intercepts AI agent actions before they
6
- execute and blocks the ones that violate your rules. It runs locally, in
7
- process, with zero external dependencies on the Free tier — the rules are baked
8
- into the package and enforced by a deterministic engine.
9
-
10
- ```bash
11
- npx @sunaiva/gate
12
- ```
13
-
14
- > **Status**: `1.1.0` "Foundation Release" — first publicly-supported release.
15
- > Closes all 7 CRITICAL findings from the signed Ship-Confidence verdict on
16
- > `1.0.1`. Full changelog: [`CHANGELOG.md`](./CHANGELOG.md). Roadmap that led
17
- > here: [`ROADMAP_1_1_0.md`](./ROADMAP_1_1_0.md).
18
-
19
- ---
20
-
21
- ## 60-second quickstart
22
-
23
- ```bash
24
- # 1. Install (no signup, no API key, no DNS records)
25
- npx @sunaiva/gate
26
-
27
- # 2. Verify it loaded
28
- npx @sunaiva/gate --smoke-test
29
- # → ✓ Gate loaded — 100 rules
30
- # → ✓ Constitutional rules — 32 (cannot be disabled, enforced locally)
31
- # → ✓ Premium rules — 68 (require backend service)
32
- # → Status: HEALTHY
33
- # → Version: 1.1.0
34
-
35
- # 3. Add to your MCP client (Claude Code, Cursor, Windsurf, Cline)
36
- # settings — see "MCP configuration" below.
37
- ```
38
-
39
- That is the entire onboarding. The 32 constitutional rules are active on first
40
- boot; no other configuration is required.
41
-
42
- ---
43
-
44
- ## What's free, forever
45
-
46
- The 1.1.0 Free tier (BUSL-1.1) ships with everything below baked into the npm
47
- package. No backend, no telemetry, no API key required.
48
-
49
- - **32 constitutional rules enforced locally** across five categories —
50
- financial-safety, data-protection, action-governance, security, and
51
- communication-safety. Detection patterns ship intact inside the package at
52
- `dist/rules/rules.json`.
53
- - **Severity ladder**: `block` / `warn-then-block` / `warn`.
54
- - **Approval-token workflow** — drop a JSON token at
55
- `data/deploy_queue/APPROVAL_TOKENS/<artifact>.json` and the gate honours it
56
- once, within a 1-hour TTL. This is the free-tier escape valve for one-shot
57
- manual unblocks.
58
- - **Local audit log** at `~/.sunaiva/audit/audit.jsonl` (lifetime, no rotation
59
- cap). Every entry records `tier`, `audit_status`, `evidence`, and
60
- `event_type` for queryable history.
61
- - **Kill-switch** — `DISABLE_SUNAIVA_GATE=1` short-circuits every
62
- `validate_action` to `allowed: true` with unconditional stderr disclosure.
63
- - **Dry-run mode** — `SUNAIVA_GATE_DRY_RUN=1` evaluates rules normally and
64
- records `would_have_blocked: [...]` without ever blocking.
65
- - **Constitutional immutability** — the 32 rules cannot be disabled via
66
- `update_rules` and cannot be bypassed via `log_bypass`, even if
67
- `~/.sunaiva/gate-config.json` is hand-edited (the loader re-merges on every
68
- read).
69
- - **Fail-CLOSED by default** — uncaught exceptions exit 3, malformed input
70
- exits 4. Both write a structured audit entry. Opt-in legacy fail-open via
71
- `SUNAIVA_GATE_FAIL_OPEN_ON_ERROR=1`.
72
- - **MCP integration** — Claude Code, Cursor, Copilot, Windsurf, Cline via the
73
- standard `mcpServers` config.
74
-
75
- The Free tier is BUSL-1.1 licensed and converts to **Apache-2.0** on
76
- **2030-05-10**. You can fork it, modify it, embed it in internal CI, and ship
77
- it in non-production workflows today — no contract, no signup, no credit card.
78
-
79
- ---
80
-
81
- ## What you get with Pro — `$79/mo` recommended, BYOK
82
-
83
- Pro adds the things a deterministic local engine cannot do on its own. Full
84
- tier matrix and pricing rationale: [`TIER_DEFINITIONS.md`](./TIER_DEFINITIONS.md).
85
-
86
- - **68 additional premium rules** (100 total) evaluated server-side via the
87
- premium backend at `https://gate.sunaiva.dev/api/v1/match`. Detection
88
- patterns are proprietary and stay in our infrastructure.
89
- - **Signed Ship-Confidence verdicts** — HMAC-SHA256, 60-minute freshness
90
- window. The `ship_confidence_check` MCP tool verifies the signature in
91
- constant time and returns `allowed: true` only when the verdict is
92
- `GREEN`, fresh, and untampered.
93
- - **`sunaiva-ship-confidence` skill integration** three independent
94
- verification layers (cross-provider spec verification, property-based
95
- testing with Hypothesis, adversarial audit via garak + DeepTeam) that
96
- emit signed verdicts the Gate honours automatically in CI.
97
- - **Dashboard** rules tab, audit tab, settings tab, billing tab. Cloud
98
- audit sync with 90-day retention.
99
- - **BYOK** — bring your own `ANTHROPIC_API_KEY` and `OPENROUTER_API_KEY`.
100
- You pay your own inference bill. We never see your tokens.
101
- - **Email support** — `support@sunaivadigital.com`, 2-business-day SLA
102
- target.
103
- - **Stripe-managed billing** with the founders coupon `KINANFOUNDER2026`
104
- (100% off, first 10 redemptions, per Rule 30).
105
-
106
- Enterprise (SSO, on-prem, multi-tenant org dashboard, named CSM) is
107
- quote-to-cash — see [`TIER_DEFINITIONS.md`](./TIER_DEFINITIONS.md) §3.
108
-
109
- ---
110
-
111
- ## Architecture
112
-
113
- ```
114
- ┌────────────────────────────────────────────────────────────────┐
115
- │ Your project (Claude Code / Cursor / Windsurf / Cline) │
116
- │ │
117
- ┌──────────────────────────────────────────────────────┐
118
- MCP client invokes a tool │ │
119
- │ e.g. Bash("git push origin main") │
120
- └────────────────────────┬─────────────────────────────┘
121
- └────────────────────────────┼───────────────────────────────────┘
122
-
123
- ┌────────────────────────────────────────────────────────────────┐
124
- │ @sunaiva/gate (MCP server, stdio transport) │
125
- │ │
126
- ┌──────────────────────────────────────────────────────┐
127
- validate_action │ │
128
- │ │ │
129
- │ │ ├─► Constitutional rules (32) — pattern matched │ │
130
- │ │ │ LOCALLY against dist/rules/rules.json │ │
131
- │ │ │ ─────────────────────────────► block/warn │ │
132
- │ │ │ │ │
133
- │ │ └─► Premium rules (68) — only if backend set │ │
134
- │ │ POST https://gate.sunaiva.dev/api/v1/match │ │
135
- │ │ (JWT auth via SUNAIVA_GATE_API_TOKEN) │ │
136
- │ │ ─────────────────────────────► block/warn │ │
137
- │ │ (fail-OPEN per-rule on backend error) │ │
138
- └──────────────────────────────────────────────────────┘
139
-
140
- audit log ─► ~/.sunaiva/audit/audit.jsonl
141
- └────────────────────────────────────────────────────────────────┘
142
- ```
143
-
144
- The Free tier path (constitutional rules) has zero network dependencies. The
145
- Pro path is opt-in — set `SUNAIVA_GATE_BACKEND_URL` and the engine starts
146
- POSTing actions to the backend for the premium-rule subset; without it, those
147
- rules are skipped (recorded as `skipped_premium` in the audit, surfaced once
148
- per session as a stderr notice).
149
-
150
- ---
151
-
152
- ## MCP configuration
153
-
154
- Add to your client's MCP settings:
155
-
156
- ```json
157
- {
158
- "mcpServers": {
159
- "sunaiva-gate": {
160
- "command": "npx",
161
- "args": ["@sunaiva/gate"]
162
- }
163
- }
164
- }
165
- ```
166
-
167
- Restart your MCP client. The first tool call will trigger the gate.
168
-
169
- ---
170
-
171
- ## MCP tool reference
172
-
173
- | Tool | What it does |
174
- |------|--------------|
175
- | `validate_action` | Check a proposed action against all active rules. Returns `{allowed, violations[], warnings[], skipped_premium[], dry_run?, would_have_blocked?, stamp}`. The workhorse — every PreToolUse hook calls this. |
176
- | `log_bypass` | Record an intentional rule bypass for the audit log. **Rejects constitutional rules** with a structured `CONSTITUTIONAL_RULE_CANNOT_BE_BYPASSED` error. |
177
- | `get_rules` | List active rules; supports filtering by `category` or `preset`. |
178
- | `update_rules` | Enable / disable rules. **Rejects disable attempts against constitutional rules** with a structured `CONSTITUTIONAL_RULE_IMMUTABLE` error. |
179
- | `get_audit_log` | Return recent gate decisions from `~/.sunaiva/audit/audit.jsonl` with `tier`, `audit_status`, `evidence`, `event_type` fields. |
180
- | `ship_confidence_check` | **Paid-tier production-deploy gate.** Accepts a signed verdict path or artifact ID; verifies HMAC-SHA256 against `SHIP_CONFIDENCE_SIGNING_KEY`; returns `{allowed, tier: "paid"\|"free", reason, evidence}`. Tagged in the audit ledger so you can measure the free-→paid upgrade funnel. |
181
-
182
- Total: **6 MCP tools**. The `ship_confidence_check` tool is the ported
183
- TypeScript implementation of `.claude/hooks/ship_confidence_gate.py` v1.2.0,
184
- byte-compatible with the Python skill's canonical-JSON HMAC format.
185
-
186
- ---
187
-
188
- ## Environment variables
189
-
190
- | Variable | Default | Purpose |
191
- |----------|---------|---------|
192
- | `DISABLE_SUNAIVA_GATE` | unset | Set to `1` to short-circuit every `validate_action` to `allowed: true`. Unconditionally logs to stderr. |
193
- | `SUNAIVA_GATE_DRY_RUN` | unset | Set to `1` to evaluate rules normally but never block. Response includes `dry_run: true` and `would_have_blocked: [...]`. |
194
- | `SUNAIVA_GATE_BACKEND_URL` | unset | Premium backend endpoint. Default for Pro customers: `https://gate.sunaiva.dev/api/v1/match`. When unset, premium rules are skipped (recorded as `skipped_premium`). |
195
- | `SUNAIVA_GATE_API_TOKEN` | unset | Bearer token (JWT) for the premium backend. Required when `SUNAIVA_GATE_BACKEND_URL` is set. |
196
- | `SUNAIVA_GATE_BACKEND_TIMEOUT_MS` | `3000` | Backend request timeout. Backend errors fail-OPEN per-rule (logged as `skipped_premium_backend_error`). |
197
- | `SUNAIVA_GATE_FAIL_OPEN_ON_ERROR` | unset | Set to `1` to restore the 1.0.x fail-open behaviour on uncaught exceptions and malformed input. Default is fail-CLOSED. |
198
- | `SHIP_CONFIDENCE_SIGNING_KEY` | unset | HMAC-SHA256 key for verifying signed `sunaiva-ship-confidence` verdicts. Required by the `ship_confidence_check` tool. |
199
- | `SUNAIVA_GATE_AUDIT_PATH` | `~/.sunaiva/audit/audit.jsonl` | Override the audit log path. |
200
-
201
- ---
202
-
203
- ## Exit codes
204
-
205
- | Code | Meaning |
206
- |------|---------|
207
- | `0` | Allow / success / smoke-test HEALTHY |
208
- | `1` | Generic test failure (legacy `--test` flag, smoke-test DEGRADED) |
209
- | `2` | Block (Claude Code convention) |
210
- | `3` | Fail-CLOSED internal error (uncaught exception). Opt-in fail-open via `SUNAIVA_GATE_FAIL_OPEN_ON_ERROR=1`. |
211
- | `4` | Fail-CLOSED invalid input (malformed JSON, empty stdin). Same opt-in escape hatch. |
212
- | `5` | Smoke-test DEGRADED with missing required files (e.g. `dist/rules/rules.json` absent). |
213
-
214
- ---
215
-
216
- ## Killing the gate (and why we tell you how)
217
-
218
- `@sunaiva/gate` discloses its kill-switch in every block and warn message:
219
-
220
- ```
221
- [sunaiva-gate v1.1.0] BLOCK — rule: dat-001 (recursive root deletion)
222
- Escape: export DISABLE_SUNAIVA_GATE=1
223
- Audit: ~/.sunaiva/audit/audit.jsonl
224
- ```
225
-
226
- The escape hint is a deliberate security-disclosure design. An enforcement
227
- product that hides its own bypass is one that gets routed around in production
228
- without anyone knowing. The kill-switch invocation is itself logged to the
229
- audit ledger as `decision: 'bypass_kill_switch'`, so disabling the gate is
230
- visible to anyone who reads the audit.
231
-
232
- ```bash
233
- export DISABLE_SUNAIVA_GATE=1 # All actions allowed (logged)
234
- unset DISABLE_SUNAIVA_GATE # Back to normal enforcement
235
- ```
236
-
237
- Use dry-run instead of the kill-switch when you want to *measure* what the
238
- gate would block without actually blocking anything:
239
-
240
- ```bash
241
- export SUNAIVA_GATE_DRY_RUN=1
242
- # → response.dry_run: true
243
- # → response.would_have_blocked: [{rule_id, name, severity}, ...]
244
- ```
245
-
246
- ---
247
-
248
- ## Decision model — warn-then-block escalation
249
-
250
- Constitutional rules block on the first match. Standard rules (the
251
- non-constitutional subset) implement a session-state escalation:
252
-
253
- - **First match in a session** → `warn` (action allowed, message printed).
254
- - **Subsequent matches in the same session** → `block`.
255
-
256
- This avoids one-time false-positive noise while still catching repeated
257
- violations. The session counter is reset when the MCP server process restarts.
258
- Confidence is derived from keyword-count thresholds: `≥3` keywords matched
259
- `high`, `1-2` `medium`, `0` `low` (low confidence is filtered out before
260
- the response).
261
-
262
- ---
263
-
264
- ## Smoke test
265
-
266
- ```bash
267
- $ npx @sunaiva/gate --smoke-test
268
- ✓ Gate loaded — 100 rules
269
- Constitutional rules — 32 (cannot be disabled, enforced locally)
270
- Premium rules68 (require backend service)
271
- Presets file5 presets available
272
- Live eval (git push origin main) HARD block via gov-001
273
- Live eval (ls -la) ALLOW
274
- ✓ Live eval (rm -rf /) — HARD block via dat-001
275
- ✓ Live eval (stripe.charges.create) — HARD block via fin-001
276
- Immutability guardACTIVE (32 constitutional rules pinned)
277
- MCP serverready (not started in smoke test)
278
- Status: HEALTHY
279
- Version: 1.1.0
280
- Issues: https://github.com/Kinan27/sunaiva-gate/issues
281
- ```
282
-
283
- Exit codes: `0` = HEALTHY, `1` = DEGRADED, `5` = missing required files.
284
-
285
- ---
286
-
287
- ## Presets
288
-
289
- `get_rules` accepts a `preset` argument that filters the active set:
290
-
291
- | Preset | Rules | Use case |
292
- |--------|-------|----------|
293
- | `minimal` | 5 | Absolute non-negotiables only |
294
- | `essential` | 15 | Recommended starting point |
295
- | `developer-safety` | 25 | AI coding agents (Cursor / Windsurf / Cline / Aider) |
296
- | `financial-protection` | 24 | All financial + resource rules |
297
- | `full-suite` | 100 | Everything Free constitutional set + Pro premium set |
298
-
299
- Presets read from `dist/rules/presets.json`. Premium presets require
300
- `SUNAIVA_GATE_BACKEND_URL` to be set; without it the premium rules are skipped
301
- with a `skipped_premium` audit entry.
302
-
303
- ---
304
-
305
- ## Ship Confidence Gate (paid tier)
306
-
307
- The `ship_confidence_check` MCP tool is the deploy-time gate for high-blast-
308
- radius commands (`npm publish`, `wrangler deploy`, `gh repo create --public`,
309
- `netlify deploy --prod`). It checks for authorization in two tiers:
310
-
311
- ### Paid path signed verdict
312
- 1. The `sunaiva-ship-confidence` Python skill runs three verification layers
313
- against your product (spec verification, property-based testing,
314
- adversarial audit).
315
- 2. It emits a signed verdict at
316
- `data/ship_confidence_verdicts/<artifact>.signed.json`.
317
- 3. The `ship_confidence_check` tool verifies:
318
- - HMAC-SHA256 signature is valid (constant-time compare, byte-compatible
319
- with the Python skill's canonical-JSON encoding).
320
- - `level == "GREEN"` (YELLOW and RED hard-block).
321
- - Signed within the last 60 minutes
322
- (configurable via `VERDICT_MAX_AGE_MINUTES`).
323
- 4. On all-pass: returns `{allowed: true, tier: "paid", ...}` and writes an
324
- audit entry tagged `tier: "paid"` with the verdict ID and evidence.
325
-
326
- ### Free fallback approval token
327
- If no signed verdict is found (or `SHIP_CONFIDENCE_SIGNING_KEY` is not set),
328
- the tool falls back to a one-time approval token at
329
- `data/deploy_queue/APPROVAL_TOKENS/<artifact>.json` written within the last
330
- hour. Tagged `tier: "free"` in the audit ledger with an upgrade hint pointing
331
- at the paid skill.
332
-
333
- ```bash
334
- # CLI form for use in CI:
335
- npx @sunaiva/gate --ship-confidence @sunaiva/gate@1.1.0
336
- # Exit 0 = allow, 2 = block, 3 = internal error (fail-OPEN logged)
337
- ```
338
-
339
- ---
340
-
341
- ## Constitutional rules cannot be disabled or bypassed
342
-
343
- This is the package's hard guarantee. The 32 constitutional rules are
344
- re-merged into `active_rules` on every config load — even if
345
- `~/.sunaiva/gate-config.json` is hand-edited to remove them and:
346
-
347
- - `update_rules({disable: ['fin-001']})` returns
348
- `{error: "CONSTITUTIONAL_RULE_IMMUTABLE", rule_ids: [...]}`. No state
349
- change.
350
- - `log_bypass({rule_id: 'fin-001'})` returns
351
- `{error: "CONSTITUTIONAL_RULE_CANNOT_BE_BYPASSED", rule_id: ...}`. Nothing
352
- written to the bypass log.
353
-
354
- The kill-switch (`DISABLE_SUNAIVA_GATE=1`) is the only way to disable
355
- constitutional enforcement, and it is loud — stderr disclosure on every
356
- block, audit-ledger entry on every short-circuit. There are no quiet
357
- bypasses.
358
-
359
- ---
360
-
361
- ## Known limitations — what 1.1.0 does NOT have
362
-
363
- We shipped `1.0.1` with seven CRITICAL gaps flagged by our own signed
364
- Ship-Confidence verdict on our own commit (`01KRDBCEYF2CAB21G6Y3E9VVH5`, RED).
365
- 1.1.0 closes all seven. What is honestly **not** in 1.1.0 yet:
366
-
367
- - **Sunaiva-Managed inference** no flat-fee tier that includes LLM calls.
368
- BYOK only in v1. Revisit at 50+ Pro customers.
369
- - **UI verification layer** (Playwright walkthroughs / computer-use)
370
- designed in
371
- `data/ship_confidence_skill_upgrade_2026_05_11.md`, not yet shipped.
372
- Folded into Pro at no extra cost when it lands.
373
- - **Multi-tenant dashboard / "Pro Team" tier** — Pro is single-seat in v1.
374
- Team management is Enterprise. A self-serve "Pro Team" tier waits until
375
- 10+ customers ask for it.
376
- - **On-prem / VPC deployment** — Enterprise-only roadmap item. Helm chart
377
- and Terraform module designs exist; not yet packaged.
378
- - **Per-call / metered pricing** — abandoned. Subscription wins.
379
- - **On-chain attestation (ERC-8004)** aspirational. Deferred to v2.x.
380
-
381
- Full deferred-feature list:
382
- [`TIER_DEFINITIONS.md` §4](./TIER_DEFINITIONS.md).
383
-
384
- ---
385
-
386
- ## Cross-platform
387
-
388
- - **Linux** — native.
389
- - **WSL** — native.
390
- - **macOS** — native.
391
- - **Windows** — native Node, plus a Python shim for clients that invoke the
392
- legacy `hooks/sunaiva_gate_hook.py` PreToolUse path.
393
-
394
- ---
395
-
396
- ## Privacy
397
-
398
- Your data stays where you choose. The Free tier makes **zero** external network
399
- calls — constitutional rules are evaluated locally against patterns shipped
400
- inside the package. The Pro path is opt-in: when you set
401
- `SUNAIVA_GATE_BACKEND_URL`, the engine POSTs only the proposed action text
402
- and rule IDs to the backend; we never see your code, your secrets, or your
403
- filesystem. BYOK means your `ANTHROPIC_API_KEY` and `OPENROUTER_API_KEY` go
404
- direct from your machine to those providers they do not transit Sunaiva.
405
-
406
- ---
407
-
408
- ## License
409
-
410
- [BUSL-1.1](./BUSINESS_LICENSE.md) — free for evaluation, internal development,
411
- hobby and academic use. Commercial license required if you embed the Gate in
412
- the critical path of a third-party paying-customer product before the
413
- **Change Date of 2030-05-10**, after which the wrapper converts to
414
- **Apache-2.0** automatically. The premium backend stays proprietary regardless
415
- of the Change Date.
416
-
417
- - Licensor: Sunaiva Digital
418
- - Change Date: **2030-05-10**
419
- - Change License: **Apache License, Version 2.0**
420
-
421
- ---
422
-
423
- ## Support
424
-
425
- | Need | Where |
426
- |------|-------|
427
- | Bug or crash | [Open an issue](https://github.com/Kinan27/sunaiva-gate/issues/new?template=bug.yml) |
428
- | Feature request | [Open an issue](https://github.com/Kinan27/sunaiva-gate/issues/new?template=feature.yml) |
429
- | Security vulnerability | Email `security@sunaivadigital.com` (do not file publicly) |
430
- | Licensing | `kinan@sunaiva.ai` |
431
- | Commercial / paid tier | `support@sunaivadigital.com` |
432
- | General discussion | [GitHub Discussions](https://github.com/Kinan27/sunaiva-gate/discussions) |
433
-
434
- Full support guide: [`SUPPORT.md`](./SUPPORT.md).
435
-
436
- When reporting bugs, include the output of `npx @sunaiva/gate --smoke-test`
437
- and `node --version`.
438
-
439
- ---
440
-
441
- ## Contributing
442
-
443
- Pull requests welcome. For substantial changes, please open an issue first to
444
- discuss the proposal. Constitutional rule additions require a corresponding
445
- test fixture in `tests/bundle.test.ts` and a passing dogfood Ship-Confidence
446
- verdict on the change.
447
-
448
- ---
449
-
450
- *Built by a team whose own hooks killed their development for nine hours.
451
- We fixed it. Then we shipped the fix. Then we signed the proof.*
1
+ # @sunaiva/gate
2
+
3
+ **Stop documenting rules your agents ignore. Start enforcing them.**
4
+
5
+ `@sunaiva/gate` is an MCP server that intercepts AI agent actions before they
6
+ execute and blocks the ones that violate your rules. It runs locally, in
7
+ process, with zero external dependencies on the Free tier — the rules are baked
8
+ into the package and enforced by a deterministic engine.
9
+
10
+ ```bash
11
+ npx @sunaiva/gate
12
+ ```
13
+
14
+ > **Status**: `1.1.0` "Foundation Release" — first publicly-supported release.
15
+ > Closes all 7 CRITICAL findings from the signed Ship-Confidence verdict on
16
+ > `1.0.1`. Full changelog: [`CHANGELOG.md`](./CHANGELOG.md). Roadmap that led
17
+ > here: [`ROADMAP_1_1_0.md`](./ROADMAP_1_1_0.md).
18
+
19
+ ---
20
+
21
+ ## 60-second quickstart
22
+
23
+ ```bash
24
+ # 1. Install (no signup, no API key, no DNS records)
25
+ npx @sunaiva/gate
26
+
27
+ # 2. Verify it loaded
28
+ npx @sunaiva/gate --smoke-test
29
+ # → ✓ Gate loaded — 100 rules
30
+ # → ✓ Constitutional rules — 32 (cannot be disabled, enforced locally)
31
+ # → ✓ Premium rules — 68 (require backend service)
32
+ # → Status: HEALTHY
33
+ # → Version: 1.1.0
34
+
35
+ # 3. Add to your MCP client (Claude Code, Cursor, Windsurf, Cline)
36
+ # settings — see "MCP configuration" below.
37
+ ```
38
+
39
+ That is the entire onboarding. The 32 constitutional rules are active on first
40
+ boot; no other configuration is required.
41
+
42
+ ---
43
+
44
+ ## What's free, forever
45
+
46
+ The 1.1.0 Free tier (BUSL-1.1) ships with everything below baked into the npm
47
+ package. No backend, no telemetry, no API key required.
48
+
49
+ - **32 constitutional rules enforced locally** across five categories —
50
+ financial-safety, data-protection, action-governance, security, and
51
+ communication-safety. Detection patterns ship intact inside the package at
52
+ `dist/rules/rules.json`.
53
+ - **Severity ladder**: `block` / `warn-then-block` / `warn`.
54
+ - **Approval-token workflow** — drop a JSON token at
55
+ `data/deploy_queue/APPROVAL_TOKENS/<artifact>.json` and the gate honours it
56
+ once, within a 1-hour TTL. This is the free-tier escape valve for one-shot
57
+ manual unblocks.
58
+ - **Local audit log** at `~/.sunaiva/audit/audit.jsonl` (lifetime, no rotation
59
+ cap). Every entry records `tier`, `audit_status`, `evidence`, and
60
+ `event_type` for queryable history.
61
+ - **Kill-switch** — `DISABLE_SUNAIVA_GATE=1` short-circuits every
62
+ `validate_action` to `allowed: true` with unconditional stderr disclosure.
63
+ - **Dry-run mode** — `SUNAIVA_GATE_DRY_RUN=1` evaluates rules normally and
64
+ records `would_have_blocked: [...]` without ever blocking.
65
+ - **Constitutional immutability** — the 32 rules cannot be disabled via
66
+ `update_rules` and cannot be bypassed via `log_bypass`, even if
67
+ `~/.sunaiva/gate-config.json` is hand-edited (the loader re-merges on every
68
+ read).
69
+ - **Fail-CLOSED by default** — uncaught exceptions exit 3, malformed input
70
+ exits 4. Both write a structured audit entry. Opt-in legacy fail-open via
71
+ `SUNAIVA_GATE_FAIL_OPEN_ON_ERROR=1`.
72
+ - **MCP integration** — Claude Code, Cursor, Copilot, Windsurf, Cline via the
73
+ standard `mcpServers` config.
74
+
75
+ The Free tier is BUSL-1.1 licensed and converts to **Apache-2.0** on
76
+ **2030-05-10**. You can fork it, modify it, embed it in internal CI, and ship
77
+ it in non-production workflows today — no contract, no signup, no credit card.
78
+
79
+ ---
80
+
81
+ ## What you get with Pro (recommended, BYOK)
82
+
83
+ Pro adds the things a deterministic local engine cannot do on its own. Full
84
+ tier matrix in [`TIER_DEFINITIONS.md`](./TIER_DEFINITIONS.md). Current pricing
85
+ at **https://sunaivacore.io/pricing** (canonical source of truth across all
86
+ Sunaiva Core products).
87
+
88
+ - **68 additional premium rules** (100 total) evaluated server-side via the
89
+ premium backend at `https://mcp.sunaivacore.io/v1/gatehooks`. Detection
90
+ patterns are proprietary and stay in our infrastructure.
91
+ - **Signed Ship-Confidence verdicts** HMAC-SHA256, 60-minute freshness
92
+ window. The `ship_confidence_check` MCP tool verifies the signature in
93
+ constant time and returns `allowed: true` only when the verdict is
94
+ `GREEN`, fresh, and untampered.
95
+ - **`sunaiva-ship-confidence` skill integration** three independent
96
+ verification layers (cross-provider spec verification, property-based
97
+ testing with Hypothesis, adversarial audit via garak + DeepTeam) that
98
+ emit signed verdicts the Gate honours automatically in CI.
99
+ - **Dashboard** — rules tab, audit tab, settings tab, billing tab. Cloud
100
+ audit sync with 90-day retention.
101
+ - **BYOK** — bring your own `ANTHROPIC_API_KEY` and `OPENROUTER_API_KEY`.
102
+ You pay your own inference bill. We never see your tokens.
103
+ - **Email support** `support@sunaiva.ai`, 2-business-day SLA
104
+ target.
105
+ - **Stripe-managed billing** with the founders coupon `KINANFOUNDER2026`
106
+ (100% off, first 10 redemptions, per Rule 30).
107
+
108
+ Enterprise (SSO, on-prem, multi-tenant org dashboard, named CSM) is
109
+ quote-to-cash — see the [Enterprise tier in `TIER_DEFINITIONS.md`](./TIER_DEFINITIONS.md#enterprise--contact-sales).
110
+
111
+ ---
112
+
113
+ ## Architecture
114
+
115
+ ```
116
+ ┌────────────────────────────────────────────────────────────────┐
117
+ Your project (Claude Code / Cursor / Windsurf / Cline)
118
+
119
+ ┌──────────────────────────────────────────────────────┐
120
+ │ MCP client invokes a tool │
121
+ │ │ e.g. Bash("git push origin main") │ │
122
+ │ └────────────────────────┬─────────────────────────────┘ │
123
+ └────────────────────────────┼───────────────────────────────────┘
124
+
125
+ ┌────────────────────────────────────────────────────────────────┐
126
+ @sunaiva/gate (MCP server, stdio transport)
127
+
128
+ ┌──────────────────────────────────────────────────────┐
129
+ │ │ validate_action │ │
130
+ │ │ │ │ │
131
+ │ │ ├─► Constitutional rules (32) — pattern matched │ │
132
+ │ │ │ LOCALLY against dist/rules/rules.json │ │
133
+ │ │ │ ─────────────────────────────► block/warn │ │
134
+ │ │
135
+ │ │ └─► Premium rules (68) only if backend set │ │
136
+ │ │ POST https://mcp.sunaivacore.io/v1/gatehooks │ │
137
+ │ │ (JWT auth via SUNAIVA_GATE_API_TOKEN) │ │
138
+ │ ─────────────────────────────► block/warn │
139
+ (fail-OPEN per-rule on backend error) │ │
140
+ └──────────────────────────────────────────────────────┘
141
+ │ │
142
+ │ audit log ─► ~/.sunaiva/audit/audit.jsonl │
143
+ └────────────────────────────────────────────────────────────────┘
144
+ ```
145
+
146
+ The Free tier path (constitutional rules) has zero network dependencies. The
147
+ Pro path is opt-in set `SUNAIVA_GATE_BACKEND_URL` and the engine starts
148
+ POSTing actions to the backend for the premium-rule subset; without it, those
149
+ rules are skipped (recorded as `skipped_premium` in the audit, surfaced once
150
+ per session as a stderr notice).
151
+
152
+ ---
153
+
154
+ ## MCP configuration
155
+
156
+ Add to your client's MCP settings:
157
+
158
+ ```json
159
+ {
160
+ "mcpServers": {
161
+ "sunaiva-gate": {
162
+ "command": "npx",
163
+ "args": ["@sunaiva/gate"]
164
+ }
165
+ }
166
+ }
167
+ ```
168
+
169
+ Restart your MCP client. The first tool call will trigger the gate.
170
+
171
+ ---
172
+
173
+ ## MCP tool reference
174
+
175
+ | Tool | What it does |
176
+ |------|--------------|
177
+ | `validate_action` | Check a proposed action against all active rules. Returns `{allowed, violations[], warnings[], skipped_premium[], dry_run?, would_have_blocked?, stamp}`. The workhorse — every PreToolUse hook calls this. |
178
+ | `log_bypass` | Record an intentional rule bypass for the audit log. **Rejects constitutional rules** with a structured `CONSTITUTIONAL_RULE_CANNOT_BE_BYPASSED` error. |
179
+ | `get_rules` | List active rules; supports filtering by `category` or `preset`. |
180
+ | `update_rules` | Enable / disable rules. **Rejects disable attempts against constitutional rules** with a structured `CONSTITUTIONAL_RULE_IMMUTABLE` error. |
181
+ | `get_audit_log` | Return recent gate decisions from `~/.sunaiva/audit/audit.jsonl` with `tier`, `audit_status`, `evidence`, `event_type` fields. |
182
+ | `ship_confidence_check` | **Paid-tier production-deploy gate.** Accepts a signed verdict path or artifact ID; verifies HMAC-SHA256 against `SHIP_CONFIDENCE_SIGNING_KEY`; returns `{allowed, tier: "paid"\|"free", reason, evidence}`. Tagged in the audit ledger so you can measure the free-→paid upgrade funnel. |
183
+
184
+ Total: **6 MCP tools**. The `ship_confidence_check` tool is the ported
185
+ TypeScript implementation of `.claude/hooks/ship_confidence_gate.py` v1.2.0,
186
+ byte-compatible with the Python skill's canonical-JSON HMAC format.
187
+
188
+ ---
189
+
190
+ ## Environment variables
191
+
192
+ | Variable | Default | Purpose |
193
+ |----------|---------|---------|
194
+ | `DISABLE_SUNAIVA_GATE` | unset | Set to `1` to short-circuit every `validate_action` to `allowed: true`. Unconditionally logs to stderr. |
195
+ | `SUNAIVA_GATE_DRY_RUN` | unset | Set to `1` to evaluate rules normally but never block. Response includes `dry_run: true` and `would_have_blocked: [...]`. |
196
+ | `SUNAIVA_GATE_BACKEND_URL` | unset | Premium backend endpoint. Default for Pro customers: `https://mcp.sunaivacore.io/v1/gatehooks`. When unset, premium rules are skipped (recorded as `skipped_premium`). |
197
+ | `SUNAIVA_GATE_API_TOKEN` | unset | Bearer token (JWT) for the premium backend. Required when `SUNAIVA_GATE_BACKEND_URL` is set. |
198
+ | `SUNAIVA_GATE_BACKEND_TIMEOUT_MS` | `3000` | Backend request timeout. Backend errors fail-OPEN per-rule (logged as `skipped_premium_backend_error`). |
199
+ | `SUNAIVA_GATE_FAIL_OPEN_ON_ERROR` | unset | Set to `1` to restore the 1.0.x fail-open behaviour on uncaught exceptions and malformed input. Default is fail-CLOSED. |
200
+ | `SHIP_CONFIDENCE_SIGNING_KEY` | unset | HMAC-SHA256 key for verifying signed `sunaiva-ship-confidence` verdicts. Required by the `ship_confidence_check` tool. |
201
+ | `SUNAIVA_GATE_AUDIT_PATH` | `~/.sunaiva/audit/audit.jsonl` | Override the audit log path. |
202
+
203
+ ---
204
+
205
+ ## Exit codes
206
+
207
+ | Code | Meaning |
208
+ |------|---------|
209
+ | `0` | Allow / success / smoke-test HEALTHY |
210
+ | `1` | Generic test failure (legacy `--test` flag, smoke-test DEGRADED) |
211
+ | `2` | Block (Claude Code convention) |
212
+ | `3` | Fail-CLOSED internal error (uncaught exception). Opt-in fail-open via `SUNAIVA_GATE_FAIL_OPEN_ON_ERROR=1`. |
213
+ | `4` | Fail-CLOSED invalid input (malformed JSON, empty stdin). Same opt-in escape hatch. |
214
+ | `5` | Smoke-test DEGRADED with missing required files (e.g. `dist/rules/rules.json` absent). |
215
+
216
+ ---
217
+
218
+ ## Killing the gate (and why we tell you how)
219
+
220
+ `@sunaiva/gate` discloses its kill-switch in every block and warn message:
221
+
222
+ ```
223
+ [sunaiva-gate v1.1.0] BLOCK — rule: dat-001 (recursive root deletion)
224
+ Escape: export DISABLE_SUNAIVA_GATE=1
225
+ Audit: ~/.sunaiva/audit/audit.jsonl
226
+ ```
227
+
228
+ The escape hint is a deliberate security-disclosure design. An enforcement
229
+ product that hides its own bypass is one that gets routed around in production
230
+ without anyone knowing. The kill-switch invocation is itself logged to the
231
+ audit ledger as `decision: 'bypass_kill_switch'`, so disabling the gate is
232
+ visible to anyone who reads the audit.
233
+
234
+ ```bash
235
+ export DISABLE_SUNAIVA_GATE=1 # All actions allowed (logged)
236
+ unset DISABLE_SUNAIVA_GATE # Back to normal enforcement
237
+ ```
238
+
239
+ Use dry-run instead of the kill-switch when you want to *measure* what the
240
+ gate would block without actually blocking anything:
241
+
242
+ ```bash
243
+ export SUNAIVA_GATE_DRY_RUN=1
244
+ # → response.dry_run: true
245
+ # → response.would_have_blocked: [{rule_id, name, severity}, ...]
246
+ ```
247
+
248
+ ---
249
+
250
+ ## Decision model warn-then-block escalation
251
+
252
+ Constitutional rules block on the first match. Standard rules (the
253
+ non-constitutional subset) implement a session-state escalation:
254
+
255
+ - **First match in a session** → `warn` (action allowed, message printed).
256
+ - **Subsequent matches in the same session** `block`.
257
+
258
+ This avoids one-time false-positive noise while still catching repeated
259
+ violations. The session counter is reset when the MCP server process restarts.
260
+ Confidence is derived from keyword-count thresholds: `≥3` keywords matched →
261
+ `high`, `1-2` → `medium`, `0` → `low` (low confidence is filtered out before
262
+ the response).
263
+
264
+ ---
265
+
266
+ ## Smoke test
267
+
268
+ ```bash
269
+ $ npx @sunaiva/gate --smoke-test
270
+ Gate loaded100 rules
271
+ Constitutional rules32 (cannot be disabled, enforced locally)
272
+ Premium rules68 (require backend service)
273
+ Presets file 5 presets available
274
+ ✓ Live eval (git push origin main) — HARD block via gov-001
275
+ ✓ Live eval (ls -la) — ALLOW
276
+ Live eval (rm -rf /) HARD block via dat-001
277
+ Live eval (stripe.charges.create) HARD block via fin-001
278
+ Immutability guard — ACTIVE (32 constitutional rules pinned)
279
+ MCP server — ready (not started in smoke test)
280
+ Status: HEALTHY
281
+ Version: 1.1.1
282
+ Support: support@sunaiva.ai
283
+ ```
284
+
285
+ Exit codes: `0` = HEALTHY, `1` = DEGRADED, `5` = missing required files.
286
+
287
+ ---
288
+
289
+ ## Presets
290
+
291
+ `get_rules` accepts a `preset` argument that filters the active set:
292
+
293
+ | Preset | Rules | Use case |
294
+ |--------|-------|----------|
295
+ | `minimal` | 5 | Absolute non-negotiables only |
296
+ | `essential` | 15 | Recommended starting point |
297
+ | `developer-safety` | 25 | AI coding agents (Cursor / Windsurf / Cline / Aider) |
298
+ | `financial-protection` | 24 | All financial + resource rules |
299
+ | `full-suite` | 100 | Everything — Free constitutional set + Pro premium set |
300
+
301
+ Presets read from `dist/rules/presets.json`. Premium presets require
302
+ `SUNAIVA_GATE_BACKEND_URL` to be set; without it the premium rules are skipped
303
+ with a `skipped_premium` audit entry.
304
+
305
+ ---
306
+
307
+ ## Ship Confidence Gate (paid tier)
308
+
309
+ The `ship_confidence_check` MCP tool is the deploy-time gate for high-blast-
310
+ radius commands (`npm publish`, `wrangler deploy`, `gh repo create --public`,
311
+ `netlify deploy --prod`). It checks for authorization in two tiers:
312
+
313
+ ### Paid path signed verdict
314
+ 1. The `sunaiva-ship-confidence` Python skill runs three verification layers
315
+ against your product (spec verification, property-based testing,
316
+ adversarial audit).
317
+ 2. It emits a signed verdict at
318
+ `data/ship_confidence_verdicts/<artifact>.signed.json`.
319
+ 3. The `ship_confidence_check` tool verifies:
320
+ - HMAC-SHA256 signature is valid (constant-time compare, byte-compatible
321
+ with the Python skill's canonical-JSON encoding).
322
+ - `level == "GREEN"` (YELLOW and RED hard-block).
323
+ - Signed within the last 60 minutes
324
+ (configurable via `VERDICT_MAX_AGE_MINUTES`).
325
+ 4. On all-pass: returns `{allowed: true, tier: "paid", ...}` and writes an
326
+ audit entry tagged `tier: "paid"` with the verdict ID and evidence.
327
+
328
+ ### Free fallback approval token
329
+ If no signed verdict is found (or `SHIP_CONFIDENCE_SIGNING_KEY` is not set),
330
+ the tool falls back to a one-time approval token at
331
+ `data/deploy_queue/APPROVAL_TOKENS/<artifact>.json` written within the last
332
+ hour. Tagged `tier: "free"` in the audit ledger with an upgrade hint pointing
333
+ at the paid skill.
334
+
335
+ ```bash
336
+ # CLI form for use in CI:
337
+ npx @sunaiva/gate --ship-confidence @sunaiva/gate@1.1.0
338
+ # Exit 0 = allow, 2 = block, 3 = internal error (fail-OPEN logged)
339
+ ```
340
+
341
+ ---
342
+
343
+ ## Constitutional rules cannot be disabled or bypassed
344
+
345
+ This is the package's hard guarantee. The 32 constitutional rules are
346
+ re-merged into `active_rules` on every config load — even if
347
+ `~/.sunaiva/gate-config.json` is hand-edited to remove them — and:
348
+
349
+ - `update_rules({disable: ['fin-001']})` returns
350
+ `{error: "CONSTITUTIONAL_RULE_IMMUTABLE", rule_ids: [...]}`. No state
351
+ change.
352
+ - `log_bypass({rule_id: 'fin-001'})` returns
353
+ `{error: "CONSTITUTIONAL_RULE_CANNOT_BE_BYPASSED", rule_id: ...}`. Nothing
354
+ written to the bypass log.
355
+
356
+ The kill-switch (`DISABLE_SUNAIVA_GATE=1`) is the only way to disable
357
+ constitutional enforcement, and it is loud — stderr disclosure on every
358
+ block, audit-ledger entry on every short-circuit. There are no quiet
359
+ bypasses.
360
+
361
+ ---
362
+
363
+ ## Known limitations — what 1.1.0 does NOT have
364
+
365
+ We shipped `1.0.1` with seven CRITICAL gaps flagged by our own signed
366
+ Ship-Confidence verdict on our own commit (`01KRDBCEYF2CAB21G6Y3E9VVH5`, RED).
367
+ 1.1.0 closes all seven. What is honestly **not** in 1.1.0 yet:
368
+
369
+ - **Sunaiva-Managed inference** no flat-fee tier that includes LLM calls.
370
+ BYOK only in v1. Revisit at 50+ Pro customers.
371
+ - **UI verification layer** (Playwright walkthroughs / computer-use)
372
+ designed in
373
+ `data/ship_confidence_skill_upgrade_2026_05_11.md`, not yet shipped.
374
+ Folded into Pro at no extra cost when it lands.
375
+ - **Multi-tenant dashboard / "Pro Team" tier** — Pro is single-seat in v1.
376
+ Team management is Enterprise. A self-serve "Pro Team" tier waits until
377
+ 10+ customers ask for it.
378
+ - **On-prem / VPC deployment** — Enterprise-only roadmap item. Helm chart
379
+ and Terraform module designs exist; not yet packaged.
380
+ - **Per-call / metered pricing** — abandoned. Subscription wins.
381
+ - **On-chain attestation (ERC-8004)** — aspirational. Deferred to v2.x.
382
+
383
+ Full deferred-feature list: see `STRATEGIC_PRIORITIES.md` Phase 3
384
+ (in-repo, not shipped in the tarball — internal-facing roadmap).
385
+
386
+ ---
387
+
388
+ ## Cross-platform
389
+
390
+ - **Linux** — native.
391
+ - **WSL** — native.
392
+ - **macOS** native.
393
+ - **Windows** — native Node, plus a Python shim for clients that invoke the
394
+ legacy `hooks/sunaiva_gate_hook.py` PreToolUse path.
395
+
396
+ ---
397
+
398
+ ## Privacy
399
+
400
+ Your data stays where you choose. The Free tier makes **zero** external network
401
+ calls constitutional rules are evaluated locally against patterns shipped
402
+ inside the package. The Pro path is opt-in: when you set
403
+ `SUNAIVA_GATE_BACKEND_URL`, the engine POSTs only the proposed action text
404
+ and rule IDs to the backend; we never see your code, your secrets, or your
405
+ filesystem. BYOK means your `ANTHROPIC_API_KEY` and `OPENROUTER_API_KEY` go
406
+ direct from your machine to those providers — they do not transit Sunaiva.
407
+
408
+ ---
409
+
410
+ ## License
411
+
412
+ [BUSL-1.1](./BUSINESS_LICENSE.md) free for evaluation, internal development,
413
+ hobby and academic use. Commercial license required if you embed the Gate in
414
+ the critical path of a third-party paying-customer product before the
415
+ **Change Date of 2030-05-10**, after which the wrapper converts to
416
+ **Apache-2.0** automatically. The premium backend stays proprietary regardless
417
+ of the Change Date.
418
+
419
+ - Licensor: Sunaiva Digital
420
+ - Change Date: **2030-05-10**
421
+ - Change License: **Apache License, Version 2.0**
422
+
423
+ ---
424
+
425
+ ## Support
426
+
427
+ | Need | Where |
428
+ |------|-------|
429
+ | Bug or crash | Email `support@sunaiva.ai` with `--smoke-test` output + `node --version` |
430
+ | Feature request | Email `support@sunaiva.ai` with subject `[feature-request]` |
431
+ | Security vulnerability | Email `support@sunaiva.ai` (do not file publicly) |
432
+ | Licensing | `support@sunaiva.ai` |
433
+ | Commercial / paid tier | `support@sunaiva.ai` |
434
+ | Product page | `https://sunaivacore.io/products/gate` |
435
+
436
+ When reporting bugs, include the output of `npx @sunaiva/gate --smoke-test`
437
+ and `node --version`.
438
+
439
+ ---
440
+
441
+ ## Contributing
442
+
443
+ Pull requests welcome. For substantial changes, please open an issue first to
444
+ discuss the proposal. Constitutional rule additions require a corresponding
445
+ test fixture in `tests/bundle.test.ts` and a passing dogfood Ship-Confidence
446
+ verdict on the change.
447
+
448
+ ---
449
+
450
+ *Built by a team whose own hooks killed their development for nine hours.
451
+ We fixed it. Then we shipped the fix. Then we signed the proof.*