---
title: Memory Skill for Claude Code
canonical: https://skillselion.com/skills/google-gemini/gemini-cli/memory
content_type: text/markdown
description: "Persistent memory management for Gemini CLI Bot that synchronizes cross-session state, documents decision logic, and prevents context bloat through structured."
---

# Memory Skill

Title: Memory Skill for Claude Code

> Persistent memory management for Gemini CLI Bot that synchronizes cross-session state, documents decision logic, and prevents context bloat through structured.

Canonical: https://skillselion.com/skills/google-gemini/gemini-cli/memory

Persistent memory management for Gemini CLI Bot that synchronizes cross-session state, documents decision logic, and prevents context bloat through structured ledgers and pruning.

This skill standardizes persistent memory management for the Gemini CLI Bot, enabling cross-session continuity through structured Task Ledger, Hypothesis Ledger, and Decision Log formats. It implements memory pruning strategies (50 recent tasks, 20 decision entries) to prevent context bloat and establishes mandatory synchronization rituals at session start and completion. Supports delegation to worker agents via context passing while enforcing read-only restrictions on state updates. Critical for investigative workflows, root-cause documentation, and orchestrator-worker coordination in automated pull request and issue management pipelines.

## Key facts

- Installs: 200
- GitHub stars: 109,201
- Author: google-gemini
- Repository: google-gemini/gemini-cli
- Install command: `npx skills add https://github.com/google-gemini/gemini-cli --skill memory`
- Last updated: November 27, 2026

## What Memory does

Maintain persistent bot memory and task state across Gemini CLI bot sessions via structured ledgers and synchronization rituals.

Bots lose context across sessions, duplicate investigations, and lack audit trails for architectural decisions; context bloat accumulates without pruning.

Bot maintains consistent state via lessons-learned.md, synchronizes with prior sessions before execution, documents root causes, and delegates cleanly to workers.

Best for: Orchestrator agents managing multiple runs, investigating issues across sessions, delegating tasks while maintaining state consistency, audit trails of bot decisions.

Not for: Single-shot scripts, stateless agents, real-time chat without persistence, scenarios requiring <5ms latency decisions.

- Structured memory pruning with rolling windows (50 tasks, 20 decisions)
- Mandatory Phase 0 context retrieval and Phase 6 memory preservation rituals
- Task Ledger, Hypothesis Ledger, and Decision Log in append-only Markdown format
- Orchestrator-only state preservation with worker agent read-only access
- Session synchronization via GitHub CLI verification (gh pr view, gh issue view)

## SKILL.md

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

```markdown
# 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.

## Memory FAQ

### What is Memory Skill?

Persistent memory management for Gemini CLI Bot that synchronizes cross-session state, documents decision logic, and prevents context bloat through structured.

### How do I install Memory Skill?

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

## Machine access

- [Sitemap](https://skillselion.com/sitemap.xml)
- [llms.txt](https://skillselion.com/llms.txt)
- [llms-full.txt](https://skillselion.com/llms-full.txt)
- [Developer resources](https://skillselion.com/developers)
- [OpenAPI spec](https://skillselion.com/openapi.json)
- [MCP handshake](https://skillselion.com/.well-known/mcp)
- [API catalog](https://skillselion.com/.well-known/api-catalog)
- [AI catalog](https://skillselion.com/.well-known/ai-catalog.json)
- [Pricing](https://skillselion.com/pricing.md)
- [Auth](https://skillselion.com/auth.md)
- [AGENTS.md](https://skillselion.com/AGENTS.md)
- [Contact](https://skillselion.com/contact)
- [Home](https://skillselion.com/)
