Skip to content
sprachgefuehl-string-rewriting logo

Sprachgefühl String Rewriting

sprachgefuehl-string-rewriting

Counterfactual conceptual string rewriting with trapezoid termination for recursive rendering of phenomenologically-rich diagrams.

plurigrid/asi0installs67starsOther

SKILL.md

Full skill instructions

Sprachgefühl String Rewriting

Plastic Constant ψ: For GF(3) systems, prefer ψ≈1.3247 (x³=x+1) over φ. See PLASTIC_CONSTANT.md

Trit: 0 (ERGODIC - mediates between phenomenal concepts)

Counterfactual conceptual string rewriting with trapezoid termination for recursive rendering of phenomenologically-rich diagrams.

Core Concept

German phenomenological vocabulary → String diagram morphisms → Counterfactual rewriting → Trapezoid collapse

Anschauung ──┐
             ├──▷ StringDiagram ──▷ Rewrite ──▷ ⏢ (Trapezoid)
Stimmung ────┘                         ↑
                                       │
                              Counterfactual

Linked Skills (Phenomenological Chain)

DeutschSkillTritString Type
Anschauungsegal-types0Composition wire
Zeitgeistprotocol-evolution-markets0Temporal morphism
Stimmungqri-valence0Valence field
Bewusstseincybernetic-immune0Self-reference loop
Empfindungactive-inference+1Sensation box
Einfühlungsheaf-laplacian-coordination+1Harmonic extension
Gestaltbisimulation-game+1Pattern node
Weltanschauungglass-bead-game+1World crossing
Strahlunggay-mcp-1Color emanation
Erlebnisreafference-corollary-discharge-1Experience wire
Umweltworld-hopping-1Environment boundary
Vorstellunghierarchical-control-1Reference signal

String Rewriting Rules

from discopy import Ty, Box, Diagram, Functor

# Phenomenological types
Anschauung = Ty('Anschauung')    # Direct intuition
Stimmung = Ty('Stimmung')        # Mood-atmosphere
Gestalt = Ty('Gestalt')          # Organized whole
Erlebnis = Ty('Erlebnis')        # Lived experience

# Trapezoid terminator (recursive base case)
class Trapezoid(Box):
    """Terminal morphism: collapses string to phenomenal unity."""
    def __init__(self, dom):
        super().__init__('⏢', dom, Ty())  # Maps to unit type

# Counterfactual rewriting
class Counterfactual(Box):
    """What-if morphism: rewrites string under alternative."""
    def __init__(self, original, alternative):
        self.original = original
        self.alternative = alternative
        super().__init__(f'CF({original}→{alternative})', 
                        original.cod, alternative.cod)

# Recursive string diagram with trapezoid termination
def recursive_render(diagram, depth=0, max_depth=3):
    """Render diagram recursively, terminate with trapezoid."""
    if depth >= max_depth:
        return Trapezoid(diagram.cod)
    
    # Apply counterfactual rewriting
    rewritten = counterfactual_rewrite(diagram)
    
    # Recurse
    return diagram >> recursive_render(rewritten, depth + 1, max_depth)

def counterfactual_rewrite(diagram):
    """Rewrite under German phenomenological counterfactual."""
    # Stimmung → Gestalt (mood becomes pattern)
    # Anschauung → Erlebnis (intuition becomes experience)
    rules = {
        'Stimmung': 'Gestalt',
        'Anschauung': 'Erlebnis',
        'Empfindung': 'Bewusstsein',
        'Vorstellung': 'Weltanschauung'
    }
    return apply_rules(diagram, rules)

Trapezoid Semantics

The trapezoid (⏢) represents:

  1. Categorical: Terminal object / unit morphism
  2. Phenomenological: Collapse to unified experience
  3. Computational: Base case of recursion
  4. GF(3): Conservation checkpoint
    ┌───────────────────┐
    │   Input Wires     │  (Anschauung ⊗ Stimmung ⊗ Gestalt)
    └─────────┬─────────┘
              │
              ▼
    ┌───────────────────┐
    │   Rewrite Step    │  Counterfactual(Stimmung → Gestalt)
    └─────────┬─────────┘
              │
              ▼
    ┌───────────────────┐
    │   Rewrite Step    │  Counterfactual(Anschauung → Erlebnis)
    └─────────┬─────────┘
              │
              ▼
         ╱─────────╲
        ╱    ⏢      ╲     TRAPEZOID: Phenomenal Unity
        ╲           ╱     GF(3) = 0 ✓
         ╲─────────╱

Clojure Implementation

(ns sprachgefuehl-string
  (:require [clojure.string :as str]))

(def PLASTIC 1.32471795724474602596)

;; Phenomenological types as keywords
(def pheno-types
  {:anschauung  {:trit 0  :english "intuition"}
   :stimmung    {:trit 0  :english "mood"}
   :gestalt     {:trit 1  :english "pattern"}
   :erlebnis    {:trit -1 :english "experience"}
   :bewusstsein {:trit 0  :english "consciousness"}})

