Skip to content

cogpy/NNPL-253-253

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

30 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

p235

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.

🎯 META-RECURSIVE CONVERGENCE ACHIEVED

The Pattern Language Applied to Itself - This repository demonstrates optimal grip through iterative self-application of patterns to its own structure.

Hierarchical Base-6 Organization

  • 7 = 1 + 6: 1 meta-pattern + 6 dimensions
  • 43 = 1 + 6 + 36: meta + dimensions + 36 sequences
  • 253 = 1 + 6 + 36 + 210: Complete hierarchical structure

Fitness Metrics (100% Achieved)

Multi-scale Clarity:      100%  βœ“
Relationship Richness:    100%  βœ“
Contextual Relevance:     100%  βœ“
Gestalt Perception:       100%  βœ“
Interactive Navigation:   100%  βœ“
Self-Similarity:          100%  βœ“
──────────────────────────────────
OVERALL FITNESS:          100%  βœ“

Key Documents:

🎯 NEW: Optimal Grip Implementation

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.html

Documentation:

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.py

πŸ€– Agent Invocation System: Collaborative Pattern Intelligence

NEW: 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:

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 validated

πŸš€ Skill Framework: Pattern-Based Workflow System

NEW: 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:

# Run demo
python3 demo_skill_framework.py

# Run tests
python3 test_skill_framework.py

# Run integration examples
python3 integration_examples.py

🎯 Meta-Recursive Achievement

NEW: This repository now applies Pattern Language principles to itself, creating a living example of patterns in action!

The repository structure embodies the patterns it documents, achieving optimal cognitive grip on the gestalt through self-application.

πŸš€ NPU-253: Neural Processing Unit / Natural Patterning Unit

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:

# Run demo
python3 demo_npu253.py

# Run tests
python3 test_npu253.py

πŸ”’ APL Language Implementation

NEW: 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 1

Features:

  • ✨ 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:

# Run tests
python3 test_apl_implementation.py

# Generate data
python3 generate_apl_data.py

APL Files:

  • patterns.apl - Core pattern data structures
  • queries.apl - Search and query operations
  • transformations.apl - Domain transformations
  • relationships.apl - Pattern relationship navigation
  • demo.apl - Interactive demonstrations
  • data_loader.apl - Pattern data initialization

πŸ”„ Meta-Recursive Organization

Patterns Applied to Repository Structure:

This repository uses Pattern Language principles to organize itself:

Navigation & Access

Integration & Understanding

Cognitive Achievement

  • βœ… 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.

πŸ“– Documentation

For Contributors & AI Assistants

Formal Specifications

  • 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

Pattern Collections

  • 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

Markdown Versions

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.

Pattern Language Schema

The repository includes formalized JSON schemas for both the Pattern Language and Archetypal Patterns:

APL Pattern Language Schema

  • 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 (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.

Generating Schemas

# Generate APL Pattern Language schema
python3 generate_pattern_schema.py

# Generate Archetypal Pattern schema
python3 generate_archetypal_schema.py

Testing Schemas

# Test APL schema (if tests exist)
python3 validate_schema.py

# Test Archetypal schema
python3 test_archetypal_schema.py

Demo Schemas

# Demo APL schema
python3 demo_pattern_schema.py

# Demo Archetypal schema
python3 demo_archetypal_schema.py

OpenCog Atomese Representation

The Pattern Language has been converted to OpenCog's Atomese format for knowledge representation and pattern matching:

  • opencog_atomese/ - Complete Atomese hypergraph representation in Scheme format
    • pattern_language.scm - Complete representation
    • meta_pattern.scm - Meta-pattern
    • categories.scm - Categories with InheritanceLinks
    • sequences.scm - Sequences with MemberLinks
    • Enhanced Features:
      • pattern_language_enhanced.scm - Enhanced with diagrams, details, and connections
      • relationship_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.

Paradigm & Language Analysis

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.

Generating Atomese Files

# Generate base Atomese files
python3 generate_opencog_atomese.py

# Generate enhanced features
python3 generate_enhanced_atomese.py

Testing Atomese Files

# Test base files
python3 test_opencog_atomese.py

# Test enhanced features
python3 test_enhanced_atomese.py

Demo Enhanced Features

python3 demo_enhanced_atomese.py

Demo Query System

# Demo Datalog query integration (requires pyDatalog)
pip install pyDatalog
python3 demo_datalog_queries.py

About

Neural Network Pattern Language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •