sint-memory
Structured agent memory system with hash-chain provenance, temporal decay, drift detection, provenance archaeology, vector embeddings, and git integration for OpenCode agents.
README
SINT-UA v2.1 — Agent Memory System for OpenCode
A structured memory system with hash-chain provenance, temporal decay, drift detection, provenance archaeology, vector embeddings, and git integration for OpenCode agents.
What This Is
This is not another prompt template. This is infrastructure for AI agent memory:
- Structured JSON blocks with semantic registers (SENSE/FACT/LOGIC/OPINION/ACTION)
- Hash-chain provenance — tamper-evident chain of all memory blocks
- Temporal decay — memory blocks "cool down" over time like human memory
- Drift detection — monitors when agent starts hallucinating or losing register discipline
- Provenance archaeology — trace any decision back to its root facts
- Vector embeddings — semantic search with sentence-transformers
- Git integration — link memory blocks to git commits for audit trail
Architecture
┌─────────────────────────────────────────────────────────────┐
│ sint-main (primary agent) │
│ Auto-reads memory → Classifies task → Delegates │
└─────────┬──────────────────────┬────────────────────────────┘
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────┐
│ sint-critic │ │ sint-scribe │
│ • Verification │ │ • Memory ops │
│ • Fact-check │ │ • Block I/O │
│ • Code review │ │ • Chain verify │
└─────────────────┘ └─────────────────┘
│ │
└──────────┬───────────┘
▼
┌─────────────────────────────────────────────────────────────┐
│ sint-memory MCP Server │
│ 16 tools: read/write/search/verify/decay/drift/trace │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Hash-Chain Memory (.opencode/memory/) │
│ blocks/*.json — chain.jsonl — state.json — sessions/ │
└─────────────────────────────────────────────────────────────┘
Components
Agents (.opencode/agents/)
| Agent | Role | Mode |
|---|---|---|
| sint-main | Primary orchestrator, auto-reads memory, classifies, delegates | primary |
| sint-critic | Independent verification — register compliance, logic, sources | subagent |
| sint-scribe | Memory management — block I/O, chain operations | subagent |
| sint-router | Task classification by semantic register and domain | subagent |
MCP Server
Python MCP server providing 20 tools for memory operations:
memory_read_state memory_write_block
memory_read_block memory_write_session
memory_read_blocks memory_update_state
memory_search memory_verify_chain
memory_get_chain_tail memory_stats
memory_apply_decay memory_heat_block
memory_relevance_tiers memory_drift_check
memory_trace_provenance git_link_blocks
git_trace_block git_timeline
embeddings_index embeddings_search
CLI Tool (sint)
sint status # Memory stats and current focus
sint recent [n] # Last N chain entries
sint search <query> # Search blocks
sint block <id> # Block details
sint verify # Verify hash chain
sint add <reg> <text> # Add new block
sint decay # Apply temporal decay
sint drift # Drift detection
sint trace <id> # Provenance archaeology
sint git link # Link blocks to git commits
sint git timeline # Combined block + commit timeline
sint dashboard # Full dashboard
Vector Embeddings (sint-embeddings)
sint-embeddings index # Build/update embedding index
sint-embeddings search <q> # Semantic search
sint-embeddings similar <id> # Find similar blocks
Git Integration (sint-git)
sint-git link # Link blocks to git commits
sint-git trace <id> # Trace block through git history
sint-git timeline # Combined timeline
sint-git info # Current commit details
Plugin (sint-hooks)
TypeScript plugin with hooks:
tool.execute.after— auto-log significant findingschat.system.transform— inject memory contextsession.compacting— preserve across compaction
Commands
| Command | What it does |
|---|---|
/session-start |
Read memory, present context |
/session-end |
Write summary, update state |
/verify [content] |
Run sint-critic |
/memory [query] |
Query memory system |
/dashboard |
Full dashboard view |
Memory Blocks
Each block is a JSON file with semantic register:
{
"id": "0042",
"register": "FACT",
"prev_hash": "a3f2c...",
"hash": "7b1d9...",
"timestamp": "2026-07-14T12:00:00Z",
"project": "DSA",
"content": "3D attenuation verified: near=0.25 far=0.0025",
"source": "bench run 2026-07-13",
"confidence": 0.95,
"tags": ["3d", "attenuation", "verified"],
"links": ["0038"]
}
Registers
| Register | Use for |
|---|---|
SENSE |
Raw observations, tool output, logs |
FACT |
Verified claims with sources |
LOGIC |
Inferences from FACT/SENSE |
OPINION |
Subjective assessments (must be labeled) |
ACTION |
Execution plans, next steps |
Hash-Chain
Every block references the previous block's hash:
block_N.prev_hash = block_{N-1}.hash
block_N.hash = sha256(id + register + content + prev_hash)[:16]
Tamper-evident: modifying any block breaks all subsequent hashes.
Novel Features
Temporal Decay
Memory blocks have relevance scores that decay over time:
- Hot (relevance > 0.7): Recently accessed or highly linked
- Warm (0.4-0.7): Still relevant
- Cool (0.15-0.4): Aging
- Cold (< 0.15): Nearly forgotten
sint decay # Apply decay to all blocks
sint heat 0042 # Heat up block for 7 days
Drift Detection
Monitors agent behavior across sessions:
- Register distribution (are opinions labeled as facts?)
- Source coverage (are claims traceable?)
- Confidence trends
- Topic consistency
sint drift # Check for anomalies
Provenance Archaeology
Trace any decision back to its root facts:
sint trace 0042 # Full reasoning chain
sint trace 0042 --tree # Dependency tree
Vector Embeddings
Semantic search using sentence-transformers with all-MiniLM-L6-v2 (384-dim):
sint-embeddings search "3D audio attenuation" # Returns top 10 similar blocks
sint-embeddings similar 0005 # Find blocks similar to block 0005
Embedding index stored at .opencode/memory/embeddings/.
Git Integration
Link memory blocks to git commits for complete audit trail:
sint git link # Link blocks to recent commits by timestamp
sint git trace 0042 # Show git commits linked to block
sint git timeline # Combined memory + git timeline
sint git info # Current commit details
Setup
1. Copy to your project
cp -r .opencode/agents/ /path/to/your/project/.opencode/agents/
cp -r .opencode/mcp/ /path/to/your/project/.opencode/mcp/
cp -r .opencode/plugin/ /path/to/your/project/.opencode/plugin/
cp -r .opencode/commands/ /path/to/your/project/.opencode/commands/
cp .opencode/bin/sint /usr/local/bin/
2. Install dependencies
pip install mcp sentence-transformers faiss-cpu
3. Update opencode.json
Add to your opencode.json:
{
"default_agent": "sint-main",
"agent": {
"sint-main": { "mode": "primary" },
"sint-critic": { "mode": "subagent" },
"sint-scribe": { "mode": "subagent" }
},
"mcp": {
"sint-memory": {
"type": "local",
"command": ["python3", "/path/to/.opencode/mcp/sint-memory/server.py"]
}
},
"plugin": ["/path/to/.opencode/plugin/sint-hooks.ts"]
}
4. Restart OpenCode
# Changes require restart
opencode
Usage
Automatic (default)
After setup, sint-main runs automatically:
- Reads memory state
- Greets with context
- Classifies tasks
- Delegates to specialists
- Plugin auto-logs findings
Manual
# Terminal
sint status
sint drift
sint trace 0042
# In OpenCode
/session-start
/verify this claim
/memory "3D attenuation"
/dashboard
How It's Different
| Typical Agent Systems | SINT-UA v2.1 |
|---|---|
| Flat context window | Structured JSON blocks |
| No provenance | Hash-chain audit trail |
| Memory = full context | Temporal decay, relevance scoring |
| No drift detection | Cross-session anomaly monitoring |
| Manual memory updates | Auto-logging via plugin hooks |
| "Trust me" | Cryptographic verification |
File Structure
.opencode/
├── agents/
│ ├── sint-main.md
│ ├── sint-critic.md
│ ├── sint-scribe.md
│ └── sint-router.md
├── commands/
│ ├── session-start.md
│ ├── session-end.md
│ ├── verify.md
│ ├── memory.md
│ └── dashboard.md
├── mcp/sint-memory/
│ └── server.py
├── plugin/
│ └── sint-hooks.ts
├── memory/
│ ├── state.json
│ ├── chain.jsonl
│ ├── blocks/
│ └── sessions/
├── bin/
│ ├── sint
│ ├── sint-decay
│ ├── sint-drift
│ └── sint-archaeology
└── skills/
└── memory-system/SKILL.md
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。