CLI · Reference
Command reference
47 commands. Run any of them with upg <command> --help for the same options shown here. --help is intercepted before any command runs, so asking for help never triggers a side effect (no delete picker, no skill install).
Exit codes
Every command shares one exit contract. Gate CI on it: a violation is exit 2, distinct from a runtime error.
0- Success
1- Runtime error (bad value, I/O, unknown type)
2- Validation or policy violation (e.g. verify / check found a problem)
3- Usage error (missing arg, no TTY for an interactive picker)
Stand in the graph
Navigate by cursor and lens: move, look around, create where you stand.
Set the sticky operating lens (scopes vocabulary). No arg shows the current lens.
upg hereShow where the cursor stands (the current node) and the active lens.
upg atMove the cursor to a node (resolved by id or title).
upg lsList the cursor's neighbours, grouped by relationship, with a "next here" hint.
upg findFuzzy search; on a TTY, pick a result to move the cursor there.
upg newCreate a node and auto-link it to the cursor (edge + direction inferred).
upg linkConnect two nodes; edge type + direction inferred (auto-flips to canonical).
upg checkOne ranked verdict: structure + health + gaps + anti-patterns. Exit 2 on violations.
upg fixExecute the top auto-remediable fix from `upg check` (with confirmation).
Read
Inspect and score the graph. Safe, read-only.
Score the graph 0–100. Gate CI with --min-score.
upg verifyStructural validation. Exits 2 on violations for CI gates.
upg diffCompare the current .upg against a git ref. For PR reviews.
upg listQuery entities from the graph.
upg treeTree view of the graph. Filter by entity type or domain.
upg searchFuzzy text search across titles and descriptions.
upg queryTraverse the graph following typed edges, with field projection and truncation. The BFS primitive behind tree views.
upg specBrowse the UPG spec catalogue offline. No graph needed.
upg templateBrowse the curated starter templates (the library /upg-new-from-template and the site gallery use).
upg contextA lens-aware product summary: counts, key entities, and domain guidance.
upg logThe recent mutation feed for the graph (create / update / delete).
Create & edit
Mutate the graph: nodes, edges, and gap-driven scaffolding.
Create an entity. Type is validated against the spec.
upg updateUpdate an entity. Unspecified fields are preserved.
upg deleteDelete an entity and its edges. Omit ID for an interactive picker.
upg connectCreate an edge between 2 nodes. Type is auto-inferred.
upg gapsReport empty domains, broken chains, and sparse areas.
upg moveRe-parent a node under a new parent, re-typing its containment edge.
upg disconnectRemove a single edge by id (the inverse of connect).
upg dedupeFind and merge duplicate nodes (same type + title). Dry-run by default; --apply to commit.
upg batchAtomic batch operations: create, update, or delete many entities in one call.
Frameworks
Run a framework over entities and record the scores on the exercise, then read them back.
Run a framework over entities: creates a framework_exercise + an includes edge to each.
upg scoreRecord a framework's result for one entity on the exercise's includes edge.
upg showShow a framework exercise: each included entity + the scores recorded on its edge, as a table.
upg prioritiseRank entities by a scoring framework (RICE, ICE, WSJF, value-vs-effort). Read-only. --framework and at least one id are required.
Graph
Create, scope, and move whole graphs in and out of the .upg format.
Create a .upg file. Interactive by default.
upg workspaceWorkspace actions: list (default), switch <name>, rekind --kind <kind> <file...>.
upg importImport product knowledge from Markdown, Notion, Linear, Vistaly, Dovetail, or GitHub.
upg exportExport entities as JSON, Markdown, or CSV.
upg fmtRewrite .upg files to canonical form (byte-stable, diff-friendly).
upg migrateCatalogue-aware migrations: retype a node (applies spec defaults), migrate statuses/properties to current, or rename an edge type. Pairs with fmt and fix.
upg registryThe canonical-entity registry: shared entities many products instance. Operates on a portfolio graph (default portfolio.upg).
upg portfolioCross-product and portfolio operations: membership, cross-product edges, classification cells, a portfolio digest, and validation including portfolio anti-patterns.
upg areaProduct areas within a portfolio: the area hierarchy, area-scoped subgraphs, product membership, and audience links.
upg cloneScaffold a structure from a template product, optionally scoped to a region.
upg productEdit product-level fields (title, description, stage, member_kind).
upg syncReport local sync state vs the cloud (read-only; push/pull stay agent-only).
Setup
Wire the CLI and MCP server into your environment.