Skip to main content

LeanToken CLI Ergonomics & UX Specification#

Author: UX Architect
Audience: CLI Developers, End-Users, AI Coding Agents
Target: lean CLI v0.1.0


1. Ergonomic Principles#

  1. Sub-10ms Human & Machine Perception:

    • For an agent or developer running lean, command overhead must be imperceptible.
    • Any CLI execution taking >15> 15 ms violates UX budget.
  2. Zero-Configuration Golden Path:

    • Running lean init automatically detects the environment (Claude Code, Cursor, Windsurf, OpenCode) and applies the curated settings without prompt quizzes or marketplace decision fatigue.
  3. Telegraphic, High-Signal Terminal Output:

    • Don’t pollute developer terminals with giant ASCII banners or verbose status messages.
    • Use subtle ANSI indicators (✓, ⚡, ℹ, ⚠), concise delta numbers, and instant output.

2. Command Surface & Design#

2.1 lean init#

Sets up LeanToken in current directory or globally.

Flags:

  • --global, -g: Apply to global ~/.claude/CLAUDE.md and user shell profile.
  • --dry-run: Output generated rules without writing to disk.
  • --force, -f: Overwrite existing configuration safely after backup.

2.2 lean prune <command...>#

Runs a command, intercepts stdout/stderr, and returns the pruned, agent-optimized payload while saving the full raw stream to local CCR.

2.3 lean symbols <path>#

Zero-MCP symbol extractor. Emits minimal file signature outline for rapid context consumption.

2.4 lean learn#

Real output (aricon, 8 sessions). Out-of-band analyzer of the project’s Claude Code sessions. Writes .lean/MEMORY.md (hot files with section maps, failing commands).

2.4b lean audit#

Measures real sessions: model tokens, shell output pruned and skipped (with reasons), file reads, re-reads, large whole-file reads, most-read files. Options: --sessions=N, --json.

2.5 lean stats#

Displays this project’s measured pruning counters (no estimated figures). Real output from the first audited project; counters recorded from 0.3 on also show a per-output-type breakdown.


3. Fallback & Safety UX Contracts#

  • Fail-Open Policy: If lean prune encounters an unexpected error or parsing failure, it must immediately emit the original raw output without blocking or crashing, followed by a single silent debug warning to stderr.
  • Exit Code Fidelity: lean prune <cmd> must exit with the exact same exit code as the wrapped command. If the child process exited with code 1, lean prune exits with code 1.