Skip to content

Instantly share code, notes, and snippets.

@JackMBurch
Created July 13, 2026 18:44
Show Gist options
  • Select an option

  • Save JackMBurch/ca78e754505729757ef492c1bced61ba to your computer and use it in GitHub Desktop.

Select an option

Save JackMBurch/ca78e754505729757ef492c1bced61ba to your computer and use it in GitHub Desktop.
/default-effort command for claude code

/default-effort — change Claude Code's default effort without touching your current session

The problem: Claude Code's /effort <level> changes both the current session's effort and the persisted default that every new session inherits. That coupling can't be disabled. So there's no built-in way to bump just the current session without also changing the default for all future sessions.

The fix: a small slash command, /default-effort [level], that patches only the persisted default. Running it does not affect your current session (the default is read at session start, not hot-reloaded — verified). With no argument it resets the default to medium.

/effort high           # session + default both go high (built-in behavior)
/default-effort medium # default drops back to medium; current session stays high
/default-effort        # same as: /default-effort medium

It works because the default is a single key, "effortLevel", in ~/.claude/settings.json. The command just surgically rewrites that one key.

Requirements

  • jq installed (which jq).

Setup — 2 files

1. ~/.claude/scripts/set-default-effort.sh

#!/usr/bin/env bash
# set-default-effort.sh — set the DEFAULT effort level for NEW Claude Code sessions.
# Patches only the "effortLevel" key in ~/.claude/settings.json. Does NOT change the
# effort of the currently running session. No argument resets the default to "medium".
# Usage: set-default-effort.sh [low|medium|high]
set -euo pipefail

SETTINGS="${CLAUDE_SETTINGS:-$HOME/.claude/settings.json}"
VALID=(low medium high)   # levels /effort accepts; extend this line if more are added
level="${1:-medium}"

ok=0
for v in "${VALID[@]}"; do [[ "$level" == "$v" ]] && ok=1 && break; done
if [[ "$ok" -ne 1 ]]; then
  printf 'error: invalid effort level: %q\n' "$level" >&2
  printf 'valid levels: %s\n' "${VALID[*]}" >&2
  exit 1
fi

command -v jq >/dev/null 2>&1 || { echo "error: jq not found on PATH" >&2; exit 1; }
[[ -f "$SETTINGS" ]] || { echo "error: settings file not found: $SETTINGS" >&2; exit 1; }
jq empty "$SETTINGS" >/dev/null 2>&1 || {
  echo "error: $SETTINGS is not valid JSON; refusing to write" >&2; exit 1; }

tmp="$(mktemp "${SETTINGS}.XXXXXX")"
trap 'rm -f "$tmp"' EXIT
jq --arg l "$level" '.effortLevel = $l' "$SETTINGS" > "$tmp"
jq empty "$tmp" >/dev/null 2>&1 || {
  echo "error: produced invalid JSON; aborting without writing" >&2; exit 1; }
mv "$tmp" "$SETTINGS"
trap - EXIT

echo "Default effort for new sessions set to: $level"

2. ~/.claude/commands/default-effort.md

---
description: Set the default effort level for new Claude Code sessions (does not affect the current session)
argument-hint: "[low|medium|high]  (default: medium)"
allowed-tools: Bash(bash:*)
---
Run `bash $HOME/.claude/scripts/set-default-effort.sh $ARGUMENTS` and report the resulting
default effort to the user.

Important: this changes only the default that *new* sessions inherit (the `effortLevel` key
in `~/.claude/settings.json`). It does NOT change the current session's effort. To change the
current session, use the built-in `/effort` command (which also updates this default).

Install

mkdir -p ~/.claude/scripts ~/.claude/commands
# then save the two files above to those paths, and:
chmod +x ~/.claude/scripts/set-default-effort.sh

Reload commands in Claude Code (/reload-skills, or start a new session) and you're set.

Notes

  • Safe by design: validates the level, refuses to write if settings.json is missing/malformed, and writes atomically (temp file + mv) so your settings can't be corrupted mid-write.
  • You can also run it straight from a shell: bash ~/.claude/scripts/set-default-effort.sh high.
  • If Claude Code adds new effort levels later, add them to the VALID=(...) line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment