Project Structure
Translation in Progress
This page is being translated. Content below is a placeholder.
Overview
gemini-cli is a monorepo:
gemini-cli/
├── packages/
│ ├── cli/ # Terminal UI (Ink/React)
│ └── core/ # Agent logic (our focus)
├── docs/ # Documentation
└── package.json # Workspace configCore Package Structure
packages/core/src/
├── core/ # Core classes
│ ├── client.ts # Main GeminiClient
│ ├── geminiChat.ts
│ └── turn.ts # Event types
├── tools/ # Tool implementations
│ ├── read-file.ts
│ ├── write-file.ts
│ └── shell.ts
├── services/ # Service layer
│ ├── loopDetection.ts
│ └── chatCompression.ts
└── utils/ # UtilitiesKey Files
| File | Purpose |
|---|---|
core/client.ts | Agent controller, main loop |
core/geminiChat.ts | Gemini API wrapper |
core/turn.ts | Event type definitions |
tools/*.ts | Individual tool implementations |
services/*.ts | Supporting services |
Reading Order
turn.ts- Understand data structurestools/read-file.ts- Simplest tool exampleclient.ts- Main Agent loop
Summary
- Monorepo with cli and core packages
- Core contains all Agent logic
- Start with turn.ts, then tools, then client
Next
Deep dive into core package: Core Package →