@thacio/auditaria 0.30.12 → 0.30.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +14 -10
  2. package/bundle/docs/admin/enterprise-controls.md +115 -0
  3. package/bundle/docs/changelogs/index.md +20 -1
  4. package/bundle/docs/changelogs/latest.md +359 -293
  5. package/bundle/docs/changelogs/preview.md +296 -349
  6. package/bundle/docs/cli/checkpointing.md +2 -3
  7. package/bundle/docs/cli/cli-reference.md +4 -5
  8. package/bundle/docs/cli/commands.md +376 -650
  9. package/bundle/docs/cli/custom-commands.md +3 -0
  10. package/bundle/docs/cli/enterprise.md +1 -1
  11. package/bundle/docs/cli/gemini-md.md +20 -12
  12. package/bundle/docs/cli/headless.md +34 -372
  13. package/bundle/docs/cli/keyboard-shortcuts.md +36 -35
  14. package/bundle/docs/cli/plan-mode.md +5 -1
  15. package/bundle/docs/cli/rewind.md +11 -11
  16. package/bundle/docs/cli/session-management.md +61 -44
  17. package/bundle/docs/cli/settings.md +10 -5
  18. package/bundle/docs/cli/skills.md +15 -8
  19. package/bundle/docs/cli/themes.md +85 -51
  20. package/bundle/docs/cli/tutorials/automation.md +187 -0
  21. package/bundle/docs/cli/tutorials/file-management.md +142 -0
  22. package/bundle/docs/cli/tutorials/mcp-setup.md +105 -0
  23. package/bundle/docs/cli/tutorials/memory-management.md +126 -0
  24. package/bundle/docs/cli/tutorials/session-management.md +105 -0
  25. package/bundle/docs/cli/tutorials/shell-commands.md +107 -0
  26. package/bundle/docs/cli/tutorials/skills-getting-started.md +36 -31
  27. package/bundle/docs/cli/tutorials/task-planning.md +93 -0
  28. package/bundle/docs/cli/tutorials/web-tools.md +78 -0
  29. package/bundle/docs/core/policy-engine.md +4 -2
  30. package/bundle/docs/core/subagents.md +38 -38
  31. package/bundle/docs/extensions/best-practices.md +102 -53
  32. package/bundle/docs/extensions/index.md +37 -21
  33. package/bundle/docs/extensions/reference.md +148 -216
  34. package/bundle/docs/extensions/releasing.md +93 -122
  35. package/bundle/docs/extensions/writing-extensions.md +87 -76
  36. package/bundle/docs/get-started/configuration.md +103 -61
  37. package/bundle/docs/get-started/examples.md +39 -119
  38. package/bundle/docs/get-started/index.md +5 -4
  39. package/bundle/docs/get-started/installation.md +110 -77
  40. package/bundle/docs/index.md +156 -108
  41. package/bundle/docs/releases.md +2 -2
  42. package/bundle/docs/sidebar.json +101 -61
  43. package/bundle/docs/tools/activate-skill.md +43 -0
  44. package/bundle/docs/tools/ask-user.md +1 -1
  45. package/bundle/docs/tools/file-system.md +43 -133
  46. package/bundle/docs/tools/index.md +92 -91
  47. package/bundle/docs/tools/internal-docs.md +46 -0
  48. package/bundle/docs/tools/mcp-server.md +2 -2
  49. package/bundle/docs/tools/memory.md +21 -40
  50. package/bundle/docs/tools/shell.md +43 -88
  51. package/bundle/docs/tools/todos.md +22 -44
  52. package/bundle/docs/tools/web-fetch.md +22 -46
  53. package/bundle/docs/tools/web-search.md +19 -29
  54. package/bundle/gemini.js +138221 -136590
  55. package/bundle/mcp-bridge.js +154 -143
  56. package/bundle/node_modules/@browserbasehq/stagehand/dist/index.js +430 -257
  57. package/bundle/node_modules/@thacio/auditaria-search/dist/tsconfig.tsbuildinfo +1 -1
  58. package/bundle/web-client/components/EditorPanel.js +57 -36
  59. package/bundle/web-client/components/FileTreePanel.js +77 -2
  60. package/bundle/web-client/index.html +5 -1
  61. package/bundle/web-client/managers/EditorManager.js +190 -24
  62. package/bundle/web-client/styles/themes.css +376 -0
  63. package/bundle/web-client/utils/theme-manager.js +33 -1
  64. package/package.json +6 -6
  65. package/bundle/docs/architecture.md +0 -80
  66. package/bundle/docs/cli/index.md +0 -67
  67. package/bundle/docs/cli/tutorials.md +0 -87
  68. package/bundle/docs/get-started/configuration-v1.md +0 -882
