Skip to main content

LLM-Independent Memory System with Multilingual Support

Project description

๐Ÿง  Greeum v0.4.0

KR EN CN JP ES

An LLM-Independent Memory System with Multilingual Support

๐Ÿ“Œ Overview

Greeum (pronounced as "gree-um") is a universal memory module that can be attached to any LLM model, designed to:

  • Track user's long-term utterances, goals, emotions, and intentions
  • Recall memories relevant to the current context
  • Process temporal reasoning in multiple languages
  • Function as an "AI with memory"

The name "Greeum" is inspired by the Korean word "๊ทธ๋ฆฌ์›€" which evokes a sense of longing and remembrance - perfectly capturing the essence of a memory system.

๐Ÿ”‘ Key Features

  • Long-Term Memory Blocks: Blockchain-like structure for immutable memory storage
  • Short-Term Memory Management: TTL (Time-To-Live) structure for fluid temporary memories
  • Semantic Association: Keyword/tag/vector-based memory recall system
  • Waypoint Cache: Automatically retrieves memories related to the current context
  • Prompt Composition: Automatic generation of LLM prompts that include relevant memories
  • Temporal Reasoning: Advanced time expression recognition in multiple languages
  • Multilingual Support: Automatic language detection and processing for Korean, English, and more
  • MCP Integration: Model Control Protocol support for connecting with Cursor, Unity, Discord and other tools

โš™๏ธ Installation

  1. Clone the repository

    git clone https://github.com/DryRainEnt/Greeum.git
    cd Greeum
    
  2. Install dependencies

    # ๊ธฐ๋ณธ ์„ค์น˜
    pip install -r requirements.txt
    
    # PyPI์—์„œ ์„ค์น˜
    pip install greeum
    
    # MCP ๊ธฐ๋Šฅ ํฌํ•จ ์„ค์น˜
    pip install greeum[mcp]
    
    # ๋ชจ๋“  ๊ธฐ๋Šฅ ํฌํ•จ ์„ค์น˜
    pip install greeum[all]
    

๐Ÿงช Usage

CLI Interface

# Add long-term memory
python cli/memory_cli.py add -c "I started a new project and it's really exciting"

# Search memories by keywords
python cli/memory_cli.py search -k "project,exciting"

# Search memories by time expression
python cli/memory_cli.py search-time -q "What did I do 3 days ago?" -l "auto"

# Add short-term memory
python cli/memory_cli.py stm "The weather is nice today"

# Retrieve short-term memories
python cli/memory_cli.py get-stm

# Generate a prompt
python cli/memory_cli.py prompt -i "How is the project going?"

REST API Server

# Run the API server
python api/memory_api.py

Web interface: http://localhost:5000

API Endpoints:

  • GET /api/v1/health - Check status
  • GET /api/v1/blocks - Retrieve block list
  • POST /api/v1/blocks - Add a block
  • GET /api/v1/search?keywords=keyword1,keyword2 - Search by keywords
  • GET /api/v1/search/time?query=yesterday&language=en - Search by time expression
  • GET, POST, DELETE /api/v1/stm - Manage short-term memory
  • POST /api/v1/prompt - Generate prompts
  • GET /api/v1/verify - Verify blockchain integrity

Python Library

from greeum import BlockManager, STMManager, CacheManager, PromptWrapper
from greeum.text_utils import process_user_input
from greeum.temporal_reasoner import TemporalReasoner

# Process user input
user_input = "I started a new project and it's really exciting"
processed = process_user_input(user_input)

# Store memory with block manager
block_manager = BlockManager()
block = block_manager.add_block(
    context=processed["context"],
    keywords=processed["keywords"],
    tags=processed["tags"],
    embedding=processed["embedding"],
    importance=processed["importance"]
)

# Time-based search (multilingual)
temporal_reasoner = TemporalReasoner(db_manager=block_manager, default_language="auto")
time_query = "What did I do 3 days ago?"
time_results = temporal_reasoner.search_by_time_reference(time_query)

# Generate prompt
cache_manager = CacheManager(block_manager=block_manager)
prompt_wrapper = PromptWrapper(cache_manager=cache_manager)

user_question = "How is the project going?"
prompt = prompt_wrapper.compose_prompt(user_question)

# Pass to LLM
# llm_response = call_your_llm(prompt)

MCP (Model Control Protocol) Integration

