memory
ALWAYS read durable project context from `<repo-root>/.pi/MEMORY.md`; append learnings to it. File-based, on-demand, observable.
- License 许可
- MIT
- 最近更新
- 2026-08-20
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- memory
- description
- ALWAYS read durable project context from `<repo-root>/.pi/MEMORY.md`; append learnings to it. File-based, on-demand, observable.
03 SKILL.md 正文
Memory
Durable project knowledge lives in <repo-root>/.pi/MEMORY.md. Resolve the repository root before reading or writing it; .pi may be the current directory. Read it on demand when relevant, append to it when new learnings surface.
When to load
ALWAYS at the start of any task that:
- involves a decision, design choice, or architectural call
- references prior work, past sessions, or "what we did before"
- is in a project the user has memory for (
<repo-root>/.pi/MEMORY.mdexists) - the user mentions "memory", "before", "last time", "we used to", or similar
For trivial edits, single-line fixes, or pure code questions with no project context — skip.
Where memory lives
<repo-root>/.pi/MEMORY.md— project-specific memory (per repository root)~/.pi/MEMORY.md— global personal memory (cross-project, cross-session)
The user creates and owns these files. They are not part of this skill.
Sections in MEMORY.md: architecture, decisions, patterns, gotchas. Grep-friendly keywords.
Usage
Recall prior context:
# Resolve the repository root first, then search memory
ROOT="$(git rev-parse --show-toplevel 2>/dev/null || true)"
if ! test -f "$ROOT/package.json" || ! test -d "$ROOT/.pi"; then
ROOT="$PWD"
while ! test -f "$ROOT/package.json" || ! test -d "$ROOT/.pi"; do
NEXT="$(dirname "$ROOT")"
test "$NEXT" != "$ROOT" || { ROOT=""; break; }
ROOT="$NEXT"
done
fi
test -n "$ROOT" && test -f "$ROOT/package.json" && test -d "$ROOT/.pi" || exit 1
rg -n "<topic>" "$ROOT/.pi/MEMORY.md"
For a small file, use the read tool with the absolute path $ROOT/.pi/MEMORY.md after resolving $ROOT.
Save a new learning this session:
- Resolve
<repo-root>and check for duplicates:rg -n "<topic>" <repo-root>/.pi/MEMORY.md - If the learning is durable, append a bullet via
editusing the resolved absolute path. Keep entries short.
Compact when the file grows:
- Read the file, then rewrite, dropping low-signal entries.
- Target: under 5KB. If it grows past that, compact.
Conventions for entries
- One bullet per learning, with type tag in brackets:
[decision],[bugfix],[pattern],[feature],[discovery],[learning],[warning]. - Prefer concise titles; narrative only when essential.
When NOT to use
04 同仓库更多 Skills
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment - applies TDD to process documentation by testing with subagents before writing, iterating until bulletproof against rationalization. Includes complete pressure testing methodology.
verification-before-completion
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
typescript-coding-standards
Use when writing, refactoring, or reviewing TypeScript code that needs strong domain modeling, typed errors, schema parsing, safe adapters, test seams, or maintainable module boundaries.
test-driven-development
Use when implementing a feature, bugfix, or behavior-changing refactor — require a failing behavior test before production code, then make the smallest change that passes.
source-driven-development
Use when unfamiliar libraries, dependency internals, external APIs, framework behavior, migrations, or current ecosystem guidance require official documentation, version-matched source, read the tests, and cited evidence.
security-and-hardening
Use when auditing security, implementing authentication or authorization, handling secrets, or validating data across external trust boundaries.