# add to ~/.zshrc # --- AI Agent Launcher (The "Brain Box") --- function agent() { # 1. Determine Workspace local TARGET_DIR="${1:-$PWD}" # 2. Generate Unique Name local CONTAINER_NAME="opencode-agent-$(basename "$TARGET_DIR")" echo "> Launching Smart Agent: $CONTAINER_NAME" echo "> Workspace: $TARGET_DIR" docker run -it --rm \ --name "$CONTAINER_NAME" \ --add-host=host.docker.internal:host-gateway \ -v "$TARGET_DIR:/workspace" \ -v "$HOME/dev/ai/docker-images/starship.toml:/root/.config/starship.toml" \ -v opencode-cargo-cache:/root/.cargo \ -v opencode-go-cache:/root/go \ -v opencode-bun-cache:/root/.bun \ -v opencode-uv-cache:/root/.cache/uv \ -v opencode-pip-cache:/root/.cache/pip \ -v opencode-history:/root/.history \ -e HISTFILE=/root/.history/zsh_history \ -w /workspace \ -p 4096:4096 \ smart-agent \ zsh }