mempal
Memory framework
First committed by ZhangHanDong
Published in ZhangHanDong/mempal. Publisher page
284 GitHub stars
What it is
AI Agent Memory
AutoGineer overview, from the brain’s own files
Mempal is a project memory system designed for coding agents, implemented as a single binary. It enables agents to store, search, and retrieve decision context across sessions. The system utilizes a hybrid search approach combining BM25 keyword matching and vector semantic search, alongside a knowledge graph for tracking entity relationships. It includes a self-describing protocol that allows agents to understand how to interact with the memory system without manual system prompt configuration. Mempal supports cross-project tunnels, multilingual embedding, and collaborative agent workflows through inbox-based handoffs.
How it works
Memory model: Hybrid
AutoGineer overview, from the brain’s own files
Mempal stores data in a SQLite database located at ~/.mempal/palace.db. It ingests project information by chunking and embedding content, which is then searchable via CLI or MCP tools. The system uses a memory protocol to guide agent behavior, such as verifying facts before ingestion and citing sources. It supports collaborative agent interactions by allowing agents to push messages to a per-project inbox, which are then processed via hooks during user prompt submission. The knowledge graph tracks triples with temporal validity, and the system provides tools for fact-checking and context assembly.
| Folder | Role | Files |
|---|---|---|
| .claude | agent-config | 2 |
| .github | agent-config | 3 |
| docs | docs | 129 |
| hooks | hooks | 2 |
| src | source-code | 30 |
| tests | tests | 31 |
| benchmarks | folder | 1 |
| books | folder | 41 |
| crates | folder | 71 |
| specs | folder | 131 |
The agent writes
- record_checked evidence: AGENTS.md
Requirements
Runtimes: Rust
Databases: SQLite
Works with: Claude Code, OpenAI Codex, GitHub Copilot, Cursor, Kiro, OpenCode, Amp, Cline, JetBrains Junie, Devin (ex-Windsurf)
Set it up
This brain runs code automatically: 2 hooks (claude-code). Review .claude/settings.json before opening the folder in Claude Code. No step below turns a hook on for you.
.claude/settings.json:if echo "$TOOL_INPUT" | grep -q 'git commit'; then echo 'MEMPAL REMINDER: You just committed code. Call mempal_ingest to save the decision context (what was built, why, what was considered). Rule 4: SAVE AFTER DECISIONS.'; fi.claude/settings.json:bash .claude/hooks/user-prompt-submit.sh
- Not scanned by AutoGineerThe author’s MCP configuration (.mcp.json) also starts it in a way AutoGineer does not offer. Read that file: AutoGineer did not scan that path; what it runs is listed under “This brain runs”. https://github.com/ZhangHanDong/mempal/blob/9ed705d78321daf5878e9579777b1a471e97c6f1/.mcp.json
- Not scanned by AutoGineerThe author’s README also describes installing it with cargo. Read its install section: AutoGineer did not scan that path. https://github.com/ZhangHanDong/mempal/blob/9ed705d78321daf5878e9579777b1a471e97c6f1/README.md#quick-start
First committed by ZhangHanDong. Published in ZhangHanDong/mempal. Licence: MIT License.
Usage
AutoGineer overview, from the brain’s own files
- Initialize project memory for a directory
- Ingest project files into a specific wing
- Perform hybrid search for past decisions
- Fact-check assertions against the knowledge graph
- Collaborate between agents using inbox pushes
- Manage knowledge lifecycle and anchor publication
- “mempal search "auth decision clerk"”
- Returns past decisions related to authentication and Clerk, including source citations.
- “mempal fact-check path/to/file”
- Identifies potential contradictions like similar name conflicts or stale facts against the knowledge graph.
Documentation by ZhangHanDong
mempal
Image: Crates.io Image: Downloads Image: docs.rs Image: CI Image: Release Image: License: MIT
Project memory for coding agents. Single binary, cargo install mempal, find past decisions with citations in seconds.
Latest release: v0.9.1 (2026-08-19).
What It Does
Agent writes code → commits → mempal saves the decision context
Next session (any agent) → mempal search → finds the decision with source citationHybrid search: BM25 keyword matching + vector semantic search, merged via Reciprocal Rank Fusion
Knowledge graph: subject-predicate-object triples with temporal validity (valid_from/valid_to)
Cross-project tunnels: automatic discovery when the same room appears in multiple wings
Self-describing protocol: MEMORY_PROTOCOL embedded in MCP ServerInfo teaches any agent how to use mempal — no system prompt configuration required
Multilingual: model2vec-rs (BGE-M3 distilled) as default embedder, zero native dependencies
Single file: everything lives in
~/.mempal/palace.db(SQLite + sqlite-vec)
Quick Start
cargo install mempal --version 0.9.1 --locked
mempal init ~/code/myapp
mempal ingest ~/code/myapp --wing myapp
mempal search "auth decision clerk"
mempal wake-upWith REST support:
cargo install mempal --version 0.9.1 --locked --features restFrom a source checkout:
cargo install --path . --lockedConfiguration
Config at ~/.mempal/config.toml (optional, defaults work without it):
db_path = "~/.mempal/palace.db"
[embed]
backend = "model2vec" # default, zero native deps
# model = "minishlab/potion-multilingual-128M" # default multilingual model (1024d)Other backends:
# Local ONNX (requires --features onnx)
[embed]
backend = "onnx"
# External API
[embed]
backend = "api"
api_endpoint = "http://localhost:11434/api/embeddings"
api_model = "nomic-embed-text"
dimensions = 768 # optional; defaults to 384 when omittedCommands
| Command | Purpose |
|---|---|
mempal init <DIR> [--dry-run] | Infer wing/rooms from project tree |
mempal ingest <DIR> --wing <W> [--dry-run] | Chunk, embed, and store |
mempal search <QUERY> [--wing W] [--room R] [--json] | Hybrid search (BM25 + vector + RRF) |
mempal wake-up [--format aaak] | Context refresh, sorted by importance |
mempal compress <TEXT> | AAAK format output |
mempal delete <DRAWER_ID> | Soft-delete a drawer |
mempal purge [--before TIMESTAMP] | Permanently remove soft-deleted drawers |
mempal kg add <S> <P> <O> | Add a knowledge graph triple |
mempal kg query [--subject S] [--predicate P] | Query triples |
mempal kg timeline <ENTITY> | Chronological view of an entity |
mempal kg stats | Knowledge graph statistics |
mempal tunnels | Cross-wing room links |
mempal taxonomy list / edit | Manage routing keywords |
mempal reindex | Re-embed all drawers after model change |
mempal status | DB stats, schema version, scopes |
mempal serve [--mcp] | MCP server (+ REST with feature) |
mempal cowork-install-hooks [--global-codex] | Install UserPromptSubmit hooks for Claude Code (+ optional Codex merge) |
mempal cowork-drain --target <claude|codex> | Drain inbox messages (for hook use; exits 0 on any failure) |
mempal cowork-status --cwd <PATH> | Read-only view of both inboxes at <PATH> |
mempal fact-check [PATH|-] [--wing W] [--room R] [--now <UNIX_SECS>] | Offline contradiction check against KG triples + known entities |
mempal bench longmemeval <FILE> | LongMemEval retrieval benchmark |
Project ignore rules
mempal init <DIR> and directory-mode mempal ingest <DIR> use the target
project's ignore rules by default. They respect .gitignore, .git/info/exclude,
global Git excludes, and a root-level .mempalignore. Built artifacts that should
never become project memory can be listed in .mempalignore without changing the
project's Git behavior.
Use --ignore-file <PATH> to add one or more extra ignore files for a run. Use
--no-gitignore or --no-mempalignore to disable either default source. Explicit
file ingest remains explicit: mempal ingest path/to/file --wing <W> still ingests
that file even if the project ignore rules would skip it during directory traversal.
MCP Server (10 tools)
mempal serve --mcp exposes these tools via Model Context Protocol:
| Tool | Purpose |
|---|---|
mempal_status | State + protocol + AAAK spec (teaches agent on first call) |
mempal_search | Hybrid search with tunnel hints, citations, and AAAK-derived structured signals |
mempal_ingest | Store memories with optional importance (0-5) and dry_run; reports lock_wait_ms when concurrent ingest was observed |
mempal_delete | Soft-delete with audit trail |
mempal_taxonomy | List or edit routing keywords |
mempal_kg | Knowledge graph: add/query/invalidate/timeline/stats |
mempal_tunnels | Cross-wing room discovery |
mempal_peek_partner | Read partner agent's live session (Claude ↔ Codex), pure read, never writes |
mempal_session_peek | Read an explicit Claude/Codex local session by concrete tool + cwd, including same-tool cross-project reads |
mempal_cowork_push | Send a short handoff message to partner agent's inbox (at-next-submit delivery) |
mempal_fact_check | Offline contradiction detection vs KG triples + known entities (similar-name, relation mismatch, stale facts) |
The server embeds MEMORY_PROTOCOL (11 behavioral rules) in the MCP initialize.instructions field. Any MCP client learns the workflow automatically.
Memory Protocol
mempal teaches agents these rules through self-description:
FIRST-TIME SETUP — call
mempal_statusto discover wings before filteringWAKE UP — different clients have different pre-load mechanisms
VERIFY BEFORE ASSERTING — search before stating project facts
QUERY WHEN UNCERTAIN — search on "why did we...", "last time we..." 3a. TRANSLATE TO ENGLISH — translate non-English queries before searching
SAVE AFTER DECISIONS — persist rationale, not just outcomes
CITE EVERYTHING — reference drawer_id and source_file 5a. KEEP A DIARY — record behavioral observations in wing="agent-diary"
PARTNER AWARENESS — use
mempal_peek_partnerfor live partner-agent session,mempal_session_peekfor explicit same-tool/cross-project local sessions, and mempal search only for crystallized drawersDECISION CAPTURE —
mempal_ingestis for firm decisions only; include partner input when peek informed the callCOWORK PUSH — use
mempal_cowork_pushas the SEND primitive in the SEND/READ/PERSIST triad; at-next-submit delivery, not real-timeVERIFY BEFORE INGEST — call
mempal_fact_checkbefore persisting a decision that asserts entity relationships; it catches similar-name typos, relation mismatches against the KG, and stale facts with expiredvalid_to
Agent Cowork (P6 peek + P8 push)
Two coding agents (Claude Code and Codex) can collaborate on the same repo through a per-project inbox + hook-driven injection channel, on top of mempal_peek_partner (read live partner session), mempal_session_peek (read an explicit local session by concrete tool + cwd), and mempal_cowork_push (send ephemeral handoff).
Install hooks once per repo (run at the repo root):
mempal cowork-install-hooks --global-codexThis writes:
.claude/hooks/user-prompt-submit.sh+ merges a registration entry into.claude/settings.jsonso Claude Code fires the hook on every user prompt.~/.codex/hooks.jsonUserPromptSubmit entry so Codex fires the same drain on every user prompt.
The --global-codex part is optional. The re-run is idempotent and self-heals stale/wrong drain entries — re-installing after a mempal upgrade is always safe.
Delivery is at-next-UserPromptSubmit, not real-time: a push from Claude to Codex becomes visible only when the Codex user submits their next prompt, at which point the hook drains the inbox and prepends the message as additionalContext on that turn.
Check inbox state at any time without draining:
mempal cowork-status --cwd "$PWD"Known limitations
Codex feature flag dependency: Codex's hooks runtime is gated behind the
codex_hooksfeature flag (currently "under development" in shippedcodex-cli). If the flag is off, Codex silently ignores~/.codex/hooks.json.install-hooksdetects this and prints a warning with the activation command:codex features enable codex_hooks.Two Claude-side artifacts: Claude Code does not auto-discover hook scripts by filename. Both
.claude/hooks/user-prompt-submit.shand the matching entry in.claude/settings.jsonare required.install-hookswrites both; do not remove either by hand.TUI restart needed after config changes on the Codex side: Codex reads
config.toml+hooks.jsonat process startup only. After enabling the feature flag or runninginstall-hooks, fully quit and relaunch the Codex TUI before expecting hooks to fire.MCP server re-spawn: Claude Code spawns the mempal MCP server at client startup. After upgrading the mempal binary (
cargo install ...), restart Claude Code so the MCP server respawns and exposes newly added tools likemempal_cowork_pushormempal_fact_check.Bidirectional scope:
mempal_cowork_pushcurrently requires an MCP client identifying itself asclaude-codeorcodex(or their aliases). Generic MCP clients cannot push because caller identity is required to fill thefromfield and enforce self-push rejection. This is by design for the Claude ↔ Codex pair.
Concurrent Ingest Safety (P9-B)
Two agents writing to the same source simultaneously used to be a TOCTOU race: both would pass the dedup check, both would insert, producing duplicate drawers or mismatched vectors. Since 0.4.0, mempal_ingest and ingest_file_with_options acquire a per-source advisory lock before entering the dedup + insert critical section.
Lock files live at
~/.mempal/locks/<16-hex>.lock, created lazily, released on guard drop.5 s timeout, 50 ms retry + jitter;
LockError::Timeoutsurfaces as aningesterror.Every non-dry-run response carries
lock_wait_ms: Option<u64>so agents can detect contention.Dry-run does not acquire the lock (no writes, no race).
Unix only in 0.4.0. On Windows the lock path is a no-op fallback;
LockFileExsupport is tracked for a follow-up.
Offline Fact Checking (P9-A)
mempal_fact_check — and its CLI counterpart mempal fact-check — compare a text blob against the existing KG triples + the entity registry derived from recent drawers. It flags three issue classes, all deterministic and zero-LLM:
| Issue | Trigger |
|---|---|
SimilarNameConflict | Text mentions a name within Levenshtein distance ≤ 2 of a known entity, and the names are not equal. |
RelationContradiction | Text asserts a predicate (e.g. brother_of) that's in the incompatibility dictionary against an existing KG triple with the same (subject, object) endpoints. |
StaleFact | Text asserts a triple whose KG row has valid_to < now (Unix seconds). |
Extracted triples today cover three narrow patterns: "X is Y's ROLE", "X works at / for Y", and "X is [the|a|an] ROLE of Y". Unknown sentence shapes are silently ignored, so the tool errs toward under-reporting rather than false positives.
Protocol Rule 11 guides agents to run this before ingesting a decision that asserts entity relationships. See specs/p9-fact-checker.spec.md for the full contract.
Search Architecture
query → BM25 (FTS5) → ranked by keyword match
→ Vector (sqlite-vec) → ranked by semantic similarity
→ RRF Fusion (k=60) → merged ranking
→ Wing/Room filter → scoped results
→ Tunnel hints → cross-project referencesKnowledge Graph
mempal kg add "Kai" "recommends" "Clerk"
mempal kg add "Clerk" "replaced" "Auth0" --source-drawer drawer_xxx
mempal kg timeline "Kai"
mempal kg statsTriples support temporal validity — relationships can be invalidated when they expire.
Agent Diary
Cross-session behavioral learning — agents record observations, lessons, and patterns:
# Search diary entries
mempal search "lesson" --wing agent-diary
mempal search "pattern" --wing agent-diary --room claudeDiary entries use the existing mempal_ingest tool with wing="agent-diary" and room=agent-name. MEMORY_PROTOCOL Rule 5a teaches agents to write diary entries. Integrates with Claude Code's auto-dream for automatic memory consolidation.
Ingest Formats (5)
| Format | Auto-detected by |
|---|---|
| Claude Code JSONL | type + message fields |
| ChatGPT JSON | Array or mapping tree |
| Codex CLI JSONL | session_meta + event_msg entries |
| Slack DM JSON | type: "message" + user + text |
| Plain text | Fallback |
AAAK Compression
Output-only format readable by any LLM without decoding:
mempal compress "Kai recommended Clerk over Auth0 based on pricing and DX"
# V1|manual|compress|1744156800|cli
# 0:KAI+CLK+AUT|kai_clerk_auth0|"Kai recommended Clerk over Auth0..."|★★★★|determ|DECISIONChinese text uses jieba-rs POS tagging for proper word segmentation.
Architecture
| Crate | Responsibility |
|---|---|
mempal | Installable CLI package, REST entrypoint, and legacy facade paths |
mempal-embed | Public Embedder / EmbedderFactory traits, API embedder, model2vec and ONNX implementations |
mempal-search-core | Public FTS5 query escaping and RRF rank-fusion primitives |
mempal-agent-memory | Public agent-memory domain types and anchor helpers |
mempal-mcp-protocol | Public self-describing MEMORY_PROTOCOL text |
mempal-store-sqlite | Public SQLite storage layer: schema, migrations, Database, FTS5, sqlite-vec, KG, tunnels, cards, adoption tables |
mempal-runtime | Public runtime workflows: ingest, search orchestration, context, brief, knowledge, factcheck, projects, cowork, doctor, AAAK |
mempal-mcp-server | Public MCP server adapter and tool wiring for the runtime |
Key design choices:
model2vec-rs default embedder — zero native deps, multilingual (BGE-M3 distilled)
ort (ONNX) available behind
onnxfeature flag for max qualityFTS5 for BM25 keyword search — synced via SQLite triggers
Soft-delete with audit trail —
mempal delete+mempal purgeImportance ranking — drawers have 0-5 importance, wake-up sorts by importance
Semantic dedup — ingest warns (doesn't block) when similar content exists
Public workspace crates — reusable libraries are maintained in this repo and published as versioned crates while
cargo install mempalremains the CLI path. P114 keeps the split coarse: storage, runtime, and MCP server are separate crates, but feature families such as knowledge, cowork, and context remain inmempal-runtime.
Development
cargo test --workspace
cargo test --workspace --all-features
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo fmt --all --checkAfter changing the embedding model or dimensions, re-embed existing drawers:
mempal reindexDocs
Usage guide:
docs/usage.mdAAAK dialect:
docs/aaak-dialect.mdSpecs (internal agent-spec contracts, on GitHub): https://github.com/ZhangHanDong/mempal/tree/main/specs
Plans (internal implementation plans, on GitHub): https://github.com/ZhangHanDong/mempal/tree/main/docs/plans
Benchmark:
benchmarks/longmemeval_s_summary.md— includes the older 384d baseline and the newer model2vec 256d run
Book: MemPalace — Reforging Memory in Rust
mempal 的设计分析和完整技术叙事,收录在《MemPalace: AI 记忆的第一性原理》Part 10(第 26-30 章):
| 章节 | 内容 |
|---|---|
| 第 26 章 | 为什么用 Rust 重铸 — 触发点、重写判断、语言选择 |
| 第 27 章 | 保留了什么、改变了什么 — 5 维度对比 + 架构图 |
| 第 28 章 | 自描述协议 — MEMORY_PROTOCOL、7 条规则、agent 生命周期 |
| 第 29 章 | 多 Agent 协作 — Claude↔Codex 接力、反模式发现、agent 日记 |
| 第 30 章 | 诚实的差距 — benchmark 数据、6 个 gap |
docs/MIND-MODEL-DESIGN.md
MIND MODEL DESIGN
Date: 2026-04-21 Status: P42 baseline implemented - future work remains explicit Scope: Capture the mind-model decisions discussed in this conversation and map them to a practical system design.
Implementation Checkpoint
P42 baseline means the core mind-model architecture is implemented enough to operate as a governed memory system:
Stage 1 typed drawers separate raw evidence from governed knowledge.
dao_tian -> dao_ren -> shu -> qiruntime context assembly exists throughmempal contextandmempal_context.Stage 1 knowledge supports distill, gate, promote, demote, and outward anchor publication through CLI and MCP surfaces.
Phase-2
knowledge_cards,knowledge_evidence_links, andknowledge_eventsexist in the same SQLitepalace.db.Stage-1 knowledge drawers can be backfilled into Phase-2 cards through an explicit dry-run-first apply command.
Phase-2 cards now have governed gate, promote, and demote lifecycle surfaces in CLI and MCP.
P42 baseline is not a claim that every future runtime integration is complete. It marks the point where the design is no longer only a discussion capture: the main storage, governance, and lifecycle surfaces exist and are test-backed.
One-Sentence Thesis
The system should treat memory as a governed knowledge evolution layer where raw evidence is accumulated first, abstract knowledge is distilled second, and high-level dao is woken up before shu and qi at runtime.
Goal
This design defines how to combine:
memory
skills
external research tools
runtime evaluation and promotion gates
into a coherent agent cognition system instead of treating them as unrelated parts.
The key idea is:
memory is not just storage
skills are not just static instructions
research tools are not just retrieval utilities
Together they should form a disciplined loop:
gather evidence
distill candidate knowledge
promote only with sufficient evidence
demote when contradicted or obsolete
Core Vocabulary
Dao / Shu / Qi
This design adopts the following knowledge hierarchy:
dao: high-level knowledge and governing principlesshu: reusable methods, workflows, and procedural know-howqi: concrete tools, commands, interfaces, and tool-specific usage knowledge
dao itself has two levels:
dao_tian: universal law; the most stable, cross-domain, objective knowledgedao_ren: domain law; stable patterns within a given field
Relationship:
dao_tianshapes how the agent understands realitydao_renshapes how the agent understands a specific fieldshushapes how the agent actsqishapes what the agent uses to act
Memory Domains
These are independent from dao / shu / qi.
Memory domains answer: "who is this memory for?"
projectagentskillglobal
Provenance
Every memory item should also record where it came from:
runtimeresearchhuman
Crucial Orthogonality
dao / shu / qi is not the same axis as project memory, agent memory, or skill memory.
These are orthogonal coordinate systems:
memory domainknowledge tierfieldprovenanceanchor
Example:
a debugging checklist may be
domain=skill,tier=shu,field=software-engineeringa model-specific CLI behavior note may be
domain=agent,tier=qi,field=toolinga high-level principle like "evidence precedes assertion" may be
domain=global,tier=dao_tian,field=epistemics
This orthogonality is required to avoid confusing:
local project lessons with universal law
temporary tool behavior with stable domain knowledge
workflow tips with governing principles
Anchor Model
Project identity should not be overloaded onto wing.
wing remains a semantic partitioning axis. It answers:
what semantic area does this memory belong to?
It should not also answer:
which checkout does this memory belong to?
which branch experiment does this memory belong to?
That requires a separate anchor axis.
Anchor Kinds
The recommended anchor model is:
globalrepoworktree
Meaning:
global: not tied to a repository checkout; used for cross-project memory, especially high-leveldaorepo: shared memory for the logical repository across branches and worktreesworktree: branch-local or experiment-local memory bound to one checkout path
Why Worktree Must Exist
A repo-only project anchor is insufficient.
If memory is anchored only to the repo root:
branch experiments contaminate each other
temporary workflows and conclusions leak across unrelated checkouts
failed experiments in one worktree pollute stable reasoning in another
Using the worktree path as a memory anchor preserves checkout-local memory.
Why Worktree Alone Is Not Enough
A worktree-only anchor is also insufficient.
If memory is anchored only to worktree path:
stable project knowledge fragments across checkouts
verified project-wide
shuanddao_renbecome hard to shareeach new worktree starts too empty
Therefore the recommended model is dual-anchor, not worktree-only.
Recommended Dual-Anchor Design
Every project-tied memory should be able to attach to:
a
repo_anchoroptionally a
worktree_anchor
This yields a useful separation:
stable shared project memory lives at
repobranch-local experiments, transient failures, and temporary heuristics live at
worktreeuniversal knowledge lives at
global
Anchor Does Not Replace Domain
Anchor and domain answer different questions.
domainasks: who is this memory for?anchorasks: which persistence scope does it belong to?
Examples:
a global epistemic law may be
domain=global,anchor=globala project-wide build rule may be
domain=project,anchor=repoa branch-local debugging lesson may be
domain=project,anchor=worktree
Stage-1 Anchor Fields
For the bootstrap drawer model, the minimum anchor fields should be:
anchor_kind:global | repo | worktreeanchor_id: normalized identifier for that anchoroptional
parent_anchor_id
The parent relationship is primarily for:
worktree -> repo
This allows branch-local memory to inherit a stable project parent.
Anchor Generation Rules
At stage 1, the anchor rules should be deterministic and filesystem-derived.
Recommended generation:
globalfixed symbolic id, not derived from cwd
reponormalized repository identity
worktreenormalized checkout identity
The critical rule is:
do not derive anchor identity from
wing
Repo Anchor
The repo_anchor should identify the logical repository shared by all worktrees.
Recommended source:
repository top-level path or a canonical repo identity derived from git metadata
The exact encoding can evolve, but the semantics should remain:
all worktrees of the same repo map to the same
repo_anchor
Worktree Anchor
The worktree_anchor should identify a specific checkout path.
Recommended source:
canonical worktree path
Semantics:
different worktree paths produce different
worktree_anchorsthe main checkout and each extra git worktree are treated as separate worktree anchors
Default Assignment Policy
At stage 1, memories should default to the following anchors:
dao_tianglobal
stable
dao_renusually
globalorrepo, depending on whether it is cross-project or repo-specific
project-shared
shurepo
branch-local
qiand experimentalshuworktree
runtime observations from the current checkout
worktree
external research evidence intended to support the current repo
repoby default,worktreewhen clearly branch-local
Runtime Wake-Up with Anchors
When anchors are present, runtime assembly should prefer:
current
worktreecurrent
repoglobal
This gives the agent:
local experimental context first
stable project memory second
universal law last, but still available
This ordering complements the knowledge-tier wake-up order rather than replacing it.
In other words, anchor filtering and dao / shu / qi ordering are separate passes.
Anchor Promotion Is Separate from Tier Promotion
The system needs two distinct upward movements:
knowledge-tier promotion
anchor-scope publication
These are not the same operation.
Examples:
qi @ worktree -> shu @ worktreeis a tier promotionshu @ worktree -> shu @ repois an anchor publication
Recommended publication chain:
worktree -> repo -> global
Meaning:
new or experimental memory should usually start at
worktreeonly verified, shareable project memory should move to
repoonly cross-project law should live at
global
This yields the governing principle:
write local first
publish outward only after evidence justifies it
At stage 1, this can remain a disciplined workflow and data-model invariant even
if a full publish_anchor API does not exist yet.
What Counts as Real Learning
The system should not consider "more stored text" to be the same as learning.
True learning happens only when:
observations accumulate in evidence memory
patterns are distilled into
qiorshurepeated and bounded patterns are promoted into
dao_renonly extremely stable, cross-domain knowledge is promoted into
dao_tian
Therefore:
qican be accumulated quicklyshushould be distilled with caredao_renshould be promoted rarelydao_tianshould be promoted extremely rarely
Layered Architecture
The system should be separated into four logical layers:
external tools
evidence memory
knowledge memory
runtime execution
External Tools
Examples:
research-rsCLI tools
MCP tools
test runners
build tools
These belong to qi. They are capabilities, not high-level knowledge.
Evidence Memory
This layer stores raw, source-backed observations.
Examples:
research results
runtime observations
human explicit teachings
concrete failures
counterexamples
contradictions
Evidence memory is allowed to contain inconsistent or conflicting facts.
That is expected. It reflects the world as observed.
Knowledge Memory
This layer stores distilled, governed knowledge:
qishudao_rendao_tian
Knowledge memory should never be a raw dump of evidence. It is a controlled compilation layer built on top of evidence.
Runtime Execution
This is where agents:
wake up relevant knowledge
choose the right skill
bind to available tools
act under constraints
Evidence Memory vs Knowledge Memory
This split is mandatory.
If raw evidence and abstract knowledge are stored as the same thing forever, the system will quickly lose the distinction between:
fact and conclusion
observation and law
candidate and canon
Evidence Memory Principles
raw-first
source-backed
append-friendly
contradiction-tolerant
high volume
Knowledge Memory Principles
distilled
bounded
stateful
auditable
lower volume
In short:
evidence memory stores "what we saw"
knowledge memory stores "what we therefore believe"
Relationship Between Memory, Skills, and Research
Memory
Memory is the governed persistence and wake-up system.
It should contain both:
evidence memory
knowledge memory
dao belongs here, not in external research tools.
Skills
Skills primarily encode shu.
But a good skill should also expose the dao that justifies the workflow and the qi needed to execute it.
So a mature skill should be read as:
governing principle
workflow
tool binding
Research Tools
External research tools do not define dao.
Their role is:
fetch evidence
structure evidence
help verify or falsify existing knowledge
So research-rs is qi, and its output primarily feeds evidence memory.
research-rs Boundary
research-rs is an external tool. It should not be given responsibility for maintaining dao.
Its appropriate role is close to the LLM Wiki pattern:
raw sources
wiki
schema
index
log
lint
But the outputs of research-rs should be treated as:
evidence
structured summaries
candidate insights
contradiction signals
They are not automatically dao.
Therefore:
research-rsorganizes the external worldmemory governs what is promoted from those results
P49 defines the research-rs ingestion path:
raw/source research output enters as
memory_kind=evidencewithprovenance=researchstructured summaries from research remain evidence unless explicitly distilled
candidate knowledge only through distill from existing evidence refs
contradiction signals become evidence or counterexamples for later demotion or gate evaluation
research must not directly create dao_tian. Research must not directly create canonical or promoted knowledge. It must not bypass lifecycle gates. The highest trust level research can supply by itself is source-backed evidence; memory owns distillation, promotion, demotion, and canonicalization.
Runtime Wake-Up Order
The runtime order should be explicit, not left to ad hoc semantic retrieval.
Recommended order:
dao_tiandao_renshuqievidence
Rationale:
dao_tiancalibrates the agent's worldviewdao_rencalibrates the current fieldshuproposes methodsqibinds execution to available toolsevidenceis used for grounding, exception handling, and proof
This order should not imply that the system always injects all layers.
Rather:
use
dao_tiansparingly and only when truly neededuse
dao_renbased on the active fielduse
shuas the main skill trigger and execution layeruse
qionly when binding to concrete capabilitiesuse evidence when verification or exception-handling is necessary
Promotion Hierarchy
Knowledge should evolve through controlled promotion, not direct assertion.
Recommended conceptual path:
observation -> qi/shushu -> dao_rendao_ren -> dao_tian
With the following meaning:
qi: tool-bound knowledgeshu: repeatable methoddao_ren: domain lawdao_tian: universal law
Higher promotion requires:
fewer entries
stronger evidence
broader validity
clearer boundaries
stronger review
Promotion Gate Philosophy
The system should never let "the agent found something interesting" equal "the system learned a law".
Instead:
research and runtime can produce evidence quickly
candidate knowledge can be distilled frequently
promotion must be gated
high-level law must be rare
This design strongly favors:
fast evidence growth
slow law growth
Knowledge Lifecycle
The knowledge layer should support at least these states:
candidatepromotedcanonicaldemotedretired
Meaning:
candidate: not yet trusted for default runtime wake-uppromoted: trusted enough for ordinary usecanonical: highly stable and preferreddemoted: weakened by stronger evidence or invalidationretired: no longer active, retained only for audit and history
Important rule:
High-level knowledge must be reversible. Promotion without demotion leads to knowledge pollution.
Four Core Operations
The smallest viable lifecycle should be modeled through four operations:
recorddistillpromotedemote
record
Store raw evidence.
Examples:
research result
runtime failure
human teaching
observed contradiction
distill
Create a candidate knowledge item from evidence.
Examples:
tool usage note
workflow heuristic
domain pattern candidate
promote
Move candidate knowledge into active runtime use once its gate is satisfied.
demote
Reduce or retire knowledge when it is contradicted, superseded, or becomes outdated.
Minimal Data Shape
Evidence Memory
Evidence entries should be raw-first and source-backed.
Suggested fields:
idcontentdomainfieldprovenancesource_reftimestamptags
Knowledge Memory
Knowledge entries should be explicit and auditable.
Suggested fields:
idstatementtierdomainfieldstatusstabilityevidence_refsscope_constraintscounterexamplespromotion_history
Stage-1 Bootstrap Drawer Schema
Phase 1 should reuse the existing drawer system, but not by pretending all drawers mean the same thing.
The bootstrap model should explicitly separate:
evidence drawerknowledge drawer
Shared Stage-1 Fields
Both drawer kinds should share the current base drawer fields and add:
memory_kind:evidence | knowledgedomain:project | agent | skill | globalfieldanchor_kind:global | repo | worktreeanchor_idoptional
parent_anchor_id
These fields should be explicit, not hidden inside JSON blobs, because they are part of query-time filtering and runtime wake-up assembly.
Evidence Drawer
The minimum stage-1 evidence drawer should add:
memory_kind='evidence'domainfieldprovenance:runtime | research | humananchor_kindanchor_id
Evidence drawers should not carry knowledge-governance fields such as:
tierstatusstatementtrigger_hintsrole-separated knowledge refs
Evidence drawers record what was seen, taught, verified, or contradicted. They can use tags to indicate whether they are supporting evidence, a boundary case, or a counterexample, but they are not themselves promoted knowledge.
Knowledge Drawer
The minimum stage-1 knowledge drawer should add:
memory_kind='knowledge'domainfieldstatementtier:qi | shu | dao_ren | dao_tianstatus:candidate | promoted | canonical | demoted | retiredsupporting_refscounterexample_refsteaching_refsverification_refsscope_constraintstrigger_hintsanchor_kindanchor_idoptional
parent_anchor_id
For knowledge drawers:
contentis the longer explanatory bodystatementis the short wake-up form
Why Evidence Refs Must Be Role-Separated
Stage 1 should not collapse all evidence into one undifferentiated
evidence_refs list.
The minimum useful split is:
supporting_refscounterexample_refsteaching_refsverification_refs
This matters because the runtime and future evaluator must be able to distinguish:
what supports a knowledge claim
what limits it
what was explicitly taught by a human
what was actively re-verified rather than merely observed
Minimal Trigger Hints
Stage 1 should allow a very small trigger_hints object for knowledge drawers,
but it must remain a bias layer, not a second skill registry.
The allowed structure should be limited to:
intent_tagsworkflow_biastool_needs
It should not directly name hard skill ids or become the authoritative trigger mechanism.
Statement vs Content
statement and content should have different jobs.
Recommended rule:
statementis the short, directly wakeable knowledge propositioncontentis the explanatory body with rationale, boundaries, and clarifying detail
Therefore:
statementshould not contain extended justification, examples, or long scope notescontentshould not merely restatestatement
This supports a clean runtime pattern:
wake by
statementdrill into
contentonly when explanation, review, or adjudication is needed
Natural Status Distribution by Tier
The stage-1 model should expect different status distributions for each tier:
dao_tian: usuallycanonicalordemoteddao_ren: usuallycandidateorpromotedshu: usuallypromotedqi: usuallycandidateorpromoted
This is not merely stylistic. It reflects the intended rarity and stability of each layer.
Minimal Interface Surface
If exposed through memory APIs, the minimal operations should roughly map to:
record(content, domain, field, provenance, source_ref, tags?)distill(statement, tier_candidate, domain, field, evidence_refs, scope_constraints, rationale, counterexamples?)promote(knowledge_id, target_status, promotion_reason, validation_refs, reviewer)demote(knowledge_id, reason_type, reason, evidence_refs, target_status)
Design principle:
The caller should not self-score high-level confidence directly. Confidence and stability should be system-derived or gate-derived whenever possible.
Two-Phase Implementation Strategy
The recommended implementation path is two-stage.
Phase 1: Drawer Bootstrap
Use two drawer types:
evidence drawerknowledge drawer
Purpose:
validate the value of the model quickly
avoid a large rewrite
reuse the current storage, ingest, and search paths
Limits:
knowledge drawers will eventually become overloaded with lifecycle and governance metadata
this is a bootstrap architecture, not the final form
Implemented Phase-1 runtime surface:
mempal context <query>assembles a runtime context pack from typed drawersmempal_contextexposes the same pack to MCP-connected agentsknowledge sections are ordered as
dao_tian -> dao_ren -> shu -> qiStage-1 field taxonomy is guidance-only and read-only:
mempal field-taxonomyandmempal_field_taxonomyexpose recommended fields such asgeneral,epistemics,software-engineering,debugging,tooling,research,writing, anddiary, while custom field strings remain validdao_tianis sparse by default in runtime context:mempal contextandmempal_contextinject at most 1dao_tianitem unless the caller explicitly sets--dao-tian-limit/dao_tian_limit;0disablesdao_tianwake-upremains an L0/L1 memory refresh surface and does not assemble typeddao_tian -> dao_ren -> shu -> qisections; typed operating guidance belongs tomempal context/mempal_contextevidence remains opt-in via
--include-evidencesame-tier items prefer
worktree, then currentrepo, thenrepo://legacy, thenglobalglobalanchor candidates usedomain=global, preserving the invariant that global anchors do not hold project-local domain memorytrigger_hintsare exposed as metadata only; they do not directly execute skillsMCP protocol guidance consumes context in order: read
dao_tiananddao_renfor judgment, useshuto bias workflow / skill choice, and useqito bias concrete tool choicememory hints never override system, user, repo, or client-native skill rules
bootstrap distill CLI creates candidate
dao_ren/qiknowledge drawers from existing evidence refs without auto-promotion or LLM summarizationmempal_knowledge_distillexposes the same deterministic distill operation to MCP-connected agents, letting runtime agents create candidate knowledge from evidence refs without shelling outbootstrap lifecycle CLI supports manual
promote/demoteon existing knowledge drawers by updating status plus verification / counterexample refs and writing audit entrieslifecycle verification / counterexample refs are hardened to require existing evidence drawers, preserving the rule that promotion and demotion are justified by evidence rather than arbitrary ids or other knowledge claims
promotion gate CLI provides a read-only advisory report before promotion, using deterministic evidence-count policy without mutating status, refs, vectors, schema, or audit history
mempal_knowledge_gateexposes the same read-only promotion gate to MCP-connected agents, so runtime agents can check readiness without shelling out or mutating lifecycle stateStage-1 promotion policy is inspectable without a concrete drawer through
mempal knowledge policyandmempal_knowledge_policycurrent Stage-1 thresholds are:
dao_tian -> canonical: 3 supporting refs, 2 verification refs, 1 teaching ref, human reviewer required, counterexamples blockdao_ren -> promoted: 2 supporting refs, 1 verification ref, counterexamples blockshu -> promoted: 1 supporting ref, 1 verification ref, counterexamples blockqi -> promoted: 1 supporting ref, 1 verification ref, counterexamples block
dao_tian -> canonicalalways requires a human reviewer in Stage 1; evaluator-only canonization is intentionally out of scopemempal_knowledge_promoteandmempal_knowledge_demoteexpose lifecycle mutation to MCP-connected agents; promotion is gate-enforced after appending supplied verification refs, while demotion requires counterexample evidencemempal knowledge publish-anchorimplements explicit outward anchor publication for active knowledge (worktree -> repo -> global) as a metadata-only operation separate from tier/status promotionmempal_knowledge_publish_anchorexposes the same outward anchor publication operation to MCP-connected agents without changing content, vectors, tier, or statuslifecycle updates are metadata-only in Stage 1; they do not rewrite content, re-embed vectors, or create Phase-2 knowledge cards
Phase 2: Knowledge Card Extraction
Once the model proves useful, separate knowledge memory from evidence memory structurally.
Recommended objects:
drawersfor evidenceknowledge_cardsknowledge_evidence_linksknowledge_events
Minimum schema v8 draft:
knowledge_cards:
id TEXT PRIMARY KEYstatement TEXT NOT NULLcontent TEXT NOT NULLtier TEXT NOT NULL CHECK ('qi','shu','dao_ren','dao_tian')status TEXT NOT NULL CHECK ('candidate','promoted','canonical','demoted','retired')domain TEXT NOT NULL CHECK ('project','agent','skill','global')field TEXT NOT NULL DEFAULT 'general'anchor_kind TEXT NOT NULL CHECK ('global','repo','worktree')anchor_id TEXT NOT NULLparent_anchor_id TEXTscope_constraints TEXTtrigger_hints TEXTcreated_at TEXT NOT NULLupdated_at TEXT NOT NULL
knowledge_evidence_links:
id TEXT PRIMARY KEYcard_id TEXT NOT NULLevidence_drawer_id TEXT NOT NULLrole TEXT NOT NULL CHECK ('supporting','verification','counterexample','teaching')note TEXTcreated_at TEXT NOT NULLunique key:
(card_id, evidence_drawer_id, role)
knowledge_events:
id TEXT PRIMARY KEYcard_id TEXT NOT NULLevent_type TEXT NOT NULL CHECK ('created','promoted','demoted','retired','linked','unlinked','updated','published_anchor')from_status TEXTto_status TEXTreason TEXT NOT NULLactor TEXTmetadata TEXTcreated_at TEXT NOT NULL
Minimum indexes:
knowledge_cards(tier, status)knowledge_cards(domain, field)knowledge_cards(anchor_kind, anchor_id)knowledge_evidence_links(card_id)knowledge_evidence_links(evidence_drawer_id)knowledge_events(card_id, created_at)
This yields a cleaner separation:
evidence says what happened
knowledge says what is believed
events say how that belief evolved
Storage decision:
Phase-2
knowledge_cardsshould live in the same SQLitepalace.dbthey should be separate tables from
drawers, not overloaded drawer rowsdrawersremain the raw evidence and citation rootknowledge_evidence_linksshould reference evidence drawers bydrawer_idknowledge_eventsshould be transactional with knowledge-card lifecycle changes and evidence-link mutationsa separate persistence layer is out of scope unless future measured needs prove the single-file SQLite boundary insufficient
Rationale:
mempal's product invariant is a local single-binary, single-file memory palace
knowledge promotion/demotion must stay transactionally tied to evidence refs
citations remain simpler and safer when evidence drawer ids are the durable root
using a second database or service would add operational complexity before the Phase-2 model has proven it needs independent scaling
Implemented Phase-2 surface at P42 baseline:
knowledge_cards,knowledge_evidence_links, andknowledge_eventsare schema v8 tables inpalace.dbRust core APIs can create/read/update/list cards, link evidence, and append events
mempal knowledge-cardexposes create/get/list/link/event/eventsmempal_knowledge_cardsexposes list/get/events to MCP-connected agentsmempal knowledge-card backfill-planreports Stage-1 knowledge drawers that are ready to become cards without writingmempal knowledge-card backfill-applydefaults to dry-run and only writes cards, links, and created events with--executemempal knowledge-card gateevaluates card readiness from role-separated evidence linksmempal knowledge-card promoteandmempal knowledge-card demotemutate card status transactionally with role-specific evidence links and append-only eventsmempal_knowledge_cardsalso exposesgate,promote, anddemoteactions over the same core lifecycle logic
Phase-2 cards are governed objects, but they are not yet the default
context/search source. At P42, mempal context, mempal_context, and
mempal_search remains drawer/citation based. Cards now have an explicit
linked-evidence retrieval path, but they are still not returned by default
search.
Phase-2 Card Retrieval Contract
P43 defines the contract for future card-aware runtime consumption without implementing retrieval behavior yet.
A card retrieval item is a governed knowledge result, not a raw drawer result.
The minimum returned card fields are: card_id, statement, content, tier,
status, domain, field, anchor_kind, and anchor_id.
Each card retrieval item must expose role-separated evidence citations derived
from knowledge_evidence_links. The minimum evidence citation fields are:
evidence_drawer_id, role, and source_file.
Default runtime eligibility is status-gated:
promotedandcanonicalcards are runtime-eligible by defaultcandidate,demoted, andretiredcards are excluded by default
This preserves the governance boundary:
card records carry distilled belief
linked evidence drawers remain the citation root
inactive card states remain inspectable but are not injected into ordinary runtime context
P43 does not change mempal context or mempal_context behavior.
P43 does not change mempal_search behavior.
Card embeddings, ranking strategy, and card-aware context/search surfaces are
deferred to later specs.
P44 adds the first explicit card-aware context surface:
mempal context --include-cardsmempal_contextwithinclude_cards=true
This remains opt-in. Default context assembly is still drawer-only. When enabled,
active Phase-2 cards are appended inside the existing
dao_tian -> dao_ren -> shu -> qi sections and expose card_id plus
role-separated evidence_citations. Each citation keeps the evidence drawer as
the citation root through evidence_drawer_id, role, and source_file.
P44 does not change mempal_search, does not add card embeddings, and does not
make cards the default runtime source.
P45 chooses the first card retrieval strategy:
mempal knowledge-card retrieve <query>mempal_knowledge_cardswithaction="retrieve"
The strategy is linked-evidence-first. It searches evidence drawers through the
existing BM25+vector drawer search path, follows knowledge_evidence_links, and
returns active cards linked to matched evidence. Returned card items include the
card record, a score derived from matched evidence, and role-separated evidence
citations with evidence_drawer_id, role, source_file, and score.
P45 intentionally does not add card embeddings, does not add card vector
storage, and does not make mempal_search return cards.
P46 keeps card-aware context opt-in. The default context remains drawer-only for
both mempal context and mempal_context; operators must still pass
--include-cards or include_cards=true to inject Phase-2 cards into the
typed context pack.
This is a deliberate default policy, not an unfinished implementation gap. Cards are now retrievable and context-injectable, but default runtime context is a high-trust path. It should not silently switch from drawer-backed active knowledge to mixed drawer/card guidance until real runtime evidence shows the change improves agent behavior without weakening citations.
Evidence required before default enablement:
repeated runtime traces where card-aware context causes better skill/tool selection than drawer-only context
no observed citation loss: every default card item must preserve linked evidence citations as the citation root
no material context bloat: card items must not crowd out higher-priority
dao_tian,dao_ren,shu, orqiguidanceno lifecycle confusion: inactive cards must remain excluded and demoted cards must not re-enter default context through linked evidence
explicit rollback criteria: a future default-on spec must define how to return to drawer-only defaults if card injection degrades runtime behavior
P47 keeps card-level embeddings deferred. P45 linked-evidence retrieval remains the only implemented card retrieval strategy: cards are found through matched evidence drawers, not through a separate card vector index.
This keeps the citation model simple. Card statements are distilled beliefs; evidence drawers remain the source-backed material. A card embedding index would make card statements directly retrievable, which may improve recall, but it also adds a new stale-vector surface and can make unsupported belief text feel like a primary source unless every result still carries linked evidence citations.
Evidence required before card embeddings:
statement-match misses: repeated retrieval traces where linked-evidence search misses useful active cards because evidence wording does not match the query but the card statement does
citation preservation: card-embedding results must still return linked evidence citations as the citation root
measurable recall improvement over P45 linked-evidence retrieval without unacceptable precision loss
schema and maintenance plan for card vector storage, reindexing, and stale-vector handling
rollback behavior that can disable card-vector retrieval and fall back to P45 linked-evidence retrieval without data loss
P48 keeps knowledge_events as the authoritative Phase-2 card audit trail, with
no default JSONL dual-write for card lifecycle mutations. This keeps card
promote/demote/backfill behavior transactionally bound to the same SQLite
database that owns knowledge_cards and knowledge_evidence_links.
Stage-1 drawer lifecycle continues to use audit.jsonl where already defined.
Phase-2 card lifecycle does not mirror those entries into audit.jsonl by
default because that would create two audit surfaces with different durability
and transaction semantics. The append-only knowledge_events table is the
source of truth for card lifecycle history.
If an external integration needs JSONL card history, it should be added as an
explicit export surface. JSONL export must be derived from knowledge_events,
must be reproducible, and must not become a second source of truth.
Decision on Bootstrap vs Final Architecture
Current recommendation:
start with two drawer types
explicitly mark this as bootstrap-only
plan for extraction into separate knowledge objects later
This gives the system a low-cost learning path without pretending the temporary structure is ideal.
What Belongs Where
In research-rs
ingest and normalize external sources
maintain research wiki/index/log/lint
emit structured evidence and candidate insights
In memory layer
store evidence memory
store knowledge memory
maintain
dao / shu / qimanage promotion and demotion lifecycle
In skills
encode reusable workflows
expose relevant
daobind to
qi
In evaluator/gate
validate promotions
handle demotions
guard against self-pollution
Non-Goals
This design does not assume:
fully automatic promotion to
daoexternal research directly creating universal law
replacing raw evidence with compressed knowledge
collapsing evidence, knowledge, and workflow into one storage object forever
Current Recommendation
Proceed with the following assumptions unless future evidence rejects them:
daobelongs to the memory layerresearch-rsis an externalqitool, not adaocontainerevidence memory and knowledge memory should be explicitly separated
runtime typed context should assemble
daobeforeshu, andshubeforeqi; wake-up remains a refresh surface, not the typed assemblerthe implementation should begin with drawer bootstrap and evolve into a dedicated knowledge model inside the same SQLite
palace.db
Future Work After P42
P42 originally left one explicit follow-up:
add evaluator-assisted promotion only behind deterministic gates and human review rules for high-level knowledge
P50 closes that item as policy. P50 defines evaluator-assisted promotion as advisory-only. Evaluators are not lifecycle actors.
Evaluators may:
recommend promotion or demotion candidates
propose supporting, verification, teaching, and counterexample evidence refs
produce contradiction candidates and risk notes
explain why a knowledge item appears ready or unsafe
Evaluators must not directly mutate status or otherwise act as lifecycle writers:
append lifecycle refs as authoritative gate input
bypass deterministic promotion or demotion gates
satisfy reviewer requirements by evaluator-only review
create automatic promotion or demotion paths
The deterministic gates remain authoritative. Promotion and demotion still go
through the existing gate-enforced CLI/MCP lifecycle surfaces. dao_tian
canonicalization still requires a human reviewer; evaluator-only canonization is forbidden.
If a future implementation adds evaluator APIs, that work must be a separate
spec and preserve deterministic replay, evidence citation, and audit semantics.
No open Future Work remains in the P42 list.
Completion Status After P50
P51 closure audit: the MIND-MODEL baseline is complete.
No open implementation tasks remain in the P12-P50 baseline. The completed baseline includes:
typed evidence and knowledge drawers
dao_tian,dao_ren,shu, andqigovernance boundariesworktree/repo/global anchor behavior
wake-up/context separation
context-guided skill/tool selection
distill, gate, promote, demote, and anchor publication lifecycle surfaces
Phase-2 knowledge card storage, lifecycle, retrieval, and opt-in context
research ingestion and evaluator promotion policies
Completion does not mean every optional future enhancement is implemented. It means the current design baseline has no known open implementation task. Future evaluator APIs, card-level embeddings, default card context, research adapters, or other expansions must start as new-stage specs with their own evidence, rollback criteria, and acceptance checks.
Phase 3 Intake Roadmap
P52 Phase-3 intake roadmap defines how work starts after baseline closure. Phase 3 is new-stage work, not unfinished P12-P50 baseline work.
Candidate tracks:
evaluator APIs
card retrieval maturity
research adapter ingestion
runtime adoption evidence
Intake rules:
each candidate must state evidence, rollback criteria, and acceptance checks before implementation begins
default-enabling card context or card embeddings requires measured retrieval benefit
Evaluator APIs must preserve the P50 advisory-only lifecycle boundary
Research adapters must preserve the P49 evidence-first ingestion boundary
card retrieval changes must preserve citation and audit semantics
runtime adoption work must include rollback criteria for agent behavior changes
The first Phase-3 implementation should be selected only after one candidate has enough evidence to justify implementation. Until then, Phase 3 remains an intake queue, not an implementation commitment.
Phase 3 Candidate Evidence Audit
P53 Phase-3 candidate evidence audit records current readiness. No Phase-3 candidate is ready for direct implementation yet.
Candidate readiness:
Runtime adoption evidence: recommended first measurement track. It should collect concrete agent-behavior evidence before default policy changes.
Card retrieval maturity: partial evidence from P43-P45, but it still needs measured retrieval misses and context impact before default context changes or card embeddings.
Evaluator APIs: blocked on advisory output contracts and lifecycle replay requirements.
Research adapter ingestion: blocked on an explicit external report/input contract.
Recommended first Phase-3 track: runtime adoption evidence. Runtime adoption evidence is the common measurement substrate for deciding whether card-aware context should become default, whether card embeddings are justified, and what evaluator advice is actually useful to agents.
This keeps Phase 3 evidence-first: implement measurement before implementing new authority, new retrieval defaults, or new external ingestion adapters.
Phase 3 Runtime Surfaces
P54 runtime adoption evidence adds schema v9 table runtime_adoption_events.
Events capture explicit agent/runtime signals with track, signal, feature,
optional query/context/card/evaluator/research references, note, metadata, and
timestamp.
P55 runtime adoption CLI exposes this evidence substrate:
mempal phase3 adoption recordmempal phase3 adoption listmempal phase3 adoption stats
P56 implements mempal phase3 gate card-context-default. Card context default gate remains read-only; include_cards remains opt-in. The gate requires
accepted card_context adoption evidence and zero rollback signals before a
future default-on spec can even be considered.
P57 implements mempal phase3 gate card-embeddings. The gate remains read-only
and adds no card vector schema. Card embeddings require repeated measured
card_embedding miss signals, and linked evidence remains the citation root.
P58 implements mempal phase3 gate evaluator-api. Evaluator API gate remains advisory-only and preserves the P50 advisory-only lifecycle boundary: evaluator
signals cannot mutate status, satisfy reviewer requirements, or bypass
deterministic gates.
P59 implements mempal phase3 research-validate-plan. The command validates an
external JSON report/input contract with report_id, title, sources,
findings, and optional candidate_insights. It only validates and plans;
research adapter ingestion still preserves the P49 evidence-first boundary and
does not create promoted/canonical knowledge.
P60 exposes the Phase-3 runtime evidence baseline to MCP-connected agents
through mempal_phase3. The MCP tool uses action values
record/list/stats/gate/research_validate_plan, mirroring the P54-P59 CLI
surfaces without adding new authority. Later Phase-3 actions extend this same
bounded MCP surface. record appends runtime_adoption_events; list,
stats, gate, and research_validate_plan remain read-only. MCP research
validation accepts a JSON report object and still does not ingest or promote
knowledge.
P61 adds a read-only runtime adoption recording protocol through
mempal_phase3 action=guidance. The guidance tells agents when to record
used, accepted, rejected, miss, rollback, contradiction, or
neutral, and exposes the required track, signal, and feature fields
plus optional context fields. This is a recording discipline, not automatic
instrumentation: it adds no hooks, no background writes, no schema migration,
and no default runtime behavior change.
P62 exposes the same recording protocol through CLI parity with
mempal phase3 adoption guidance. The CLI supports plain and JSON output and
shares the guidance implementation with mempal_phase3 action=guidance, so MCP
agents, humans, and non-MCP automation inspect the same semantics. This remains
read-only and does not append adoption events or change Phase-3 gate policy.
P63 adds a read-only record helper through
mempal phase3 adoption prepare-record and
mempal_phase3 action=prepare_record. The helper validates and normalizes
candidate record inputs, then returns the equivalent CLI record command and
MCP record payload with writes=false. It does not generate event ids unless
the caller supplied one, and it does not append runtime adoption events.
P64 adds a read-only record quality policy through
mempal phase3 adoption check-record and
mempal_phase3 action=check_record. The policy evaluates candidate runtime
adoption event quality before writing and returns writes=false, valid,
quality, errors, and warnings. It treats empty feature as an error,
warns when outcome-bearing signals lack concrete note/query context, and warns
when track-specific references such as card_id, evaluator_id, or
research_report_id are missing. This remains advisory only: it does not append
events and does not block the lower-level record command.
P65 adds a read-only runtime adoption review report through
mempal phase3 adoption review and mempal_phase3 action=review. The report
summarizes accumulated adoption evidence with applied filters, aggregate signal
counts, per-feature counts, an advisory conclusion, and reasons. It supports
track, feature, and signal filtering without schema changes; signal filtering is
applied after DB retrieval. This gives future default-on specs a compact
evidence artifact while preserving the Phase-3 boundary: review reports do not
write events, change gates, or authorize runtime default changes.
P66 adds a read-only card-context default readiness report through
mempal phase3 readiness card-context-default and
mempal_phase3 action=readiness with candidate=card-context-default. The
report reuses P65 review semantics filtered to track=card_context and
feature=include_cards, then returns writes=false, ready, decision, the
embedded review, and reasons. ready=true only means the surface is eligible
for a future default-on spec; it does not change mempal context defaults,
enable include_cards, mutate lifecycle state, or create card embeddings.
P67 adds explicit evidence-first research ingestion through
mempal phase3 research-ingest-plan. The command accepts the same P59 report
contract and defaults to dry-run with writes=false. With --execute, it
writes one memory_kind=evidence drawer per finding using
provenance=research, stable drawer ids, and idempotent skip-on-existing
behavior. candidate_insights are surfaced only as mempal knowledge distill
suggestions backed by the planned evidence refs; P67 does not create knowledge
drawers, promote research output, add a schema migration, or expose MCP write
access.
P68 exposes the P67 dry-run planning semantics through MCP as
mempal_phase3 action=research_ingest_plan. The action accepts an inline
report JSON object, returns planned research evidence drawer refs plus
candidate mempal knowledge distill suggestions, and always reports
writes=false. It shares the same pure planner as the CLI but deliberately does
not expose --execute, create drawers or vectors, mutate runtime adoption
events, or promote research output into knowledge.
P69 adds a quality-gated runtime adoption write path through
mempal phase3 adoption record-checked and
mempal_phase3 action=record_checked. The command/action runs the P64 record
quality policy immediately before writing. quality=ready records are written,
quality=warning records are blocked by default unless allow_warnings is
explicitly set, and quality=invalid records are always blocked. This reduces
low-signal self-evolution evidence without adding hooks, background
instrumentation, schema changes, or new authority for Phase-3 gates.
P70 self-evolution completion audit records the current state against the larger objective: a complete self-evolving agent system. Complete self-evolving agent system deliverables are:
evidence substrate: the system can store cited raw evidence and runtime adoption outcomes without losing provenance
knowledge governance: evidence can be distilled into governed knowledge and moved through lifecycle gates
runtime retrieval: agents can request context/search/card/research guidance without changing defaults implicitly
research bridge: external research output can enter as evidence and candidate insight suggestions, not as direct dao
feedback loop: runtime use, acceptance, rejection, misses, rollbacks, and contradictions can be recorded and reviewed
policy hardening path: stronger defaults require evidence, readiness checks, rollback criteria, and a new P-level spec
Prompt-to-artifact checklist:
Evidence substrate -> P54 runtime_adoption_events plus P0-P13 raw drawer storage and cited search provide durable evidence records.
Knowledge governance -> P12-P28 implement typed
dao_tian/dao_ren/shu/qidrawers, context assembly, policy surfaces, distill, gate, promote, demote, and anchor publication.Knowledge cards -> P31-P45 implement Phase-2 card schema, core API, CLI, MCP read/lifecycle/retrieval, backfill, and explicit card-aware context.
Research ingestion -> P49/P59/P67/P68 preserve evidence-first research boundaries: validate report, plan evidence refs, write research evidence only through explicit CLI
--execute, and expose MCP dry-run planning.Runtime adoption -> P54-P69 implement event storage, CLI/MCP record/list/stats, guidance, prepare/check helpers, review, readiness, and quality-gated
record_checkedwrites.Default hardening -> P56/P57/P58/P66 define read-only gates and readiness reports for card context, card embeddings, evaluator APIs, and card-context-default eligibility.
P70 conclusion: not complete. P12-P69 establish a governed self-evolution substrate, but they do not yet prove a complete self-evolving agent system. Remaining gaps before full self-evolution:
no automatic or semi-automatic adoption capture around actual agent tool execution; evidence still depends on explicit CLI/MCP calls
no end-to-end replay that demonstrates research -> evidence -> distill -> gated promotion -> runtime context -> checked adoption record in one audited scenario
no evaluator advisory API with replayable output contracts; P50/P58 only keep evaluators advisory and gated
no default-on card context or card embeddings; P66 readiness only reports eligibility for a future default-on spec
no autonomous promotion authority; lifecycle changes still require deterministic gates, evidence refs, and human/reviewer boundaries
no rollback executor for default/runtime policy changes; rollback criteria are policy requirements, not an automated runtime mechanism
Future P candidates:
P71 self-evolution loop replay: implemented as a CLI E2E replay test that walks research -> evidence -> knowledge card -> gate/promote -> context -> checked adoption record. This proves the existing pieces can compose, but it does not add automatic runtime capture.
P72 runtime adoption capture helper: implemented as explicit CLI/MCP
capturesurfaces that mapsurface/outcomeobservations into existing checked runtime adoption records. It is dry-run by default, writes only with explicit execute, and does not add background instrumentation.P73 evaluator advisory API: implemented as deterministic CLI/MCP advice surfaces through
mempal phase3 evaluator adviseandmempal_phase3 action=evaluator_advise. Advice output is replayable from request fields, returnswrites=false,lifecycle_authority=false,deterministic_gate_required=true, reasons, and asurface=evaluatoradoption capture plan. It cannot mutate lifecycle state, satisfy reviewer requirements, bypass gates, or call LLM/network evaluators.P74 card context default-on proposal: implemented as read-only CLI/MCP proposal surfaces through
mempal phase3 default-proposal card-contextandmempal_phase3 action=default_proposal. The proposal embeds P66 readiness, requires explicit rollback criteria, returnswrites=false, and only marksproposal_ready=truewhen both readiness and rollback criteria are present. It deliberately keepsmempal context/mempal_contextdefaultinclude_cards=false; any actual default change still requires a future explicit spec.
P75 self-evolution completion audit revisits the full objective after P71-P74 landed on main.
P75 objective restatement:
The system must preserve raw evidence and runtime outcome evidence with provenance.
The system must distill evidence into governed knowledge and cards through deterministic gates.
The system must expose retrieval/context surfaces that agents can use without silently changing runtime defaults.
The system must accept external research only through evidence-first and evidence-backed candidate insight paths.
The system must record, review, and quality-gate runtime adoption feedback.
The system must provide evaluator advice without granting lifecycle authority.
The system must provide a policy-hardening path where stronger defaults require evidence, readiness checks, rollback criteria, and a new explicit spec.
P75 prompt-to-artifact checklist:
Evidence substrate: P0-P13 raw drawer storage and citation-bearing search, P54
runtime_adoption_events, and schema v9 tests prove durable evidence and runtime outcome storage.Knowledge governance: P12-P28 typed
dao_tian/dao_ren/shu/qidrawers, policy surfaces, distill, gate, promote/demote, and anchor publication remain covered bytests/knowledge_lifecycle.rs.Knowledge cards: P31-P45 card schema, core API, CLI, MCP, retrieval, backfill, and lifecycle surfaces remain covered by
tests/knowledge_card_*and explicit card-aware context tests.Research bridge: P49/P59/P67/P68 ensure research output enters as evidence or evidence-backed candidate insight suggestions; P71 proves this path in
tests/phase3_self_evolution_replay.rs.Self-evolution replay: P71
tests/phase3_self_evolution_replay.rswalks research -> evidence -> card promotion -> context -> checked adoption record.Adoption capture: P72
mempal phase3 adoption captureandmempal_phase3 action=capturemap concretesurface/outcomeobservations into checked records without background instrumentation.Evaluator advice: P73
mempal phase3 evaluator adviseandmempal_phase3 action=evaluator_advisereturn replayable advisory output withlifecycle_authority=falseanddeterministic_gate_required=true.Default hardening proposal: P74
mempal phase3 default-proposal card-contextandmempal_phase3 action=default_proposalcombine P66 readiness with rollback criteria while preservinginclude_cards=false.Protocol and inventory evidence:
src/core/protocol.rs,AGENTS.md, andCLAUDE.mdlist the Phase-3 actions throughcapture/evaluator_advise/default_proposal.Mainline verification evidence: PRs #63, #64, #65, and #66 were merged to main with green
fmt,default, andrestCI checks.
P75 conclusion: not complete.
The governed self-evolution substrate is now substantially complete: evidence, knowledge governance, cards, research ingestion, runtime adoption feedback, replay, capture helpers, evaluator advice, and default-on proposal artifacts are implemented and tested. However, the full "complete self-evolving agent system" objective still has uncovered requirements if interpreted as autonomous runtime self-evolution.
Remaining gaps after P75:
no automatic live tool instrumentation: adoption capture still requires explicit CLI/MCP calls rather than wrapping actual agent tool execution
no actual default-on runtime change:
include_cardsremains opt-in by design, and P74 only creates a proposal artifactno rollback executor: rollback criteria are recorded in proposals but are not executable runtime policy
no autonomous promotion authority: lifecycle mutation still requires deterministic gates, evidence refs, and human/reviewer boundaries
no card embedding implementation: P57/P47 keep card-level embeddings behind measured miss evidence and future rollback requirements
P76 spec completeness invariant records the process rule that every numbered P must leave both a task contract and a matching plan. This includes documentation-only, audit-only, policy-only, and code implementation work. The rule exists because the P-series is no longer just a task list; it is the auditable decision trail for the mind-model implementation. Every P must leave a spec before it can be considered complete. A future spec-less P or missing spec is explicitly incomplete and must be fixed before implementation or merge.
Updated recommended next P candidates after reserving P76 for governance:
P77 live adoption instrumentation boundary adds a read-only policy surface for
the live instrumentation gap. mempal phase3 adoption instrumentation-policy
and mempal_phase3 action=instrumentation_policy return writes=false,
default_mode=manual_only, allow only opt_in_wrapper as the semi-automatic
mode, and explicitly forbid implicit_background_capture, silent event append,
and quality gate bypass. This does not install hooks or wrappers; it defines the
safe boundary future instrumentation must obey: opt-in, user opt-out, checked
capture/record_checked writes, and rollback evidence when instrumentation
degrades behavior.
Updated recommended next P candidates after completing P77:
P78 card context default runtime flag implements the first actual default
runtime change path for cards. The default remains false unless local config
sets context.include_cards_default=true. mempal context and mempal_context
use that config only when the request omits explicit card flags; CLI
--include-cards still opts in, CLI --no-include-cards opts out, and MCP
include_cards overrides config when supplied. The only supported write path is
mempal phase3 default-control card-context: enabling requires the P74
proposal-ready conditions, including sufficient card_context/include_cards
runtime adoption evidence and rollback criteria; disabling is always allowed
and writes the flag back to false. The command writes local config only and does
not append runtime adoption events, change schema, or alter search defaults.
Updated recommended next P candidates after completing P78:
P79 rollback executor policy implements the first concrete rollback executor for default/runtime policy changes. CLI
mempal phase3 rollback-control card-contextevaluatescard_context/include_cardsrollback evidence and, only with--execute, writes local configcontext.include_cards_default=false. MCPmempal_phase3 action=rollback_controlexposes the same rollback evidence check as a read-only agent surface. No runtime adoption events, knowledge lifecycle state, schema, or search defaults are changed by rollback control.
Updated recommended next P candidates after completing P79:
P80 autonomous promotion boundary audit resolves the last ambiguous "gap" from P70/P75 as a governance boundary rather than a missing implementation. Autonomous promotion is out of scope for the current complete self-evolution design. mempal can autonomously preserve evidence, prepare candidate knowledge, evaluate gates, produce evaluator advice, assemble context, propose default changes, and execute explicit rollback controls, but lifecycle authority remains human-gated. P80 decision: autonomous promotion is out of scope.
human-gated lifecycle authority is the final governance boundary: promotion and demotion of Stage-1 knowledge drawers or Phase-2 knowledge cards must remain explicit human/operator-triggered lifecycle mutation surfaces. Deterministic gates, evidence refs, reviewer rules, evaluator advice, runtime adoption evidence, and research findings can support the decision, but none of them can silently convert a candidate into promoted knowledge. This boundary keeps the system self-evolving in the evidence/proposal/context/adoption loop while avoiding an agent that can grant itself durable knowledge authority.
Updated recommended next P candidate after completing P80:
P81 self-evolution completion audit: re-evaluate the active objective against the actual artifacts after P77-P80. If the governed, human-gated definition is accepted as the intended objective, the audit can close the goal; if the goal still requires fully autonomous lifecycle mutation, that requirement must be reopened as a separate explicit spec rather than inferred.
P81 self-evolution completion audit is the final audit for the active objective
完整自进化 agent 系统.
Objective restatement: the target is a governed human-gated complete self-evolving agent system. "Complete" means the agent can gather external and runtime evidence, preserve provenance, distill and structure knowledge, retrieve the right knowledge/skills/tools at runtime, record feedback, evaluate stronger defaults, apply explicit default/rollback controls, and keep durable knowledge lifecycle mutation under deterministic gates plus human/operator intent.
Prompt-to-artifact checklist:
Evidence substrate: P0-P13 raw drawer storage, citation-bearing search, and P54
runtime_adoption_eventsprovide durable evidence and runtime outcome storage. Evidence remains raw and cited; search/context do not rewrite source content.Knowledge governance: P12-P28 typed
dao_tian/dao_ren/shu/qidrawers, policy surfaces, distill, gate, promote/demote, and anchor publication provide governed knowledge lifecycle for Stage-1 drawers.Knowledge cards: P31-P45 implement card schema, evidence links, append-only events, CLI/MCP lifecycle, backfill, retrieval, and explicit card-aware context without making cards an implicit search/default source.
Research bridge: P49/P59/P67/P68 ensure external research enters as evidence or evidence-backed candidate insight suggestions. Research output cannot directly define dao or bypass gates.
Runtime feedback loop: P54-P69 provide runtime adoption event storage, guidance, prepare/check helpers, review/readiness/gate reports, and quality-gated
record_checkedwrites.Self-evolution replay: P71
tests/phase3_self_evolution_replay.rsproves the composed path research -> evidence -> card promotion -> context -> checked adoption record.Live adoption boundary: P77
instrumentation_policydefines the safe boundary for future live wrappers: opt-in, preserve opt-out, no silent event append, and route writes through checked capture orrecord_checked.Runtime default control: P74/P78 provide proposal-ready and explicit
default-controlpaths for card-aware context. Default change requires runtime evidence and rollback criteria; request-level overrides still win.Rollback and default control: P79
rollback-controlturns rollback evidence into an explicit reversible config action, settingcontext.include_cards_default=falseonly with--executeand without writing runtime events or lifecycle state.Evaluator boundary: P50/P58/P73 keep evaluators advisory-only.
evaluator_adviseis replayable, returnslifecycle_authority=false, and cannot satisfy reviewer authority or bypass deterministic gates.Lifecycle authority boundary: P80 declares autonomous promotion out of scope. Human/operator-triggered promote/demote commands with evidence refs and gates remain the only durable lifecycle mutation path.
Spec completeness: P76 requires every numbered P to leave a matching task spec and plan. P77-P81 follow this rule.
Mainline verification: PR #68 through PR #72 are merged to main. Main CI runs
25805677837,25806999068,25808402185,25809830828, and25810588996all completed with success acrossfmt,default, andrestjobs.
P81 conclusion: complete.
The active objective is complete under the governed human-gated definition. The system now has an auditable loop from evidence intake to governed knowledge, runtime context, feedback capture, policy evaluation, explicit default control, and explicit rollback. It does not grant agents silent durable lifecycle authority, and that is an intentional design boundary rather than a missing implementation.
Residual boundary: fully autonomous lifecycle mutation remains out of scope. If future work requires an agent to promote or demote durable knowledge without a human/operator-triggered lifecycle command, that is a new objective and must be opened as a separate P-level spec with its own evidence, rollback, safety, and acceptance criteria.
Post-P81 Opt-In Instrumentation
P82 implements the first concrete opt_in_wrapper allowed by P77. CLI
mempal phase3 adoption wrap explicitly runs one child command after --,
observes its exit status, maps 0 to accepted and non-zero to rejected
unless --outcome overrides the mapping, and returns a wrapper report with the
child exit code plus the nested capture report.
P82 preserves the governed runtime boundary:
no hooks, daemons, background workers, or silent capture are installed
no MCP-side shell command execution is added
no runtime adoption event is written unless
--executeis suppliedall writes reuse P72 capture mapping and P69 checked-record quality gates
warning-quality captures remain blocked unless
--allow-warningsis suppliednon-zero child exits are propagated after the wrapper report is emitted
This makes runtime evidence capture less manual while keeping instrumentation explicit, opt-in, quality-gated, and reversible through existing rollback evidence policies.
Cognitive Brief
P83 adds mempal brief, the first deterministic cognitive brief surface. It
does not replace mempal search or mempal context; it uses the existing
context assembly path with evidence and cards enabled, then organizes the result
into a citation-first report.
The P83 brief contains:
key facts from governed knowledge/context items
cited evidence items
active knowledge cards and their linked evidence citations
simple entity cues extracted from cited text
unresolved-item cues such as action items, blockers, or remaining work
uncertainty signals such as missing evidence, missing governed knowledge, missing cards, unresolved work, or conflict/stale language
deterministic next actions
P83 deliberately avoids LLM synthesis, MCP command execution, schema changes, fact-check side effects, dream-cycle maintenance, or runtime adoption writes. Its purpose is to make the system "read for you" in a safe first step: organize cited memory into an actionable brief while preserving uncertainty instead of hallucinating confidence.
Multi-Agent Cowork Bus
P84 upgrades cowork from a two-tool Claude/Codex pair protocol into a
project-scoped multi-agent bus. The old P8 path routes to tool-family inboxes
such as claude or codex; that is insufficient when one project has one
Claude Code instance and multiple Codex instances, because both Codex instances
race on the same shared codex inbox.
The P84 bus introduces stable agent_id addressing:
cowork-registerrecords concrete instances such asclaude-main,codex-a, andcodex-bcowork-sendtargets one concreteagent_idcowork-broadcastfans out independent inbox copies to multiple targetscowork-agent-draindrains one concrete agent inboxcowork-agentslists registered agents and pending per-agent inbox state
State lives under ~/.mempal/cowork-bus/<encoded_project_identity>/, outside
palace.db. P84 remains ephemeral and file-backed: it does not write drawers,
cards, runtime adoption events, audit entries, or schema state. The legacy
cowork-drain --target claude|codex and mempal_cowork_push path remains
available unchanged for backward compatibility.
P84 stores optional transport metadata but only inbox delivery is active. tmux send/capture is intentionally left to the next P-level task so that instance identity and per-agent routing are proven before adding a more invasive terminal-injection transport.
MCP Multi-Agent Cowork Bus
P85 exposes the P84 bus to agent runtimes through one MCP tool:
mempal_cowork_bus. This is the point where the bus becomes usable by agents
directly, not only by shell commands.
The MCP surface is action-based:
action=registerregisters or updates a concreteagent_idaction=listreports project bus agents and pending inbox countsaction=senddelivers one message to one concrete targetaction=broadcastfans out independent inbox copies to multiple targetsaction=drainreturns and consumes one concrete agent's inbox
P85 deliberately does not infer concrete instances from MCP client_info.name.
Client names can identify a tool family such as Codex, but they cannot
distinguish codex-a from codex-b. The multi-agent bus therefore requires
explicit agent_id values and remains separate from legacy
mempal_cowork_push, which is still the simpler Claude<->Codex partner
handoff path.
The MCP tool uses the same file-backed bus state under
~/.mempal/cowork-bus/<encoded_project_identity>/. It does not write
palace.db, drawers, cards, runtime adoption events, or schema state. tmux
transport remains a later layer on top of the now-explicit agent registry and
per-agent routing model.
Tmux Cowork Transport
P86 activates tmux as an explicit transport for the multi-agent bus. inbox
remains the default safe path. A target agent can opt into near-real-time pane
delivery by registering with transport=tmux and a concrete tmux_target.
Example:
mempal cowork-register \
--agent-id codex-a \
--tool codex \
--cwd "$PWD" \
--transport tmux \
--tmux-target mempal:0.1After that, cowork-send, cowork-broadcast, and
mempal_cowork_bus action=send|broadcast use the same transport-aware bus core.
For tmux targets, mempal invokes the local tmux binary directly with
std::process::Command; it does not execute through a shell. The delivered text
is a plain envelope containing source agent id, target agent id, and message
content.
P86 intentionally does not silently fall back to inbox if tmux fails. A tmux transport target means "deliver to this pane"; if that pane or binary is unavailable, the send fails and no inbox copy is written. This prevents ambiguous double-delivery semantics where a pane may receive a message and then later drain the same message from an inbox.
This gives mempal three cowork layers:
legacy partner handoff:
mempal_cowork_pushfor Claude<->Codex pairsmulti-agent bus inbox: explicit
agent_idrouting with per-agent inbox filestmux transport: explicit pane delivery for registered concrete agents
Cowork Bus Event Log
P87 adds an operational event log to the multi-agent bus. Communication is no longer only "fire and inspect inbox"; every important bus action also appends a JSON Lines event under:
~/.mempal/cowork-bus/<encoded_project_identity>/events.jsonlThe event stream records:
registerevents when a concrete agent id is registered or updatedsendandbroadcastdelivery events for successful inbox or tmux deliverysend/broadcastfailure events for tmux hard failuresdrainevents when an agent drains its per-agent inbox
Replay is intentionally read-only. mempal cowork-events --cwd <repo> and
mempal_cowork_bus action=events list the operational event stream; they do
not redeliver messages, drain inboxes, trigger tmux, or ingest anything into
palace.db. Message bodies are represented as bounded message_preview
fields, so the event stream is an operational audit trail rather than a second
durable memory store.
This is the first runtime-ops layer above P84-P86. It gives later delivery ack/status, presence, thread/channel, and tmux peek work a shared evidence source for "what happened on the bus" without changing the core memory schema.
Cowork Delivery Ack And Status
P88 derives delivery status from the P87 event stream. There is no mutable
status table and no database migration. The event id of each successful or
failed delivery is the message_id surfaced to CLI and MCP callers.
Status is computed by replaying events.jsonl:
pending: delivery succeeded and has not been drained or ackeddrained: a later drain event consumed the target agent's inbox messageacked: the target agent explicitly appended an ack event for thatmessage_idfailed: the original delivery event was a hard transport failure
The user-facing surfaces are:
mempal cowork-deliveries --cwd "$PWD" --agent-id codex-a
mempal cowork-ack --cwd "$PWD" --agent-id codex-a --message-id evt-...The MCP surface reuses mempal_cowork_bus with action=deliveries and
action=ack. Ack is explicit and append-only: it does not mutate inbox files,
does not redeliver messages, and does not write palace.db. This keeps the
bus operationally observable while preserving the original ephemeral cowork
boundary.
Cowork Agent Presence
P89 adds explicit heartbeat-based presence. Registration gives each concrete
agent a last_seen_at, and agents can refresh it with:
mempal cowork-heartbeat --cwd "$PWD" --agent-id codex-aPresence is derived when listing agents:
online: last seen within the default 10 minute stale thresholdstale: last seen exists but is older than the stale thresholdnever_seen: legacy or hand-edited records withoutlast_seen_at
The same semantics are exposed through mempal_cowork_bus action=heartbeat
and action=list. This remains an explicit signal: mempal does not install a
daemon, does not infer liveness from tmux panes, and does not silently record
background heartbeat events. That keeps presence useful for coordination
without pretending to know more than the agent instances have explicitly
reported.
Cowork Threads And Channels
P90 adds two coordination scopes above raw agent addressing:
thread_idseparates work streams such asp90-revieworrelease-auditchannelnames a group of concrete agents such asrevieworfrontend
Direct cowork-send and cowork-broadcast can attach thread_id and
channel metadata. The metadata is carried into bus inbox messages, events,
and delivery status replay, so a receiver can see which work stream a message
belongs to when draining its inbox.
Channels are explicit registry entries, not inferred from tool family names:
mempal cowork-channel-set \
--cwd "$PWD" \
--channel review \
--agent codex-a \
--agent codex-b
mempal cowork-channel-send \
--cwd "$PWD" \
--from claude-main \
--channel review \
--thread-id p90-review \
--message "review this patch"cowork-channel-set replaces membership for one channel, and
cowork-channel-send fans out through the same delivery core as broadcast. The
MCP surface exposes the same behavior as mempal_cowork_bus
action=channel_set|channel_list|channel_send.
P90 still does not make channels durable memory. They are operational routing
state under ~/.mempal/cowork-bus/<project>/, and they do not write
palace.db.
Cowork Tmux Live Peek
P91 completes the tmux runtime-ops loop by adding explicit read-only pane
inspection for agents registered with transport=tmux and a concrete
tmux_target.
mempal cowork-tmux-peek \
--cwd "$PWD" \
--agent-id codex-a \
--lines 80The MCP surface is mempal_cowork_bus action=tmux_peek. Both CLI and MCP use
the same adapter: a direct std::process::Command invocation of the local
tmux binary with capture-pane. It is not executed through a shell, and it
does not discover panes automatically. The registered tmux_target is the
authority.
Peek is deliberately not delivery. It does not append events.jsonl, does not
write an inbox message, does not update channel or agent registry state, and
does not write palace.db. Capture failure is a hard error rather than a
fallback to inbox or legacy mempal_peek_partner.
This preserves the separation between:
agent live observation: read-only tmux pane capture
operational communication: inbox/tmux send through the cowork bus
durable memory: explicit ingest into the palace database
Multi-Agent Cowork Runbook
P92 makes the multi-agent runtime surfaces operationally usable by adding the authoritative COWORK-RUNBOOK plus a read-only CLI surface:
mempal cowork-runbook --format plain
mempal cowork-runbook --format jsonThe runbook describes concrete agent registration, direct send, broadcast,
channels, threads, drain, delivery status, ack, presence, tmux delivery, tmux
peek, doctor, sessions, handoff summaries, and explicit memory capture. Reading
the runbook does not touch ~/.mempal or palace.db.
Cowork Doctor
P93 adds deterministic runtime diagnostics:
mempal cowork-doctor --cwd "$PWD"
mempal cowork-doctor --cwd "$PWD" --probe-tmux --format jsonThe MCP equivalent is mempal_cowork_bus action=doctor. Doctor checks registry
size, channel count, session count, stale or never-seen agents, pending
deliveries, and optional tmux target reachability. tmux probing uses direct
tmux has-session -t <target> invocation, not a shell.
Doctor is read-only. It does not append events, drain inboxes, update heartbeats, repair state, or write memory.
Cowork Team Sessions
P94 adds runtime team sessions stored under:
~/.mempal/cowork-bus/<encoded_project_identity>/sessions.jsonSessions bind a collaboration goal to concrete agents, optional channels, and an optional thread id:
mempal cowork-session-create \
--cwd "$PWD" \
--session-id p94-review \
--title "P94 review" \
--agent claude-main \
--agent codex-a \
--thread-id p94-review
mempal cowork-sessions --cwd "$PWD"
mempal cowork-session-status --cwd "$PWD" --session-id p94-review --status pausedThe MCP actions are session_create, session_list, and session_status.
Session changes append operational events, but they do not become durable
project memory and they do not change message delivery semantics.
Cowork Handoff Summary
P95 adds deterministic handoff summaries:
mempal cowork-handoff --cwd "$PWD"
mempal cowork-handoff --cwd "$PWD" --thread-id p95-review --format jsonThe MCP action is mempal_cowork_bus action=handoff. A handoff summarizes
active sessions, agents and presence, pending deliveries, and recent events. It
supports thread_id, channel, session_id, and limit filters. It does not
call an LLM, drain inboxes, ack deliveries, or persist memory.
Cowork Memory Capture
P96 adds the explicit bridge from runtime cowork state to durable evidence:
mempal cowork-capture \
--cwd "$PWD" \
--summary-source handoff \
--session-id p95-review \
--execute \
--format jsonThe MCP action is mempal_cowork_bus action=capture. Capture defaults to
dry-run. With --execute / execute=true, it writes one evidence drawer under
wing cowork-capture by default. It does not capture raw tmux pane text, does
not promote knowledge, does not create knowledge cards, and does not alter
delivery status. This keeps runtime communication ephemeral unless an agent or
human explicitly crosses the memory boundary.
Maintenance Runbook
P97 adds the authoritative MAINTENANCE-RUNBOOK plus a read-only CLI:
mempal maintenance-runbook --format plain
mempal maintenance-runbook --format jsonThe runbook stitches together research validation, research evidence ingest, knowledge distill, card lifecycle gates, context adoption, runtime adoption review, rollback, cowork handoff, and explicit cowork capture. It is a checklist for dream-cycle style maintenance, not a daemon or scheduler.
Release Install Doctor
P98 adds a read-only operator diagnostic:
mempal doctor --format plain
mempal doctor --format jsonDoctor runs before normal database open/migration. It reports current binary
version, supported schema version, configured database path, direct SQLite
PRAGMA user_version, current executable path, the first mempal found on
PATH, warnings, and recommendations. This is specifically for the failure
mode where a long-lived MCP client or shell resolves an old binary against a
newer palace.db schema.
P99 exposes the same runtime diagnostic through MCP:
mempal_doctorThe MCP response adds required server tool/action expectations so an agent can
tell whether its connected server advertises mempal_context, mempal_brief,
mempal_phase3, and mempal_cowork_bus.
Guided Maintenance Run
P100 turns the static runbook into a deterministic dry-run command:
mempal maintenance guided-run --format plain
mempal maintenance guided-run --format jsonThe command is read-only (writes=false). It reports current drawer, knowledge
card, and runtime adoption event counts when a database exists, then emits an
ordered operator checklist for research validation, research evidence ingest,
knowledge distill, card lifecycle gate, context review, adoption review,
rollback review, cowork doctor, handoff, and explicit cowork capture. It never
executes the generated commands.
Session Close Capture
P101 closes the loop for concrete multi-agent sessions:
mempal cowork-session-close --cwd "$PWD" --session-id p101-review
mempal cowork-session-close --cwd "$PWD" --session-id p101-review --capture --execute --format jsonThe MCP equivalent is mempal_cowork_bus action=session_close. Closing a
session updates the runtime session status to closed and appends the existing
session-status event. It does not write durable memory unless capture is
explicitly requested and execute=true; dry-run capture returns the handoff
payload without creating palace.db.
MCP Cognitive Brief
P102 exposes the deterministic P83 brief to agent runtimes:
mempal_briefThe tool accepts query, field, domain, cwd, max_items, and dao_tian_limit. It returns the same citation-first shape as CLI brief: summary, key facts, evidence, cards, entities, unresolved items, uncertainty, and next actions. It does not call an LLM and does not write adoption evidence.
Adoption Analytics
P103 adds a compact analytics view over runtime adoption events:
mempal phase3 adoption analytics --format plain
mempal phase3 adoption analytics --format jsonMCP exposes the same report as mempal_phase3 action=analytics. Analytics is
read-only and groups events by track and feature, reporting used, accepted,
rejected, miss, rollback, contradiction, and neutral counts plus a
deterministic recommendation. This is the operator-facing bridge from raw
adoption evidence to default-change planning, without itself changing any
default or lifecycle state.
Release Readiness
P104 adds the release checklist:
mempal release-readiness --format plain
mempal release-readiness --format jsonThe checklist is read-only (writes=false) and checks Cargo package metadata,
README presence, P98-P104 spec/plan inventory, runbooks, doctor availability,
and current schema support. It recommends concrete verification commands such
as mempal doctor --format json, cargo test, cargo clippy -- -D warnings,
and cargo package, but it does not run them automatically.
Closing Summary
The proposed system is not "RAG plus skills."
It is a governed cognition stack:
external tools gather and organize evidence
memory stores both evidence and distilled knowledge
skills operationalize methods under governing principles
evaluators control what is allowed to harden into lasting law
That is the intended meaning of this design:
daois memory-level high-order knowledgeshuis operational methodqiis executable capabilityevidence is the substrate from which all of them must be justified
P106: Context Distill Signal (read-only detector)
mempal context / mempal_context carry a read-only distill_suggestions
field. When assembling context, a deterministic detector groups active drawers
by field and flags each field where active evidence count is at least 5
AND there are zero active promoted-or-canonical knowledge drawers. It
returns at most 3 suggestions, ordered by descending evidence count then
ascending field; each carries field, evidence_count, up to 3
sample_evidence_drawer_ids, and suggested_tier="dao_ren".
This is the "detector" layer of agent-driven mind-model construction: it makes
"this is worth distilling" a client-agnostic, pull-based signal that appears
where agents already look. It is purely observational — it performs no database
write, no LLM call, no auto-distill, and no auto-promotion. Acting on a
suggestion stays the agent's explicit mempal_knowledge_distill plus the
deterministic gate (governance per P77/P80 unchanged). The signal is on by
default (include_distill_suggestions, disable with
--no-distill-suggestions) and never alters the assembled tier sections.
453 files · 436 not served here
- .claude/hooks/user-prompt-submit.sh (not served here)
- .claude/settings.json
- .github/workflows/ci.yml (not served here)
- .github/workflows/pages.yml (not served here)
- .github/workflows/release.yml (not served here)
- .gitignore (not served here)
- .mcp.json
- AGENTS.md
- ATTRIBUTION.md
- AUTOGINEER-RUNS.md
- CHANGELOG.md
- CLAUDE.md
- Cargo.lock (not served here)
- Cargo.toml (not served here)
- LICENSE
- README.md
- README_zh.md
- benchmarks/longmemeval_s_summary.md (not served here)
- books/README.md (not served here)
- books/zh-CN/book.toml (not served here)
- books/zh-CN/mermaid-init.js (not served here)
- books/zh-CN/mermaid.min.js (not served here)
- books/zh-CN/plans/00-preface.plan.md (not served here)
- books/zh-CN/plans/01-problem.plan.md (not served here)
- books/zh-CN/plans/02-principles.plan.md (not served here)
- books/zh-CN/plans/03-architecture.plan.md (not served here)
- books/zh-CN/plans/04-storage-search.plan.md (not served here)
- books/zh-CN/plans/05-mind-model.plan.md (not served here)
- books/zh-CN/plans/06-knowledge-governance.plan.md (not served here)
- books/zh-CN/plans/07-runtime-context.plan.md (not served here)
- books/zh-CN/plans/08-cowork.plan.md (not served here)
- books/zh-CN/plans/09-self-evolution.plan.md (not served here)
- books/zh-CN/plans/10-ops-and-usage.plan.md (not served here)
- books/zh-CN/plans/99-appendix-commands.plan.md (not served here)
- books/zh-CN/specs/00-preface.spec.md (not served here)
- books/zh-CN/specs/01-problem.spec.md (not served here)
- books/zh-CN/specs/02-principles.spec.md (not served here)
- books/zh-CN/specs/03-architecture.spec.md (not served here)
- books/zh-CN/specs/04-storage-search.spec.md (not served here)
- books/zh-CN/specs/05-mind-model.spec.md (not served here)
- books/zh-CN/specs/06-knowledge-governance.spec.md (not served here)
- books/zh-CN/specs/07-runtime-context.spec.md (not served here)
- books/zh-CN/specs/08-cowork.spec.md (not served here)
- books/zh-CN/specs/09-self-evolution.spec.md (not served here)
- books/zh-CN/specs/10-ops-and-usage.spec.md (not served here)
- books/zh-CN/specs/99-appendix-commands.spec.md (not served here)
- books/zh-CN/src/SUMMARY.md (not served here)
- books/zh-CN/src/appendix-commands.md (not served here)
- books/zh-CN/src/ch01-problem.md (not served here)
- books/zh-CN/src/ch02-principles.md (not served here)
- books/zh-CN/src/ch03-architecture.md (not served here)
- books/zh-CN/src/ch04-storage-search.md (not served here)
- books/zh-CN/src/ch05-mind-model.md (not served here)
- books/zh-CN/src/ch06-knowledge-governance.md (not served here)
- books/zh-CN/src/ch07-runtime-context.md (not served here)
- books/zh-CN/src/ch08-cowork.md (not served here)
- books/zh-CN/src/ch09-self-evolution.md (not served here)
- books/zh-CN/src/ch10-ops-and-usage.md (not served here)
- books/zh-CN/src/preface.md (not served here)
- crates/mempal-agent-memory/Cargo.toml (not served here)
- crates/mempal-agent-memory/src/anchor.rs (not served here)
- crates/mempal-agent-memory/src/lib.rs (not served here)
- crates/mempal-agent-memory/src/types.rs (not served here)
- crates/mempal-embed/Cargo.toml (not served here)
- crates/mempal-embed/src/api.rs (not served here)
- crates/mempal-embed/src/lib.rs (not served here)
- crates/mempal-embed/src/model2vec.rs (not served here)
- crates/mempal-embed/src/onnx.rs (not served here)
- crates/mempal-mcp-protocol/Cargo.toml (not served here)
- crates/mempal-mcp-protocol/src/lib.rs (not served here)
- crates/mempal-mcp-server/Cargo.toml (not served here)
- crates/mempal-mcp-server/src/lib.rs (not served here)
- crates/mempal-mcp-server/src/server.rs (not served here)
- crates/mempal-mcp-server/src/tools.rs (not served here)
- crates/mempal-runtime/Cargo.toml (not served here)
- crates/mempal-runtime/src/aaak/codec.rs (not served here)
- crates/mempal-runtime/src/aaak/mod.rs (not served here)
- crates/mempal-runtime/src/aaak/model.rs (not served here)
- crates/mempal-runtime/src/aaak/parse.rs (not served here)
- crates/mempal-runtime/src/aaak/signals.rs (not served here)
- crates/mempal-runtime/src/aaak/spec.rs (not served here)
- crates/mempal-runtime/src/adoption_analytics.rs (not served here)
- crates/mempal-runtime/src/brief.rs (not served here)
- crates/mempal-runtime/src/context.rs (not served here)
- crates/mempal-runtime/src/core/config.rs (not served here)
- crates/mempal-runtime/src/core/mod.rs (not served here)
- crates/mempal-runtime/src/core/phase3.rs (not served here)
- crates/mempal-runtime/src/core/protocol.rs (not served here)
- crates/mempal-runtime/src/core/utils.rs (not served here)
- crates/mempal-runtime/src/cowork/bus.rs (not served here)
- crates/mempal-runtime/src/cowork/claude.rs (not served here)
- crates/mempal-runtime/src/cowork/codex.rs (not served here)
- crates/mempal-runtime/src/cowork/inbox.rs (not served here)
- crates/mempal-runtime/src/cowork/mod.rs (not served here)
- crates/mempal-runtime/src/cowork/peek.rs (not served here)
- crates/mempal-runtime/src/cowork/receipts.rs (not served here)
- crates/mempal-runtime/src/doctor.rs (not served here)
- crates/mempal-runtime/src/embed/mod.rs (not served here)
- crates/mempal-runtime/src/factcheck/contradictions.rs (not served here)
- crates/mempal-runtime/src/factcheck/mod.rs (not served here)
- crates/mempal-runtime/src/factcheck/names.rs (not served here)
- crates/mempal-runtime/src/factcheck/relations.rs (not served here)
- crates/mempal-runtime/src/field_taxonomy.rs (not served here)
- crates/mempal-runtime/src/ingest/chunk.rs (not served here)
- crates/mempal-runtime/src/ingest/detect.rs (not served here)
- crates/mempal-runtime/src/ingest/diary.rs (not served here)
- crates/mempal-runtime/src/ingest/lock.rs (not served here)
- crates/mempal-runtime/src/ingest/mod.rs (not served here)
- crates/mempal-runtime/src/ingest/noise.rs (not served here)
- crates/mempal-runtime/src/ingest/normalize.rs (not served here)
- crates/mempal-runtime/src/ingest/reindex.rs (not served here)
- crates/mempal-runtime/src/knowledge_anchor.rs (not served here)
- crates/mempal-runtime/src/knowledge_card_backfill.rs (not served here)
- crates/mempal-runtime/src/knowledge_card_lifecycle.rs (not served here)
- crates/mempal-runtime/src/knowledge_card_retrieval.rs (not served here)
- crates/mempal-runtime/src/knowledge_distill.rs (not served here)
- crates/mempal-runtime/src/knowledge_gate.rs (not served here)
- crates/mempal-runtime/src/knowledge_lifecycle.rs (not served here)
- crates/mempal-runtime/src/lib.rs (not served here)
- crates/mempal-runtime/src/longmemeval.rs (not served here)
- crates/mempal-runtime/src/path_filter.rs (not served here)
- crates/mempal-runtime/src/projects.rs (not served here)
- crates/mempal-runtime/src/search/filter.rs (not served here)
- crates/mempal-runtime/src/search/mod.rs (not served here)
- crates/mempal-runtime/src/search/rerank.rs (not served here)
- crates/mempal-runtime/src/search/route.rs (not served here)
- crates/mempal-search-core/Cargo.toml (not served here)
- crates/mempal-search-core/src/lib.rs (not served here)
- crates/mempal-store-sqlite/Cargo.toml (not served here)
- crates/mempal-store-sqlite/src/lib.rs (not served here)
- docs/COWORK-RUNBOOK.md
- docs/MAINTENANCE-RUNBOOK.md
- docs/MIND-MODEL-DESIGN.md
- docs/MIND-MODEL-IMPLEMENTATION-ARTICLE.md
- docs/MIND-MODEL-IMPLEMENTATION-ARTICLE.zh-CN.md
- docs/aaak-dialect.md
- docs/plans/2026-04-08-p0-implementation.md (not served here)
- docs/plans/2026-04-09-p1-p4-implementation.md (not served here)
- docs/plans/2026-04-11-p5-implementation.md (not served here)
- docs/plans/2026-04-13-p6-implementation.md (not served here)
- docs/plans/2026-04-13-p7-implementation.md (not served here)
- docs/plans/2026-04-15-p8-implementation.md (not served here)
- docs/plans/2026-04-17-p9-implementation.md (not served here)
- docs/plans/2026-04-21-p12-implementation.md (not served here)
- docs/plans/2026-04-23-p10-explicit-tunnels-implementation.md (not served here)
- docs/plans/2026-04-23-p10-normalize-version-implementation.md (not served here)
- docs/plans/2026-04-23-p11-transcript-noise-strip-implementation.md (not served here)
- docs/plans/2026-04-23-p13a-implementation.md (not served here)
- docs/plans/2026-04-23-p13b-implementation.md (not served here)
- docs/plans/2026-04-24-p11-chunk-neighbors-implementation.md (not served here)
- docs/plans/2026-04-24-p11-diary-daily-rollup-implementation.md (not served here)
- docs/plans/2026-04-24-p14-context-assembler-implementation.md (not served here)
- docs/plans/2026-04-24-p15-mcp-context-implementation.md (not served here)
- docs/plans/2026-04-24-p16-context-skill-guidance-implementation.md (not served here)
- docs/plans/2026-04-24-p17-knowledge-lifecycle-implementation.md (not served here)
- docs/plans/2026-04-24-p18-knowledge-distill-implementation.md (not served here)
- docs/plans/2026-04-24-p19-lifecycle-ref-validation-implementation.md (not served here)
- docs/plans/2026-04-25-p20-promotion-gate-policy-implementation.md (not served here)
- docs/plans/2026-04-25-p21-mcp-knowledge-gate-implementation.md (not served here)
- docs/plans/2026-04-25-p22-mcp-knowledge-distill-implementation.md (not served here)
- docs/plans/2026-04-26-p23-mcp-knowledge-lifecycle-implementation.md (not served here)
- docs/plans/2026-04-26-p24-anchor-publication-implementation.md (not served here)
- docs/plans/2026-04-26-p25-mcp-anchor-publication-implementation.md (not served here)
- docs/plans/2026-04-26-p26-dao-tian-runtime-budget-implementation.md (not served here)
- docs/plans/2026-04-26-p27-knowledge-policy-surface-implementation.md (not served here)
- docs/plans/2026-04-26-p28-field-taxonomy-surface-implementation.md (not served here)
- docs/plans/2026-04-26-p29-wake-up-context-boundary-implementation.md (not served here)
- docs/plans/2026-04-27-p30-knowledge-card-storage-boundary-implementation.md (not served here)
- docs/plans/2026-04-27-p31-knowledge-card-schema-spec.md (not served here)
- docs/plans/2026-04-27-p32-knowledge-card-schema-v8-implementation.md (not served here)
- docs/plans/2026-04-27-p33-knowledge-card-core-api-implementation.md (not served here)
- docs/plans/2026-04-27-p34-knowledge-card-cli-implementation.md (not served here)
- docs/plans/2026-04-27-p35-knowledge-card-mcp-read-implementation.md (not served here)
- docs/plans/2026-04-27-p36-knowledge-card-backfill-report-implementation.md (not served here)
- docs/plans/2026-04-27-p37-knowledge-card-backfill-apply-implementation.md (not served here)
- docs/plans/2026-04-27-p38-p42-knowledge-card-runtime-implementation.md (not served here)
- docs/plans/2026-04-28-p43-knowledge-card-retrieval-contract.md (not served here)
- docs/plans/2026-04-28-p44-card-context-assembler.md (not served here)
- docs/plans/2026-04-28-p45-card-linked-evidence-retrieval.md (not served here)
- docs/plans/2026-04-28-p46-card-context-default-policy.md (not served here)
- docs/plans/2026-04-28-p47-card-embedding-policy.md (not served here)
- docs/plans/2026-04-29-p48-card-audit-policy.md (not served here)
- docs/plans/2026-04-29-p49-research-ingestion-policy.md (not served here)
- docs/plans/2026-04-29-p50-evaluator-promotion-policy.md (not served here)
- docs/plans/2026-04-29-p51-mind-model-closure-audit.md (not served here)
- docs/plans/2026-05-01-p52-phase-3-intake-roadmap.md (not served here)
- docs/plans/2026-05-02-p53-phase-3-candidate-evidence-audit.md (not served here)
- docs/plans/2026-05-02-p54-runtime-adoption-evidence.md (not served here)
- docs/plans/2026-05-02-p55-runtime-adoption-cli.md (not served here)
- docs/plans/2026-05-02-p56-card-context-default-gate.md (not served here)
- docs/plans/2026-05-02-p57-card-embedding-evidence-gate.md (not served here)
- docs/plans/2026-05-02-p58-evaluator-api-evidence-gate.md (not served here)
- docs/plans/2026-05-02-p59-research-adapter-ingestion-contract.md (not served here)
- docs/plans/2026-05-05-p60-mcp-phase3-runtime-surface.md (not served here)
- docs/plans/2026-05-10-p61-runtime-adoption-recording-protocol.md (not served here)
- docs/plans/2026-05-12-p62-runtime-adoption-cli-guidance.md (not served here)
- docs/plans/2026-05-12-p63-runtime-adoption-record-helper.md (not served here)
- docs/plans/2026-05-13-p64-runtime-adoption-record-quality-policy.md (not served here)
- docs/plans/2026-05-13-p65-runtime-adoption-review-report.md (not served here)
- docs/plans/2026-05-13-p66-card-context-default-readiness.md (not served here)
- docs/plans/2026-05-13-p67-research-adapter-ingest.md (not served here)
- docs/plans/2026-05-13-p68-mcp-research-ingest-plan.md (not served here)
- docs/plans/2026-05-13-p69-runtime-adoption-checked-record.md (not served here)
- docs/plans/2026-05-13-p70-self-evolution-completion-audit.md (not served here)
- docs/plans/2026-05-13-p71-self-evolution-loop-replay.md (not served here)
- docs/plans/2026-05-13-p72-runtime-adoption-capture-helper.md (not served here)
- docs/plans/2026-05-13-p73-evaluator-advisory-api.md (not served here)
- docs/plans/2026-05-13-p74-card-context-default-proposal.md (not served here)
- docs/plans/2026-05-13-p75-self-evolution-completion-audit.md (not served here)
- docs/plans/2026-05-13-p76-spec-completeness-invariant.md (not served here)
- docs/plans/2026-05-13-p77-live-adoption-instrumentation-boundary.md (not served here)
- docs/plans/2026-05-13-p78-card-context-default-runtime-flag.md (not served here)
- docs/plans/2026-05-13-p79-rollback-executor-policy.md (not served here)
- docs/plans/2026-05-13-p80-autonomous-promotion-boundary-audit.md (not served here)
- docs/plans/2026-05-13-p81-self-evolution-completion-audit.md (not served here)
- docs/plans/2026-05-25-p82-opt-in-runtime-instrumentation-wrapper.md (not served here)
- docs/plans/2026-05-25-p83-cognitive-brief.md (not served here)
- docs/plans/2026-05-25-p84-multi-agent-cowork-bus.md (not served here)
- docs/plans/2026-05-25-p85-mcp-multi-agent-cowork-bus.md (not served here)
- docs/plans/2026-05-25-p86-tmux-cowork-transport.md (not served here)
- docs/plans/2026-05-25-p87-cowork-bus-event-log.md (not served here)
- docs/plans/2026-05-25-p88-cowork-delivery-ack-status.md (not served here)
- docs/plans/2026-05-25-p89-cowork-agent-presence.md (not served here)
- docs/plans/2026-05-25-p90-cowork-threads-channels.md (not served here)
- docs/plans/2026-05-25-p91-tmux-live-peek.md (not served here)
- docs/plans/2026-05-26-p100-guided-maintenance-run.md (not served here)
- docs/plans/2026-05-26-p101-cowork-session-close-capture.md (not served here)
- docs/plans/2026-05-26-p102-mcp-cognitive-brief.md (not served here)
- docs/plans/2026-05-26-p103-adoption-analytics.md (not served here)
- docs/plans/2026-05-26-p104-release-readiness-checklist.md (not served here)
- docs/plans/2026-05-26-p92-multi-agent-runbook.md (not served here)
- docs/plans/2026-05-26-p93-cowork-doctor.md (not served here)
- docs/plans/2026-05-26-p94-cowork-team-session.md (not served here)
- docs/plans/2026-05-26-p95-cowork-handoff-summary.md (not served here)
- docs/plans/2026-05-26-p96-cowork-memory-capture.md (not served here)
- docs/plans/2026-05-26-p97-maintenance-runbook.md (not served here)
- docs/plans/2026-05-26-p98-release-install-doctor.md (not served here)
- docs/plans/2026-05-26-p99-mcp-runtime-doctor.md (not served here)
- docs/plans/2026-05-28-p105-mempal-book-zh-cn.md (not served here)
- docs/plans/2026-06-04-p106-context-distill-signal.md (not served here)
- docs/plans/2026-06-09-p107-ingest-entrypoint-discoverability.md (not served here)
- docs/plans/2026-06-17-p108-peek-cwd-cross-project.md (not served here)
- docs/plans/2026-06-22-p109-cross-project-resume.md (not served here)
- docs/plans/2026-07-02-p110-public-issue-compatibility.md (not served here)
- docs/plans/2026-07-06-p111-project-ignore-rules.md (not served here)
- docs/plans/2026-07-07-p112-session-peek.md (not served here)
- docs/plans/2026-07-08-p113-public-workspace-crates.md (not served here)
- docs/plans/2026-07-09-p114-coarse-workspace-split.md (not served here)
- docs/plans/2026-07-26-p115-codex-preamble-noise-strip.md (not served here)
- docs/plans/2026-07-26-p116-cowork-pair-delivery-receipts.md (not served here)
- docs/plans/2026-08-18-p117-reindex-atomic-replace.md (not served here)
- docs/site/en/index.html (not served here)
- docs/site/index.html (not served here)
- docs/site/ja/index.html (not served here)
- docs/specs/2026-04-08-mempal-design.md (not served here)
- docs/specs/2026-04-13-cowork-peek-and-decide.md (not served here)
- docs/specs/2026-04-13-p7-search-structured-signals.md (not served here)
- docs/specs/2026-04-14-p8-cowork-inbox-push.md (not served here)
- docs/usage.md
- hooks/mempal_precompact_hook.sh (not served here)
- hooks/mempal_save_hook.sh (not served here)
- specs/p0-core-scaffold.spec.md (not served here)
- specs/p0-embed-trait.spec.md (not served here)
- specs/p0-ingest.spec.md (not served here)
- specs/p0-search-cli.spec.md (not served here)
- specs/p1-routing-citation.spec.md (not served here)
- specs/p10-explicit-tunnels.spec.md (not served here)
- specs/p10-normalize-version.spec.md (not served here)
- specs/p100-guided-maintenance-run.spec.md (not served here)
- specs/p101-cowork-session-close-capture.spec.md (not served here)
- specs/p102-mcp-cognitive-brief.spec.md (not served here)
- specs/p103-adoption-analytics.spec.md (not served here)
- specs/p104-release-readiness-checklist.spec.md (not served here)
- specs/p105-mempal-book-zh-cn.spec.md (not served here)
- specs/p106-context-distill-signal.spec.md (not served here)
- specs/p107-ingest-entrypoint-discoverability.spec.md (not served here)
- specs/p108-peek-cwd-cross-project.spec.md (not served here)
- specs/p109-cross-project-resume.spec.md (not served here)
- specs/p11-chunk-neighbors.spec.md (not served here)
- specs/p11-diary-daily-rollup.spec.md (not served here)
- specs/p11-transcript-noise-strip.spec.md (not served here)
- specs/p110-public-issue-compatibility.spec.md (not served here)
- specs/p111-project-ignore-rules.spec.md (not served here)
- specs/p112-session-peek.spec.md (not served here)
- specs/p113-public-workspace-crates.spec.md (not served here)
- specs/p114-coarse-workspace-split.spec.md (not served here)
- specs/p115-codex-preamble-noise-strip.spec.md (not served here)
- specs/p116-cowork-pair-delivery-receipts.spec.md (not served here)
- specs/p117-reindex-atomic-replace.spec.md (not served here)
- specs/p12-mind-model-bootstrap.spec.md (not served here)
- specs/p13-ingest-identity.spec.md (not served here)
- specs/p13-wake-up-statement.spec.md (not served here)
- specs/p14-context-assembler.spec.md (not served here)
- specs/p15-mcp-context.spec.md (not served here)
- specs/p16-context-skill-guidance.spec.md (not served here)
- specs/p17-knowledge-lifecycle.spec.md (not served here)
- specs/p18-knowledge-distill.spec.md (not served here)
- specs/p19-lifecycle-ref-validation.spec.md (not served here)
- specs/p2-mcp.spec.md (not served here)
- specs/p20-promotion-gate-policy.spec.md (not served here)
- specs/p21-mcp-knowledge-gate.spec.md (not served here)
- specs/p22-mcp-knowledge-distill.spec.md (not served here)
- specs/p23-mcp-knowledge-lifecycle.spec.md (not served here)
- specs/p24-anchor-publication.spec.md (not served here)
- specs/p25-mcp-anchor-publication.spec.md (not served here)
- specs/p26-dao-tian-runtime-budget.spec.md (not served here)
- specs/p27-knowledge-policy-surface.spec.md (not served here)
- specs/p28-field-taxonomy-surface.spec.md (not served here)
- specs/p29-wake-up-context-boundary.spec.md (not served here)
- specs/p3-aaak.spec.md (not served here)
- specs/p30-knowledge-card-storage-boundary.spec.md (not served here)
- specs/p31-knowledge-card-schema.spec.md (not served here)
- specs/p32-knowledge-card-schema-v8.spec.md (not served here)
- specs/p33-knowledge-card-core-api.spec.md (not served here)
- specs/p34-knowledge-card-cli.spec.md (not served here)
- specs/p35-knowledge-card-mcp-read.spec.md (not served here)
- specs/p36-knowledge-card-backfill-report.spec.md (not served here)
- specs/p37-knowledge-card-backfill-apply.spec.md (not served here)
- specs/p38-knowledge-card-gate.spec.md (not served here)
- specs/p39-knowledge-card-lifecycle-cli.spec.md (not served here)
- specs/p4-rest-api.spec.md (not served here)
- specs/p40-mcp-knowledge-card-lifecycle.spec.md (not served here)
- specs/p41-knowledge-card-runtime-boundary.spec.md (not served here)
- specs/p42-mind-model-completion-audit.spec.md (not served here)
- specs/p43-knowledge-card-retrieval-contract.spec.md (not served here)
- specs/p44-card-context-assembler.spec.md (not served here)
- specs/p45-card-linked-evidence-retrieval.spec.md (not served here)
- specs/p46-card-context-default-policy.spec.md (not served here)
- specs/p47-card-embedding-policy.spec.md (not served here)
- specs/p48-card-audit-policy.spec.md (not served here)
- specs/p49-research-ingestion-policy.spec.md (not served here)
- specs/p5-agent-diary.spec.md (not served here)
- specs/p5-format-support.spec.md (not served here)
- specs/p5-kg-timeline-stats.spec.md (not served here)
- specs/p5-semantic-dedup.spec.md (not served here)
- specs/p5-wake-up-importance.spec.md (not served here)
- specs/p50-evaluator-promotion-policy.spec.md (not served here)
- specs/p51-mind-model-closure-audit.spec.md (not served here)
- specs/p52-phase-3-intake-roadmap.spec.md (not served here)
- specs/p53-phase-3-candidate-evidence-audit.spec.md (not served here)
- specs/p54-runtime-adoption-evidence.spec.md (not served here)
- specs/p55-runtime-adoption-cli.spec.md (not served here)
- specs/p56-card-context-default-gate.spec.md (not served here)
- specs/p57-card-embedding-evidence-gate.spec.md (not served here)
- specs/p58-evaluator-api-evidence-gate.spec.md (not served here)
- specs/p59-research-adapter-ingestion-contract.spec.md (not served here)
- specs/p6-cowork-peek-and-decide.spec.md (not served here)
- specs/p60-mcp-phase3-runtime-surface.spec.md (not served here)
- specs/p61-runtime-adoption-recording-protocol.spec.md (not served here)
- specs/p62-runtime-adoption-cli-guidance.spec.md (not served here)
- specs/p63-runtime-adoption-record-helper.spec.md (not served here)
- specs/p64-runtime-adoption-record-quality-policy.spec.md (not served here)
- specs/p65-runtime-adoption-review-report.spec.md (not served here)
- specs/p66-card-context-default-readiness.spec.md (not served here)
- specs/p67-research-adapter-ingest.spec.md (not served here)
- specs/p68-mcp-research-ingest-plan.spec.md (not served here)
- specs/p69-runtime-adoption-checked-record.spec.md (not served here)
- specs/p7-search-structured-signals.spec.md (not served here)
- specs/p70-self-evolution-completion-audit.spec.md (not served here)
- specs/p71-self-evolution-loop-replay.spec.md (not served here)
- specs/p72-runtime-adoption-capture-helper.spec.md (not served here)
- specs/p73-evaluator-advisory-api.spec.md (not served here)
- specs/p74-card-context-default-proposal.spec.md (not served here)
- specs/p75-self-evolution-completion-audit.spec.md (not served here)
- specs/p76-spec-completeness-invariant.spec.md (not served here)
- specs/p77-live-adoption-instrumentation-boundary.spec.md (not served here)
- specs/p78-card-context-default-runtime-flag.spec.md (not served here)
- specs/p79-rollback-executor-policy.spec.md (not served here)
- specs/p8-cowork-inbox-push.spec.md (not served here)
- specs/p80-autonomous-promotion-boundary-audit.spec.md (not served here)
- specs/p81-self-evolution-completion-audit.spec.md (not served here)
- specs/p82-opt-in-runtime-instrumentation-wrapper.spec.md (not served here)
- specs/p83-cognitive-brief.spec.md (not served here)
- specs/p84-multi-agent-cowork-bus.spec.md (not served here)
- specs/p85-mcp-multi-agent-cowork-bus.spec.md (not served here)
- specs/p86-tmux-cowork-transport.spec.md (not served here)
- specs/p87-cowork-bus-event-log.spec.md (not served here)
- specs/p88-cowork-delivery-ack-status.spec.md (not served here)
- specs/p89-cowork-agent-presence.spec.md (not served here)
- specs/p9-fact-checker.spec.md (not served here)
- specs/p9-ingest-lock.spec.md (not served here)
- specs/p90-cowork-threads-channels.spec.md (not served here)
- specs/p91-tmux-live-peek.spec.md (not served here)
- specs/p92-multi-agent-runbook.spec.md (not served here)
- specs/p93-cowork-doctor.spec.md (not served here)
- specs/p94-cowork-team-session.spec.md (not served here)
- specs/p95-cowork-handoff-summary.spec.md (not served here)
- specs/p96-cowork-memory-capture.spec.md (not served here)
- specs/p97-maintenance-runbook.spec.md (not served here)
- specs/p98-release-install-doctor.spec.md (not served here)
- specs/p99-mcp-runtime-doctor.spec.md (not served here)
- specs/project.spec.md (not served here)
- src/aaak/mod.rs (not served here)
- src/adoption_analytics.rs (not served here)
- src/api/handlers.rs (not served here)
- src/api/mod.rs (not served here)
- src/api/state.rs (not served here)
- src/brief.rs (not served here)
- src/context.rs (not served here)
- src/core/db.rs (not served here)
- src/core/mod.rs (not served here)
- src/core/protocol.rs (not served here)
- src/cowork/mod.rs (not served here)
- src/doctor.rs (not served here)
- src/embed/mod.rs (not served here)
- src/factcheck/mod.rs (not served here)
- src/field_taxonomy.rs (not served here)
- src/ingest/mod.rs (not served here)
- src/knowledge_anchor.rs (not served here)
- src/knowledge_card_backfill.rs (not served here)
- src/knowledge_card_lifecycle.rs (not served here)
- src/knowledge_card_retrieval.rs (not served here)
- src/knowledge_distill.rs (not served here)
- src/knowledge_gate.rs (not served here)
- src/knowledge_lifecycle.rs (not served here)
- src/lib.rs (not served here)
- src/longmemeval.rs (not served here)
- src/main.rs (not served here)
- src/mcp/mod.rs (not served here)
- src/path_filter.rs (not served here)
- src/projects.rs (not served here)
- src/search/mod.rs (not served here)
- tests/cognitive_brief.rs (not served here)
- tests/context_assembler.rs (not served here)
- tests/cowork_bus.rs (not served here)
- tests/cowork_inbox.rs (not served here)
- tests/cowork_peek.rs (not served here)
- tests/cowork_receipts.rs (not served here)
- tests/diary_rollup.rs (not served here)
- tests/fact_check.rs (not served here)
- tests/fixtures/cowork/claude/session.jsonl (not served here)
- tests/fixtures/cowork/claude/session_with_tools.jsonl (not served here)
- tests/fixtures/cowork/claude_since/session.jsonl (not served here)
- tests/fixtures/cowork/codex/2026/04/12/rollout-2026-04-12T12-00-00-otherproject.jsonl (not served here)
- tests/fixtures/cowork/codex/2026/04/13/rollout-2026-04-13T12-00-00-fake.jsonl (not served here)
- tests/ingest_lock.rs (not served here)
- tests/knowledge_card_backfill.rs (not served here)
- tests/knowledge_card_cli.rs (not served here)
- tests/knowledge_card_core.rs (not served here)
- tests/knowledge_card_retrieval.rs (not served here)
- tests/knowledge_card_schema.rs (not served here)
- tests/knowledge_lifecycle.rs (not served here)
- tests/mind_model_bootstrap.rs (not served here)
- tests/noise_strip.rs (not served here)
- tests/normalize_version.rs (not served here)
- tests/ops_runtime.rs (not served here)
- tests/phase3_runtime.rs (not served here)
- tests/phase3_self_evolution_replay.rs (not served here)
- tests/projects_resume.rs (not served here)
- tests/reindex_safety.rs (not served here)
- tests/search_neighbors.rs (not served here)
- tests/tunnels_explicit.rs (not served here)
- tests/workspace_crates.rs (not served here)
Advantages
- Hybrid search combines BM25 and vector semantic search for improved retrieval. evidence: README.md
- Self-describing protocol allows agents to learn interaction rules automatically. evidence: README.md
- Per-source advisory locking prevents race conditions during concurrent agent ingestion. evidence: README.md
Limitations
- Codex integration requires a specific feature flag to be enabled. evidence: README.md
- Bidirectional cowork push is restricted to identified Claude and Codex agents. evidence: README.md
- Advisory locking for concurrent ingest is currently limited to Unix systems. evidence: README.md
Security
Risk level: Low risk
This brain runs
Hooks (2)
.claude/settings.json(PostToolUse):if echo "$TOOL_INPUT" | grep -q 'git commit'; then echo 'MEMPAL REMINDER: You just committed code. Call mempal_ingest to save the decision context (what was built, why, what was considered). Rule 4: SAVE AFTER DECISIONS.'; fi.claude/settings.json(UserPromptSubmit):bash .claude/hooks/user-prompt-submit.sh
MCP servers (1)
.mcp.json(mempal):mempal serve --mcp
Agent instructions that run or fetch something (22)
AGENTS.md:Rust 实现的 coding agent 项目记忆工具。单二进制,`cargo install mempal`,10 秒内带出处找回历史决策。AGENTS.md:| Spec | 状态 | 范围 | |------|------|------| | `specs/p0-core-scaffold.spec.md` | 完成 | workspace 骨架 + SQLite schema | | `specs/p0-embed-trait.spec.md` | 完成 | Embedder trait(model2vec 默认 + ort 可选) | | `specs/p0-ingest.spec.md` | 完成 | 导入管道(格式检测/归一化/分块/存储) | | `specs/p0-search-cli.spec.md` …[+7715 chars]AGENTS.md:`docs/plans/2026-05-26-p98-release-install-doctor.md` — P98 release install doctor(已完成)AGENTS.md:`docs/plans/2026-05-26-p100-guided-maintenance-run.md` — P100 guided maintenance run(已完成)AGENTS.md:`docs/plans/2026-08-18-p117-reindex-atomic-replace.md` — P117 atomic reindex replace + dry-run feasibility report(已完成)AGENTS.md:| 工具 | 作用 | |------|------| | `mempal_status` | 状态 + 协议 + AAAK spec | | `mempal_doctor` | release/install + MCP runtime diagnostics:报告 binary/PATH/schema 兼容性和 required MCP tool/action 能力清单(P99) | | `mempal_search` | 混合检索(BM25 + 向量 + RRF + tunnel hints)+ AAAK 结构化 signals(P7) | | `mempa …[+2688 chars]AGENTS.md:Cargo workspace,root package 仍是 `mempal`,并继续提供 `cargo install mempal` 的 CLI binary。P113/P114 已把可复用边界拆成公开 workspace crates;root crate 现在主要负责 CLI、REST entrypoint、package metadata 和 legacy facade paths。AGENTS.md:**`mempal cowork-install-hooks` 写两件 Claude 侧制品**:`.claude/hooks/user-prompt-submit.sh`(脚本)+ `.claude/settings.json` 下的 `hooks.UserPromptSubmit` 条目(注册)。Claude Code 不按文件名约定自动发现脚本,两件**都必须有**hook 才会 fire。`install-hooks` 已自动处理 + 自愈 stale 条目;请勿手工移除其中任一。AGENTS.md:**Codex 侧依赖 `codex_hooks` feature flag**:shipped `codex-cli ≤ 0.120.0` 该 flag 处于 "under development" 且默认 `false`,此时 Codex runtime 完全忽略 `~/.codex/hooks.json`。`install-hooks` 检测到会打印 warning + 激活命令 `codex features enable codex_hooks`。AGENTS.md:**Codex TUI 进程启动时一次性缓存 config**:改完 `config.toml` 或 `hooks.json`(含 feature flag / install-hooks)后,必须完全退出并重启 Codex TUI;已在跑的进程拿不到新配置。AGENTS.md:**Claude Code 的 MCP server 是 session startup spawn**:`cargo install` 升级 mempal binary 后,Claude Code 还在用旧 MCP server 进程,**不认识新加的工具**(如 `mempal_cowork_push`)。升级后重启 Claude Code,MCP server 会 respawn 到新 binary。CLAUDE.md:Rust 实现的 coding agent 项目记忆工具。单二进制,`cargo install mempal`,10 秒内带出处找回历史决策。CLAUDE.md:| Spec | 状态 | 范围 | |------|------|------| | `specs/p0-core-scaffold.spec.md` | 完成 | workspace 骨架 + SQLite schema | | `specs/p0-embed-trait.spec.md` | 完成 | Embedder trait(model2vec 默认 + ort 可选) | | `specs/p0-ingest.spec.md` | 完成 | 导入管道(格式检测/归一化/分块/存储) | | `specs/p0-search-cli.spec.md` …[+7715 chars]CLAUDE.md:`docs/plans/2026-05-26-p98-release-install-doctor.md` — P98 release install doctor(已完成)CLAUDE.md:`docs/plans/2026-05-26-p100-guided-maintenance-run.md` — P100 guided maintenance run(已完成)CLAUDE.md:`docs/plans/2026-08-18-p117-reindex-atomic-replace.md` — P117 atomic reindex replace + dry-run feasibility report(已完成)CLAUDE.md:| 工具 | 作用 | |------|------| | `mempal_status` | 状态 + 协议 + AAAK spec | | `mempal_doctor` | release/install + MCP runtime diagnostics:报告 binary/PATH/schema 兼容性和 required MCP tool/action 能力清单(P99) | | `mempal_search` | 混合检索(BM25 + 向量 + RRF + tunnel hints)+ AAAK 结构化 signals(P7) | | `mempa …[+2688 chars]CLAUDE.md:Cargo workspace,root package 仍是 `mempal`,并继续提供 `cargo install mempal` 的 CLI binary。P113/P114 已把可复用边界拆成公开 workspace crates;root crate 现在主要负责 CLI、REST entrypoint、package metadata 和 legacy facade paths。CLAUDE.md:**`mempal cowork-install-hooks` 写两件 Claude 侧制品**:`.claude/hooks/user-prompt-submit.sh`(脚本)+ `.claude/settings.json` 下的 `hooks.UserPromptSubmit` 条目(注册)。Claude Code 不按文件名约定自动发现脚本,两件**都必须有**hook 才会 fire。`install-hooks` 已自动处理 + 自愈 stale 条目;请勿手工移除其中任一。CLAUDE.md:**Codex 侧依赖 `codex_hooks` feature flag**:shipped `codex-cli ≤ 0.120.0` 该 flag 处于 "under development" 且默认 `false`,此时 Codex runtime 完全忽略 `~/.codex/hooks.json`。`install-hooks` 检测到会打印 warning + 激活命令 `codex features enable codex_hooks`。CLAUDE.md:**Codex TUI 进程启动时一次性缓存 config**:改完 `config.toml` 或 `hooks.json`(含 feature flag / install-hooks)后,必须完全退出并重启 Codex TUI;已在跑的进程拿不到新配置。CLAUDE.md:**Claude Code 的 MCP server 是 session startup spawn**:`cargo install` 升级 mempal binary 后,Claude Code 还在用旧 MCP server 进程,**不认识新加的工具**(如 `mempal_cowork_push`)。升级后重启 Claude Code,MCP server 会 respawn 到新 binary。
- Low risk: scripts-present (.claude/hooks/user-prompt-submit.sh)
Attribution and licence
- First committed by
ZhangHanDong
- Publisher
- Alex (Community)
- Source
- ZhangHanDong/mempal · commit 9ed705d
- Licence
- MIT License (files served here)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Contributors
- ZhangHanDong, LiuZiqi-dual, TigerInYourDream, jolestar, ryushione
AutoGineer is not affiliated with or endorsed by ZhangHanDong.
Install from source
436 of its files are not served here, so there is no ZIP. ZhangHanDong/mempal at 9ed705d