Skip to main content

Opinionated Claude Code wrapper: dangerous perms + non-destructive guardrails + auto Haiku handoffs instead of compacting.

Project description

sclaude

Opinionated Claude Code wrapper for long-running sessions. A Cartage OSS contribution.

What it does:

  • Launches claude with --dangerously-skip-permissions so you never see a permission prompt.
  • Appends a strict non-destructive guardrails system prompt so Claude self-imposes the safety checks the permission gate would have enforced.
  • Runs a context-window sidecar. At ~70% context, it asks Haiku to write a handoff doc and auto-swaps the session: kills the running claude, respawns it fresh, and types /resume <doc> for you. No mid-flow compacting, no lost state.
  • Bundles a Claude Code status line showing context %, 5-hour and 7-day usage buckets, and a pace meter.
  • Spawns git worktrees with sclaude <name> — one command, branch + tree
    • wrapped claude.

Install

pipx install sclaude

Requires Claude Code installed and authed (claude login) — sclaude uses your existing OAuth session, no API key needed.

Quick start

# launch claude in current cwd (no worktree)
sclaude run

# spawn a worktree at <repo>/.worktrees/my-feature and launch claude in it
sclaude my-feature
sclaude worktree my-feature           # explicit form

# remove worktrees whose branches are merged / clean
sclaude prune                          # dry run
sclaude prune --apply                  # actually remove

Any argument that isn't a known subcommand is treated as a worktree name. So sclaude AE-1234sclaude worktree AE-1234.

Worktree paths

Default: <repo>/.worktrees/<name>. Override with --path:

sclaude my-feature --path ~/scratch/my-feature

Branch defaults to the worktree name and forks off the detected default branch (origin/mainorigin/mastermainmaster). Override with --branch / --base.

Context threshold

Default fires at 70% of the 200k context window. Override:

sclaude --threshold 0.65

To disable the PTY auto-swap and fall back to a banner-only handoff:

sclaude --no-auto-handoff

Status line

On first launch, sclaude composes a settings JSON that points Claude Code's statusLine at the bundled statusline.sh (cached at ~/.cache/sclaude/statusline.sh). Your existing ~/.claude/settings.json is preserved — only the statusLine key is added.

The bar shows: context fill % • pace (7d burn-rate vs sustainable) • 5h and 7d usage buckets when either crosses 50%.

Guardrails

See src/sclaude/guardrails.md. Summary: no force-push, no destructive git/SQL, no editing CI/secrets, always work in a worktree, commit per chunk, confirm before irreversible ops.

Architecture

sclaude <name>
├── git worktree add <repo>/.worktrees/<name>
├── spawn watcher.py (subprocess, polls ~/.claude/projects/<cwd>/*.jsonl)
└── pexpect-driven PTY around `claude --dangerously-skip-permissions
                                       --append-system-prompt <guardrails>
                                       --settings <bundled-statusline.json>`

When the watcher detects context ≥ threshold, it calls claude -p --model haiku to write a handoff doc under ~/.claude/handoffs/. The PTY runner spots the new file, terminates the current claude, respawns it, and pre-types /resume <doc> as the first user input.

Acknowledgements

Built at Cartage for our own non-technical AO users running multi-day Claude Code sessions. Released as a standalone OSS package in the hope it's useful to anyone else who hates compaction.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sclaude-0.4.0.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sclaude-0.4.0-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file sclaude-0.4.0.tar.gz.

File metadata

  • Download URL: sclaude-0.4.0.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sclaude-0.4.0.tar.gz
Algorithm Hash digest
SHA256 d10d19d206d3fcf7171e5d90a8c2a29dde55cec5d8d138b4fb69a4da1ad811ec
MD5 59ff1ac2bb85b2861552a14b7b86902f
BLAKE2b-256 1bc8aa86f3e715b058a087e2d67b76c8c59df89ff0072cf5b02fe811bde9eed9

See more details on using hashes here.

File details

Details for the file sclaude-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: sclaude-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 22.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sclaude-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e98daa5374ab5cdd1b11624cead37eac739f4e4b6a2a2387ff886f16e2482488
MD5 0423af7b21d6b4592a0a693697d417eb
BLAKE2b-256 69e27103359085ac395898f6ee98529e7195de74b72339230e6c48b35ef72119

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page