์„ค์น˜ ๋ฐ ์„ค์ •

# MCP ๊ธฐ๋Šฅ ํฌํ•จ ์„ค์น˜
pip install greeum[mcp]

# ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์„ค์ • (์„ ํƒ ์‚ฌํ•ญ)
export ADMIN_KEY="your_admin_secret_key"  # API ํ‚ค ๊ด€๋ฆฌ๋ฅผ ์œ„ํ•œ ๊ด€๋ฆฌ์ž ํ‚ค

MCP ์„œ๋น„์Šค ์‹คํ–‰

# CLI ๋ช…๋ น์„ ํ†ตํ•œ ์„œ๋น„์Šค ์‹คํ–‰
greeum-mcp --port 8000 --data-dir ./data

# ๋˜๋Š” Python ๋ชจ๋“ˆ๋กœ ์ง์ ‘ ์‹คํ–‰
python -m memory_engine.mcp_service --port 8000 --data-dir ./data

MCP ํด๋ผ์ด์–ธํŠธ ์‚ฌ์šฉ ์˜ˆ์ œ

# MCP ํด๋ผ์ด์–ธํŠธ ์‚ฌ์šฉ
from memory_engine.mcp_client import MCPClient

# ํด๋ผ์ด์–ธํŠธ ์ดˆ๊ธฐํ™” (API ํ‚ค ํ•„์š”)
client = MCPClient(api_key="YOUR_API_KEY")

# ๊ธฐ์–ต ์ถ”๊ฐ€
result = client.manage_memory(
    action="add",
    memory_content="This is a memory created through MCP interface"
)

# ๊ธฐ์–ต ๊ฒ€์ƒ‰
memories = client.manage_memory(
    action="query",
    query="MCP",
    limit=5
)

# Unity ํ†ตํ•ฉ ์˜ˆ์ œ (Unity๊ฐ€ MCP ํ˜ธํ™˜๋˜์–ด ์žˆ๋Š” ๊ฒฝ์šฐ)
result = client.execute_menu_item(menu_path="GameObject/Create Empty")

MCP ๊ธฐ๋Šฅ์œผ๋กœ ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ๋“ค

  • ์™ธ๋ถ€ ๋„๊ตฌ์™€ Greeum ๊ธฐ์–ต ์‹œ์Šคํ…œ ์—ฐ๋™
  • ์žฅ๊ธฐ/๋‹จ๊ธฐ ๊ธฐ์–ต ๊ด€๋ฆฌ API ํ˜ธ์ถœ
  • API ํ‚ค ๊ธฐ๋ฐ˜ ์ธ์ฆ
  • ์‹ค์‹œ๊ฐ„ ๊ธฐ์–ต ๊ฒ€์ƒ‰ ๋ฐ ์ €์žฅ

๋” ์ž์„ธํ•œ MCP ์‚ฌ์šฉ ๋ฐฉ๋ฒ•์€ examples/README.md๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

๐Ÿงฑ Architecture

greeum/
โ”œโ”€โ”€ greeum/                # Core library
โ”‚   โ”œโ”€โ”€ block_manager.py    # Long-term memory management
โ”‚   โ”œโ”€โ”€ stm_manager.py      # Short-term memory management
โ”‚   โ”œโ”€โ”€ cache_manager.py    # Waypoint cache
โ”‚   โ”œโ”€โ”€ prompt_wrapper.py   # Prompt composition
โ”‚   โ”œโ”€โ”€ text_utils.py       # Text processing utilities
โ”‚   โ”œโ”€โ”€ temporal_reasoner.py # Time-based reasoning 
โ”‚   โ”œโ”€โ”€ embedding_models.py  # Embedding model integration
โ”œโ”€โ”€ api/                   # REST API interface
โ”œโ”€โ”€ cli/                   # Command-line tools
โ”œโ”€โ”€ memory_engine/         # Original memory engine implementation
โ”‚   โ”œโ”€โ”€ mcp_client.py       # MCP client implementation
โ”‚   โ”œโ”€โ”€ mcp_service.py      # MCP service implementation
โ”‚   โ”œโ”€โ”€ mcp_integrations.py # MCP integration utilities
โ”œโ”€โ”€ data/                  # Data storage directory
โ”œโ”€โ”€ examples/              # Usage examples
โ”œโ”€โ”€ tests/                 # Test suite

