claude-wrapper CLAUDE.md

claude-wrapper CLAUDE.md is an instructions file for coding agents from smartwatermelon/claude-wrapper. It costs 2,491 tokens per session, scanned A, original, MIT.

A Bash wrapper around the Claude Code command-line tool that adds project-specific identity, token, secret, SSH-key, and remote-session handling before starting Claude.

In plain words
What is it for?
Use it to run Claude with isolated credentials, debug output, and repository-specific tests and shell linting.
Why use it?
It centralizes setup that would otherwise need to be configured separately for each command-line session.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/smartwatermelon/claude-wrapper/claude-md
Clone the repo
git clone --depth 1 https://github.com/smartwatermelon/claude-wrapper

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for claude-wrapper CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/smartwatermelon/claude-wrapper/claude-md.svg)](https://agentmods.dev/instructions/smartwatermelon/claude-wrapper/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/smartwatermelon/claude-wrapper/claude-md"><img src="https://agentmods.dev/badge/instructions/smartwatermelon/claude-wrapper/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 2,491 This file is loaded in full into every session.
When invoked 2,491 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.02491 $0.02491
Opus 5 $0.01246 $0.01246
Sonnet 5 $0.00498 $0.00498
Haiku 4.5 $0.00249 $0.00249

Measured 5d ago against content hash 02cf4e2a08e5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

claude-wrapper CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 151 lines

How it starts

The opening of the file, as written. The whole thing — 151 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

What This Is

A Bash wrapper around the Claude Code CLI (claude) that intercepts invocations to inject git identity, GitHub tokens, 1Password secrets, SSH key isolation, and automatic remote-control session naming before delegating to the real claude binary. Installed by symlinking bin/claude-wrapper to ~/.local/bin/claude so it shadows the real binary in $PATH.

Commands

Run tests

bash tests/test-wrapper.sh
bash tests/test-gh-token-permissions.sh
bash tests/test-remote-session.sh

There is no test runner script — run individual test files directly. No npm test or make test.

Lint

shellcheck --external-sources lib/*.sh bin/claude-wrapper tests/*.sh

Use --external-sources because lib files source each other via variables (${WRAPPER_LIB}/logging.sh), and plain shellcheck emits false SC1091 warnings.

Debug mode

CLAUDE_DEBUG=true claude

Enables verbose DEBUG: output to stderr from all modules.

Architecture

Execution flow (bin/claude-wrapper)

The wrapper is a single orchestrator that sources modules in dependency order, then execs the real binary:

  1. Resolve own pathrealpath to handle symlinks
  2. Source libslogging.shpermissions.shpath-security.shlaunch-dir-check.shgit-identity.shcredentials.shsecrets-loader.shbinary-discovery.shpre-launch.shremote-session.sh. Sourcing credentials.sh has the side effect of fetching OP_SERVICE_ACCOUNT_TOKEN from the macOS Keychain and GH_TOKEN from the 1Password Automation vault (see below).
  3. Check launch directorycheck_launch_dir warns (non-blocking) if CWD is exactly $HOME or $HOME/Developer, since neither is a git repo and both carry an unrelated accumulated MCP server surface in ~/.claude/.claude.json
  4. Find real claude binary — scans $PATH for claude, skipping itself (the wrapper)
  5. Validate binary — ownership and permission checks on the discovered binary
  6. Initialize secrets loaderinit_secrets_loader discovers per-project secrets files and authenticates if needed
  7. Build remote-control argsbuild_remote_control_args computes --remote-control <session-name> for interactive sessions (applied later, at exec)
  8. Inject 1Password secrets — if secrets are available, inject_secrets runs op inject to resolve op://Automation/... references from per-project .claude/secrets.op; authentication uses OP_SERVICE_ACCOUNT_TOKEN (no TouchID prompt)
  9. Run pre-launch hook — if secrets are available, run_pre_launch_hook runs .claude/pre-launch.sh from the git root if it exists and passes security validation
  10. exec — replaces the wrapper process with the real binary, applying the remote-control args from step 7

Read the full file on GitHub · 151 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 151 lines · 2,491 tokens per session scan A 02cf4e2a08e5

Subscribe to this mod's changes

claude-wrapper CLAUDE.md is an instructions file published in the GitHub repository smartwatermelon/claude-wrapper (5 stars, last pushed 16d ago), licensed MIT. It adds 2,491 tokens to every session, about $0.0125 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.