Skip to content

workspace-setup

Deploys workspace rules, statusline, governance files, and base settings via SessionStart hook.

Self-contained — all CC-specific files bundled in the plugin, no external dependencies.

Deployed files

  • *rules/.md → .claude/rules/ — core principles, context management, compound learning, CI status checks, unattended execution, read discipline, review tiers
  • scripts/statusline.sh → .claude/scripts/ — status line display. The context field shows the share of the window in use and the share at which compaction fires (ctx:6% used·compact@17% with a 200K window on a 1M model; compact@ is about 33K tokens below CLAUDE_CODE_AUTO_COMPACT_WINDOW, k/M suffixes allowed, or below the model's window when unset, an observed figure since the docs state no buffer, lowered by CLAUDE_AUTOCOMPACT_PCT_OVERRIDE when set; a window set by /autocompact or the autoCompactWindow setting is not visible to the script; ! when at most 3% of the window is left). World clock off by default. Two ways to opt in: (1) persistent — set CC_WORLD_CLOCK="Asia/Tokyo,Europe/Paris,Europe/London,UTC,America/New_York,America/Los_Angeles" in your shell rc (needs CC restart to change); (2) live toggle — write the same comma-separated zone list to ~/.claude/world-clock (next prompt render picks it up; rm the file to turn off). Env var wins over file. Use east-to-west / sunrise order or any IANA zones you prefer. Each entry is either a bare zone (Europe/Paris → label Paris) or Zone=Label to override the rendered label (America/New_York=NYC → label NYC). Zones render on a dedicated line below the main statusline; invalid zones show as ?<name>. See the comment block at the top of .claude/scripts/statusline.sh for the curated shortlist and usage notes.
  • settings/settings-base.json → .claude/settings.json — lightweight defaults (statusline, context7, attribution); its env sets BASH_MAX_OUTPUT_LENGTH 15000 (characters of Bash output kept in context) and CLAUDE_CODE_AUTO_COMPACT_WINDOW 200000 (tokens of context at which auto-compaction fires; minimum 100000, capped at the model's window; do not also set CLAUDE_AUTOCOMPACT_PCT_OVERRIDE, a percentage of that window, or the two stack to about 100K), see env vars. If .claude/settings.json is tracked by git, or git cannot say, the hook leaves it untouched, writes nothing else for settings and prints one warning line. Git cannot say when git is missing or errors, when GIT_DIR, GIT_WORK_TREE or GIT_INDEX_FILE is set in the environment, or when realpath -m (GNU coreutils, not on stock macOS) is unavailable; then the whole settings step is skipped, including for an untracked or absent file.
  • governance/AGENTS.md → AGENTS.md — agent behavioral rules and decision framework
  • governance/AGENT_LEARNINGS.md → AGENT_LEARNINGS.md — pattern discovery template
  • governance/AGENT_REQUESTS.md → AGENT_REQUESTS.md — human escalation protocol
  • governance/README.md → README.md — value-first front door, derived from the qte77 doc-structure canon
  • governance/CONTRIBUTING.md → CONTRIBUTING.md — technical workflows + the ## Documentation hierarchy statement

All files use copy-if-not-exists (won't overwrite).

Persisting ~/.claude across container rebuilds

scripts/link-claude-home.sh is a copyable snippet, not something this plugin invokes itself. Copy it into your repo (e.g. scripts/link-claude-home.sh) and call it first in .devcontainer/devcontainer.json's onCreateCommand, before any step that installs or touches Claude Code:

"onCreateCommand": "bash scripts/link-claude-home.sh && make setup_all"

It symlinks $HOME/.claude to /workspaces/.claude-files (override with CLAUDE_HOME_DIR / CLAUDE_HOME_PERSIST_DIR) so memory, sessions, settings, and credentials survive a container rebuild — on platforms like GitHub Codespaces, everything outside /workspaces is cleared on rebuild, everything inside it persists.

This can't live in a plugin hook: SessionStart only fires once Claude Code (and this plugin) are already installed, which itself requires ~/.claude to already be linked — a hook can't bootstrap the directory it lives inside. The SessionStart hook below does still warn if it detects ~/.claude isn't a symlink, for visibility in sessions where it happens to run, but it can't self-heal.

Note this only covers ~/.claude itself — ~/.claude.json (trust/permission state per project, marketplace/onboarding flags) is a separate sibling file outside ~/.claude, and it deliberately has no fix here (decided not to build one). Symlinking an individual live-rewritten file is a known-risky pattern — Claude Code config writes aren't verified atomic-rename-safe on every path, which silently breaks a file symlink (directory symlinks like ~/.claude above aren't affected; see #199 failure mode 1) — and the value (re-approving trust dialogs after a rebuild) didn't clear the bar against that risk plus this file's unresolved redaction question (it carries oauthAccount). The SessionStart hook still warns if ~/.claude.json isn't linked, purely for visibility.

read-once hook

PreToolUse hook that prevents redundant file re-reads within a session. Saves ~2K tokens per blocked re-read; total savings scale with how often a session re-reads files it already has (no aggregate figure is measured).

  • Mode: warn (default) — allows read with advisory; set READ_ONCE_MODE=deny to block
  • TTL: 1200s (20 min) — cache expires after this; set READ_ONCE_TTL to override
  • Diff mode: set READ_ONCE_DIFF=1 to show diffs instead of full re-reads for changed files; snapshots skip secret-like files (.env*, *.pem, *.key, *.p12, *.pfx, id_*, *credential*, .netrc, .npmrc, .pgpass; matched case-insensitively, on the requested name and on the symlink target) and files over 1 MiB. A hard link has its own name, so a hard link to a secret file under a plain name is still snapshotted
  • Cache: per user under claude-read-once-<uid>/<session> in $XDG_RUNTIME_DIR (else $TMPDIR, else /tmp), mode 700; the hook does nothing if that dir is a symlink or not owned by you. Earlier versions used ${TMPDIR:-/tmp}/claude-read-once-<session>, which is no longer read or cleaned up and may hold world-readable snapshots: remove those claude-read-once-<session> directories you own. Don't remove them with a claude-read-once-* glob: without $XDG_RUNTIME_DIR it also matches the current claude-read-once-<uid> base
  • PostCompact: cache clears automatically when CC compacts context
  • Partial reads: offset/limit reads always pass through (never cached)
  • Disable: set READ_ONCE_DISABLED=1
  • Requires jq, md5sum, realpath and stat: if one is missing the hook silently does nothing (stock macOS has no md5sum)

Based on Bande-a-Bonnot/Boucle-framework (MIT).

Install

claude plugin install workspace-setup@qte77-claude-code-plugins

For sandbox settings, use workspace-sandbox instead.