v3/docs/adr/ADR-371-dream-cycle-security-neural-cryptographic-authorization.md
Status: Proposed
Authors: claude (dream-cycle agent, 2026-07-21)
References: arXiv (Jul 16, 2026) "From Neural Intent to Cryptographic Authorization: Governing Agentic Workflows"; ADR-178 (RepE IPI Detection); ADR-165 (Security CVE Posture); ADR-096 (Encryption at Rest); ADR-101 (Federated Claims)
The July 2026 arXiv paper "From Neural Intent to Cryptographic Authorization: Governing Agentic Workflows" (Grade A) demonstrates that:
Identity verification is insufficient: Authenticated agents can still be hijacked via direct or indirect prompt injection after identity is confirmed. The attack succeeds at the intent-interpretation layer, not the authentication layer.
The proposed fix is a mandatory cryptographic gate: Before any agentic action executes, a Neural Cryptographic Service (NCS) computes an intent signature from the agent's hidden states and requires cryptographic proof that the action is authorized under the original task scope. If the intent signature deviates from the authorized pattern, execution is blocked regardless of agent identity.
Ruflo's current security stack (@claude-flow/security) provides:
InputValidator — boundary-level input validation (Zod)PathValidator — path traversal preventionSafeExecutor — command injection protectionNone of these implement a cryptographic authorization gate at the action-execution level. ADR-096 covers encryption at rest. ADR-101 covers federated claims (identity). Neither prevents a legitimate, authenticated agent from executing an injected harmful action.
This is architecturally distinct from ADR-178: RepE detects anomalous intent; NCA prevents execution even when detection is uncertain. They are complementary.
Add a CryptoAuthGate middleware to @claude-flow/security that intercepts action execution in the @claude-flow/hooks pre-task → execute path.
Agent intent
│
▼
┌─────────────────────────────────────┐
│ NCA Layer (CryptoAuthGate) │
│ 1. Extract intent signature │
│ (task scope + action type + │
│ tool targets) │
│ 2. Verify against AuthorizationRoot │
│ (HMAC-SHA256 of original task) │
│ 3. Check deviation threshold │
│ (configurable, default: strict) │
│ 4. Block or pass execution │
└─────────────────────────────────────┘
│ │
PASS BLOCK
│ │
▼ ▼
execute() reject + log + alert
When a task is initiated via hooks pre-task:
AuthorizationRoot = HMAC-SHA256(task_description + allowed_tools + scope_constraints, session_key)AuthorizationRoot in the task context (not in shared memory — local to the execution context)AuthorizationRoot to all sub-agents spawned by this taskWhen a sub-agent attempts to call a tool:
ActionSig = HMAC-SHA256(tool_name + tool_args + agent_id, session_key)ActionSig is within the authorized scope defined by AuthorizationRootaudit background worker"allowed": ["read", "search"] can be used freely; "disallowed": ["write", "delete"] are hard-blocked| Package | Change |
|---|---|
@claude-flow/security | Add CryptoAuthGate class; AuthorizationRoot builder; scope deviation check |
@claude-flow/hooks | Wire CryptoAuthGate.check() into pre-task hook before any tool dispatch |
@claude-flow/cli | Add `--nca-mode [strict |
@claude-flow/shared | Add TaskAuthContext type for AuthorizationRoot + ActionSig |