Token导航 LogoToken导航

Agent Skill · 研究检索

pact-memory(契约记忆)

pact-memory 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

pact-memory 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 51,060。

总安装 594周安装 25GitHub Stars 62下载 208核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:pact-memory(契约记忆)
来源仓库:https://github.com/profsynapse/pact-plugin
仓库路径:skills/pact-memory
安装命令:
npx skills add https://github.com/profsynapse/pact-plugin --skill pact-memory
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/profsynapse/pact-plugin --skill pact-memory

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

pact-memory 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。它适用于研究检索类任务,可结合来源仓库和原始 README 核验具体用法。

安装方式:通过 npx skills add 命令从 GitHub 仓库安装。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/pact-memory

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/profsynapse/pact-plugin --skill pact-memory;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

pact-memory 怎么安装?

在终端执行 npx skills add https://github.com/profsynapse/pact-plugin --skill pact-memory。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

pact-memory 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

pact-memory 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

pact-memory 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

pact-memory 用的人多吗?

公开数据是累计安装 594 次,近一周安装 25 次,下载 208 次,GitHub 62 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

pact-memory 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
pact-memory

契约记忆 · 本页

59462接触敏感数据未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

PACT Memory Skill

Persistent memory system for PACT framework agents. Store and retrieve context, goals, lessons learned, decisions, and entities across sessions with semantic search.

Overview

The PACT Memory skill provides:

  • Rich Memory Objects: Store context, goals, tasks, lessons, decisions, and entities
  • Semantic Search: Find relevant memories using natural language queries
  • Graph-Enhanced Retrieval: Memories linked to files are boosted when working on related files
  • Session Tracking: Automatic file tracking and session context
  • Cross-Session Learning: Memories persist across sessions for cumulative knowledge

Quick Start

All commands use the CLI entry point via ${CLAUDE_SKILL_DIR}:

# Save a memory
python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" save '{
  "context": "Implementing user authentication",
  "goal": "Add JWT refresh token support",
  "lessons_learned": [
    "Redis INCR is atomic - perfect for rate limiting",
    "Always validate refresh token rotation"
  ],
  "decisions": [
    {
      "decision": "Use Redis for token blacklist",
      "rationale": "Fast TTL support, distributed access"
    }
  ],
  "reasoning_chains": [
    "Redis chosen because TTL support → needed for token expiry → simpler than DB cleanup"
  ],
  "entities": [
    {"name": "AuthService", "type": "component"},
    {"name": "TokenManager", "type": "class"}
  ]
}'
# See Memory Structure table below for all available fields
# including agreements_reached and disagreements_resolved

# Search memories
python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" search "rate limiting tokens"

# Search with graph-enhanced boosting for current file
python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" search "auth tokens" --current-file src/auth/refresh.ts

# List recent memories
python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" list --limit 10

# Get a specific memory by ID
python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" get <memory_id>

# Update an existing memory (scalar fields replace; list fields merge additively)
python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" update <memory_id> '{"goal": "Updated goal"}'

# Delete a memory
python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" delete <memory_id>

# Check system status
python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" status

# Initialize/verify the memory system
python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" setup

All commands output JSON to stdout: {"ok": true, "result":...}. Errors output JSON to stderr: {"ok": false, "error": "...", "message": "..."}.

For large JSON payloads (to avoid shell escaping issues), use --stdin:

echo '{"context": "...", "goal": "..."}' | python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" save --stdin

Memory Structure

Each memory can contain:

FieldTypeDescription
contextstringCurrent working context description
goalstringWhat you're trying to achieve
active_taskslistTasks with status and priority
lessons_learnedlistWhat worked or didn't work
decisionslistDecisions with rationale and alternatives
entitieslistReferenced components, services, modules
reasoning_chainslistHow key decisions connect — "X because Y, which required Z"
agreements_reachedlistWhat was verified via teachback or agreement check
disagreements_resolvedlistWhere agents disagreed and how it was settled
fileslistAssociated file paths (auto-linked)
project_idstringAuto-detected from environment
session_idstringAuto-detected from environment

Task Format

{"task": "Implement token refresh", "status": "in_progress", "priority": "high"}

Decision Format

{
    "decision": "Use Redis for caching",
    "rationale": "Fast, supports TTL natively",
    "alternatives": ["Memcached", "In-memory LRU"]
}

Entity Format

{"name": "AuthService", "type": "component", "notes": "Handles all auth flows"}

CLI Reference

Commands

CommandDescriptionOutput
save <json>Save a memory object{"memory_id": "<hex>"}
save --stdinSave from piped JSON{"memory_id": "<hex>"}
search <query>Semantic search[{"id": "...", "context": "...",...},...]
search <query> --limit NSearch with limit[...] (default: 5)
search <query> --current-file <path>Search with graph boosting[...] (boosts file-related memories)
listList recent memories[{"id": "...", "context": "...",...},...]
list --limit NList with limit[...] (default: 20)
get <id>Get memory by ID{"id": "...", "context": "...",...}
update <id> <json>Update memory fields (list fields merge additively){"memory_id": "<hex>"}
update <id> --stdinUpdate from piped JSON{"memory_id": "<hex>"}
update <id> <json> --replaceReplace list fields wholesale instead of merging{"memory_id": "<hex>"}
delete <id>Delete a memory{"deleted": true, "memory_id": "<hex>"}
statusSystem status{"memory_count": N, "db_path": "...",...}
setupInitialize system{"status": "ready", "message": "..."}

