Thin CLI client for Zylch AI - connects to Zylch API server
Project description
Zylch CLI
Thin CLI client for Zylch AI - your AI assistant for email, calendar, and relationship intelligence.
Architecture
The CLI is a thin client that communicates with the Zylch API server. All business logic, AI processing, and data storage happens on the server. The CLI handles:
- User authentication (Firebase OAuth via browser)
- Service connections (Google, Microsoft, Anthropic)
- Interactive chat with slash command support
- Local caching for offline access
- Modifier queue for offline operations
┌─────────────┐ HTTP API ┌──────────────┐
│ Zylch CLI │ ───────────────────────► │ Zylch Server │
│ (Thin) │ ◄─────────────────────── │ (FastAPI) │
└─────────────┘ └──────────────┘
│ │
▼ ▼
Local Cache Supabase
(SQLite) (PostgreSQL)
Installation
pip install zylch-cli
From source
git clone https://github.com/malemi/zylch-cli.git
cd zylch-cli
pip install -e .
Quick Start
# Start the CLI (connects to production server by default)
zylch
# Or connect to a specific server
zylch --server-url http://localhost:9000
Configuration
Configuration is stored in ~/.zylch/cli_config.json:
{
"api_server_url": "https://api.zylchai.com",
"session_token": "",
"owner_id": "",
"email": "",
"local_db_path": "~/.zylch/local_data.db",
"enable_offline": true,
"max_offline_days": 7,
"auto_sync_on_start": false
}
Commands
Session & Authentication (Client-side)
| Command | Description |
|---|---|
/login |
Login via browser (Firebase OAuth) |
/logout |
Logout and clear session |
/status |
Show CLI status and cache stats |
/new |
Start new conversation |
/quit, /exit |
Exit Zylch |
Integrations (Client-side)
| Command | Description |
|---|---|
/connect |
Show all service connection status |
/connect anthropic |
Set your Anthropic API key (required for chat) |
/connect google |
Connect Google (Gmail, Calendar) via OAuth |
/connect microsoft |
Connect Microsoft (Outlook, Calendar) |
/connect --reset |
Disconnect all services |
Data & Sync (Server-side)
| Command | Description |
|---|---|
/sync [days] |
Sync emails & calendar from connected services |
/gaps |
Show relationship gaps analysis |
/briefing |
Get daily briefing |
/archive |
Email archive management (--help for details) |
/cache |
Cache management (--help for details) |
AI & Memory (Server-side)
| Command | Description |
|---|---|
/memory |
Behavioral memory management (--help for details) |
/model [haiku|sonnet|opus|auto] |
Switch AI model tier |
/trigger |
Event automation (--help for details) |
Sharing (Server-side)
| Command | Description |
|---|---|
/share <email> |
Share data with another user |
/revoke <email> |
Revoke sharing access |
/sharing |
Show current sharing status |
Other (Server-side)
| Command | Description |
|---|---|
/mrcall |
Link to MrCall assistant |
/tutorial |
Interactive tutorial |
/help |
Show all commands |
Authentication Flow
- User runs
/login - CLI starts local HTTP server on
localhost:8765 - Browser opens to
{server}/api/auth/oauth/initiate - User completes Firebase/Google OAuth in browser
- Server redirects to
localhost:8765/callback?token=... - CLI captures JWT token, saves to config
- Token used for all subsequent API calls
Token Expiry: Firebase JWT tokens expire after ~1 hour. The CLI checks token expiry locally before making requests. If expired, user is prompted to /login again.
Service Connection Flow (Google/Microsoft)
- User runs
/connect google - CLI calls
/api/auth/google/authorizeto get OAuth URL - Browser opens to Google consent screen
- User authorizes Gmail/Calendar access
- Callback stores tokens in Supabase (server-side)
- CLI receives success confirmation
Important: OAuth tokens are stored in Supabase, not locally. This allows the same credentials to work across CLI and web dashboard.
Offline Support
The CLI includes offline capabilities:
-
Local Cache: SQLite database at
~/.zylch/local_data.db- Cached emails, calendar events, contacts
- 7-day TTL for cached data
-
Modifier Queue: Operations queued when offline
- Email drafts, sends
- Calendar event creation
- Synced when connection restored via
POST /api/data/modifier
Project Structure
zylch-cli/
├── zylch_cli/
│ ├── __init__.py
│ ├── cli.py # Main CLI (Click + Rich + prompt_toolkit)
│ ├── api_client.py # HTTP client for Zylch API
│ ├── config.py # Configuration + JWT parsing
│ ├── oauth_handler.py # Browser OAuth flow
│ ├── local_storage.py # SQLite cache
│ └── modifier_queue.py # Offline operation queue
├── pyproject.toml # Poetry configuration
└── README.md
Key Files
| File | Purpose |
|---|---|
cli.py |
Main entry point, slash commands, chat loop with autocomplete |
api_client.py |
All HTTP calls to api.zylchai.com |
config.py |
Load/save config, JWT expiry parsing |
oauth_handler.py |
Local callback server for OAuth |
local_storage.py |
SQLite caching for offline access |
modifier_queue.py |
Queue offline operations for later sync |
API Endpoints Used
Authentication
POST /api/auth/login- Login with Firebase tokenPOST /api/auth/logout- Invalidate sessionGET /api/auth/session- Get session infoPOST /api/auth/refresh- Refresh token (exists but not auto-used)
Service Connections
GET /api/auth/google/status- Check Google connectionGET /api/auth/google/authorize- Get Google OAuth URLPOST /api/auth/google/revoke- Disconnect GoogleGET /api/auth/anthropic/status- Check Anthropic keyPOST /api/auth/anthropic/key- Save Anthropic API keyPOST /api/auth/anthropic/revoke- Delete Anthropic key
Chat
POST /api/chat/message- Send message (includes slash commands)GET /api/chat/history- Get conversation history
Data
GET /api/data/emails- List email threadsGET /api/data/calendar- List calendar eventsGET /api/data/contacts- List contactsPOST /api/data/modifier- Apply offline modifications
Health
GET /health- Server health check
Development
# Install with dev dependencies
pip install -e ".[dev]"
# Run CLI
zylch
# Run tests
pytest
# Format code
black zylch_cli/
ruff check zylch_cli/
Production URLs
| Service | URL |
|---|---|
| API Server | https://api.zylchai.com |
| Web Dashboard | https://app.zylchai.com |
| Website | https://zylchai.com |
Known Gaps
-
Token Refresh: The
refresh_token()method exists but isn't called automatically. Users must manually/loginwhen token expires. -
Microsoft Support: Endpoints exist but not fully implemented yet.
-
Keychain Storage: Tokens stored in plaintext JSON. TODO: Use system keychain.
What This CLI Does NOT Do
- Access Google/Microsoft APIs directly (server handles this)
- Store OAuth credentials locally (only session token)
- Process emails/calendar locally (server-side)
- Run AI models (server uses your Anthropic key)
All business logic lives on the server (api.zylchai.com).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zylch_cli-0.9.0.tar.gz.
File metadata
- Download URL: zylch_cli-0.9.0.tar.gz
- Upload date:
- Size: 31.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
437d950655150a00c3b1b8578f35ec11cf6218dc35be78af13e3d55c8b10f8de
|
|
| MD5 |
42334f0ed0219a780cd150538686078a
|
|
| BLAKE2b-256 |
44d7fc759f4bd85dfb4a6805c37103a813c45df2e44fbbef295cb78cd58e47b1
|
Provenance
The following attestation bundles were made for zylch_cli-0.9.0.tar.gz:
Publisher:
workflow.yml on malemi/zylch-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zylch_cli-0.9.0.tar.gz -
Subject digest:
437d950655150a00c3b1b8578f35ec11cf6218dc35be78af13e3d55c8b10f8de - Sigstore transparency entry: 760276485
- Sigstore integration time:
-
Permalink:
malemi/zylch-cli@3606dd979ca0f0d5837b9c593f959b506fd88e0e -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/malemi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@3606dd979ca0f0d5837b9c593f959b506fd88e0e -
Trigger Event:
release
-
Statement type:
File details
Details for the file zylch_cli-0.9.0-py3-none-any.whl.
File metadata
- Download URL: zylch_cli-0.9.0-py3-none-any.whl
- Upload date:
- Size: 31.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f68e9ea94895af74d19c8f0384f38e6cece9b5e0dd034f4e0b885729cd4796e
|
|
| MD5 |
17107b4b8407b09b7e138b83fdd0f7e7
|
|
| BLAKE2b-256 |
1845f18cc10356bbf6777983e0234ab1c0fe1de6b7459894e8a88803e83cf5be
|
Provenance
The following attestation bundles were made for zylch_cli-0.9.0-py3-none-any.whl:
Publisher:
workflow.yml on malemi/zylch-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zylch_cli-0.9.0-py3-none-any.whl -
Subject digest:
4f68e9ea94895af74d19c8f0384f38e6cece9b5e0dd034f4e0b885729cd4796e - Sigstore transparency entry: 760276487
- Sigstore integration time:
-
Permalink:
malemi/zylch-cli@3606dd979ca0f0d5837b9c593f959b506fd88e0e -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/malemi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@3606dd979ca0f0d5837b9c593f959b506fd88e0e -
Trigger Event:
release
-
Statement type: