Note on Terminology: This repository now uses "individual" instead of the previously overloaded terms "psychic" or "interpersonal" to refer to the domain of consciousness, awareness, and mental patterns. This change improves clarity and reduces confusion with other meanings of these terms.
This repository contains collections of design patterns and organizational metaphors with formal specifications, including a virtual hardware implementation (NPU-253) for accelerated pattern operations, an APL language implementation for array-based pattern analysis, a Skill Framework for generalized pattern-based workflows, and an Optimal Grip Implementation for cognitive-aware pattern exploration.
The Pattern Language Applied to Itself - This repository demonstrates optimal grip through iterative self-application of patterns to its own structure.
- 7 = 1 + 6: 1 meta-pattern + 6 dimensions
- 43 = 1 + 6 + 36: meta + dimensions + 36 sequences
- 253 = 1 + 6 + 36 + 210: Complete hierarchical structure
Multi-scale Clarity: 100% β
Relationship Richness: 100% β
Contextual Relevance: 100% β
Gestalt Perception: 100% β
Interactive Navigation: 100% β
Self-Similarity: 100% β
ββββββββββββββββββββββββββββββββββ
OVERALL FITNESS: 100% β
Key Documents:
- PATTERN_SELF_APPLICATION.md - How patterns apply to themselves
- CONVERGENCE_VISUALIZATION.md - Visual diagrams of structure
- Test Suite - 23 passing tests validating convergence
- Analysis Tool - Fitness calculation and metrics
Cognitive "optimal grip" on the gestalt salience landscape - A complete multi-layer implementation featuring:
- π Datalog Query Layer: Declarative pattern discovery and relationship inference
- π§ ML Salience Engine: Context-aware relevance scoring and gestalt detection
- π¨ Interactive D3.js Visualization: Force-directed graph explorer with real-time filtering
- π REST API: FastAPI-based endpoints for programmatic access
- π Emergence Tracking: Detect synergistic pattern combinations
Quick Start:
# Install dependencies
pip install pyDatalog numpy fastapi uvicorn
# Start the API
python3 pattern_api.py
# Open visualization (in browser)
# file:///path/to/pattern_explorer.htmlDocumentation:
- Quick Start Guide - Get started in 5 minutes
- Implementation Analysis - Complete design rationale
- API Documentation - Swagger/OpenAPI (after starting API)
Features:
- π― Context-aware pattern salience scoring
- π Gestalt pattern detection (emergent groupings)
- π Emergence tracking in pattern sequences
- π Declarative Datalog queries with inference
- π¨ Interactive force-directed graph visualization
- π RESTful API with 7 endpoints
- π Multi-scale perception (Towns β Buildings β Construction)
Try it now:
# Demo the salience engine
python3 pattern_salience_engine.py
# Demo Datalog queries
python3 demo_datalog_queries.py
# Start API and open pattern_explorer.html in browser
python3 pattern_api.pyNEW: All 4,836 agents in the .github/agents/apl0/ hierarchy are now configured for cross-invocation, enabling sophisticated multi-agent collaboration!
User β @apl0/dim2 (Physical dimension agent)
β delegates to
@apl0/dim2/cat1 (Towns category agent)
β delegates to
@apl0/dim2/cat1/seq01 (Regional planning sequence)
β delegates to
@apl0/dim2/cat1/seq01/apl001 (INDEPENDENT REGIONS pattern)
Features:
- π€ 4,836 Specialized Agents across 6 dimensions, 18 categories, 216 sequences
- π Cross-Invocation Protocol: Any agent can invoke any other agent
- π Standardized Context Passing: Consistent format for task delegation
- π― Hierarchical Delegation: Agents delegate to appropriate specialists
- π Multi-Dimensional Views: Same pattern from physical/social/conceptual/individual perspectives
- π§ Navigation Support: Context agents help navigate pattern hierarchy
Agent Types:
- Dimension Agents (6) - Coordinate entire dimensions
- Category Agents (18) - Coordinate scale-specific work
- Sequence Agents (216) - Manage emergent phenomena
- Pattern Agents (1,555+) - Provide specific pattern guidance
- Context Agents (3,041+) - Navigate broader/narrower relationships
Documentation:
- Agent Invocation Guide - Complete reference
- Agent Invocation Examples - Detailed scenarios
- Quick Reference - Quick lookup
- .github/agents/apl0/README.md - Agent directory overview
Standard Context Format:
I am working on [task description].
So far I have [summary of work done].
I need help with [specific question] because [reason].
Constraints: [any limitations or requirements]
Related patterns in use: [list of pattern IDs]
Example Invocations:
# Get help with town design
@apl0/dim2/cat1 β Category agent for town-scale patterns
# Understand a specific pattern
@apl0/dim2/cat1/seq01/apl001 β INDEPENDENT REGIONS pattern
# Find what comes next
@apl0/dim2/cat1/seq01/apl001/narrower β Next patterns in hierarchy
# Multi-dimensional view
@apl0/dim2/.../apl028 (Physical)
@apl0/dim3/.../apl028 (Social)
@apl0/dim4/.../apl028 (Conceptual)Validation:
python3 validate_agent_invocation.py
# β All 4,836 agent files validatedNEW: Generalized framework for implementing sequences of skills as ordered routines defined by algorithmic workflows!
from skill_framework import Skill, SequenceBuilder, SkillWorkflow, WorkflowEngine
# Create skills from patterns
skill1 = Skill("apl1", "Independent Regions", "Design autonomous regions")
skill2 = Skill("apl2", "Distribution of Towns", "Balance urban settlements")
# Build sequence
sequence = (SequenceBuilder("regional", "Regional Planning")
.add_skill(skill1)
.add_skill(skill2)
.build())
# Execute workflow
context = SkillContext(domain="physical")
results = sequence.execute(context)Features:
- π― Domain-agnostic skill execution (physical/social/conceptual/individual)
- π Sequential and conditional workflow modes
- β Preconditions and postconditions validation
- π State management with scoped variables
- π Domain transformation support
- π Integration with pattern sequences and NPU-253
- β 17 passing tests
Documentation:
- Skill Framework README - Complete documentation
- Quick Reference - Quick start guide
- Demo | Tests | Integration Examples
# Run demo
python3 demo_skill_framework.py
# Run tests
python3 test_skill_framework.py
# Run integration examples
python3 integration_examples.pyNEW: This repository now applies Pattern Language principles to itself, creating a living example of patterns in action!
- PATTERN_MAP.md - Repository organized as 8 independent regions (Pattern 1)
- NAVIGATION_HUB.md - Multiple entry points for exploration (Pattern 28)
- SEQUENCE_NAVIGATION.md - Navigate 36 pattern sequences (Pattern 52)
- markdown/sequences/ - NEW: Comprehensive sequence documentation with aggregated problem-solution pairs
- PATTERN_INDEX.md - Comprehensive pattern access (Pattern 30)
- PATTERN_CROSS_REFERENCE.md - Links between representations (Pattern 8)
- META_RECURSIVE_IMPLEMENTATION.md - How patterns apply to themselves
The repository structure embodies the patterns it documents, achieving optimal cognitive grip on the gestalt through self-application.
NEW: Virtual hardware device implementing the 253-pattern language as a memory-mapped coprocessor!
from npu253 import PatternCoprocessorDriver, NPUConfig
npu = PatternCoprocessorDriver(NPUConfig())
npu.load()
# Query patterns
pattern = npu.query_by_id(1)
print(f"{pattern.name}: {pattern.solution}")
# Domain transformation
social = npu.transform_pattern("12610010", "social")Features:
- π§ Hardware-style MMIO register interface
- π― 253 APL patterns + 253 archetypal patterns
- π Domain transformation (physical/social/conceptual/individual)
- β‘ LRU caching for performance
- π Telemetry and diagnostics
- β 34 passing tests
Documentation:
- NPU-253 Blueprint - Architecture and design
- NPU-253 API - Complete API reference
- npu253/README.md - Package documentation
- Demo | Tests
# Run demo
python3 demo_npu253.py
# Run tests
python3 test_npu253.pyNEW: Array-based implementation in APL (A Programming Language)!
APL is a powerful array-oriented language perfect for pattern analysis and transformations. This implementation leverages APL's concise array operations for efficient pattern queries.
β Query patterns by category
towns β GetTownPatterns
β Transform archetypal pattern to domain
social β TransformToSocial pattern
β Find pattern relationships
connected β GetAllConnectedPatterns 1Features:
- β¨ 253 patterns as array-based data structures
- π Fast array-based queries and filters
- π Domain transformations (physical/social/conceptual/individual)
- π Relationship navigation and path finding
- π Pattern sequences and statistics
- π― ~1,900 lines of APL code
Documentation:
- apl_language/README.md - Module overview
- apl_language/INSTALLATION.md - Complete installation and usage guide
- Demo | Tests
# Run tests
python3 test_apl_implementation.py
# Generate data
python3 generate_apl_data.pyAPL Files:
patterns.apl- Core pattern data structuresqueries.apl- Search and query operationstransformations.apl- Domain transformationsrelationships.apl- Pattern relationship navigationdemo.apl- Interactive demonstrationsdata_loader.apl- Pattern data initialization
Patterns Applied to Repository Structure:
This repository uses Pattern Language principles to organize itself:
- PATTERN_MAP.md - 8 independent regions (Pattern 1: Independent Regions)
- NAVIGATION_HUB.md - Multiple entry points (Pattern 28: Eccentric Nucleus)
- SEQUENCE_NAVIGATION.md - Navigate 36 sequences (Pattern 52: Network of Paths)
- PATTERN_INDEX.md - Complete access (Pattern 30: Activity Nodes)
- PATTERN_CROSS_REFERENCE.md - Links between APL/UIA/Archetypal (Pattern 8: Mosaic of Subcultures)
- META_RECURSIVE_IMPLEMENTATION.md - Complete analysis of self-application
- .github/copilot-instructions.md - GitHub Copilot guidance using Pattern Language principles
- β Multi-scale perception: Navigate repository β region β sequence β pattern
- β Relationship richness: Clear connections between all elements
- β Contextual relevance: Find patterns by domain/context/need
- β Gestalt perception: See the whole as living system
- β Optimal grip: Structure supports understanding
The repository is both documentation of patterns and example of patterns in use.
- .github/copilot-instructions.md - GitHub Copilot instructions applying Pattern Language principles
- CLAUDE.md - Developer quick reference guide
- QUICK_REFERENCE.md - Essential commands and workflows
- Formal Specification Summary - Complete overview of architecture and Z++ specifications
- docs/ - Comprehensive technical documentation (2,328 lines)
- Architecture overview with Mermaid diagrams
- Z++ formal specifications (data model, system state, operations, integrations)
- Usage guide for specifications
- APL: Christopher Alexander's "A Pattern Language" (253 patterns) - architectural and urban design patterns
- UIA: Union of International Associations "Patterns & Metaphors" (253 patterns) - organizational and conceptual patterns
The markdown/ directory contains converted versions of all APL and UIA pages in markdown format for improved readability and accessibility:
markdown/apl/: 253 A Pattern Language patterns (apl001.md - apl253.md)markdown/uia/: 253 UIA Patterns & Metaphors (12610010.md - 12612530.md)markdown/arc/: 102 Archetypal Patterns extracted from UIA templates with domain-specific placeholders
See markdown/README.md for detailed information about the conversion process and markdown structure.
The repository includes formalized JSON schemas for both the Pattern Language and Archetypal Patterns:
- Pattern Language Schema (
pattern_language_generated.json) - Complete meta-pattern, categories, and sequences - Pattern Sequences (
pattern_sequences.json) - All 36 pattern sequences with emergent phenomena - Categories (
category_*.json) - Towns, Buildings, and Construction categories
See PATTERN_SCHEMA_README.md for detailed information about the APL schema structure.
- Archetypal Pattern Schema (
archetypal_pattern_schema.json) - JSON schema for archetypal patterns - Archetypal Patterns (
archetypal_patterns.json) - All 102 archetypal patterns with domain mappings - Placeholder Reference (
archetypal_placeholders.json) - Complete placeholder documentation
Archetypal patterns use the format: "generic {{domain-specific}} generic" and can be transformed across:
- Physical - Spatial, material, architectural domains
- Social - Organizational, community, institutional domains
- Conceptual - Knowledge, theoretical, paradigmatic domains
- Individual - Awareness, consciousness, mental domains
See ARCHETYPAL_SCHEMA_README.md for detailed information about the archetypal pattern schema.
# Generate APL Pattern Language schema
python3 generate_pattern_schema.py
# Generate Archetypal Pattern schema
python3 generate_archetypal_schema.py# Test APL schema (if tests exist)
python3 validate_schema.py
# Test Archetypal schema
python3 test_archetypal_schema.py# Demo APL schema
python3 demo_pattern_schema.py
# Demo Archetypal schema
python3 demo_archetypal_schema.pyThe Pattern Language has been converted to OpenCog's Atomese format for knowledge representation and pattern matching:
opencog_atomese/- Complete Atomese hypergraph representation in Scheme formatpattern_language.scm- Complete representationmeta_pattern.scm- Meta-patterncategories.scm- Categories with InheritanceLinkssequences.scm- Sequences with MemberLinks- Enhanced Features:
pattern_language_enhanced.scm- Enhanced with diagrams, details, and connectionsrelationship_types.scm- Pattern relationship types (complement, conflict, alternative)patterns/- Individual .scm files for modular loading
The Atomese format enables:
- Pattern matching and reasoning in OpenCog
- Hypergraph queries for pattern relationships
- Knowledge graph navigation and inference
- Integration with AI/AGI systems
See opencog_atomese/README.md for usage examples and opencog_atomese/ENHANCEMENTS.md for enhanced features documentation.
Comprehensive analysis of optimal implementation approaches for achieving cognitive "optimal grip" on the gestalt salience landscape:
-
PARADIGM_LANGUAGE_ANALYSIS.md - Complete paradigm and language evaluation
- Analysis of 6 programming paradigms (hypergraph, functional, logic, OOP, constraint, agent-based)
- Evaluation of 6+ languages (Scheme, Datalog, Python, Haskell, JavaScript, Prolog)
- Cognitive affordances mapping
- Recommended multi-layer architecture
-
IMPLEMENTATION_GUIDE.md - Practical implementation guide
- Concrete code examples for each layer
- Datalog query system integration
- Haskell domain transformation engine
- Python salience computation
- D3.js visualization framework
-
PARADIGM_COMPARISON_MATRIX.md - Detailed comparison matrices
- Cognitive requirements vs paradigms matrix
- Implementation tasks vs languages matrix
- Paradigm synergy analysis
- Use-case specific recommendations
Key Finding: Multi-paradigm approach required - Hypergraph (Scheme/OpenCog) foundation + Datalog queries + Functional transformations (Haskell) + Python integration + JavaScript visualization provides optimal cognitive affordances.
# Generate base Atomese files
python3 generate_opencog_atomese.py
# Generate enhanced features
python3 generate_enhanced_atomese.py# Test base files
python3 test_opencog_atomese.py
# Test enhanced features
python3 test_enhanced_atomese.pypython3 demo_enhanced_atomese.py# Demo Datalog query integration (requires pyDatalog)
pip install pyDatalog
python3 demo_datalog_queries.py