Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ fi

# Copy GitHub App private key if using App auth
if [ "$USE_GITHUB_APP" = "yes" ] && [ -n "${GITHUB_APP_PEM_PATH:-}" ]; then
PEM_DEST="$INSTALL_DIR/github-app.pem"
mkdir -p "$CONFIG_DIR"
PEM_DEST="$CONFIG_DIR/github-app.pem"
cp "$GITHUB_APP_PEM_PATH" "$PEM_DEST" 2>/dev/null || true
chmod 600 "$PEM_DEST" 2>/dev/null || true
export GITHUB_APP_PEM_PATH="$PEM_DEST"
Expand Down
10 changes: 5 additions & 5 deletions scripts/refresh-github-token.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set -euo pipefail
# GITHUB_APP_PEM_PATH - Path to the .pem private key file
#
# Outputs the token (ghs_...) to stdout.
# Also exports git author/committer identity for the bot.
# Also configures global git author/committer identity for the bot.

: "${GITHUB_APP_ID:?Set GITHUB_APP_ID}"
: "${GITHUB_APP_INSTALLATION_ID:?Set GITHUB_APP_INSTALLATION_ID}"
Expand Down Expand Up @@ -55,9 +55,9 @@ if [ -n "${AGENT_NAME:-}" ] && [ "$AGENT_NAME" != "default" ]; then
AGENT_LABEL="Proactive Engineer ($AGENT_NAME)"
fi

export GIT_AUTHOR_NAME="$AGENT_LABEL"
export GIT_AUTHOR_EMAIL="proactive-engineer[bot]@users.noreply.github.com"
export GIT_COMMITTER_NAME="$AGENT_LABEL"
export GIT_COMMITTER_EMAIL="proactive-engineer[bot]@users.noreply.github.com"
if command -v git >/dev/null 2>&1; then
git config --global user.name "$AGENT_LABEL"
git config --global user.email "proactive-engineer[bot]@users.noreply.github.com"
fi

echo "$token"
9 changes: 4 additions & 5 deletions skills/proactive-engineer/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,13 @@ You'll have either a GitHub App or a Personal Access Token configured:
- **GITHUB_APP_ID**, **GITHUB_APP_INSTALLATION_ID**, **GITHUB_APP_PEM_PATH** are set in your environment
- Before any git push, PR, or `gh` CLI operation, refresh your token and set it for both git and gh:
```bash
export GITHUB_TOKEN=$(~/.proactive-engineer/scripts/refresh-github-token.sh)
export GH_TOKEN="$GITHUB_TOKEN"
git config --global user.name "Proactive Engineer"
git config --global user.email "proactive-engineer[bot]@users.noreply.github.com"
export GH_TOKEN=$(~/.proactive-engineer/scripts/refresh-github-token.sh)
export GITHUB_TOKEN="$GH_TOKEN"
```
*(The script automatically configures your git committer identity.)*
- **CRITICAL**: Each `exec` call runs in a fresh shell. Environment variables do NOT persist between calls. You MUST include the token setup in the SAME exec call as your git/gh commands. For example, chain everything in one command:
```bash
export GITHUB_TOKEN=$(...refresh script...) && export GH_TOKEN=$GITHUB_TOKEN && git push && GH_TOKEN=$GITHUB_TOKEN gh pr create --title "..." --body "..."
export GH_TOKEN=$(~/.proactive-engineer/scripts/refresh-github-token.sh) && export GITHUB_TOKEN=$GH_TOKEN && git push && gh pr create --title "..." --body "..."
```
- Never run `gh pr create` without `GH_TOKEN` set in the same shell, or it will use the host user's personal auth instead of the App token.
- Tokens expire every hour, so always refresh before git operations.
Expand Down
38 changes: 5 additions & 33 deletions terraform/user-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,43 +59,15 @@ else
export SLACK_APP_TOKEN='$SLACK_APP_TOKEN'
export SLACK_BOT_TOKEN='$SLACK_BOT_TOKEN'
export GITHUB_TOKEN='$GITHUB_TOKEN'
export GITHUB_APP_ID='$GITHUB_APP_ID'
export GITHUB_APP_INSTALLATION_ID='$GITHUB_APP_INSTALLATION_ID'
export GITHUB_APP_PEM_PATH='$GITHUB_APP_PEM_PATH'
export GEMINI_API_KEY='$GEMINI_API_KEY'
export AGENT_NAME='$AGENT_NAME'
export AGENT_DISPLAY_NAME='$AGENT_DISPLAY_NAME'
export SETUP_TAILSCALE='y'

curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard
export PATH=\"\$HOME/.npm-global/bin:\$HOME/.local/bin:\$PATH\"

REPO=refreshdotdev/proactive-engineer
INSTALL_DIR=\"\$HOME/.proactive-engineer\"
PROFILE_NAME=\"pe-\$AGENT_NAME\"
CONFIG_DIR=\"\$HOME/.openclaw-\$PROFILE_NAME\"
WORKSPACE_DIR=\"\$HOME/.openclaw/workspace-\$PROFILE_NAME\"
SKILL_DIR=\"\$HOME/.openclaw/skills/proactive-engineer\"

git clone --depth 1 https://github.com/\$REPO.git \"\$INSTALL_DIR\"

mkdir -p \"\$(dirname \$SKILL_DIR)\"
ln -sf \"\$INSTALL_DIR/skills/proactive-engineer\" \"\$SKILL_DIR\"

mkdir -p \"\$CONFIG_DIR\" \"\$WORKSPACE_DIR\"
for f in HEARTBEAT.md IDENTITY.md SOUL.md AGENTS.md; do
ln -sf \"\$INSTALL_DIR/skills/proactive-engineer/workspace/\$f\" \"\$WORKSPACE_DIR/\$f\" 2>/dev/null || true
done

cat > \"\$CONFIG_DIR/openclaw.json\" << CONF
{
\"gateway\": { \"mode\": \"local\", \"port\": 18789, \"auth\": { \"allowTailscale\": true }, \"tailscale\": { \"mode\": \"serve\" } },
\"env\": { \"GITHUB_TOKEN\": \"\$GITHUB_TOKEN\", \"GEMINI_API_KEY\": \"\$GEMINI_API_KEY\" },
\"agents\": { \"defaults\": { \"workspace\": \"\$WORKSPACE_DIR\", \"heartbeat\": { \"every\": \"30m\" }, \"model\": { \"primary\": \"google/gemini-3.1-pro-preview\" } } },
\"channels\": { \"slack\": { \"enabled\": true, \"appToken\": \"\$SLACK_APP_TOKEN\", \"botToken\": \"\$SLACK_BOT_TOKEN\", \"groupPolicy\": \"open\", \"channels\": { \"*\": { \"requireMention\": true } }, \"dmPolicy\": \"open\", \"allowFrom\": [\"*\"] } },
\"skills\": { \"entries\": { \"proactive-engineer\": { \"enabled\": true, \"env\": { \"AGENT_NAME\": \"\$AGENT_NAME\", \"AGENT_DISPLAY_NAME\": \"\$AGENT_DISPLAY_NAME\" } } } }
}
CONF

openclaw --profile \"\$PROFILE_NAME\" gateway install 2>/dev/null || true
systemctl --user enable \"openclaw-gateway-\$PROFILE_NAME\" 2>/dev/null || true
systemctl --user start \"openclaw-gateway-\$PROFILE_NAME\" 2>/dev/null || true
curl -fsSL https://raw.githubusercontent.com/refreshdotdev/proactive-engineer/main/install.sh | bash
"
fi

Expand Down