npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

swapclaw

v0.1.1

Published

Container-isolated agent runtime over the Agent Client Protocol (ACP)

Readme

swapclaw

License: MIT CI Node

Container-isolated agent runtime over the Agent Client Protocol (ACP).

Overview

A "claw" is an agent runtime that manages container sandboxes where work happens. A typical claw bundles an embedded agent SDK — swapclaw replaces the SDK with an ACP client. The client connects to any external ACP agent, and that agent becomes the brain that drives the containers.

The agent doesn't know or care that it's driving a claw. It just sees a standard ACP interface that happens to route terminal and filesystem requests into isolated containers.

Architecture

External ACP Agent (the brain — any ACP-compatible agent)
  ↕ ACP
swapclaw (the body — session + container management)
  ↕ manages
Docker or Apple Containers (execution sandboxes)
  ├── /project (working directory, read-only mount)
  └── /session (scratch space, read-write)
  1. swapclaw connects to an ACP agent over stdio
  2. Sends prompts to the agent via ACP
  3. The agent requests terminal access, file reads/writes — swapclaw routes these into containers
  4. Session updates stream back to the external ACP client in real time

Features

  • Agent-agnostic — works with any ACP-compatible agent
  • Container isolation — each session gets its own Docker or Apple Container
  • Session persistence — SQLite-backed sessions survive restarts
  • Crash recovery — clears stale containers on startup
  • Idle timeout — containers tear down automatically when unused
  • Concurrency control — configurable maximum concurrent sessions
  • Session modes — code / ask / architect modes via ACP extensions
  • Task scheduling — once / interval / cron execution via ACP extensions
  • MCP passthrough — stdio-transport MCP servers forwarded into containers
  • Streaming — real-time session update forwarding to external clients

Security Model

swapclaw relies on container isolation as its primary security boundary. Each session runs in a dedicated Docker or Apple Container with the project directory mounted read-only. All terminal commands and file operations execute inside the sandbox — the host is never exposed. See AGENTS.md for details.

Prerequisites

  • Bun (or Node.js >= 22)
  • Docker or Apple Containers (macOS)
  • An ACP-compatible agent

Installation

npm install swapclaw

Or from source:

git clone https://github.com/arielarevalo/swapclaw.git
cd swapclaw
bun install
bun run build

Usage

swapclaw runs as an ACP agent on stdio. Point it at an external agent:

SWAPCLAW_AGENT_COMMAND=claude swapclaw

With arguments:

SWAPCLAW_AGENT_COMMAND=claude SWAPCLAW_AGENT_ARGS="--model opus" swapclaw

Configuration

All configuration is via environment variables:

| Variable | Default | Description | |----------|---------|-------------| | SWAPCLAW_AGENT_COMMAND | (required) | Command to spawn the ACP agent | | SWAPCLAW_AGENT_ARGS | | Space-separated arguments for the agent | | SWAPCLAW_DATA_DIR | ~/.swapclaw | Session data and database directory | | SWAPCLAW_CONTAINER_IMAGE | alpine:latest | Docker image for containers | | SWAPCLAW_CONTAINER_TIMEOUT | 300000 | Prompt timeout (ms) | | SWAPCLAW_IDLE_TIMEOUT | 60000 | Container idle timeout (ms) | | SWAPCLAW_MAX_CONCURRENT | 3 | Maximum concurrent sessions | | SWAPCLAW_TIMEZONE | (system) | Timezone for sessions |

ACP Extensions

Custom functionality exposed via ACP extMethod:

| Method | Description | |--------|-------------| | swapclaw/getSessionMode | Get current session mode | | swapclaw/setSessionMode | Set mode (code / ask / architect) | | swapclaw/createTask | Schedule a task (once / interval / cron) | | swapclaw/listTasks | List scheduled tasks | | swapclaw/cancelTask | Cancel a scheduled task |

Operations

  • Crash recovery — on startup, stale containers from previous crashes are automatically cleaned up
  • Idle timeout — containers tear down after 60 seconds of inactivity (configurable)
  • Capacity — new sessions are rejected when at SWAPCLAW_MAX_CONCURRENT; no queuing
  • Logging — structured JSON to stderr

See AGENTS.md for the full operations guide.

Development

bun install          # Install dependencies
bun run build        # Compile TypeScript
bun test             # Run tests
bun run test:watch   # Watch mode
bun run lint         # Check lint + formatting
bun run lint:fix     # Auto-fix
bun run format       # Auto-format

Tests are organized in three tiers:

  • Unit (tests/<module>.test.ts) — single class, deps mocked
  • Integration (tests/integration_<flow>.test.ts) — multiple real classes
  • E2E (tests/e2e_<scenario>.test.ts) — full application with Docker

License

MIT