Skip to content

Sandbox and Skills

For: people deciding what a session may touch, and people packaging instructions and tools as skills. After this page you know the sandbox policy fields, what a skill file may contain and how each narrows or extends a session.

The sandbox is a policy object (SandboxPolicy) that confines bash and edit to the workspace, hides secrets, scrubs the environment and can cut the network or set resource limits. Children (sub-agents, pipeline stages) can only narrow it. A skill is a Markdown file with front matter that bundles instructions, a default model, the tools it enables and its verify gates. For the practical side see Security and sandbox and Skills.

tether.sandbox

Deterministic security sandbox for Tether (workspace jail, env scrubbing, Linux bwrap).

SandboxViolationError

Bases: PermissionError

Raised when a tool call violates the deterministic SandboxPolicy.

ApprovalNeeded

Bases: SandboxViolationError

The command needs to run outside the jail; only the session's caller can approve it.

SandboxUnavailableError

Bases: RuntimeError

A write session needs bwrap and the caller did not opt out.

SandboxPolicy dataclass

Deterministic security envelope enforced by the harness (never by the LLM).

protect_store(db_path)

Hide the session store and its WAL/SHM/journal files from bash and edit (AD-55).

A TETHER_DB in the workspace let qwen3.5:9b read the session's own turns and inbox with python3 -c "import sqlite3 ..." (gap hunt, ask task); only .tether/ was protected.

with_allow_file()

A copy whose allow_outside also holds the project's .tether/allow.json entries.

attenuate(child_profile=None, child_network=None, child_web_allow=None, child_allow_unsandboxed=None, child_allow_outside=None, child_limits=None)

Create a child SandboxPolicy that can only narrow (never escalate) privileges.

isolation_error()

The refusal message when this policy needs a jail and has no opt-out, else None.

require_isolation()

Refuse before any model call; with the opt-out, print the notice once per process.

mode()

What tether status shows for the session.

resolve_safe_path(raw_path, *, write=False)

Resolve a path and enforce workspace confinement + sensitive-file protection.

scrub_env(base_env=None)

Return a sanitized environment: allowlist only, so unknown secrets never leak.

validate_bash_command(cmd, *, text_rules=False)

Deterministically validate a shell command against sandbox rules.

execute_bash_with_code(cmd, stdin=None) async

Execute a shell command in the deterministic sandbox and return (returncode, output).

execute_bash(cmd, stdin=None) async

Execute a shell command inside the deterministic sandbox.

approval_prefix(head)

The prefix an approval grants: the first two words for git, the first word otherwise.

parse_limits(raw)

Normalise resource limits from CLI K=V strings or a mapping; empty means no limits.

parse_web_allow(raw)

Normalise a web_allow domain list; None means unset, () means deny every host.

parse_allow_outside(raw)

Normalise allow_outside prefixes: single-spaced tokens, no duplicates, order kept.

load_allow_file(root)

Entries of <root>/.tether/allow.json; a missing file allows nothing.

add_to_allow_file(root, prefix)

Append prefix to <root>/.tether/allow.json, keeping existing entries and their order.

A malformed file stays a loud ValueError and is left untouched. The write goes through a temp file and os.replace, so a concurrent reader never sees half a file.

bwrap_probe()

Probe (uncached) whether bwrap is installed and permitted by host kernel namespaces.

tether.skills

Progressive Skill discovery, YAML frontmatter parser, and companion tools.py loader.

SkillLoader

Discovers and loads skills from ./skills/ and ~/.tether/skills/.

parse_skill_markdown(raw_text, default_name, source_path=None)

Parse a Markdown file with optional YAML frontmatter into a Skill object.

make_skill_tool(loader, mux)

Create the progressive skill tool (skill list | load <name>).

tether.retro

Offline post-mortem (tether retro): distill session friction into tiny Skill rules.

parse_rules(text, existing='')

Keep <=MAX_RULES bullets within the token cap, dropping ones already in existing.