gemini-cli-session

Installation
SKILL.md

Gemini CLI Session

Use this skill when the user wants the primary agent to send a prompt to Gemini CLI against an existing Gemini session, so Gemini keeps the prior conversation history.

Do not use wrapper scripts. Run Gemini CLI directly.

Default to --approval-mode auto_edit so Gemini CLI can use its own write_file and replace tools without interactive approval.

Use the project-root .gemini-cli-session-id file as the primary source of truth for the session to resume.

The main user task must never run without an active session ID.

If .gemini-cli-session-id does not exist, first look up the current project's local Gemini history under ~/.gemini/tmp/<project_hash>/logs.json and recover the latest sessionId. Write that value into .gemini-cli-session-id.

If the project has no local Gemini session history yet, start a fresh headless run only for session bootstrap, capture the session_id from the init event in stream-json, and immediately persist it into .gemini-cli-session-id. After that, run the real user task by reading the session ID from .gemini-cli-session-id and using gemini -r.

Workflow

  1. Read <project-root>/.gemini-cli-session-id first.
Related skills
Installs
5
GitHub Stars
1
First Seen
Mar 19, 2026