Branch Management

  • main: Stable release version branch
  • dev: Core feature development branch (merged to main after testing)
  • test-collect: Performance metrics and A/B test data collection branch

๐Ÿ“Š Performance Tests

Greeum conducts performance tests in the following areas:

T-GEN-001: Response Specificity Improvement Rate

  • Measures response quality improvement when using Greeum memory
  • Confirmed 18.6% average quality improvement
  • Increase of 4.2 specific information points per response

T-MEM-002: Memory Search Latency

  • Measures speed improvement through waypoint cache
  • Confirmed 5.04x average speed improvement
  • Up to 8.67x speed improvement for 1,000+ memory blocks

T-API-001: API Call Efficiency

  • Measures reduction in follow-up questions due to memory-based context
  • Confirmed 78.2% reduction in need for follow-up questions
  • Cost savings from reduced API calls

๐Ÿ“Š Memory Block Structure

{
  "block_index": 143,
  "timestamp": "2025-05-08T01:02:33",
  "context": "I started a new project and it's really exciting",
  "keywords": ["project", "start", "exciting"],
  "tags": ["positive", "beginning", "motivated"],
  "embedding": [0.131, 0.847, ...],
  "importance": 0.91,
  "hash": "...",
  "prev_hash": "..."
}

๐Ÿ”ค Supported Languages

Greeum supports time expression recognition in the following languages:

  • ๐Ÿ‡ฐ๐Ÿ‡ท Korean: Native support for Korean time expressions (์–ด์ œ, ์ง€๋‚œ์ฃผ, 3์ผ ์ „, etc.)
  • ๐Ÿ‡บ๐Ÿ‡ธ English: Full support for English time formats (yesterday, 3 days ago, etc.)
  • ๐ŸŒ Auto-detection: Automatically detects the language and processes accordingly

๐Ÿ” Temporal Reasoning Examples

# Korean
result = evaluate_temporal_query("3์ผ ์ „์— ๋ญ ํ–ˆ์–ด?", language="ko")
# Returns: {detected: True, language: "ko", best_ref: {term: "3์ผ ์ „"}}

# English
result = evaluate_temporal_query("What did I do 3 days ago?", language="en")
# Returns: {detected: True, language: "en", best_ref: {term: "3 days ago"}}

# Auto-detection
result = evaluate_temporal_query("What happened yesterday?")
# Returns: {detected: True, language: "en", best_ref: {term: "yesterday"}}

๐Ÿ”ง Project Extensions

  • Enhanced Multilingual Support: Expanding to Japanese, Chinese, Spanish and more languages
  • Embedding Improvements: Integration with real embedding models (e.g., sentence-transformers)
  • Keyword Extraction Enhancement: Implementation of language-specific keyword extraction
  • Cloud Integration: Addition of database backends (SQLite, MongoDB, etc.)
  • Distributed Processing: Implementation of distributed processing for large-scale memory management
  • Tool Integrations: Expanded MCP support for additional tools and platforms

๐ŸŒ Website

Visit our website: greeum.app

๐Ÿ“„ License

MIT License

๐Ÿ‘ฅ Contributing

We welcome all contributions including bug reports, feature suggestions, and pull requests!

๐Ÿ“ฑ Contact

Email: playtart@play-t.art

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

greeum-0.4.0.tar.gz (83.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

greeum-0.4.0-py3-none-any.whl (94.9 kB view details)

Uploaded Python 3

File details

Details for the file greeum-0.4.0.tar.gz.

File metadata

  • Download URL: greeum-0.4.0.tar.gz
  • Upload date:
  • Size: 83.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.9

File hashes

Hashes for greeum-0.4.0.tar.gz
Algorithm Hash digest
SHA256 72328efcf5fde298b7c1bf02eac5fd1ad371dc711c29bfb8e99b174815f47f09
MD5 110b55aafc0f84f3cd06e0d42d128d2d
BLAKE2b-256 200f511b49676d49821b9afb4b9406d19fff8885e8aece0e1611dc03bd752101

See more details on using hashes here.

File details

Details for the file greeum-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: greeum-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 94.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.9

File hashes

Hashes for greeum-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 399213b118a879ab939faee4831fffe4964b7c4835990a3c76774b7774ad1026
MD5 6a33942efe9fa0af85ec1a27f7671059
BLAKE2b-256 d7aa5f2c46ba426224eaf38835f3d5d10c34d8ccb6119b207436f35616934535

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page