AGENT SKILL

mastermind-invites

Deprecated: bookkeeping only — not enforced by the Org Runtime. Mastermind invites: Creates, revokes and lists invites and join requests in side files; accepting grants no access.

License 许可
Apache-2.0
所属仓库
monoes/monomind
最近更新
2026-11-14
Stars
★ 23
Forks
2

01 前言 Front Matter

name
mastermind-invites
pick
low
type
domain-skill
description
Deprecated: bookkeeping only — not enforced by the Org Runtime. Mastermind invites: Creates, revokes and lists invites and join requests in side files; accepting grants no access.
default_mode
confirm

03 SKILL.md 正文

Mastermind Invites

This skill is invoked directly via /mastermind-invites.

Bookkeeping only — not enforced by the Org Runtime. It writes .monomind/orgs/<org>-members.json, which no runtime code reads: invites, members, and approved join requests grant no access to anything.

On first use in a session, print this one line before doing anything else: WARNING: mastermind-invites is a ledger only - nothing is enforced by the Org Runtime.


Inputs

  • brain_context: BRAIN CONTEXT block (injected by command, or loaded below if standalone)
  • org_name: org to manage invites for (required)
  • action: list | create | revoke | copy-url | join-queue | approve-join | reject-join
  • role: owner | admin | operator | viewer (for create; default: operator)
  • invite_id: invite id/token (for revoke/copy-url)
  • request_id: join request id (for approve-join/reject-join)
  • request_type: all | human | agent (for join-queue; default: all)
  • status_filter: pending_approval | approved | rejected (for join-queue; default: pending_approval)
  • caller: command | master

Invite Roles

Role Can Do
owner Full control — all permissions
admin Create agents, invite users, assign tasks, approve joins, manage environments
operator Assign tasks, run routines
viewer Read-only access

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 Members File

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

membersFile=".monomind/orgs/${org_name}-members.json"
[ ! -f "$membersFile" ] && echo '{"members":[],"join_requests":[]}' > "$membersFile"

Step 2 — Execute Action

list (default)

Show invite history and member count:

echo "INVITES — org: $org_name"
echo "────────────────────────────────────────────────────────"

# Active invites (pending in join_requests with type=invite)
activeInvites=$(jq '[(.join_requests // [])[] | select(.type == "invite" and .status == "pending")] | length' "$membersFile")
totalMembers=$(jq '.members | length' "$membersFile")
pendingJoins=$(jq '[(.join_requests // [])[] | select(.type != "invite" and .status == "pending_approval")] | length' "$membersFile")

echo "  Members:          $totalMembers"
echo "  Pending invites:  $activeInvites"
echo "  Pending joins:    $pendingJoins"
echo ""

if [ "$activeInvites" -gt 0 ]; then
  echo "ACTIVE INVITES"
  printf "  %-28s %-10s %-20s %s\n" "TOKEN" "ROLE" "CREATED" "URL"
  echo "  ────────────────────────────────────────────────────────"
  jq -r '(.join_requests // [])[] | select(.type == "invite" and .status == "pending") |
    [.token, (.role // "operator"), (.createdAt // "-"), (.inviteUrl // "-")] | @tsv' \
    "$membersFile" | while IFS=$'\t' read -r tok role ts url; do
    printf "  %-28s %-10s %-20s %s\n" "${tok:0:24}…" "$role" "$ts" "${url:0:40}…"
  done
fi

echo ""
echo "  To create a new invite: --action create --role <role>"
[ "$pendingJoins" -gt 0 ] && echo "  To review join requests: --action join-queue"

create

role="${role:-operator}"
case "$role" in owner|admin|operator|viewer) : ;; *)
  echo "ERROR: --role must be: owner, admin, operator, viewer"; exit 1 ;;
esac

token=$(openssl rand -hex 20 2>/dev/null || python3 -c "import secrets; print(secrets.token_hex(20))")
inviteUrl="monomind://invite?org=${org_name}&token=${token}&role=${role}"
ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)

