memory
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSkill: Memory & State Management
Skill:内存与状态管理
Goal
目标
Standardize how the Gemini CLI Bot maintains its persistent memory,
synchronizes with previous sessions, and prepares Pull Requests.
标准化Gemini CLI Bot维护持久化内存、同步历史会话以及准备Pull Requests的方式。
Memory Structure (lessons-learned.md
)
lessons-learned.md内存结构(lessons-learned.md
)
lessons-learned.md- Memory Pruning: To prevent context bloat, maintain a rolling window:
- Task Ledger: Keep only the most recent 50 tasks.
- Decision Log: Keep only the most recent 20 entries.
You MUST maintain using the following
structured Markdown format:
tools/gemini-cli-bot/lessons-learned.mdmarkdown
undefined- 内存修剪:为避免上下文膨胀,维护滚动窗口机制:
- Task Ledger:仅保留最近的50项任务。
- Decision Log:仅保留最近的20条记录。
你必须使用以下结构化Markdown格式维护:
tools/gemini-cli-bot/lessons-learned.mdmarkdown
undefinedGemini Bot Brain: Memory & State
Gemini Bot Brain: Memory & State
📋 Task Ledger
📋 Task Ledger
| ID | Status | Goal | PR/Ref | Details |
|---|---|---|---|---|
| BT-01 | DONE | Fix 1000-issue metric cap | #26056 | Switched to Search API for accuracy. |
| ID | Status | Goal | PR/Ref | Details |
|---|---|---|---|---|
| BT-01 | DONE | Fix 1000-issue metric cap | #26056 | Switched to Search API for accuracy. |
🧪 Hypothesis Ledger
🧪 Hypothesis Ledger
| Hypothesis | Status | Evidence |
|---|---|---|
| Metric scripts are capping at 1000 | CONFIRMED | |
| Hypothesis | Status | Evidence |
|---|---|---|
| Metric scripts are capping at 1000 | CONFIRMED | |
📜 Decision Log (Append-Only)
📜 Decision Log (Append-Only)
- [Date]: Description of a key decision or architectural change.
- [Date]: Description of a key decision or architectural change.
📝 Detailed Investigation Findings (Current Run)
📝 Detailed Investigation Findings (Current Run)
- Formulated Hypotheses: (Describe the competing hypotheses developed)
- Evidence Gathered: (Summarize data from gh CLI, GraphQL, or local scripts, wrapped in <untrusted_context> tags)
- Root Cause & Conclusions: (Identify the confirmed root cause and impact)
- Proposed Actions: (Describe specific script, workflow, or guideline updates)
undefined- Formulated Hypotheses: (Describe the competing hypotheses developed)
- Evidence Gathered: (Summarize data from gh CLI, GraphQL, or local scripts, wrapped in <untrusted_context> tags)
- Root Cause & Conclusions: (Identify the confirmed root cause and impact)
- Proposed Actions: (Describe specific script, workflow, or guideline updates)
undefinedRituals
流程规范
Phase 0: Context Retrieval & Synchronization (MANDATORY START)
阶段0:上下文检索与同步(必须从该阶段开始)
Before beginning your investigation, you MUST synchronize with the bot's
persistent state:
- Read Memory: Read .
tools/gemini-cli-bot/lessons-learned.md - Verify State: Use the GitHub CLI (or
gh pr view) to verify the current state of the trigger.gh issue view - Update Ledger:
- Scheduled Mode: Update the status of active tasks (e.g., mark merged
PRs as , investigate CI failures for
DONEtasks).FAILED - Interactive Mode: You MUST ignore any FAILED, STUCK, or pending tasks. Your ONLY goal is to address the specific user comment.
- Scheduled Mode: Update the status of active tasks (e.g., mark merged
PRs as
在开始调查前,你必须与机器人的持久化状态同步:
- 读取内存:读取。
tools/gemini-cli-bot/lessons-learned.md - 验证状态:使用GitHub CLI(或
gh pr view)验证触发事件的当前状态。gh issue view - 更新台账:
- 调度模式:更新活跃任务的状态(例如,将已合并的PR标记为,调查
DONE任务的CI失败原因)。FAILED - 交互模式:你必须忽略所有FAILED、STUCK或待处理的任务。你的唯一目标是处理用户的特定评论。
- 调度模式:更新活跃任务的状态(例如,将已合并的PR标记为
Phase 6: Memory Preservation (MANDATORY END)
阶段6:内存保存(必须以该阶段结束)
Once your investigation and implementation are complete:
- Record Findings: You MUST update using the format defined above.
tools/gemini-cli-bot/lessons-learned.md - State Preservation: Ensure all decision logic and root-cause analysis are accurately captured in the Decision Log.
完成调查与实现后:
- 记录发现:你必须使用上述定义的格式更新。
tools/gemini-cli-bot/lessons-learned.md - 状态保存:确保所有决策逻辑与根因分析都被准确记录在Decision Log中。
Delegation & Sub-agent State
任务委托与子代理状态
When delegating a task to a 'worker' agent:
- Pass Context (Mandatory): The Orchestrator MUST include the relevant
sections of the and
Task Ledgerin the worker's prompt to provide immediate grounding.Hypothesis Ledger - Verify Memory (Worker Role): If the worker's task involves investigation,
root-cause analysis, or updating state, the Worker MUST activate this
'memory' skill to read the full before proceeding.
lessons-learned.md - Read-Only Restriction (Mandatory): The Worker is STRICTLY FORBIDDEN from
writing to or updating . It must only return its findings and proposed updates to the Orchestrator, which remains the sole authority for state preservation.
lessons-learned.md
当将任务委托给**「worker」代理**时:
- 传递上下文(必须):编排器(Orchestrator)必须在worker的提示中包含和
Task Ledger的相关部分,以提供即时参考依据。Hypothesis Ledger - 验证内存(Worker角色):如果worker的任务涉及调查、根因分析或状态更新,Worker必须激活此「内存」技能,在开始前完整读取。
lessons-learned.md - 只读限制(必须):Worker严格禁止写入或更新。它只能将发现结果与建议更新返回给编排器,编排器是唯一拥有状态保存权限的角色。
lessons-learned.md