Overview
Initialize the Persistent Context Workflow in the current project, creating the necessary files and directory structure.
When to Use
- First-time setup for a new project
- Adding workflow support to an existing project
- User explicitly says "init-project" or "初始化工作流"
Execution Steps
1. Check Existing Structure
Check whether the project is already initialized:
AGENTS.mdWhether it existsdocs/progress.mdWhether it existsdocs/memory/Whether the directory existsdocs/postmortem/Whether the directory exists
2. Copy Template Files
Copy files from the Skill's built-in template directory:
# 模板位置(相对于本 Skill)
templates/
├── AGENTS.md
├── progress.md
├── memory-readme.md
└── postmortem-readme.md
Files to copy:
templates/AGENTS.md→ project root directoryAGENTS.mdtemplates/progress.md→docs/progress.mdtemplates/memory-readme.md→docs/memory/README.mdtemplates/postmortem-readme.md→docs/postmortem/README.md
Note: The template files are embedded in the Skill; no need to access the user's root directory, they can be read directly.
3. Create Directory Structure
project/
├── AGENTS.md # [已创建]
├── docs/
│ ├── progress.md # [已创建]
│ ├── memory/ # [已创建]
│ │ └── README.md # [已创建]
│ └── postmortem/ # [已创建]
│ └── README.md # [已创建]
4. Update AGENTS.md
If the project already has AGENTS.md, append the workflow section:
## Agent-Agnostic 工作流
本工作流设计用于在 Claude Code、Codex、OpenCode 等不同 AI Agent CLI 之间保持上下文连续性。
### 三层记忆系统
| 层级 | 位置 | 用途 | 更新频率 |
|------|------|------|----------|
| 1. Auto Memory | Agent 自带 | 用户偏好、纠正过的行为 | 自动 |
| 2. 工作日志 | `docs/memory/YYYY-MM-DD.md` | 每日完成事项、决策 | 每次 checkpoint |
| 3. 状态快照 | `docs/progress.md` | 当前进行中的工作 | 每次 checkpoint |
### 工作流命令
- `recap` - 恢复上下文
- `checkpoint` - 存档当前进度
- `postmortem` - 事后复盘
- `init-workflow` - 初始化工作流
5. Confirm Initialization Is Complete
Report to the user:
- Which files have been created
- Which files have been updated
- Suggested next steps (run
recaporcheckpoint)
Notes
- If a file already exists, ask the user whether to overwrite it
- Preserve the user's existing project-specific configuration
- Do not delete existing content; only append workflow-related sections
Success Criteria
-
AGENTS.mdContains workflow instructions -
docs/progress.mdHas been created -
docs/memory/Directory and README have been created -
docs/postmortem/Directory and README have been created