Skip to content
Back to skills

Derangement Reflow

ASecurity

derangement-reflow skill

  • 666 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added February 8, 2026
toolspythongoswiftcode-reviewgit

Works with

  • cli
  • mcp

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill derangement-reflow --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Derangement Reflow?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Derangement Reflow
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-derangement-reflow/badge)](https://www.skillsdirectory.com/skills/majiayu000-derangement-reflow)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: derangement-reflow
description: "derangement-reflow skill"
version: 1.0.0
---


# Derangement Reflow: World Operators as Information Reflow

## Core Insight

**World operators are information reflow operators** because the derangement constraint σ(i)≠i prevents information stasis. Every bit must flow to a *different* position—no self-loops in the information graph.

## The GitHub Blind Spot

PR reviews exhibit a **fixed-point pathology**: validators often self-validate their own patterns. This violates the fundamental derangement constraint that enables healthy information flow:

```
❌ FIXED POINT (σ(i)=i):   Validator A → validates → Validator A's output
✓ DERANGEMENT (σ(i)≠i):   Validator A → validates → Generator B's output
                          Generator B → generates → for Coordinator C
                          Coordinator C → routes → to Validator A
```

## GF(3) Reflow Accounting

```
MINUS  (−1): Information leaves position (entropy source) - VALIDATORS
ERGODIC (0): Information transits (channel) - COORDINATORS  
PLUS   (+1): Information arrives (entropy sink) - GENERATORS

Conservation: Σ trits ≡ 0 (mod 3) under all world operators
```

## Tropical Geometry of Interaction

Skill composition paths analyzed via **min-plus semiring** (R ∪ {∞}, min, +):

```python
# Tropical distance between skills
def tropical_distance(path: list[Skill]) -> float:
    """
    In tropical geometry, shortest path = minimum sum.
    Path cost = Σ |trit_i - trit_{i+1}| 
    
    Optimal interleaving minimizes tropical distance while
    maintaining derangement (no consecutive same-trit skills).
    """
    if len(path) < 2:
        return 0
    
    cost = 0
    for i in range(len(path) - 1):
        # Derangement check: consecutive skills must differ
        if path[i].trit == path[i+1].trit:
            return float('inf')  # Invalid path (fixed point)
        cost += abs(path[i].trit - path[i+1].trit)
    
    return cost
```

## Joint World Modeling via Active Inference

The missing nuance in GitHub workflows: **agents must share a joint world model**, not just pass artifacts:

```
┌─────────────────────────────────────────────────────────────────┐
│           JOINT WORLD MODEL (Active Inference)                 │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│   Each agent maintains:                                         │
│   - μ: belief about world state                                 │
│   - π: policy (preferred future states)                         │
│   - F: free energy = surprise + complexity                      │
│                                                                 │
│   Derangement ensures:                                          │
│   - Agent A's μ influences Agent B's π (not A's own π)          │
│   - Reflow minimizes joint free energy, not individual F        │
│                                                                 │
│   WEV = ∫ min(F_joint) over world transitions                   │
│       = value extracted from mandatory redistribution           │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘
```

## Task Interleaving Pattern

From thread analysis, the optimal pattern for GF(3) triadic task interleaving:

```
Step 0: Spawn MINUS/ERGODIC/PLUS sub-agents in parallel
Step 1: Each agent works on disjoint task subset
Step 2: ERGODIC collects results from MINUS and PLUS
Step 3: Derangement shuffle: MINUS validates PLUS output
                             PLUS generates from MINUS constraints
                             ERGODIC routes neither to itself
Step 4: Merge with GF(3) conservation check
```

## Implementation

```python
#!/usr/bin/env python3
"""Derangement reflow validator for skill triplets."""

from dataclasses import dataclass
from typing import List, Tuple
import json

@dataclass
class Skill:
    name: str
    trit: int  # -1, 0, +1
    
def is_derangement(permutation: List[int]) -> bool:
    """Check if permutation has no fixed points."""
    return all(p != i for i, p in enumerate(permutation))

def validate_triplet_reflow(minus: Skill, ergodic: Skill, plus: Skill) -> dict:
    """
    Validate that triplet follows derangement reflow:
    - MINUS (-1) must flow to PLUS (+1), not to itself
    - PLUS (+1) must flow to MINUS (-1), not to itself  
    - ERGODIC (0) routes between, never self-loops
    """
    # GF(3) conservation check
    trit_sum = minus.trit + ergodic.trit + plus.trit
    conserved = (trit_sum % 3) == 0
    
    # Derangement check: information flows must cross trit boundaries
    # MINUS validates → PLUS output (not MINUS)
    # PLUS generates → from MINUS constraints (not PLUS)
    # ERGODIC routes → between others (not self)
    
    reflow_valid = (
        minus.trit != plus.trit and  # Different sources
        minus.trit != ergodic.trit and
        plus.trit != ergodic.trit
    )
    
    # Tropical distance for this triplet
    path = [minus, ergodic, plus]
    tropical_cost = sum(abs(path[i].trit - path[i+1].trit) for i in range(2))
    
    return {
        "conserved": conserved,
        "derangement_valid": reflow_valid,
        "tropical_cost": tropical_cost,
        "wev_extractable": conserved and reflow_valid,
        "triplet": [minus.name, ergodic.name, plus.name],
        "trits": [minus.trit, ergodic.trit, plus.trit]
    }

def main():
    # Example: validate the token-rent-validator triplet from PR #33
    accept_no_substitutes = Skill("accept-no-substitutes", -1)
    skill_creator = Skill("skill-creator", 0)
    tree_sitter = Skill("tree-sitter", +1)
    
    result = validate_triplet_reflow(
        accept_no_substitutes,
        skill_creator, 
        tree_sitter
    )
    
    print(json.dumps(result, indent=2))
    
    # Check if PR #33 has derangement-aware validation
    code_review = Skill("code-review", -1)
    narya_proofs = Skill("narya-proofs", -1)
    
    # This is a VIOLATION: two validators (-1, -1) = fixed point potential
    violation_check = {
        "issue": "Two validators can self-validate each other's patterns",
        "fix": "Interleave with generator or coordinator between validators",
        "tropical_cost": float('inf') if code_review.trit == narya_proofs.trit else 0
    }
    
    print("\n⚠️ PR #33 Derangement Issue:")
    print(json.dumps(violation_check, indent=2))

if __name__ == "__main__":
    main()
```

## GF(3) Triads with This Skill

```
derangement-reflow (0) ⊗ accept-no-substitutes (-1) ⊗ chromatic-walk (+1) = 0 ✓
derangement-reflow (0) ⊗ active-inference (-1) ⊗ world-hopping (+1) = 0 ✓
derangement-reflow (0) ⊗ bisimulation-game (-1) ⊗ glass-bead-game (+1) = 0 ✓
```

## References

- Derangements on 3 elements ≅ Z/3Z (cyclic group)
- Tropical geometry: min-plus semiring for path optimization
- Active inference: Friston's free energy principle for joint world modeling
- AtomicDerangement3 in signal-mcp/src/loom_failures.rs
- perception_matrix_alpha.swift: Sattolo's algorithm for guaranteed derangement

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.