Text2Mem/
├── README.md # Project overview and quick start
├── docs/ # Core documentation
│ ├── README.md # This file - documentation index
│ ├── CONFIGURATION.md # Configuration guide
│ └── CHANGELOG.md # Version history
├── bench/ # Benchmark system
│ ├── README.md # Benchmark overview
│ ├── GUIDE.md # Complete benchmark guide
│ └── TEST_REPORT.md # Test validation report
└── examples/ # Usage examples
└── README.md # Example documentation
- Installation & Setup - Install Text2Mem and configure environment
- Configuration Guide - Set up providers (Mock/Ollama/OpenAI)
- First Steps - Run your first operations
- README.md - Project overview, architecture, and quick start
- CONFIGURATION.md - Detailed configuration for all providers
- CHANGELOG.md - Version history and release notes
- bench/README.md - Benchmark system overview
- bench/GUIDE.md - Complete benchmark usage guide
- bench/TEST_REPORT.md - Test report and validation
- examples/README.md - Usage examples and scenarios
- examples/ir_operations/ - Single operation IR examples
- examples/op_workflows/ - Minimal executable workflows
- examples/real_world_scenarios/ - End-to-end scenarios
The core of Text2Mem is the Operation Schema IR - a typed JSON contract that defines memory operations:
{
"stage": "ENC|RET|STR",
"op": "Encode|Retrieve|...",
"target": {...},
"args": {...},
"meta": {...}
}See README.md - Architecture for details.
Encoding Stage (ENC):
Encode- Store new memories with embeddings
Retrieval Stage (RET):
Retrieve- Search memories by semantic similarity or filtersSummarize- Generate summaries of selected memories
Storage Governance Stage (STR):
Label- Add tags and facets to memoriesUpdate- Modify memory fields (text, type, weight, tags)Promote- Increase weight or set remindersDemote- Decrease weight or archiveMerge- Combine multiple memoriesSplit- Break memory into partsLock- Protect from modificationExpire- Set expiration timeDelete- Soft or hard delete memories
Note: Clarify is a UX utility for disambiguation, not a canonical operation.
# 1. Copy template
cp .env.example .env
# 2. Choose provider (edit .env)
TEXT2MEM_PROVIDER=mock # Testing
TEXT2MEM_PROVIDER=ollama # Local models
TEXT2MEM_PROVIDER=openai # Cloud APISee CONFIGURATION.md for complete guide.
| Provider | Speed | Cost | Setup | Use Case |
|---|---|---|---|---|
| Mock | ⚡ Fast | 💰 Free | ✅ None | Testing, development |
| Ollama | 🐢 Medium | 💰 Free | 🔧 Local install | Production, privacy |
| OpenAI | ⚡ Fast | 💰 Paid | 🔑 API key | Production, best quality |
# Environment
python manage.py status # Check environment
python manage.py config # Interactive configuration
# Execute IR
python manage.py ir --inline '{...}' # Execute inline JSON
python manage.py ir --file path.json # Execute from file
# Demo & Examples
python manage.py demo # Run demo workflow
# Workflows
python manage.py workflow <file> # Run multi-step workflow
# Interactive
python manage.py session # Enter REPL mode
# Testing
python manage.py test # Run test suiteSee README.md - CLI Guide for details.
The benchmark system provides two-layer evaluation:
- Plan-level: NL → IR generation quality
- Execution-level: IR → state transition correctness
# Quick test
./bench-cli run --mode mock -v
# Full test
./bench-cli run --mode ollama -v
# View results
./bench-cli show-result latest
# Generate new benchmark
./bench-cli generate
./bench-cli validate <id> --run-tests
./bench-cli promote <id>See bench/GUIDE.md for complete guide.
- manage.py - Main management CLI
- bench-cli - Benchmark system CLI
- scripts/ - Utility scripts for development
from text2mem.services.service_factory import create_models_service
from text2mem.adapters.sqlite_adapter import SQLiteAdapter
# Create service
service = create_models_service(mode="mock")
# Create adapter
adapter = SQLiteAdapter(db_path="./text2mem.db")Issue: .env not found
cp .env.example .env
python manage.py configIssue: Ollama connection failed
# Check Ollama is running
curl http://localhost:11434/api/version
# Start Ollama
ollama serveIssue: OpenAI API error
- Check API key in
.env - Verify API quota and billing
See CONFIGURATION.md - Troubleshooting for more.
We welcome contributions! Before contributing:
- Read the README.md
- Check CHANGELOG.md for recent changes
- Follow the code structure and style
- Add tests for new features
- Update documentation
- Paper: Research paper on Text2Mem (see paper/)
- GitHub: github.com/your-username/Text2Mem
- License: MIT License
Text2Mem/
├── README.md # 项目概览和快速开始
├── docs/ # 核心文档
│ ├── README.md # 本文件 - 文档索引
│ ├── CONFIGURATION.md # 配置指南
│ └── CHANGELOG.md # 版本历史
├── bench/ # 基准测试系统
│ ├── README.md # 基准测试概览
│ ├── GUIDE.md # 完整基准测试指南
│ └── TEST_REPORT.md # 测试验证报告
└── examples/ # 使用示例
└── README.md # 示例文档
- README.md - 项目概览、架构和快速开始
- CONFIGURATION.md - 所有提供者的详细配置
- CHANGELOG.md - 版本历史和发布说明
- bench/README.md - 基准测试系统概览
- bench/GUIDE.md - 完整基准测试使用指南
- bench/TEST_REPORT.md - 测试报告和验证
- examples/README.md - 使用示例和场景
- examples/ir_operations/ - 单操作 IR 示例
- examples/op_workflows/ - 最小可执行工作流
- examples/real_world_scenarios/ - 端到端场景
Text2Mem 的核心是 操作契约 IR - 定义记忆操作的类型化 JSON 契约:
{
"stage": "ENC|RET|STR",
"op": "Encode|Retrieve|...",
"target": {...},
"args": {...},
"meta": {...}
}详见 README.md - 架构设计。
编码阶段 (ENC):
Encode- 存储带有向量嵌入的新记忆
检索阶段 (RET):
Retrieve- 通过语义相似度或过滤器搜索记忆Summarize- 生成选定记忆的摘要
存储治理阶段 (STR):
Label- 为记忆添加标签和分面Update- 修改记忆字段(文本、类型、权重、标签)Promote- 增加权重或设置提醒Demote- 降低权重或归档Merge- 合并多个记忆Split- 将记忆拆分为多个部分Lock- 保护记忆不被修改Expire- 设置过期时间Delete- 软删除或硬删除记忆
注意: Clarify 是用于消歧的 UX 工具,不属于标准操作集。
# 1. 复制模板
cp .env.example .env
# 2. 选择提供者(编辑 .env)
TEXT2MEM_PROVIDER=mock # 测试
TEXT2MEM_PROVIDER=ollama # 本地模型
TEXT2MEM_PROVIDER=openai # 云端 API完整指南见 CONFIGURATION.md。
| 提供者 | 速度 | 成本 | 设置 | 使用场景 |
|---|---|---|---|---|
| Mock | ⚡ 快 | 💰 免费 | ✅ 无 | 测试、开发 |
| Ollama | 🐢 中等 | 💰 免费 | 🔧 本地安装 | 生产、隐私 |
| OpenAI | ⚡ 快 | 💰 付费 | 🔑 API 密钥 | 生产、最佳质量 |
# 环境
python manage.py status # 检查环境
python manage.py config # 交互式配置
# 执行 IR
python manage.py ir --inline '{...}' # 执行内联 JSON
python manage.py ir --file path.json # 从文件执行
# 演示和示例
python manage.py demo # 运行演示工作流
# 工作流
python manage.py workflow <文件> # 运行多步骤工作流
# 交互式
python manage.py session # 进入 REPL 模式
# 测试
python manage.py test # 运行测试套件基准测试系统提供两层评估:
- 计划层:自然语言 → IR 生成质量
- 执行层:IR → 状态转换正确性
# 快速测试
./bench-cli run --mode mock -v
# 完整测试
./bench-cli run --mode ollama -v
# 查看结果
./bench-cli show-result latest
# 生成新基准
./bench-cli generate
./bench-cli validate <id> --run-tests
./bench-cli promote <id>完整指南见 bench/GUIDE.md。
- manage.py - 主管理 CLI
- bench-cli - 基准测试系统 CLI
- scripts/ - 开发实用脚本
from text2mem.services.service_factory import create_models_service
from text2mem.adapters.sqlite_adapter import SQLiteAdapter
# 创建服务
service = create_models_service(mode="mock")
# 创建适配器
adapter = SQLiteAdapter(db_path="./text2mem.db")问题:找不到 .env
cp .env.example .env
python manage.py config问题:Ollama 连接失败
# 检查 Ollama 是否运行
curl http://localhost:11434/api/version
# 启动 Ollama
ollama serve问题:OpenAI API 错误
- 检查
.env中的 API 密钥 - 验证 API 配额和计费
欢迎贡献!贡献前请:
- 阅读 README.md
- 查看 CHANGELOG.md 了解最近变更
- 遵循代码结构和风格
- 为新功能添加测试
- 更新文档
- 论文:Text2Mem 研究论文(见 paper/)
- GitHub:github.com/your-username/Text2Mem
- 许可证:MIT 许可证
Last Updated | 最后更新: 2026-01-07
Version | 版本: v1.2.0