plugins/code-analysis/skills/mnemex-orchestration/SKILL.md
Use when orchestrating multi-agent code analysis with mnemex. Run mnemex once, share output across parallel agents. Enables parallel investigation, consensus analysis, and role-based command mapping.
npx skillsauth add madappgang/magus mnemex-orchestrationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Version: 1.1.0 Purpose: Coordinate multiple agents using shared mnemex output
When multiple agents need to investigate the same codebase:
This pattern avoids redundant mnemex calls and enables consensus-based prioritization.
For parallel execution patterns, see: multimodel:multi-model-validation skill
This skill focuses on mnemex-specific orchestration. For general parallel execution:
multimodel:multi-model-validation Pattern 1multimodel:multi-model-validation Pattern 0multimodel:multi-model-validation Pattern 7Purpose: Run expensive mnemex commands ONCE, share results across agents.
# Create unique session directory (per multimodel:multi-model-validation Pattern 0)
SESSION_ID="analysis-$(date +%Y%m%d-%H%M%S)-$(head -c 4 /dev/urandom | xxd -p)"
SESSION_DIR="ai-docs/sessions/${SESSION_ID}"
mkdir -p "$SESSION_DIR"
# Run mnemex ONCE, write to shared files
mnemex --agent map "feature area" > "$SESSION_DIR/structure-map.md"
mnemex --agent test-gaps > "$SESSION_DIR/test-gaps.md" 2>&1 || echo "No gaps found" > "$SESSION_DIR/test-gaps.md"
mnemex --agent dead-code > "$SESSION_DIR/dead-code.md" 2>&1 || echo "No dead code" > "$SESSION_DIR/dead-code.md"
# Export session info
echo "$SESSION_ID" > "$SESSION_DIR/session-id.txt"
Why shared output matters:
After running mnemex, distribute to mode-specific agents:
# Parallel Execution (ONLY Task calls - per 4-Message Pattern)
Task: code-analysis:investigate (architecture mode)
Prompt: "Analyze architecture from $SESSION_DIR/structure-map.md.
Focus on layer boundaries and design patterns.
Write findings to $SESSION_DIR/architect-analysis.md"
---
Task: code-analysis:investigate (testing mode)
Prompt: "Analyze test gaps from $SESSION_DIR/test-gaps.md.
Prioritize coverage recommendations.
Write findings to $SESSION_DIR/tester-analysis.md"
---
Task: code-analysis:investigate (implementation mode)
Prompt: "Analyze dead code from $SESSION_DIR/dead-code.md.
Identify cleanup opportunities.
Write findings to $SESSION_DIR/developer-analysis.md"
All 3 execute simultaneously (3x speedup!)
Task: code-analysis:deep-analysis
Prompt: "Consolidate analyses from:
- $SESSION_DIR/architect-analysis.md
- $SESSION_DIR/tester-analysis.md
- $SESSION_DIR/developer-analysis.md
Create unified report with prioritized action items.
Write to $SESSION_DIR/consolidated-analysis.md"
When multiple agents perform searches, consolidate feedback for efficiency.
Why Consolidate?
Shared Feedback Collection:
Each agent writes feedback to a shared file in the session directory:
# Agent writes feedback entry (atomic with flock)
report_agent_feedback() {
local query="$1"
local helpful="$2"
local unhelpful="$3"
# Use file locking to prevent race conditions
(
flock -x 200
printf '%s|%s|%s\n' "$query" "$helpful" "$unhelpful" >> "$SESSION_DIR/feedback.log"
) 200>"$SESSION_DIR/feedback.lock"
}
# Usage in agent
report_agent_feedback "$SEARCH_QUERY" "$HELPFUL_IDS" "$UNHELPFUL_IDS"
Orchestrator Consolidation:
After all agents complete, the orchestrator submits all feedback:
consolidate_feedback() {
local session_dir="$1"
local feedback_log="$session_dir/feedback.log"
# Skip if no feedback collected
[ -f "$feedback_log" ] || return 0
# Check if feedback command available (v0.8.0+)
if ! mnemex feedback --help 2>&1 | grep -qi "feedback"; then
echo "Note: Search feedback requires mnemex v0.8.0+"
return 0
fi
local success=0
local failed=0
while IFS='|' read -r query helpful unhelpful; do
# Skip empty lines
[ -n "$query" ] || continue
if timeout 5 mnemex feedback \
--query "$query" \
--helpful "$helpful" \
--unhelpful "$unhelpful" 2>/dev/null; then
((success++))
else
((failed++))
fi
done < "$feedback_log"
echo "Feedback: $success submitted, $failed failed"
# Cleanup
rm -f "$feedback_log" "$session_dir/feedback.lock"
}
# Call after consolidation
consolidate_feedback "$SESSION_DIR"
Multi-Agent Workflow Integration:
Phase 1: Session Setup
└── Create SESSION_DIR with feedback.log
Phase 2: Parallel Agent Execution
└── Agent 1: Search → Track → Write feedback entry
└── Agent 2: Search → Track → Write feedback entry
└── Agent 3: Search → Track → Write feedback entry
Phase 3: Results Consolidation
└── Consolidate agent outputs
Phase 4: Feedback Consolidation (NEW)
└── Read all feedback entries from log
└── Submit each to mnemex
└── Report success/failure counts
Phase 5: Cleanup
└── Remove SESSION_DIR (includes feedback files)
Best Practices Update:
Do:
flock -x)Don't:
| Agent Role | Primary Commands | Secondary Commands | New Tools | Focus |
|------------|------------------|--------------------|-----------|-------|
| Architect | map, dead-code | context, dependency-graph | memory_write (persist arch findings) | Structure, cleanup, knowledge persistence |
| Developer | callers, callees, impact | symbol | edit_symbol, rename_symbol, think | Modification scope, safe edits |
| Tester | test-gaps | callers | references (find all usages including tests) | Coverage priorities |
| Debugger | context, impact | symbol, callers | define, references (LSP-backed call sites) | Error tracing, type verification |
| Ultrathink | ALL | ALL | ALL | Comprehensive |
For complex bugs or features requiring ordered investigation:
Phase 1: Architecture Understanding
mnemex --agent map "problem area" Identify high-PageRank symbols (> 0.05)
Phase 2: Symbol Deep Dive
For each high-PageRank symbol:
mnemex --agent context <symbol> Document dependencies and callers
Phase 3: Impact Assessment (v0.4.0+)
mnemex --agent impact <primary-symbol> Document full blast radius
Phase 4: Gap Analysis (v0.4.0+)
mnemex --agent test-gaps --min-pagerank 0.01 Identify coverage holes in affected code
Phase 5: Action Planning
Prioritize by: PageRank * impact_depth * test_coverage
MCP Tool Integration: For single-agent workflows, mnemex MCP tools can be called
directly instead of via CLI. The mnemex-search skill covers both modes.
When an agent needs deep code analysis, it should reference the mnemex skill:
---
skills: code-analysis:mnemex-search, code-analysis:mnemex-orchestration
---
The agent then follows this pattern:
mnemex statusmnemex indexDo:
multimodel:multi-model-validation)Don't:
Session TTL Cleanup: Clean up expired session directories manually or use a cleanup pattern:
Note: Use ai-docs/sessions/{session-id}/ for session artifacts instead of /tmp/
to comply with project conventions.
Manual Cleanup:
# Clean up specific session
rm -rf "$SESSION_DIR"
# Clean all old sessions (24+ hours)
find ai-docs/sessions -maxdepth 1 -name "analysis-*" -o -name "review-*" -mtime +1 -exec rm -rf {} \;
For robust orchestration, handle common mnemex errors. See mnemex-search skill for complete error handling templates:
RESULT=$(mnemex --agent map "query" 2>/dev/null)
if [ -z "$RESULT" ] || echo "$RESULT" | grep -q "No results found"; then
echo "No results - try broader keywords or check index status"
fi
# Check if command is available (v0.4.0+ commands)
if mnemex --agent dead-code 2>&1 | grep -q "unknown command"; then
echo "dead-code requires mnemex v0.4.0+"
echo "Fallback: Use map command instead"
fi
# Verify index before running commands
if ! mnemex status 2>&1 | grep -qE "[0-9]+ (chunks|symbols)"; then
echo "Index not found - run: mnemex index"
exit 1
fi
Reference: For complete error handling patterns, see templates in code-analysis:mnemex-search skill (Templates 1-5)
Maintained by: MadAppGang Plugin: code-analysis v4.0.0 Last Updated: March 2026 (v4.0.0 - MCP-based integration, removed hook refs)
testing
A test skill for validation testing. Use when testing skill parsing and validation logic.
tools
--- name: bad-skill description: This skill has invalid YAML in frontmatter allowed-tools: [invalid, array, syntax prerequisites: not-an-array --- # Bad Skill This skill has malformed frontmatter that should fail parsing. The YAML has: - Unclosed array bracket - Wrong type for prerequisites (should be array, not string)
development
Sync model aliases from the curated Firebase database. Fetches default model assignments, short aliases, team compositions, and known model metadata from the claudish API. Run this to get fresh model recommendations.
tools
Release one or more Magus plugins to the distribution repos (magus, magus-alpha, magus-marketing). Handles version inference from git history, marketplace.json updates, tagging, and force-push to lean dist repos. Use whenever the user says "release kanban", "release the dev plugin", "cut a new version of gtd", "bump kanban to 1.7", or hands you a batch like "release kanban and gtd". Also use for multi-plugin releases and for checking what a release would contain before committing.