用途
Context Mode 用于在 CocoPlus 环境中开启上下文模式。开启后,每一次开发者提示都会被前置一段 CocoPlus 上下文块,其中显示当前阶段(current phase)、已激活的模式(active modes)以及最近的检查点(recent checkpoints),帮助在多个对话轮次之间维持项目上下文。
主要能力
- 为每条开发者提示自动前置 CocoPlus 上下文块。
- 上下文块内容包含:当前阶段、激活的模式、最近的检查点。
- 通过模式标志文件记录开关状态,便于跨会话保持。
- 同步更新 AGENTS.md 中的 Context 行,确保文档状态与实际开关一致。
使用方式
- 前置检查:确认当前目录下存在 .cocoplus/ 目录。若不存在,则输出“CocoPlus not initialized in this directory. Run $pod init to begin.”并停止。
- 创建模式标志:使用 Write 工具创建空文件 .cocoplus/modes/context-mode.on(跨平台要求:不要使用 touch)。
- 更新 AGENTS.md(保持不超过 200 行):将 Context 行替换为
- Context Mode: ON (phase context prepended to prompts)。 - 输出确认信息:“✓ Context Mode enabled. Each prompt will be prepended with current phase, active modes, and recent checkpoints. This helps maintain project context across conversation turns.”
适用场景
适用于使用 CocoPlus 进行开发、且希望在多轮对话中持续保留项目阶段、模式与检查点信息的场景。
限制与注意事项
- 必须在已初始化 CocoPlus 的目录中执行,否则会中止并提示运行 $pod init。
- 创建标志文件时需使用 Write 工具,不可使用 touch。
- 即使标志文件已存在(幂等重新启用),也必须同步更新 AGENTS.md,因为其可能仍显示“Context Mode: off”。
- AGENTS.md 需保持在 200 行以内。
退出标准
- .cocoplus/modes/context-mode.on 标志文件存在。
- .cocoplus/AGENTS.md 的 Context 行显示为
- Context Mode: ON (phase context prepended to prompts)。