CLI overview
Query courses, lessons, sections, and ask the knowledge base from your terminal.
The learnos CLI talks to your hosted LearnOS workspace using
browser OAuth (recommended) or a
personal access token.
It exposes the same primitives the web app and MCP server expose — listing
courses, searching, reading lessons, adding flashcards and notes, asking the
knowledge base, and inspecting progress.
Not yet published
The published learnos binary is planned but not yet shipped. This
reference documents the intended interface. Until release, run the same
commands from a checkout of the LearnOS repo via pnpm learnos -- <command>
(see the contributor guide).
Install
npm i -g learnos # or: pnpm add -g learnosAuthenticate
learnos login # browser OAuth → ~/.config/learnos/credentials.json
learnos whoamiOr export a PAT for CI: export LEARNOS_TOKEN=los_.... See
CLI auth for OAuth client registration and resolution order.
Commands
| Command | Purpose |
|---|---|
login / logout / whoami | Browser OAuth session management. |
oauth register-cli | Create the public CLI OAuth client (one-time). |
courses | List courses with completion progress. |
course create --title T [--source-url U] | Create a new empty course. |
search <query> [--course C] [--limit N] | Hybrid FTS + vector search. |
lesson get <id> | Full lesson markdown. |
lesson list --course C [--module M] | Lessons in a course / module. |
lesson add --course ID [--title T] [--module M] [--file F | stdin] | Append one markdown doc as a lesson. |
lesson add-md --course ID [--file F | stdin] | Split one doc into many lessons (H2/H3). |
chunk get <lesson_id> <anchor> | One section by anchor. |
flashcard add --lesson ID --question Q --answer A | Create a flashcard. |
note add --lesson ID [--content … | stdin] | Append a note entry. |
ask <question> [--course C] [--limit N] [--model M] | One-shot RAG answer. |
course quality <id-or-title> [--verbose] | Score a course on the six-category quality rubric. |
Global flags
--format json|text— output format. Defaults tojson, exceptaskwhich defaults totext.-h,--help— usage.
Scoping with --course
--course accepts either a course id or a title substring (case-insensitive).
Omit it to search the whole library.
learnos search "promises" --course "Web Development" --format text