| name | bashrc |
| description | Safe wrapper and settings editing playbook for ~/.bashrc — hardening protocol for editing Claude/claude CLI wrappers and model routing without breaking base claude behavior. Slash command: /bashrc. |
| scope | user |
Bashrc Maintenance
Purpose
Provide a hardening playbook for editing ~/.bashrc safely, especially around
Claude/claude wrappers and model routing.
Problem pattern from recent failures
What broke
claudem() was fixed, but plain claude still came from ~/.claude/settings.json
forcing MiniMax.
- Config was changed in one place (
~/.bashrc) without checking all active config
layers (~/.claude/settings.json, aliases, shell env exports).
- A debug command was executed with ungrouped
| redirections, creating misleading
...: command not found noise.
Why it happened
- Missing precedence check across configuration layers.
- No explicit pre-change checklist.
- No final validation proving wrapper and base command use different env stacks.
Before editing — history checks
- Run
/history "bashrc minimax minimax_M3 claude settings.json" --recent 14 to confirm recent context.
- Run
/ms "claude ANTHROPIC_BASE_URL MINIMAX_API_KEY" to check if there is prior recovery notes.
- If either output shows unresolved confusion, pause and resolve before editing.
Safe edit protocol (required)
- Read current values first
sed -n '1,220p' ~/.bashrc
cat ~/.claude/settings.json
cat ~/.claude/commands/claude* 2>/dev/null
- Decide the intended ownership of each variable
~/.claude/settings.json: global baseline for claude.
~/.bashrc: explicit shell aliases/functions (for claudem, claudee, etc.).
- Never mix responsibilities.
- Make only scoped edits
- If changing
claude behavior, update ~/.claude/settings.json only.
- If adding/switching a wrapper (for example
claudem), keep it in ~/.bashrc and
avoid touching base claude.
- Validate with a clean check matrix before ending
env | rg 'ANTHROPIC_BASE_URL|ANTHROPIC_MODEL|MINIMAX_API_KEY|ANTHROPIC_AUTH_TOKEN'
declare -f claude claudem || true
bash -lc "source ~/.bashrc >/dev/null 2>&1; declare -f claude; declare -f claudem"
- Smoke test both entry points in a fresh shell
bash -lc "source ~/.bashrc >/dev/null 2>&1; claude --help >/tmp/claude_help.txt; head -n 2 /tmp/claude_help.txt"
bash -lc "source ~/.bashrc >/dev/null 2>&1; claudem --version"
- Verify command outputs match intent
claude should reflect default Anthropic settings from settings file (or explicit
--model override).
claudem should show MiniMax-* env in function output.
Template for wrapper edits (copy this pattern)
claudem() {
ANTHROPIC_BASE_URL="https://api.minimax.io/anthropic" \
ANTHROPIC_AUTH_TOKEN="$MINIMAX_API_KEY" \
ANTHROPIC_MODEL="MiniMax-M3" \
ANTHROPIC_SMALL_FAST_MODEL="MiniMax-M3" \
claude --dangerously-skip-permissions --teammate-mode=tmux "$@"
}
Anti-patterns
- Editing only
.bashrc and assuming it controls all Claude behavior.
- Adding raw
ANTHROPIC_* values to one layer without checking the other.
- Running shell greps with unescaped pipes in one-liners.
- Relying on output from
tmux/shell without checking command exit codes and source context.
Post-change acceptance checklist
~/.bashrc changed only for wrapper function(s) unless explicitly asked to touch ~/.claude/settings.json.
- Baseline
claude path and wrapper claudem path are distinguishable.
- Environment stack for each entry point is documented in commit notes.
- Fresh shell smoke tests pass.
Record change summary
In the final note include:
- files changed,
- expected model path per command,
- exact validation commands + results.
If invoked without edit intent, treat this as a checklist and stop before mutating files.