Fixed model selection and the install script now properly works when not sudo
This commit is contained in:
1 parent
f7e7f2694a
commit
ac8f72cfe5
3 files changed
+43
-16
No files matched your search
@@ -120,6 +120,10 @@ If the selected model has a context length:
|
|||||||
If no context length is available:
|
If no context length is available:
|
||||||
- `CLAUDE_CODE_DISABLE_1M_CONTEXT=1`
|
- `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
|
## Using the Businessman Skill
|
||||||
|
|
||||||
The skill is automatically initialized when you run `businessman`. To use it manually after the session is running:
|
The skill is automatically initialized when you run `businessman`. To use it manually after the session is running:
|
||||||
|
|||||||
+36
-13
@@ -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)"
|
SESSION_NAME="businessman-$(date +%Y%m%d-%H%M%S)"
|
||||||
|
|
||||||
# Set env vars (inheritable by tmux panes)
|
# Set env vars for tmux session (set before creating session)
|
||||||
export ANTHROPIC_BASE_URL="$LLAMA_SWAP_API"
|
LLAMA_BASE_URL="$LLAMA_SWAP_API"
|
||||||
export ANTHROPIC_AUTH_TOKEN="dummy"
|
LLAMA_AUTH_TOKEN="dummy"
|
||||||
export ANTHROPIC_DEFAULT_SONNET_MODEL="$MODEL_ID"
|
LLAMA_MODEL_ID="$MODEL_ID"
|
||||||
export ANTHROPIC_DEFAULT_HAIKU_MODEL="$MODEL_ID"
|
LLAMA_CTX="$CTX"
|
||||||
export ANTHROPIC_DEFAULT_OPUS_MODEL="$MODEL_ID"
|
|
||||||
|
|
||||||
# Context-aware settings
|
# Context-aware settings
|
||||||
if [ -n "$CTX" ] && [ "$CTX" != "unknown" ] && [ "$CTX" -gt 0 ]; then
|
if [ -n "$CTX" ] && [ "$CTX" != "unknown" ] && [ "$CTX" -gt 0 ]; then
|
||||||
if [ "$CTX" -gt 200000 ]; then
|
if [ "$CTX" -gt 200000 ]; then
|
||||||
export CLAUDE_CODE_DISABLE_1M_CONTEXT="0"
|
CLAUDE_DISABLE_1M_CONTEXT="0"
|
||||||
export CLAUDE_CODE_AUTO_COMPACT_WINDOW="200000"
|
CLAUDE_AUTO_COMPACT_WINDOW="200000"
|
||||||
else
|
else
|
||||||
export CLAUDE_CODE_DISABLE_1M_CONTEXT="1"
|
CLAUDE_DISABLE_1M_CONTEXT="1"
|
||||||
export CLAUDE_CODE_AUTO_COMPACT_WINDOW="$CTX"
|
CLAUDE_AUTO_COMPACT_WINDOW="$CTX"
|
||||||
fi
|
fi
|
||||||
export CLAUDE_AUTOCOMPACT_PCT_OVERRIDE="80"
|
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE="80"
|
||||||
else
|
else
|
||||||
export CLAUDE_CODE_DISABLE_1M_CONTEXT="1"
|
CLAUDE_DISABLE_1M_CONTEXT="1"
|
||||||
|
CLAUDE_AUTO_COMPACT_WINDOW=""
|
||||||
fi
|
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)
|
# Start tmux session with bash in pane 0 (keeps shell alive after claude exits)
|
||||||
tmux new-session -d -s "$SESSION_NAME" "bash"
|
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
|
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
|
# Pane 1 is still a plain bash
|
||||||
tmux split-window -t "$SESSION_NAME:0.0" -h "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
|
tmux resize-pane -t "$SESSION_NAME:0.0" -x 50
|
||||||
|
|
||||||
# Focus pane 0 (Claude)
|
# Focus pane 0 (Claude)
|
||||||
@@ -102,3 +122,6 @@ echo "To reattach: tmux attach -t $SESSION_NAME"
|
|||||||
|
|
||||||
# Auto-attach
|
# Auto-attach
|
||||||
tmux attach -t "$SESSION_NAME"
|
tmux attach -t "$SESSION_NAME"
|
||||||
|
|
||||||
|
# Clean up temp file after session ends
|
||||||
|
rm -f "$ENV_SETUP"
|
||||||
@@ -68,9 +68,9 @@ echo "Copying SKILL.md to $SKILLS_DIR..."
|
|||||||
cp "$SKILL_MD" "$SKILLS_DIR/SKILL.md"
|
cp "$SKILL_MD" "$SKILLS_DIR/SKILL.md"
|
||||||
|
|
||||||
# Copy businessman binary to /usr/local/bin
|
# Copy businessman binary to /usr/local/bin
|
||||||
echo "Copying businessman to $BIN_DIR..."
|
# /usr/local/bin is root-owned, so the copy must run as sudo
|
||||||
cp "$BUSINESSMAN_TEMP" "$BIN_DIR/businessman"
|
echo "Copying businessman to $BIN_DIR (sudo)..."
|
||||||
chmod +x "$BIN_DIR/businessman"
|
sudo install -m 755 "$BUSINESSMAN_TEMP" "$BIN_DIR/businessman"
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
rm -f "$BUSINESSMAN_TEMP"
|
rm -f "$BUSINESSMAN_TEMP"
|
||||||
|
|||||||
Reference in new issue
Block a user