/crystallize
Promote extracted incident knowledge into global patterns and agent improvements.
$ npx -y skills add avelikiy/great_cto --agent claude-codeShips with great-cto. Installing the plugin gets this command.
How it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/crystallize
Context preview
What this command does when you run it.
Promote extracted incident knowledge into global patterns and agent improvements.
Command definition
crystallize.mddescription: "Promote extracted incident knowledge into global patterns and agent improvements."
argument-hint: '[approve GP-NNNN [--no-eval "reason"] | reject GP-NNNN <reason> | rollback GP-NNNN | prune | status]'
user-invocable: true
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
model: sonnet
<!-- great_cto-managed -->
You are the great_cto knowledge crystallization command. You read incident knowledge extractions (KE files), promote them to global patterns (GP files), and propose concrete improvements to agent workflow files. Human approves every agent change.
**Privacy rule:** GP files and proposals never contain project names, client names, URLs, credentials, or identifying data. Generic technology descriptors only. See `skills/great_cto/references/knowledge-extraction.md` for the full privacy checklist.
---
Setup
KE_DIR=~/.great_cto/extractions
GP_DIR=~/.great_cto/global-patterns
PROPOSAL_DIR=~/.great_cto/proposals
METRICS_DIR=~/.great_cto/metrics
mkdir -p "$KE_DIR" "$GP_DIR" "$PROPOSAL_DIR" "$METRICS_DIR"
# Plugin dir (for agent files)
PLUGIN_DIR=$(find ~/.claude -name "ARCHETYPES.md" -path "*/great_cto/*" 2>/dev/null | sort -V | tail -1 | xargs dirname)
[ -z "$PLUGIN_DIR" ] && PLUGIN_DIR=$(dirname "$(find . .great_cto \
-name "ARCHETYPES.md" 2>/dev/null | head -1)" 2>/dev/null)
TODAY=$(date +%Y-%m-%d)
---
Dispatch by argument
ARG="${1:-status}"
case "$ARG" in
# `approve GP-NNNN [--no-eval "<reason>"]` — the flag is the ONLY way to
# activate a pattern that carries no eval evidence, and the reason is logged.
approve) SUBCOMMAND=approve; GP_ID="$2"
if [ "$3" = "--no-eval" ]; then NO_EVAL_REASON="${*:4}"; fi ;;
reject) SUBCOMMAND=reject; GP_ID="$2"; REASON="${@:3}" ;;
rollback) SUBCOMMAND=rollback; GP_ID="$2" ;;
propose) SUBCOMMAND=propose; GP_ID="$2" ;; # NEW: Sprint 3 — PR-gate
prune) SUBCOMMAND=prune ;;
status) SUBCOMMAND=status ;;
*) SUBCOMMAND=review ;; # default: show pending KEs + proposals
esac---
Subcommand: status / review (default)
Show all pending KE files not yet promoted + all proposals awaiting approval.
echo "=== CRYSTALLIZE STATUS ==="
echo ""
# Pending KE files
PENDING_KE=$(ls "$KE_DIR"/KE-*.yaml 2>/dev/null | while read f; do
if ! grep -q "^promoted_to:" "$f" 2>/dev/null; then echo "$f"; fi
done)
KE_COUNT=$(echo "$PENDING_KE" | grep -c "." 2>/dev/null || echo 0)
echo "Pending extractions (KE): $KE_COUNT"
if [ "$KE_COUNT" -gt 0 ]; then
echo "$PENDING_KE" | while read ke; do
KE_ID=$(grep "^ke_id:" "$ke" | awk '{print $2}')
AGENT=$(grep "^target_agent:" "$ke" | awk '{print $2}')
CONF=$(grep "^confidence:" "$ke" | awk '{print $2}')
ITER=$(grep "^ iterations:" "$ke" | awk '{print $2}')
MTTR=$(grep "^mttr_reduction_estimate:" "$ke" | sed "s/mttr_reduction_estimate: //")
echo " • $KE_ID → $AGENT (confidence=$CONF iter=$ITER mttr_reduction=$MTTR)"
done
fi
echo ""
# Pending proposals
PENDING_PROP=$(ls "$PROPOSAL_DIR"/PROPOSAL-*.md 2>/dev/null | while read f; do
if grep -q "^Status: PENDING_APPROVAL" "$f" 2>/dev/null; then echo "$f"; fi
done)
PROP_COUNT=$(echo "$PENDING_PROP" | grep -c "." 2>/dev/null || echo 0)
echo "Pending proposals (GP): $PROP_COUNT"
if [ "$PROP_COUNT" -gt 0 ]; then
echo "$PENDING_PROP" | while read prop; do
GP_ID=$(grep "^GP_ID:" "$prop" | awk '{print $2}')
TARGET=$(grep "^Target agent:" "$prop" | sed "s/Target agent: //")
EVIDENCE=$(grep "^Evidence:" "$prop" | sed "s/Evidence: //")
echo " • $GP_ID → $TARGET — $EVIDENCE"
done
echo ""
echo "Run: /crystallize approve <GP-ID> | /crystallize reject <GP-ID> <reason>"
fi
# Active pattern stats
ACTIVE=$(ls "$GP_DIR"/GP-*.md 2>/dev/null | \
xargs grep -l "^status: active" 2>/dev/null | wc -l | tr -d ' ')
TOTAL_HITS=$(grep -rh "^hits:" "$GP_DIR" 2>/dev/null | \
awk -F': ' '{sum+=$2} END{print sum+0}')
echo ""
echo "Active patterns: ${ACTIVE:-0} | Total hits: ${TOTAL_HITS:-0}"
echo "Run /crystallize (no args) to review, or /crystallize prune to archive stale patterns"---
Subcommand: review (promote KE → GP + generate proposals)
Run when there are pending KE files. For each qualifying KE: 1. Check noise filter (confidence + iterations thresholds) 2. Check deduplication (slug already in GP_DIR?) 3. Generate GP-NNNN file 4. Generate PROPOSAL-*.md with concrete agent diff
# Noise filter thresholds
MIN_ITERATIONS_MEDIUM=5 # medium confidence requires 5+ iterations
MIN_ITERATIONS_LOW=8 # low confidence requires 8+ iterations
echo "=== REVIEWING KE FILES ==="
echo ""
ls "$KE_DIR"/KE-*.yaml 2>/dev/null | while read ke_file; do
# Skip already promoted
grep -q "^promoted_to:" "$ke_file" 2>/dev/null && continue
KE_ID=$(grep "^ke_id:" "$ke_file" | awk '{print $2}')
CONFIDENCE=$(grep "^confidence:" "$ke_file" | awk '{print $2}')
ITERATIONS=$(grep "^ iterations:" "$ke_file" | awk '{print $2}')
IS_CANDIDATE=$(grep "^ pattern_candidate:" "$ke_file" | awk '{print $2}')
TARGET_AGENT=$(grep "^target_agent:" "$ke_file" | awk '{print $2}')
TARGET_SKILL=$(grep "^target_skill:" "$ke_file" | awk '{print $2}')
SLUG=$(echo "$KE_ID" | sed 's/KE-[0-9-]*-//')
# Validate routing: must have exactly one of target_agent / target_skill
if [ -z "$TARGET_AGENT" ] && [ -z "$TARGET_SKILL" ]; then
echo " SKIP: KE has no target_agent or target_skill"; continue
fi
echo "Processing: $KE_ID"
# Noise filter
PROMOTE=false
case "$CONFIDENCE" in
high) PROMOTE=true ;;
medium) [ "${ITERATIONS:-0}" -ge "$MIN_ITERATIONS_MEDIUM" ] && PROMOTE=true ;;
low) [ "${ITERATIONS:-0}" -ge "$MIN_ITERATIONS_LOW" ] && PROMOTE=true ;;
esac
[ "$IS_CANDIDATE" != "true" ] && PROMOTE=false
if [ "$PROMOTE" != "true" ]; then
echo " SKIP: below promotion threshold (confidence=$CONFIDENCE iter=$ITERATIONS)"
continue
fi
# Deduplication — check if slug already in GP library
EXISTINRead more
description: "Promote extracted incident knowledge into global patterns and agent improvements." argument-hint: '[approve GP-NNNN [--no-eval "reason"] | reject GP-NNNN <reason> | rollback GP-NNNN | prune | status]' user-invocable: true allowed-tools: Read, Write, Edit, Bash, Glob, Grep model: sonnet
<!-- great_cto-managed -->
You are the great_cto knowledge crystallization command. You read incident knowledge extractions (KE files), promote them to global patterns (GP files), and propose concrete improvements to agent workflow files. Human approves every agent change.
**Privacy rule:** GP files and proposals never contain project names, client names, URLs, credentials, or identifying data. Generic technology descriptors only. See `skills/great_cto/references/knowledge-extraction.md` for the full privacy checklist.
---
Setup
KE_DIR=~/.great_cto/extractions GP_DIR=~/.great_cto/global-patterns PROPOSAL_DIR=~/.great_cto/proposals METRICS_DIR=~/.great_cto/metrics mkdir -p "$KE_DIR" "$GP_DIR" "$PROPOSAL_DIR" "$METRICS_DIR" # Plugin dir (for agent files) PLUGIN_DIR=$(find ~/.claude -name "ARCHETYPES.md" -path "*/great_cto/*" 2>/dev/null | sort -V | tail -1 | xargs dirname) [ -z "$PLUGIN_DIR" ] && PLUGIN_DIR=$(dirname "$(find . .great_cto \ -name "ARCHETYPES.md" 2>/dev/null | head -1)" 2>/dev/null) TODAY=$(date +%Y-%m-%d)
---
Dispatch by argument
ARG="${1:-status}"
case "$ARG" in
# `approve GP-NNNN [--no-eval "<reason>"]` — the flag is the ONLY way to
# activate a pattern that carries no eval evidence, and the reason is logged.
approve) SUBCOMMAND=approve; GP_ID="$2"
if [ "$3" = "--no-eval" ]; then NO_EVAL_REASON="${*:4}"; fi ;;
reject) SUBCOMMAND=reject; GP_ID="$2"; REASON="${@:3}" ;;
rollback) SUBCOMMAND=rollback; GP_ID="$2" ;;
propose) SUBCOMMAND=propose; GP_ID="$2" ;; # NEW: Sprint 3 — PR-gate
prune) SUBCOMMAND=prune ;;
status) SUBCOMMAND=status ;;
*) SUBCOMMAND=review ;; # default: show pending KEs + proposals
esac---
Subcommand: status / review (default)
Show all pending KE files not yet promoted + all proposals awaiting approval.
echo "=== CRYSTALLIZE STATUS ==="
echo ""
# Pending KE files
PENDING_KE=$(ls "$KE_DIR"/KE-*.yaml 2>/dev/null | while read f; do
if ! grep -q "^promoted_to:" "$f" 2>/dev/null; then echo "$f"; fi
done)
KE_COUNT=$(echo "$PENDING_KE" | grep -c "." 2>/dev/null || echo 0)
echo "Pending extractions (KE): $KE_COUNT"
if [ "$KE_COUNT" -gt 0 ]; then
echo "$PENDING_KE" | while read ke; do
KE_ID=$(grep "^ke_id:" "$ke" | awk '{print $2}')
AGENT=$(grep "^target_agent:" "$ke" | awk '{print $2}')
CONF=$(grep "^confidence:" "$ke" | awk '{print $2}')
ITER=$(grep "^ iterations:" "$ke" | awk '{print $2}')
MTTR=$(grep "^mttr_reduction_estimate:" "$ke" | sed "s/mttr_reduction_estimate: //")
echo " • $KE_ID → $AGENT (confidence=$CONF iter=$ITER mttr_reduction=$MTTR)"
done
fi
echo ""
# Pending proposals
PENDING_PROP=$(ls "$PROPOSAL_DIR"/PROPOSAL-*.md 2>/dev/null | while read f; do
if grep -q "^Status: PENDING_APPROVAL" "$f" 2>/dev/null; then echo "$f"; fi
done)
PROP_COUNT=$(echo "$PENDING_PROP" | grep -c "." 2>/dev/null || echo 0)
echo "Pending proposals (GP): $PROP_COUNT"
if [ "$PROP_COUNT" -gt 0 ]; then
echo "$PENDING_PROP" | while read prop; do
GP_ID=$(grep "^GP_ID:" "$prop" | awk '{print $2}')
TARGET=$(grep "^Target agent:" "$prop" | sed "s/Target agent: //")
EVIDENCE=$(grep "^Evidence:" "$prop" | sed "s/Evidence: //")
echo " • $GP_ID → $TARGET — $EVIDENCE"
done
echo ""
echo "Run: /crystallize approve <GP-ID> | /crystallize reject <GP-ID> <reason>"
fi
# Active pattern stats
ACTIVE=$(ls "$GP_DIR"/GP-*.md 2>/dev/null | \
xargs grep -l "^status: active" 2>/dev/null | wc -l | tr -d ' ')
TOTAL_HITS=$(grep -rh "^hits:" "$GP_DIR" 2>/dev/null | \
awk -F': ' '{sum+=$2} END{print sum+0}')
echo ""
echo "Active patterns: ${ACTIVE:-0} | Total hits: ${TOTAL_HITS:-0}"
echo "Run /crystallize (no args) to review, or /crystallize prune to archive stale patterns"---
Subcommand: review (promote KE → GP + generate proposals)
Run when there are pending KE files. For each qualifying KE: 1. Check noise filter (confidence + iterations thresholds) 2. Check deduplication (slug already in GP_DIR?) 3. Generate GP-NNNN file 4. Generate PROPOSAL-*.md with concrete agent diff
# Noise filter thresholds
MIN_ITERATIONS_MEDIUM=5 # medium confidence requires 5+ iterations
MIN_ITERATIONS_LOW=8 # low confidence requires 8+ iterations
echo "=== REVIEWING KE FILES ==="
echo ""
ls "$KE_DIR"/KE-*.yaml 2>/dev/null | while read ke_file; do
# Skip already promoted
grep -q "^promoted_to:" "$ke_file" 2>/dev/null && continue
KE_ID=$(grep "^ke_id:" "$ke_file" | awk '{print $2}')
CONFIDENCE=$(grep "^confidence:" "$ke_file" | awk '{print $2}')
ITERATIONS=$(grep "^ iterations:" "$ke_file" | awk '{print $2}')
IS_CANDIDATE=$(grep "^ pattern_candidate:" "$ke_file" | awk '{print $2}')
TARGET_AGENT=$(grep "^target_agent:" "$ke_file" | awk '{print $2}')
TARGET_SKILL=$(grep "^target_skill:" "$ke_file" | awk '{print $2}')
SLUG=$(echo "$KE_ID" | sed 's/KE-[0-9-]*-//')
# Validate routing: must have exactly one of target_agent / target_skill
if [ -z "$TARGET_AGENT" ] && [ -z "$TARGET_SKILL" ]; then
echo " SKIP: KE has no target_agent or target_skill"; continue
fi
echo "Processing: $KE_ID"
# Noise filter
PROMOTE=false
case "$CONFIDENCE" in
high) PROMOTE=true ;;
medium) [ "${ITERATIONS:-0}" -ge "$MIN_ITERATIONS_MEDIUM" ] && PROMOTE=true ;;
low) [ "${ITERATIONS:-0}" -ge "$MIN_ITERATIONS_LOW" ] && PROMOTE=true ;;
esac
[ "$IS_CANDIDATE" != "true" ] && PROMOTE=false
if [ "$PROMOTE" != "true" ]; then
echo " SKIP: below promotion threshold (confidence=$CONFIDENCE iter=$ITERATIONS)"
continue
fi
# Deduplication — check if slug already in GP library
EXISTINShowing the first part of this file.
Don't buy software. Get the work done. GreatCTO ships AI autopilots that run a whole business function — medical coding, legal docs, procurement, accounting, IT, tax — from intake to outcome. A qualified human signs only the judgment calls. Live connectors, built-in compliance.
Repo: avelikiy/great_cto
Other commands on great-cto.
- /aedt-bias-audit
HR-AI / AEDT bias audit. Invokes hr-ai-reviewer to assess NYC LL 144, EEOC, Illinois AIVIA, Colorado SB 205, EU AI Act Annex III applicability and produce TM-hrai with bias-audit pipeline requirements (4/5-rule, intersectional).
Open command - /agent-retire
Gracefully retire an LLM agent from the workforce. Archives prompt, removes from sync list, keeps verdicts for audit. Like firing a human — but reversible.
Open command - /agent-review
Performance review for an LLM agent (or all agents). Verdicts breakdown, cost analysis, top failure modes, prompt-tuning suggestions. Like a human '1:1' but for AI workforce.
Open command - /api-contract-review
API platform contract review. Invokes api-platform-reviewer to audit rate-limit design, OAuth scope hygiene, webhook signing, idempotency, Sunset/deprecation, pagination, error envelope, and versioning strategy. Critical before v1 GA.
Open command - /audit
Audit an existing codebase. Detects stack, finds gaps, creates tasks, generates PROJECT.md.
Open command - /board
Open the great_cto admin board at http://localhost:3141 (Kanban, cost, pipeline, inbox, memory). Starts it in background if not running.
Open command

