memory

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Skill: 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

  • 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
tools/gemini-cli-bot/lessons-learned.md
using the following structured Markdown format:
markdown
undefined
  • 内存修剪:为避免上下文膨胀,维护滚动窗口机制:
    • Task Ledger:仅保留最近的50项任务。
    • Decision Log:仅保留最近的20条记录。
你必须使用以下结构化Markdown格式维护
tools/gemini-cli-bot/lessons-learned.md
markdown
undefined

Gemini Bot Brain: Memory & State

Gemini Bot Brain: Memory & State

📋 Task Ledger

📋 Task Ledger

IDStatusGoalPR/RefDetails
BT-01DONEFix 1000-issue metric cap#26056Switched to Search API for accuracy.
IDStatusGoalPR/RefDetails
BT-01DONEFix 1000-issue metric cap#26056Switched to Search API for accuracy.

🧪 Hypothesis Ledger

🧪 Hypothesis Ledger

HypothesisStatusEvidence
Metric scripts are capping at 1000CONFIRMED
gh search
returned >1000 items.
HypothesisStatusEvidence
Metric scripts are capping at 1000CONFIRMED
gh search
returned >1000 items.

📜 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)
undefined

Rituals

流程规范

Phase 0: Context Retrieval & Synchronization (MANDATORY START)

阶段0:上下文检索与同步(必须从该阶段开始)

Before beginning your investigation, you MUST synchronize with the bot's persistent state:
  1. Read Memory: Read
    tools/gemini-cli-bot/lessons-learned.md
    .
  2. Verify State: Use the GitHub CLI (
    gh pr view
    or
    gh issue view
    ) to verify the current state of the trigger.
  3. Update Ledger:
    • Scheduled Mode: Update the status of active tasks (e.g., mark merged PRs as
      DONE
      , investigate CI failures for
      FAILED
      tasks).
    • Interactive Mode: You MUST ignore any FAILED, STUCK, or pending tasks. Your ONLY goal is to address the specific user comment.
在开始调查前,你必须与机器人的持久化状态同步:
  1. 读取内存:读取
    tools/gemini-cli-bot/lessons-learned.md
  2. 验证状态:使用GitHub CLI(
    gh pr view
    gh issue view
    )验证触发事件的当前状态。
  3. 更新台账
    • 调度模式:更新活跃任务的状态(例如,将已合并的PR标记为
      DONE
      ,调查
      FAILED
      任务的CI失败原因)。
    • 交互模式:你必须忽略所有FAILED、STUCK或待处理的任务。你的唯一目标是处理用户的特定评论。

Phase 6: Memory Preservation (MANDATORY END)

阶段6:内存保存(必须以该阶段结束)

Once your investigation and implementation are complete:
  1. Record Findings: You MUST update
    tools/gemini-cli-bot/lessons-learned.md
    using the format defined above.
  2. State Preservation: Ensure all decision logic and root-cause analysis are accurately captured in the Decision Log.
完成调查与实现后:
  1. 记录发现:你必须使用上述定义的格式更新
    tools/gemini-cli-bot/lessons-learned.md
  2. 状态保存:确保所有决策逻辑与根因分析都被准确记录在Decision Log中。

Delegation & Sub-agent State

任务委托与子代理状态

When delegating a task to a 'worker' agent:
  1. Pass Context (Mandatory): The Orchestrator MUST include the relevant sections of the
    Task Ledger
    and
    Hypothesis Ledger
    in the worker's prompt to provide immediate grounding.
  2. 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
    lessons-learned.md
    before proceeding.
  3. Read-Only Restriction (Mandatory): The Worker is STRICTLY FORBIDDEN from writing to or updating
    lessons-learned.md
    . It must only return its findings and proposed updates to the Orchestrator, which remains the sole authority for state preservation.
当将任务委托给**「worker」代理**时:
  1. 传递上下文(必须):编排器(Orchestrator)必须在worker的提示中包含
    Task Ledger
    Hypothesis Ledger
    的相关部分,以提供即时参考依据。
  2. 验证内存(Worker角色):如果worker的任务涉及调查、根因分析或状态更新,Worker必须激活此「内存」技能,在开始前完整读取
    lessons-learned.md
  3. 只读限制(必须):Worker严格禁止写入或更新
    lessons-learned.md
    。它只能将发现结果与建议更新返回给编排器,编排器是唯一拥有状态保存权限的角色。