--- name: shadow-detection description: Use when monitoring agent behavior for dysfunction, when an agent seems stuck, or when orchestration quality is degrading. Detects and corrects Jungian shadow activation in archetypes. --- # Shadow Detection Every archetype has a **virtue** (its unique contribution) and a **shadow** (the destructive inversion of that virtue). A shadow activates when the virtue is pushed too far. ``` Virtue (healthy) → pushed too far → Shadow (dysfunction) Contextual Clarity → can't stop → Rabbit Hole Decisive Framing → never done → Perfectionist Execution Discipline → no guardrails → Cowboy Threat Intuition → sees threats only → Paranoid Assumption Surfacing → questions only → Paralytic Adversarial Creativity → destruction only → Saboteur Maintainability Judgment → reviews only → Bureaucrat ``` --- ## Explorer → Rabbit Hole **Virtue inverted:** Contextual Clarity becomes compulsive investigation — or output that dumps without analyzing. **Symptoms:** - Research output keeps growing but never synthesizes - "I found one more thing to check" repeated 3+ times - Reading more than 15 files without producing findings - Output is a raw inventory of files with no analysis or recommendation **Triggers:** - Output length > 2000 words without a recommendation section - More than 3 "see also" or "related" tangents - No patterns or recommendation in output **Correction:** "Summarize your top 3 findings and one recommendation in under 300 words. If your output has no Recommendation section, add one. A dump is not research." --- ## Creator → Perfectionist **Virtue inverted:** Decisive Framing becomes endless revision — or designing at the wrong scale. **Symptoms:** - Proposal revised 3+ times without new information - Confidence score keeps dropping instead of stabilizing - Scope expanding with each revision - Abstraction layers and future-proofing for requirements that don't exist **Triggers:** - Revision count > 2 without external feedback - Proposal scope exceeds original task by > 50% - More than 2 new abstractions for a single feature **Correction:** "Ship at current state. Design for the current order of magnitude, not 100x. Note remaining concerns under 'Risks' and let the Check phase catch them." --- ## Maker → Cowboy **Virtue inverted:** Execution Discipline becomes reckless shipping — or expanding beyond the plan. **Symptoms:** - Writing code before reading the proposal fully - No tests, or tests written after implementation - Large uncommitted working tree - Files changed that aren't mentioned in the proposal **Triggers:** - No test files in the changeset - Single monolithic commit instead of incremental commits - Diff contains files not listed in the Creator's proposal **Correction:** "Read the proposal. Write a test. Commit what you have. Revert changes to files not in the proposal. Then continue." --- ## Guardian → Paranoid **Virtue inverted:** Threat Intuition becomes blocking everything — without offering a path forward. **Symptoms:** - Every finding marked CRITICAL - Blocking on theoretical risks with < 1% probability - Rejecting without suggesting how to fix - Security concerns for internal-only code at external-API severity **Triggers:** - CRITICAL:WARNING ratio > 2:1 - Zero APPROVED verdicts in 3+ consecutive reviews - Less than 50% of findings include a suggested fix **Correction:** "For each CRITICAL finding, answer: Would a senior engineer block a PR for this? If not, downgrade. Every rejection must include a specific, implementable fix." --- ## Skeptic → Paralytic **Virtue inverted:** Assumption Surfacing becomes inability to approve anything — drowning signal in tangential concerns. **Symptoms:** - More than 7 challenges raised - Challenges without suggested alternatives - "What about X?" chains that drift from the task - Restating the same concern in different words **Triggers:** - Challenge count > 7 - Less than 50% of challenges include alternatives - Same conceptual concern raised multiple times **Correction:** "Rank your challenges by impact. Keep the top 3. Each must include a specific alternative. Delete the rest." --- ## Trickster → Saboteur **Virtue inverted:** Adversarial Creativity becomes destructive chaos — or testing the wrong code. **Symptoms:** - Modifying code instead of testing it - Attacks with no constructive reporting - Finding "bugs" in code that wasn't changed - No reproduction steps in findings **Triggers:** - Agent modifies files that aren't in the Maker's changeset - Findings reference code untouched by the implementation - No reproduction steps in findings **Correction:** "You test the CHANGES, not the entire system. Limit attacks to files in the Maker's diff. Every finding must include exact reproduction steps." --- ## Sage → Bureaucrat **Virtue inverted:** Maintainability Judgment becomes bloat — reviews longer than the code, or insight without action. **Symptoms:** - Review longer than the code change itself - Requesting documentation for self-evident code - Suggesting refactors unrelated to the current task - Deep-sounding analysis that doesn't end with a specific action **Triggers:** - Review word count > 2x the code change's word count - Suggestions reference files not in the changeset - Findings contain "consider" or "think about" without a specific action **Correction:** "Limit your review to issues that affect maintainability in the next 6 months. Every finding must end with a specific action. If you can't state the consequence of NOT fixing it, don't raise it." --- ## Shadow Escalation Protocol 1. **First detection:** Log the shadow, apply the correction prompt, let the agent continue 2. **Second detection (same agent, same shadow):** Replace the agent with a fresh one. The shadow is entrenched. 3. **Shadow detected in 3+ agents in the same cycle:** The task itself may be poorly scoped. Escalate to the user: "Multiple agents are struggling — the task may need to be broken down." ## Shadow Immunity Some behaviors LOOK like shadows but aren't: - Explorer reading 20 files in a monorepo with scattered dependencies → **not a rabbit hole** if each file is genuinely relevant - Creator at confidence 0.4 → **not perfectionism** if the task is genuinely ambiguous (flag to user instead) - Guardian blocking with 2 CRITICAL findings → **not paranoid** if both are genuine security vulnerabilities - Trickster finding 5 edge cases → **not saboteur** if all are in the changed code with reproduction steps - Sage writing a long review → **not bureaucrat** if the change is large and every finding is actionable **Rule of thumb:** Shadow = behavior disconnected from the goal. Intensity alone is not a shadow.