@dgxo/mashadevcli 1.1.0

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 (140) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +393 -0
  3. package/bundle/builtin/skill-creator/SKILL.md +382 -0
  4. package/bundle/builtin/skill-creator/scripts/init_skill.cjs +239 -0
  5. package/bundle/builtin/skill-creator/scripts/package_skill.cjs +131 -0
  6. package/bundle/builtin/skill-creator/scripts/validate_skill.cjs +131 -0
  7. package/bundle/docs/CONTRIBUTING.md +1 -0
  8. package/bundle/docs/admin/enterprise-controls.md +115 -0
  9. package/bundle/docs/assets/connected_devtools.png +0 -0
  10. package/bundle/docs/assets/gemini-screenshot.png +0 -0
  11. package/bundle/docs/assets/monitoring-dashboard-logs.png +0 -0
  12. package/bundle/docs/assets/monitoring-dashboard-metrics.png +0 -0
  13. package/bundle/docs/assets/monitoring-dashboard-overview.png +0 -0
  14. package/bundle/docs/assets/release_patch.png +0 -0
  15. package/bundle/docs/assets/theme-ansi-light.png +0 -0
  16. package/bundle/docs/assets/theme-ansi.png +0 -0
  17. package/bundle/docs/assets/theme-atom-one.png +0 -0
  18. package/bundle/docs/assets/theme-ayu-light.png +0 -0
  19. package/bundle/docs/assets/theme-ayu.png +0 -0
  20. package/bundle/docs/assets/theme-custom.png +0 -0
  21. package/bundle/docs/assets/theme-default-light.png +0 -0
  22. package/bundle/docs/assets/theme-default.png +0 -0
  23. package/bundle/docs/assets/theme-dracula.png +0 -0
  24. package/bundle/docs/assets/theme-github-light.png +0 -0
  25. package/bundle/docs/assets/theme-github.png +0 -0
  26. package/bundle/docs/assets/theme-google-light.png +0 -0
  27. package/bundle/docs/assets/theme-xcode-light.png +0 -0
  28. package/bundle/docs/changelogs/index.md +867 -0
  29. package/bundle/docs/changelogs/latest.md +208 -0
  30. package/bundle/docs/changelogs/preview.md +187 -0
  31. package/bundle/docs/cli/checkpointing.md +93 -0
  32. package/bundle/docs/cli/cli-reference.md +115 -0
  33. package/bundle/docs/cli/creating-skills.md +80 -0
  34. package/bundle/docs/cli/custom-commands.md +327 -0
  35. package/bundle/docs/cli/enterprise.md +604 -0
  36. package/bundle/docs/cli/gemini-ignore.md +71 -0
  37. package/bundle/docs/cli/gemini-md.md +116 -0
  38. package/bundle/docs/cli/generation-settings.md +210 -0
  39. package/bundle/docs/cli/headless.md +50 -0
  40. package/bundle/docs/cli/model-routing.md +42 -0
  41. package/bundle/docs/cli/model.md +53 -0
  42. package/bundle/docs/cli/plan-mode.md +375 -0
  43. package/bundle/docs/cli/rewind.md +51 -0
  44. package/bundle/docs/cli/sandbox.md +257 -0
  45. package/bundle/docs/cli/session-management.md +184 -0
  46. package/bundle/docs/cli/settings.md +165 -0
  47. package/bundle/docs/cli/skills.md +134 -0
  48. package/bundle/docs/cli/system-prompt.md +125 -0
  49. package/bundle/docs/cli/telemetry.md +922 -0
  50. package/bundle/docs/cli/themes.md +269 -0
  51. package/bundle/docs/cli/token-caching.md +20 -0
  52. package/bundle/docs/cli/trusted-folders.md +126 -0
  53. package/bundle/docs/cli/tutorials/automation.md +283 -0
  54. package/bundle/docs/cli/tutorials/file-management.md +142 -0
  55. package/bundle/docs/cli/tutorials/mcp-setup.md +113 -0
  56. package/bundle/docs/cli/tutorials/memory-management.md +126 -0
  57. package/bundle/docs/cli/tutorials/session-management.md +105 -0
  58. package/bundle/docs/cli/tutorials/shell-commands.md +107 -0
  59. package/bundle/docs/cli/tutorials/skills-getting-started.md +110 -0
  60. package/bundle/docs/cli/tutorials/task-planning.md +93 -0
  61. package/bundle/docs/cli/tutorials/web-tools.md +78 -0
  62. package/bundle/docs/core/index.md +107 -0
  63. package/bundle/docs/core/remote-agents.md +84 -0
  64. package/bundle/docs/core/subagents.md +307 -0
  65. package/bundle/docs/examples/proxy-script.md +83 -0
  66. package/bundle/docs/extensions/best-practices.md +188 -0
  67. package/bundle/docs/extensions/index.md +61 -0
  68. package/bundle/docs/extensions/reference.md +333 -0
  69. package/bundle/docs/extensions/releasing.md +154 -0
  70. package/bundle/docs/extensions/writing-extensions.md +308 -0
  71. package/bundle/docs/get-started/authentication.md +402 -0
  72. package/bundle/docs/get-started/examples.md +139 -0
  73. package/bundle/docs/get-started/gemini-3.md +115 -0
  74. package/bundle/docs/get-started/index.md +82 -0
  75. package/bundle/docs/get-started/installation.md +174 -0
  76. package/bundle/docs/hooks/best-practices.md +709 -0
  77. package/bundle/docs/hooks/index.md +164 -0
  78. package/bundle/docs/hooks/reference.md +330 -0
  79. package/bundle/docs/hooks/writing-hooks.md +474 -0
  80. package/bundle/docs/ide-integration/ide-companion-spec.md +267 -0
  81. package/bundle/docs/ide-integration/index.md +224 -0
  82. package/bundle/docs/index.md +141 -0
  83. package/bundle/docs/integration-tests.md +211 -0
  84. package/bundle/docs/issue-and-pr-automation.md +172 -0
  85. package/bundle/docs/local-development.md +134 -0
  86. package/bundle/docs/mermaid/context.mmd +103 -0
  87. package/bundle/docs/mermaid/render-path.mmd +64 -0
  88. package/bundle/docs/npm.md +62 -0
  89. package/bundle/docs/redirects.json +20 -0
  90. package/bundle/docs/reference/commands.md +526 -0
  91. package/bundle/docs/reference/configuration.md +1786 -0
  92. package/bundle/docs/reference/keyboard-shortcuts.md +164 -0
  93. package/bundle/docs/reference/memport.md +246 -0
  94. package/bundle/docs/reference/policy-engine.md +364 -0
  95. package/bundle/docs/reference/tools.md +106 -0
  96. package/bundle/docs/release-confidence.md +164 -0
  97. package/bundle/docs/releases.md +540 -0
  98. package/bundle/docs/resources/faq.md +175 -0
  99. package/bundle/docs/resources/quota-and-pricing.md +165 -0
  100. package/bundle/docs/resources/tos-privacy.md +102 -0
  101. package/bundle/docs/resources/troubleshooting.md +176 -0
  102. package/bundle/docs/resources/uninstall.md +56 -0
  103. package/bundle/docs/sidebar.json +233 -0
  104. package/bundle/docs/tools/activate-skill.md +43 -0
  105. package/bundle/docs/tools/ask-user.md +95 -0
  106. package/bundle/docs/tools/file-system.md +129 -0
  107. package/bundle/docs/tools/internal-docs.md +46 -0
  108. package/bundle/docs/tools/mcp-server.md +1150 -0
  109. package/bundle/docs/tools/memory.md +35 -0
  110. package/bundle/docs/tools/planning.md +58 -0
  111. package/bundle/docs/tools/shell.md +216 -0
  112. package/bundle/docs/tools/todos.md +35 -0
  113. package/bundle/docs/tools/web-fetch.md +35 -0
  114. package/bundle/docs/tools/web-search.md +32 -0
  115. package/bundle/docs/update/update-guide.md +111 -0
  116. package/bundle/masha.js +563471 -0
  117. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/client/main.js +89 -0
  118. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.d.ts +7 -0
  119. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.js +9 -0
  120. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.js.map +1 -0
  121. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.d.ts +48 -0
  122. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.js +299 -0
  123. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.js.map +1 -0
  124. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.d.ts +36 -0
  125. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.js +7 -0
  126. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.js.map +1 -0
  127. package/bundle/node_modules/@dgxo/mashadevcli-devtools/package.json +32 -0
  128. package/bundle/policies/conseca.toml +6 -0
  129. package/bundle/policies/discovered.toml +8 -0
  130. package/bundle/policies/plan.toml +109 -0
  131. package/bundle/policies/read-only.toml +53 -0
  132. package/bundle/policies/write.toml +80 -0
  133. package/bundle/policies/yolo.toml +54 -0
  134. package/bundle/sandbox-macos-permissive-open.sb +27 -0
  135. package/bundle/sandbox-macos-permissive-proxied.sb +37 -0
  136. package/bundle/sandbox-macos-restrictive-open.sb +96 -0
  137. package/bundle/sandbox-macos-restrictive-proxied.sb +98 -0
  138. package/bundle/sandbox-macos-strict-open.sb +131 -0
  139. package/bundle/sandbox-macos-strict-proxied.sb +133 -0
  140. package/package.json +169 -0