Exit Codes

CodeMeaning
0Success
1User error (bad args, invalid JSON, not found)
2Validation error (unknown field name, unknown sub-object key) — the error envelope includes an allowed_fields list

Update Semantics

update uses additive merge with content-hash dedup for list-valued fields (lessons_learned, reasoning_chains, agreements_reached, disagreements_resolved, active_tasks, decisions, entities). Scalar fields (context, goal, etc.) still replace on update.

  • Passing {"lessons_learned": ["new lesson"]} appends to the existing list; duplicate items (by content hash) are silently deduplicated, so repeated saves are idempotent.
  • Pass --replace when you intentionally want to remove items from a list by overwriting it wholesale.
  • Unknown top-level fields (e.g. {"foo": 1}) raise ValueError with exit code 2 instead of silently disappearing. Likewise, unknown sub-object keys (e.g. {"entities": [{"description": "…"}]} — the field is notes, not description) raise ValueError.

This prevents partial-list updates from silently clobbering the entire column.

Examples

# Save a memory
python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" save '{"context": "Bug fix", "lessons_learned": ["Check null values first"]}'

# Search memories
python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" search "authentication"

# Search with file context for graph-enhanced results
python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" search "auth patterns" --current-file src/auth/service.py

# List recent memories
python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" list --limit 5

# Update an existing memory — additive list merge (default)
# This APPENDS "New lesson" to the existing lessons_learned list; any
# existing lessons are preserved. Scalar fields like "goal" still replace.
python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" update abc123 \
  '{"goal": "Updated goal", "lessons_learned": ["New lesson"]}'

# Update with wholesale list replacement (--replace)
# Use this ONLY when you intentionally want to remove items from a list.
# After this call, lessons_learned contains exactly ["Only lesson that matters"]
# and nothing else.
python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" update abc123 \
  '{"lessons_learned": ["Only lesson that matters"]}' --replace

# Delete a memory
python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" delete abc123

Search Capabilities

Semantic Search

Uses embeddings to find semantically similar memories. Requires either:

  • sqlite-lembed with GGUF model (preferred)
  • sentence-transformers (fallback)

Graph-Enhanced Search

When searching while working on a file, memories linked to:

  • The current file
  • Files imported by/importing the current file
  • Files modified in the same session

...are boosted in ranking.

Keyword Fallback

If embeddings are unavailable, falls back to substring matching across context, goal, lessons_learned, and decisions fields.

Setup

Dependencies

# Required for database
pip install sqlite-vec

# For local embeddings (recommended)
pip install sqlite-lembed

# Alternative embedding backend
pip install sentence-transformers

Initialize and Check Status

# Initialize the memory system (creates directories, database schema)
python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" setup

# Check system status (memory count, capabilities, db path)
python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" status

Storage

Memories are stored in ~/.claude/pact-memory/memory.db using SQLite with:

  • WAL mode for crash safety
  • Vector extensions for semantic search
  • Graph tables for file relationships

Command Line Usage

When invoked via /pact-memory <command> "<args>":

Save Command

python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" save '<json>'

IMPORTANT: The argument is just a hint. You MUST construct a comprehensive memory object with ALL relevant fields. Never just save the raw string. Think of each memory as a detailed journal entry that your future self (or another agent) needs to fully understand what happened, why it mattered, and what was learned.

Required fields for every save:

FieldMinimum LengthWhat to Include
context3-5 sentences (paragraph)Full background: what you were working on, why, what led to this point, relevant history, the state of things when this memory was created
goal1-2 sentencesThe specific objective, including success criteria if applicable
lessons_learned3-5 itemsSpecific, actionable insights with enough detail to be useful months later. Each lesson should explain the "why" not just the "what"

Recommended fields:

  • decisions: Key decisions made with full rationale, alternatives considered, and why they were rejected
  • entities: Components, files, services, APIs involved (enables graph-based retrieval)

Writing comprehensive context:

BAD (too sparse):

"Debugging auth bug"

STILL BAD (single sentence):

"Debugging authentication failure in the login flow where users were getting 401 errors."

GOOD (comprehensive):

"Working on the fix/auth-refresh branch to resolve issue #234 where users reported intermittent 401 errors after being logged in for extended periods. The bug was reported by 3 enterprise customers last week and is blocking the v2.1 release. Initial investigation pointed to the token refresh mechanism, specifically a race condition between concurrent API requests. The authentication system uses JWT tokens with 15-minute expiry and a refresh token rotation pattern. This session focused on reproducing the bug locally by simulating high-latency conditions."

