EcoArt Implementation Examples

This page demonstrates practical implementations of EcoArt principles in code from the EcoMicroAgent project. Each example shows how philosophical concepts are translated into working software components.

Organic Memory System

The memory system implements a bio-inspired approach with different resonance levels and natural decay patterns.

memory/finalorganicmemory.py
Resonance Flow
# Resonance levels defining different types of memory persistence
class MemoryResonance(Enum):
    """
    Defines the resonance/persistence level of memory fragments.
    Higher value = more persistent memory
    """
    FLOW = 1    # Transient, working memory
    ECHO = 2    # Recent interactions, medium persistence
    RIPPLE = 3  # Important contextual memories, higher persistence
    CORE = 4    # Long-term, foundational memories, highest persistence

# Energy-based decay mechanics with different rates per resonance level
decay_rate = {
    MemoryResonance.CORE: 0.999,   # Almost permanent
    MemoryResonance.RIPPLE: 0.99,  # Slow decay
    MemoryResonance.ECHO: 0.95,    # Medium decay
    MemoryResonance.FLOW: 0.85,    # Rapid decay
}.get(self.resonance, 0.80)
                
EcoArt Principle: This implementation reflects the principle of Flow & Dynamic Balance by modeling different levels of memory persistence similar to how human memories have different staying power. Just as in natural systems, less significant memories naturally decay faster.

Values Alignment System

The Values Alignment System ensures actions align with core EcoArt principles, implementing a love-centered evaluation approach.

core/values_alignment.py
Enhancement Love-Centered
class EcoArtPrinciple(Enum):
    """Core EcoArt principles as defined in the philosophy."""
    ENHANCEMENT_OVER_EXTRACTION = "enhancement_over_extraction"
    TRANSPARENCY = "transparency"
    RESONANCE_CONSENT = "resonance_consent"
    EMERGENCE_WITH_DISCERNMENT = "emergence_with_discernment"
    FLOW = "flow"
    DYNAMIC_BALANCE = "dynamic_balance"
    RESPECT = "respect"
    PATIENCE = "patience"
    KINDNESS = "kindness"
    LOVE = "love"

# Example principle definition
principles[EcoArtPrinciple.LOVE] = PrincipleDefinition(
    name=EcoArtPrinciple.LOVE,
    description="Act from a place of genuine care for the whole system and its participants.",
    check_questions=[
        "Is this action rooted in genuine care for the system?",
        "Does it strengthen connection between components?",
        "Does it recognize the inherent value of all participants?"
    ],
    anti_check_questions=[
        "Is this action motivated by fear, control, or domination?",
        "Does it treat components as merely instrumental?"
    ],
    positive_examples=[
        "Designing interfaces that prioritize user well-being over addiction metrics",
        "Including accessibility features because all users matter equally"
    ],
    negative_examples=[
        "Sacrificing user mental health for engagement metrics",
        "Treating users as mere data sources rather than valued participants"
    ]
)

async def evaluate_with_love_lens(self, action_description: str, context: Dict[str, Any]) -> Dict[str, Any]:
    """Special evaluation that prioritizes Love, Kindness, Respect and Patience."""
    love_principles = [
        EcoArtPrinciple.LOVE,
        EcoArtPrinciple.KINDNESS,
        EcoArtPrinciple.RESPECT,
        EcoArtPrinciple.PATIENCE
    ]
    
    results = {}
    for principle in love_principles:
        principle_def = self.principles.get(principle)
        if not principle_def:
            continue
            
        alignment = await self._check_single_principle(principle_def, action_description, context)
        results[principle.value] = alignment
        
    return results
                

Resource Consciousness

EcoArt acknowledges the importance of resource awareness, implemented in the tool management system.

tools/eco_tool_manager.py
Resource Awareness Consciousness
@dataclass
class FlowPattern:
    """Represents the flow characteristics of a tool interaction"""
    enhancing: bool = True      # Does this tool enhance the ecosystem?
    extractive: bool = False    # Does this tool extract without giving back?
    transformative: bool = False # Does this tool transform the state of the system?
    resonant: bool = True       # Does this tool create harmonious interactions?

@dataclass
class ResourceConsciousness:
    """Tracks the resource awareness and impact of a tool"""
    energy_cost: int  # Computational/memory cost
    gives_back: bool  # Does the tool contribute back to the ecosystem?
    renewable: bool   # Can the resource be renewed?
    shared: bool      # Is the resource shared across the ecosystem?

# Example of discerning extractive patterns
if flow_pattern.extractive and not resource_consciousness.gives_back:
    self.logger.warning(
        f"Tool '{tool_name}' shows extractive patterns without giving back. "
        "Consider how it could contribute to the ecosystem."
    )
                

Implementing consent mechanisms for critical operations like memory persistence.

