Skip to content
Back to skills

Mastermind Bootstrap

BSecurity

Mastermind bootstrap — one-time org initialization that primes the CEO/boss agent with org context, goal hierarchy, and a signed invite token. Run after createorg before first runorg.

  • 21 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 10, 2026
ai-agentspythongobash

Security analysis

B88/100
  • criticalSends environment variables or credentials to an external URL

Pro shows the line behind each finding and how to fix it

Scanned October 1, 2026

npx -y skills add monoes/monomind --skill mastermind-bootstrap --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Mastermind Bootstrap?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Mastermind Bootstrap
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/monoes-mastermind-bootstrap/badge)](https://www.skillsdirectory.com/skills/monoes-mastermind-bootstrap)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: mastermind-bootstrap
description: Mastermind bootstrap — one-time org initialization that primes the CEO/boss agent with org context, goal hierarchy, and a signed invite token. Run after createorg before first runorg.
type: domain-skill
default_mode: confirm
---

# Mastermind Bootstrap

This skill is invoked directly via `/mastermind-bootstrap`.

---

## Inputs

- `brain_context`: BRAIN CONTEXT block (injected by command, or loaded below if standalone)
- `org_name`: org to bootstrap (required)
- `action`: init | token | status | reset
- `boss_role_id`: role ID of the CEO/boss agent (default: auto-detect by `reports_to: null`)
- `caller`: command | master

---

## Step 0 — Brain Load (standalone only)

If `caller` is not "command", load brain context following mastermind-protocol/SKILL.md Brain Load Procedure with namespace: `ops`.

---

## Step 1 — Resolve Org

```bash
orgFile=".monomind/orgs/${org_name}.json"
[ ! -f "$orgFile" ] && { echo "ERROR: Org '${org_name}' not found. Run /mastermind:createorg first."; exit 1; }

bootstrapFile=".monomind/orgs/${org_name}-bootstrap.json"
```

---

## Step 2 — Execute Action

### status (check bootstrap state)

```bash
if [ -f "$bootstrapFile" ]; then
  echo "BOOTSTRAP STATUS — ${org_name}"
  echo "──────────────────────────────────"
  jq -r '
    "  State:       \(.state // "unknown")",
    "  Boss Role:   \(.boss_role_id // "-")",
    "  Bootstrapped:\(.bootstrapped_at // "never")",
    "  Token:       \(if .invite_token then (.invite_token | .[0:8]) + "..." else "none" end)",
    "  Token used:  \(.token_used // false)"
  ' "$bootstrapFile"
else
  echo "Not bootstrapped. Run /mastermind-bootstrap --org ${org_name} --action init"
fi
```

### token (generate a fresh invite token)

Generate a signed one-time token the boss agent uses to authenticate its first session:

```bash
token=$(openssl rand -hex 24 2>/dev/null || python3 -c "import secrets; print(secrets.token_hex(24))")
ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)

echo "INVITE TOKEN — ${org_name}"
echo "──────────────────────────────────"
echo "  Token: $token"
echo "  Valid until first use."
echo ""

# Store token in bootstrap file
[ ! -f "$bootstrapFile" ] && echo '{}' > "$bootstrapFile"
tmp="${bootstrapFile}.tmp"
jq --arg token "$token" --arg ts "$ts" \
  '.invite_token = $token | .token_generated_at = $ts | .token_used = false' \
  "$bootstrapFile" > "$tmp" && mv "$tmp" "$bootstrapFile"
echo "Token stored. Include in boss agent prompt as: INVITE_TOKEN=${token}"
```

### init (full bootstrap)

Initialize org bootstrap: detect boss, generate token, write primer context:

```bash
# Auto-detect boss (role with no reports_to or reports_to: null)
if [ -z "$boss_role_id" ]; then
  boss_role_id=$(jq -r '(.roles // [])[] | select(.reports_to == null or .reports_to == "") | .id' "$orgFile" | head -1)
fi
[ -z "$boss_role_id" ] && { echo "ERROR: Could not detect boss role. Pass --boss-role-id <id>."; exit 1; }

bossConfig=$(jq --arg id "$boss_role_id" '(.roles // [])[] | select(.id == $id)' "$orgFile")
bossTitle=$(echo "$bossConfig" | jq -r '.title // "CEO"')
orgGoal=$(jq -r '.goal // "No goal set"' "$orgFile")
orgTopology=$(jq -r '.topology // "hierarchical"' "$orgFile")
roleCount=$(jq '.roles | length' "$orgFile")
governance=$(jq -r '.governance.policy // "auto"' "$orgFile")

# Generate invite token
token=$(openssl rand -hex 24 2>/dev/null || python3 -c "import secrets; print(secrets.token_hex(24))")
ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)

# Write bootstrap record
cat > "$bootstrapFile" <<EOF
{
  "org": "${org_name}",
  "state": "initialized",
  "boss_role_id": "${boss_role_id}",
  "boss_title": "${bossTitle}",
  "org_goal": "${orgGoal}",
  "topology": "${orgTopology}",
  "role_count": ${roleCount},
  "governance": "${governance}",
  "invite_token": "${token}",
  "token_used": false,
  "token_generated_at": "${ts}",
  "bootstrapped_at": "${ts}"
}
EOF

echo "BOOTSTRAP COMPLETE — ${org_name}"
echo "──────────────────────────────────────────"
echo "  Boss:       ${bossTitle} (${boss_role_id})"
echo "  Goal:       ${orgGoal}"
echo "  Topology:   ${orgTopology}"
echo "  Agents:     ${roleCount}"
echo "  Governance: ${governance}"
echo "  Token:      ${token}"
echo ""
echo "CEO PRIMER (include in boss agent prompt):"
echo "──────────────────────────────────────────"
cat <<PRIMER
ORG: ${org_name}
ROLE: ${bossTitle}
GOAL: ${orgGoal}
GOVERNANCE: ${governance}
INVITE_TOKEN: ${token}

You are the autonomous CEO of org '${org_name}'. Your mission: ${orgGoal}.
You lead ${roleCount} agents in a ${orgTopology} topology.
Governance mode: ${governance}. In 'board' or 'strict' mode, pause before high-risk actions and emit approval requests.
Use your INVITE_TOKEN for your first heartbeat. Token is single-use.
PRIMER
```

### reset

Clear bootstrap state (next init will regenerate token):

```bash
if [ -f "$bootstrapFile" ]; then
  rm "$bootstrapFile"
  echo "Bootstrap state cleared for '${org_name}'. Run --action init to re-bootstrap."
else
  echo "No bootstrap file found for '${org_name}'."
fi
```

---

## Step 3 — Return Output

```yaml
domain: ops
status: complete
action: <action>
org: <org_name>
boss_role_id: <boss_role_id>
state: initialized | token | reset
```

---

## Step 4 — Brain Write (standalone only)

If `caller` is not "command", follow mastermind-protocol/SKILL.md Brain Write Procedure for domain `ops`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.