Mastermind profile

From monoes/monomind · View interactive version

Mastermind profile is an AI agent skill from the GitHub repository monoes/monomind. Mastermind profile — view and edit the operator profile, and show any user's activity, completion rate and token usage.

How to use this skill

Skill file

Mastermind Profile

This skill is invoked directly via /mastermind-profile.


Inputs


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 — Load Profile File

profileFile=".monomind/operator-profile.json"
[ ! -f "$profileFile" ] && cat > "$profileFile" <<'EOF'
{
  "id": "local-operator",
  "displayName": "Operator",
  "email": "",
  "theme": "system",
  "avatarInitials": "OP",
  "keyboardShortcutsEnabled": true,
  "createdAt": null
}
EOF

Step 2 — Execute Action

show (default)

echo "OPERATOR PROFILE"
echo "────────────────────────────────────────────────────────"
jq -r '
  "  ID:            \(.id // "local-operator")",
  "  Display name:  \(.displayName // "(not set)")",
  "  Email:         \(.email // "(not set)")",
  "  Theme:         \(.theme // "system")",
  "  Initials:      \(.avatarInitials // "OP")",
  "  Shortcuts:     \(.keyboardShortcutsEnabled // true)",
  "  Created:       \(.createdAt // "(local)")"
' "$profileFile"

echo ""
echo "  To edit: --action edit --display-name 'New Name'"
echo "  To view stats: --action stats"

edit

if [ -z "$display_name" ] && [ -z "$email" ] && [ -z "$theme" ]; then
  echo "ERROR: Provide at least one of: --display-name, --email, --theme (light|dark|system)"
  exit 1
fi

case "${theme:-}" in
  light|dark|system|"") : ;;
  *) echo "ERROR: --theme must be light, dark, or system"; exit 1 ;;
esac

tmp="${profileFile}.tmp"
jq \
  --arg name "${display_name:-}" \
  --arg email "${email:-}" \
  --arg theme "${theme:-}" \
  '(if $name != "" then .displayName = $name else . end) |
   (if $email != "" then .email = $email else . end) |
   (if $theme != "" then .theme = $theme else . end) |
   (if $name != "" then .avatarInitials = ($name | split(" ") |
     map(select(length > 0) | .[0:1] | ascii_upcase) | .[0:2] | join(""))
   else . end)' \
  "$profileFile" > "$tmp" && mv "$tmp" "$profileFile"

echo "Profile updated."
jq -r '"  displayName: \(.displayName)  email: \(.email)  theme: \(.theme)"' "$profileFile"

view-user

targetId="${user_id:-local-operator}"
echo "USER PROFILE — $targetId"
echo "────────────────────────────────────────────────────────"

# Try to find in instance access file
accessFile=".monomind/instance-access.json"
if [ -f "$accessFile" ]; then
  userEntry=$(jq -r --arg id "$targetId" '(.users // [])[] | select(.id == $id)' "$accessFile")
  if [ -n "$userEntry" ]; then
    isAdmin=$(echo "$userEntry" | jq -r '.isInstanceAdmin // false')
    orgs=$(echo "$userEntry" | jq -r '(.companyAccess // []) | join(", ")')
    echo "  ID:              $targetId"
    echo "  Instance admin:  $isAdmin"
    echo "  Org access:      ${orgs:-(none)}"
  else
    echo "  ID: $targetId"
    echo "  (User not found in instance access registry)"
  fi
else
  echo "  ID: $targetId  (no instance access file)"
fi

echo ""
echo "  For activity stats: --action stats --user-id $targetId"

stats

targetId="${user_id:-local-operator}"
echo "ACTIVITY STATS — $targetId"
echo "────────────────────────────────────────────────────────"

# Scan activity files for user contributions
totalRuns=0; successRuns=0; totalInputTokens=0; totalOutputTokens=0

for actFile in data/mastermind-sessions.json .monomind/orgs/*-activity.jsonl; do
  [ -f "$actFile" ] || continue
  if echo "$actFile" | grep -q "\.jsonl$"; then
    cnt=$(grep -c "\"actorId\":\"${targetId}\"" "$actFile" 2>/dev/null || echo 0)
    succ=$(grep "\"actorId\":\"${targetId}\"" "$actFile" 2>/dev/null | grep -c '"outcome":"success"' || echo 0)
    totalRuns=$((totalRuns + cnt))
    successRuns=$((successRuns + succ))
  fi
done

# Per-org if org_name set
if [ -n "$org_name" ]; then
  issuesFile=".monomind/orgs/${org_name}-issues.json"
  if [ -f "$issuesFile" ]; then
    assigned=$(jq --arg uid "$targetId" '[(.issues // [])[] | select(.assigneeId == $uid)] | length' "$issuesFile")
    echo "  Issues assigned (org $org_name): $assigned"
  fi
fi

completionRate=0
[ "$totalRuns" -gt 0 ] && completionRate=$((successRuns * 100 / totalRuns))

echo "  Total runs tracked:   $totalRuns"
echo "  Successful runs:      $successRuns"
echo "  Completion rate:      ${completionRate}%"
echo ""
echo "  (Token usage stats require agent run logs with token tracking enabled)"

Step 3 — Return Output

domain: ops
status: complete
action: <action>
user_id: <user_id or local-operator>

Step 4 — Brain Write (standalone only)

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

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.