Skip to main content
OpenEral sandbox

Run Claude Code.
Keep it contained.

Isolated home directory, PostgreSQL-backed workspace state, and StringCost metering for agent runs. No Docker. No SDK rewrite.

Start here

Local sandbox, then optional metering + persistence

copy / paste
terminal
export ANTHROPIC_API_KEY='sk-ant-...'
npx openeral

# Optional: meter usage
export STRINGCOST_API_KEY='sk-stringcost-...'

# Optional: persist files
export DATABASE_URL='postgresql://user:pass@host:5432/db'
export OPENERAL_WORKSPACE_ID='project-alpha'

npx openeral

1 command

start local

0 SDK changes

drop-in CLI

Postgres

persistent home

StringCost

metered egress

Quick start

Progressively add power.

Start with just an API key. Add metering, persistence, and workspace isolation only when you need them.

Open repo

01

Start local

Claude gets its own isolated $HOME. No Postgres or Docker required.

terminal
export ANTHROPIC_API_KEY='sk-ant-...'
npx openeral

02

Meter calls

Set one StringCost key and every Anthropic call is tracked by session and workspace.

terminal
export STRINGCOST_API_KEY='sk-stringcost-...'
npx openeral

03

Persist files

Add Postgres when you want files to survive after the session ends.

terminal
export DATABASE_URL='postgresql://user:pass@host:5432/db'
npx openeral

04

Name workspace

Use the same workspace ID to restore the same files next session.

terminal
export OPENERAL_WORKSPACE_ID='project-alpha'
npx openeral

local-first

starts without Postgres

1 env var

StringCost metering

workspace

persistent home

pg

database from bash

Infrastructure

Fast, stateful, metered.

Isolated home

$HOME points at an OpenEral workspace, not your real laptop home.

$HOME=/tmp/openeral-<workspace-id>

Stateful by Postgres

Workspace files restore on startup and sync back while the agent works.

Database from bash

Claude can run pg queries directly from its sandboxed shell.

Metered egress

Anthropic calls route through StringCost when the API key exists.

Spend in the prompt

Claude can inspect session spend, set task limits, and warn mid-run.

Workspace isolation

Different workspace IDs produce different state and attribution boundaries.

Memory refresh

Regenerate project memory around fresh workspace context.

Runtime map

Claude Code stays normal. The boundary changes.

Claude Code

agent runtime

/home/agent

isolated workspace

PostgreSQL

optional persistence

StringCost

optional metering

Environment

Set only what you need.

Start with Anthropic. Add StringCost and Postgres when ready.

VariableNeed
ANTHROPIC_API_KEY

Claude Code provider key

required
STRINGCOST_API_KEY

Turns on proxy metering

optional
DATABASE_URL

Turns on persistence + pg access

optional
OPENERAL_WORKSPACE_ID

Names the persistent workspace

optional
.env
ANTHROPIC_API_KEY='sk-ant-...'
STRINGCOST_API_KEY='sk-stringcost-...'
DATABASE_URL='postgresql://user:pass@host:5432/db'
OPENERAL_WORKSPACE_ID='project-alpha'
Persistence

Files survive across sessions.

Same workspace ID means the same files come back. Claude can query Postgres from bash via pg.

Sync strategy: restore on session start, sync on write, final sync on exit.

session 1
echo "notes" > $HOME/notes.txt
session 2
cat $HOME/notes.txt
# Output: notes
database queries
pg "SELECT count(*) FROM users"
pg "\d public.orders"
Prompt controls

Let Claude see what it costs.

Package a native OpenEral skill so the agent can inspect spend, set limits, and warn inside the conversation.

get_session_cost

current run spend

get_workspace_cost

project-level spend

set_budget_limit

warn or stop at threshold

get_recommendations

find expensive calls

inside Claude Code
"How much did this workspace spend today?"
"Warn me at $5 for this task. Stop at $8."
"Which calls in this session were expensive?"

presigned

API calls route through proxy

per-session

cost tracked per invocation

per-workspace

aggregate project spend

1 command

vs. 50+ lines of Docker config

How OpenEral compares

Isolated home directory

OpenEral
Claude
Docker
manual Scripts

PostgreSQL persistence

OpenEral
Claude
Docker
manual Scripts

Database from bash

OpenEral
Claude
Docker
manual Scripts

Automatic cost tracking

OpenEral
Claude
Docker
manual Scripts

Session isolation

OpenEral
Claude
Docker
manual Scripts

Zero-config start

OpenEral
Claude
Docker
Scripts
Security

Safe by default.

The sandbox makes the safe path the default: isolated home, explicit secrets, auditable state.

SSH keys

Not mounted into agent home

Cloud credentials

Kept outside sandbox path

.env files

Passed through proxy, not filesystem

Git remotes

Explicit workspace policy required

Custom agents

Works with any agent that has bash.

Use the shell directly for custom agents. The TypeScript API wraps everything into a single createOpeneralShell call.

custom-agent.ts
import { createOpeneralShell, createToolHandler } from 'openeral-js'

const shell = await createOpeneralShell({
connectionString: process.env.DATABASE_URL,
workspaceId: 'project-alpha',
})

const handleBash = createToolHandler(shell)

await shell.exec('echo "hello" > /home/agent/notes.txt')
await shell.exec('cat /home/agent/notes.txt')

FAQ

Do I need PostgreSQL to start?

No. Without DATABASE_URL, OpenEral runs with a local temp home directory. Add PostgreSQL when you need persistence.

Can I use this with agents other than Claude Code?

Yes. The TypeScript API works with any agent that has bash access.

How does cost tracking work?

When STRINGCOST_API_KEY is set, OpenEral presigns your Anthropic key with StringCost and routes API calls through the proxy.

What happens if PostgreSQL is down?

The agent continues working with local files. Sync resumes when the database reconnects.

Ready

Start with the sandbox. Add metering when it matters.

$ npx openeral