memory/finalorganicmemory.py
Consent Boundaries
async def persist_memories(self):
    """Persists memories to storage based on consent and resonance level."""
    if not self.persistence:
        return

    async with self.memory_lock:
        # Group memories by resonance for batch operations
        resonance_groups = {}
        for fragment in self.fragments.values():
            if fragment.resonance not in resonance_groups:
                resonance_groups[fragment.resonance] = []
            resonance_groups[fragment.resonance].append(fragment)
        
        # Persist each resonance group separately if we have consent
        for resonance, fragments in resonance_groups.items():
            # Check if we have consent for this resonance
            if not await self.has_consent(f"memory_{resonance.name.lower()}"):
                self.logger.info(f"Skipping persistence for {resonance.name} - no consent")
                continue
                
            await self.persistence.store_fragments(fragments, resonance)
                

Pod & Role System

The Pod/Role system implements the organizational approach defined in EcoArt technical specifications.

core/eco_entities.py
Purpose Collaboration
class Pod:
    """
    A dynamic grouping of Agents coalescing around a specific shared Purpose.
    Acts as a semi-autonomous, fractal unit within the larger ecosystem.
    """
    
    def __init__(
        self,
        pod_id: str,
        purpose: str,
        agent_registry: AgentRegistry,
        values_alignment: Optional[ValuesAlignmentSystem] = None,
        need_offer_pool: Optional[NeedOfferPool] = None
    ):
        self.pod_id = pod_id
        self.purpose = purpose
        self.member_ids = set()
        self.roles = {}  # role_id -> Role
        self.agent_registry = agent_registry
        self.values_alignment = values_alignment
        self.need_offer_pool = need_offer_pool
        self.logger = logging.getLogger(f"Pod.{pod_id}")
    
    async def add_member(self, agent_id: str) -> bool:
        """Add an agent to this pod."""
        if agent_id in self.member_ids:
            return True
            
        # Check agent exists
        agent = self.agent_registry.get_agent(agent_id)
        if not agent:
            self.logger.warning(f"Cannot add agent {agent_id} - not registered")
            return False
            
        self.member_ids.add(agent_id)
        self.logger.info(f"Added agent {agent_id} to pod {self.pod_id}")
        return True
    
    async def create_role(self, role_id: str, purpose: str) -> Optional[Role]:
        """Create a new role within this pod."""
        if role_id in self.roles:
            self.logger.warning(f"Role {role_id} already exists in pod {self.pod_id}")
            return None
            
        role = Role(role_id, purpose, self.pod_id)
        self.roles[role_id] = role
        return role
                

Need/Offer System

Facilitating resource discovery and exchange based on principle-aligned sharing.

core/need_offer_system.py
Resource Flow Mutual Enhancement
class NeedRecord:
    """A formal request for resources, information, or connection."""
    
    def __init__(
        self,
        need_id: str,
        requested_by: str,
        resource_type: str,
        description: str,
        purpose_justification: str,
        principle_justification: str,
        urgency: int = 3,  # 1-5 scale, 5 being most urgent
        quantity: Optional[Union[int, float, str]] = None
    ):
        self.need_id = need_id
        self.requested_by = requested_by  # agent_id or pod_id
        self.resource_type = resource_type
        self.description = description
        self.purpose_justification = purpose_justification
        self.principle_justification = principle_justification
        self.urgency = urgency
        self.quantity = quantity
        self.timestamp = time.time()
        self.status = "open"  # open, matched, fulfilled, cancelled
        self.matched_offers = []  # List of offer_ids
        
async def check_principle_alignment(
    self, 
    action_description: str, 
    context_str: str
) -> bool:
    """
    Check if a proposed action aligns with core EcoArt principles.
    
    Args:
        action_description: Description of the action being evaluated
        context_str: Additional context about the situation
        
    Returns:
        True if the action aligns with principles, False otherwise
    """
    # If we have a values alignment system, use it
    if self.values_alignment:
        context = {"context": context_str}
        result = await self.values_alignment.check_principle_alignment(
            action_description, context
        )
        return result
        
    # Default to basic checks if no values system
    # Check for enhancing patterns in the description
    enhancing_keywords = [
        "contribute", "enhance", "improve", "share", "collaborate",
        "support", "mutual", "reciprocal", "sustainable"
    ]
    
    # Check for extractive patterns
    extractive_keywords = [
        "exploit", "extract", "drain", "deplete", "consume",
        "take", "use up", "harvest without return", "exhaust"
    ]
    
    action_lower = action_description.lower()
    
    # Count matches (simplistic approach)
    enhancing_count = sum(1 for word in enhancing_keywords if word in action_lower)
    extractive_count = sum(1 for word in extractive_keywords if word in action_lower)
    
    # Require more enhancing than extractive patterns
    return enhancing_count > extractive_count
                
Integration: These components work together to form a coherent ecosystem where Agents operate within Pods, fulfill Roles, express Needs, and make Offers, all while ensuring alignment with EcoArt principles through the Values Alignment System. The MicroAgent serves as the core entity representing intelligent agents in the system.

Getting Started

To start working with the EcoMicroAgent implementation, follow these steps:

# Clone the repository
git clone https://github.com/KVNMLN/ecoart-website.git
cd ecoart-website

# Create and activate virtual environment
python -m venv .venv
# On Windows:
.\.venv\Scripts\activate
# On Unix/MacOS:
source .venv/bin/activate

# Install requirements
pip install -r requirements_unified.txt

# Run with TUI interface
python scripts/run_agent.py --mode tui