How doriandarko/gemini-writer works
Gemini Writing Agent turns a CLI prompt into a multi-file writing project: Gemini plans and generates content, tool calls create a project and write Markdown artifacts, and the agent streams progress while tracking tokens and iterations. Context compression and recovery preserve long-running work. The README documents streaming, thinking, and recovery behavior; the sampled excerpts omit parts of the main loop, so only clearly supported control and data transfers are shown.
Main entry points: writer.py CLI Agent · compression.py Context Compressor · tools/writer.py Markdown Writer · project.py Project Manager
Components 10
Agent Runtime
- CLI Agent
writer.py - Agent Utilities
utils.py
Writing Tools
- Markdown Writer
tools/writer.py
Context Management
- Context Compressor
tools/compression.py - Context Summaries
Project Storage
- Project Manager
tools/project.py - Active Project
tools/project.py - Project Files
Other components
- Writer
- Gemini API
Connections 18
- Writer → CLI Agent: provides prompt
- Writer → CLI Agent: provides recovery path
- CLI Agent → Agent Utilities: gets tools
- Agent Utilities → CLI Agent: returns tool map
- CLI Agent → Gemini API: sends prompt and tools
- Gemini API → CLI Agent: returns responses and calls
- CLI Agent → Gemini API: counts tokens
- CLI Agent → Project Manager: dispatches project calls
- CLI Agent → Markdown Writer: dispatches writing calls
- CLI Agent → Context Compressor: dispatches compression
- Project Manager → Active Project: sets active folder
- Project Manager → Project Files: creates project folder
- Markdown Writer → Active Project: reads active folder
- Markdown Writer → Project Files: writes Markdown
- Context Compressor → Active Project: gets active folder
- Context Compressor → Gemini API: requests summary
- Context Compressor → Context Summaries: saves summary
- CLI Agent → Context Summaries: loads recovery context