claudia (0.2.2)
Installation
pip install --index-url claudiaAbout this package
Run Claude Code in a rootless Podman container with read-only inputs, a writable output directory and persistent named instances
Claudia
Claudia runs Claude Code in a rootless Podman container
where Claude has full freedom (--dangerously-skip-permissions, passwordless
sudo), but can only:
- read the input directories you give it,
- write to one output directory, which is how results come back out,
- keep its own state (login, settings, history, auto-updated Claude Code) in a per-instance home that survives between runs.
Instances are named. The first run of an instance asks you to log in to Claude. Later runs of the same instance don't.
Install
Requires Podman (rootless) and Python ≥ 3.11 on the host.
# as a uv tool
uv tool install git+https://kode.naiv.no/olemd/claudia
# or the Debian package from the Forgejo registry
sudo curl https://kode.naiv.no/api/packages/olemd/debian/repository.key \
-o /etc/apt/keyrings/forgejo-olemd.asc
sudo tee /etc/apt/sources.list.d/claudia.sources > /dev/null <<'SOURCES'
Types: deb
URIs: https://kode.naiv.no/api/packages/olemd/debian/
Suites: trixie
Components: main
Signed-By: /etc/apt/keyrings/forgejo-olemd.asc
Architectures: all
SOURCES
sudo apt update && sudo apt install claudia
The registry only has Architectures: all, because Claudia is a pure Python
package. With Architectures: all in the sources file, apt doesn't look for
amd64/i386 indexes there, so it doesn't print "Skipping acquire" notices.
The Debian package installs the man page (man claudia) and bash
completion. With the uv tool, enable completion yourself:
mkdir -p ~/.local/share/bash-completion/completions
claudia completion bash > ~/.local/share/bash-completion/completions/claudia
The .deb, wheel and sdist are also attached to every
release.
Usage
# First run: -o is required. Inputs (-r) are optional and repeatable.
claudia run report -r ~/docs/specs -r ~/src/project -o ~/work/report-out
# Later runs remember the mounts; any -r/-o given replaces the remembered value.
claudia run report
# Forget one input (by basename or host path), or all of them.
claudia run report --remove-ro specs
claudia run report --clear-ro
# Headless: run one task and exit (the instance must be logged in already).
claudia run report -p "Summarise the specs into summary.md"
# Restrict egress to Anthropic's hosts (plus any you allow). Remembered;
# --no-restricted switches back.
claudia run report --restricted --allow-domain pypi.org
# Nested Podman (build and run containers inside) is on by default;
# --no-nested turns it off for the instance, --nested back on.
claudia run report --no-nested
claudia list # all instances (--names: names only)
claudia show report # mounts, network mode, paths
claudia rm report # deletes login/state; never touches input or output
claudia run report --dry-run # print the podman command(s) instead
claudia build # build the images locally
claudia completion bash # print the bash completion script
Inside the container:
| Path | What | Mode |
|---|---|---|
/work/input/<basename> |
each -r DIR |
read-only |
/work/output |
-o DIR, the working directory |
read-write |
/home/claudia |
the instance's persistent home | read-write |
The user is claudia (uid 1000), mapped to your host user, so files Claude
writes to the output directory are owned by you. Files it creates with sudo
are owned by a subordinate uid instead. Remove those with podman unshare rm.
Nested containers
Claude can use podman build and podman run inside the container, as the
rootless user claudia. Nested images and containers are stored in the
instance home, so they survive between runs and are deleted by claudia rm.
Nested containers share the outer container's network, so --restricted
applies to them too. To pull from Docker Hub in restricted mode, allow
registry-1.docker.io, auth.docker.io and production.cloudfront.docker.com.
This needs two extra options on the outer container, and both are left out
with --no-nested:
--cap-add SYS_ADMINletsnewuidmapcreate the nested user namespace. The capability is scoped to the rootless user namespace and grants nothing on the host. It does widen the kernel attack surface.--security-opt unmask=/proc/*lets the nested runtime mount a fresh/proc, which the kernel refuses while paths in/procare masked.
No --privileged, seccomp=unconfined or extra devices are used.
Work log
Every session is started with an appended system prompt (baked into the
image at /usr/share/claudia/log-instructions.md) that requires Claude to keep
a high-level log of what it does and why in /work/output/CLAUDIA-LOG.md. The
log is append-only, written at architecture level, and ends each task with a
summary and open questions.
Where things live on the host
| Path | Content | Mounted? |
|---|---|---|
$XDG_CONFIG_HOME/claudia/instances/NAME.json |
start-up options (mounts, network, allowlist) | never |
$XDG_DATA_HOME/claudia/NAME/home/ |
Claude's login, settings, history, Claude Code itself | as /home/claudia |
claudia run refuses any -r/-o that is, contains or lies inside either
Claudia tree. That way Claude can never see or change how it will be started
next time, and can't read other instances' credentials.
Security model
- The container is rootless, so root inside (via
sudo) is your own host user at most. Read-only bind mounts stay read-only even for root. - The instance home is writable by Claude by design. That is what keeps login and auto-updates. Claude can therefore change its own settings or Claude Code binary for that instance, but never the mounts or network mode, which are chosen by the host CLI.
- The work-log instructions and the entrypoint live in the image. Each run
uses
--rm, so changes made inside the container don't last. --restrictedputs the container on an internal Podman network with no route out. A per-runclaudia-proxycontainer (tinyproxy, deny by default) forwards only toapi.anthropic.com,claude.ai,claude.com,platform.claude.com,downloads.claude.aiand any--allow-domainhosts.- Connectors from your Claude account come along. Once an instance is
logged in with a claude.ai account, Claude Code inside the container can use
every MCP connector you have connected to that account on the web (Gmail,
Google Drive, calendars and so on). It can do so with your credentials,
and these connectors reach outside the container. Mount restrictions don't
apply to them. In
--restrictedmode they are blocked, because the connector proxymcp-proxy.anthropic.comis not on the allowlist (add it with--allow-domainif you want them). To turn them off in full network mode as well, you have three options:- disconnect them in your claude.ai settings (this affects every client),
- log the instance in with an account that has no connectors, or
- set
ENABLE_CLAUDEAI_MCP_SERVERS=falsefor the instance. Add"env": {"ENABLE_CLAUDEAI_MCP_SERVERS": "false"}to$XDG_DATA_HOME/claudia/NAME/home/.claude/settings.json. That file is in the instance home, which Claude can write to, so Claude can undo this. Treat it as a convenience, not a security boundary.
- Nested Podman (on by default) adds
SYS_ADMINinside the user namespace and unmasks/proc. See Nested containers. Use--no-nestedfor the tightest sandbox.
Images
claudia run uses kode.naiv.no/olemd/claudia:<version> (and
claudia-proxy:<version> for --restricted). If the image isn't present
locally, it is pulled. If the pull fails, it is built from the files shipped
inside the package. Claude Code updates itself inside each instance home, so
the image only needs rebuilding for changes to the base system.
Development
uv sync
uv run ruff format --check . && uv run ruff check .
uv run pytest
shellcheck src/claudia/assets/entrypoint.sh src/claudia/assets/proxy/entrypoint.sh packaging/*.sh packaging/claudia.launcher
shellcheck -s bash src/claudia/assets/completion/claudia.bash
groff -man -ww -z packaging/claudia.1
uv build # dist/*.whl, dist/*.tar.gz
packaging/build-deb.sh # dist/claudia_<version>_all.deb
CI (.forgejo/workflows/ci.yml) runs the checks on every push and pull
request. Publishing a release (tag v<version> matching pyproject.toml)
also runs the release job, which builds and publishes the wheel, sdist,
.deb and both container images. It needs the repository secret
PACKAGES_TOKEN, an access token of the repository owner (olemd) with
write:package and write:repository (repository access "Public only").
The first is for the registries, the second for attaching files to the
release.
Forgejo cannot limit write:package to a single repository. To keep
repository write access off the package token, give it only write:package
and add a second secret RELEASE_TOKEN with write:repository limited to
olemd/claudia. The release job uses RELEASE_TOKEN for attachments when it
is set.
License
MIT, see LICENSE.