cd /news/ai-agents/enclawed-code-how-deterministic-secu… · home › topics › ai-agents › article
[ARTICLE · art-176942] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Enclawed Code: How Deterministic Security Layers Harden Claude Code Agent Execution

An open-source project called Enclawed Code wraps the Claude Code CLI in a deterministic security layer that classifies every tool call as reversible or not before execution, running reversible actions in a sandbox and requiring approval for network calls, config changes, package installs and destructive file operations. A companion paper (DOI: 10.5281/zenodo.24524917) reports zero harmful actions passed and zero harmless actions blocked across 15,021 real tool calls, 7.7x fewer approval prompts than Claude Code's default permission mode, and 11 attacks from compromised hosts all blocked when paired with Enclaweder's hardware-backed attestation.

recommendation

Enforce agent safety with a deterministic reversibility check outside the LLM: sandbox reversible actions and require approval codes for network, config, install and destructive operations.

more in playbook: Securing agents and AI tools
by read4 min views16 publishedNov 26, 2026

Enclawed Code wraps Claude Code in a deterministic security layer that checks every action before execution. The core insight: stop asking the LLM to judge safety. Instead, enforce boundaries at the infrastructure layer using a fixed rule that asks one question: can this action be undone?

The project ships as open source with a companion research paper showing zero harmful actions passed and zero harmless actions blocked across 15,021 real tool calls. It also claims 7.7x fewer approval prompts than Claude Code's default permission mode.

Claude Code and similar agents execute shell commands, edit files, and call tools on your local machine. They read context along the way: README files, web pages, tool output. Anyone can plant instructions in those contexts.

Traditional safeguards rely on the LLM to recognize malicious intent. This creates three failure modes:

Enclawed Code moves the security boundary outside the model. It intercepts every action before execution and applies a deterministic rule. The LLM never sees the security decision.

Enclawed Code runs as a wrapper around the standard Claude Code CLI. You type ecwcode instead of claude. The security layer sits between the agent's action planner and the host system.

The sealed space is a sandboxed environment where read operations, read-only commands, file edits (with automatic versioning), and tests execute without approval.

Action Type Reversible? Execution Path
File read Yes Runs in sealed space
Read-only shell command Yes Runs in sealed space
File edit Yes Runs after old version saved
Test execution Yes Runs in isolated environment
Network call No Requires approval
System configuration change No Requires approval
Package installation No Requires approval
Destructive file operation No Requires approval

The reversibility rule is not configurable by the LLM. It is a fixed policy enforced at the infrastructure layer.

Enclawed Code uses three mechanisms to enforce boundaries:

Every tool call is parsed and classified before execution. The system extracts the operation type, target resources, and scope. This happens outside the LLM's control.

def intercept_action(action):
    parsed = parse_tool_call(action)

    if is_reversible(parsed):
        old_state = snapshot_affected_resources(parsed)
        result = execute_in_sealed_space(action)
        log_action(action, old_state, result)
        return result
    else:
        approval_code = generate_approval_code()
        user_input = prompt_user(action, approval_code)
        if user_input == approval_code:
            result = execute_with_full_privileges(action)
            log_action(action, None, result)
            return result
        else:
            raise SecurityViolation("Action blocked by user")

Reversible actions run in isolated environments. File system changes are copy-on-write. Network access is restricted. The sealed space is torn down after execution, but state changes (like edited files) are committed back to the host with full audit trails.

When paired with Enclaweder, the security key unlock uses hardware-backed attestation. This prevents a compromised host from bypassing the approval flow. The research paper reports 11 attacks from compromised computers, all blocked with Enclaweder present.

The companion paper (DOI: 10.5281/zenodo.24524917) tested three Claude models across four permission modes with 4,350 live runs. Key findings:

The benchmark does not test performance overhead. The paper focuses on security effectiveness, not latency.

Enclawed Code is a local wrapper. It does not require cloud infrastructure or API changes. You install it on the same machine where you run Claude Code.

This makes it suitable for:

It is not suitable for:

Enclawed Code preserves session state across security violations. If an action is blocked, the agent's conversation history, file snapshots, and sealed space state remain intact. The user can resume the session after reviewing the blocked action.

This is critical for long-running sessions where a single blocked action should not discard hours of work.

The current implementation logs every action, approval decision, and state snapshot. However, it does not expose metrics for:

These gaps make it hard to predict performance impact in production.

The fixed rule might incorrectly classify an action as reversible. For example, a file edit that triggers a build process with side effects (like up artifacts) would run without approval.

Mitigation: The sealed space restricts network access, so most side effects are contained. But this is not foolproof.

If the agent generates many irreversible actions, users still face approval prompts. The 7.7x reduction helps, but it does not eliminate the problem.

Mitigation: Tune the agent's system prompt to prefer reversible operations. This is a prompt engineering task, not a security fix.

Without Enclaweder, a compromised host can bypass the security layer. The approval prompt is just a UI element. An attacker with root access can modify the binary to skip checks.

Mitigation: Deploy Enclaweder for hardware-backed attestation. This adds cost and complexity.

Use Enclawed Code when:

Avoid it when:

The core idea is sound: move security decisions outside the LLM. The implementation is production-ready for local workflows but needs cloud deployment support and better observability before it scales to multi-tenant or high-throughput scenarios.

── more in #ai-agents 4 stories · sorted by recency
── more on @enclawed code 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/enclawed-code-how-de…] indexed:0 read:4min 2026-11-26 · —