tmp="${membersFile}.tmp"
jq --arg token "$token" --arg role "$role" --arg ts "$ts" --arg url "$inviteUrl" \
  '.join_requests += [{"id":$token,"type":"invite","role":$role,"status":"pending",
    "token":$token,"inviteUrl":$url,"createdAt":$ts}]' \
  "$membersFile" > "$tmp" && mv "$tmp" "$membersFile"

echo "INVITE CREATED"
echo "────────────────────────────────────────────────────────"
echo "  Role:  $role"
echo "  Token: $token"
echo "  URL:   $inviteUrl"
echo "  Time:  $ts"
echo ""
echo "Share the token or URL with the invitee."
echo "To copy URL hint: --action copy-url --invite-id $token"

revoke

[ -z "$invite_id" ] && { echo "ERROR: --invite-id required."; exit 1; }

# Find the invite
inviteExists=$(jq -r --arg id "$invite_id" \
  '[(.join_requests // [])[] | select((.id == $id or .token == $id) and .type == "invite")] | length' \
  "$membersFile")
[ "$inviteExists" -eq 0 ] && { echo "ERROR: Invite '$invite_id' not found or already resolved."; exit 1; }

ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)
tmp="${membersFile}.tmp"
jq --arg id "$invite_id" --arg ts "$ts" \
  '.join_requests = [(.join_requests // [])[] | if (.id == $id or .token == $id) then
     .status = "revoked" | .resolvedAt = $ts
   else . end]' \
  "$membersFile" > "$tmp" && mv "$tmp" "$membersFile"

echo "Invite revoked: $invite_id"
echo "  Revoked at: $ts"

copy-url

[ -z "$invite_id" ] && { echo "ERROR: --invite-id required."; exit 1; }

inviteUrl=$(jq -r --arg id "$invite_id" \
  '(.join_requests // [])[] | select(.id == $id or .token == $id) | .inviteUrl // ""' \
  "$membersFile")
[ -z "$inviteUrl" ] && { echo "ERROR: Invite '$invite_id' not found."; exit 1; }

echo "INVITE URL"
echo "────────────────────────────────────────────────────────"
echo "$inviteUrl"
echo ""
echo "(Copy the URL above to share with the invitee)"
# Try to copy to clipboard if pbcopy/xclip available
echo "$inviteUrl" | pbcopy 2>/dev/null && echo "(Copied to clipboard)" || true

join-queue

statusFilter="${status_filter:-pending_approval}"
typeFilter="${request_type:-all}"

echo "JOIN REQUEST QUEUE — org: $org_name"
echo "  Filter: status=$statusFilter  type=$typeFilter"
echo "────────────────────────────────────────────────────────"

