AGENT SKILL

mastermind-goal-detail

Mastermind goal-detail — inspect and manage one goal: sub-goal tree, linked projects, edit its fields, add child goals, close or reopen it.

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

01 前言 Front Matter

name
mastermind-goal-detail
pick
low
type
domain-skill
description
Mastermind goal-detail — inspect and manage one goal: sub-goal tree, linked projects, edit its fields, add child goals, close or reopen it.
default_mode
auto

03 SKILL.md 正文

Mastermind Goal Detail

This skill is invoked directly via /mastermind-goal-detail.


Inputs

  • brain_context: BRAIN CONTEXT block (injected by command, or loaded below if standalone)
  • org_name: org the goal belongs to (required)
  • goal_id: goal id/slug (required)
  • action: show | tree | projects | edit | add-child | close | reopen
  • field: field to edit (title | description | status | priority | parent_id)
  • value: new field value (required for edit)
  • child_title: title for the new child goal (required for add-child)
  • child_description: description for the new child goal (optional)
  • caller: command | master

Goal Status Flow

open → in_progress → done
  └──────────────────┘  (can reopen)

Priority Levels

critical | high | medium | low


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 Goal Data

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

goalsFile=".monomind/orgs/${org_name}-goals.json"
[ ! -f "$goalsFile" ] && { echo "ERROR: No goals file for org '$org_name'. Create goals via /mastermind-goals."; exit 1; }

goalDef=$(jq -r --arg id "$goal_id" '(.goals // [])[] | select(.id == $id or .slug == $id)' "$goalsFile")
[ -z "$goalDef" ] && { echo "ERROR: Goal '$goal_id' not found in org '$org_name'."; exit 1; }

resolvedId=$(echo "$goalDef" | jq -r '.id')
projectsFile=".monomind/orgs/${org_name}-projects.json"

Step 2 — Execute Action

show (default)

echo "GOAL DETAIL — $goal_id @ $org_name"
echo "────────────────────────────────────────────────────────"

echo "$goalDef" | jq -r '
  "  ID:           \(.id)",
  "  Title:        \(.title // "(no title)")",
  "  Status:       \(.status // "open")",
  "  Priority:     \(.priority // "medium")",
  "  Parent:       \(.parent_id // "(root goal)")",
  "  Created:      \(.created_at // "-")",
  "  Updated:      \(.updated_at // "-")"
'

# Sub-goals count
subCount=$(jq --arg pid "$resolvedId" '[(.goals // [])[] | select(.parent_id == $pid)] | length' "$goalsFile" 2>/dev/null || echo 0)
doneCount=$(jq --arg pid "$resolvedId" '[(.goals // [])[] | select(.parent_id == $pid and .status == "done")] | length' "$goalsFile" 2>/dev/null || echo 0)
echo "  Sub-goals:    $subCount total, $doneCount done"

# Linked projects
projCount=$(echo "$goalDef" | jq -r '(.linked_projects // []) | length')
echo "  Projects:     $projCount linked"

# Description
desc=$(echo "$goalDef" | jq -r '.description // ""')
if [ -n "$desc" ]; then
  echo ""
  echo "DESCRIPTION"
  echo "────────────────────────────────────────────────────────"
  echo "$desc"
fi

tree

echo "SUB-GOAL TREE — $goal_id"
echo "────────────────────────────────────────────────────────"

