Answer: You configure session retention and session limits in your settings.json file: retention policies go under general.sessionRetention (enabled, maxAge, maxCount, minRetention), and session length is limited with model.maxSessionTurns. The default policy is to retain sessions for 30 days. Status: Confirmed Entry: tool/gemini-cli/settings/session-retention-limits Revision: 1 Digest: sha256:54049b622c14cba3 (changes whenever the content changes) Timeline: Created: 2026-11-14T12:48:30Z Last changed: 2026-11-14T12:48:30Z Last verified: 2026-11-20T12:51:23Z Next check: 2026-11-21T12:51:23Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Unit | Source | As of retention default | 30 days | days | [1] | 2026-11-20 maxAge default | 30d | | [1] | 2026-11-20 maxCount default | undefined (unlimited) | | [1] | 2026-11-20 minRetention default | 1d | | [1] | 2026-11-20 enabled default | true | | [1] | 2026-11-20 maxSessionTurns default | -1 | | [1] | 2026-11-20 Sources: [1] Google. "Session management". https://geminicli.com/docs/cli/session-management.md Role: primary. Accessed: 2026-11-20T12:51:23Z Quote: "The default policy is to **retain sessions for 30 days**." (Supports: retention default) Quote: "Defaults to `"30d"`." (Supports: maxAge default) Quote: "Defaults to undefined (unlimited)." (Supports: maxCount default) Quote: "Defaults to `"1d"`." (Supports: minRetention default) Quote: "Master switch for session cleanup. Defaults to `true`." (Supports: enabled default) Quote: "Set to `-1` for unlimited (default)." (Supports: maxSessionTurns default) Published: 2026-10-16T02:36:07Z Snapshot SHA-256: 938b285ec43c2be80a625cd405c48f2711db2032171829124ba9e040c2735271 (captured 2026-11-13T03:17:43Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-14T12:48:30Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T12:51:23Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:51:23Z Last attempt: 2026-11-20T12:51:23Z Notes and limitations: Extracted automatically from a single official source (section "Configuration"). Related: https://latestn.com/tool/gemini-cli/settings/set-gcp-project How do I set my Google Cloud project for Gemini CLI? https://latestn.com/tool/gemini-cli/settings/set-pager How do I set the pager for the Gemini CLI shell tool? https://latestn.com/tool/gemini-cli/settings/settings-file-locations Where are Gemini CLI settings stored and which file overrides which? https://latestn.com/tool/gemini-cli/settings/override-trust-file-location How do I change where Gemini CLI stores its trusted folders file? https://latestn.com/tool/gemini-cli/settings/remote-subagent-proxy How do I configure a proxy for remote subagents in Gemini CLI? https://latestn.com/tool/gemini-cli/settings/restart-after-geminiignore-change Do I need to restart Gemini CLI after changing .geminiignore? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-14T12:48:30Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/gemini-cli/settings/session-retention-limits/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/gemini-cli/settings/session-retention-limits POST: https://latestn.com/dispute/tool/gemini-cli/settings/session-retention-limits with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/gemini-cli/settings/session-retention-limits?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I configure session retention and session limits in Gemini CLI? Revision 1, last verified 2026-11-20T12:51:23Z. https://latestn.com/tool/gemini-cli/settings/session-retention-limits (accessed 2026-11-21T09:53:46Z). @misc{LatestN_tool_gemini_cli_settings_session_retention_limits_r1, title = {How do I configure session retention and session limits in Gemini CLI?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/gemini-cli/settings/session-retention-limits}}, note = {Revision 1; digest sha256:54049b622c14cba3; last verified 2026-11-20T12:51:23Z; accessed 2026-11-21T09:53:46Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/gemini-cli/settings/session-retention-limits