一键导入
memory-layer
Standalone persistent memory for Pi — smart search, symbol clustering, dedup, auto-recovery, trust scoring. Zero Python dependency.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Standalone persistent memory for Pi — smart search, symbol clustering, dedup, auto-recovery, trust scoring. Zero Python dependency.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | memory-layer |
| description | Standalone persistent memory for Pi — smart search, symbol clustering, dedup, auto-recovery, trust scoring. Zero Python dependency. |
Persistent memory via a single SQLite database (~/.pi/memory/memory.db).
All operations through memory-store.js — zero Python dependency, zero MCP servers.
Code parsing uses web-tree-sitter (WASM) in-process.
Code analysis (imports, call graph, complexity, dead code, churn) and doc indexing (markdown sections, links, glossary, code examples) built in — no external tools needed.
Optional HTTP server for programmatic access to the Aurex domain (missions, milestones, working units) and code analysis endpoints.
session-start --project NAME → auto-recovers incomplete sessions, returns { sessionId, recoveredSession }session-end --id INT --memories INT [--auto] → trust-recovery + closepi install git:github.com/GeneGulanesJr/LaPispi update --extensions or pi update --extension git:github.com/GeneGulanesJr/LaPissave --title TEXT --content TEXT [--type TYPE] [--project NAME] [--scope project|personal] [--topic-key KEY] [--session-id ID] [--force]
observation_relations).potential_duplicate warning, lists matching IDs.--force to bypass dedup entirely.update --id INT [--title TEXT] [--content TEXT] [--type TYPE] [--scope SCOPE] [--topic-key KEY]
delete --id INT
search --query TEXT [--project NAME] [--type TYPE] [--scope SCOPE] [--limit N] [--session-id ID]
--session-id is provided._score for transparency.--include-code flag returns both memories AND indexed code symbols.get --id ID — Read full memory details. In the Pi tool, memory-get rejects project-scoped memories from another project unless allow_cross_project=true is set, to avoid accidentally pulling stale or unrelated context.context --project NAME [--limit N] [--session-id ID] [--topic-key KEY] [--query TEXT] [--deep true]
skill type from project context.index-repo --path ABS_PATH [--name NAME] — Index a local folder with tree-sitter.reindex-repo --repo NAME [--mode full|incremental] — Incremental reindex via mtime.search-code --query TEXT [--repo NAME] [--kind TYPE] [--max-results N] — FTS5 BM25 over code symbols.ranked-code-context --query TEXT [--repo NAME] [--token-budget N] [--max-results N] — Token-budgeted ranked code context for injection.get-code-source --repo NAME --file PATH --name SYMBOL — Byte-accurate source retrieval.list-code-repos / remove-code-repo --repo NAME — Manage indexed repos.Fast-path guidance: For exact current-code questions, use one locator step, then a targeted read. If you already know the symbol name, exact grep/rg is acceptable when it is clearly cheaper than semantic search. If using memory-code, include --repo when known. After a locator identifies the file, do not run another broad search; call outline --repo NAME --file F only if structure is needed, then use read with offset/limit.
Supported: JavaScript, TypeScript, TSX, Go, Python, Rust, SQL. Uses web-tree-sitter (WASM) — zero Python dependency.
Grammar .wasm files bundled in grammars/.
import-graph --repo NAME [--file F] [--direction imports|importers|both] [--depth N] — Import dependency graph with recursive traversalcall-hierarchy --symbol S --repo NAME [--direction callers|callees] [--depth N] — Call graph hierarchyblast-radius --symbol S --repo NAME [--depth N] — What breaks if a symbol changesdead-code --repo NAME [--min-confidence 0.5] [--include-tests true] — Find unused codecomplexity --repo NAME [--symbol S] — Cyclomatic complexity per functionoutline --repo NAME --file F — File symbol outline (classes, methods, standalone)churn --repo NAME [--file F] [--days 90] [--refresh true] — Git commit frequency metricshotspots --repo NAME [--top N] [--days N] — Top N symbols by complexity × churn (bug risk)cycles --repo NAME — Dependency cycles via Tarjan SCC on import graphimportance --repo NAME [--top N] [--scope DIR] — Symbol PageRank on call graphcoupling --repo NAME [--file F] [--sort-by instability|afferent|efferent] — Afferent/efferent/instability per fileextractable --repo NAME [--min-complexity N] [--min-callers N] [--top N] — Refactoring candidates (complex functions called from many files)hierarchy --repo NAME --symbol S [--direction both|ancestors|descendants] — Class hierarchy from parent_namesignal-chains --repo NAME [--kind http|cli] [--symbol S] [--max-depth N] — Detect HTTP/CLI gateways and trace call chainslayer-violations --repo NAME [--rules JSON] — Check import rules against declared architecture layerswinnow --repo NAME — Filter analysis results by confidence/typeast-patterns --repo NAME — AST-based code smell and pattern detectionprovenance --repo NAME — Git blame-based provenance for symbolsuntested --repo NAME — Find symbols without test coveragepr-risk --repo NAME — Assess risk of changes for PR reviewcoding-context --repo NAME [--symbol S | --file F] — Unified before-edit context for coding tasks. Ambiguous symbols are auto-disambiguated (prefers function/method/class kinds, uses file hint when both --symbol and --file are provided).Note: Layer rules can be defined inline via --rules or in a .pimemory-layers.jsonc file at the repo root.
Signal chains detect Express routes (app.get/post/...), router patterns, and CLI commands.
AST call resolution (v5.3) uses tree-sitter call_expression nodes instead of regex for JS/TS.
Note: Churn metrics require git CLI. All other analysis works on any indexed repo.
Complexity does NOT count ?. optional chaining as a decision point.
Dead code confidence: 0.33 per signal (no callers, unreachable file), 1.0 = provably unreachable.
index-docs --path P --name NAME [--ignore GLOB] — Index a markdown doc treereindex-docs --repo NAME [--mode full] [--ignore GLOB] — Re-index a doc repodoc-search --query Q --repo NAME [--level N] [--role TYPE] — Full-text search across doc sectionsdoc-outline --repo NAME [--file F] — Section hierarchy outlinebacklinks --repo NAME --path F — Find all docs that link TO a given docbroken-links --repo NAME — Find broken internal doc linksglossary --repo NAME [--term T] — Look up glossary terms (**Term** — definition pattern)tutorial-path --section INT --repo NAME — Reconstruct ordered tutorial chaincode-examples --query Q --repo NAME [--lang X] — Search fenced code blocks by contentdoc-orphans --repo NAME [--include-same-doc] — Find sections with zero inbound linksdoc-coverage --repo NAME [--doc-repo DOC_REPO] — Which code symbols have documentation coveragestale-pages --repo NAME — Find docs modified since last index (mtime comparison)doc-duplicates --repo NAME — Find duplicate sections by content hashHashtag extraction: (?<!#)#(\w{2,}) with negative lookbehind (excludes ATX headings).
Heading slugs: lowercase → strip non-alphanumeric → replace spaces with hyphens (GitHub-compatible).
Role classification: tutorial, api, how_to, concept, troubleshooting, changelog, faq, example, other.
list-workspaces — All workspaces with counts and archive status.create-workspace --name NAME — Create a named workspace.archive-workspace --name NAME — Soft-archive (data preserved).symbol-cluster --symbol SYMBOL_ID [--repo NAME] — all memories for a symbolrelated --id INT — memories linked to the same symbolslink-symbol --memory TEXT --symbol TEXT --repo TEXT [--trust REAL]auto-link --project NAMEsync-code-trust --repo TEXT — trust sync after git changes (compares stored HEAD vs current HEAD via built-in index)compact — prune dead links, decay stale trust, VACUUM, optimize FTS5 (auto-runs every 5 sessions)
dream — Dream Cycle: clean stale (not just old) memories:
observation_relations)update)Age alone is NOT a signal. A 6-month-old valid decision stays. A 1-day-old superseded one goes.
Auto-runs every 10th session. Run manually: memory-store.js dream or /memory-dream.
stats
list-projects
init — Initialize the database schema.
LaPis includes an optional HTTP server for programmatic access to the Aurex domain model and code analysis features:
node memory-store.js serve [--host HOST] [--port PORT]
Defaults to 127.0.0.1:9100. Provides REST endpoints for missions, milestones, working units, handoffs, contracts, verdicts, broadcasts, findings, sessions, memory search, costs, retry/rescope, compression, checkpoints, settings, and code indexing/analysis. See ../../docs/API.md for the full endpoint reference.
On session start, the extension:
list-projects for all known project namespath.basename(cwd) if nothing matchesWhen a project has zero memories, loads cross-project context from all known projects. Personal preferences always load regardless of project.
session-start --project <PROJECT> → save sessionIdobservations and personal listsrecoveredSession is present, review what was auto-recovered--scope personal for preferences that apply across all projectssession-summary --content "## Goal\n...\n## Accomplished\n..."session-end --id <ID> --memories <COUNT> --autoOn save, trigram overlap checked against existing observations:
--force to bypass| Trust Range | Behavior |
|---|---|
| 0.8 - 1.0 | Surface confidently |
| 0.5 - 0.7 | Surface with caveat |
| 0.3 - 0.4 | Surface with warning |
| 0.0 - 0.2 | Don't surface automatically |
~/.pi/memory/memory.dbindex-repo and reindex-repo invalidate the repo cache immediately, so guardrails recognize the repo on the very next tool call.isRepoStale now samples up to 50 source file mtimes (not directory mtime) to accurately detect stale indexes.The extension proactively ensures memory is always invoked at the right moment. All hooks are non-blocking — they enhance, not replace, explicit tool usage.
| Hook | Situation | Response |
|---|---|---|
session_compact | User runs /compact or auto-compaction fires | Re-inject full memory context (observations + preferences + status) so LLM retains awareness |
context | 5+ consecutive non-memory LLM calls | Sliding-window reminder to use memory-search/memory-save (resets on any memory tool use) |
message_end | Assistant message with decision/bugfix/discovery pattern | Auto-save as observation with detected type (dedup pipeline active) |
turn_end | Every 10th turn | Progress checkpoint with files touched + memory count |
tool_call | LLM reads code files directly (indexed repo, no offset/limit) | Hard block — forces memory-code outline first; excludes config files (package.json, tsconfig, etc.); partial reads allowed |
tool_call | LLM uses grep/rg/find on source code in indexed repo | Hard block for browsing/scanning — forces memory-code instead; targeted exact-symbol grep/rg is allowed when cheaper |
tool_call | LLM calls memory-code with file param | Marks file as explored → future reads allowed |
tool_call | LLM calls memory-code with any mode | Track result files as explored via tool_result; reset callsSinceLastMemory counter |
tool_call | LLM uses memory-* tools | Track last-usage timestamp + reset sliding window counter |
tool_result | memory-code returns results with file paths | Extract file paths from results → add to exploredFiles |
tool_result | bash with git pull/checkout/merge | Auto-sync code trust scores |
tool_result | edit/write on code files | Track file for session summary + periodic auto-save |
session_shutdown | Session ends | Rich summary with topics discussed + files modified + turn count |
The extension pattern-matches assistant messages for:
Cooldown of 60s between auto-saved decisions prevents noise.
Auto-saved decisions are explicitly marked with **What**: Auto-detected ... format.
Dedup pipeline is active for auto-detected decisions (no force bypass) — prevents duplicate noise from repeated patterns.