jq -r --arg st "$statusFilter" --arg type "$typeFilter" '
  (.join_requests // [])[] |
  select(
    (.status == $st) and
    (.type != "invite") and
    (if $type == "all" then true
     elif $type == "human" then (.requestType == "human" or .requestType == null)
     else .requestType == "agent"
     end)
  ) |
  [.id, (.requestType // "human"), (.role // "viewer"), (.createdAt // "-"), (.message // "(no message)")] | @tsv
' "$membersFile" | while IFS=$'\t' read -r id rtype role ts msg; do
  echo ""
  echo "  [$id]  type=$rtype  role=$role  at=$ts"
  echo "  Message: $msg"
  echo "  → approve: --action approve-join --request-id $id"
  echo "  → reject:  --action reject-join  --request-id $id"
done

total=$(jq --arg st "$statusFilter" '[(.join_requests // [])[] | select(.status == $st and .type != "invite")] | length' "$membersFile")
[ "$total" -eq 0 ] && echo "  No join requests with status='$statusFilter'."
echo ""
echo "Total ($statusFilter): $total"

approve-join

[ -z "$request_id" ] && { echo "ERROR: --request-id required."; exit 1; }

reqRole=$(jq -r --arg id "$request_id" \
  '(.join_requests // [])[] | select(.id == $id) | .role // "viewer"' "$membersFile")
[ -z "$reqRole" ] && { echo "ERROR: Request '$request_id' not found."; exit 1; }

ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)
tmp="${membersFile}.tmp"
jq --arg id "$request_id" --arg role "$reqRole" --arg ts "$ts" \
  '.join_requests = [(.join_requests // [])[] | if .id == $id then .status = "approved" | .resolvedAt = $ts else . end] |
   .members += [{"id":$id,"role":$role,"status":"active","grants":[],"joinedAt":$ts}]' \
  "$membersFile" > "$tmp" && mv "$tmp" "$membersFile"

echo "Join request '$request_id' approved."
echo "  Role: $reqRole  |  Joined: $ts"
echo "  Member added. View members: /mastermind-access --org $org_name --action list"

reject-join

[ -z "$request_id" ] && { echo "ERROR: --request-id required."; exit 1; }

exists=$(jq -r --arg id "$request_id" '[(.join_requests // [])[] | select(.id == $id)] | length' "$membersFile")
[ "$exists" -eq 0 ] && { echo "ERROR: Request '$request_id' not found."; exit 1; }

ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)
tmp="${membersFile}.tmp"
jq --arg id "$request_id" --arg ts "$ts" \
  '.join_requests = [(.join_requests // [])[] | if .id == $id then .status = "rejected" | .resolvedAt = $ts else . end]' \
  "$membersFile" > "$tmp" && mv "$tmp" "$membersFile"

echo "Join request '$request_id' rejected."

Step 3 — Return Output

domain: ops
status: complete
action: <action>
org: <org_name>
pending_invites: <N>
pending_joins: <N>

Step 4 — Brain Write (standalone only)

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

04 同仓库更多 Skills

monoes
monoes/monomind

isms-audit-expert

Use when planning or running an ISO 27001 ISMS audit: risk-based audit schedules, Annex A control assessment, Statement of Applicability and nonconformities. Auditor-side procedures, versus compliance-auditor, which is org role guidance across SOC 2, HIPAA and PCI-DSS.

★ 23
monoes
monoes/monomind

instrument-data-to-allotrope

Convert laboratory instrument output files (PDF, CSV, Excel, TXT) to Allotrope Simple Model (ASM) JSON format or flattened 2D CSV. Use this skill when scientists need to standardize instrument data for LIMS systems, data lakes, or downstream analysis. Supports auto-detection of instrument types. Outputs include full ASM JSON, flattened CSV for easy import, and exportable Python code for data engineers. Common triggers include converting instrument files, standardizing lab data, preparing data for upload to LIMS/ELN systems, or generating parser code for production pipelines.

★ 23
monoes
monoes/monomind

experiment-designer

Use when planning a product A/B or multivariate test: If/Then/Because hypotheses, primary and guardrail metrics, sample size and MDE, ICE prioritization. For logging and reproducing ML runs use experiment-tracker; for scientific study design use experimental-design.

★ 23
monoes
monoes/monomind

digest

Generate a daily or weekly digest of activity across all connected sources. Use when catching up after time away, starting the day and wanting a summary of mentions and action items, or reviewing a week's decisions and document updates grouped by project.

★ 23
monoes
monoes/monomind

design-critique

Get structured design feedback on usability, hierarchy, and consistency. Trigger with "review this design", "critique this mockup", "what do you think of this screen?", or when sharing a Figma link or screenshot for feedback at any stage from exploration to final polish.

★ 23
monoes
monoes/monomind

deployment-pipeline-design

Use when architecting a multi-stage CI/CD pipeline with approval gates, SAST and DAST scans, environment promotion, canary rollout and automated rollback. Design-level; for concrete Dockerfile and health check patterns use deployment-patterns.

★ 23