;; String diagram as nested vectors
(defrecord StringDiagram [inputs outputs boxes])

;; Trapezoid terminator
(defrecord Trapezoid [inputs])

(defn trapezoid? [x] (instance? Trapezoid x))

;; Counterfactual rewrite rules
(def cf-rules
  {:stimmung :gestalt
   :anschauung :erlebnis
   :empfindung :bewusstsein
   :vorstellung :weltanschauung})

(defn counterfactual-rewrite [diagram]
  (update diagram :boxes
          (fn [boxes]
            (mapv (fn [b]
                    (if-let [alt (get cf-rules (:type b))]
                      (assoc b :type alt :counterfactual true)
                      b))
                  boxes))))

(defn recursive-render
  "Render string diagram recursively with trapezoid termination."
  [diagram & {:keys [depth max-depth] :or {depth 0 max-depth 3}}]
  (if (>= depth max-depth)
    ;; TRAPEZOID TERMINATION
    (->Trapezoid (:outputs diagram))
    ;; Recursive step
    (let [rewritten (counterfactual-rewrite diagram)]
      {:diagram diagram
       :rewritten rewritten
       :continuation (recursive-render rewritten 
                                       :depth (inc depth) 
                                       :max-depth max-depth)})))

;; GF(3) conservation check at trapezoid
(defn trapezoid-gf3-check [trapezoid]
  (let [trits (map #(get-in pheno-types [% :trit] 0) (:inputs trapezoid))]
    {:inputs (:inputs trapezoid)
     :trits trits
     :sum (reduce + trits)
     :conserved? (zero? (mod (reduce + trits) 3))}))

Mermaid Visualization

flowchart TB
    subgraph INPUT["Input Layer"]
        A["Anschauung<br/>Trit: 0"]
        S["Stimmung<br/>Trit: 0"]
        G["Gestalt<br/>Trit: +1"]
        E["Erlebnis<br/>Trit: -1"]
    end
    
    subgraph CF1["Counterfactual Rewrite 1"]
        CF1a["Stimmung → Gestalt"]
        CF1b["Anschauung → Erlebnis"]
    end
    
    subgraph CF2["Counterfactual Rewrite 2"]
        CF2a["Pattern merge"]
    end
    
    subgraph TRAP["⏢ TRAPEZOID"]
        T["Phenomenal Unity<br/>GF(3) = 0 ✓"]
    end
    
    A --> CF1a
    S --> CF1a
    G --> CF1b
    E --> CF1b
    CF1a --> CF2a
    CF1b --> CF2a
    CF2a --> T
    
    style A fill:#7231ac,stroke:#fff,color:#fff
    style S fill:#a6e6ea,stroke:#000,color:#000
    style G fill:#dd4c4c,stroke:#fff,color:#fff
    style E fill:#add98e,stroke:#000,color:#000
    style T fill:#ffd700,stroke:#000,color:#000

Usage

# Run recursive string rewriting
bb -e '(require (quote sprachgefuehl-string))
       (def d (->StringDiagram [:anschauung :stimmung] [:gestalt] []))
       (recursive-render d :max-depth 3)'

GF(3) Triads

Skill TriadSum
segal-types (0) ⊗ sprachgefuehl-string-rewriting (0) ⊗ qri-valence (0)0 ✓
gay-mcp (-1) ⊗ sprachgefuehl-string-rewriting (0) ⊗ bisimulation-game (+1)0 ✓
world-hopping (-1) ⊗ sprachgefuehl-string-rewriting (0) ⊗ glass-bead-game (+1)0 ✓

Mutually Aware Skills

These skills share GF(3) triadic structure with plastic constant ψ:

See: PLASTIC_CONSTANT.md


Autopoietic Marginalia

The interaction IS the skill improving itself.

Every use of this skill is an opportunity for worlding:

  • MEMORY (-1): Record what was learned
  • REMEMBERING (0): Connect patterns to other skills
  • WORLDING (+1): Evolve the skill based on use

Add Interaction Exemplars here as the skill is used.

More Other skills

Delegate independent tasks to specialized agents working concurrently with isolated context.

295.4K 206.3K
View

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

179.7K 100.1K
View

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

179.7K 89.5K
View

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

179.7K 76.1K
View

Fundamental design principles for writing maintainable, testable Python code.

40.2K 21.9K
View

Modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first strategies.

40.2K 20K
View

Generate Playwright tests from scenarios using interactive browser exploration and validation.

39.7K 18.2K
View

Modern React state management with Redux Toolkit, Zustand, Jotai, and React Query for every state category.

40.2K 14.7K
View

GDPR-compliant data handling with consent management, data subject rights, and privacy controls.

40.2K 14.3K
View

Python error handling patterns including input validation, exception hierarchies, and partial failure handling. Use when implementing validation logic, designing exception strategies, handling batch processing failures, or building robust APIs.

40.2K 13.5K
View

Detailed multi-file refactor planning with safety checks and rollback guidance.

39.7K 13K
View