@@ -0,0 +1,187 @@
1
+ # Automate tasks with headless mode
2
+
3
+ Automate tasks with Gemini CLI. Learn how to use headless mode, pipe data into
4
+ Gemini CLI, automate workflows with shell scripts, and generate structured JSON
5
+ output for other applications.
6
+
7
+ ## Prerequisites
8
+
9
+ - Gemini CLI installed and authenticated.
10
+ - Familiarity with shell scripting (Bash/Zsh).
11
+
12
+ ## Why headless mode?
13
+
14
+ Headless mode runs Gemini CLI once and exits. It's perfect for:
15
+
16
+ - **CI/CD:** Analyzing pull requests automatically.
17
+ - **Batch processing:** Summarizing a large number of log files.
18
+ - **Tool building:** Creating your own "AI wrapper" scripts.
19
+
20
+ ## How to use headless mode
21
+
22
+ Run Gemini CLI in headless mode by providing a prompt as a positional argument.
23
+ This bypasses the interactive chat interface and prints the response to standard
24
+ output (stdout).
25
+
26
+ Run a single command:
27
+
28
+ ```bash
29
+ gemini "Write a poem about TypeScript"
30
+ ```
31
+
32
+ ## How to pipe input to Gemini CLI
33
+
34
+ Feed data into Gemini using the standard Unix pipe `|`. Gemini reads the
35
+ standard input (stdin) as context and answers your question using standard
36
+ output.
37
+
38
+ Pipe a file:
39
+
40
+ ```bash
41
+ cat error.log | gemini "Explain why this failed"
42
+ ```
43
+
44
+ Pipe a command:
45
+
46
+ ```bash
47
+ git diff | gemini "Write a commit message for these changes"
48
+ ```
49
+
50
+ ## Use Gemini CLI output in scripts
51
+
52
+ Because Gemini prints to stdout, you can chain it with other tools or save the
53
+ results to a file.
54
+
55
+ ### Scenario: Bulk documentation generator
56
+
57
+ You have a folder of Python scripts and want to generate a `README.md` for each
58
+ one.
59
+
60
+ 1. Save the following code as `generate_docs.sh`:
61
+
62
+ ```bash
63
+ #!/bin/bash
64
+
65
+ # Loop through all Python files
66
+ for file in *.py; do
67
+ echo "Generating docs for $file..."
68
+
69
+ # Ask Gemini CLI to generate the documentation and print it to stdout
70
+ gemini "Generate a Markdown documentation summary for @$file. Print the
71
+ result to standard output." > "${file%.py}.md"
72
+ done
73
+ ```
74
+
75
+ 2. Make the script executable and run it in your directory:
76
+
77
+ ```bash
78
+ chmod +x generate_docs.sh
79
+ ./generate_docs.sh
80
+ ```
81
+
82
+ This creates a corresponding Markdown file for every Python file in the
83
+ folder.
84
+
85
+ ## Extract structured JSON data
86
+
87
+ When writing a script, you often need structured data (JSON) to pass to tools
88
+ like `jq`. To get pure JSON data from the model, combine the
89
+ `--output-format json` flag with `jq` to parse the response field.
90
+
91
+ ### Scenario: Extract and return structured data
92
+
93
+ 1. Save the following script as `generate_json.sh`:
94
+
95
+ ```bash
96
+ #!/bin/bash
97
+
98
+ # Ensure we are in a project root
99
+ if [ ! -f "package.json" ]; then
100
+ echo "Error: package.json not found."
101
+ exit 1
102
+ fi
103
+
104
+ # Extract data
105
+ gemini --output-format json "Return a raw JSON object with keys 'version' and 'deps' from @package.json" | jq -r '.response' > data.json
106
+ ```
107
+
108
+ 2. Run `generate_json.sh`:
109
+
110
+ ```bash
111
+ chmod +x generate_json.sh
112
+ ./generate_json.sh
113
+ ```
114
+
115
+ 3. Check `data.json`. The file should look like this:
116
+
117
+ ```json
118
+ {
119
+ "version": "1.0.0",
120
+ "deps": {
121
+ "react": "^18.2.0"
122
+ }
123
+ }
124
+ ```
125
+
126
+ ## Build your own custom AI tools
127
+
128
+ Use headless mode to perform custom, automated AI tasks.
129
+
130
+ ### Scenario: Create a "Smart Commit" alias
131
+
132
+ You can add a function to your shell configuration (like `.zshrc` or `.bashrc`)
133
+ to create a `git commit` wrapper that writes the message for you.
134
+
135
+ 1. Open your `.zshrc` file (or `.bashrc` if you use Bash) in your preferred
136
+ text editor.
137
+
138
+ ```bash
139
+ nano ~/.zshrc
140
+ ```
141
+
142
+ **Note**: If you use VS Code, you can run `code ~/.zshrc`.
143
+
144
+ 2. Scroll to the very bottom of the file and paste this code:
145
+
146
+ ```bash
147
+ function gcommit() {
148
+ # Get the diff of staged changes
149
+ diff=$(git diff --staged)
150
+
151
+ if [ -z "$diff" ]; then
152
+ echo "No staged changes to commit."
153
+ return 1
154
+ fi
155
+
156
+ # Ask Gemini to write the message
157
+ echo "Generating commit message..."
158
+ msg=$(echo "$diff" | gemini "Write a concise Conventional Commit message for this diff. Output ONLY the message.")
159
+
160
+ # Commit with the generated message
161
+ git commit -m "$msg"
162
+ }
163
+ ```
164
+
165
+ Save your file and exit.
166
+
167
+ 3. Run this command to make the function available immediately:
168
+
169
+ ```bash
170
+ source ~/.zshrc
171
+ ```
172
+
173
+ 4. Use your new command:
174
+
175
+ ```bash
176
+ gcommit
177
+ ```
178
+
179
+ Gemini CLI will analyze your staged changes and commit them with a generated
180
+ message.
181
+
182
+ ## Next steps
183
+
184
+ - Explore the [Headless mode reference](../../cli/headless.md) for full JSON
185
+ schema details.
186
+ - Learn about [Shell commands](shell-commands.md) to let the agent run scripts
187
+ instead of just writing them.
@@ -0,0 +1,142 @@
1
+ # File management with Gemini CLI
2
+
3
+ Explore, analyze, and modify your codebase using Gemini CLI. In this guide,
4
+ you'll learn how to provide Gemini CLI with files and directories, modify and
5
+ create files, and control what Gemini CLI can see.
6
+
7
+ ## Prerequisites
8
+
9
+ - Gemini CLI installed and authenticated.
10
+ - A project directory to work with (e.g., a git repository).
11
+
12
+ ## How to give the agent context (Reading files)
13
+
14
+ Gemini CLI will generally try to read relevant files, sometimes prompting you
15
+ for access (depending on your settings). To ensure that Gemini CLI uses a file,
16
+ you can also include it directly.
17
+
18
+ ### Direct file inclusion (`@`)
19
+
20
+ If you know the path to the file you want to work on, use the `@` symbol. This
21
+ forces the CLI to read the file immediately and inject its content into your
22
+ prompt.
23
+
24
+ ```bash
25
+ `@src/components/UserProfile.tsx Explain how this component handles user data.`
26
+ ```
27
+
28
+ ### Working with multiple files
29
+
30
+ Complex features often span multiple files. You can chain `@` references to give
31
+ the agent a complete picture of the dependencies.
32
+
33
+ ```bash
34
+ `@src/components/UserProfile.tsx @src/types/User.ts Refactor the component to use the updated User interface.`
35
+ ```
36
+
37
+ ### Including entire directories
38
+
39
+ For broad questions or refactoring, you can include an entire directory. Be
40
+ careful with large folders, as this consumes more tokens.
41
+
42
+ ```bash
43
+ `@src/utils/ Check these utility functions for any deprecated API usage.`
44
+ ```
45
+
46
+ ## How to find files (Exploration)
47
+
48
+ If you _don't_ know the exact file path, you can ask Gemini CLI to find it for
49
+ you. This is useful when navigating a new codebase or looking for specific
50
+ logic.
51
+
52
+ ### Scenario: Find a component definition
53
+
54
+ You know there's a `UserProfile` component, but you don't know where it lives.
55
+
56
+ ```none
57
+ `Find the file that defines the UserProfile component.`
58
+ ```
59
+
60
+ Gemini uses the `glob` or `list_directory` tools to search your project
61
+ structure. It will return the specific path (e.g.,
62
+ `src/components/UserProfile.tsx`), which you can then use with `@` in your next
63
+ turn.
64
+
65
+ > **Tip:** You can also ask for lists of files, like "Show me all the TypeScript
66
+ > configuration files in the root directory."
67
+
68
+ ## How to modify code
69
+
70
+ Once Gemini CLI has context, you can direct it to make specific edits. The agent
71
+ is capable of complex refactoring, not just simple text replacement.
72
+
73
+ ```none
74
+ `Update @src/components/UserProfile.tsx to show a loading spinner if the user data is null.`
75
+ ```
76
+
77
+ Gemini CLI uses the `replace` tool to propose a targeted code change.
78
+
79
+ ### Creating new files
80
+
81
+ You can also ask the agent to create entirely new files or folder structures.
82
+
83
+ ```none
84
+ `Create a new file @src/components/LoadingSpinner.tsx with a simple Tailwind CSS spinner.`
85
+ ```
86
+
87
+ Gemini CLI uses the `write_file` tool to generate the new file from scratch.
88
+
89
+ ## Review and confirm changes
90
+
91
+ Gemini CLI prioritizes safety. Before any file is modified, it presents a
92
+ unified diff of the proposed changes.
93
+
94
+ ```diff
95
+ - if (!user) return null;
96
+ + if (!user) return <LoadingSpinner />;
97
+ ```
98
+
99
+ - **Red lines (-):** Code that will be removed.
100
+ - **Green lines (+):** Code that will be added.
101
+
102
+ Press **y** to confirm and apply the change to your local file system. If the
103
+ diff doesn't look right, press **n** to cancel and refine your prompt.
104
+
105
+ ## Verify the result
106
+
107
+ After the edit is complete, verify the fix. You can simply read the file again
108
+ or, better yet, run your project's tests.
109
+
110
+ ```none
111
+ `Run the tests for the UserProfile component.`
112
+ ```
113
+
114
+ Gemini CLI uses the `run_shell_command` tool to execute your test runner (e.g.,
115
+ `npm test` or `jest`). This ensures the changes didn't break existing
116
+ functionality.
117
+
118
+ ## Advanced: Controlling what Gemini sees
119
+
120
+ By default, Gemini CLI respects your `.gitignore` file. It won't read or search
121
+ through `node_modules`, build artifacts, or other ignored paths.
122
+
123
+ If you have sensitive files (like `.env`) or large assets that you want to keep
124
+ hidden from the AI _without_ ignoring them in Git, you can create a
125
+ `.geminiignore` file in your project root.
126
+
127
+ **Example `.geminiignore`:**
128
+
129
+ ```text
130
+ .env
131
+ local-db-dump.sql
132
+ private-notes.md
133
+ ```
134
+
135
+ ## Next steps
136
+
137
+ - Learn how to [Manage context and memory](memory-management.md) to keep your
138
+ agent smarter over long sessions.
139
+ - See [Execute shell commands](shell-commands.md) for more on running tests and
140
+ builds.
141
+ - Explore the technical [File system reference](../../tools/file-system.md) for
142
+ advanced tool parameters.
@@ -0,0 +1,105 @@
1
+ # Set up an MCP server
2
+
3
+ Connect Gemini CLI to your external databases and services. In this guide,
4
+ you'll learn how to extend Gemini CLI's capabilities by installing the GitHub
5
+ MCP server and using it to manage your repositories.
6
+
7
+ ## Prerequisites
8
+
9
+ - Gemini CLI installed.
10
+ - **Docker:** Required for this specific example (many MCP servers run as Docker
11
+ containers).
12
+ - **GitHub token:** A Personal Access Token (PAT) with repo permissions.
13
+
14
+ ## How to prepare your credentials
15
+
16
+ Most MCP servers require authentication. For GitHub, you need a PAT.
17
+
18
+ 1. Create a [fine-grained PAT](https://github.com/settings/tokens?type=beta).
19
+ 2. Grant it **Read** access to **Metadata** and **Contents**, and
20
+ **Read/Write** access to **Issues** and **Pull Requests**.
21
+ 3. Store it in your environment:
22
+
23
+ ```bash
24
+ export GITHUB_PERSONAL_ACCESS_TOKEN="github_pat_..."
25
+ ```
26
+
27
+ ## How to configure Gemini CLI
28
+
29
+ You tell Gemini about new servers by editing your `settings.json`.
30
+
31
+ 1. Open `~/.gemini/settings.json` (or the project-specific
32
+ `.gemini/settings.json`).
33
+ 2. Add the `mcpServers` block. This tells Gemini: "Run this docker container
34
+ and talk to it."
35
+
36
+ ```json
37
+ {
38
+ "mcpServers": {
39
+ "github": {
40
+ "command": "docker",
41
+ "args": [
42
+ "run",
43
+ "-i",
44
+ "--rm",
45
+ "-e",
46
+ "GITHUB_PERSONAL_ACCESS_TOKEN",
47
+ "ghcr.io/modelcontextprotocol/servers/github:latest"
48
+ ],
49
+ "env": {
50
+ "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_PERSONAL_ACCESS_TOKEN}"
51
+ }
52
+ }
53
+ }
54
+ }
55
+ ```
56
+
57
+ > **Note:** The `command` is `docker`, and the rest are arguments passed to it.
58
+ > We map the local environment variable into the container so your secret isn't
59
+ > hardcoded in the config file.
60
+
61
+ ## How to verify the connection
62
+
63
+ Restart Gemini CLI. It will automatically try to start the defined servers.
64
+
65
+ **Command:** `/mcp list`
66
+
67
+ You should see: `✓ github: docker ... - Connected`
68
+
69
+ If you see `Disconnected` or an error, check that Docker is running and your API
70
+ token is valid.
71
+
72
+ ## How to use the new tools
73
+
74
+ Now that the server is running, the agent has new capabilities ("tools"). You
75
+ don't need to learn special commands; just ask in natural language.
76
+
77
+ ### Scenario: Listing pull requests
78
+
79
+ **Prompt:** `List the open PRs in the google/gemini-cli repository.`
80
+
81
+ The agent will:
82
+
83
+ 1. Recognize the request matches a GitHub tool.
84
+ 2. Call `github_list_pull_requests`.
85
+ 3. Present the data to you.
86
+
87
+ ### Scenario: Creating an issue
88
+
89
+ **Prompt:**
90
+ `Create an issue in my repo titled "Bug: Login fails" with the description "See logs".`
91
+
92
+ ## Troubleshooting
93
+
94
+ - **Server won't start?** Try running the docker command manually in your
95
+ terminal to see if it prints an error (e.g., "image not found").
96
+ - **Tools not found?** Run `/mcp refresh` to force the CLI to re-query the
97
+ server for its capabilities.
98
+
99
+ ## Next steps
100
+
101
+ - Explore the [MCP servers reference](../../tools/mcp-server.md) to learn about
102
+ SSE and HTTP transports for remote servers.
103
+ - Browse the
104
+ [official MCP server list](https://github.com/modelcontextprotocol/servers) to
105
+ find connectors for Slack, Postgres, Google Drive, and more.
@@ -0,0 +1,126 @@
1
+ # Manage context and memory
2
+
3
+ Control what Gemini CLI knows about you and your projects. In this guide, you'll
4
+ learn how to define project-wide rules with `GEMINI.md`, teach the agent
5
+ persistent facts, and inspect the active context.
6
+
7
+ ## Prerequisites
8
+
9
+ - Gemini CLI installed and authenticated.
10
+ - A project directory where you want to enforce specific rules.
11
+
12
+ ## Why manage context?
13
+
14
+ Out of the box, Gemini CLI is smart but generic. It doesn't know your preferred
15
+ testing framework, your indentation style, or that you hate using `any` in
16
+ TypeScript. Context management solves this by giving the agent persistent
17
+ memory.
18
+
19
+ You'll use these features when you want to:
20
+
21
+ - **Enforce standards:** Ensure every generated file matches your team's style
22
+ guide.
23
+ - **Set a persona:** Tell the agent to act as a "Senior Rust Engineer" or "QA
24
+ Specialist."
25
+ - **Remember facts:** Save details like "My database port is 5432" so you don't
26
+ have to repeat them.
27
+
28
+ ## How to define project-wide rules (GEMINI.md)
29
+
30
+ The most powerful way to control the agent's behavior is through `GEMINI.md`
31
+ files. These are Markdown files containing instructions that are automatically
32
+ loaded into every conversation.
33
+
34
+ ### Scenario: Create a project context file
35
+
36
+ 1. In the root of your project, create a file named `GEMINI.md`.
37
+
38
+ 2. Add your instructions:
39
+
40
+ ```markdown
41
+ # Project Instructions
42
+
43
+ - **Framework:** We use React with Vite.
44
+ - **Styling:** Use Tailwind CSS for all styling. Do not write custom CSS.
45
+ - **Testing:** All new components must include a Vitest unit test.
46
+ - **Tone:** Be concise. Don't explain basic React concepts.
47
+ ```
48
+
49
+ 3. Start a new session. Gemini CLI will now know these rules automatically.
50
+
51
+ ### Scenario: Using the hierarchy
52
+
53
+ Context is loaded hierarchically. This allows you to have general rules for
54
+ everything and specific rules for sub-projects.
55
+
56
+ 1. **Global:** `~/.gemini/GEMINI.md` (Rules for _every_ project you work on).
57
+ 2. **Project Root:** `./GEMINI.md` (Rules for the current repository).
58
+ 3. **Subdirectory:** `./src/GEMINI.md` (Rules specific to the `src` folder).
59
+
60
+ **Example:** You might set "Always use strict typing" in your global config, but
61
+ "Use Python 3.11" only in your backend repository.
62
+
63
+ ## How to teach the agent facts (Memory)
64
+
65
+ Sometimes you don't want to write a config file. You just want to tell the agent
66
+ something once and have it remember forever. You can do this naturally in chat.
67
+
68
+ ### Scenario: Saving a memory
69
+
70
+ Just tell the agent to remember something.
71
+
72
+ **Prompt:** `Remember that I prefer using 'const' over 'let' wherever possible.`
73
+
74
+ The agent will use the `save_memory` tool to store this fact in your global
75
+ memory file.
76
+
77
+ **Prompt:** `Save the fact that the staging server IP is 10.0.0.5.`
78
+
79
+ ### Scenario: Using memory in conversation
80
+
81
+ Once a fact is saved, you don't need to invoke it explicitly. The agent "knows"
82
+ it.
83
+
84
+ **Next Prompt:** `Write a script to deploy to staging.`
85
+
86
+ **Agent Response:** "I'll write a script to deploy to **10.0.0.5**..."
87
+
88
+ ## How to manage and inspect context
89
+
90
+ As your project grows, you might want to see exactly what instructions the agent
91
+ is following.
92
+
93
+ ### Scenario: View active context
94
+
95
+ To see the full, concatenated set of instructions currently loaded (from all
96
+ `GEMINI.md` files and saved memories), use the `/memory show` command.
97
+
98
+ **Command:** `/memory show`
99
+
100
+ This prints the raw text the model receives at the start of the session. It's
101
+ excellent for debugging why the agent might be ignoring a rule.
102
+
103
+ ### Scenario: Refresh context
104
+
105
+ If you edit a `GEMINI.md` file while a session is running, the agent won't know
106
+ immediately. Force a reload with:
107
+
108
+ **Command:** `/memory refresh`
109
+
110
+ ## Best practices
111
+
112
+ - **Keep it focused:** Don't dump your entire internal wiki into `GEMINI.md`.
113
+ Keep instructions actionable and relevant to code generation.
114
+ - **Use negative constraints:** Explicitly telling the agent what _not_ to do
115
+ (e.g., "Do not use class components") is often more effective than vague
116
+ positive instructions.
117
+ - **Review often:** Periodically check your `GEMINI.md` files to remove outdated
118
+ rules.
119
+
120
+ ## Next steps
121
+
122
+ - Learn about [Session management](session-management.md) to see how short-term
123
+ history works.
124
+ - Explore the [Command reference](../../cli/commands.md) for more `/memory`
125
+ options.
126
+ - Read the technical spec for [Project context](../../cli/gemini-md.md).
@@ -0,0 +1,105 @@
1
+ # Manage sessions and history
2
+
3
+ Resume, browse, and rewind your conversations with Gemini CLI. In this guide,
4
+ you'll learn how to switch between tasks, manage your session history, and undo
5
+ mistakes using the rewind feature.
6
+
7
+ ## Prerequisites
8
+
9
+ - Gemini CLI installed and authenticated.
10
+ - At least one active or past session.
11
+
12
+ ## How to resume where you left off
13
+
14
+ It's common to switch context—maybe you're waiting for a build and want to work
15
+ on a different feature. Gemini makes it easy to jump back in.
16
+
17
+ ### Scenario: Resume the last session
18
+
19
+ The fastest way to pick up your most recent work is with the `--resume` flag (or
20
+ `-r`).
21
+
22
+ ```bash
23
+ gemini -r
24
+ ```
25
+
26
+ This restores your chat history and memory, so you can say "Continue with the
27
+ next step" immediately.
28
+
29
+ ### Scenario: Browse past sessions
30
+
31
+ If you want to find a specific conversation from yesterday, use the interactive
32
+ browser.
33
+
34
+ **Command:** `/resume`
35
+
36
+ This opens a searchable list of all your past sessions. You'll see:
37
+
38
+ - A timestamp (e.g., "2 hours ago").
39
+ - The first user message (helping you identify the topic).
40
+ - The number of turns in the conversation.
41
+
42
+ Select a session and press **Enter** to load it.
43
+
44
+ ## How to manage your workspace
45
+
46
+ Over time, you'll accumulate a lot of history. Keeping your session list clean
47
+ helps you find what you need.
48
+
49
+ ### Scenario: Deleting sessions
50
+
51
+ In the `/resume` browser, navigate to a session you no longer need and press
52
+ **x**. This permanently deletes the history for that specific conversation.
53
+
54
+ You can also manage sessions from the command line:
55
+
56
+ ```bash
57
+ # List all sessions with their IDs
58
+ gemini --list-sessions
59
+
60
+ # Delete a specific session by ID or index
61
+ gemini --delete-session 1
62
+ ```
63
+
64
+ ## How to rewind time (Undo mistakes)
65
+
66
+ Gemini CLI's **Rewind** feature is like `Ctrl+Z` for your workflow.
67
+
68
+ ### Scenario: Triggering rewind
69
+
70
+ At any point in a chat, type `/rewind` or press **Esc** twice.
71
+
72
+ ### Scenario: Choosing a restore point
73
+
74
+ You'll see a list of your recent interactions. Select the point _before_ the
75
+ undesired changes occurred.
76
+
77
+ ### Scenario: Choosing what to revert
78
+
79
+ Gemini gives you granular control over the undo process. You can choose to:
80
+
81
+ 1. **Rewind conversation:** Only remove the chat history. The files stay
82
+ changed. (Useful if the code is good but the chat got off track).
83
+ 2. **Revert code changes:** Keep the chat history but undo the file edits.
84
+ (Useful if you want to keep the context but retry the implementation).
85
+ 3. **Rewind both:** Restore everything to exactly how it was.
86
+
87
+ ## How to fork conversations
88
+
89
+ Sometimes you want to try two different approaches to the same problem.
90
+
91
+ 1. Start a session and get to a decision point.
92
+ 2. Save the current state with `/chat save decision-point`.
93
+ 3. Try your first approach.
94
+ 4. Later, use `/chat resume decision-point` to fork the conversation back to
95
+ that moment and try a different approach.
96
+
97
+ This creates a new branch of history without losing your original work.
98
+
99
+ ## Next steps
100
+
101
+ - Learn about [Checkpointing](../../cli/checkpointing.md) to understand the
102
+ underlying safety mechanism.
103
+ - Explore [Task planning](task-planning.md) to keep complex sessions organized.
104
+ - See the [Command reference](../../cli/commands.md) for all `/chat` and
105
+ `/resume` options.