Mastermind join queue

From monoes/monomind · View interactive version

Mastermind join queue is an AI agent skill from the GitHub repository monoes/monomind. Deprecated: bookkeeping only — not enforced by the Org Runtime. Mastermind join-queue: Lists, approves or rejects join requests recorded in a side file, by type and status.

How to use this skill

Skill file

Mastermind Join Queue

This skill is invoked directly via /mastermind-join-queue.

Bookkeeping only — not enforced by the Org Runtime. It reads and writes .monomind/orgs/<org>-join-requests.json, which no runtime code reads: approving a request grants no access.

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


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 Org

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

joinFile=".monomind/orgs/${org_name}-join-requests.json"

Step 2 — Execute Action

list (default)

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

echo "JOIN REQUESTS — $org_name  (status: $statusFilter  type: $typeFilter)"
echo "────────────────────────────────────────────────────────"

if [ ! -f "$joinFile" ]; then
  echo "  No join requests found."
  echo ""
  echo "  Approve: /mastermind-join-queue --org $org_name --action approve --request-id <id>"
  exit 0
fi

python3 - "$joinFile" "$statusFilter" "$typeFilter" <<'PYEOF'
import json, sys
data = json.load(open(sys.argv[1]))
status_f = sys.argv[2]
type_f   = sys.argv[3]

requests = data.get("requests", [])
filtered = [r for r in requests
  if r.get("status") == status_f
  and (type_f == "all" or r.get("type") == type_f)]

if not filtered:
  print("  (no matching requests)")
else:
  print(f"  {'ID':<32} {'TYPE':<8} {'REQUESTER':<28} {'STATUS':<20} {'CREATED'}")
  print("  " + "─" * 102)
  for r in filtered:
    rid     = r.get("id","?")[:32]
    rtype   = r.get("type","?")[:8]
    req     = (r.get("requesterName") or r.get("requesterId","?"))[:28]
    st      = r.get("status","?")[:20]
    created = r.get("createdAt","-")[:10]
    print(f"  {rid:<32} {rtype:<8} {req:<28} {st:<20} {created}")

print(f"\n  Total: {len(filtered)} request(s) (status={status_f}, type={type_f})")
PYEOF

echo ""
echo "  Approve: /mastermind-join-queue --org $org_name --action approve --request-id <id>"
echo "  Reject:  /mastermind-join-queue --org $org_name --action reject  --request-id <id>"

approve

[ -z "$request_id" ] && { echo "ERROR: --request-id required."; exit 1; }
[ ! -f "$joinFile" ] && { echo "ERROR: No join requests file found for org '${org_name}'."; exit 1; }

ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)

python3 - "$joinFile" "$request_id" "$ts" <<'PYEOF'
import json, sys
path, rid, ts = sys.argv[1], sys.argv[2], sys.argv[3]
data = json.load(open(path))
requests = data.get("requests", [])
found = False
for r in requests:
    if r.get("id") == rid:
        r["status"] = "approved"
        r["resolvedAt"] = ts
        found = True
        break
if not found:
    print(f"ERROR: Request '{rid}' not found.")
    sys.exit(1)
data["requests"] = requests
with open(path, "w") as f:
    json.dump(data, f, indent=2)
print(f"  Approved: {rid}  (resolvedAt: {ts})")
PYEOF

reject

[ -z "$request_id" ] && { echo "ERROR: --request-id required."; exit 1; }
[ ! -f "$joinFile" ] && { echo "ERROR: No join requests file found for org '${org_name}'."; exit 1; }

ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)

python3 - "$joinFile" "$request_id" "$ts" <<'PYEOF'
import json, sys
path, rid, ts = sys.argv[1], sys.argv[2], sys.argv[3]
data = json.load(open(path))
requests = data.get("requests", [])
found = False
for r in requests:
    if r.get("id") == rid:
        r["status"] = "rejected"
        r["resolvedAt"] = ts
        found = True
        break
if not found:
    print(f"ERROR: Request '{rid}' not found.")
    sys.exit(1)
data["requests"] = requests
with open(path, "w") as f:
    json.dump(data, f, indent=2)
print(f"  Rejected: {rid}  (resolvedAt: {ts})")
PYEOF

Step 3 — Return Output

domain: ops
status: complete
action: <action>
org_name: <org_name>
status_filter: <status>
type_filter: <request_type>

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.