Skip to main content

CLI to access Grok

Project description

Grokko

CLI for capturing Grok session cookies, triggering account exports, polling email for export links, downloading the ZIP, and inspecting export contents.

Install

Requires Python 3.10+ and uv.

git clone https://github.com/deeplook/grokko
cd grokko
uv tool install .
grokko setup

grokko setup installs the Playwright browser dependencies, skipping the download if a compatible version is already present.

To install into a local virtual environment instead:

git clone https://github.com/deeplook/grokko
cd grokko
uv venv ./myenv
uv pip install --python ./myenv .
./myenv/bin/grokko setup

Plugins

grokko can load optional command plugins from installed packages via the grokko.plugins entry-point group. Plugins are discovered automatically at startup — no configuration needed beyond installation.

Installing plugins

If you installed grokko as a uv tool, add a plugin by reinstalling with --with (works for both a fresh install and an existing one):

uv tool install --reinstall --with grokko-plugin .

For a local plugin directory, pass the path instead of a package name:

uv tool install --reinstall --with ../grokko-plugin .

Or use the Makefile shorthand from the grokko directory:

make install-tool PLUGINS="grokko-plugin"

If you installed grokko as a regular package (e.g. uv pip install grokko or pip install grokko), install the plugin into the same environment:

pip install grokko-plugin

Writing plugins

In a plugin package, expose either a Typer app or a single command callback:

[project.entry-points."grokko.plugins"]
reports = "my_package.cli:app"
details = "my_package.extra:inspect_extra"

If app is a typer.Typer() instance, grokko reports ... becomes a command group. If inspect_extra is a callable command, grokko details becomes a single command.

Quick Examples

Capture cookies from your local Chrome profile:

grokko session capture

Trigger an export, poll IMAP for the export email, and download the ZIP:

IMAP_USER=you@example.com IMAP_PASSWORD=app-password grokko export run

Show the latest chat transcript:

grokko chat --messages

Show a range of chat summaries by recency index:

grokko chat -n 3:10

The START:STOP form is half-open, so 3:10 means indices 3 through 9.

Download all attachments from a conversation (uploaded files and generated images):

grokko chat --id <conversation-id> --attachments

Files are saved to ~/.grokko/attachments/<id>/ by default. Override with --attachments-dir:

grokko chat --id <conversation-id> --attachments --attachments-dir ./my-dir

Combine with --messages to download attachments and print the transcript in one go:

grokko chat --id <conversation-id> --attachments --messages

Inspect the most recently downloaded ZIP:

grokko export inspect

Extract a Grok export ZIP to Obsidian Markdown notes:

grokko extract export.zip ./notes

Export only starred conversations:

grokko extract export.zip ./notes --starred

Export with attachments:

grokko extract export.zip ./notes --attachments all

See an overview of all CLI commands:

grokko overview

The CLI stores its working files in ~/.grokko by default. Override that with GROKKO_STORAGE_DIR=/path/to/dir if needed.

Environment

Required for grokko export run:

IMAP_USER=you@example.com
IMAP_PASSWORD=app-password

Optional:

IMAP_HOST=imap.gmail.com
IMAP_PORT=993
GROK_EXPORT_SUBJECT="Your data export is ready"
GROK_EXPORT_SENDER=
GROK_EXPORT_URL_PATTERN='https://accounts\.x\.ai/download/\?file_reference=[\w/-]+\.zip'
GROK_EXPORT_MAILBOX=INBOX
GROK_EXPORT_POLL_INTERVAL=30
GROK_EXPORT_POLL_TIMEOUT=600
GROKKO_STORAGE_DIR=~/.grokko

Development

make test
make lint
make format

Install and run the pre-commit hooks:

uv run pre-commit install
uv run pre-commit run --all-files

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grokko-0.1.0.tar.gz (111.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grokko-0.1.0-py3-none-any.whl (35.2 kB view details)

Uploaded Python 3

File details

Details for the file grokko-0.1.0.tar.gz.

File metadata

  • Download URL: grokko-0.1.0.tar.gz
  • Upload date:
  • Size: 111.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for grokko-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bd038cfad9f5434fe68cbf92c2cba0a9acf43583434232ebd0349ae114f1b840
MD5 c99413f2d184ab1a439b6a34a095fdd4
BLAKE2b-256 81e58126dd9e387d95d3bee87c3bce705eeadf29f1243534d11e249d01575469

See more details on using hashes here.

File details

Details for the file grokko-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: grokko-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 35.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for grokko-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 688c411ebce2df509520180fc268af2ec21f47377a87a87406b5bebd4d53961e
MD5 281004b0bdeb945a39b27fb6928f27b2
BLAKE2b-256 9d270630481886054989df32dc121d1baf98d5014c51f346d173c7179be0fcab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page