hn.today

Show HN: Run Claude Code unattended inside a fence, under a dollar budget

github.com8 points3 comments
Screenshot of Show HN: Run Claude Code unattended inside a fence, under a dollar budget

SIwithin is a single-file Python tool that runs agent CLIs (notably Claude Code and OpenAI Codex) unattended inside a strict macOS sandbox, enforcing three guarantees: a run may read or write only the folders explicitly allowed, it cannot spend more than a per-run or global dollar budget, and every run leaves an immutable one-line ledger entry recording cost and completion status. It achieves monetary control by creating a per-run token and, for the Claude adapter, a loopback proxy that is the sole network door to the API; the proxy meters each API request, refuses further requests when the budget is exhausted, and terminates the run. The tool refuses to run on Linux or Windows rather than run without a fence.

Implementation details matter: the fence is a generated macOS sandbox profile that denies home access, limits writable paths, forbids certain system executables, and restricts environment variables and network sockets unless a proxy is allowed. Adapters get isolated config directories and runs inherit minimal environment. Auth modes include a safer proxy-token approach and an optional ENV mode that exposes keys to the run (with cautions and recommended provider spend-limits). SIwithin is standard-library-only (Python 3.10+), installs easily, includes tests and docs, is Apache-2.0 licensed, makes no external network calls itself, and is independent of Anthropic/OpenAI.

Read on github.com3 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in AI

Claude Duet

Claude Duet

Claude Duet is a new AI app for professionals and small business owners that acts as a proactive assistant, managing tasks and priorities. It is available for iOS, Android, and web, and offers a research preview for Pro and Max subscribers. (claude.com)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.