关于
Memex provides cross-session memory for agents, allowing them to persist facts and reasoning patterns via a six-layer reconstruction trail. Developers should use it to load prior context at session start, search stored observations mid-session, and immediately log new insights to avoid re-deriving past decisions.
快速安装
Claude Code
推荐npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/memex在 Claude Code 中复制并粘贴此命令以安装该技能
技能文档
Memex
Agent-native shared memory. Postgres + pgvector index over a canonical markdown store, exposed over MCP. Lives at https://github.com/pjt222/memex.
When to Use
- At session start, always. Call
mcp__memex__recent_observationsbefore substantive work. Loads the bias-log from prior sessions. - Mid-session, when about to make a non-trivial decision. Call
mcp__memex__search "<topic>"to check whether the project has converged on this before. - Immediately when a bias surfaces in your own reasoning. Log an
observationviamcp__memex__addwhile the context is fresh. Do NOT wait for session end. - When you catch yourself re-deriving something. Re-derivation IS the signal that the trail is incomplete; capture the gap as an observation and link to whatever you re-derived.
Inputs
- Required: A registered
memexMCP server in the active harness. Verify withclaude mcp list | grep memex(Claude Code) or the equivalent in your harness. - Required:
$MEMEX_PG_URLand$MEMEX_STORE_PATHin the server's environment. - Optional:
$MEMEX_EMBED_PROVIDER=voyage+$VOYAGE_API_KEYfor semantic / hybrid search. Without these,mode=keywordstill works.
Procedure
Step 1: Load the bias-log
Before any substantive work in a fresh session, call:
mcp__memex__recent_observations(limit=20)
Read every returned entry. Each one is a pattern the agent (you, or a prior instance) noticed in its own reasoning. Recurring patterns are the most valuable; transient ones are still cheap to skim.
Expected: 5–30 observations covering biases (availability, confirmation, anchoring), pace tells (rushing past confusing measurements), and verification gaps (trusting summaries over source truth).
On failure: If the call fails with "tool not found", the MCP
server isn't registered; run adapters/claude-code/install.sh (or
the per-harness equivalent) from the memex repo first.
Step 2: Search before deriving
When a non-trivial decision approaches (architectural, naming, algorithmic), search first:
mcp__memex__search(query="<topic>", mode="hybrid", k=10)
For exact-wording lookups use mode=keyword. For purely conceptual
queries (topic unlikely to share tokens with indexed text) use
mode=semantic. Optional node_type filter restricts to one type
(e.g. observation).
Expected: 0–10 hits. Even 0 hits is useful — it tells you the trail doesn't cover this decision, so your present reasoning becomes the canonical record.
On failure: If search errors (server down or db unreachable),
fall back to the CLI substitute memex query "<topic>" --node-type observation (defaults to hybrid, which honors the type filter via
its semantic leg). If it returns 0 hits on a topic that clearly should
have coverage, treat the gap as a signal and proceed to Step 4.
Step 3: Log observations mid-session
When you notice a bias in your own reasoning:
mcp__memex__add(
node_type="observation",
title="<short bias name>",
body="<context, mitigation, origin date>",
tags=["bias-log", "vipassana"]
)
Body convention (mirroring docs/OBSERVATIONS.md in the memex repo;
treat that file as the source of truth — it is read by an extractor):
<Description of the bias as it surfaced>. Mitigation: <what to do next time>. Origin: <date> + <context>.
Expected: the add call returns the new node's id (the CLI
equivalent memex add prints <uuid>\t<store-path>) — confirmation
the observation is in the canonical store.
On failure: rmcp dispatches tool calls concurrently — if add
races a dependent call (add → link), await its response first. If
the db is unreachable the write is lost; re-issue once the server is
back, or fall back to appending the entry to docs/OBSERVATIONS.md by
hand (Step 4).
Step 4: Surface unknowns
If recent_observations is empty (fresh memex install), or search
returns nothing on a topic that clearly should have coverage, that's a
documentary trail gap. Close it by appending to the canonical markdown
and re-extracting, or by depositing directly via the MCP tool:
# Backfill path (run from the memex repo root):
$EDITOR docs/OBSERVATIONS.md # append under "## Vipassana observations"
memex extract meditate-vipassana --registry extractors/sources.yml
Or use mcp__memex__add (Step 3) during the session to deposit the
entry into the canonical store on the spot, without touching the file.
Expected: after extract, the new observation is queryable —
memex query "<its topic>" --node-type observation returns it (the
observation-node count grows by one).
On failure: extract is cwd-sensitive — run it from the memex
repo root or pass --registry. If it reports "no new sources", the
content hash already matched; confirm the append actually landed in
docs/OBSERVATIONS.md.
Validation
-
mcp__memex__recent_observationsreturns ≥ 0 entries (call succeeded, not "tool not found") - Each substantive decision in the session is preceded by either
a
mcp__memex__searchcall or an explicit "no prior context to check" note - New biases noticed during the session are logged via
mcp__memex__addbefore session end, not silently dropped - At session end, the agent has either committed new bias entries
to
docs/OBSERVATIONS.mdor confirmed there are none worth logging
Common Pitfalls
- Skipping the session-start call. The single highest-value use of memex. Skipping it is the strongest tell that the agent is treating each session as starting from scratch.
- Logging at session end only. Biases caught at session end are reconstructed from memory and lose specificity. Log them immediately when they surface.
- Logging an observation that's actually a concept. Bias-log
entries are about the agent's own reasoning patterns. Reusable
architectural facts belong in
conceptnodes. - Trusting search results over reading them. A title that
matches your query isn't proof the body answers it. Fetch the
full body with
mcp__memex__getwhen in doubt. - Pipelining dependent MCP calls in one session. rmcp dispatches tool calls concurrently. If a later call depends on a write from an earlier call (add → link → neighbors), await each response before issuing the next.
Related Skills
memex-init— session-start ritual that wires memex into a fresh session; run it before this umbrella's Step 1 to register the server and load the bias-log.memex-observe— the focused wrapper for Step 3; use it when the task is purely "log a bias I just noticed" rather than the full umbrella flow.memex-wrap— session-close counterpart; confirms observations are logged (deferring the actual write tomemex-observe) and writes the continuation trail this skill reads next session.memex-verify— pre-commit gate for the memex repo itself; run it before committing changes to memex (cargo fmt/clippy/test).breathe— pair with memex at session boundaries: breathe to release prior-session residue, thenrecent_observationsto load the next-session priors.meditate— full reflective close; outputs new observations worth logging viamcp__memex__add.read-continue-here— complementary; loads project-state pickup doc. Memex loads cross-project bias-log; CONTINUE_HERE loads project-specific milestone state.
GitHub 仓库
常见问题
什么是 memex Skill?
memex 是一个 Claude Skill,作者为 pjt222。Skill 将 Claude 按需加载的说明和资源打包,让 Claude 无需额外提示即可执行与 memex 相关的任务。
如何安装 memex?
使用本页的安装命令:将 memex 作为插件添加到 Claude Code,或将其仓库克隆到 skills 目录,然后重启 Claude 以加载该 Skill。
memex 属于哪个分类?
memex 属于设计分类。
memex 可以免费使用吗?
可以。memex 已收录在 AIMCP,可免费安装。
相关推荐技能
该Skill用于当开发者提供完整实施计划时,以受控批次方式执行代码实现。它会先审阅计划并提出疑问,然后分批次执行任务(默认每批3个任务),并在批次间暂停等待审查。关键特性包括分批次执行、内置检查点和架构师审查机制,确保复杂系统实现的可控性。
该Skill可在完成任务、实现主要功能或合并代码前自动调度代码审查子代理,确保实现符合需求和计划。它支持通过指定git SHA范围进行精准的代码变更审查,帮助开发者在关键节点及时发现潜在问题。核心原则是"早审查、勤审查",适用于开发流程的各个关键阶段。
这个Skill指导开发者如何将MCP服务器连接到Claude Code,支持HTTP、stdio和SSE三种传输协议。它涵盖了从安装配置到认证安全的完整流程,适用于集成GitHub、Notion、数据库等外部服务。当开发者需要添加集成、配置外部工具或提及MCP相关功能时,这个Skill能提供实用的操作指南。
该Skill帮助开发者根据任务特性选择Claude Code的Web或CLI界面,并指导如何在两种环境间无缝迁移会话。它能分析任务复杂度、迭代需求等要素,推荐最优工作界面和工作流。关键特性包括会话状态管理、环境切换指导和上下文优化建议。
