recursive-systems-architect
Designs self-referential and recursive systems that examine, modify, or generate themselves, including metacognitive architectures and strange loops.
What this skill does
# Recursive Systems Architect
This skill provides guidance for designing systems that operate on themselves—self-referential structures, metacognitive architectures, and recursive processes that create emergent properties through strange loops.
## Core Competencies
- **Self-Reference**: Systems that examine or modify themselves
- **Strange Loops**: Hierarchical tangles where levels fold back
- **Metacognition**: Systems that reason about their own reasoning
- **Fixed Points**: Stable states in recursive processes
- **Emergence**: Properties arising from recursive interaction
## Foundations of Recursive Systems
### What Makes a System Recursive
```
Traditional System: Recursive System:
Input → Process → Output Input → Process → Output
↑ │
└─────────┘
Process operates on
itself or its outputs
```
### Types of Self-Reference
| Type | Description | Example |
|------|-------------|---------|
| Direct | System references itself explicitly | `function f() { return f; }` |
| Indirect | System references itself via another | A references B, B references A |
| Hierarchical | Higher level describes lower level | Metadata about data |
| Strange Loop | Levels fold back unexpectedly | Gödel sentences |
### The Strange Loop Pattern
Douglas Hofstadter's concept: moving through levels of a hierarchy, you unexpectedly find yourself back where you started.
```
Level 3: Meta-rules (rules about rules)
↑ │
Level 2: Rules │
↑ │
Level 1: Objects │
↑ ↓
└────────────────────┘
Level 3 can modify Level 1,
which affects what reaches Level 3
```
## Recursive Architecture Patterns
### Self-Modifying Code
```python
# System that modifies its own behavior
class SelfModifyingAgent:
def __init__(self):
self.rules = {
'default': lambda x: x * 2
}
self.meta_rules = {
'optimize': self._optimize_rules
}
def process(self, input):
result = self.rules['default'](input)
# System examines its own performance
self._reflect_on_result(result)
return result
def _reflect_on_result(self, result):
# Meta-level: decide whether to modify rules
if self._should_modify():
self.meta_rules['optimize']()
def _optimize_rules(self):
# Modify the rule that produced the result
# This is the recursive fold-back
self.rules['default'] = self._generate_better_rule()
```
### Metacognitive Loop
```
┌─────────────────────────────────────────────────────────┐
│ Metacognitive Architecture │
├─────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────┐ │
│ │ Meta-Cognitive Layer │ │
│ │ • Monitor cognitive processes │ │
│ │ • Evaluate strategy effectiveness │ │
│ │ • Modify cognitive strategies │ │
│ └──────────────────┬──────────────────────────┘ │
│ │ observes & modifies │
│ ▼ │
│ ┌─────────────────────────────────────────────┐ │
│ │ Cognitive Layer │ │
│ │ • Execute reasoning strategies │ │
│ │ • Process information │ │
│ │ • Generate outputs │ │
│ └──────────────────┬──────────────────────────┘ │
│ │ produces │
│ ▼ │
│ ┌─────────────────────────────────────────────┐ │
│ │ Ground Layer │ │
│ │ • Raw inputs and outputs │ │
│ │ • Environmental interaction │ │
│ └─────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────┘
```
### Fixed Point Iteration
Many recursive systems seek fixed points—states where further iteration produces no change:
```python
def find_fixed_point(f, initial, tolerance=1e-6, max_iter=1000):
"""Find x where f(x) = x"""
x = initial
for i in range(max_iter):
x_next = f(x)
if abs(x_next - x) < tolerance:
return x_next # Fixed point found
x = x_next
return x # May not have converged
# Self-consistent beliefs example
def belief_update(beliefs):
"""Update beliefs based on other beliefs"""
new_beliefs = {}
for key, value in beliefs.items():
# Each belief influenced by related beliefs
related = get_related_beliefs(beliefs, key)
new_beliefs[key] = aggregate(value, related)
return new_beliefs
# Find equilibrium beliefs
stable_beliefs = find_fixed_point(belief_update, initial_beliefs)
```
### Quine Pattern (Self-Reproduction)
A quine is a program that outputs its own source code:
```python
# Python quine
s = 's = %r\nprint(s %% s)'
print(s % s)
```
This pattern extends to systems that can describe or reconstruct themselves:
```python
class SelfDescribingSystem:
"""System that can generate its own specification"""
def __init__(self, config):
self.config = config
self.state = {}
def describe(self):
"""Generate a complete description of this system"""
return {
'type': self.__class__.__name__,
'config': self.config,
'state': self.state,
'methods': self._describe_methods()
}
def reconstruct(self, description):
"""Create a new instance from description"""
return self.__class__(description['config'])
def clone(self):
"""Self-reproduction via self-description"""
description = self.describe()
return self.reconstruct(description)
```
## Recursive System Design Patterns
### Observer-Observed Duality
```python
class ReflectiveSystem:
"""System that is both observer and observed"""
def __init__(self):
self.observations = []
self.self_model = {}
def act(self, action):
# Perform action
result = self._execute(action)
# Observe self performing action
self._observe_self(action, result)
# Update self-model based on observation
self._update_self_model()
return result
def _observe_self(self, action, result):
observation = {
'action': action,
'result': result,
'predicted': self.self_model.get('predicted_result'),
'surprise': self._compute_surprise()
}
self.observations.append(observation)
def _update_self_model(self):
# Self-model predicts own behavior
# Discrepancies drive model updates
recent = self.observations[-10:]
self.self_model['patterns'] = self._find_patterns(recent)
self.self_model['predicted_result'] = self._predict_next()
```
### Recursive Decomposition
Break problems into self-similar sub-problems:
```python
def recursive_solve(problem, depth=0, max_depth=10):
"""Solve by recursive decomposition"""
# Base case: problem is atomic
if is_atomic(problem) or depth >= max_depth:
return solve_directly(problem)
# Recursive case: decompose and solve
subproblems = decompose(problem)
subsolutions = [recursive_solve(sp, depth + 1) for sp in subproblems]
# Combine subsolutions
solution = combine(subsolutions)
# Meta-level: evaluate solution quality
if not satisfactory(solution, problem):
# TrRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.