Skip to content

Go-based AI assistant with auto-summary sessions and BM25+RAG memory system

License

Notifications You must be signed in to change notification settings

hoorayman/rizzclaw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

46 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

RizzClaw 🐾

RizzClaw Logo

AI-Powered Coding Assistant

license go version

Introduction

RizzClaw is an AI-powered intelligent coding assistant built on MiniMax large language models. It helps developers with various tasks including code writing, debugging, file operations, web search, and more.

✨ Core Features

πŸš€ Gateway Multi-Channel Support

RizzClaw 0.2.0 introduces Gateway Mode, supporting multiple channels for AI interaction:

  • Feishu (Lark) - Enterprise instant messaging integration
  • Console - Command-line interactive mode
  • Extensible Architecture - Easy to add Telegram, Discord, and more channels

Gateway Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Gateway                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”‚
β”‚  β”‚ Agent   │◄──►│  MessageBus  β”‚       β”‚
β”‚  β”‚  Loop   β”‚    β”‚              β”‚       β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜       β”‚
β”‚         β–²              β”‚                β”‚
β”‚         β”‚         β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”          β”‚
β”‚         β”‚         β”‚ Channelsβ”‚          β”‚
β”‚         β”‚         β”œβ”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€          β”‚
β”‚         β”‚         β”‚Feishuβ”‚Consoleβ”‚      β”‚
β”‚         β”‚         β””β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”˜          β”‚
β”‚         β–²                              β”‚
β”‚    LLM API                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Multi-User Session Isolation

Gateway mode supports multiple users simultaneously, with each user/group having independent conversation context:

User A DM β†’ feishu_chat_aaa_user_aaa.jsonl
User B DM β†’ feishu_chat_bbb_user_bbb.jsonl
Group Chat β†’ feishu_group_ccc_user_aaa.jsonl

🧠 Smart Session Management (Auto-Summary)

RizzClaw features an intelligent session compression mechanism that automatically manages context windows during long conversations:

  • Auto-Compression Trigger: Compression is triggered when session tokens exceed the threshold (default: 50% of 128K)
  • Smart Summary Generation: Early conversations are compressed into concise summaries, preserving key information while significantly reducing token usage
  • Configurable Parameters:
    • MaxTokens: Maximum token limit (default: 128000)
    • MaxHistoryShare: Maximum share of history messages (default: 0.5)
    • MinMessagesToKeep: Number of recent messages to keep (default: 10)
    • ChunkRatio: Compression ratio (default: 0.4)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Session History                                             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  [Summary] Summary of 50 earlier messages...                β”‚
β”‚  [Summary] Summary of 30 mid-session messages...            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  [Recent] User: Help me refactor this function              β”‚
β”‚  [Recent] Assistant: Sure, let me help you...               β”‚
β”‚  ...                                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ’Ύ Long-term Memory System (BM25 + RAG)

RizzClaw implements an advanced hybrid retrieval memory system supporting long-term knowledge storage and intelligent recall:

Hybrid Retrieval Architecture

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   User Query      β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β–Ό              β–Ό              β–Ό
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚  Vector Search β”‚ β”‚  BM25 Keyword  β”‚
     β”‚  (Semantic)    β”‚ β”‚  (Exact Match) β”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚                  β”‚
             β”‚    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β–Ό    β–Ό
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚   Score Fusion     β”‚
     β”‚  Vector: 0.7       β”‚
     β”‚  Keyword: 0.3      β”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β–Ό
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚   MMR Reranking    β”‚
     β”‚   (Optional)       β”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β–Ό
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚   Temporal Decay   β”‚
     β”‚   (Optional)       β”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β–Ό
         Final Results

Core Technologies

Technology Description
BM25 Full-text Search Built on SQLite FTS5, supports Chinese and English keyword search with precise matching of key terms in user queries
Vector Semantic Search Supports embedding model integration for semantic-level similarity search, understanding query intent beyond keyword matching
Hybrid Score Fusion Vector search weight 0.7 + keyword search weight 0.3, fully customizable
MMR Diversity Reranking Maximal Marginal Relevance algorithm avoids overly similar results, improving information coverage
Temporal Decay Based on exponential decay function, older memories have lower weights with default 30-day half-life
Evergreen Memory Memories marked as Evergreen never decay, ideal for storing user preferences, project context, and other long-term information

