Skip to content

pm_encoder v1.3.1 - The Twins Architecture 🐍🦀

Choose a tag to compare

@alanbld alanbld released this 13 Dec 20:06
· 191 commits to main since this release

🐍🦀 The Twins Architecture

pm_encoder v1.3.1 establishes dual-engine development - Python and Rust evolving together.

🎯 What This Release Brings

Two Production-Track Engines:

Python v1.3.1              Rust v0.1.0
(The Reference)            (The Performance)
────────────────          ────────────────
✅ 95% coverage           ✅ Library-first
✅ 93 tests               ✅ WASM-ready
✅ Production ready       ✅ PyO3-ready
✅ 7 languages            ✅ Zero deps
✅ Independently audited  ✅ 5 tests passing

Timeline Acceleration:

  • Original plan: Rust in Q2 2026
  • Actual delivery: December 13, 2025
  • 6 months ahead of schedule!

📚 New Documentation

THE_TWINS_ARCHITECTURE.md (347 lines)

Complete architectural documentation covering:

  • The Decision: Why two engines, why now, why open source
  • The Architecture: Library-first pattern, test vector contract
  • The Development Flow: How Python and Rust validate each other
  • The Roadmap: v0.1.0 → v1.0.0 (Dec 2025 - Q2 2026)
  • The Philosophy: "Twins grow together" - 4 core principles
  • For Contributors: Clear guidance on contributing to either engine

KNOWLEDGE_BASE.md

Consolidated reference optimized for AI sessions:

  • Quick status and architecture overview
  • Decisions log and roadmap
  • Token-efficient context guidance
  • Single source of truth (~2000 token savings)

🏗️ Infrastructure

Test Vector Contract:

test_vectors/
├── README.md                    # Specification
├── basic_serialization.json     # Output format contract
└── python_analyzer.json         # Structure extraction contract

Purpose: Ensure Python and Rust produce byte-identical output.

Unified Build System:

make test         # Run all tests (Python + Rust)
make test-python  # Python suite only
make test-rust    # Rust suite only
make test-cross   # Validate outputs match
make version      # Show both engine versions

🦀 Rust Engine Architecture

Library-First Pattern:

// src/lib.rs - The Brain (pure logic)
pub fn serialize_project(root: &str) -> Result<String, String>

// src/bin/main.rs - The Interface (CLI wrapper)
fn main() {
    pm_encoder::serialize_project(&path)  // Thin wrapper
}

This Enables:

  1. WASM Compilation (future):

    #[wasm_bindgen]
    pub fn serialize_wasm(root: &str) -> String {
        pm_encoder::serialize_project(root).unwrap()
    }
  2. Python Bindings (future):

    #[pyfunction]
    fn serialize(root: &str) -> PyResult<String> {
        pm_encoder::serialize_project(root)
            .map_err(|e| PyErr::new::<PyRuntimeError, _>(e))
    }
  3. Independent Testing:

    #[test]
    fn test_serialize() {
        let result = serialize_project(".");
        assert!(result.is_ok());
    }

All interfaces consume the same lib.rs!


📊 Current Status

Component Python v1.3.1 Rust v0.1.0
Core Serialization ✅ Production ⏳ Skeleton
Test Coverage 95% (93 tests) 100%* (5 tests)
Language Analyzers 7 complete 0 (planned)
Context Lenses 4 built-in 0 (planned)
Truncation Modes 3 modes 0 (planned)
Dependencies 0 0
WASM Ready No Yes
PyO3 Ready No Yes

*Skeleton-only coverage


🗺️ Rust Roadmap

v0.2.0 - Core Serialization (Week of Dec 16)

  • Directory traversal
  • Include/exclude patterns
  • Plus/Minus format output
  • MD5 checksums
  • Pass basic test vectors

v0.3.0 - Test Parity (Week of Dec 23 🎄)

  • Pass all Python test vectors
  • Byte-identical output verified
  • Performance benchmarks

v0.4.0-0.8.0 - Features (Q1 2026)

  • Language analyzers (Python, JS, Rust)
  • Lens system
  • Truncation modes

v1.0.0 - Production (Q2 2026)

  • Full feature parity
  • 10x performance vs Python
  • Binary distribution
  • WASM module

🤝 The Multi-AI Story

This release represents collaboration between:

  • AI Studio (Gemini): Strategic analysis, QA architecture
  • Claude Opus: Senior architecture review, refinements
  • Claude Code Server: Implementation, testing, documentation
  • Claude Sonnet: Orchestration, narrative, coordination
  • Human Architect: Vision, quality standards, final decisions

Result: Multi-AI consensus on dual-engine architecture.


📦 Installation

Python Engine (Production):

curl -O https://raw.githubusercontent.com/alanbld/pm_encoder/main/pm_encoder.py
chmod +x pm_encoder.py
./pm_encoder.py --version  # pm_encoder 1.3.1

Rust Engine (Development):

git clone https://github.com/alanbld/pm_encoder.git
cd pm_encoder/rust
cargo build --release
./target/release/pm_encoder --version  # v0.1.0

For Development (Both Engines):

git clone https://github.com/alanbld/pm_encoder.git
cd pm_encoder
make test  # Runs tests for both engines

🎯 Why This Matters

For Users:

  • Choose the right engine for your use case
  • Python for quick development and prototyping
  • Rust for performance-critical CI/CD pipelines

For Contributors:

  • Contribute to either/both engines
  • Clear architectural guidance
  • Test vectors ensure compatibility

For The Ecosystem:

  • Demonstrates multi-language implementation feasibility
  • Library-first pattern enables modularity
  • Open source from day 1 maximizes collaboration

📚 Resources


🎁 Santa Lucia Delivery

Released December 13, 2025 - Festival of Light 🕯️

From problem to dual-engine architecture in 48 hours.

The Twins are born. Let them grow together. 🐍🦀


Full Changelog: v1.3.0...v1.3.1-twins