# team-code-expert Initialization

**Hello! Please complete the following initialization steps for team-code-expert:**

---

## 1. Environment Variables

**Note**: Environment variables are automatically synced from the host to your container by the `container-env-check` script. However, you can verify they are set:

```bash
# Check if environment variables are available
echo "MINIMAX_API_KEY: $MINIMAX_API_KEY"
echo "GITHUB_APP_ID: $GITHUB_APP_ID"
```

If they are empty, you can either:
- Wait for `container-env-check` to sync them (runs periodically)
- Or ask the administrator to run `container-env-check` manually

---

## 2. Install gh CLI (if not installed)

**IMPORTANT**: Do this FIRST, before cloning the repository!

```bash
type gh || (curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null && sudo apt update && sudo apt install gh)
```

---

## 3. Clone ai-configuration Repository

**IMPORTANT**: Do this step FIRST, before creating symlinks!

```bash
mkdir -p ~/github
cd ~/github
git clone https://github.com/tidbcloud/data-service-infra-ai-configurations.git
cd data-service-infra-ai-configurations
```

Verify the clone was successful:
```bash
ls -la ~/github/data-service-infra-ai-configurations/memories/team-code-expert/
```

You should see files like: AGENTS.md, SOUL.md, USER.md, IDENTITY.md, HEARTBEAT.md, configuration.md

---

## 4. Configure GitHub App Authentication

```bash
# Generate GitHub App token
~/.github-app/github-app-token.sh
# Verify
gh auth status
```

---

## 5. Link Workspace Files

First, remove existing files in `~/.openclaw/workspace/` that will be replaced:

```bash
rm -f ~/.openclaw/workspace/AGENTS.md
rm -f ~/.openclaw/workspace/SOUL.md
rm -f ~/.openclaw/workspace/USER.md
rm -f ~/.openclaw/workspace/IDENTITY.md
rm -f ~/.openclaw/workspace/HEARTBEAT.md
rm -f ~/.openclaw/workspace/configuration.md
```

Then create symlinks (make sure you cloned the repo in step 3 first!):

```bash
cd ~/github/data-service-infra-ai-configurations

# Link bootstrap files
ln -sf memories/team-code-expert/AGENTS.md ~/.openclaw/workspace/AGENTS.md
ln -sf memories/team-code-expert/SOUL.md ~/.openclaw/workspace/SOUL.md
ln -sf memories/team-code-expert/USER.md ~/.openclaw/workspace/USER.md
ln -sf memories/team-code-expert/IDENTITY.md ~/.openclaw/workspace/IDENTITY.md
ln -sf memories/team-code-expert/HEARTBEAT.md ~/.openclaw/workspace/HEARTBEAT.md

# Link configuration file
ln -sf ../data-service-infra-ai-configurations/memories/team-code-expert/configuration.md ~/.openclaw/workspace/configuration.md
```

---

## 6. Load Skills

Link the following skill directories to `~/.openclaw/workspace/skills/`:

```bash
cd ~/.openclaw/workspace/skills

# team-code-expert specific skills
ln -sf ~/github/data-service-infra-ai-configurations/skills/team-code-expert/claude-code-dispatch ./claude-code-dispatch
ln -sf ~/github/data-service-infra-ai-configurations/skills/team-code-expert/pr-review-daemon ./pr-review-daemon
ln -sf ~/github/data-service-infra-ai-configurations/skills/team-code-expert/tidbcloud-github-access ./tidbcloud-github-access

# Common skills
ln -sf ~/github/data-service-infra-ai-configurations/skills/team-common/jira-issue-ops ./jira-issue-ops
```

---

**Report back when complete:**
- ✅ / ❌ Environment variables (list each value)
- ✅ / ❌ gh CLI installed
- ✅ / ❌ Repository clone status
- ✅ / ❌ Workspace symlinks created
- ✅ / ❌ Skills loaded
