Skip to content

CLI and AI agents

The gymgym CLI is for people and for programs. It can print everything that it shows as JSON. It can create and edit everything that you build in the app (routines, plans and logged workouts), step by step or as whole documents.

Agents can use gymgym in two ways. Both give the same abilities and run the same code:

  • The MCP server at https://app.gymgym.club/mcp works with any assistant that speaks MCP. The assistant can run in the cloud (Claude, ChatGPT) or on your machine (Claude Code, Codex). You install nothing. You sign in and allow the assistant in the browser. The MCP server reference lists every tool.
  • CLI commands with --json are for scripts and for agents that run shell commands.

You need Node.js 24 or newer. Install the CLI from npm:

Terminal window
npm install -g @gymgym/cli
gymgym --help

New commands can reach the repository before they reach npm. To run the newest version, run the CLI from the repository:

Terminal window
git clone https://github.com/ifokeev/gymgym && cd gymgym
corepack pnpm install
alias gymgym="node $PWD/apps/cli/src/main.ts"
gymgym --help

The CLI talks to https://app.gymgym.club. For a self-hosted instance, pass --url <server> or set GYMGYM_URL.

The /connect page of the app walks people through this. It has setup text to copy for each client, and Settings → Connected apps links to it.

Add https://app.gymgym.club/mcp to your assistant as a remote MCP server. Many assistants call this a custom connector. For example, in Claude Code:

Terminal window
claude mcp add --transport http gymgym https://app.gymgym.club/mcp

In Codex (~/.codex/config.toml):

[mcp_servers.gymgym]
url = "https://app.gymgym.club/mcp"

The first time that the assistant uses the server, a gymgym page opens:

  1. Sign in with Google, GitHub, a passkey or a guest account. If several accounts are signed in on this browser, pick the account that the assistant must use.
  2. Check what the assistant asks for and choose Allow.

The assistant now acts as that account only. To give it another account, connect it again and pick the other account. Settings → Connected apps lists every app that you allowed. “Remove access” stops an app at once. Assistants register themselves with a Client ID Metadata Document. Older assistants use dynamic registration. You do not need to create anything first.

In the CLI, a profile is one signed-in account on one server. You can sign in a second account next to the first and switch between them:

Terminal window
gymgym login # the "default" profile
gymgym login --profile coach # another account; becomes current
gymgym profile # list them; * marks the current one
gymgym profile use default
gymgym today --profile coach # one command as another profile
GYMGYM_PROFILE=coach gymgym workouts
gymgym logout --profile coach # sign out of one and forget it

The web app has the same idea. Go to Settings → Account → Add account, then switch from the account list or the sidebar. The MCP server has it too: connect an assistant once for each account, and pick the account when you sign in.

  1. Run gymgym login once on the machine that the agent uses. Approve the code at /device in your browser. The CLI stores the session tokens for each profile in ~/.config/gymgym/config.json (mode 0600), or where $GYMGYM_CONFIG points.
  2. Give the agent the commands that it can run. A useful read-only set is today, plan, routine list|show, workouts, workout show, weight and exercises. Add routine apply, workout apply and log when the agent can write.
  3. Point the agent at the formats. gymgym routine schema and gymgym workout schema print JSON Schemas. --example prints a valid sample. Routine and workout documents explains every field.
  • --json is on every command. It prints the data as JSON on stdout. Prompts and progress go to stderr.
  • The exit code is 0 on success and 1 on any problem. A problem prints one line on stderr that starts with gymgym:. Document errors name the field, for example gymgym: Document problem at exercises[1].sets: expected a whole number 1–20. A command that fails saves nothing.
  • A command does not prompt when you give it everything. Destructive commands need --yes. import needs --yes without a terminal. workout --as-planned logs a routine without asking. You can pipe documents in with -.
  • You can name things with a name or an id. A routine takes its name, or a unique start of its name. A workout takes its id (or the last characters of it, as gymgym workouts shows), a date, or last. An exercise takes its everyday name or its id. When two exercises share a name, a document writes the name with the id after it, for example dumbbell one arm bent-over row [0292]. Write it back as it is, or use only the id. Exercise names follow the language of the account. Listings, search and documents use that language. A name in any of the languages of the app is accepted when it means one exercise.
  • Documents carry a unit (kg or lb), and gymgym reads and writes weights in that unit. Commands and MCP tools use the unit of the account. gymgym settings --unit lb (or the settings tool) changes it. A new account starts in the unit of the region of the browser: pounds in the US, kilograms elsewhere.

