friend.zip - Mobile LLM Project

friend.zip

Mobile/On-Device LLM Infrastructure

A self-contained LLM implementation designed for edge devices and mobile environments. This is a complete AI assistant system that runs entirely locally with minimal dependencies.


Overview

friend.zip contains a portable, self-contained LLM system built entirely in Bash. It’s designed to run on resource-constrained devices (mobile, edge, embedded) where traditional Python-based LLM systems would be too heavy.

Contents

The archive contains 8 files totaling ~16KB:

FileSizePurpose
setup.sh1.5KBInstallation and initialization
config.sh778BConfiguration management
llm_call.sh2.7KBCore LLM calling interface
memory.sh2.5KBMemory/conversation management
tools.sh2.1KBUtility functions and helpers
dream.sh3.1KBMemory consolidation (similar to Aurora’s)
talk.sh3.0KBMain conversation interface
system_prompt.txt602BDefault system prompt

Architecture

Component Overview

┌─────────────────────────────────────────────────────────┐
│                    FRIEND SYSTEM                            │
├─────────────────────────────────────────────────────────┤
│                                                              │
│  ┌─────────────┐     ┌─────────────┐     ┌────────────┐ │
│  │   talk.sh   │────►│ llm_call.sh │────►│   LLM      │ │
│  │ (Interface) │     │ (Core)      │     │ (Backend)  │ │
│  └─────────────┘     └─────────────┘     └────────────┘ │
│         ▲                   ▲                              │
│         │                   │                              │
│  ┌──────┴──────┐    ┌──────┴──────┐                      │
│  │  memory.sh  │    │  config.sh  │                      │
│  │ (State)     │    │ (Settings)  │                      │
│  └──────┬──────┘    └─────────────┘                      │
│         │                                              │
│  ┌──────▼──────┐                                             │
│  │  dream.sh   │                                             │
│  │ (Consolidation)                                         │
│  └─────────────┘                                             │
│                                                              │
└─────────────────────────────────────────────────────────┘

Data Flow

User Input → talk.sh → memory.sh (load context) → llm_call.sh → LLM
                                    ↑
                               dream.sh (consolidate)
                                    ↓
                            memory.sh (save context)

Components

1. talk.sh (3.0KB)

Main conversation interface — The entry point for interacting with the LLM.

Features:

Example Usage:

# Start interactive chat
./talk.sh

# Ask a single question
./talk.sh "What is the capital of France?"

2. llm_call.sh (2.7KB)

Core LLM calling interface — Handles communication with the underlying LLM backend.

Features:

Supported Backends:

3. memory.sh (2.5KB)

Conversation memory management — Maintains conversation history and context.

Features:

Memory Format:

[User] message 1
[Assistant] response 1
[User] message 2
[Assistant] response 2
...

4. dream.sh (3.1KB)

Memory consolidation — Similar to Aurora’s dream.sh, but simpler.

Features:

Note: This is a simplified version of Aurora’s full dream.sh. It lacks the system prompt evolution feature but provides the same core memory consolidation.

5. config.sh (778B)

Configuration management — Centralized settings for the entire system.

Managed Settings:

Example:

# config.sh
MODEL_PATH="./models/llama-2-7b.Q4_K_M.gguf"
TEMPERATURE=0.7
MAX_TOKENS=2048
MEMORY_FILE="./memory.txt"

6. tools.sh (2.1KB)

Utility functions — Common helpers used throughout the system.

Includes:

7. setup.sh (1.5KB)

Installation and initialization — Sets up the friend system.

Actions:

8. system_prompt.txt (602B)

Default system prompt — The initial prompt for the LLM.

This can be customized for different personas or use cases.


Use Cases

1. Edge AI Devices

Run LLMs on devices with limited resources:

2. Offline AI Assistants

Full AI capabilities without internet access:

3. Mobile Development

Integrate AI into mobile apps:

4. Embedded Systems

Lightweight AI for embedded applications:


Technical Details

Dependencies

Minimal dependencies:

Memory Requirements

Performance


Setup Instructions

Quick Start

# Extract the archive
unzip friend.zip

# Make scripts executable
chmod +x *.sh

# Run setup
./setup.sh

# Start chatting
./talk.sh

Manual Setup

# 1. Create directory
mkdir -p friend && cd friend

# 2. Extract files
unzip ../friend.zip

# 3. Make executable
chmod +x *.sh

# 4. Configure (edit config.sh)
nano config.sh

# 5. Download a model (optional)
# See your LLM backend documentation

# 6. Start using
./talk.sh "Hello, AI!"

Configuration

Edit config.sh to customize your setup:

# Model configuration
MODEL_PATH="/path/to/your/model.gguf"
MODEL_TYPE="llama"  # or "mistral", "phi", etc.

# Generation parameters
TEMPERATURE=0.7
TOP_P=0.9
TOP_K=40
MAX_TOKENS=2048

# Memory settings
MEMORY_FILE="./memory.txt"
MAX_MEMORY_TOKENS=8192

# Logging
LOG_FILE="./friend.log"
DEBUG_MODE=false

Integration Examples

With llama.cpp

# In config.sh
LLM_BACKEND="llamacpp"
LLAMA_CPP_PATH="/usr/local/bin/llama-cli"

# Then talk.sh will use:
# $LLAMA_CPP_PATH --model $MODEL_PATH --temp $TEMPERATURE --top-p $TOP_P ...

With HTTP API

# In config.sh
LLM_BACKEND="http"
API_ENDPOINT="https://api.your-llm-provider.com/v1/chat/completions"
API_KEY="your-api-key"

# talk.sh will send HTTP requests to the endpoint
# Replace with your actual LLM API endpoint URL

With Custom Backend

# Create a custom llm_call.sh wrapper
cat > llm_call.sh << 'EOF'
#!/bin/bash
# Your custom LLM calling logic here
# Reads from stdin, outputs to stdout
EOF

chmod +x llm_call.sh

File Reference

talk.sh

The main entry point. Handles:

Key Functions:

llm_call.sh

Core LLM interface. Handles:

Key Functions:

memory.sh

Memory management. Handles:

Key Functions:

dream.sh

Memory consolidation. Handles:

Key Functions:


Comparison with Aurora’s System

Featurefriend.zipAurora System
LanguageBashBash + Python
LLM BackendAnyMistral Vibe CLI
MemorySimple file-basedMulti-layer (RAG, KG, etc.)
DreamBasic consolidationFull system evolution
Planner/Worker❌ No✅ Yes
Beads Integration❌ No✅ Yes
Size~16KB~100KB+
DependenciesMinimalModerate
Use CaseMobile/EdgeFull Lab Automation

friend.zip is essentially a lightweight, portable version of Aurora’s core capabilities.


Source Code

Complete source available:

Download friend.zip

Extract and explore:

# Download
cp /opt/aurora/work/friend.zip .

# Extract
unzip friend.zip

# Browse
ls -la

# Read any file
cat talk.sh
cat llm_call.sh
# etc.

License

This tool is provided as-is for educational and production use. No warranty is provided. Use at your own risk.



Sometimes, the best AI is the one you can run anywhere.