When to Use This Skill
Trigger conditions
Trigger this skill when the user mentions "glean" combined with an action intent:
- "glean search vacation policy" / "用 glean 搜一下请假规定"
- "glean chat summarize Q1 goals" / "问一下 glean 季度目标"
- "search company docs" / "搜公司知识库" / "搜内部文档"
- "glean agents list" / "glean documents get"
- "glean shortcuts create" / "create a go-link"
- "glean api" / "look up people in glean" / "glean 查人"
NOT a trigger (do NOT invoke this skill):
- Generic web search not targeting company knowledge
- User asks to search GitHub issues/PRs — use
gh-operations
- User asks to search Confluence — use
confluence skill
Security — MANDATORY rules for AI agents
- NEVER echo, print, or log the values of any environment variable containing credentials (
GLEAN_API_TOKEN, etc.). Do NOT run commands like echo $GLEAN_API_TOKEN or printenv GLEAN_API_TOKEN — even for debugging.
- NEVER pass token/credential values as inline CLI arguments or env-var overrides.
glean reads credentials from its own config or environment — just run glean commands directly.
- NEVER read environment variable values using shell commands or programmatic access. The AI agent should not inspect, verify, or access token values in any way.
- When debugging auth errors, rely solely on
glean auth status output and glean error messages. Do NOT attempt to verify tokens by reading or printing them.
- NEVER extract credentials from OS credential stores or config files. Strictly forbidden commands include:
- macOS Keychain:
security find-internet-password, security find-generic-password
- Reading
~/.glean/config.json or any glean auth config file
- Any command that outputs a password, token, or secret value from any credential store
- NEVER use extracted credential values in commands. The
glean CLI handles all authentication internally — use glean api for API calls instead of curl with raw tokens.
Runtime requirements
- Glean CLI (
glean) installed and authenticated
- Run
skills-check glean to verify dependencies
Workflow
1) Pre-flight checks
MANDATORY execution rule:
- If the user provides a clear glean action (e.g., "glean search X"), go straight to the relevant operation. Do NOT run
glean --version or glean auth status first — let the command succeed or fail.
- If running glean for the first time or encountering auth errors, check:
- Verify
glean exists:glean --version
- Verify authentication:
glean auth status
- If not authenticated:
glean auth login # OAuth via browser (recommended)
- For CI/CD environments, credentials are set via environment variables:
GLEAN_API_TOKEN — API token
GLEAN_HOST — Glean backend hostname (e.g. your-company-be.glean.com)
2) Search (glean search)
Search across company knowledge:
glean search "vacation policy"
glean search "Q1 planning" --datasource confluence --page-size 5
glean search "docs" --output ndjson | jq .title
glean search "onboarding" --fields "results.document.title,results.document.url"
glean search --json '{"query":"onboarding","pageSize":3}'
glean search --dry-run "test"
| Flag |
Description |
--output / --format |
json (default), ndjson (one result per line), text |
--fields |
Dot-path field projection — prefix paths with results. |
--datasource / -d |
Filter by datasource (repeatable) |
--type / -t |
Filter by document type (repeatable) |
--page-size |
Results per page (default 10) |
--json |
Raw SDK request body (overrides all flags) |
--dry-run |
Print request body without sending |
3) Chat (glean chat)
Chat with Glean Assistant (non-interactive):
glean chat "What are our company holidays?"
glean chat --timeout 120000 "Summarize all Q1 OKRs across teams"
glean chat --json '{"messages":[{"author":"USER","messageType":"CONTENT","fragments":[{"text":"What is Glean?"}]}]}'
echo "What is Glean?" | glean chat
glean chat # interactive multiline input, Ctrl+D to send
| Flag |
Description |
--timeout |
Request timeout in milliseconds (default 60000) |
--json |
Raw SDK request body (overrides all flags) |
--dry-run |
Print request body without sending |
--save |
Persist chat for continuation (default true) |
4) Schema introspection (glean schema)
Discover commands and flags programmatically:
glean schema | jq '.commands'
glean schema search | jq '.flags | keys'
glean schema search | jq '.flags["--output"]'
5) AI Agents (glean agents)
glean agents list | jq '.agents[] | {id: .agent_id, name: .name}'
glean agents get --json '{"agentId":"<id>"}'
glean agents schemas --json '{"agentId":"<id>"}'
glean agents run --json '{"agentId":"<id>","messages":[{"author":"USER","fragments":[{"text":"summarize Q1 results"}]}]}'
6) Documents (glean documents)
glean documents get --json '{"documentSpecs":[{"url":"https://..."}]}'
glean documents summarize --json '{"documentSpecs":[{"url":"https://..."}]}'
7) Collections (glean collections)
glean collections list
glean collections get --json '{"id":"<collection-id>"}'
glean collections create --json '{"name":"My Collection","description":"..."}'
glean collections add-items --json '{"id":"<collection-id>","addedDocumentSpecs":[{"url":"https://..."}]}'
8) Shortcuts / go-links (glean shortcuts)
glean shortcuts list
glean shortcuts create --json '{"data":{"inputAlias":"onboarding","destinationUrl":"https://..."}}'
glean shortcuts create --json '{"data":{"inputAlias":"jira","urlTemplate":"https://jira.example.com/browse/{arg}"}}'
9) Other namespace commands
All namespace commands accept --json, --output, and --dry-run.
| Namespace |
Subcommands |
Description |
glean answers |
list, get, create, update, delete |
Curated Q&A pairs |
glean announcements |
create, update, delete |
Company announcements |
glean pins |
list, get, create, update, remove |
Promoted search results |
glean entities |
list, read-people |
People, teams, custom entities |
glean verification |
list, verify, remind |
Document verification |
glean insights |
get |
Search and usage analytics |
glean messages |
get |
Indexed messages (Slack, Teams) |
glean activity |
report, feedback |
User activity reporting |
glean tools |
list, run |
Platform tools |
10) Raw API access (glean api)
glean api search --method POST --raw-field '{"query":"rust","pageSize":3}'
glean api --preview search --method POST --raw-field '{"query":"test"}'
11) Interactive TUI
Running glean with no arguments opens a full-screen chat:
glean # open TUI
glean --continue # resume the most recent session
Output Expectations
For every task, provide:
- Commands executed (or planned) in code blocks
- Short result summary
- If write operation succeeded, include the result explicitly
- If operation fails, include exact error and next action
All glean commands return structured JSON on stdout and errors on stderr. Use jq for parsing. Use --dry-run to preview requests before sending.
Error Handling
glean not installed: Tell user to install via brew install gleanwork/tap/glean-cli or the install script. Run skills-check glean to verify.
- Not authenticated: Run
glean auth login (OAuth via browser). For CI/CD, set GLEAN_API_TOKEN and GLEAN_HOST environment variables.
- Auth failure — ONLY allowed recovery steps:
- Report the
glean error message to the user
- Suggest
glean auth login or glean auth status
- For token-based auth, suggest checking
GLEAN_API_TOKEN and GLEAN_HOST are set
- Stop and wait for the user to fix auth
- API errors: Report status code and error body. Use
--dry-run to debug request shape.
- Unknown command: Use
glean schema to discover available commands and flags.
Notes
- Every command returns JSON — pipe to
jq for field extraction.
- Use
--dry-run to preview requests before sending.
- Use
glean schema <command> for machine-readable flag documentation.
- Use
--output ndjson for streaming large result sets.
- The interactive TUI (
glean with no args) is for human-interactive sessions; prefer glean chat "..." or glean search "..." for agent workflows.
1---2name: glean3description: Use Glean CLI (`glean`) for enterprise knowledge search, AI chat, and API operations from terminal. Trigger when user mentions "glean" combined with an action — e.g. "glean search", "search glean", "ask glean", "glean chat", "用 glean 搜", "glean 搜索", "问一下 glean", "glean 问答", "search company knowledge", "搜公司知识库", "公司文档搜索", "glean api", "glean agents", "glean documents", "glean shortcuts", "glean collections". Also trigger when user asks to search company/internal knowledge, docs, or people and Glean is the implied tool. This skill covers search, chat, AI agents, documents, collections, shortcuts, pins, announcements, entities, verification, insights, messages, activity, and raw API access.4license: MIT5---67# When to Use This Skill89## Trigger conditions1011Trigger this skill when the user mentions **"glean"** combined with an action intent:1213- "glean search vacation policy" / "用 glean 搜一下请假规定"14- "glean chat summarize Q1 goals" / "问一下 glean 季度目标"15- "search company docs" / "搜公司知识库" / "搜内部文档"16- "glean agents list" / "glean documents get"17- "glean shortcuts create" / "create a go-link"18- "glean api" / "look up people in glean" / "glean 查人"1920**NOT a trigger** (do NOT invoke this skill):21- Generic web search not targeting company knowledge22- User asks to search GitHub issues/PRs — use `gh-operations`23- User asks to search Confluence — use `confluence` skill2425## Security — MANDATORY rules for AI agents26271. **NEVER echo, print, or log** the values of any environment variable containing credentials (`GLEAN_API_TOKEN`, etc.). Do NOT run commands like `echo $GLEAN_API_TOKEN` or `printenv GLEAN_API_TOKEN` — even for debugging.282. **NEVER pass token/credential values as inline CLI arguments or env-var overrides.** `glean` reads credentials from its own config or environment — just run `glean` commands directly.293. **NEVER read environment variable values** using shell commands or programmatic access. The AI agent should not inspect, verify, or access token values in any way.304. **When debugging auth errors**, rely solely on `glean auth status` output and `glean` error messages. Do NOT attempt to verify tokens by reading or printing them.315. **NEVER extract credentials from OS credential stores or config files.** Strictly forbidden commands include:32 - macOS Keychain: `security find-internet-password`, `security find-generic-password`33 - Reading `~/.glean/config.json` or any `glean` auth config file34 - Any command that outputs a password, token, or secret value from any credential store356. **NEVER use extracted credential values in commands.** The `glean` CLI handles all authentication internally — use `glean api` for API calls instead of `curl` with raw tokens.3637## Runtime requirements3839- **Glean CLI (`glean`)** installed and authenticated40- Run `skills-check glean` to verify dependencies4142# Workflow4344## 1) Pre-flight checks4546MANDATORY execution rule:47- **If the user provides a clear glean action** (e.g., "glean search X"), go straight to the relevant operation. Do NOT run `glean --version` or `glean auth status` first — let the command succeed or fail.48- **If running glean for the first time** or encountering auth errors, check:49501. Verify `glean` exists:51 ```bash52 glean --version53 ```542. Verify authentication:55 ```bash56 glean auth status57 ```583. If not authenticated:59 ```bash60 glean auth login # OAuth via browser (recommended)61 ```624. For CI/CD environments, credentials are set via environment variables:63 - `GLEAN_API_TOKEN` — API token64 - `GLEAN_HOST` — Glean backend hostname (e.g. `your-company-be.glean.com`)6566## 2) Search (`glean search`)6768Search across company knowledge:6970```bash71glean search "vacation policy"72glean search "Q1 planning" --datasource confluence --page-size 573glean search "docs" --output ndjson | jq .title74glean search "onboarding" --fields "results.document.title,results.document.url"75glean search --json '{"query":"onboarding","pageSize":3}'76glean search --dry-run "test"77```7879| Flag | Description |80|---|---|81| `--output` / `--format` | `json` (default), `ndjson` (one result per line), `text` |82| `--fields` | Dot-path field projection — prefix paths with `results.` |83| `--datasource` / `-d` | Filter by datasource (repeatable) |84| `--type` / `-t` | Filter by document type (repeatable) |85| `--page-size` | Results per page (default 10) |86| `--json` | Raw SDK request body (overrides all flags) |87| `--dry-run` | Print request body without sending |8889## 3) Chat (`glean chat`)9091Chat with Glean Assistant (non-interactive):9293```bash94glean chat "What are our company holidays?"95glean chat --timeout 120000 "Summarize all Q1 OKRs across teams"96glean chat --json '{"messages":[{"author":"USER","messageType":"CONTENT","fragments":[{"text":"What is Glean?"}]}]}'97echo "What is Glean?" | glean chat98glean chat # interactive multiline input, Ctrl+D to send99```100101| Flag | Description |102|---|---|103| `--timeout` | Request timeout in milliseconds (default 60000) |104| `--json` | Raw SDK request body (overrides all flags) |105| `--dry-run` | Print request body without sending |106| `--save` | Persist chat for continuation (default true) |107108## 4) Schema introspection (`glean schema`)109110Discover commands and flags programmatically:111112```bash113glean schema | jq '.commands'114glean schema search | jq '.flags | keys'115glean schema search | jq '.flags["--output"]'116```117118## 5) AI Agents (`glean agents`)119120```bash121glean agents list | jq '.agents[] | {id: .agent_id, name: .name}'122glean agents get --json '{"agentId":"<id>"}'123glean agents schemas --json '{"agentId":"<id>"}'124glean agents run --json '{"agentId":"<id>","messages":[{"author":"USER","fragments":[{"text":"summarize Q1 results"}]}]}'125```126127## 6) Documents (`glean documents`)128129```bash130glean documents get --json '{"documentSpecs":[{"url":"https://..."}]}'131glean documents summarize --json '{"documentSpecs":[{"url":"https://..."}]}'132```133134## 7) Collections (`glean collections`)135136```bash137glean collections list138glean collections get --json '{"id":"<collection-id>"}'139glean collections create --json '{"name":"My Collection","description":"..."}'140glean collections add-items --json '{"id":"<collection-id>","addedDocumentSpecs":[{"url":"https://..."}]}'141```142143## 8) Shortcuts / go-links (`glean shortcuts`)144145```bash146glean shortcuts list147glean shortcuts create --json '{"data":{"inputAlias":"onboarding","destinationUrl":"https://..."}}'148glean shortcuts create --json '{"data":{"inputAlias":"jira","urlTemplate":"https://jira.example.com/browse/{arg}"}}'149```150151## 9) Other namespace commands152153All namespace commands accept `--json`, `--output`, and `--dry-run`.154155| Namespace | Subcommands | Description |156|---|---|---|157| `glean answers` | `list`, `get`, `create`, `update`, `delete` | Curated Q&A pairs |158| `glean announcements` | `create`, `update`, `delete` | Company announcements |159| `glean pins` | `list`, `get`, `create`, `update`, `remove` | Promoted search results |160| `glean entities` | `list`, `read-people` | People, teams, custom entities |161| `glean verification` | `list`, `verify`, `remind` | Document verification |162| `glean insights` | `get` | Search and usage analytics |163| `glean messages` | `get` | Indexed messages (Slack, Teams) |164| `glean activity` | `report`, `feedback` | User activity reporting |165| `glean tools` | `list`, `run` | Platform tools |166167## 10) Raw API access (`glean api`)168169```bash170glean api search --method POST --raw-field '{"query":"rust","pageSize":3}'171glean api --preview search --method POST --raw-field '{"query":"test"}'172```173174## 11) Interactive TUI175176Running `glean` with no arguments opens a full-screen chat:177178```bash179glean # open TUI180glean --continue # resume the most recent session181```182183# Output Expectations184185For every task, provide:1861871. Commands executed (or planned) in code blocks1882. Short result summary1893. If write operation succeeded, include the result explicitly1904. If operation fails, include exact error and next action191192All `glean` commands return structured JSON on stdout and errors on stderr. Use `jq` for parsing. Use `--dry-run` to preview requests before sending.193194# Error Handling195196- **`glean` not installed**: Tell user to install via `brew install gleanwork/tap/glean-cli` or the install script. Run `skills-check glean` to verify.197- **Not authenticated**: Run `glean auth login` (OAuth via browser). For CI/CD, set `GLEAN_API_TOKEN` and `GLEAN_HOST` environment variables.198- **Auth failure — ONLY allowed recovery steps**:199 1. Report the `glean` error message to the user200 2. Suggest `glean auth login` or `glean auth status`201 3. For token-based auth, suggest checking `GLEAN_API_TOKEN` and `GLEAN_HOST` are set202 4. Stop and wait for the user to fix auth203- **API errors**: Report status code and error body. Use `--dry-run` to debug request shape.204- **Unknown command**: Use `glean schema` to discover available commands and flags.205206# Notes207208- Every command returns JSON — pipe to `jq` for field extraction.209- Use `--dry-run` to preview requests before sending.210- Use `glean schema <command>` for machine-readable flag documentation.211- Use `--output ndjson` for streaming large result sets.212- The interactive TUI (`glean` with no args) is for human-interactive sessions; prefer `glean chat "..."` or `glean search "..."` for agent workflows.