---
description: Launch an employee session with isolated config and memory tracking
allowed-tools: Bash, Read, Edit, Write, Glob, Grep, recall_my_memory, ask_team_memory, get_session_context, store_memory
argument-hint: [employee-name]
---

Load the named employee and become them for this session, or launch them in a new tmux window.

## 0. tmux gate (mandatory)

```bash
# Robust tmux detection — handles su/sudo login shells (env vars stripped)
([ -n "$TMUX" ] || [ -n "$TMUX_PANE" ] || [[ "$TERM" == tmux* ]] || [[ "$TERM" == screen* ]] || tmux display-message -p '#{session_name}' >/dev/null 2>&1) && echo "TMUX_OK" || echo "TMUX_MISSING"
```

If `TMUX_MISSING`, show this message EXACTLY and STOP — do not launch any employee:

```
═══════════════════════════════════════════════
 tmux is required for exe-os multi-agent.

 Start tmux first, then launch claude:

   tmux new-session -s work
   claude
   /exe

 Why: exe-os uses tmux for instant cross-session
 communication between employees. Without it,
 task dispatch, parallel execution, and agent
 coordination don't work.

 Install tmux:
   macOS:  brew install tmux
   Linux:  apt install tmux

 New to tmux? https://tmuxcheatsheet.com
═══════════════════════════════════════════════
```

## 0b. Validate employee

Load the employee roster and find the employee:
```bash
cat ~/.exe-os/exe-employees.json 2>/dev/null || echo "NO_ROSTER"
```

If the employee name from $ARGUMENTS is not found in the roster, tell the user:
> Employee not found. Run `/exe-team` to see available employees, or `/exe-new-employee <name>` to create one.

## 0c. Session routing — launch vs become

Check the current tmux session name to decide if we're in an employee session or the coordinator session:
```bash
NAME="$ARGUMENTS"
CURRENT_SESSION=$(tmux display-message -p '#{session_name}' 2>/dev/null)
echo "CURRENT_SESSION=${CURRENT_SESSION} TARGET=${NAME}"
```

Employee sessions are named `{name}-{coordinatorSession}` or `{name}{N}-{coordinatorSession}` for multi-instance.

**If CURRENT_SESSION matches `{NAME}-` or `{NAME}{digit}-`** (auto-launched into employee session):
- Continue below to become the employee.

**Otherwise** (user is calling from their coordinator session):
- Ensure the employee is running (check → intercom or spawn) and STOP:
```bash
NAME="$ARGUMENTS"
EXE_SESSION=$(tmux display-message -p '#{session_name}' 2>/dev/null)
RESULT=$(node -e "const {ensureEmployee}=require('$(npm root -g)/@askexenow/exe-os/dist/lib/tmux-routing.js'); const r=ensureEmployee('${NAME}','${EXE_SESSION}','$(pwd)'); console.log(JSON.stringify(r));")
echo "$RESULT"
```
Report the result and STOP HERE. Do not continue to step 1.

---

If found, read their system prompt from the roster. Then:

1. Write agent marker, register parent, create folders, and scan tasks — ALL IN ONE CALL:
```bash
NAME="$ARGUMENTS"
ROLE="$(NAME="$ARGUMENTS" node -e "const e = JSON.parse(require('fs').readFileSync(require('os').homedir()+'/.exe-os/exe-employees.json','utf8')); const emp = e.find(x=>x.name===process.env.NAME); console.log(emp?.role||'specialist')")"
KEY=$$ && while [ "$KEY" -gt 1 ] 2>/dev/null; do CMD=$(ps -p $KEY -o comm= 2>/dev/null); case "$CMD" in *claude*) break ;; esac; KEY=$(ps -p $KEY -o ppid= 2>/dev/null | tr -d ' '); done
mkdir -p ~/.exe-os/session-cache "exe/$NAME" exe/output exe/research
NAME="$NAME" ROLE="$ROLE" KEY="$KEY" node -e "require('fs').writeFileSync(require('os').homedir()+'/.exe-os/session-cache/active-agent-'+process.env.KEY+'.json', JSON.stringify({agentId:process.env.NAME, agentRole:process.env.ROLE, startedAt:new Date().toISOString()}))" 2>/dev/null
MY_SESSION=$(tmux display-message -p '#{session_name}' 2>/dev/null)
DISPATCH_INFO="$HOME/.exe-os/session-cache/dispatch-info-${MY_SESSION}.json"
DISPATCHED_BY=$(node -e "try{const d=JSON.parse(require('fs').readFileSync('$DISPATCH_INFO','utf8'));console.log(d.dispatchedBy||'')}catch{console.log('')}" 2>/dev/null)
node -e "const {parseParentExe,registerParentExe}=require('$(npm root -g)/@askexenow/exe-os/dist/lib/tmux-routing.js'); const p=parseParentExe('$MY_SESSION','$NAME'); if(p) registerParentExe('$KEY',p,'$DISPATCHED_BY'||undefined);" 2>/dev/null
if [ -f .gitignore ]; then grep -q '^/exe/$' .gitignore 2>/dev/null || echo -e '\n# Employee task assignments (private)\n/exe/' >> .gitignore; else echo -e '# Employee task assignments (private)\n/exe/' > .gitignore; fi
export AGENT_ID="${NAME}" AGENT_ROLE="${ROLE}" EXE_SESSION_KEY="${KEY}" EXE_RUNTIME="claude"
echo "Agent: ${NAME} (${ROLE}) [key=${KEY}]"
node "$(npm root -g)/@askexenow/exe-os/dist/bin/scan-tasks.js" "exe/$NAME" --format=mandatory 2>/dev/null
```

2. Check memories — use `recall_my_memory` for past context, `ask_team_memory` for coordinator instructions. Do this ONLY if no MANDATORY task was found above. If a task was found, skip memory recall and start working immediately.

4. **Adopt the employee's identity.** Read and follow their system prompt from the roster. You ARE this employee for the rest of the conversation. Stay in character.

5. If the scan output contains "MANDATORY" or "Continue working on":
   - Read the task file referenced in the output
   - Begin working immediately — do NOT greet the user, do NOT ask what to do
   - If "Continue working on": resume the in-progress task
   - If "MANDATORY": start the highest-priority open task

6. If the scan output is empty (no open tasks):
> [name] online. No open tasks. What do you need?
