TITAN Memory 标志

TITAN Memory

社区
henryhawke

This tool is a cutting-edge memory engine that blends real-time learning, persistent three-tier context awareness, and seamless plug-n-play LLM integration to continuously evolve and enrich your AI’s intelligence.

发布者henryhawke
代码仓库mcp-titan
语言TypeScript
复刻数
20
星标数
91
可用工具
0
传输类型stdio
分类
许可协议MIT
链接
  • 将工具接入 AI 工作流

    TITAN Memory 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 91 个星标和 20 个复刻。

TITAN Memory: AI That Remembers Like You Do

I've kind of given up on this as I don't have money to train it. Feel free to submit any sort of pull requests :)

Turn any AI into a learning companion that remembers across conversations

npm version TypeScript Node.js License: MIT


What is MCP-TITAN??

Think about how you remember things:

  • 💭 Short-term memory - What you heard 5 seconds ago
  • 📝 Long-term memory - Important facts you recall later
  • 🗄️ Deep storage - Things you "just know" from years ago

HOPE (Hierarchical Online Persistent Encoding) is the second generation of TITAN and gives AI this same ability. Instead of forgetting everything after each conversation, it builds up knowledge like a human brain.

The Problem HOPE Solves

❌ Standard AI (e.g., ChatGPT without plugins):
User: "I'm working on a React project with TypeScript"
AI: *Helps with code*
[Next session]
User: "How do I add a new component to my project?"
AI: "What framework are you using?" ← Forgot everything!

✅ HOPE Memory:
User: "I'm working on a React project with TypeScript"
HOPE: *Stores in long-term memory: React + TypeScript project*
[Next session]
User: "How do I add a new component?"
HOPE: *Recalls context* → "Here's a TypeScript React component for your project..."

Key Features

🧠 Three-Tier Memory System

Like your brain, HOPE has multiple memory levels:

Memory LevelWhat It StoresHow LongLike Your Brain
Short-termCurrent conversationMinutesWorking memory - what you just heard
Long-termImportant patternsDays/weeksConsolidated facts - things you studied
ArchiveCore knowledgePermanentDeep knowledge - things you "just know"

Example:

Conversation: "My dog Max is 3 years old and loves fetch"

HOPE storage:
- Short-term: "User talking about Max right now"
- Long-term: "User has dog named Max, age 3" (promoted after repeated mentions)
- Archive: "User is pet owner" (core fact, rarely changes)

🎯 Smart Forgetting

Not everything deserves to be remembered!

  • Surprising/novel information → Stored longer
  • Repeated boring stuff → Forgotten faster
  • Important patterns → Promoted to long-term storage

This prevents memory bloat and focuses on what matters.

📈 Continuous Learning (Momentum-Based)

Unlike standard AI that's frozen after training:

Standard AI: Learn once → Deploy → Never changes
HOPE: Learn → Deploy → Keep learning from every interaction

How it works:

  • Sees pattern once → Small memory trace
  • Sees pattern repeatedly → Stronger reinforcement
  • Contradictory information → Gradual update (not catastrophic overwrite)

This is called momentum learning - changes happen smoothly, preventing the AI from "unlearning" important things.

🔗 Sequence Understanding (Token Flow)

HOPE understands sequences, not just individual facts:

❌ Standard: Knows "cat", "sat", "mat" as separate words
✅ HOPE: Understands "cat sat on mat" as a pattern

User: "The cat..."
HOPE: *Predicts "sat on mat"* (learned sequence)

📊 Surprise-Based Attention

HOPE pays attention to what's unexpected:

Input: "The sky is blue"
HOPE: Low surprise → Process quickly, minimal storage

Input: "The sky is green with purple clouds"
HOPE: High surprise! → Deep processing, strong memory trace

How It Works (Technical Overview)

The HOPE Architecture

HOPE is based on cutting-edge research in Nested Learning - the idea that learning happens at multiple levels simultaneously:

┌─────────────────────────────────────┐
│  INPUT: "Help me debug this code"  │
└──────────────┬──────────────────────┘
               │
        ┌──────▼─────────┐
        │  Memory Router  │  ← Decides where to look
        │  (Surprise-based)│
        └──────┬──────────┘
               │
    ┌──────────┼──────────┐
    │          │          │
 ┌──▼─┐    ┌──▼─┐    ┌──▼─┐
 │Short│    │Long│    │Arch│  ← Three memory tiers
 │Term │    │Term│    │ive │
 └──┬─┘    └──┬─┘    └──┬─┘
    │          │          │
    └──────────┼──────────┘
               │
        ┌──────▼─────────┐
        │ Retentive Core  │  ← Processes & integrates
        │ (Sequence Model)│
        └──────┬──────────┘
               │
        ┌──────▼─────────┐
        │  Momentum       │  ← Smooth learning
        │  + Forgetting   │
        └──────┬──────────┘
               │
        ┌──────▼─────────┐
        │  OUTPUT         │
        │  + Memory Update│
        └─────────────────┘

Core Mechanisms

  1. Continuum Memory System (CMS)

    • Multi-tier storage with automatic promotion/demotion
    • Memories move between tiers based on access patterns and surprise
  2. Momentum-Based Updates (from research paper)

    M_t = (1 - α) * M_t + S_t
    
    Where:
    - M_t = Memory at time t
    - α = Forgetting gate (higher for boring stuff)
    - S_t = Momentum term (accumulated learning)
  3. Selective State-Space Filters (Mamba-style)

    • Efficient sequence processing
    • Adaptive filtering based on context
  4. Sparse Routing

    • Not all memories are checked for every query
    • Routes queries to relevant memory tiers

Installation & Setup

Requirements

  • Node.js 22+ (required for TensorFlow.js optimizations)
  • npm or bun package manager

Quick Start

bash
# Install
npm install @henryhawke/mcp-titan

# Or with bun
bun add @henryhawke/mcp-titan

Configuration for Cursor

Add to ~/.cursor/settings.json:

json
{
  "mcp": {
    "servers": {
      "hope-memory": {
        "command": "npx",
        "args": ["-y", "@henryhawke/mcp-titan"],
        "workingDirectory": "/path/to/your/memory/storage"
      }
    }
  }
}

Configuration for Claude Desktop

  1. Open Claude Desktop settings
  2. Add MCP server:
    • Name: hope-memory
    • Command: npx
    • Args: -y @henryhawke/mcp-titan
    • Working Directory: Where you want memories stored (default: ~/.hope_memory)

First Run

bash
# Start the HOPE server
npx @henryhawke/mcp-titan

# The server will:
# 1. Create ~/.hope_memory/ directory
# 2. Initialize empty memory banks
# 3. Start listening for MCP tool calls

Operational Quickstart

  1. Run server: bun run build && bun start (or npx @henryhawke/mcp-titan)
  2. Initialize tools in order:
    • init_model
    • init_tokenizer
    • start_learner
  3. Store and recall:
    • Store: store_memory { text, type?: episodic|semantic }
    • Recall: recall { query, topK? }
    • Distill: distill_memories { memories: number[][] }
  4. Online learning:
    • Add data: enqueue_samples (batch of input/target pairs, optional positive/negative)
    • Status: learner_status
    • Control: start_learner, pause_learner, stop_learner
  5. Checkpoints:
    • Save: save_checkpoint { path }
    • Auto-export: export_checkpoint → .hope_memory/checkpoints
    • Import: import_checkpoint { filename } or load_checkpoint { path }
  6. Health:
    • health_check --detailed
    • get_hierarchical_metrics, get_momentum_metrics, get_token_flow_metrics
  7. Safety defaults:
    • Inputs sanitized and length-capped; arrays validated; paths sandboxed
    • URL bootstrap uses timeouts/size guards
    • Logs are structured, rotated, redacted

Dumbed Down Getting Started

  1. bun run build && bun start
  2. Call init_model, then init_tokenizer, then start_learner
  3. store_memory to save facts; recall to fetch them
  4. enqueue_samples to teach; watch learner_status
  5. export_checkpoint to back up; import_checkpoint to restore
  6. If stuck: health_check --detailed