Example transformation:

# Agent is asked to save "figured out the auth bug"

# Construct the full memory object and save:
{
    "context": "Working on the fix/auth-refresh branch to resolve issue #234 where users reported intermittent 401 errors after being logged in for extended periods. The bug was reported by 3 enterprise customers last week and is blocking the v2.1 release. Initial investigation pointed to the token refresh mechanism, specifically a race condition between concurrent API requests. The authentication system uses JWT tokens with 15-minute expiry and a refresh token rotation pattern. This session focused on reproducing the bug locally by simulating high-latency conditions and tracing through the token refresh flow.",
    "goal": "Identify and fix the root cause of intermittent authentication failures that occur after extended user sessions, ensuring the fix doesn't introduce performance regressions.",
    "lessons_learned": [
        "The token refresh mechanism had a race condition: when multiple API requests detected an expired token simultaneously, each would trigger its own refresh, causing token rotation conflicts where subsequent requests used invalidated tokens",
        "Adding a mutex/lock around the token refresh operation prevents concurrent refresh attempts - the first request refreshes while others wait and then use the new token",
        "The bug only manifests under high latency conditions (>500ms API response time) because faster responses complete before the token expiry window, making it hard to reproduce in development",
        "Our existing retry logic actually made the problem worse by immediately retrying with the same stale token instead of waiting for the refresh to complete",
        "Integration tests should include latency simulation to catch timing-dependent bugs like this"
    ],
    "decisions": [
        {
            "decision": "Use mutex pattern for token refresh instead of request queuing",
            "rationale": "Simpler implementation with less state to manage. A mutex ensures only one refresh happens at a time while other requests wait. Our concurrency level (typically <10 concurrent requests) doesn't warrant the complexity of a full request queue.",
            "alternatives": ["Request queue with single refresh - more complex, better for high concurrency", "Optimistic token prefetch - would require predicting refresh timing", "Retry with backoff - doesn't solve the root cause, just masks it"]
        }
    ],
    "entities": [
        {"name": "AuthService", "type": "service", "notes": "Central authentication service handling login, logout, and token management"},
        {"name": "TokenManager", "type": "class", "notes": "Manages JWT token lifecycle including refresh logic"},
        {"name": "src/auth/refresh.ts", "type": "file", "notes": "Contains the token refresh implementation where the bug was fixed"}
    ]
}

Search Command

python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" search "<query>"

Returns semantically similar memories. Use natural language queries.

List Command

python3 "${CLAUDE_SKILL_DIR}/scripts/cli.py" list --limit 10

Shows recent memories (default: 20).

Best Practices

  1. Save at Phase Completion: Save memories after completing PACT phases
  2. Include Lessons: Always capture what worked and what didn't
  3. Document Decisions: Record rationale and alternatives considered
  4. Link Entities: Reference components for better graph connectivity
  5. Search Before Acting: Check for relevant past context before starting work
  6. Write Complete Sentences: Context should be a full description, not a fragment
  7. Be Specific in Lessons: "X didn't work because Y" is better than "X didn't work"
  8. Check Save Results: The save command verifies persistence by reading back the saved memory. If verification fails (exit code 2, error type SYSTEM_ERROR), the save silently failed — retry or check system status

Memory Layers: pact-memory vs Auto-Memory

The PACT framework operates with multiple memory layers. Understanding their distinct roles prevents duplication and ensures the right tool is used for the right purpose.

LayerStorageContentWho WritesAuto-Loaded
Auto-memory (MEMORY.md)~/.claude/projects/{hash}/memory/Free-form session learnings, user preferences, general patternsPlatform (automatic)Yes (first 200 lines)
pact-memory (SQLite)~/.claude/pact-memory/memory.dbStructured institutional knowledge: context, goals, decisions, lessons, entitiesAgents via this skillVia Working Memory sync to CLAUDE.md
Agent persistent memory~/.claude/agent-memory/<name>/Per-agent domain expertise accumulated across sessionsIndividual agents (automatic)Yes (first 200 lines, per agent)

pact-memory's unique value: Structured fields (context, goal, decisions, lessons_learned, entities) enable semantic search, graph-enhanced retrieval, and cross-agent knowledge sharing -- capabilities that auto-memory's free-form markdown does not provide.

Coexistence model: Auto-memory captures broad session context automatically. pact-memory captures deliberate, structured knowledge at PACT phase boundaries. The Working Memory section in CLAUDE.md shows the 3 most recent pact-memory entries, providing structured context that complements auto-memory's general learnings.

Integration with PACT

The memory skill integrates with PACT phases:

  • Prepare: Search for relevant past context before starting
  • Architect: Record design decisions with rationale
  • Code: Save lessons learned during implementation
  • Test: Document test strategies and findings

See references/memory-patterns.md for detailed usage patterns.

平台分布

Codex

35.36%
按下载量换算74

Claude

31.45%
按下载量换算65

Cursor

20.37%
按下载量换算42

Gemini CLI

9.8%
按下载量换算20

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills