better-memory
暂无简介
- License 许可
- MIT
- 最近更新
- 2026-04-05
- Stars
- ★ 7
- Forks
- 1
02 资源文件 1
- 参考文档README.md4.4 KB
03 SKILL.md 正文
Better Memory
Semantic memory, intelligent compression, and context management for AI agents
Package: better-memory
Description: Prevents context limit amnesia with real embeddings, priority-based compression, and identity persistence.
Key Capabilities
- Vector-based memory storage using local embeddings
- Semantic retrieval through similarity matching
- Automatic deduplication (exact hash + cosine similarity >0.9)
- Token-budget-aware retrieval
- User identity persistence across sessions
- Intelligent compression when approaching limits
Dependencies
{
"@xenova/transformers": "^2.x",
"tiktoken": "^1.x",
"sql.js": "^1.x"
}
Installation
cd ~/.clawdbot/skills/better-memory && npm install
Configuration
| Parameter | Default | Description |
|---|---|---|
| dataDir | ~/.better-memory | Storage location |
| contextLimit | 128000 | Maximum tokens |
| tokenEncoding | cl100k_base | Token encoder |
| warningThreshold | 0.75 | 75% warning |
| compressThreshold | 0.85 | 85% auto-compress |
| emergencyThreshold | 0.95 | 95% emergency |
Basic Usage
const { ContextGuardian } = require('better-memory');
// Initialize with token budget
const guardian = new ContextGuardian({
contextLimit: 128000
});
// Store memory with priority
await guardian.store({
content: "User prefers dark mode",
role: "user",
priority: 8
});
// Semantic search
const results = await guardian.search("user preferences");
// Get context within token budget
const context = await guardian.getContext({
maxTokens: 4000,
query: "UI preferences"
});
Priority Scoring
Combines multiple signals:
- Role weight: system=7, user=6, assistant=5
- Regex patterns: Important keywords boost score
- Semantic similarity: To query archetypes
- Content length: Reasonable length preferred
Memory Decay
- Age penalty: Older memories score lower
- Access bonus: Frequently accessed memories persist
- Configurable decay rate
Embedding Model
Uses @xenova/transformers with all-MiniLM-L6-v2:
- 384-dimensional vectors
- Local processing (no API calls)
- Fast inference
Storage
SQLite via sql.js (WASM):
- Location:
~/.better-memory/memories.db - Tables: memories, identity, sessions
- Binary embedding blobs for efficiency
License
MIT
04 同仓库更多 Skills
zyfai
Earn yield on any Ethereum wallet on Base, Arbitrum, and Plasma. Use when a user wants passive DeFi yield on their funds. Deploys a non-custodial subaccount (Safe) linked to their EOA, enables automated yield optimization, and lets them deposit/withdraw anytime.
zerion-api
暂无简介
zerion-api-skill
暂无简介
zerion-api-mcp
暂无简介
yahoo-finance-forex
Fetches real-time FOREX news and market data from Yahoo Finance for major currency pairs (EUR/USD, GBP/USD, USD/JPY, etc.). Analyzes sentiment and provides trading context.
yahoo-finance
This skill should be used when the user asks to "get stock prices", "check stock quotes", "look up earnings", "get financial data", "find trending stocks", or needs stock market data from Yahoo Finance.