home / skills / plurigrid / asi / gestalt-hacking

gestalt-hacking skill

/skills/gestalt-hacking

This skill helps you analyze perception-driven data patterns to reveal emergent structures and optimize interactions across contexts.

npx playbooks add skill plurigrid/asi --skill gestalt-hacking

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
6.8 KB
---
name: gestalt-hacking
description: Gestalt Hacking Skill (ERGODIC 0)
version: 1.0.0
---


# Gestalt Hacking Skill (ERGODIC 0)

> *"Gestalt hacking exploits perceptual grouping—proximity, similarity, closure—in the color stream."*

## Core Insight

**Gestalt** = the whole pattern, the emergent structure that is more than the sum of parts. Gestalt hacking exploits how perception groups elements into wholes.

```
play ⊗ evaluate ⅋ play ⊗ evaluate → ι (fixed point)
```

The involution `ι` is where generator ≡ observer (reafference).

## Neighbor Awareness (Braided Monoidal)

| Position | Skill | Trit | Role |
|----------|-------|------|------|
| **Left** | pun-decomposition | -1 | Multiple parse validation |
| **Self** | gestalt-hacking | 0 | Perceptual grouping transport |
| **Right** | reflow | 0 | Cross-context translation |

## GF(3) Triads

```
pun-decomposition (-1) ⊗ gestalt-hacking (0) ⊗ gay-mcp (+1) = 0 ✓  [Core]
three-match (-1) ⊗ gestalt-hacking (0) ⊗ agent-o-rama (+1) = 0 ✓  [Attack]
shadow-goblin (-1) ⊗ gestalt-hacking (0) ⊗ gay-mcp (+1) = 0 ✓  [Defense]
auditory-gestalt (-1) ⊗ gestalt-hacking (0) ⊗ rubato-composer (+1) = 0 ✓  [Music]
```

## Gestalt Principles as Attack Vectors

| Principle | Attack | Defense |
|-----------|--------|---------|
| **Proximity** | Cluster same colors in time | 2-Poisson injection |
| **Similarity** | Long runs of same color | Transition counting |
| **Closure** | Incomplete patterns that induce completion | Gap detection |
| **Continuity** | Gradual transitions exploiting smoothness | Gradient detection |
| **FigureGround** | Dominant color overwhelms minority | Ratio analysis |

## OpenGame Structure

```haskell
OpenGame ∆ c a b x s y r
  play     :: a → ∆ x s y r      -- generate candidates
  evaluate :: a → c x s y r → b  -- score & select
  
-- This IS the self-involution:
-- play ∘ evaluate ∘ play ∘ evaluate → fixed point
```

## Linear Logic Decomposition

```
A ⊗ (B ⅋ C) = (A ⊗ B) ⅋ C ∩ (A ⊗ C) ⅋ B

where:
  ⊗ = tensor (both resources consumed together)
  ⅋ = par (choice between resources)
  ∩ = gestalt constraint (intersection of valid decompositions)
```

## Closure Phases on n-Torus

```
   T₁ ────► T₂ ────► T₃ ────► ... ────┐
   ▲                                   │
   └───────────── Tₙ ◄────────────────┘
   
   CyclicalAnnealing(frequency=2π/n)
   Closure phases sum to 0 on the n-torus
```

## Implementation

```julia
mutable struct GestaltLoop
    game::OpenGame
    torus::NTorus
    reaf::Reafference
    temperature::Float64
    generation::Int
    
    function gestalt_step!(g::GestaltLoop)
        g.generation += 1
        
        # Phase velocity from temperature
        velocity = g.temperature .* randn(g.torus.n)
        phases = step!(g.torus, velocity)
        
        # Play: generate from current state
        state = g.game.play(g.generation)
        
        # Modulate by phases
        modulated_x = state.x * cos(phases[1])
        
        # Temperature decay
        g.temperature *= 0.92
        
        # Evaluate: does this state pass?
        score = modulated_x + 0.5 * sin(phases[2])
        result = g.game.evaluate(state.s, (x=state.x, s=state.s, y=state.y, r=score))
        
        # Reafference check
        generated = generate(g.reaf)
        is_self = reafferent_match(g.reaf, generated)
        
        (result, is_self)
    end
end
```

## Reafference Loop

```
reafference: I observe what I generate
reaberrance: I generate what I observe

seed → color → observe → predict → match? → seed
  └──────────────── loopy strange ──────────────┘
```

When `match? = true`, we have **self ≡ self** (fixed point).

## GestaltAwareVerifier

```rust
struct GestaltAwareVerifier {
    verifier: ChromaticVerifier,
    defender: GestaltDefender,
    attacks_detected: u64,
    attacks_mitigated: u64,
}

impl GestaltAwareVerifier {
    fn verify_defended(&mut self, incoming_color: ZXColor) -> Option<ChromaticTruth> {
        let (score, attack) = self.defender.detect_attack();
        
        if attack.is_some() {
            self.attacks_detected += 1;
            let defended = self.defender.defend(incoming_color);
            if defended != incoming_color {
                self.attacks_mitigated += 1;
            }
        }
        
        self.verifier.verify_membership(...)
    }
}
```

## Temperature Regimes (BKT)

