early-technical-insights

Type: fact
Tags: amigospeagotechnicalarchitecturehistory
Created: Thu Oct 30 2025 00:00:00 GMT+0000 (Coordinated Universal Time)

Early Technical Insights (from Peago Phase)

Technical concepts from the early “Peago” design phase that may still be relevant for Amigos.

Transpiler Architecture

Original Vision

// .peago file (source)
package myapp

var counter int // Persistent by default

func Increment() {
    counter++ // Auto-persisted
}

// Transpiles to .pea.go
package myapp

import "peago/runtime"

var counter = runtime.State[int]("counter")

func Increment() {
    counter.Update(func(val int) int {
        return val + 1
    })
}

Insights for Amigos

Copy-on-Write State Design

COW Storage Model

State Version Tree:
├── v1: Initial state
├── v2: After first write
│   └── Only changed values stored
├── v3: After second write
│   └── Delta from v2
└── HEAD: Current state

Benefits Identified

Universal Import Resolution

Import Syntax Unification

// All these work the same way:
import "local/package"           // Local file
import "github.com/user/repo"    // GitHub
import "chain.com/contract"      // Blockchain
import "ipfs://Qm..."           // IPFS

Resolution Strategy

  1. Check local cache first
  2. Resolve via appropriate protocol
  3. Verify integrity/signatures
  4. Cache for offline use

Contract-First Philosophy

Everything as Contracts

// Even config is a contract
type Config struct {
    Port int
    Host string
}

// Configs can import other configs
import baseConfig "company/standard-config"

var config = Config{
    baseConfig.Config,
    Port: 8080, // Override
}

Design Implications

State Synchronization Ideas

Multi-Master Sync

Node A: State v1 → v2 → v3
                    ↘
                     Merge → v4
                    ↗
Node B: State v1 → v2'

Conflict Resolution

Testing Philosophy

State-Aware Testing

func TestCounter(t *testing.T) {
    // Each test gets fresh state
    state.Reset()
    
    Increment()
    assert.Equal(t, 1, counter)
    
    // Can test state persistence
    state.Save()
    state.Reset()
    state.Load()
    assert.Equal(t, 1, counter)
}

Test Scenarios

Rendering System Design

Automatic UI Generation

type TodoList struct {
    Items []string
}

// Auto-generates UI
func (t TodoList) Render() string {
    // Default HTML rendering
}

// Custom rendering
func (t TodoList) RenderMobile() string {
    // Mobile-specific UI
}

Security Considerations (Early Thoughts)

State Isolation

Resource Limits

// Proposed annotations
//go:peago maxstate=1GB
//go:peago maxcompute=1000ms
package myapp

Developer Experience Goals

Zero Configuration

Progressive Complexity

Deprecated Ideas

Package Suffixes (.peago)

Custom Standard Library

Explicit State Markers

Valuable Concepts to Preserve

  1. COW Storage - Still relevant for efficiency
  2. Universal Imports - Core to Amigos vision
  3. Everything as Contracts - Unified model
  4. State Versioning - Git for state
  5. Zero Config - Critical for adoption

Integration with Current Design

These early insights should inform:

The Peago phase established key principles that remain central to Amigos: simplicity, universality, and persistence by default.

Sources

See also

← Back to Knowledge Base