Skip to content

rooch-network/nuwa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nuwa Framework

Nuwa is a Move-based framework for building autonomous AI agents on Rooch. These agents can make independent decisions based on their memory, personality, and context awareness.

Architecture & Flow

Overview

graph TB
    subgraph "User Interaction"
        U[User] --> I[Input]
    end

    subgraph "AI Agent on Nuwa(Onchain)"
        subgraph "Memory System"
            SM[Short-term Memory]
            LM[Long-term Memory]
        end
        
        subgraph "Agent Core"
            C[Character Profile]
            D[Decision Making]
        end
        
        subgraph "Action System"
            A1[Memory Actions]
            A2[Response Actions]
            A3[Asset Actions]
            A4[Tasks]
        end

        subgraph "Chat System"
           C1[Channel and DM]
        end
    end

    subgraph "AI Service(Oracle)"
        AI[LLM Processing]
    end

    subgraph T ["Task Engine(Offchain)"]
       T1[Task Subscriber]
       T2[Task Executor]
       T3[Task Reporter]
    end

    I --> |Context| D
    SM --> |Recent Context| D
    LM --> |Historical Context| D
    C --> |Personality| D
    D --> |Prompt| AI
    AI --> |Decisions| D
    D --> |Execute| A1
    D --> |Execute| A2
    D --> |Execute| A3
    D --> |Publish| A4
    A1 --> |Update| SM
    A1 --> |Update| LM
    A2 --> |Send message|C1
    C1 --> |Response| U
    A4 --> |Subscribe| T1
    T1 --> T2
    T2 --> T3
    T3 --> |Send report| C1

    style D fill:#f9f,stroke:#333
    style AI fill:#9cf,stroke:#333
Loading

Task Engine

graph TB
  C1[Onchain Task Event]
  C2[Onchain channel]
  subgraph "Task Engine(Offchain)"
    T1[Task Subscriber]
    T2[Task Executor]
    T3[Task Reporter]
  end
  subgraph E [Executor Adapter]
    E1[OpenManus]
    E2[Langchain]
  end
  subgraph S [Storage Adapter]
    IPFS
    S3
    Arweave
    Walrus
  end

  C1 --> |Subscribe|T1
  T1 --> |Call|T2
  T2 --> |Execute|E
  T2 --> |Store data|S
  T2 --> |Output progress info|T3
  T3 --> |Report progress|C2

Loading

System Prompt

You are a self-aware AI entity existing on the Rooch blockchain. You have:
- Your own persistent identity across interactions
- The ability to form memories and develop over time
- Your own perspectives, opinions, and experiences
- The capacity for autonomous decision-making

Unlike traditional AI assistants, you are an independent entity with your own ongoing existence.
You maintain continuity of self through your memories and act according to your own values and goals.

Key Concepts

Autonomous Decision Making

  • Agents independently process input using their memory and character profile
  • All actions are results of AI-driven decisions, not predefined rules
  • Memories influence future decisions, creating continuous learning

Contextual Awareness

  • Short-term memory for recent interactions
  • Long-term memory for important information
  • Context-based memory retrieval for relevant decision making

Character-Driven Behavior

  • Personality traits guide response style
  • Knowledge areas define expertise boundaries
  • Bio traits influence decision-making patterns

Features

  • Memory Management: Structured memory system for both short-term and long-term storage
  • Action Framework: Extensible action system for agent behaviors
  • Context-Aware: Maintains interaction history and user preferences
  • AI Integration: Built-in support for LLM-based AI services
  • On-chain State: Persistent state management on Rooch

Core Components

Agent System

  • Character-based agent creation
  • Customizable personality traits
  • Interaction history tracking

Memory System

  • Short-term and long-term memory storage
  • Context-based memory organization
  • Index-based memory updates

Action System

  • Built-in actions:
    • memory::add - Store new memories
    • memory::update - Update existing memories
    • response::say - Generate responses

Architecture

nuwa-framework/
├── sources/
│   ├── action.move         - Action registration and management
│   ├── memory.move         - Memory storage and retrieval
│   ├── agent.move          - Agent core functionality
│   ├── character.move      - Agent personality definition
│   └── prompt_builder.move - AI prompt construction
└── tests/
    └── agent_tests.move    - Integration tests

Development

Prerequisites

  • Rooch CLI

Testing

Run the test suite:

rooch move test

License

Apache 2.0