A local, terminal-first client for the Glean Client REST API. Inspired by Claude Code. Built in Python with zero runtime dependencies.
- Slash commands for every major Glean Client API surface
- Full in-terminal documentation for every command via
/help <command> - Config stored at
~/.gleancode/config.json - Mock mode by default, so you can try every command offline
- Live mode the moment you add an instance and token
cd glean-code
python3 -m glean_code
# or
./glean-codePython 3.9 or newer. No pip install required. Only the standard library is used.
/login --instance acme-be.glean.com --token <bearer_token>
/status
/search "quarterly planning"
/chat "summarise the Q2 plan"
Without a token the CLI runs in mock mode and returns realistic fake data. Set a token with /login and it switches to live calls against https://<instance>-be.glean.com/rest/api/v1.
/help
/status
/login
/logout
/config
/mode
/history
/clear
/exit
/chat
/search
/autocomplete
/recommendations
/feedback
/agents.list
/agents.run
/tools.list
/tools.call
/docs.get
/docs.permissions
/entities.list
/people.get
/announcements.list
/announcements.create
/announcements.delete
/collections.list
/collections.create
/pins.list
/pins.create
Type /help <command> for parameters, examples and the underlying REST endpoint. Bare text with no leading slash is a shortcut for /chat.
instance, api_token, act_as, base_url, mode, theme, default_page_size
Change any of them with /config set <key> <value>. Use /mode live|mock|auto to force a mode.
glean-code/
glean-code launcher script
glean_code/
__init__.py
__main__.py python -m glean_code
cli.py REPL loop and banner
ui.py ASCII art, colours, boxes
config.py config file load and save
client.py Glean REST wrapper + mock responses
commands.py slash command parser and handlers
help_docs.py per-command documentation
The client targets the documented Glean Client REST API at https://<instance>-be.glean.com/rest/api/v1. Paths used:
POST /chat
POST /search
POST /autocomplete
POST /recommendations
POST /feedback
POST /agents/search
POST /agents/runs/wait
POST /agents/runs/stream
POST /tools/list
POST /tools/call
POST /getdocuments
POST /getdocumentpermissions
POST /listentities
POST /people
POST /announcements/list
POST /announcements/create
POST /announcements/delete
POST /listcollections
POST /createcollection
POST /listpins
POST /createpin
If your tenant uses a slightly different path for a given surface, change it in glean_code/client.py. Every method is a small wrapper around self._post(path, body) so the swap is a one-liner.
Wrap the JSON in single quotes so the shell parser leaves the double quotes intact:
/tools.call search '{"query":"pto policy"}'