Fixed model selection and the install script now properly works when not sudo

This commit is contained in:
plean committed 2026-08-11 00:47:20 +00:00
1 parent f7e7f2694a
commit ac8f72cfe5
3 files changed
+44 -17

No files matched your search

+4
View File
@@ -120,6 +120,10 @@ If the selected model has a context length:
If no context length is available:
- `CLAUDE_CODE_DISABLE_1M_CONTEXT=1`
### Environment Variable Propagation
**Important:** The environment variables are written to a temporary file and sourced by each tmux pane at startup. This ensures Claude Code in Pane 0 receives the correct model settings. Do not delete the temporary environment file while the tmux session is running.
## Using the Businessman Skill
The skill is automatically initialized when you run `businessman`. To use it manually after the session is running:
+37 -14
View File
@@ -57,34 +57,54 @@ cd "$PROJECT_DIR" || { echo "Directory not found: $PROJECT_DIR"; exit 1; }
SESSION_NAME="businessman-$(date +%Y%m%d-%H%M%S)"
# Set env vars (inheritable by tmux panes)
export ANTHROPIC_BASE_URL="$LLAMA_SWAP_API"
export ANTHROPIC_AUTH_TOKEN="dummy"
export ANTHROPIC_DEFAULT_SONNET_MODEL="$MODEL_ID"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="$MODEL_ID"
export ANTHROPIC_DEFAULT_OPUS_MODEL="$MODEL_ID"
# Set env vars for tmux session (set before creating session)
LLAMA_BASE_URL="$LLAMA_SWAP_API"
LLAMA_AUTH_TOKEN="dummy"
LLAMA_MODEL_ID="$MODEL_ID"
LLAMA_CTX="$CTX"
# Context-aware settings
if [ -n "$CTX" ] && [ "$CTX" != "unknown" ] && [ "$CTX" -gt 0 ]; then
if [ "$CTX" -gt 200000 ]; then
export CLAUDE_CODE_DISABLE_1M_CONTEXT="0"
export CLAUDE_CODE_AUTO_COMPACT_WINDOW="200000"
CLAUDE_DISABLE_1M_CONTEXT="0"
CLAUDE_AUTO_COMPACT_WINDOW="200000"
else
export CLAUDE_CODE_DISABLE_1M_CONTEXT="1"
export CLAUDE_CODE_AUTO_COMPACT_WINDOW="$CTX"
CLAUDE_DISABLE_1M_CONTEXT="1"
CLAUDE_AUTO_COMPACT_WINDOW="$CTX"
fi
export CLAUDE_AUTOCOMPACT_PCT_OVERRIDE="80"
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE="80"
else
export CLAUDE_CODE_DISABLE_1M_CONTEXT="1"
CLAUDE_DISABLE_1M_CONTEXT="1"
CLAUDE_AUTO_COMPACT_WINDOW=""
fi
# Create environment setup file for the session
ENV_SETUP="/tmp/businessman-env-$$-$SESSION_NAME"
cat > "$ENV_SETUP" << EOF
export ANTHROPIC_BASE_URL="$LLAMA_BASE_URL"
export ANTHROPIC_AUTH_TOKEN="$LLAMA_AUTH_TOKEN"
export ANTHROPIC_DEFAULT_SONNET_MODEL="$LLAMA_MODEL_ID"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="$LLAMA_MODEL_ID"
export ANTHROPIC_DEFAULT_OPUS_MODEL="$LLAMA_MODEL_ID"
export CLAUDE_CODE_DISABLE_1M_CONTEXT="$CLAUDE_DISABLE_1M_CONTEXT"
export CLAUDE_CODE_AUTO_COMPACT_WINDOW="$CLAUDE_AUTO_COMPACT_WINDOW"
export CLAUDE_AUTOCOMPACT_PCT_OVERRIDE="$CLAUDE_AUTOCOMPACT_PCT_OVERRIDE"
EOF
# Start tmux session with bash in pane 0 (keeps shell alive after claude exits)
tmux new-session -d -s "$SESSION_NAME" "bash"
# Send 'claude' command to pane 0 and hit Enter
# Send commands to pane 0 that source the env file and then run claude
tmux send-keys -t "$SESSION_NAME:0.0" "source \"$ENV_SETUP\"" Enter
sleep 0.2
tmux send-keys -t "$SESSION_NAME:0.0" "claude \"Use the businessman skill to initialize our session\"" Enter
# Pane 1 is still a plain bash
tmux split-window -t "$SESSION_NAME:0.0" -h "bash"
# Set pane 1 to also source the env file
tmux send-keys -t "$SESSION_NAME:0.1" "source \"$ENV_SETUP\"" Enter
tmux resize-pane -t "$SESSION_NAME:0.0" -x 50
# Focus pane 0 (Claude)
@@ -101,4 +121,7 @@ echo "When done with claude, type 'exit' in pane 0 to get your bash shell back"
echo "To reattach: tmux attach -t $SESSION_NAME"
# Auto-attach
tmux attach -t "$SESSION_NAME"
tmux attach -t "$SESSION_NAME"
# Clean up temp file after session ends
rm -f "$ENV_SETUP"
+3 -3
View File
@@ -68,9 +68,9 @@ echo "Copying SKILL.md to $SKILLS_DIR..."
cp "$SKILL_MD" "$SKILLS_DIR/SKILL.md"
# Copy businessman binary to /usr/local/bin
echo "Copying businessman to $BIN_DIR..."
cp "$BUSINESSMAN_TEMP" "$BIN_DIR/businessman"
chmod +x "$BIN_DIR/businessman"
# /usr/local/bin is root-owned, so the copy must run as sudo
echo "Copying businessman to $BIN_DIR (sudo)..."
sudo install -m 755 "$BUSINESSMAN_TEMP" "$BIN_DIR/businessman"
# Cleanup
rm -f "$BUSINESSMAN_TEMP"