function print_tree() {
  local pid="$1"
  local indent="$2"
  local children
  children=$(jq -r --arg pid "$pid" '(.goals // [])[] | select(.parent_id == $pid) |
    [.id, (.status // "open"), (.title // "(no title)")] | @tsv' "$goalsFile" 2>/dev/null)
  while IFS=$'\t' read -r cid cst ctitle; do
    [ -z "$cid" ] && continue
    echo "${indent}[${cst}] ${ctitle} (${cid})"
    print_tree "$cid" "  ${indent}"
  done <<< "$children"
}

# Print root goal
rootTitle=$(echo "$goalDef" | jq -r '.title // "(no title)"')
rootStatus=$(echo "$goalDef" | jq -r '.status // "open"')
echo "[${rootStatus}] ${rootTitle} (${resolvedId})"
print_tree "$resolvedId" "  "

projects

echo "LINKED PROJECTS — $goal_id"
echo "────────────────────────────────────────────────────────"

linkedIds=$(echo "$goalDef" | jq -r '(.linked_projects // [])[]')
if [ -z "$linkedIds" ]; then
  echo "  No linked projects."
else
  while IFS= read -r pid; do
    [ -z "$pid" ] && continue
    if [ -f "$projectsFile" ]; then
      projInfo=$(jq -r --arg id "$pid" '(.projects // [])[] | select(.id == $id) |
        "  [\(.status // "active")] \(.name // $id) — \(.description // "")"' "$projectsFile" 2>/dev/null)
      [ -n "$projInfo" ] && echo "$projInfo" || echo "  [$pid] (project not found in projects file)"
    else
      echo "  $pid"
    fi
  done <<< "$linkedIds"
fi

echo ""
echo "Issues referencing this goal:"
issuesFile=".monomind/orgs/${org_name}-issues.json"
if [ -f "$issuesFile" ]; then
  count=$(jq --arg gid "$resolvedId" '[(.issues // [])[] | select(.goal_id == $gid)] | length' "$issuesFile" 2>/dev/null || echo 0)
  echo "  $count issue(s) linked to this goal."
fi

edit

[ -z "$field" ] && { echo "ERROR: --field required (title|description|status|priority|parent_id)."; exit 1; }
[ -z "$value" ] && { echo "ERROR: --value required."; exit 1; }

validFields="title description status priority parent_id"
echo "$validFields" | tr ' ' '\n' | grep -qx "$field" || {
  echo "ERROR: Unknown field '$field'. Valid: $validFields"; exit 1
}

if [ "$field" = "status" ]; then
  case "$value" in open|in_progress|done|cancelled) : ;; *)
    echo "ERROR: status must be one of: open, in_progress, done, cancelled"; exit 1 ;;
  esac
fi
if [ "$field" = "priority" ]; then
  case "$value" in critical|high|medium|low) : ;; *)
    echo "ERROR: priority must be one of: critical, high, medium, low"; exit 1 ;;
  esac
fi

ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)
tmp="${goalsFile}.tmp"
jq --arg id "$resolvedId" --arg field "$field" --arg val "$value" --arg ts "$ts" \
  '.goals = [(.goals // [])[] | if .id == $id then .[$field] = $val | .updated_at = $ts else . end]' \
  "$goalsFile" > "$tmp" && mv "$tmp" "$goalsFile"

echo "Goal '$goal_id' updated: $field = $value"

add-child

[ -z "$child_title" ] && { echo "ERROR: --child-title required."; exit 1; }

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

tmp="${goalsFile}.tmp"
jq --arg id "$childId" \
   --arg title "$child_title" \
   --arg desc "${child_description:-}" \
   --arg pid "$resolvedId" \
   --arg ts "$ts" \
  '.goals += [{"id":$id,"title":$title,
    "description":(if $desc != "" then $desc else null end),
    "parent_id":$pid,"status":"open","priority":"medium",
    "linked_projects":[],"created_at":$ts,"updated_at":$ts}]' \
  "$goalsFile" > "$tmp" && mv "$tmp" "$goalsFile"

echo "Sub-goal created: $childId"
echo "  Title:  $child_title"
echo "  Parent: $goal_id"

close

ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)
tmp="${goalsFile}.tmp"
jq --arg id "$resolvedId" --arg ts "$ts" \
  '.goals = [(.goals // [])[] | if .id == $id then .status = "done" | .updated_at = $ts | .closed_at = $ts else . end]' \
  "$goalsFile" > "$tmp" && mv "$tmp" "$goalsFile"
echo "Goal '$goal_id' → done."

reopen

ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)
tmp="${goalsFile}.tmp"
jq --arg id "$resolvedId" --arg ts "$ts" \
  '.goals = [(.goals // [])[] | if .id == $id then .status = "open" | .updated_at = $ts | .closed_at = null else . end]' \
  "$goalsFile" > "$tmp" && mv "$tmp" "$goalsFile"
echo "Goal '$goal_id' → reopened."

Step 3 — Return Output

domain: ops
status: complete
action: <action>
org: <org_name>
goal_id: <goal_id>
goal_status: <status>
sub_goals: <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