memory

Chuyên môn trong việc duy trì bộ nhớ liên tục của bot, đồng bộ hóa với các phiên trước đó qua Task Ledger và lưu giữ nhật ký quyết định.

npx skills add https://github.com/google-gemini/gemini-cli --skill memory

Skill: Memory & State Management

Goal

Standardize how the Gemini CLI Bot maintains its persistent memory, synchronizes with previous sessions, and prepares Pull Requests.

Memory Structure (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:

# Gemini Bot Brain: Memory & State

## 📋 Task Ledger

| ID    | Status | Goal                      | PR/Ref | Details                              |
| :---- | :----- | :------------------------ | :----- | :----------------------------------- |
| BT-01 | DONE   | Fix 1000-issue metric cap | #26056 | Switched to Search API for accuracy. |

## 🧪 Hypothesis Ledger

| Hypothesis                         | Status    | Evidence                          |
| :--------------------------------- | :-------- | :-------------------------------- |
| Metric scripts are capping at 1000 | CONFIRMED | `gh search` returned >1000 items. |

## 📜 Decision Log (Append-Only)

- **[Date]**: Description of a key decision or architectural change.

## 📝 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)

Rituals

Phase 0: Context Retrieval & Synchronization (MANDATORY START)

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.

Phase 6: Memory Preservation (MANDATORY END)

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.

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.

Thêm skills từ google-gemini

agent-tui
google-gemini
Main Agents: Do NOT use this skill directly. If you need to test the TUI, invoke the `tui_tester` subagent. Drive terminal UI (TUI) applications…
gemini-api-cli
google-gemini
Hướng dẫn sử dụng công cụ CLI Gemini API. Sử dụng khi bạn cần tương tác với Gemini API qua dòng lệnh, quản lý tác nhân hoặc tạo phương tiện (hình ảnh,…)
behavioral-evals
google-gemini
Hướng dẫn tạo, chạy, sửa lỗi và thúc đẩy các đánh giá hành vi. Sử dụng khi xác minh logic quyết định của tác nhân, gỡ lỗi lỗi, gỡ lỗi prompt…
gemini-live-api-dev
google-gemini
Truyền phát hai chiều thời gian thực với Gemini qua WebSockets cho các cuộc hội thoại âm thanh, video và văn bản. Hỗ trợ đầu vào/đầu ra âm thanh (PCM 16 kHz), khung hình video, văn bản và phiên âm tự động với phát hiện hoạt động giọng nói để xử lý ngắt quãng. Bao gồm các tính năng âm thanh gốc: hội thoại cảm xúc, âm thanh chủ động và chế độ suy nghĩ; gọi hàm để sử dụng công cụ đồng bộ và không đồng bộ; và truy vấn Google Search. Cung cấp quản lý phiên với nén ngữ cảnh, tiếp tục và...
gemini-omni-flash-api
google-gemini
Sử dụng kỹ năng này để chỉnh sửa video tạo sinh, chuyển văn bản thành video, tạo video tham chiếu hình ảnh và hoạt ảnh chuyển tiếp từ khung hình đầu tiên sang video bằng…
gemini-api-dev
google-gemini
Xây dựng ứng dụng với các mô hình Gemini của Google, hỗ trợ nội dung đa phương thức, gọi hàm và đầu ra có cấu trúc trên Python, JavaScript, Go và Java. Truy cập các mô hình Gemini 3 hiện tại (Pro, Flash, Pro Image) với ngữ cảnh 1 triệu token; các mô hình Gemini 2.x và 1.5 cũ đã ngừng hỗ trợ. Hỗ trợ tạo văn bản, hiểu hình ảnh/âm thanh/video, gọi hàm, đầu ra JSON có cấu trúc, thực thi mã, lưu trữ ngữ cảnh và nhúng. Các SDK chính thức có sẵn: google-genai (Python),...
gemini-interactions-api
google-gemini
Giao diện thống nhất cho các mô hình và tác nhân Gemini với trạng thái phía máy chủ, phát trực tuyến và điều phối công cụ. Hỗ trợ nhiều mô hình hiện tại (gemini-3-flash-preview, gemini-3-pro-preview, gemini-2.5-flash/pro) và tác nhân Deep Research; tự động thay thế các ID mô hình đã lỗi thời bằng các lựa chọn thay thế hiện tại. Giảm tải lịch sử hội thoại lên máy chủ qua previous_interaction_id cho các tương tác đa lượt có trạng thái mà không cần quản lý lịch sử thủ công. Điều phối công cụ tích hợp bao gồm...
deliver
google-gemini
Đăng phiên bản tóm tắt của bản briefing tới một webhook đến của Google Chat hoặc Slack, để bản chạy hàng ngày tự giao — bỏ qua một cách im lặng khi không có webhook nào…