Skip to main content

samai-openbox

CLI archive skill for AI agents — one stable command to compress and extract every common archive format.

PyPI version Python 3.8+ License: MIT

samai-openbox is a tiny, dependency-light Python package that exposes the OpenBox archiver engine as a single CLI command — samai-openbox — so any LLM agent with shell access can compress and extract archives without remembering six different flag syntaxes.

Why does this exist?

LLM agents are great at writing shell commands, but they consistently get archive syntax wrong. One stable CLI fixes that:

  • tar -czvf vs tar -xzvf vs 7z a vs 7z x vs zip -r vs unzip — agents hallucinate.
  • Path-traversal protection varies by tool. OpenBox blocks ../../etc/passwd-style entries at extraction time.
  • JSON output mode lets agents parse archive contents in their reasoning loop.

Install

# Standard
pip install samai-openbox

# Or with pipx (recommended for isolated CLI tools)
pipx install samai-openbox

# Verify
samai-openbox --version
samai-openbox --help

Works on Python 3.8+. Pure-Python implementation using stdlib zipfile and tarfile; shells out to the system 7z / 7zz / 7za for 7z, and unrar for rar (only if those formats are actually used).

The CLI in 60 seconds

Five verbs cover everything an agent needs to do with archives.

Compress files into an archive

# Auto-detects format from output extension: .zip .tar .tar.gz .7z
samai-openbox compress report.pdf photos/ -o backup.zip

# Force compression level (0-9, default 6)
samai-openbox compress src/ -o release.tar.gz --level 9

# 7z compression (requires 7z/7zz/7za on PATH)
samai-openbox compress bigfile.bin -o archive.7z

Extract an archive

# Auto-creates destination if missing
samai-openbox extract backup.zip -d ./restored

# Works for every supported format
samai-openbox extract legacy.rar -d ./legacy
samai-openbox extract cd-image.iso -d ./cd-contents

List archive contents

# Human-readable
samai-openbox list backup.zip

# Machine-readable JSON — perfect for agent reasoning
samai-openbox list backup.zip --json

Example JSON output:

{
  "archive": "backup.zip",
  "format": "zip",
  "entries": [
    {"name": "report.pdf",   "size": 2516582, "modified": "2024-08-15T10:23:00Z"},
    {"name": "photos/",      "size": 0,       "modified": "2024-08-15T10:24:00Z", "is_dir": true},
    {"name": "photos/01.jpg", "size": 4409111, "modified": "2024-08-14T18:11:00Z"}
  ]
}

Test archive integrity

# Verifies CRCs without extracting — exits non-zero on corruption
samai-openbox test backup.zip

Show version & supported formats

samai-openbox --version
samai-openbox formats

Format support matrix

Format Compress Extract Notes
zip ✓ ✓ stdlib zipfile, deflate or store
tar ✓ ✓ stdlib tarfile
tar.gz ✓ ✓ tarfile + gzip, 5 levels
7z ✓* ✓* requires 7z / 7zz / 7za on PATH
rar — ✓* requires unrar on PATH
iso — ✓* requires 7z (handles ISO 9660)

* = via external CLI. Install with:

Path-traversal safety

extract blocks any archive entry whose absolute path would escape the target directory. So an archive containing ../../etc/passwd extracts the file into <target>/etc/passwd instead of /etc/passwd. Safe to point at untrusted downloads.

ClawHub skill spec

Drop this into your agent's skill catalog so it knows when and how to call OpenBox:

# skill.yaml
name: openbox-archive
version: 0.1.0
description: Compress and extract archives (zip, tar, tar.gz, 7z, rar, iso)
command: samai-openbox
install: pip install samai-openbox
verbs:
  - name: compress
    usage: samai-openbox compress <files...> -o <archive> [--level 0-9]
    formats_out: [zip, tar, tar.gz, 7z]
  - name: extract
    usage: samai-openbox extract <archive> -d <dir>
    formats_in: [zip, tar, tar.gz, 7z, rar, iso]
  - name: list
    usage: samai-openbox list <archive> [--json]
  - name: test
    usage: samai-openbox test <archive>
safety:
  - Extraction blocks path-traversal entries (../../etc/passwd)
  - No network calls · no telemetry · no auto-update
  - Exits non-zero on any error — safe to chain with &&

Use as a Python module

from samai_openbox import compress, extract, list_archive, test_archive

# Compress
compress(["report.pdf", "photos/"], "backup.zip", level=6)

# Extract (path-traversal safe)
extract("backup.zip", "./restored")

# List (returns a list of dicts)
entries = list_archive("backup.zip")
for e in entries:
    print(e["name"], e["size"], e.get("modified"))

# Verify integrity
ok = test_archive("backup.zip")

Agent conversation example

User: Pack the reports/ folder into a .zip for email, but skip anything larger than 10 MB. Then list what's in the archive so I can sanity-check.

Agent (using samai-openbox):

# 1. Find files under 10 MB in reports/
find reports/ -type f -size -10M -print0 | \
  xargs -0 samai-openbox compress -o reports-email.zip

# 2. List the result as JSON for verification
samai-openbox list reports-email.zip --json

Done. reports-email.zip contains 23 files totalling 47.2 MB (after compression from 89.4 MB). Three files over 10 MB were excluded: reports/q3-raw-data.csv, reports/audit-full.pdf, and reports/appendix-exhibits.pptx. Want me to send them separately as a .tar.gz?

License

MIT — same as the OpenBox desktop app. See LICENSE.

See also

OpenBox is a SamAI Group public-welfare open-source project. Free, forever.

Metadata

Release files for samai-openbox 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for samai-openbox 0.2.0
File Size Uploaded Provenance
samai_openbox-0.2.0.tar.gz 18.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for samai-openbox 0.2.0
File Interpreter ABI Platform
samai_openbox-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.3 kB

Release files / samai_openbox-0.2.0.tar.gz

Download URL samai_openbox-0.2.0.tar.gz
Size 18.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3e0656756a892ecec8075e51b754f7a38866d3e789684d915f7dc0a56d41d813
BLAKE2b-256 checksum
How to use checksums
5b2d391cecc7ce76188d899a96964e705b97409de4eb3f3d0173922fe6a0e56e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / samai_openbox-0.2.0-py3-none-any.whl

Download URL samai_openbox-0.2.0-py3-none-any.whl
Size 17.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
adc56d547a39e28ad8c9ce4b0152811857f9fa2d165068453053d48ea40ff3b9
BLAKE2b-256 checksum
How to use checksums
f7ec148e7893172574824f7a1128c1cb8d73e22d0b6a4acb336a946148d6213d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Security for samai-openbox 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page