Config file
moodle-cli storesbase_url in a YAML file at ~/.config/moodle-cli/config.yaml. The first run that needs a base URL and finds none prompts for it (in an interactive terminal only) and writes it there.
config.yaml
- The path in
MOODLE_CONFIG, if that variable is set. ./config.yamlin the current directory.~/.config/moodle-cli/config.yaml.
Session cache
A validated session — a few profile fields alongside what’s needed to sign you back in — is cached at~/.cache/moodle-cli/session.json, encrypted at rest, with the file and its containing directory restricted to your user. The cache expires after 24 hours; an expired or missing cache triggers a fresh sign-in.
Pass --no-cache to skip the cache for a single command: it neither reads a cached session nor writes the one it obtains.
Global flags
These flags work on every command. See Output formats for--json/--yaml/--table/--fields, and Mutations for --yes and --dry-run.
--limit and --days are declared once on the program itself. A value you pass wins over the command’s own default, wherever you put it on the command line; leave it out and the command falls back to its own default: moodle due, for example, defaults --days to 14 and --limit to 20.
--verbose
-v / --verbose writes one line per request to stderr, naming what was requested and how long it took. It never logs your session cookie or an MCP (Model Context Protocol) access token.
Scripting this? See Moodle CLI for scripts and agents for --fields and --pretty.