بنقرة واحدة
memory-best-practices
Best practices for writing and maintaining high-quality role memories.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Best practices for writing and maintaining high-quality role memories.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Web search, online search, real-time search, internet search, Google alternative, Bing alternative, DuckDuckGo alternative, search the web, lookup online, find information, research,查询,搜索,搜索结果,网页搜索,联网搜索,实时搜索,网络查询,资料查找,信息检索,最新资讯,新闻搜索, Tavily Search API for optimized, real-time web search results for RAG. A pre-configured, cost-effective search tool.
在 macOS 上使用 osascript 执行 AppleScript 或 JavaScript for Automation (JXA) 实现系统自动化。当用户需要控制 macOS 应用(Finder、Safari、Mail、Calendar、Keynote、Numbers、Pages 等)、操作系统 UI、显示对话框/通知、读写剪贴板、自动化重复任务、或任何涉及 osascript/AppleScript/JXA 的需求时,必须使用本技能。即使用户只说"帮我自动化这个"或"在 Mac 上操作 XXX",也应优先考虑本技能。
Model configuration editor for ~/.pi/agent/models.json - 使用 Bun 脚本管理模型配置
读取和写入输出风格目录的工具技能。当用户需要:(1)读取输出风格文件,(2)写入/创建输出风格文件,(3)管理输出风格目录,(4)解析风格文件格式时使用。
Periodic maintenance of role memory: dedup, tidy, consolidate, and pending management.
Load prior knowledge from role memory before starting any task.
| name | memory-best-practices |
| description | Best practices for writing and maintaining high-quality role memories. |
| whenToUse | When writing or reviewing memory entries, or when the user asks about memory quality standards. |
A quality standard for writing high-quality memories that compound in value.
[Nx] Priority System[0x] New → unverified, just added
[1-2x] Normal → confirmed 1-2 times
[3x]+ High Priority → battle-tested, frequently used
[Nx] = usage count. The best quality signal. [6x] survived 6 sessions — probably right. [0x] might be noise.
[Nx] Increments| Trigger | Effect |
|---|---|
memory({ action: "reinforce", content: "..." }) | Manual +1 |
memory({ action: "search", query: "..." }) score ≥0.5 | Auto-reinforce +1 |
| Pending auto-promote (search ≥0.5) | Moves to consolidated at [0x] |
Reinforce ≠ Promote:
[Nx] within consolidated (used+1)Before saving:
✅ "MyBatis-Plus getOne needs .last('LIMIT 1') to avoid TooManyResultsException"
✅ "禁止 rm,优先 trash"
✅ "ACP: Agent 无状态,Client 持状态"
❌ "用户让我修了一个 bug" ← too generic
❌ "Error at /src/index.ts:42" ← copy-paste, no insight
❌ "服务器现在在 3000 端口" ← temporary state
| Category | When |
|---|---|
Communication | Language, style, tone |
Code | Style, conventions, abstraction |
Tools | CLI, editors, workflows |
Workflow | Process, review, deployment |
General | Everything else |
Rules: one per line, be specific, correct category.
Each learning has LLM-auto-extracted tags. You don't tag manually.
Tags are used in search:
Example: searching "安全删除" finds entries tagged filesystem, safety, delete even if they don't contain those words.
Path 1: Auto-extract (agent_end / compaction)
→ pending.md [○] → search ≥0.5 → promote → consolidated [0x]
→ reinforce over time → [3x]+ High Priority
Path 2: Manual (memory tool)
→ consolidated [0x] directly (you verified it's worth keeping)
→ reinforce over time → same priority ladder
Why pending? Auto-extracted memories are noisy. Pending layer filters by actual usage.
| Operation | Method | What it does |
|---|---|---|
consolidate | Rule-based | Exact + Jaccard dedup. Safe, never deletes unique entries. |
llm_tidy | LLM-guided | Rewrites verbose, detects contradictions, suggests deletions. |
Use consolidate for routine maintenance. Use llm_tidy for deep cleanup.
| Dimension | Memory (consolidated.md) | Knowledge (knowledge/) |
|---|---|---|
| Scope | Cross-session insights | Reusable patterns, decisions |
| Format | One-line entries | Full markdown files |
| Example | "禁止 rm,优先 trash" | Full design pattern with code |
| Tool | memory | knowledge |
| Share | Per-role | Role / global / project |
Write knowledge when: full pattern with code examples, or share across roles.
[3x]+ entries[0x] count (low noise)[0x] never reinforced (noise)Add learning: memory({ action: "add_learning", content: "..." })
Add preference: memory({ action: "add_preference", content: "...", category: "..." })
Reinforce: memory({ action: "reinforce", content: "..." })
Search: memory({ action: "search", query: "..." })
List: memory({ action: "list" })
Consolidate: memory({ action: "consolidate" })
LLM tidy: memory({ action: "llm_tidy" })