360 Secure SkillHub
360 安全技能中心

MAMP

MAMP 通过本地 SQLite 数据库为 AI 代理提供跨会话记忆:可创建会话、记录 user/assistant 轮次、添加标签与优先级,并在全部会话中做关键词计数与检索。技能声明无需外部服务、API Key 或第三方依赖,默认写入当前目录的 mark_memory.db。

分类:知识
rokkiezeng
rokkiezeng
热度 0.46
最近更新 2026-04-17 13:41:47

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add rokkiezeng/mamp
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
mamp
description
Mark AI Memory Protocol — persistent, searchable session memory for AI agents. SQLite-only, zero external dependencies.
author
LeoTseng
version
1.1.5
license
MIT-0

MAMP — Mark AI Memory Protocol

Gives AI agents persistent, searchable memory using SQLite.

When to Use

  • User says "remember what I told you last time"
  • Agent needs to recall facts across conversations
  • User asks about past topics, preferences, or decisions
  • Context window is filling up and older info needs to be summarized

Core Concepts

  • Session — a conversation, has an ID, survives restarts
  • Turn — one message in a session (role: user/assistant)
  • Tag — labels for a turn, e.g. ["finance", "important"]
  • Priority — importance level: critical, normal, trivial

Key Methods

from importlib.util import spec_from_file_location, module_from_spec
spec = spec_from_file_location("mamp", "ai_memory_protocol_v1.1.5.py")
mod = module_from_spec(spec)
spec.loader.exec_module(mod)

# Default: writes to ./mark_memory.db in current directory
sm = mod.SessionManager()
# Or specify path explicitly:
sm = mod.SessionManager(db_path="./memory.db")
# Or via environment variable:
# export MARK_MEMORY_DB=/path/to/memory.db

# Start a conversation
sid = sm.start_conversation()

# Add a message
sm.add_turn("user", "I prefer dark mode")
sm.add_turn("assistant", "Noted")

# Search across all sessions
count = sm.search_count("dark mode")
results = sm.search("dark mode", limit=5)

# Get full session
sess = sm.get_session_extended(sid)
# → {'total_turns': 2, 'turns': [...], 'meta': {...}}

# Tag and filter
sm.add_turn("user", "finance topic", tags=["finance"])
c = sm.search_count("topic", tag_filter=["finance"])

What It Solves

AI forgets everything each conversation. MAMP makes memory persistent, searchable, and structured — without any external service, API key, or dependency beyond SQLite.