claude-wrapper: Instructions file for Claude Code

CLAUDE.md

claude-wrapper CLAUDE.md is an instructions file for Claude Code from smartwatermelon/claude-wrapper. It costs 3,723 tokens per session, scanned B, 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 for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

This is smartwatermelon/claude-wrapper's own configuration. It tells Claude Code how to work on claude-wrapper itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything claude-wrapper configures →

Reuse

Borrowing it

Nothing to install: this file belongs to smartwatermelon/claude-wrapper. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/smartwatermelon/claude-wrapper/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/smartwatermelon/claude-wrapper

Made for: Claude Code.

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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for claude-wrapper CLAUDE.md

Your own site · 80×15
<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="Reviewed on agentmods" width="80" height="20"></a>
Per session 3,723 This file is loaded in full into every session.
When invoked 3,723 The same file — it is already loaded in full.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.03723 $0.03723
Opus 5.5 $0.01489 $0.01489
Sonnet 5.5 $0.00745 $0.00745
Haiku 4.5 $0.00372 $0.00372

Measured 9d ago against content hash efd1b2739d03, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

claude-wrapper CLAUDE.md scanned grade B with 1 finding 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 9d 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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

- **`machine-settings.sh`** — passes `~/.config/claude-code/machine-settings.json` (or `$CLAUDE_MACHINE_SETTINGS`) with `--settings` for interactive sessions, so one machine can enable what the git-shared `~/.claude/sett
CLAUDE.md · 189 lines

How it starts

The opening of the file, as written. The whole thing — 189 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
bash tests/test-machine-settings.sh
bash tests/test-claude-wrapper-lite.sh

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

Lint

shellcheck -S info lib/*.sh bin/claude-wrapper bin/claude-wrapper-lite tests/*.sh tests/lib/*.sh

CI (standards-check) runs shellcheck with the canonical config from smartwatermelon/github-workflows (standards/shellcheckrc: external-sources=true, source-path=SCRIPTDIR, disable=SC2310). To match CI locally, add --rcfile <path to that file>. Lib and test files source each other through variable paths (${WRAPPER_LIB}/logging.sh, ${TEST_DIR}/lib/op-guard.sh), which shellcheck cannot resolve unless external sourcing is enabled — without it, the # shellcheck source=... directives at those call sites are ignored and each one raises a false SC1091.

This repo has no .shellcheckrc of its own. A plain local run reads ~/.shellcheckrc instead, which CI never sees, so use --rcfile when the result must match CI — see PR #122.

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 path — realpath to handle symlinks
  2. Source libs — logging.sh → permissions.sh → path-security.sh → launch-dir-check.sh → git-identity.sh → credentials.sh → secrets-loader.sh → binary-discovery.sh → pre-launch.sh → remote-session.sh → machine-settings.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 directory — check_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. Locate caffeinate — hardcoded to /usr/bin/caffeinate, checked for executability; hard-fails if absent
  5. Find real claude binary — scans $PATH for claude, skipping itself (the wrapper)
  6. Validate binary — ownership and permission checks on the discovered binary
  7. Initialize secrets loader — init_secrets_loader discovers per-project secrets files and authenticates if needed
  8. Build injected args — build_remote_control_args computes --remote-control <session-name>, then build_machine_settings_args adds --settings <machine file>, both for interactive sessions only (applied later, at exec)
  9. 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)
  10. 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
  11. exec — replaces the wrapper process with caffeinate -is <claude>, applying the injected args from step 8

Read the full file on GitHub · 189 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. 9d ago Changed · +5 lines · +198 tokens per session efd1b2739d03
  2. 14d ago Changed · +2 lines · +149 tokens per session scan A → B ddeb0f766515
  3. 17d ago Changed · -18 tokens per session 3917f4907857
  4. 28d ago Changed · +43 tokens per session aa6f86e6ec94
  5. 1mo ago Changed · +2 lines · +98 tokens per session ab96bad4d23c
  6. 1mo ago Changed accc84a2abf7
  7. 1mo ago Changed · +29 lines · +762 tokens per session cbfc89fa497f
  8. 2mo 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 (6 stars, last pushed 9d ago), licensed MIT. It adds 3,723 tokens to every session, about $0.0149 per session on Opus 5.5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 9,715 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,461 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).

microsoft/vscode · 5,262 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,680 tokens

vscode copilot-instructions.md

Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).

microsoft/vscode · 2,750 tokens

deno copilot-instructions.md

Copilot instructions for denoland/deno, covering deno development guide for github copilot, network access, high level overview, key directories and key files to understand first.

denoland/deno · 3,077 tokens