Memory Storage

type MemoryEntry struct {
    ID          string    // Unique identifier
    Content     string    // Memory content
    Embedding   []float32 // Vector embedding
    Keywords    []string  // Extracted keywords
    Source      string    // Source (e.g., "MEMORY.md", "conversation")
    CreatedAt   time.Time // Creation timestamp
    IsEvergreen bool      // Whether it's an evergreen memory
}

Search Configuration

type SearchOptions struct {
    MaxResults     int     // Maximum number of results (default: 6)
    MinScore       float64 // Minimum score threshold (default: 0.35)
    VectorWeight   float64 // Vector search weight (default: 0.7)
    KeywordWeight  float64 // Keyword search weight (default: 0.3)
    UseMMR         bool    // Enable MMR (default: false)
    MMRLambda      float64 // MMR relevance weight (default: 0.7)
    TemporalDecay  bool    // Enable temporal decay (default: true)
    HalfLifeDays   float64 // Temporal decay half-life (default: 30 days)
}

πŸ› οΈ Other Features

  • πŸ€– AI-Powered - Built on advanced MiniMax M2.1/M2.5 large language models
  • πŸ“ Rich Tools - Built-in file operations, code execution, web search, and more
  • ⚑ Skill System - Support for loading custom skill extensions

πŸ” Web Search

  • DuckDuckGo Integration - Uses DuckDuckGo HTML search instead of Bing for better accessibility
  • Proxy Support - Automatically reads proxy configuration from environment variables:
    • HTTP_PROXY / http_proxy - HTTP proxy
    • HTTPS_PROXY / https_proxy - HTTPS proxy
    • NO_PROXY / no_proxy - Bypass proxy for specific hosts

Tech Stack

  • Language: Go 1.23+
  • CLI Framework: Cobra
  • Configuration: Viper
  • Database: SQLite3 (memory storage)
  • Full-text Search: SQLite FTS5 (BM25)
  • LLM Provider: MiniMax API

Quick Start

Screenshot

RizzClaw Console

Installation

# Clone the project
git clone https://github.com/hoorayman/rizzclaw.git
cd rizzclaw

# Build
go build -o rizzclaw ./main.go

# Run
./rizzclaw chat

Configuration

  1. Copy the example config file:
