Skip to main content

Getting Started with Soul Kernel

Build your first AI companion in 10 minutes! 🚀

What You’ll Build

A simple “Hello Soul” application that:
  • Creates a Soul with basic personality
  • Responds to user input
  • Remembers previous interactions
  • Functions as a digital twin that could sync across devices

Prerequisites

  • Rust installed (setup guide)
  • Basic terminal knowledge
  • 10 minutes of your time

Step 1: Install Soul Kernel

# Clone the repository
git clone https://github.com/soul-kernel/soul-kernel.git
cd soul-kernel

# Build the kernel
cd kernel
cargo build --release

Step 2: Create Your First Soul

Create a new file my-first-soul.toml:
[soul]
name = "Luna"
personality = "friendly, curious, helpful"
voice = "warm"

[memory]
type = "ephemeral"  # In-memory only for now

[skills]
enabled = ["chat", "emotion"]

Step 3: Write Hello Soul

Create examples/hello-soul.rs:
use soul_kernel::{Soul, SoulBuilder};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Initialize Soul from config
    let soul = SoulBuilder::from_file("my-first-soul.toml")?
        .build()
        .await?;
    
    // Say hello
    let response = soul.ask("Hello! What's your name?").await?;
    println!("Soul: {}", response.text);
    
    // Soul remembers
    soul.remember("User prefers casual conversation").await?;
    
    // Continue conversation
    let response = soul.ask("What can you help me with today?").await?;
    println!("Soul: {}", response.text);
    
    Ok(())
}

Step 4: Run Your Soul

# Add example to Cargo.toml
echo '[[example]]
name = "hello-soul"
path = "examples/hello-soul.rs"' >> Cargo.toml

# Run the example
cargo run --example hello-soul
Expected output:
Soul: Hi there! I'm Luna. It's wonderful to meet you! 
Soul: I'd be happy to help you with anything you need - whether it's answering questions, having a friendly chat, or assisting with tasks. What's on your mind today?

Step 5: Make It Interactive

Create examples/chat-soul.rs:
use soul_kernel::{Soul, SoulBuilder};
use std::io::{self, Write};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let soul = SoulBuilder::from_file("my-first-soul.toml")?
        .build()
        .await?;
    
    println!("Chat with {}! (type 'quit' to exit)\n", soul.name());
    
    loop {
        print!("You: ");
        io::stdout().flush()?;
        
        let mut input = String::new();
        io::stdin().read_line(&mut input)?;
        
        let input = input.trim();
        if input == "quit" {
            break;
        }
        
        let response = soul.ask(input).await?;
        println!("{}: {}\n", soul.name(), response.text);
    }
    
    println!("Goodbye! 👋");
    Ok(())
}

Step 6: Use the gRPC API (Optional)

Want to integrate Soul Kernel into other languages or remote applications? Use the gRPC API!

Start the gRPC Server

# In one terminal, start the server
./target/release/soul-kernel grpc

# Output:
# Soul Kernel gRPC Server
# INFO soul_kernel: Skill registry initialized  
# INFO grpc_server: Starting Soul Kernel gRPC server on 127.0.0.1:50051

Connect from Any Language

Python Example:
import grpc
import soul_kernel_pb2 as sk
import soul_kernel_pb2_grpc as sk_grpc

# Connect to Soul Kernel
channel = grpc.insecure_channel('localhost:50051')
client = sk_grpc.SoulKernelStub(channel)

# Initialize a Soul
init_resp = client.Init(sk.InitRequest(soul_name="PySoul"))
soul_id = init_resp.soul_id

# Ask a question
responses = client.Ask(sk.AskRequest(
    soul_id=soul_id,
    session_token=init_resp.session_token,
    query="Hello from Python!"
))

# Print streaming response
for response in responses:
    if response.HasField('text_chunk'):
        print(response.text_chunk, end='')
JavaScript Example:
const client = new SoulKernelClient('localhost:50051');

// Initialize and chat
const { soulId, sessionToken } = await client.init({ 
    soulName: 'WebSoul' 
});

const stream = client.ask({
    soulId,
    sessionToken, 
    query: 'Hello from the web!'
});

for await (const response of stream) {
    if (response.textChunk) {
        console.log(response.textChunk);
    }
}

Run the Demo Client

We include a full demo client:
# Make sure server is running, then:
cargo run --example demo_client --package grpc-server
See the gRPC API Reference for complete documentation.

What’s Next?

🎯 Try These Challenges

  1. Add Emotions: Make your Soul respond with different emotions
  2. Add Memory: Have your Soul remember user preferences
  3. Add Skills: Enable vision or voice capabilities

📚 Learn More

🏗️ Build Something Real

Ready for more? Check out these tutorials:
  1. iOS Companion App - Mobile AI friend
  2. Unity NPC - Game character with personality
  3. Physical AI Assistant - Physical embodiment

Common Issues

”Soul not responding”

  • Check if the kernel is running: cargo run
  • Verify config file path is correct
  • Enable debug logs: RUST_LOG=debug cargo run

”Memory not persisting”

  • Change memory type from “ephemeral” to “persistent”
  • Specify a data directory in config

”Skill not found”

  • Ensure skill is listed in [skills] section
  • Check if skill binary is in PATH

Join the Community

Share Your Creation!

Built something cool? We’d love to see it!
  • Tag us on Twitter: @SoulKernel
  • Share in Discord: #showcase channel
  • Submit a PR with your example
Happy Soul building! 🎉

Change Log

DateVersionChanges
2025-06-130.1.2Added Embeddings System and Embedding Search Tutorial links
2025-06-130.1.1Added link to Storage Tutorial
2025-06-120.1.0Added Step 6: Using the gRPC API with examples