Operations

Common tasks

Use this page when you need exact commands for the most common ankicli workflows: inspecting collections, searching cards, changing notes, backing up, syncing, and running study sessions.

Copy this guide

Paste it into Claude, Codex, or OpenClaw for structured context.

Paste this page into your LLM chat for structured context.

When to use this

  • You want concrete commands rather than product-level examples.
  • You need a task-oriented page to hand to a human operator or an agent harness.

What the agent should know

  • Prefer read and preview commands before mutation commands.
  • Use backup and sync preflight steps explicitly instead of assuming remote and local state are already safe.

Inspect the local environment and collection

These are the baseline read commands to confirm the local setup, find profiles, and inspect the collection before anything riskier happens.

Inspection baseline

ankicli --json profile list
ankicli --json profile default
ankicli --json --profile "User 1" collection info
ankicli --json --profile "User 1" deck list

Search notes and cards safely

Use preview-style searches when a human or agent needs to inspect the target set before creating or changing anything.

Search and preview

ankicli --json --profile "User 1" search preview --kind notes --query 'deck:Default' --limit 10
ankicli --json --profile "User 1" search preview --kind cards --query 'tag:review' --limit 10

Create or update notes

Once the deck and model are confirmed, use note mutations directly. For updates, preview the target first and use `--dry-run` where the command supports it.

Note mutation examples

ankicli --json --profile "User 1" note add --deck Default --model Basic --field Front="Question" --field Back="Answer"
ankicli --json --profile "User 1" note update --id 123 --field Back="Updated answer"
ankicli --json --profile "User 1" note add-tags --id 123 --tag review --dry-run

Back up and sync explicitly

Backup and sync solve different problems. Use both intentionally instead of assuming one covers the other.

Backup and sync preflight

ankicli --json --profile "User 1" backup create
ankicli --json auth status
ankicli --json --profile "User 1" sync status
ankicli --json --profile "User 1" sync run

Run a study session

Study mode is for local tutor-style flows. Use it when a human or agent wants turn-by-turn session control without writing review grades back into Anki scheduling.

Study session

ankicli --json --profile "User 1" study start --deck Default --limit 10
ankicli --json study next
ankicli --json study reveal
ankicli --json study grade --rating good