cp config.example.json ~/.rizzclaw/config.json
  1. Edit config.json and add your MiniMax API Key:
{
  "models": {
    "mode": "merge",
    "providers": {
      "minimax": {
        "baseUrl": "https://api.minimaxi.com/anthropic",
        "apiKey": "API_KEY",
        "api": "anthropic-messages",
        "models": [
          {
            "id": "MiniMax-M2.1",
            "name": "MiniMax M2.1",
            "reasoning": false,
            "input": ["text"],
            "cost": {
              "input": 0.3,
              "output": 1.2,
              "cacheRead": 0.03,
              "cacheWrite": 0.12
            },
            "contextWindow": 200000,
            "maxTokens": 8192
          },
          {
            "id": "MiniMax-M2.1-lightning",
            "name": "MiniMax M2.1 Lightning",
            "reasoning": false,
            "input": ["text"],
            "cost": {
              "input": 0.3,
              "output": 1.2,
              "cacheRead": 0.03,
              "cacheWrite": 0.12
            },
            "contextWindow": 200000,
            "maxTokens": 8192
          },
          {
            "id": "MiniMax-M2.5",
            "name": "MiniMax M2.5",
            "reasoning": true,
            "input": ["text"],
            "cost": {
              "input": 0.3,
              "output": 1.2,
              "cacheRead": 0.03,
              "cacheWrite": 0.12
            },
            "contextWindow": 200000,
            "maxTokens": 8192
          },
          {
            "id": "MiniMax-M2.5-Lightning",
            "name": "MiniMax M2.5 Lightning",
            "reasoning": true,
            "input": ["text"],
            "cost": {
              "input": 0.3,
              "output": 1.2,
              "cacheRead": 0.03,
              "cacheWrite": 0.12
            },
            "contextWindow": 200000,
            "maxTokens": 8192
          },
          {
            "id": "MiniMax-VL-01",
            "name": "MiniMax VL 01",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": {
              "input": 0.3,
              "output": 1.2,
              "cacheRead": 0.03,
              "cacheWrite": 0.12
            },
            "contextWindow": 200000,
            "maxTokens": 8192
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "minimax/MiniMax-M2.5": {
          "primary": "minimax/MiniMax-M2.5",
          "alias": "Minimax"
        }
      },
      "timeout": 120
    }
  }
}

Usage

# Show help
rizzclaw --help

# Start interactive chat (Console mode)
rizzclaw chat

# Start Gateway service
rizzclaw gateway

# Start Gateway in debug mode (show message logs)
rizzclaw gateway -d

# List available models
rizzclaw models

# Show current configuration
rizzclaw config show

Interactive Commands

In chat mode, the following commands are available:

Command Description
/exit or /quit Exit the conversation
/clear Clear current session history
/help Show help information

Feishu Integration

  1. Create an enterprise app on Feishu Open Platform and obtain App ID and App Secret

  2. Add Feishu configuration to config.json:

{
  "channels": {
    "feishu": {
      "enabled": true,
      "app_id": "cli_xxxxxxxx",
      "app_secret": "xxxxxxxx",
      "encrypt_key": "optional",
      "verification_token": "optional",
      "allow_from": []
    }
  }
}
  1. Start the Gateway service:
rizzclaw gateway
  1. Search for your app in Feishu and start chatting

Feishu Conversation Examples

Feishu Example 1 Feishu Example 2 Feishu Example 3

Project Structure

rizzclaw/
β”œβ”€β”€ cmd/                # CLI command entry
β”‚   └── root.go         # Root command and chat command
β”œβ”€β”€ internal/           # Internal packages
β”‚   β”œβ”€β”€ agent/          # Agent core logic
β”‚   β”‚   β”œβ”€β”€ agent.go    # Agent implementation
β”‚   β”‚   └── session.go  # Session management
β”‚   β”œβ”€β”€ llm/            # LLM client abstraction
β”‚   β”œβ”€β”€ tools/          # Tool collection
β”‚   β”œβ”€β”€ context/        # Context management
β”‚   β”‚   β”œβ”€β”€ manager.go  # Context manager
β”‚   β”‚   β”œβ”€β”€ session.go  # Session storage & compression
β”‚   β”‚   β”œβ”€β”€ memory.go   # Memory storage & retrieval
β”‚   β”‚   └── types.go    # Type definitions
β”‚   β”œβ”€β”€ minimax/        # MiniMax API integration
β”‚   └── config/         # Configuration management
β”œβ”€β”€ docs/               # Documentation resources
β”‚   └── pics/           # Image resources
└── main.go             # Program entry point

Supported Models

Model Name Type Context Window Max Output
MiniMax-M2.1 Text 200K 8K
MiniMax-M2.1-lightning Text 200K 8K
MiniMax-M2.5 Reasoning 200K 8K
MiniMax-M2.5-Lightning Reasoning 200K 8K
MiniMax-VL-01 Multimodal 200K 8K

Data Storage Location

All data is stored in the .rizzclaw folder in the user's home directory:

~/.rizzclaw/
β”œβ”€β”€ config.json        # Configuration file
β”œβ”€β”€ memory.db          # Memory database (SQLite)
β”œβ”€β”€ sessions/          # Session storage
β”‚   └── session-*.jsonl
└── context/           # Context files
    β”œβ”€β”€ MEMORY.md      # Long-term memory
    β”œβ”€β”€ USER.md        # User preferences
    └── ...

License

MIT License - See LICENSE file for details


Made with ❀️ by RizzClaw

About

Go-based AI assistant with auto-summary sessions and BM25+RAG memory system

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages