Skip to content

💻 CLI Reference

SpecMem provides a comprehensive command-line interface for all operations.

Installation

pip install specmem

Global Options

specmem [OPTIONS] COMMAND [ARGS]...

Options:
  --version        Show version and exit
  --config PATH    Path to config file
  --verbose, -v    Enable verbose output
  --quiet, -q      Suppress output
  --help           Show help and exit

Commands Overview

Command Description
init Initialize SpecMem in a project
scan Scan and index specifications
build Build the Agent Experience Pack
query Search specifications
impact Analyze impact of changes
validate Validate specifications
cov Analyze spec coverage
guidelines Manage coding guidelines
serve Start the web UI
demo Launch demo with SpecMem's own specs

Lifecycle Commands

Command Description
health Display spec health scores
prune Archive or delete orphaned specs
generate Generate specs from code
compress Compress verbose specs

Quick Reference

# Initialize
specmem init

# Scan specs
specmem scan

# Build pack
specmem build

# Query
specmem query "authentication"

# Impact analysis
specmem impact --files src/auth.py

# Validate
specmem validate

# Spec coverage
specmem cov

# Coding guidelines
specmem guidelines                # List all guidelines
specmem guidelines --source claude  # Filter by source
specmem guidelines convert <id> steering  # Convert format

# Web UI
specmem serve

# Demo (try SpecMem instantly)
specmem demo

# Lifecycle management
specmem health                    # View spec health scores
specmem prune --orphaned          # Archive orphaned specs
specmem generate src/             # Generate specs from code
specmem compress --all            # Compress verbose specs

Configuration

SpecMem looks for configuration in this order:

  1. --config flag
  2. .specmem.toml in current directory
  3. .specmem.local.toml (local overrides)
  4. Environment variables

Exit Codes

Code Meaning
0 Success
1 General error
2 Configuration error
3 Validation errors found
4 No specs found

Environment Variables

Variable Description
SPECMEM_CONFIG Path to config file
SPECMEM_LOG_LEVEL Log level (debug, info, warning, error)
SPECMEM_NO_COLOR Disable colored output