Backward Compatibility

  • Titan aliases are still exported (e.g., TitanMemoryModel → HOPE)
  • Checkpoints include version + checksum and validate dimensions on load

Usage Examples

Basic Memory Operations

typescript
// In your AI chat interface (Claude, Cursor, etc.)

// 1. Initialize memory (first time)
> init_model

// 2. Store some context
> bootstrap_memory text="I'm building a Python web app with FastAPI and PostgreSQL"

// 3. Have conversations - HOPE learns automatically
> help me set up database migrations
[HOPE stores: User uses FastAPI + PostgreSQL]

> how do I add authentication?
[HOPE recalls context: FastAPI project → suggests FastAPI-specific auth]

// 4. Check what's stored
> get_memory_state

// 5. Save for later
> save_checkpoint path="my_project_memory.json"

Training HOPE

typescript
// Explicit training on patterns
> train_step
  x_t: "def hello"
  x_next: "world"

// HOPE learns: "def hello" → "world" pattern

// Later:
> forward_pass input="def hello"
// Predicts: "world" (or similar completion)

Online Learning Mode

typescript
// Start continuous learning
> init_learner

// Feed training samples as you work
> add_training_sample data="function add(a, b) { return a + b; }"

// HOPE learns in background, memory updates automatically

// Check learning progress
> get_learner_stats

Available MCP Tools

HOPE exposes 19 tools via the Model Context Protocol:

Memory Management

  • init_model - Initialize or reconfigure memory system
  • bootstrap_memory - Quick-load context from text or URL
  • get_memory_state - Inspect current memory contents
  • memory_stats - Get statistical summary
  • prune_memory - Clean up low-value memories

Learning Operations

  • forward_pass - Query memory and get prediction
  • train_step - Explicit learning from example pair
  • reset_gradients - Clear training state

Persistence

  • save_checkpoint - Save memory to file
  • load_checkpoint - Restore from checkpoint

Online Learning

  • init_learner - Start background learning service
  • pause_learner / resume_learner - Control learning
  • get_learner_stats - Monitor learning metrics
  • add_training_sample - Feed training data

Advanced Metrics

  • get_token_flow_metrics - Sequence pattern analysis
  • get_hierarchical_metrics - Memory tier distribution
  • health_check - System health & performance

Utilities

  • help - List all available tools with descriptions

See docs/api/README.md for complete API reference.


Real-World Use Cases

1. Personalized Code Assistant

Day 1: "I'm learning Rust"
HOPE: Stores preference for Rust

Day 5: "Show me how to handle errors"
HOPE: Recalls Rust context → Shows Result<T, E> pattern
      (Not Python try/catch or JavaScript throw)

2. Project Context Memory

Store once: "Working on e-commerce site, React frontend, Django backend, Stripe payments"

Every question after:
- "Add a new product page" → HOPE knows React + Django + ecommerce context
- "How do I refund a payment" → HOPE knows you use Stripe
- "Deploy to production" → HOPE remembers full stack (React + Django)

3. Research Assistant

Feed HOPE 50 research papers on neural networks

Query: "What's the consensus on attention mechanisms?"
HOPE:
- Short-term: Current paper's view
- Long-term: Cross-paper patterns identified
- Archive: Fundamental concepts
→ Synthesized answer from all levels

4. Continuous Learning Chatbot

Traditional bot:
- User: "No, I meant X not Y"
- Bot: "OK" → Forgets next session

HOPE bot:
- User: "No, I meant X not Y"
- HOPE: Stores correction in long-term memory
- Next session: Remembers correction automatically

Performance & Scalability

Benchmarks

MetricPerformance
Memory initialization~100ms
Forward pass (query)<50ms (95th percentile)
Training step~75ms
Checkpoint save/load~200ms for 10K memories
Memory footprint~500MB for typical usage

Capacity

  • Short-term: 64 slots (fast access)
  • Long-term: 256 slots (medium access)
  • Archive: 512 slots (stable storage)
  • Total: ~800 distinct memory traces

