This repository contains collections of design patterns and organizational metaphors with formal specifications, including a virtual hardware implementation (NPU-253) for accelerated pattern operations and an APL language implementation for array-based pattern analysis.
NEW: 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)
- 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/psychic)
- β‘ 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/psychic)
- π 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
- Psychic - 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