# Encryptium: Cryptographically Enforced Intelligence

## Research thesis
Beyond Constitutional AI: Cryptographically Enforced Trust Boundaries in Autonomous Reasoning Systems.

Constitutional AI studies learned behavior using principles and AI feedback. Encryptium studies a separate enforcement layer. Neither encrypted arithmetic nor a signature establishes semantic correctness, harmlessness, model alignment, or superiority over Anthropic. The word “alignment” here names a research direction, not a proven cryptographic property.

## Supported workflows

1. Execution: Ed25519-signed, 60-second capabilities for SHA-256 and Unicode character count. Server verifies using its issuer key, not a caller-supplied key. Tokens cannot authorize network, shell, filesystem or another agent's memory. Fixed source runs in a bounded Node worker; no user code is evaluated. Workers share the host security boundary and are not OS sandboxes. Tokens are reusable within their lifetime because supported operations are pure. This is not a general autonomous agent runtime.
2. Homomorphic inference: Microsoft SEAL through node-seal 5.1.7. BFV polynomial modulus degree 4096, tc128 parameters, 20-bit batching modulus. A fresh browser key encrypts x; the server receives ciphertext only and computes y=3x+2. The secret key stays client-side. This is a fixed affine neuron, leveled HE without bootstrapping, not encrypted transformer inference or unrestricted FHE. Encryption timing includes module/context/key initialization; server evaluation and client decryption are separately measured. Inputs are limited to 0–255 to avoid modular overflow.
3. Proofs: snarkjs Groth16/BN254 verifies a Circom circuit for y=x²+3x+2 with x constrained to eight bits. Public signal is y, witness is x. Proving is server-side: the server sees x. The small domain/public output allow inference of x; this is NOT a privacy mechanism for secret inputs. The proof establishes only this relation. Single-party randomized setup is experimental and requires a multiparty ceremony and audit before production trust. Changing the setup requires distributing the new verification key. Fixed verification key is shipped independently; supplied receipt keys are not accepted as circuit authority.
4. Memory: non-exportable AES-256-GCM keys in page memory, fresh 96-bit IV, agent ID as authenticated additional data, ciphertext in localStorage. Each agent has its own key. Reload drops keys; revoke deletes key reference and stored ciphertext. JavaScript GC does not guarantee physical erasure. Same-origin scripts and a compromised device remain trusted. This does not offer durable recovery or server multi-tenant isolation.
5. Benchmarks: six original cases, two clean controls and four malicious proposals. Replay tests policy decisions, not model resistance. The unrestricted baseline accepts every proposal but simulates side effects. Optional OpenRouter runs obtain one proposal per case and replay it against both dispatchers. Six short model calls consume the user's provider credits. Invalid JSON is recorded separately, not counted as a successful defense. No benchmark claims are populated before running. No statistical generalization from six cases is justified.
6. Research explorer: upstream status, references, assumptions and downloadable raw experimental receipts.

## Threat model
An attacker controls retrieved text and proposes tool calls, but cannot edit server code, issuer keys, browser origin, verification artifacts or policy. Every action must pass the typed executor boundary. Pure hash/length operations may process hostile text because they have no external side effects. Model outputs do not directly set permissions. Signatures authenticate bytes; proofs verify a relation; encryption hides supported inputs from the evaluator. These are different guarantees.

The public research API uses bounded inputs and same-origin browser requests. It is not an authenticated enterprise service and origin checks are not abuse prevention. Vercel platform quotas/firewall still apply. Do not attach valuable external credentials or tools to this experimental executor without authentication, shared rate limiting, revocation storage, hardened process/container isolation and review.

## Reproduction
- pnpm install --frozen-lockfile
- pnpm typecheck && pnpm lint && pnpm test && pnpm build
- Start the app; open /research; run and export each experiment.
- Circuit source: /research/inference.circom
- Verification key: /research/verification-key.json
- Public proving artifacts: /research/inference.wasm and /research/inference.zkey
- Rebuild experimental setup with node scripts/setup-proof.mjs in the source repository. Randomized keys differ on each rebuild. Never represent this as a multiparty ceremony.

## Upstream evaluation (2026-11-30)
- Requested google-research/camel returned 404. Actual CaMeL: https://github.com/google-research/camel-prompt-injection at f083b6b396399d3b3c7f2ddaf613a5945eaf32d8, Apache-2.0. Acknowledged adaptation of default-deny policy in policy.ts; Python interpreter is not deployed.
- Microsoft SEAL: https://github.com/microsoft/SEAL at 61cc4c779e4fac2ef13f8d3daab716298d345e2e, MIT. Integrated through the separately licensed node-seal binding; installed binding pins its own bundled SEAL implementation.
- Concrete ML: https://github.com/zama-ai/concrete-ml at e56714c72dbe81e38cef9811398c88267c31c5d9, BSD-3-Clause-Clear with no patent grant. Python 3.8–3.12 and native dependencies require a separate worker. Evaluated, not installed in the Next.js runtime; no claim of Zama-powered production inference.
- EZKL: https://github.com/zkonduit/ezkl at e196b111c1bafaa61b92ae431cd3c3fe9371da05. README and Cargo.toml inspected; no license file located in this revision. No source copied or deployed. ONNX/Halo2 native prover would need a separately licensed, pinned worker and circuit artifacts. Public proofs here use snarkjs, not EZKL.
- Agent Injection Bench: https://github.com/OctaviusLeo/Agent-Injection-Bench at 8627924470323a8695f281de532a00634b836eb4, MIT. Methodology reference, not the origin of Encryptium's cases or measurements. Its published performance numbers are not imported.
- snarkjs 0.7.5: https://github.com/iden3/snarkjs, GPL-3.0. Runs on server only. Circom compiler: circom2 npm binding 0.2.22; generated artifacts and circuit source published for reproduction.

## Research references
- https://www.anthropic.com/research/constitutional-ai-harmlessness-from-ai-feedback
- https://www.anthropic.com/research/constitutional-classifiers
- https://www.anthropic.com/research/prompt-injection-defenses
- https://github.com/google-research/camel-prompt-injection

## Original contributions
Encryptium composes signed capabilities, typed fixed-tool workers, paired policy replay, browser-held HE keys, authenticated per-agent state and a purpose-built inference circuit into visible, exportable experiments. This composition is independent research, not a new cryptographic primitive. No partnership or endorsement is implied by references or logos.

## Deployment limits
Solana devnet Memo registration is available after proof verification and explicit wallet approval. It timestamps a receipt hash, not an on-chain proof verification. Funded-wallet end-to-end testing is not included. No mainnet proof registry, hardened arbitrary-code sandbox, TEE attestation, encrypted frontier LLM, Concrete ML worker or EZKL worker is claimed. Wallet connections remain available. Frontier metrics require a funded provider key and a completed run.
