CLI Reference
The Sophic CLI (usesophic) lets you authenticate, capture knowledge, and manage workspaces from your terminal.
Installation
npm install -g usesophic
This installs the sophic command globally.
Commands
sophic login
Authenticate via browser SSO and select your active workspace.
sophic login
Opens your browser to complete authentication. On success, a Personal Access Token and workspace list are saved to ~/.sophic/config.json. If you belong to multiple workspaces, you'll be prompted to choose one interactively.
Options:
| Flag | Default | Description |
|---|---|---|
--url <url> | https://app.sophichq.co | Sophic server URL |
Alias: sophic setup
sophic capture
Send a text snippet to the Sophic ingestion pipeline.
sophic capture "Redis failover: switch to replica-2, then promote via redis-cli"
You can also pipe content from stdin:
echo "Deploy note: always run migrations first" | sophic capture
pbpaste | sophic capture
cat incident-notes.txt | sophic capture
Pass - explicitly to read from stdin:
sophic capture -
Arguments:
| Argument | Required | Description |
|---|---|---|
text | No | The text to capture. Omit or pass - to read from stdin. |
Exit codes:
| Code | Meaning |
|---|---|
| 0 | Captured successfully |
| 1 | Authentication error, empty text, network error, or server error |
sophic workspace list
Show all cached workspaces. The active workspace is marked with *.
sophic workspace list
* acme-eng Acme Engineering owner
acme-platform Acme Platform editor
sophic workspace use <slug>
Switch the active workspace by slug. The slug must match a workspace in your cached list — if it doesn't, the command prints available options.
sophic workspace use acme-platform
sophic workspace show
Display the currently active workspace.
sophic workspace show
Workspace: Acme Engineering
Slug: acme-eng
Role: owner
Configuration
The CLI stores credentials and workspace state in ~/.sophic/config.json:
{
"personalToken": "...",
"apiUrl": "https://app.sophichq.co",
"activeWorkspace": "acme-eng",
"workspaces": [
{ "slug": "acme-eng", "name": "Acme Engineering", "role": "owner" }
]
}
Environment variables
Override config file values with environment variables — useful for CI/CD:
| Variable | Description |
|---|---|
SOPHIC_PAT | Personal Access Token (overrides personalToken in config) |
SOPHIC_API_KEY | Alias for SOPHIC_PAT (backwards compatibility) |
SOPHIC_API_URL | API base URL (overrides apiUrl in config) |
SOPHIC_WORKSPACE | Workspace slug (overrides activeWorkspace in config) |
Next steps
- API Reference — Programmatic access to documents and search
- MCP Integration — Connect AI agents to Sophic