docs: Add setup instructions for API key to README - #1
Merged
Conversation
KeijiBranshi
force-pushed
the
keijibranshi/docs/gemini-api-key
branch
from
April 17, 2025 18:53
5d529c8 to
44eb4ae
Compare
KeijiBranshi
force-pushed
the
keijibranshi/docs/gemini-api-key
branch
from
April 17, 2025 18:57
44eb4ae to
c548068
Compare
keithballinger
pushed a commit
that referenced
this pull request
Jun 13, 2025
yaleh
pushed a commit
to yaleh/gemini-cli
that referenced
this pull request
Jun 29, 2025
hymjay0
added a commit
to hymjay0/gemini-cli
that referenced
this pull request
Jul 17, 2025
This was referenced Jul 22, 2025
bishal-codepros
referenced
this pull request
in bishal-codepros/gemini-cli
Jul 22, 2025
mattKorwel
pushed a commit
that referenced
this pull request
Jul 31, 2025
Added tests for the emacs support.
theshloksschauhan
added a commit
to theshloksschauhan/gemini-cli
that referenced
this pull request
Mar 29, 2026
…iles - Add _meta provenance header to error report JSON files so AV content scanners can identify them as legitimate Gemini CLI artifacts - Move error reports from os.tmpdir() (%%TEMP%%) into the project's ~/.gemini/tmp/<hash>/error-reports/ directory to avoid the google-gemini#1 AV heuristic trigger (structured JSON written to system temp dir) - Auto-create the error-reports directory before writing - Add troubleshooting documentation with AV exclusion instructions and vendor-specific false positive submission links - Update tests to verify _meta presence, key ordering, and dir creation Fixes google-gemini#15404 Related: google-gemini#1907
haunchen
added a commit
to haunchen/gemini-cli
that referenced
this pull request
Mar 31, 2026
- Add m.youtube.com and music.youtube.com subdomain support (google-gemini#1) - Change mimeType from video/* to video/mp4 per Vertex AI docs (google-gemini#2)
18 tasks
Closed
This was referenced Apr 15, 2026
This was referenced Apr 22, 2026
18 tasks
SeunghyunLee1982
referenced
this pull request
in SeunghyunLee1982/gemini-cli
May 17, 2026
Adds a persistent agent swarm primitive behind the `experimental.swarm` settings flag. The main Gemini agent can now spawn long-lived Claude sub-agent instances, send them multiple messages across orchestrator turns (retaining `messages` state), and release them — going beyond the existing one-shot `kind: anthropic` AgentTool delegation. Scope (v1.0): - Sync only. `message` blocks until the session's turn completes. - In-memory `SwarmManager` singleton; sessions die with the process. - Single discriminated `swarm` tool with `action: spawn | message | release | list`. Zod-backed discriminated union. - Read-only tool whitelist by default (`read_file`, `grep_search`, `glob`, `list_directory`, `read_many_files`); per-spawn `tools` override allowed. - Session abort bound to `Config.getAppAbortSignal()` (SIGINT / process exit), NOT the orchestrator turn signal — ending an orchestrator turn does not kill the swarm. - 30-minute idle TTL with background sweep; sessions wedged in `running` past `2 * TTL` are aborted, marked `error`, and kept in `list()` for user debugging. - Feature-flagged off by default. The Anthropic message loop body from `AnthropicAgentInvocation` was extracted into `anthropic-loop.ts` so both the v1 single-shot path and the new long-lived `SwarmSession` share the same tool-use machinery. Design + reviews: - Multi-turn design discussion: `design-loop/swarm-design.md` (Claude + Gemini, Turns 0-4 + Final Synthesis with the locked v1.0 acceptance E2E). - Phase 1 reviews: `design-loop/phase1-review-opus.md`, `design-loop/phase1-review-gemini.md`. - Phase 2 reviews: `design-loop/phase2-review-opus.md`, `design-loop/phase2-review-gemini.md`. Phase 2 review items addressed in this commit: - Gemini #1: TTL sweep no longer deletes stuck-RUNNING sessions — they're aborted + marked ERROR + kept in `list()`. - Opus #1/#3: per-session app-abort listeners now have a disposer that fires from `SwarmSession.release()` and from the TTL-stuck path; no more unbounded listener accumulation across spawn/release cycles. - Opus #2: `appAbortDisposers` (Config) and `appAbortDisposer` (SwarmManager) are nulled out after firing for clarity. - Opus #4: `lastActiveAt` is stamped on RUNNING entry so a legitimate 35-minute turn is not misjudged "stuck" by the 2 * TTL sweep. Acceptance gate: - The locked stateful-continuity E2E is in `packages/core/src/agents/swarm/swarm-continuity.test.ts`. It intercepts the Anthropic SDK at the module boundary and asserts that the THIRD `messages.create` call (Agent A's second turn) sees the prior user+assistant turns in its `messages` array. If session statelessness regresses (e.g. someone resets `messages = []`), the test fails. Validation gates passed: - `npm run typecheck` (all workspaces) - `node scripts/lint.js --eslint` - `node scripts/lint.js --prettier` - `npm run build --workspace=packages/core` - `npm run build --workspace=packages/cli` - `npx vitest run packages/core/src/agents/` (753 passed) - `npx vitest run packages/core/src/agents/swarm/` (18 passed) Deferred to v1.1+ (per the synthesis): - `async: true` spawn + `poll` / `await` actions. - Shared workspace dir at `~/.gemini/swarm/<session_id>/work/`. - Budget guardrails (`max_spend_usd`, `max_total_tokens`). - Cross-process persistence. - Haiku worker reintegration (user policy default stands). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
SeunghyunLee1982
referenced
this pull request
in SeunghyunLee1982/gemini-cli
May 19, 2026
… + /audit) + P1 caps
North-star v1.x milestone per `design-loop/swarm-north-star.md` (LOCKED
2026-05-17). Wires the existing `PolicyEngine` into the swarm primitive so
sub-agent capability is enforced at the runtime, not at the tool-list
whitelist. Plus the two P1 safety caps that were deferred from the live
test report. Phase 5 + 5.1 (commits `ab572fa3c`, `cbfa37206`) are the
baseline; multi-agent reviewer loop (Opus + Gemini) ran before commit and
both verdicts were SHIP.
Area 1 — spawn-time `policy` field. `SwarmActionSchema.spawn` gains an
optional `policy: PolicyRule[]` (max 50 rules per spawn). A new
`SwarmPolicyRuleSchema` mirrors the writable subset of `PolicyRule` in
Zod; `argsPattern` is parsed string → RegExp at validation time. The
manager rewrites each rule's `subagent` (forced to the spawned agent_id),
`source` (forced to `swarm:<agent_id>:spawn`), and `priority` (forced to
`EXTENSION_POLICY_TIER + 0.01 * i`, well below the tier-4 user ceiling)
so an orchestrator cannot raise its own scope. `tools: string[]` (Phase 5)
stays for back-compat — both fields co-exist on a single spawn.
Area 2 — engine wiring verified. The scheduler ALREADY threads `subagent`
end-to-end (`anthropic-loop` → `scheduleAgentTools` →
`Scheduler.context.subagent` → `PolicyEngine.check`). The matching
predicate at `policy-engine.ts:matchRule` was extended to treat
`rule.subagent === '*'` as a wildcard against any non-empty caller —
preserves the existing "undefined subagent on rule = applies to both
main and sub agents" semantics while letting a sidecar policy file
target every sub-agent without enumerating them.
Area 3 — sidecar `<repo>/.gemini/swarm-policy.toml`. Loaded inside
`Config.loadWorkspacePolicies` at `WORKSPACE_POLICY_TIER` (3) — sibling
of the existing `.gemini/policies/*.toml` directory load. Rules without
an explicit `subagent` get `'*'` stamped on insertion so they apply to
every spawned agent (but not the orchestrator, per the matchRule
semantics above). Reloads sweep correctly because the existing tier-3
reload path already clears `WORKSPACE_POLICY_TIER` rules first.
Area 4 — `/audit <agent_id>` slash command. New
`packages/cli/src/ui/commands/auditCommand.ts`. Gated by
`isSwarmEnabled()` like the `swarm` tool itself. Renders, in one info
block: session metadata (status / role / model / turn count), the
effective policy filtered to `subagent === agentId || '*'` sorted by
priority desc, and the most-recent 20 events filtered to this agent.
Non-existent agent → user-facing error, not a throw.
Area 5 — `swarm_status.effective_policy_summary`. Each agents[] entry
in the snapshot now carries `{ total_rules, allow_count, deny_count,
ask_user_count, top_rules[] }` (top 5 by priority desc). Computed via a
new `SwarmManager.computeEffectivePolicySummary(agentId)`. Two new
manager accessors (`getSessionById`, `getRecentEvents`) feed the audit
command without exposing the internal Map.
Area 6 — P1 safety caps:
- `max_turns` on spawn is Zod-capped at 50 (mirrors `kind: anthropic`
agents). Above the cap → `INVALID_ARGS` with the message naming the
bound.
- `MAX_SWARM_SESSIONS = 8` simultaneous sessions per CLI process.
`spawn` rejects beyond cap with a clear error pointing the
orchestrator at `release`. `release` frees capacity immediately —
the 9th spawn after one release succeeds.
Area 7 — docs. CLAUDE.md "Swarm v1.0" section gains a "Spawn-time
policy scoping (v1.x Scope Bridge)" subsection with an example, plus a
"P1 safety caps (v1.x)" note. `SKILL.md` (swarm-collaboration) gets
the matching guidance for sub-agent authors. North-star doc's v1.x
milestone bullet was tightened to call out `WORKSPACE_POLICY_TIER` (3)
explicitly instead of the loose "tier 2 기본값" phrasing (Opus review
follow-up #1).
Tests added (10 total, all real-engine where appropriate):
- `policy-engine.test.ts` — `subagent: '*'` wildcard matches sub-agent
callers and explicitly does NOT match orchestrator (subagent
undefined).
- `swarm-manager.test.ts` — spawn-policy insertion at tier 2; release
purge via `removeRulesBySource`; effective_policy_summary counts +
top_rules ordering; sidecar wildcard application; `MAX_SWARM_SESSIONS`
8-OK / 9-rejected / release-recovers; `max_turns: 51` Zod rejection;
real-engine integration (swap in fresh `PolicyEngine`, spawn deny
rule, assert sub-agent shell call → DENY, orchestrator shell →
not-DENY, after release → not-DENY).
- `auditCommand.test.ts` — usage error on missing arg; ghost
agent_id → user-facing error; live agent → policy + events
rendered.
Bundled Phase 5.1 follow-up: `anthropic-invocation.test.ts:805` updated
the messagesCreate call count 2 → 3. The Phase 5.1 drain adds one
no-tools call when the loop exits with a trailing tool_result; the
single-shot tests' "max_turns silent on cap" case is a tool-use loop
that exits in exactly that state. The test wasn't updated when 5.1
landed; verified the failure on baseline `cbfa37206` and fixed it here
rather than ship a separate one-line commit.
Non-blocking follow-ups (Opus + Gemini reviews concur; deferred to v2):
- `computeEffectivePolicySummary` is `public` so a test can reach in
directly. v2 cleanup: make it private + a dedicated read accessor.
- `mapStringToPolicyDecision` default → ASK_USER is technically dead
code after Zod narrows the input. Keep as defense-in-depth.
Out of scope (per design-loop/swarm-north-star.md):
- `swarm.amend_policy` action (v2 spine).
- Drop `tools: string[]` entirely (v2 spine).
- `BehaviorConfig` runtime monitor (v2 spine).
- `request_capability` reborn as amend sugar (v2 spine).
- `agent.spawn` unification (v3 most-aggressive milestone).
Validation:
npm run typecheck — pass
node scripts/lint.js --eslint — pass
node scripts/lint.js --prettier — pass for staged
npm run build --workspace=packages/core — pass
npm run build --workspace=packages/cli — pass
npx vitest run packages/core/src/agents/ — pass
npx vitest run packages/core/src/policy/ — pass (2 pre-existing
topic-policy.test.ts failures unrelated, verified clean on cbfa372)
npx vitest run packages/core/src/scheduler/ — 146 / 146
npx vitest run packages/cli/src/ui/commands/auditCommand.test.ts — 3/3
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
SeunghyunLee1982
referenced
this pull request
in SeunghyunLee1982/gemini-cli
May 19, 2026
Closes a real UX gap surfaced in the user's live testing: the orchestrator (Gemini model) doesn't naturally reach for the `swarm` tool, even when registered, even with explicit prompt steering. It falls back to `run_shell_command` and tries `gemini swarm ...` recursively. The fork ships substantial swarm + policy machinery already (Phases 4–6), but the model-side disposition layer was missing. R1/R2 multi-model design debate (Opus + Gemini in parallel, two rounds) settled the design at `design-loop/swarm-orchestrator- disposition.md`. After implementation, a six-reviewer pass (three angles — TS/clean-code, intent, tests/abstractions — each with one Opus + one Gemini reviewer) ran in parallel; all six returned SHIP or SHIP-WITH-FOLLOW-UP. Cheap follow-ups are addressed in this commit; the rest are noted in the design doc and the agent-memory entry for v2 pickup. Four layers, all gated on `Config.isSwarmEnabled()` so upstream non-swarm users see zero behavior change: 1) Tool description rewrite (~+150 tokens). `SWARM_TOOL_DESCRIPTION` and `SWARM_STATUS_TOOL_DESCRIPTION` now carry explicit "when to use" + the anti-pattern "DO NOT shell out to `gemini` — there is no `gemini swarm` verb." Drift-guard tests pin the anti-pattern phrasing so accidental rewording regresses behavior loudly. 2) Orchestrator system-prompt disposition block + single inline worked example (~+300 tokens, conditional). New `SwarmDispositionOptions` + `renderSwarmDisposition` in `prompts/snippets.ts`. Inserted between `renderSubAgents` and `renderAgentSkills` in `getCoreSystemPrompt`. `promptProvider.ts` gates on `(SWARM_TOOL_NAME ∨ SWARM_STATUS_TOOL_NAME) ∈ registered tools` AND `isSwarmEnabled()`. The block names the tool, flags the no-CLI-verb anti-pattern, references `swarm_status`, and embeds one `<example>` showing a `swarm spawn` call. The example is inline rather than separate so in-context proximity isn't diluted by intervening prompt sections. 3) `swarm-collaboration` skill auto-inline (~+1.6k tokens, only when swarm enabled). `promptProvider.ts` filters the skill out of the regular `<available_skills>` manifest and inlines its SKILL.md body via new `renderSwarmInline`. Removes the activate-skill indirection so the protocol (state.md convention, release rules, paste-verbatim discipline) lands in the orchestrator's context without an extra round-trip. Hardcoded for the single fork-builtin inline candidate; an `inline: boolean` metadata flag was explicitly rejected in R2 (YAGNI; the LOCKED v2 north star reserves the capability/ template data-model surface). 4) Runtime guard — tier-1 default-deny `PolicyRule`. Registered from `config.ts` inside the existing `isSwarmEnabled()` tool- registration block. Pattern matches the JSON-stringified args form (`stableStringify(toolCall.args)`), NOT raw shell text — that ground-truth correction was caught in R2 when both models independently traced `PolicyEngine.matchRule` and found the raw-shell prototype from R1 would silently never match. The correct shape is `/"command":"(gemini|gemini-fork)(\s|"|\\)/`; the policy engine's existing sub-command splitter (`policy-engine.ts:469-475`) handles `bash -c "gemini foo"` and `cd /tmp && gemini ...` via recursive `check()`. The deny message carries the redirect text. `tier-4` user policies can still override. Review-cycle fixes folded in before commit: - Legacy snippets gap (Opus angle 1 #1): `snippets.legacy.ts` now imports the Phase 8 option types and renderers from `snippets.ts` and wires them into legacy `getCoreSystemPrompt`, so Gemini 2.x orchestrators with swarm enabled get the disposition block too. The disposition fix matters more for older models with stronger shell-first priors, not less. - Misleading test narration (Opus angles 2 + 3, cross-flagged): `policy-engine.test.ts` comment for the `bash -c "gemini help"` case had the wrong mechanism. The DENY actually fires via the sub-command splitter recursing into the inner `gemini help`, not the JSON-escape `(\\)` alternative at the top level. Corrected. - `swarm_status`-only branch test gap (Opus angle 3): added a case proving the disposition AND auto-inline both fire when only `SWARM_STATUS_TOOL_NAME` is registered (sub-agents themselves get `swarm_status` without `swarm` per the recursion-guard filter in `swarm-manager.ts`). - Empty-body edge case (Gemini angle 3): `renderSwarmInline` now returns `''` for whitespace-only bodies so a future skill loader returning an empty string doesn't render a dangling `# Skill — <name> (auto-loaded)` header with no content. Test added. Non-blocking review findings deferred to follow-ups (recorded in the design doc / agent-memory entry): - `SWARM_TOOL_NAME` SoT split (Opus angle 1 #3, Gemini angle 1): `SWARM_STATUS_TOOL_NAME` lives in lightweight `agents/swarm/ types.ts`, while `SWARM_TOOL_NAME` is still in heavy `swarm-tool.ts`. Consolidating both into the central `tools/tool-names.ts` is a separate cleanup. - Phase 8 prompt fields bypass `withSection` (Opus angle 1 #2): the operator `GEMINI_PROMPT_<KEY>=0` mute knob doesn't apply to the new sections. Routing through `withSection` is a separate consistency fix. - Layer 4 brittleness on `stableStringify` (Gemini angle 2): the argsPattern coupling to the policy engine's stringify format is a structural smell. A dedicated structured-arg matcher in the policy engine is a v2-level improvement. Tests landed (11 new): - `policy-engine.test.ts`: JSON-shape pattern denies `gemini …`, `gemini-fork …`, and `bash -c "gemini help"` (via recursive splitter); passes through `ls -la` and `echo gemini`. - `swarm-tool.test.ts`: anti-pattern drift guards on both tool descriptions. - `promptProvider.test.ts`: disposition block on/off; auto- inline pulled out/in manifest; only-`swarm_status` branch fires both layers; `renderSwarmInline` empty-body returns ''. - `config.test.ts`: tier-1 deny rule registered iff swarm enabled; carries the expected `source`, `toolName`, `decision`, `argsPattern` shape, and `denyMessage`. Gates: npm run typecheck — pass node scripts/lint.js --eslint — pass node scripts/lint.js --prettier — pass for staged files; design-loop docs auto-formatted by pre-commit hook npm run build --workspace=packages/core — pass npm run build --workspace=packages/cli — pass npx vitest run packages/core/src/policy/ — 330/332 (the 2 pre-existing topic-policy.test.ts failures, unrelated, verified on parent commit f190547) npx vitest run packages/core/src/agents/swarm/ — 36/36 npx vitest run packages/core/src/prompts/ — 65/65 Files committed include the LOCKED design doc (`design-loop/swarm-orchestrator-disposition.md`) and the `.gitignore` exception that tracks it (alongside `swarm-north-star.md`). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
18 tasks
18 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implementation details (internal): http://gpaste/6419003930836992