| name | agent-memory |
| description | Initialize or repair an agentMemory .memory directory and root instruction files for Claude Code, Codex, OpenCode, and Gemini CLI. Use when the user invokes /skills, asks to install agent memory, initialize .memory, set up AGENTS/CLAUDE/GEMINI memory pointers, or avoid repeating the agentMemory install command. |
Agent Memory
Initialize the current project with the taichuy/agentMemory memory template. The goal is to make project memory available to coding agents without asking the user to paste the remote install command.
Workflow
-
Treat the current working directory as the target project unless the user gives another path.
-
Do not overwrite an existing .memory/ directory unless the user explicitly asks for force/overwrite.
-
Prefer the bundled installer from this skill directory. Use the known skill path if the tool exposes it; otherwise try the global paths created by the installer:
python <skill-dir>/scripts/install-memory.py --dest .
python "$HOME/.codex/skills/agent-memory/scripts/install-memory.py" --dest .
python "$HOME/.claude/skills/agent-memory/scripts/install-memory.py" --dest .
python "$HOME/.config/opencode/skills/agent-memory/scripts/install-memory.py" --dest .
python "$HOME/.gemini/skills/agent-memory/scripts/install-memory.py" --dest .
In Claude Code, ${CLAUDE_SKILL_DIR} may be used as <skill-dir>. If python is unavailable, try python3 or py. If the user asked to replace an existing .memory/, add --force.
-
If the bundled script cannot run, manually copy assets/memory-template/.memory into the target project as .memory, then create or update these root files:
AGENTS.md
CLAUDE.md
GEMINI.md
-
The root instruction files must contain this block, or an equivalent existing reference:
# 记忆
命中对应`记忆存储规则`自动更新对应记忆中
@.memory/AGENTS.md
## 用户偏好
@.memory/user-memory.md
-
If a root instruction file already exists and already references .memory/AGENTS.md and .memory/user-memory.md, leave it unchanged.
-
If a root instruction file exists but lacks the memory references, append the memory block instead of replacing the user's content.
-
Finish by reporting whether .memory/ was installed, kept, or replaced, and which instruction files were created or updated.
-
Before ending the turn, infer the user's primary communication language from the current conversation and project files. Ask in that language whether to initialize .memory/user-memory.md. Do not write user memory before the user confirms.
-
If the user confirms, ask one compact initialization question group adapted to the project context. Include:
- Whether the inferred primary communication language is correct.
- The user's role or responsibility in this project.
- Main programming language, stack, and experience level. If the project reveals likely stack details, mention them as a hypothesis for confirmation.
- Preferred collaboration style: discuss first, implement directly with reasonable assumptions, or ask before risky choices.
- Preferred output style: concise, detailed, code-first, explanation-first, Chinese/English/bilingual, etc.
- Implementation, verification, and git preferences: when to run tests, whether to stage/commit, and what needs confirmation.
- Memory boundaries: anything the user does not want stored as long-term user memory.
-
After the user answers, update .memory/user-memory.md from the template. Preserve useful existing content, merge rather than replacing non-template memory, and use absolute timestamps in yyyy-mm-dd hh format.
Post-install Prompt
Use this shape after installation, translated to the user's inferred language:
我判断你的主流使用语言是:中文。是否现在初始化 `.memory/user-memory.md`?
如果确认,请一次性回答下面这些问题;如果暂时不想初始化,回复“跳过”即可。
1. 你在这个项目里的角色/职责是什么?
2. 你的主力编程语言、技术栈、经验年限和擅长方向是什么?
3. 我从当前项目判断它偏向 <项目类型/技术栈假设>,这个判断是否正确?需要补充什么?
4. 需求不明确时,你希望我先讨论确认,还是先按合理假设推进?
5. 你偏好的输出风格是什么?例如简短结论、详细解释、代码优先、中文/英文/双语。
6. 实现、验证、git stage/commit/push 分别希望我默认怎么处理?
7. 哪些内容不要写入长期用户记忆?
Notes
AGENTS.md covers Codex and other agents that follow the AGENTS.md convention.
CLAUDE.md covers Claude Code.
GEMINI.md covers Gemini CLI.
- OpenCode can use both AGENTS.md-style project context and globally installed Agent Skills.