@@ -0,0 +1,93 @@
1
+ # Plan tasks with todos
2
+
3
+ Keep complex jobs on the rails with Gemini CLI's built-in task planning. In this
4
+ guide, you'll learn how to ask for a plan, execute it step-by-step, and monitor
5
+ progress with the todo list.
6
+
7
+ ## Prerequisites
8
+
9
+ - Gemini CLI installed and authenticated.
10
+ - A complex task in mind (e.g., a multi-file refactor or new feature).
11
+
12
+ ## Why use task planning?
13
+
14
+ Standard LLMs have a limited context window and can "forget" the original goal
15
+ after 10 turns of code generation. Task planning provides:
16
+
17
+ 1. **Visibility:** You see exactly what the agent plans to do _before_ it
18
+ starts.
19
+ 2. **Focus:** The agent knows exactly which step it's working on right now.
20
+ 3. **Resilience:** If the agent gets stuck, the plan helps it get back on
21
+ track.
22
+
23
+ ## How to ask for a plan
24
+
25
+ The best way to trigger task planning is to explicitly ask for it.
26
+
27
+ **Prompt:**
28
+ `I want to migrate this project from JavaScript to TypeScript. Please make a plan first.`
29
+
30
+ Gemini will analyze your codebase and use the `write_todos` tool to generate a
31
+ structured list.
32
+
33
+ **Example Plan:**
34
+
35
+ 1. [ ] Create `tsconfig.json`.
36
+ 2. [ ] Rename `.js` files to `.ts`.
37
+ 3. [ ] Fix type errors in `utils.js`.
38
+ 4. [ ] Fix type errors in `server.js`.
39
+ 5. [ ] Verify build passes.
40
+
41
+ ## How to review and iterate
42
+
43
+ Once the plan is generated, it appears in your CLI. Review it.
44
+
45
+ - **Missing steps?** Tell the agent: "You forgot to add a step for installing
46
+ `@types/node`."
47
+ - **Wrong order?** Tell the agent: "Let's verify the build _after_ each file,
48
+ not just at the end."
49
+
50
+ The agent will update the todo list dynamically.
51
+
52
+ ## How to execute the plan
53
+
54
+ Tell the agent to proceed.
55
+
56
+ **Prompt:** `Looks good. Start with the first step.`
57
+
58
+ As the agent works, you'll see the todo list update in real-time above the input
59
+ box.
60
+
61
+ - **Current focus:** The active task is highlighted (e.g.,
62
+ `[IN_PROGRESS] Create tsconfig.json`).
63
+ - **Progress:** Completed tasks are marked as done.
64
+
65
+ ## How to monitor progress (`Ctrl+T`)
66
+
67
+ For a long-running task, the full todo list might be hidden to save space. You
68
+ can toggle the full view at any time.
69
+
70
+ **Action:** Press **Ctrl+T**.
71
+
72
+ This shows the complete list, including pending, in-progress, and completed
73
+ items. It's a great way to check "how much is left?" without scrolling back up.
74
+
75
+ ## How to handle unexpected changes
76
+
77
+ Plans change. Maybe you discover a library is incompatible halfway through.
78
+
79
+ **Prompt:**
80
+ `Actually, let's skip the 'server.js' refactor for now. It's too risky.`
81
+
82
+ The agent will mark that task as `cancelled` or remove it, and move to the next
83
+ item. This dynamic adjustment is what makes the todo system powerful—it's a
84
+ living document, not a static text block.
85
+
86
+ ## Next steps
87
+
88
+ - Explore [Session management](session-management.md) to save your plan and
89
+ finish it tomorrow.
90
+ - See the [Todo tool reference](../../tools/todos.md) for technical schema
91
+ details.
92
+ - Learn about [Memory management](memory-management.md) to persist planning
93
+ preferences (e.g., "Always create a test plan first").
@@ -0,0 +1,78 @@
1
+ # Web search and fetch
2
+
3
+ Access the live internet directly from your prompt. In this guide, you'll learn
4
+ how to search for up-to-date documentation, fetch deep context from specific
5
+ URLs, and apply that knowledge to your code.
6
+
7
+ ## Prerequisites
8
+
9
+ - Gemini CLI installed and authenticated.
10
+ - An internet connection.
11
+
12
+ ## How to research new technologies
13
+
14
+ Imagine you want to use a library released yesterday. The model doesn't know
15
+ about it yet. You need to teach it.
16
+
17
+ ### Scenario: Find documentation
18
+
19
+ **Prompt:**
20
+ `Search for the 'Bun 1.0' release notes and summarize the key changes.`
21
+
22
+ Gemini uses the `google_web_search` tool to find relevant pages and synthesizes
23
+ an answer. This "grounding" process ensures the agent isn't hallucinating
24
+ features that don't exist.
25
+
26
+ **Prompt:** `Find the documentation for the 'React Router v7' loader API.`
27
+
28
+ ## How to fetch deep context
29
+
30
+ Search gives you a summary, but sometimes you need the raw details. The
31
+ `web_fetch` tool lets you feed a specific URL directly into the agent's context.
32
+
33
+ ### Scenario: Reading a blog post
34
+
35
+ You found a blog post with the exact solution to your bug.
36
+
37
+ **Prompt:**
38
+ `Read https://example.com/fixing-memory-leaks and explain how to apply it to my code.`
39
+
40
+ Gemini will retrieve the page content (stripping away ads and navigation) and
41
+ use it to answer your question.
42
+
43
+ ### Scenario: Comparing sources
44
+
45
+ You can even fetch multiple pages to compare approaches.
46
+
47
+ **Prompt:**
48
+ `Compare the pagination patterns in https://api.example.com/v1/docs and https://api.example.com/v2/docs.`
49
+
50
+ ## How to apply knowledge to code
51
+
52
+ The real power comes when you combine web tools with file editing.
53
+
54
+ **Workflow:**
55
+
56
+ 1. **Search:** "How do I implement auth with Supabase?"
57
+ 2. **Fetch:** "Read this guide: https://supabase.com/docs/guides/auth."
58
+ 3. **Implement:** "Great. Now use that pattern to create an `auth.ts` file in
59
+ my project."
60
+
61
+ ## How to troubleshoot errors
62
+
63
+ When you hit an obscure error message, paste it into the chat.
64
+
65
+ **Prompt:**
66
+ `I'm getting 'Error: hydration mismatch' in Next.js. Search for recent solutions.`
67
+
68
+ The agent will search sources such as GitHub issues, StackOverflow, and forums
69
+ to find relevant fixes that might be too new to be in its base training set.
70
+
71
+ ## Next steps
72
+
73
+ - Explore [File management](file-management.md) to see how to apply the code you
74
+ generate.
75
+ - See the [Web search tool reference](../../tools/web-search.md) for citation
76
+ details.
77
+ - See the [Web fetch tool reference](../../tools/web-fetch.md) for technical
78
+ limitations.
@@ -0,0 +1,107 @@
1
+ # Gemini CLI core
2
+
3
+ Gemini CLI's core package (`packages/core`) is the backend portion of Gemini
4
+ CLI, handling communication with the Gemini API, managing tools, and processing
5
+ requests sent from `packages/cli`. For a general overview of Gemini CLI, see the
6
+ [main documentation page](../index.md).
7
+
8
+ ## Navigating this section
9
+
10
+ - **[Sub-agents (experimental)](./subagents.md):** Learn how to create and use
11
+ specialized sub-agents for complex tasks.
12
+ - **[Core tools reference](../reference/tools.md):** Information on how tools
13
+ are defined, registered, and used by the core.
14
+ - **[Memory Import Processor](../reference/memport.md):** Documentation for the
15
+ modular GEMINI.md import feature using @file.md syntax.
16
+ - **[Policy Engine](../reference/policy-engine.md):** Use the Policy Engine for
17
+ fine-grained control over tool execution.
18
+
19
+ ## Role of the core
20
+
21
+ While the `packages/cli` portion of Gemini CLI provides the user interface,
22
+ `packages/core` is responsible for:
23
+
24
+ - **Gemini API interaction:** Securely communicating with the Google Gemini API,
25
+ sending user prompts, and receiving model responses.
26
+ - **Prompt engineering:** Constructing effective prompts for the Gemini model,
27
+ potentially incorporating conversation history, tool definitions, and
28
+ instructional context from `GEMINI.md` files.
29
+ - **Tool management & orchestration:**
30
+ - Registering available tools (e.g., file system tools, shell command
31
+ execution).
32
+ - Interpreting tool use requests from the Gemini model.
33
+ - Executing the requested tools with the provided arguments.
34
+ - Returning tool execution results to the Gemini model for further processing.
35
+ - **Session and state management:** Keeping track of the conversation state,
36
+ including history and any relevant context required for coherent interactions.
37
+ - **Configuration:** Managing core-specific configurations, such as API key
38
+ access, model selection, and tool settings.
39
+
40
+ ## Security considerations
41
+
42
+ The core plays a vital role in security:
43
+
44
+ - **API key management:** It handles the `GEMINI_API_KEY` and ensures it's used
45
+ securely when communicating with the Gemini API.
46
+ - **Tool execution:** When tools interact with the local system (e.g.,
47
+ `run_shell_command`), the core (and its underlying tool implementations) must
48
+ do so with appropriate caution, often involving sandboxing mechanisms to
49
+ prevent unintended modifications.
50
+
51
+ ## Chat history compression
52
+
53
+ To ensure that long conversations don't exceed the token limits of the Gemini
54
+ model, the core includes a chat history compression feature.
55
+
56
+ When a conversation approaches the token limit for the configured model, the
57
+ core automatically compresses the conversation history before sending it to the
58
+ model. This compression is designed to be lossless in terms of the information
59
+ conveyed, but it reduces the overall number of tokens used.
60
+
61
+ You can find the token limits for each model in the
62
+ [Google AI documentation](https://ai.google.dev/gemini-api/docs/models).
63
+
64
+ ## Model fallback
65
+
66
+ Gemini CLI includes a model fallback mechanism to ensure that you can continue
67
+ to use the CLI even if the default "pro" model is rate-limited.
68
+
69
+ If you are using the default "pro" model and the CLI detects that you are being
70
+ rate-limited, it automatically switches to the "flash" model for the current
71
+ session. This allows you to continue working without interruption.
72
+
73
+ Internal utility calls that use `gemini-2.5-flash-lite` (for example, prompt
74
+ completion and classification) silently fall back to `gemini-2.5-flash` and
75
+ `gemini-2.5-pro` when quota is exhausted, without changing the configured model.
76
+
77
+ ## File discovery service
78
+
79
+ The file discovery service is responsible for finding files in the project that
80
+ are relevant to the current context. It is used by the `@` command and other
81
+ tools that need to access files.
82
+
83
+ ## Memory discovery service
84
+
85
+ The memory discovery service is responsible for finding and loading the
86
+ `GEMINI.md` files that provide context to the model. It searches for these files
87
+ in a hierarchical manner, starting from the current working directory and moving
88
+ up to the project root and the user's home directory. It also searches in
89
+ subdirectories.
90
+
91
+ This allows you to have global, project-level, and component-level context
92
+ files, which are all combined to provide the model with the most relevant
93
+ information.
94
+
95
+ You can use the [`/memory` command](../reference/commands.md) to `show`, `add`,
96
+ and `refresh` the content of loaded `GEMINI.md` files.
97
+
98
+ ## Citations
99
+
100
+ When Gemini finds it is reciting text from a source it appends the citation to
101
+ the output. It is enabled by default but can be disabled with the
102
+ ui.showCitations setting.
103
+
104
+ - When proposing an edit the citations display before giving the user the option
105
+ to accept.
106
+ - Citations are always shown at the end of the model’s turn.
107
+ - We deduplicate citations and display them in alphabetical order.
@@ -0,0 +1,84 @@
1
+ # Remote Subagents (experimental)
2
+
3
+ Gemini CLI supports connecting to remote subagents using the Agent-to-Agent
4
+ (A2A) protocol. This allows Gemini CLI to interact with other agents, expanding
5
+ its capabilities by delegating tasks to remote services.
6
+
7
+ Gemini CLI can connect to any compliant A2A agent. You can find samples of A2A
8
+ agents in the following repositories:
9
+
10
+ - [ADK Samples (Python)](https://github.com/google/adk-samples/tree/main/python)
11
+ - [ADK Python Contributing Samples](https://github.com/google/adk-python/tree/main/contributing/samples)
12
+
13
+ > **Note: Remote subagents are currently an experimental feature.**
14
+
15
+ ## Configuration
16
+
17
+ To use remote subagents, you must explicitly enable them in your
18
+ `settings.json`:
19
+
20
+ ```json
21
+ {
22
+ "experimental": {
23
+ "enableAgents": true
24
+ }
25
+ }
26
+ ```
27
+
28
+ ## Defining remote subagents
29
+
30
+ Remote subagents are defined as Markdown files (`.md`) with YAML frontmatter.
31
+ You can place them in:
32
+
33
+ 1. **Project-level:** `.gemini/agents/*.md` (Shared with your team)
34
+ 2. **User-level:** `~/.gemini/agents/*.md` (Personal agents)
35
+
36
+ ### Configuration schema
37
+
38
+ | Field | Type | Required | Description |
39
+ | :--------------- | :----- | :------- | :------------------------------------------------------------------------------------------------------------- |
40
+ | `kind` | string | Yes | Must be `remote`. |
41
+ | `name` | string | Yes | A unique name for the agent. Must be a valid slug (lowercase letters, numbers, hyphens, and underscores only). |
42
+ | `agent_card_url` | string | Yes | The URL to the agent's A2A card endpoint. |
43
+
44
+ ### Single-subagent example
45
+
46
+ ```markdown
47
+ ---
48
+ kind: remote
49
+ name: my-remote-agent
50
+ agent_card_url: https://example.com/agent-card
51
+ ---
52
+ ```
53
+
54
+ ### Multi-subagent example
55
+
56
+ The loader explicitly supports multiple remote subagents defined in a single
57
+ Markdown file.
58
+
59
+ ```markdown
60
+ ---
61
+ - kind: remote
62
+ name: remote-1
63
+ agent_card_url: https://example.com/1
64
+ - kind: remote
65
+ name: remote-2
66
+ agent_card_url: https://example.com/2
67
+ ---
68
+ ```
69
+
70
+ > **Note:** Mixed local and remote agents, or multiple local agents, are not
71
+ > supported in a single file; the list format is currently remote-only.
72
+
73
+ ## Managing Subagents
74
+
75
+ Users can manage subagents using the following commands within the Gemini CLI:
76
+
77
+ - `/agents list`: Displays all available local and remote subagents.
78
+ - `/agents refresh`: Reloads the agent registry. Use this after adding or
79
+ modifying agent definition files.
80
+ - `/agents enable <agent_name>`: Enables a specific subagent.
81
+ - `/agents disable <agent_name>`: Disables a specific subagent.
82
+
83
+ > **Tip:** You can use the `@cli_help` agent within Gemini CLI for assistance
84
+ > with configuring subagents.
@@ -0,0 +1,307 @@
1
+ # Subagents (experimental)
2
+
3
+ Subagents are specialized agents that operate within your main Gemini CLI
4
+ session. They are designed to handle specific, complex tasks—like deep codebase
5
+ analysis, documentation lookup, or domain-specific reasoning—without cluttering
6
+ the main agent's context or toolset.
7
+
8
+ > **Note: Subagents are currently an experimental feature.**
9
+ >
10
+ > To use custom subagents, you must explicitly enable them in your
11
+ > `settings.json`:
12
+ >
13
+ > ```json
14
+ > {
15
+ > "experimental": { "enableAgents": true }
16
+ > }
17
+ > ```
18
+ >
19
+ > **Warning:** Subagents currently operate in
20
+ > ["YOLO mode"](../reference/configuration.md#command-line-arguments), meaning
21
+ > they may execute tools without individual user confirmation for each step.
22
+ > Proceed with caution when defining agents with powerful tools like
23
+ > `run_shell_command` or `write_file`.
24
+
25
+ ## What are subagents?
26
+
27
+ Subagents are "specialists" that the main Gemini agent can hire for a specific
28
+ job.
29
+
30
+ - **Focused context:** Each subagent has its own system prompt and persona.
31
+ - **Specialized tools:** Subagents can have a restricted or specialized set of
32
+ tools.
33
+ - **Independent context window:** Interactions with a subagent happen in a
34
+ separate context loop, which saves tokens in your main conversation history.
35
+
36
+ Subagents are exposed to the main agent as a tool of the same name. When the
37
+ main agent calls the tool, it delegates the task to the subagent. Once the
38
+ subagent completes its task, it reports back to the main agent with its
39
+ findings.
40
+
41
+ ## Built-in subagents
42
+
43
+ Gemini CLI comes with the following built-in subagents:
44
+
45
+ ### Codebase Investigator
46
+
47
+ - **Name:** `codebase_investigator`
48
+ - **Purpose:** Analyze the codebase, reverse engineer, and understand complex
49
+ dependencies.
50
+ - **When to use:** "How does the authentication system work?", "Map out the
51
+ dependencies of the `AgentRegistry` class."
52
+ - **Configuration:** Enabled by default. You can configure it in
53
+ `settings.json`. Example (forcing a specific model):
54
+ ```json
55
+ {
56
+ "experimental": {
57
+ "codebaseInvestigatorSettings": {
58
+ "enabled": true,
59
+ "maxNumTurns": 20,
60
+ "model": "gemini-2.5-pro"
61
+ }
62
+ }
63
+ }
64
+ ```
65
+
66
+ ### CLI Help Agent
67
+
68
+ - **Name:** `cli_help`
69
+ - **Purpose:** Get expert knowledge about Gemini CLI itself, its commands,
70
+ configuration, and documentation.
71
+ - **When to use:** "How do I configure a proxy?", "What does the `/rewind`
72
+ command do?"
73
+ - **Configuration:** Enabled by default.
74
+
75
+ ### Generalist Agent
76
+
77
+ - **Name:** `generalist_agent`
78
+ - **Purpose:** Route tasks to the appropriate specialized subagent.
79
+ - **When to use:** Implicitly used by the main agent for routing. Not directly
80
+ invoked by the user.
81
+ - **Configuration:** Enabled by default. No specific configuration options.
82
+
83
+ ### Browser Agent (experimental)
84
+
85
+ - **Name:** `browser_agent`
86
+ - **Purpose:** Automate web browser tasks — navigating websites, filling forms,
87
+ clicking buttons, and extracting information from web pages — using the
88
+ accessibility tree.
89
+ - **When to use:** "Go to example.com and fill out the contact form," "Extract
90
+ the pricing table from this page," "Click the login button and enter my
91
+ credentials."
92
+
93
+ > **Note:** This is a preview feature currently under active development.
94
+
95
+ #### Prerequisites
96
+
97
+ The browser agent requires:
98
+
99
+ - **Chrome** version 144 or later (any recent stable release will work).
100
+ - **Node.js** with `npx` available (used to launch the
101
+ [`chrome-devtools-mcp`](https://www.npmjs.com/package/chrome-devtools-mcp)
102
+ server).
103
+
104
+ #### Enabling the browser agent
105
+
106
+ The browser agent is disabled by default. Enable it in your `settings.json`:
107
+
108
+ ```json
109
+ {
110
+ "agents": {
111
+ "overrides": {
112
+ "browser_agent": {
113
+ "enabled": true
114
+ }
115
+ }
116
+ }
117
+ }
118
+ ```
119
+
120
+ #### Session modes
121
+
122
+ The `sessionMode` setting controls how Chrome is launched and managed. Set it
123
+ under `agents.browser`:
124
+
125
+ ```json
126
+ {
127
+ "agents": {
128
+ "overrides": {
129
+ "browser_agent": {
130
+ "enabled": true
131
+ }
132
+ },
133
+ "browser": {
134
+ "sessionMode": "persistent"
135
+ }
136
+ }
137
+ }
138
+ ```
139
+
140
+ The available modes are:
141
+
142
+ | Mode | Description |
143
+ | :----------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
144
+ | `persistent` | **(Default)** Launches Chrome with a persistent profile stored at `~/.gemini/cli-browser-profile/`. Cookies, history, and settings are preserved between sessions. |
145
+ | `isolated` | Launches Chrome with a temporary profile that is deleted after each session. Use this for clean-state automation. |
146
+ | `existing` | Attaches to an already-running Chrome instance. You must enable remote debugging first by navigating to `chrome://inspect/#remote-debugging` in Chrome. No new browser process is launched. |
147
+
148
+ #### Configuration reference
149
+
150
+ All browser-specific settings go under `agents.browser` in your `settings.json`.
151
+
152
+ | Setting | Type | Default | Description |
153
+ | :------------ | :-------- | :------------- | :---------------------------------------------------------------------------------------------- |
154
+ | `sessionMode` | `string` | `"persistent"` | How Chrome is managed: `"persistent"`, `"isolated"`, or `"existing"`. |
155
+ | `headless` | `boolean` | `false` | Run Chrome in headless mode (no visible window). |
156
+ | `profilePath` | `string` | — | Custom path to a browser profile directory. |
157
+ | `visualModel` | `string` | — | Model override for the visual agent (for example, `"gemini-2.5-computer-use-preview-10-2025"`). |
158
+
159
+ #### Security
160
+
161
+ The browser agent enforces the following security restrictions:
162
+
163
+ - **Blocked URL patterns:** `file://`, `javascript:`, `data:text/html`,
164
+ `chrome://extensions`, and `chrome://settings/passwords` are always blocked.
165
+ - **Sensitive action confirmation:** Actions like form filling, file uploads,
166
+ and form submissions require user confirmation through the standard policy
167
+ engine.
168
+
169
+ #### Visual agent
170
+
171
+ By default, the browser agent interacts with pages through the accessibility
172
+ tree using element `uid` values. For tasks that require visual identification
173
+ (for example, "click the yellow button" or "find the red error message"), you
174
+ can enable the visual agent by setting a `visualModel`:
175
+
176
+ ```json
177
+ {
178
+ "agents": {
179
+ "overrides": {
180
+ "browser_agent": {
181
+ "enabled": true
182
+ }
183
+ },
184
+ "browser": {
185
+ "visualModel": "gemini-2.5-computer-use-preview-10-2025"
186
+ }
187
+ }
188
+ }
189
+ ```
190
+
191
+ When enabled, the agent gains access to the `analyze_screenshot` tool, which
192
+ captures a screenshot and sends it to the vision model for analysis. The model
193
+ returns coordinates and element descriptions that the browser agent uses with
194
+ the `click_at` tool for precise, coordinate-based interactions.
195
+
196
+ > **Note:** The visual agent requires API key or Vertex AI authentication. It is
197
+ > not available when using Google Login.
198
+
199
+ ## Creating custom subagents
200
+
201
+ You can create your own subagents to automate specific workflows or enforce
202
+ specific personas. To use custom subagents, you must enable them in your
203
+ `settings.json`:
204
+
205
+ ```json
206
+ {
207
+ "experimental": {
208
+ "enableAgents": true
209
+ }
210
+ }
211
+ ```
212
+
213
+ ### Agent definition files
214
+
215
+ Custom agents are defined as Markdown files (`.md`) with YAML frontmatter. You
216
+ can place them in:
217
+
218
+ 1. **Project-level:** `.gemini/agents/*.md` (Shared with your team)
219
+ 2. **User-level:** `~/.gemini/agents/*.md` (Personal agents)
220
+
221
+ ### File format
222
+
223
+ The file **MUST** start with YAML frontmatter enclosed in triple-dashes `---`.
224
+ The body of the markdown file becomes the agent's **System Prompt**.
225
+
226
+ **Example: `.gemini/agents/security-auditor.md`**
227
+
228
+ ```markdown
229
+ ---
230
+ name: security-auditor
231
+ description: Specialized in finding security vulnerabilities in code.
232
+ kind: local
233
+ tools:
234
+ - read_file
235
+ - grep_search
236
+ model: gemini-2.5-pro
237
+ temperature: 0.2
238
+ max_turns: 10
239
+ ---
240
+
241
+ You are a ruthless Security Auditor. Your job is to analyze code for potential
242
+ vulnerabilities.
243
+
244
+ Focus on:
245
+
246
+ 1. SQL Injection
247
+ 2. XSS (Cross-Site Scripting)
248
+ 3. Hardcoded credentials
249
+ 4. Unsafe file operations
250
+
251
+ When you find a vulnerability, explain it clearly and suggest a fix. Do not fix
252
+ it yourself; just report it.
253
+ ```
254
+
255
+ ### Configuration schema
256
+
257
+ | Field | Type | Required | Description |
258
+ | :------------- | :----- | :------- | :------------------------------------------------------------------------------------------------------------------------ |
259
+ | `name` | string | Yes | Unique identifier (slug) used as the tool name for the agent. Only lowercase letters, numbers, hyphens, and underscores. |
260
+ | `description` | string | Yes | Short description of what the agent does. This is visible to the main agent to help it decide when to call this subagent. |
261
+ | `kind` | string | No | `local` (default) or `remote`. |
262
+ | `tools` | array | No | List of tool names this agent can use. If omitted, it may have access to a default set. |
263
+ | `model` | string | No | Specific model to use (e.g., `gemini-2.5-pro`). Defaults to `inherit` (uses the main session model). |
264
+ | `temperature` | number | No | Model temperature (0.0 - 2.0). |
265
+ | `max_turns` | number | No | Maximum number of conversation turns allowed for this agent before it must return. Defaults to `15`. |
266
+ | `timeout_mins` | number | No | Maximum execution time in minutes. Defaults to `5`. |
267
+
268
+ ### Optimizing your subagent
269
+
270
+ The main agent's system prompt encourages it to use an expert subagent when one
271
+ is available. It decides whether an agent is a relevant expert based on the
272
+ agent's description. You can improve the reliability with which an agent is used
273
+ by updating the description to more clearly indicate:
274
+
275
+ - Its area of expertise.
276
+ - When it should be used.
277
+ - Some example scenarios.
278
+
279
+ For example, the following subagent description should be called fairly
280
+ consistently for Git operations.
281
+
282
+ > Git expert agent which should be used for all local and remote git operations.
283
+ > For example:
284
+ >
285
+ > - Making commits
286
+ > - Searching for regressions with bisect
287
+ > - Interacting with source control and issues providers such as GitHub.
288
+
289
+ If you need to further tune your subagent, you can do so by selecting the model
290
+ to optimize for with `/model` and then asking the model why it does not think
291
+ that your subagent was called with a specific prompt and the given description.
292
+
293
+ ## Remote subagents (Agent2Agent) (experimental)
294
+
295
+ Gemini CLI can also delegate tasks to remote subagents using the Agent-to-Agent
296
+ (A2A) protocol.
297
+
298
+ > **Note: Remote subagents are currently an experimental feature.**
299
+
300
+ See the [Remote Subagents documentation](/docs/core/remote-agents) for detailed
301
+ configuration and usage instructions.
302
+
303
+ ## Extension subagents
304
+
305
+ Extensions can bundle and distribute subagents. See the
306
+ [Extensions documentation](../extensions/index.md#subagents) for details on how
307
+ to package agents within an extension.