Read the routine, change it and write it back:

Terminal window
gymgym routine show "Upper A" --json > upper.json
# … change upper.json (add an exercise, change reps to "8-12", set "superset": "A" on two entries) …
gymgym routine apply upper.json

Or make one change at a time:

Terminal window
gymgym routine create "Upper A" --progression double
gymgym routine add "Upper A" "bench press" --sets 4 --reps 6-10 --weight 80 --rest 2:30
gymgym routine add "Upper A" pull-up --sets 3 --reps 6-10 --superset A
gymgym routine add "Upper A" "dumbbell lateral raise" --sets 3 --reps 12-15 --superset A
gymgym routine edit "Upper A" 1 --reps 5-8
gymgym routine move "Upper A" 3 1
gymgym plan set mon "Upper A"

A routine document can also plan extra sets for each exercise. "warmups": 2 plans warm-ups that ramp toward the first work weight, rounded to the plates that you own. "drops": 1 and "bursts": 1 plan drop sets and rest-pause bursts after the last work set. Each value is from 0 to 5. For an exercise done one side at a time, such as a one-arm row, the reps are for each side. An exercise can also carry a "note" of up to 140 characters: a tip that the workout shows above its sets, such as "down to a box". It can also carry a "why" of up to 280 characters: the reason for its sets, reps and rest, in a sentence or two. The coach writes one for every exercise of a new routine and reads it to answer why an exercise has the sets it has. The workout does not show it. If you leave "why" out of a document that changes a routine, the saved reason stays while the sets, the reps, the time, the rest and the extra sets stay, and it goes when one of them changes. An empty "why" removes it. "deload": true on the routine makes it a planned deload. Its sessions open on its own targets and never feed progression.

Routines live in folders and run on any day. Each folder suggests the routine after the one that you did last. Routines in no folder are under “My routines”.

Terminal window
gymgym program # the ready-made programs and their routines
gymgym program save ppl --name "Push Pull Legs" # a new folder with a copy of its routines
gymgym folder # folders, their routines and what comes next
gymgym folder create "Arms"
gymgym folder move "Arms and core" arms # or "My routines"
gymgym folder rename arms "Arms day"
gymgym folder archive "arms day" # hide it with its routines; nothing in it changes
gymgym folder restore "arms day" # put it back on the Workout screen
gymgym folder delete "arms day" --yes # its routines move to My routines (--with-routines deletes them)

An archived folder leaves the Workout screen with its routines, and gymgym folder lists it last, marked archived. Its routines keep their exercises, schedule and history, so a folder that you restore is the same as before.

Saving a program leaves the weekly schedule alone. If you keep a schedule, gymgym plan set puts routines on weekdays, for reminders. The MCP tools match these commands: list_programs, save_program, list_folders, save_folder, move_routine, archive_folder and delete_folder.

Use a document when the agent knows what you did:

Terminal window
gymgym workout apply - <<'JSON'
{ "name": "Evening push", "date": "2026-10-03", "minutes": 50,
"exercises": [ { "exercise": "bench press", "sets": ["80x8", "80x7@8", "80x6"] } ] }
JSON

In the text of a set, w: marks a warm-up, d: a drop set and rp: a rest-pause burst. For example: ["w:40x10", "80x8", "d:60x8"]. Warm-ups never count for volume, records or progression. Drop sets and bursts count for volume only. For a dumbbell or a kettlebell, write the weight of one. When the exercise holds one in each hand, such as a dumbbell bench press, its volume counts both. An exercise can carry a "note". With "pinned": true, the note returns in later workouts with that exercise. An exercise can also carry "skipProgression": true. The same flag on the workout excludes the whole session.

To correct a workout later, apply the edited output of gymgym workout show last --json. It keeps its id. For one exercise, gymgym log "bench press" 85x3 85x3 is shorter. The output of workout apply and log includes any new personal records.

To clear history, use these commands:

  • gymgym workout delete 2026-10-03 --yes removes one workout.
  • gymgym workout delete --from 2026-01-01 --to 2026-03-31 --yes removes every workout in a range of dates. Both days are included. You can leave out either end.
  • --all removes the whole history.

Without --yes, the command only says how many workouts it would delete and between which dates. The command never deletes a running workout. gymgym counts the records and the progress that the deleted workouts set again without them. There is no undo. The MCP tool delete_workouts does the same for assistants. In the coach of the app, it comes as a card that the person must confirm with Delete.