Memories automatically promoted/demoted based on:

  • Access frequency
  • Surprise value
  • Temporal recency

Architecture Deep Dive

For technical users interested in the implementation:

Research Foundation

HOPE implements concepts from:

  • Nested Learning - Multi-level optimization problems
  • Continuum Memory Systems - Multi-tier storage with different update frequencies
  • Retentive Networks - Efficient sequence modeling
  • Selective State-Space Models (Mamba) - Adaptive filtering

See HOPE.md for the full research paper.

Key Components

src/hope_model/
├── index.ts              # Main HopeMemoryModel class
├── continuum_memory.ts   # Three-tier memory management
├── retention_core.ts     # Sequence processing
├── memory_router.ts      # Surprise-based routing
├── mamba_filters.ts      # Selective state-space filters
└── optimizer_hooks.ts    # Delta compression, layer scheduling

Memory State Structure

typescript
interface HopeMemoryState {
  shortTerm: Tensor2D;       // Recent activations [N, 256]
  longTerm: Tensor2D;        // Consolidated patterns [M, 256]
  archive: Tensor2D;         // Stable knowledge [K, 256]

  surpriseHistory: Tensor1D; // Surprise scores over time
  accessCounts: Tensor1D;    // How often each memory accessed
  timestamps: Tensor1D;      // When each memory created

  // HOPE-specific enhancements
  momentumState?: Tensor2D;  // Momentum for smooth learning
  tokenFlowHistory?: number[][]; // Sequence patterns
  levelIndex: Tensor1D;      // Which tier each memory belongs to
}

Development

Build from Source

bash
git clone https://github.com/henryhawke/mcp-titan.git
cd mcp-titan

# Install dependencies
bun install  # or npm install

# Build
bun run build

# Test
bun test

# Run locally
bun start

Project Structure

mcp-titan/
├── src/
│   ├── hope_model/          # Core HOPE architecture
│   ├── tokenizer/           # BPE tokenization & embeddings
│   ├── training/            # Training pipeline
│   ├── index.ts             # MCP server entry point
│   └── types.ts             # TypeScript interfaces
├── docs/
│   ├── api/                 # API documentation
│   ├── architecture-overview.md
│   └── typescript-error-resolution-guide.md
├── test/                    # Test suites
├── HOPE.md                  # Research paper
├── PLAN.md                  # Implementation roadmap
└── README.md                # This file

Running Tests

bash
# All tests
bun test

# With coverage
bun test --coverage

# Specific test file
bun test src/__tests__/hope_model.test.ts

Roadmap

✅ Implemented (v3.0)

  • Three-tier continuum memory system
  • Retentive sequence processing
  • Selective state-space filters
  • Memory routing with surprise detection
  • Hierarchical promotion/demotion
  • MCP server with 19 tools
  • Checkpoint save/load
  • Online learning service

🚧 In Progress (v3.1)

  • Fix TypeScript compilation errors (42 → 0)
  • Implement momentum-based updates (Equations 32-33)
  • Activate forgetting gate mechanism
  • Token flow tracking

🔮 Planned (v4.0)

  • Deep neural memory module (MLP-based)
  • Self-modifying learning
  • Multi-modal memory (text + code + images)
  • Distributed memory across multiple servers
  • Fine-grained access control

See PLAN.md for detailed implementation plan.


Troubleshooting

"Module not found" errors

bash
# Ensure Node.js 22+
node --version

# Reinstall dependencies
rm -rf node_modules package-lock.json
npm install

Memory leaks during long sessions

typescript
// HOPE has automatic cleanup, but you can manually trigger:
> reset_gradients
> prune_memory threshold=0.1

TypeScript compilation errors

Current known issue (being fixed in v3.1). To use despite errors:

bash
# Skip type checking
npm run build --skipTypeCheck

# Or use published version
npx @henryhawke/mcp-titan

Slow performance

