Gorse CLI
Gorse CLI
Warning
The CLI is under development, and commands might be changed in later versions. Pull requests are welcomed: https://github.com/gorse-io/cli
gorse-cli is a command line tool for managing Gorse applications. It provides terminal access to common operations, including application statistics, task progress, user/item/feedback management, JSONL import and export, recommendation preview, recommendation pipeline configuration, and binary backup or restore operations.
Installation
curl -fsSL https://gorse.io/install.sh | shirm https://gorse.io/install.ps1 | iexbrew tap gorse-io/tap
brew install gorse-cliscoop bucket add gorse https://github.com/gorse-io/scoop-bucket
scoop install gorse-clinpm install -g @gorse/clinix profile install github:gorse-io/cligo install github.com/gorse-io/cli@latestThe Bash install script supports Linux on AMD64, ARM64, Loong64, and RISCV64, and macOS on ARM64. The PowerShell install script supports Windows on AMD64 and ARM64. Run gorse-cli --version to verify the installation.
Shell Completion
For shell completion setup instructions, replace <shell> with bash, zsh, fish, or powershell and run:
gorse-cli completion <shell> --helpAuthentication
Most commands need the Gorse master HTTP endpoint and admin API key. You can provide them in three ways. Each value is resolved independently in order of precedence: command flags, environment variables, --application, and finally the current saved application.
Save an application
An application stores the endpoint and API key in the system keyring and selects it as the current application:
gorse-cli application add local --endpoint http://localhost:8088If neither --api-key nor GORSE_ADMIN_API_KEY is provided, the command prompts for the API key. Application names may contain letters, digits, _, ., and -. Subsequent commands use the current application automatically:
gorse-cli application current
gorse-cli statsManage saved applications with:
gorse-cli application list
gorse-cli application use local
gorse-cli application delete localTarget a specific saved application for a single command without changing the current application:
gorse-cli stats --application localUse environment variables
export GORSE_ADMIN_ENDPOINT=http://localhost:8088
export GORSE_ADMIN_API_KEY=<api-key>
gorse-cli statsPass credentials per command
gorse-cli stats \
--endpoint http://localhost:8088 \
--api-key <api-key>Application and task status
Use these commands to inspect application statistics and background tasks:
# Show global statistics
gorse-cli stats
# List task progress
gorse-cli psstats displays the binary version, server and worker counts, user/item/label/feedback counts, and model scores and update times. ps lists tasks with their status, progress bar (or error message), and start/finish times.
Data management
Manage users, items, and feedback directly from the terminal.
Users
# List users (default: 10)
gorse-cli user list -n 20
# Show one user
gorse-cli user get <user-id>
# Add a user
gorse-cli user add <user-id> --labels '{"language":"en"}' --comment "Active user"
# Update user fields
gorse-cli user update <user-id> --comment "Newsletter subscriber"
# Delete a user (--yes is required)
gorse-cli user delete <user-id> --yesItems
# List items (default: 10)
gorse-cli item list -n 20
# Search items by query terms
gorse-cli item list release notes -n 10
# Show one item
gorse-cli item get <item-id>
# List item categories
gorse-cli item categories
# Add an item
gorse-cli item add <item-id> \
--category news \
--category tech \
--labels '{"tags":["go"]}' \
--timestamp 2026-01-01T00:00:00Z \
--comment "Release notes"
# Update item fields
gorse-cli item update <item-id> --category tech --is-hidden=false
# Delete an item (--yes is required)
gorse-cli item delete <item-id> --yesWhen listing users or items, if another page is available, gorse-cli prints a Next page: command with --cursor (and redacts --api-key as YOUR_API_KEY if passed on the command line). Note that --cursor is not supported when searching items with item list [query...].
For user update and item update, at least one update flag is required and omitted fields remain unchanged:
--labelsreplaces the entire JSON value; use{}or[]to clear it (nullis rejected).- An empty
--comment ""clears the comment. - On items, repeated
--categoryflags replace the category list; pass--category ""alone to clear all categories. - Use
--is-hiddento hide an item from recommendations and--timestampto set its RFC3339 timestamp.
Feedback
# Latest feedback records (newest first, default: 10)
gorse-cli feedback list -n 20
# Filter feedback by user, item, and/or type
gorse-cli feedback list --user <user-id>
gorse-cli feedback list --item <item-id>
gorse-cli feedback list --type like --user <user-id> --item <item-id>
# Add feedback (value defaults to 1, timestamp defaults to current time)
gorse-cli feedback add like <user-id> <item-id> \
--value 2 \
--labels '{"source":"web"}' \
--timestamp 2026-01-01T12:00:00Z
# Delete feedback (--yes is required)
gorse-cli feedback delete like <user-id> <item-id> --yesImport and export JSONL
user, item, and feedback each support import [file] and export [file] in JSON Lines (JSONL) format. Omit [file] or pass - to read from standard input or write to standard output.
# Export to a file or stdout
gorse-cli user export users.jsonl
gorse-cli item export - > items.jsonl
# Import from a file or stdin
gorse-cli user import users.jsonl
cat feedback.jsonl | gorse-cli feedback importexport overwrites the target file if it already exists. import replaces existing records with the same key; if a later batch fails, completed server-side batches are not rolled back.
Recommendation preview
The recommend commands preview recommendation results from the terminal.
# Latest items, optionally filtered by category
gorse-cli recommend latest -n 10 --category news
# Non-personalized recommendations by configured name (optionally exclude a user's read items)
gorse-cli recommend non-personalized popular -n 10 --user-id <user-id>
# Recommendations for a user using the default pipeline
gorse-cli recommend item-to-user <user-id> -n 10
# Recommendations for a user from a specific recommender (and optional configured name)
gorse-cli recommend item-to-user <user-id> collaborative -n 10
gorse-cli recommend item-to-user <user-id> non-personalized popular -n 10
# Item-to-item and user-to-user neighbors
gorse-cli recommend item-to-item similar <item-id> -n 10
gorse-cli recommend user-to-user similar <user-id> -n 10Repeat --category to filter by multiple categories on any item-returning recommend command (latest, non-personalized, item-to-user, and item-to-item):
gorse-cli recommend item-to-user <user-id> --category news --category sportsPipeline configuration
Use pipeline commands to inspect, update, or reset the recommend section of the Gorse configuration. Outputs are formatted as YAML, and the Master validates submitted configuration changes.
Global and section settings
# Print the current recommendation pipeline configuration as YAML
gorse-cli pipeline get
# Update global recommendation settings
gorse-cli pipeline update --cache-size 1000 --cache-expire 24h --context-size 100 --active-user-ttl 30Each singleton section supports get and update:
| Section | Key update flags |
|---|---|
data-source | --positive-feedback-type, --negative-feedback-type, --read-feedback-type (repeatable), --positive-feedback-ttl, --item-ttl |
search | --column (repeatable) |
collaborative | --type (none or mf), --fit-period, --fit-epoch, --optimize-period, --optimize-trials |
ranker | --type (none, fm, reranker, or decision), --recommender (repeatable), --cache-expire, --fit-period, --fit-epoch, --optimize-period, --optimize-trials, --early-stopping-patience, --reranker-*, --decision-* |
fallback | --recommender (repeatable) |
replacement | --enable-replacement, --positive-replacement-decay, --read-replacement-decay |
For repeatable list flags (--positive-feedback-type, --negative-feedback-type, --read-feedback-type, --column, and --recommender), passing a single empty value ("") clears the list.
# View and update data-source settings
gorse-cli pipeline data-source get
gorse-cli pipeline data-source update --positive-feedback-type like --item-ttl 72
# Configure collaborative filtering
gorse-cli pipeline collaborative update --type mf --fit-period 1h --fit-epoch 100
# Configure ranker and fallback recommender order
gorse-cli pipeline ranker update --type fm --recommender collaborative --recommender item-to-item/similar
gorse-cli pipeline fallback update --recommender non-personalized/popular --recommender latestNamed recommenders
Manage named recommender lists with list, get <name>, add <name>, update <name>, and delete <name>:
| Group | Flags |
|---|---|
non-personalized | --score (required on add), --filter |
item-to-item | --type (embedding, tags, users, or auto; required on add), --column |
user-to-user | --type (embedding, tags, items, or auto; required on add), --column |
external | --script or --script-file (mutually exclusive; one required on add) |
# Add, inspect, update, and remove a named recommender
gorse-cli pipeline item-to-item add similar --type auto
gorse-cli pipeline item-to-item list
gorse-cli pipeline item-to-item get similar
gorse-cli pipeline item-to-item update similar --type tags --column item.Labels.tags
gorse-cli pipeline item-to-item delete similarAdding a named recommender does not automatically update explicit ranker or fallback recommender lists; include its full reference (such as item-to-item/similar, non-personalized/popular, user-to-user/similar, or external/custom) when updating those lists. Because pipeline updates are read-modify-write, avoid concurrent edits from multiple clients.
Reset pipeline
Reset the recommendation pipeline to the configuration file defaults:
gorse-cli pipeline resetWarning
pipeline reset overwrites the current pipeline settings with the configuration file defaults. The command prompts for confirmation ([y/N]) before applying the reset.
Backup and restore
Export all Gorse data to a binary backup file (truncating any existing file at that path):
gorse-cli dump backup.binRestore data from a binary backup file:
gorse-cli restore backup.binWarning
restore overwrites existing users, items, feedback, and cache data. The command prompts for confirmation ([y/N]) before restoring, and reports the restored record counts and duration on completion.
Command reference
| Command | Description |
|---|---|
gorse-cli application add <name> | Add or update a saved application |
gorse-cli application list | List saved applications |
gorse-cli application use <name> | Switch the current application |
gorse-cli application current | Show the current application |
gorse-cli application delete <name> | Delete a saved application |
gorse-cli stats | Show global statistics |
gorse-cli ps | List task progress |
gorse-cli user list | List users |
gorse-cli user get <user-id> | Show one user |
gorse-cli user add <user-id> | Add a user |
gorse-cli user update <user-id> | Update user fields |
gorse-cli user delete <user-id> --yes | Delete a user |
gorse-cli user import [file] | Import users from JSONL |
gorse-cli user export [file] | Export users as JSONL |
gorse-cli item list [query...] | List or search items |
gorse-cli item get <item-id> | Show one item |
gorse-cli item add <item-id> | Add an item |
gorse-cli item update <item-id> | Update item fields |
gorse-cli item delete <item-id> --yes | Delete an item |
gorse-cli item categories | List item categories |
gorse-cli item import [file] | Import items from JSONL |
gorse-cli item export [file] | Export items as JSONL |
gorse-cli feedback list | List or filter feedback |
gorse-cli feedback add <feedback-type> <user-id> <item-id> | Add feedback |
gorse-cli feedback delete <feedback-type> <user-id> <item-id> --yes | Delete feedback |
gorse-cli feedback import [file] | Import feedback from JSONL |
gorse-cli feedback export [file] | Export feedback as JSONL |
gorse-cli recommend latest | Get latest items |
gorse-cli recommend non-personalized <name> | Get non-personalized recommendations |
gorse-cli recommend item-to-user <user-id> [recommender] [name] | Get recommendations for a user |
gorse-cli recommend item-to-item <name> <item-id> | Get item-to-item recommendations |
gorse-cli recommend user-to-user <name> <user-id> | Get user-to-user recommendations |
gorse-cli pipeline get | Print recommendation pipeline configuration as YAML |
gorse-cli pipeline update | Update global recommendation settings |
gorse-cli pipeline reset | Reset recommendation pipeline to file defaults |
gorse-cli pipeline <section> {get|update} | Get or update data-source, search, collaborative, ranker, fallback, or replacement |
gorse-cli pipeline <group> {list|get|add|update|delete} | Manage non-personalized, item-to-item, user-to-user, or external recommenders |
gorse-cli dump <file> | Dump all Gorse data as a binary backup |
gorse-cli restore <file> | Restore Gorse data from a binary backup |
gorse-cli completion <shell> | Generate shell completion scripts |
Run gorse-cli <command> --help for command-specific flags and examples.
