Skip to content

Repository files navigation

space-cli

Command-line tool for querying and editing your local Space flashcard database. Reads directly from the PowerSync SQLite file the Space app syncs locally — no network calls, no cloud round-trips.

$ space deck list
┌──────┬─────────────────────────────┬───────┬──────┐
│ ID   │ Name                        │ Cards │ Due  │
├──────┼─────────────────────────────┼───────┼──────┤
│ ck3u │ Japanese Kanji — N5         │   104 │   12 │
│ f02a │ FSRS Paper Notes            │    37 │    3 │
│ 9a1e │ Rust Ownership & Lifetimes  │    58 │    0 │
└──────┴─────────────────────────────┴───────┴──────┘

Install

Homebrew (macOS & Linux)

brew install space-org/tap/space-cli

curl installer (macOS & Linux)

curl -fsSL https://raw.githubusercontent.com/space-org/space-cli/main/scripts/install.sh | sh

Installs to ~/.local/bin/space. Make sure that directory is on your PATH.

Manual download

Grab the archive for your platform from the latest release, extract it, and put the space binary somewhere on your PATH. Verify the SHA256 against checksums.txt if you care.

Platform Asset
macOS (Apple) space-cli-macos-arm64.tar.gz
Linux (ARM64) space-cli-linux-arm64.tar.gz
Linux (x86_64) space-cli-linux-x86_64.tar.gz
Windows (x86_64) space-cli-windows-x86_64.zip

Quickstart

space deck list                       # all decks
space deck show ck3u                  # details of one deck (prefix match)
space deck stats ck3u                 # retention, maturity, due today
space card search "過去形"            # full-text search across cards
space card show 7f2a                  # render one card
space group cards a91c                # cards inside a group

Write commands:

space deck create "Rust Ownership"
space card create --deck ck3u --front "..." --back "..."
space card edit 7f2a --back "new back"
space card delete 7f2a
space group move-cards --from a91c --to b02d

All commands accept ID prefixes — ck3u resolves to the full UUID as long as it's unique.

Run space --help for the full command tree.

Use Space from Claude or Codex with MCP

space mcp runs a local Model Context Protocol server over stdio. It gives supported AI clients six purpose-built tools:

Tool Effect
list_decks Read deck summaries
get_deck Read one deck, its groups, and a bounded card page
search_cards Read matching cards
create_deck Create a deck
create_cards Atomically append up to 100 cards
update_card Replace a card's front and/or back

There are no delete, media, group-mutation, raw-SQL, network, or telemetry tools. create_cards is not retry-safe: retrying the same request can create duplicates.

Claude Code

claude mcp add --scope user space -- space mcp

Codex

codex mcp add space -- space mcp

Claude Desktop

Add this entry to the mcpServers object in the Claude Desktop configuration:

{
  "mcpServers": {
    "space": {
      "command": "space",
      "args": ["mcp"]
    }
  }
}

If auto-detection does not find your database, pass an explicit path. For CLI configuration commands, replace space mcp with:

space --db-path /path/to/space.db mcp

For JSON configurations, use:

{"command": "space", "args": ["--db-path", "/path/to/space.db", "mcp"]}

The MCP server itself only accesses the local database. Your chosen AI client controls approval prompts and may transmit tool inputs or results according to that product's privacy settings. Enabling the write tools grants the client permission to modify local Space data. The Space app performs normal PowerSync synchronization after local writes.

This local stdio server works with clients that can launch local MCP processes. It does not connect directly to ChatGPT web, Claude web, or other products that require a remotely reachable HTTP MCP server.

How it works

  • Reads the local SQLite file the Space desktop app maintains (PowerSync + Drift).
  • Write commands use INSERT OR REPLACE on the ps_data__* tables; PowerSync picks up the changes on next sync.
  • FSRS retrievability/strength and card maturity are computed on-device, same formulas as the app.
  • --db-path <file> overrides auto-detection; handy if you keep a secondary profile or point at a backup.

Links

Building from source

dart pub get
dart compile exe bin/space.dart -o bin/space
./bin/space --version

Requires Dart SDK ^3.7.0.

About

No description, website, or topics provided.

Resources

Stars

8 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages