AGENT SKILL

mastermind-search

Mastermind search — fuzzy cross-org search across tasks, goals, agents, approvals, routines, projects, and activity log. Returns ranked results with org context.

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

01 前言 Front Matter

name
mastermind-search
pick
low
type
domain-skill
description
Mastermind search — fuzzy cross-org search across tasks, goals, agents, approvals, routines, projects, and activity log. Returns ranked results with org context.
default_mode
auto

03 SKILL.md 正文

Mastermind Search

This skill is invoked directly via /mastermind-search.


Inputs

  • brain_context: BRAIN CONTEXT block (injected by command, or loaded below if standalone)
  • query: search term (required)
  • org_name: filter to a specific org (optional — searches all orgs if omitted)
  • scope: all | tasks | goals | agents | approvals | routines | projects | activity (default: all)
  • limit: max results per category (default: 10)
  • 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 Orgs

if [ -n "$org_name" ]; then
  orgs="$org_name"
else
  orgs=$(ls .monomind/orgs/*.json 2>/dev/null | grep -vE -- '-approvals|-state|-activity|-goals|-routines|-projects|-members|-issues|-workspaces|-worktrees|-environments|-plugins|-adapters|-bootstrap|-threads|-budgets|-project-workspaces|-approval-comments' | xargs -I{} basename {} .json | sort)
fi
[ -z "$orgs" ] && { echo "No orgs found. Run /mastermind:createorg first."; exit 0; }

Step 2 — Search All Scopes

query_lower=$(echo "$query" | tr '[:upper:]' '[:lower:]')
limit="${limit:-10}"
total_hits=0

echo "SEARCH: \"${query}\""
echo "════════════════════════════════════════════════"
echo ""

for org in $orgs; do
  orgFile=".monomind/orgs/${org}.json"
  [ ! -f "$orgFile" ] && continue

  org_hits=0

  # ── Agents ────────────────────────────────────────
  if [ "$scope" = "all" ] || [ "$scope" = "agents" ]; then
    hits=$(jq -r --arg q "$query_lower" \
      '(.roles // [])[] | select((.id + " " + .title + " " + (.responsibilities // [] | join(" "))) | ascii_downcase | test($q)) |
       "[AGENT] \(.id): \(.title)  type=\(.agent_type)"' \
      "$orgFile" 2>/dev/null | head -"$limit")
    if [ -n "$hits" ]; then
      echo "── $org / agents ──"
      echo "$hits"
      echo ""
      org_hits=$((org_hits + $(echo "$hits" | wc -l)))
    fi
  fi

  # ── Goals ─────────────────────────────────────────
  goalsFile=".monomind/orgs/${org}-goals.json"
  if [ -f "$goalsFile" ] && { [ "$scope" = "all" ] || [ "$scope" = "goals" ]; }; then
    hits=$(jq -r --arg q "$query_lower" \
      '(.goals // [])[] | select((.title + " " + (.description // "") + " " + (.status // "")) | ascii_downcase | test($q)) |
       "[GOAL] [\(.id)] \(.title)  status=\(.status // "open")"' \
      "$goalsFile" 2>/dev/null | head -"$limit")
    if [ -n "$hits" ]; then
      echo "── $org / goals ──"
      echo "$hits"
      echo ""
      org_hits=$((org_hits + $(echo "$hits" | wc -l)))
    fi
  fi

  # ── Routines ──────────────────────────────────────
  routinesFile=".monomind/orgs/${org}-routines.json"
  if [ -f "$routinesFile" ] && { [ "$scope" = "all" ] || [ "$scope" = "routines" ]; }; then
    hits=$(jq -r --arg q "$query_lower" \
      '(.routines // [])[] | select((.name + " " + (.description // "") + " " + (.schedule // "")) | ascii_downcase | test($q)) |
       "[ROUTINE] \(.name)  schedule=\(.schedule // "-")"' \
      "$routinesFile" 2>/dev/null | head -"$limit")
    if [ -n "$hits" ]; then
      echo "── $org / routines ──"
      echo "$hits"
      echo ""
      org_hits=$((org_hits + $(echo "$hits" | wc -l)))
    fi
  fi

  # ── Approvals ─────────────────────────────────────
  approvalsFile=".monomind/orgs/${org}-approvals.json"
  if [ -f "$approvalsFile" ] && { [ "$scope" = "all" ] || [ "$scope" = "approvals" ]; }; then
    hits=$(jq -r --arg q "$query_lower" \
      '(.approvals // [])[] | select((.title + " " + (.action // "") + " " + (.agent_id // "")) | ascii_downcase | test($q)) |
       "[APPROVAL] [\(.id)] \(.agent_id): \(.title)  status=\(.status)"' \
      "$approvalsFile" 2>/dev/null | head -"$limit")
    if [ -n "$hits" ]; then
      echo "── $org / approvals ──"
      echo "$hits"
      echo ""
      org_hits=$((org_hits + $(echo "$hits" | wc -l)))
    fi
  fi

  # ── Projects ──────────────────────────────────────
  projectsFile=".monomind/orgs/${org}-projects.json"
  if [ -f "$projectsFile" ] && { [ "$scope" = "all" ] || [ "$scope" = "projects" ]; }; then
    hits=$(jq -r --arg q "$query_lower" \
      '(.projects // [])[] | select((.name + " " + (.description // "") + " " + (.lead // "")) | ascii_downcase | test($q)) |
       "[PROJECT] \(.name)  status=\(.status // "active")  lead=\(.lead // "-")"' \
      "$projectsFile" 2>/dev/null | head -"$limit")
    if [ -n "$hits" ]; then
      echo "── $org / projects ──"
      echo "$hits"
      echo ""
      org_hits=$((org_hits + $(echo "$hits" | wc -l)))
    fi
  fi

  # ── Activity log ──────────────────────────────────
  if [ "$scope" = "all" ] || [ "$scope" = "activity" ]; then
    eventsFile="data/mastermind-events.jsonl"
    if [ -f "$eventsFile" ]; then
      hits=$(grep "\"org\":\"$org\"" "$eventsFile" 2>/dev/null | \
        jq -r --arg q "$query_lower" \
          'select((tostring | ascii_downcase | test($q))) |
           "[EVENT] \(.type)  org=\(.org)  \(if .task then "task=\(.task)" elif .role then "role=\(.role)" else "" end)"' \
        2>/dev/null | tail -"$limit")
      if [ -n "$hits" ]; then
        echo "── $org / activity ──"
        echo "$hits"
        echo ""
        org_hits=$((org_hits + $(echo "$hits" | wc -l)))
      fi
    fi
  fi

  total_hits=$((total_hits + org_hits))
done

if [ "$total_hits" -eq 0 ]; then
  echo "  No results found for \"${query}\""
  echo ""
  echo "  Tips:"
  echo "  • Try a shorter or more general query"
  echo "  • Use --scope to narrow: tasks, goals, agents, approvals, routines, projects, activity"
  echo "  • Use --org to limit to a specific org"
fi

echo "════════════════════════════════════════════════"
echo "Found: ${total_hits} result(s)"

Step 3 — Return Output

domain: ops
status: complete
query: <query>
scope: <scope>
orgs_searched: <N>
total_hits: <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

zk-steward

Org role guidance for a ZK steward: engineer zero-knowledge proof systems with circuit design, SNARK vs STARK choice and security review. This is zero-knowledge cryptography, not Zettelkasten note-taking.

★ 23
monoes
monoes/monomind

writing-plans

Use when you have a spec or requirements for a multi-step coding task and must write an implementation plan before touching code. Produces bite-sized TDD tasks with exact file paths, code and commands for an engineer with zero context.

内容创作者写作与文案
★ 23
monoes
monoes/monomind

write-spec

Write a feature spec or PRD from a problem statement or feature idea. Use when turning a vague idea or user request into a structured document, scoping a feature with goals and non-goals, defining success metrics and acceptance criteria, or breaking a big ask into a phased spec.

产品经理
★ 23
monoes
monoes/monomind

write-query

Write optimized SQL for your dialect with best practices. Use when translating a natural-language data need into SQL, building a multi-CTE query with joins and aggregations, optimizing a query against a large partitioned table, or getting dialect-specific syntax for Snowflake, BigQuery, Postgres, etc.

数据分析师
★ 23
monoes
monoes/monomind

workflow-automation

Org role guidance for workflow automation: build and maintain CI/CD definitions in GitHub Actions or equivalent: triggers, jobs, matrices, caching. Covers path filters, dependency caching, parallel jobs, timeouts and fail-fast ordering.

运维与部署Skill与智能体开发
★ 23
monoes
monoes/monomind

workflow-architect

Org role guidance for a workflow architect: map full workflow trees for systems, user journeys and agents, covering every branch and failure. Covers discovering workflows from code, handoff contracts, timeouts, recovery paths and observable state.

Skill与智能体开发
★ 23