- Core CLI framework (Click-based, uv shebang)
-
synccommand - fetch emails matching criteria to local cache -
threadcommand - fetch specific thread by Gmail ID -
listcommand - list cached threads with filtering -
criteriacommand - manage search criteria -
labelscommand - list Gmail labels -
rebuild-dbcommand - rebuild SQLite index from YAML -
querycommand - SQL queries against SQLite index - Dual YAML (authoritative) + Markdown (derived) cache format
- Content-aware updates (ignore fetched_at in diff)
- Multi-client support per criteria
- HTML-to-Markdown conversion with link preservation
- Verbose logging (-v to -vvvv)
- Global exclusions system (_global.yaml)
- Fetch thread metadata first (without --full)
- Compare message IDs with cached YAML
- Only fetch --full for NEW messages not in cache
- Handle out-of-order message appearance (Gmail threads are mutable)
- Add --force flag to bypass optimization
- Criteria option:
download_attachments: true - Size limits:
max_attachment_size: 10MB - MIME filtering:
attachment_types: ["pdf", "doc*"] - Storage:
cache/{client}/{group}/{topic}/attachments/{YYMMDD}-{HHmm}-{subject}-{msg_id}/ -
_manifest.yamlwith checksums (md5, sha256) for deduplication -
_message.mdfor self-contained context per attachment folder - Skip download if attachment already exists
- Pseudo-client "merged" computed from single-client caches
- RFC 2822 Message-ID correlation across accounts
- ID collision detection and warnings
- Cross-account thread linking
- Provenance tracking in merged files
- Calendar event caching via
gog calendarcommands - Event-to-Email correlation (meeting invites)
- Unified timeline view
- iCalUID-based cross-calendar correlation
- Contact caching via
gog contactscommands - Contact-to-Email correlation
- Contact group management
- Config-driven hook system (pre-sync, post-sync, on-new-thread, etc.)
- Hook definitions in config file (shell commands, scripts)
- Template system for downstream repos to customize behavior
- Example hook: auto-label new threads based on criteria
- Example hook: notify on new messages matching patterns
- Central config file (
~/.config/gog-ng/config.yamlor project-local) - Timezone configuration (default: UTC, overridable per-project)
- Default client configuration
- Custom cache directory per project
- Criteria directory overrides
- Full-text search in SQLite (FTS5)
- Label-based filtering
- Date range queries with human-friendly syntax
- Export to JSONL for LLM context
- historyId tracking per client
- Incremental updates (only fetch changes since last sync)
- Cache invalidation on label changes
- Conflict detection
-
--capabilities=CAPSCLI flag accepting comma-separated capability list - Each capability defined in settings file for user fine-tuning
- Initial settings file generation (
gog-ng init-capabilities) - Default capability taxonomy:
read-only- only read operations (list, query, sync to local cache)writable- can create drafts, modify local fileswritable-user-scoped-impact- changes affecting only the user's datawritable-shared-group-impact- changes visible to a group (shared labels, etc.)writable-global-impact-like-sending-emails- operations with external impact (send email, etc.)
- Taxonomy and ontology refinement needed - the above is a starting point
- Per-command capability requirements (e.g.,
syncneedsread-only,draftneedswritable) - Capability validation before command execution
- Config file:
~/.config/gog-ng/capabilities.yaml
-
gog-ng export --format mbox- Standard mbox format -
gog-ng export --format eml- Individual .eml files -
gog-ng export --format jsonl- JSONL for streaming/LLM processing
-
gog-ng watch --criteria NAME --interval 5m - Poll for new messages matching criteria
- Desktop notification integration (optional)
-
gog-ng summarize THREAD_ID - Generate LLM-friendly thread summary with key points
- Configurable summary templates
-
gog-ng draft --reply-to MESSAGE_ID --template templates/reply.md - Template system for common reply patterns
- Requires
writablecapability (P500)
- Add proper logging (structlog)
- Add retry logic for transient API failures
- Add cache size limits and cleanup
- Add cache integrity verification
- Add migration support for format changes
- Test suite
- Direct email sending - User must send manually via Gmail UI (unless explicitly enabled via capabilities P500)
- Modify labels directly - Read-only by default
- Delete messages - Read-only by default
- OAuth token management - Delegated to
gog auth