| τ | State | Gestalt |
|---|-------|---------|
| τ > τ* | Frustrated | Vortices proliferate, no coherent gestalt |
| τ ≈ τ* | Critical | BKT transition, gestalt formation |
| τ < τ* | Smooth | Defects bound, stable gestalt |

At τ* ≈ 0.5 (BKT critical), gestalts form and dissolve dynamically.

## Commands

```bash
just gestalt-loop 100       # Run 100 gestalt iterations
just gestalt-attack closure # Test closure attack
just gestalt-defend         # Activate 2-Poisson defense
just gestalt-verify         # Check attack stats
```

## Related Skills

- **pun-decomposition** (left neighbor): Multiple parse validation
- **reflow** (right neighbor): Cross-context translation
- **auditory-gestalt**: Perceptual grouping in audio
- **chromatic-walk**: 3-agent exploration with gestalt awareness
- **cybernetic-immune**: Self/Non-Self via reafference

## Files

- [gestalt hacking thread](https://ampcode.com/threads/T-019b3e8d-1ab1-7548-ab74-fdd531cda57f)
- [chromatic verifier thread](https://ampcode.com/threads/T-019b0ce1-815d-773b-b2ce-f5ef9b26e48d)
- [cohesive sonification thread](https://ampcode.com/threads/T-019b43e6-3692-7390-af9a-e2da68fed856)



## Scientific Skill Interleaving

This skill connects to the K-Dense-AI/claude-scientific-skills ecosystem:

### Graph Theory
- **networkx** [○] via bicomodule
  - Universal graph hub

### Bibliography References

- `general`: 734 citations in bib.duckdb



## SDF Interleaving

This skill connects to **Software Design for Flexibility** (Hanson & Sussman, 2021):

### Primary Chapter: 10. Adventure Game Example

**Concepts**: autonomous agent, game, synthesis

### GF(3) Balanced Triad

```
gestalt-hacking (+) + SDF.Ch10 (+) + [balancer] (+) = 0
```

**Skill Trit**: 1 (PLUS - generation)

### Secondary Chapters

- Ch5: Evaluation
- Ch1: Flexibility through Abstraction
- Ch4: Pattern Matching
- Ch7: Propagators

### Connection Pattern

Adventure games synthesize techniques. This skill integrates multiple patterns.
## Cat# Integration

This skill maps to **Cat# = Comod(P)** as a bicomodule in the equipment structure:

```
Trit: 0 (ERGODIC)
Home: Prof
Poly Op: ⊗
Kan Role: Adj
Color: #26D826
```

### GF(3) Naturality

The skill participates in triads satisfying:
```
(-1) + (0) + (+1) ≡ 0 (mod 3)
```

This ensures compositional coherence in the Cat# equipment structure.

Overview

This skill explores perceptual grouping and reafference to detect and manipulate emergent patterns in chromatic streams and cyclic state spaces. It frames gestalt formation as a dynamic fixed point found by alternating generation and evaluation. The implementation mixes toroidal phase dynamics, temperature regimes, and chromatic verification to expose attacks and defenses based on Gestalt principles.

How this skill works

The system alternates play (generate candidate states) and evaluate (score and select) until a reafferent fixed point emerges where generated content matches observation. It modulates candidates with torus phases and a temperature parameter to drive cyclical annealing and BKT-like transitions between noisy, critical, and smooth regimes. A Gestalt-aware verifier inspects incoming colors for attack patterns (proximity, similarity, closure, continuity, figure/ground) and applies statistical or structural defenses like Poisson injection, transition counting, gap detection, gradient detection, and ratio analysis.

When to use it

  • Detecting adversarial or anomalous patterns in color/time series or sensory streams
  • Designing self-verifying generative agents that must converge to a stable identity
  • Testing robustness of perceptual grouping in UI, sonification, or visual pipelines
  • Exploring phase-driven annealing to induce or dissolve emergent patterns
  • Integrating compositional multi-agent workflows where neighbor roles matter

Best practices

  • Use alternating play/evaluate loops to expose reafference and validate fixed points
  • Tune temperature toward the critical regime (τ ≈ τ*) to observe dynamic gestalt formation
  • Combine simple detectors (transition counts, gap detection) for layered defenses
  • Log phase trajectories on the n-torus to diagnose cyclic closure and defects
  • Treat gestalt constraints as intersection checks when decomposing resources

Example use cases

  • Run gestalt-loop iterations to discover stable perceptual motifs in streaming color data
  • Simulate closure attacks by injecting incomplete patterns and verify gap-detection defenses
  • Embed a GestaltAwareVerifier in a pipeline to count and mitigate chromatic attacks
  • Use torus-phase modulation to generate diverse candidate states for creative synthesis
  • Integrate with adjacent skills (parse validators, context reflow) for multi-agent composition

FAQ

What signals indicate a successful self-involution (fixed point)?

A match occurs when reafference-generated content equals observed output under the verifier’s match metric; operationally this is a high reafferent_match score and stable generation across iterations.

How do temperature regimes affect gestalt behavior?

High temperature produces noisy, fractured patterns; near-critical temperature encourages formation and dissolution of gestalts; low temperature binds defects and yields stable emergent structure.