typescript
// Reduce memory capacity in config
> init_model config={
  "shortTermSlots": 32,  // Default 64
  "longTermSlots": 128,  // Default 256
  "archiveSlots": 256    // Default 512
}

Contributing

Contributions welcome! Areas needing help:

  1. Fixing TypeScript errors - See docs/typescript-error-resolution-guide.md
  2. Implementing momentum updates - See PLAN.md Phase 1, Task 1.1
  3. Documentation improvements - Make HOPE more accessible
  4. Test coverage - Current ~60%, target 80%+

Development Workflow

  1. Fork the repo
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Make changes and test: bun test
  4. Commit: git commit -m 'Add amazing feature'
  5. Push: git push origin feature/amazing-feature
  6. Open Pull Request

See CONTRIBUTING.md for detailed guidelines.


Research & Citations

If you use HOPE in research, please cite:

bibtex
@article{behrouz2025nested,
  title={Nested Learning: The Illusion of Deep Learning Architectures},
  author={Behrouz, Ali and Razaviyayn, Meisam and Zhong, Peiling and Mirrokni, Vahab},
  journal={NeurIPS},
  year={2025}
}

Related Work

  • Transformer-XL - Segmented recurrence for long sequences
  • Retentive Networks - Efficient alternatives to attention
  • Mamba - Selective state-space models
  • Test-Time Training (TTT) - Online learning in neural networks
  • Fast Weight Programmers - Dynamic weight updates

License

MIT License - See LICENSE file


Support & Community


FAQ

Q: How is this different from RAG (Retrieval-Augmented Generation)?

A: RAG fetches external documents; HOPE builds internal neural memory.

FeatureRAGHOPE
StorageExternal vector DBInternal neural tensors
LearningNo learning (just retrieval)Continuous learning with momentum
ForgettingNever forgets (stores all)Smart forgetting (prunes low-value)
ContextRetrieved documentsLearned patterns
SpeedSlower (external lookup)Faster (in-memory)

Q: Does HOPE replace fine-tuning?

A: No, complementary. Fine-tuning = pre-training knowledge. HOPE = session-specific learning.

Base Model → Fine-tuning → HOPE Learning
(General)    (Domain)      (User-specific)

Q: How much memory does HOPE use?

A: ~500MB typical, configurable. Reduce by lowering tier capacities.

Q: Can HOPE run on CPU?

A: Yes! Uses TensorFlow.js Node backend (CPU). GPU optional but not required.

Q: Is my data private?

A: Yes. HOPE runs locally, memories stored on your disk (~/.hope_memory). No cloud upload.


Made with ❤️ by the HOPE team

Turn your AI into a learning companion that grows with you.

安装

TypingMind
{
  "mcpServers": {
    "mcp-titan": {
      "command": "npx",
      "args": [
        "-y",
        "@henryhawke/mcp-titan"
      ]
    }
  }
}

将 TITAN Memory MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 TITAN Memory 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请勿关闭终端窗口或停止其中的连接器进程。
3

将 TITAN Memory 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 TITAN Memory MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "mcp-titan": {
      "command": "npx",
      "args": [
        "-y",
        "@henryhawke/mcp-titan"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 TITAN Memory MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 TITAN Memory MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 TITAN Memory 帮我完成这项任务吗?
TITAN Memory
当然,我看过了。
以下是我使用 TITAN Memory 得到的结果。

常见问题

TITAN Memory MCP 服务器有什么用途?

TITAN Memory 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 TITAN Memory MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您无需为每个模型单独配置 MCP 服务器,就能在 Claude、ChatGPT、Gemini 或您在 TypingMind 中配置的其他 AI 模型中使用 TITAN Memory。

为什么在 TypingMind 中使用 TITAN Memory MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是最出色的大语言模型聊天前端之一。连接 TITAN Memory 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 TITAN Memory MCP 连接到 TypingMind?

TITAN Memory 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

TITAN Memory MCP 在 TypingMind 中提供哪些工具?

TITAN Memory 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 TITAN Memory MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行选择模型提供商,并自行管理 API 密钥、提示词和 MCP 配置。如果 TITAN Memory 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