Skip to main content

blankstate-cli

Terminal interface for Blankstate (Python). Measure interactions, inspect protocols, and monitor your AI agents in real time — from the command line. This package provides the bks command and uses the blankstate-sdk library (import blankstate_sdk).


Install

Requirements: Python 3.10+ and pip.

From PyPI (when published)

python3 -m venv .venv
source .venv/bin/activate          # Windows: .venv\Scripts\activate
python3 -m pip install --upgrade pip
python3 -m pip install blankstate-cli
bks --help

Install as a standalone tool (isolated environment, recommended for daily use):

pipx install blankstate-cli
bks --help

From this monorepo (development)

From the repository root (blankstate-py), install the SDK and CLI in editable mode so imports resolve:

python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -e "./packages/sdk" -e "./packages/cli"
bks --help

If you only have the packages/cli tree, install the SDK path explicitly:

python3 -m pip install -e /path/to/blankstate-py/packages/sdk
python3 -m pip install -e /path/to/blankstate-py/packages/cli

Run without the bks script on PATH:

python3 -m blankstate_cli --help

Authentication

# Interactive login — stores token in ~/.blankstate/config.json
bks auth login

# Check current auth and ICS balance
bks auth status

# Logout
bks auth logout

# Or set via environment variable (takes priority over saved config)
export BLANKSTATE_API_TOKEN=bks_your_token_here

Get a token at atlas.blankstate.ai.


Commands

bks status

API health, engine versions, and ICS balance.

$ bks status

  API:           healthy
  Authenticated: true
  SGM versions:  1.0 · 1.5

  ICS cap:       40
  ICS used:      4
  ICS remaining: 36
  Period:        2026-03

bks protocol list

List protocols in your account.

$ bks protocol list

  50 protocol(s):

  Customer Support Quality [SGM 1.0]
    ID:       proto-6d28a7b8-a905-45f3-81f5-2cd574813450
    Versions: 0.1, 0.2

  Agent Safety Monitor [SGM 1.5]
    ID:       proto-f302e022-1ed2-4546-abcb-e942239d5c79
    Versions: 1.0

bks protocol inspect <id>

Full protocol definition with metamarkers.

bks protocol inspect proto-6d28a7b8-a905-45f3-81f5-2cd574813450

# Save a local YAML snapshot
bks protocol inspect proto-6d28a7b8-a905-45f3-81f5-2cd574813450 --save

# Alternate ID flag
bks protocol inspect --id proto-6d28a7b8-a905-45f3-81f5-2cd574813450
  Customer Support Quality
  ────────────────────────
  ID:          proto-6d28a7b8-a905-45f3-81f5-2cd574813450
  Version:     0.2
  SGM version: 1.0

  Metamarkers (9):
    - Solution-Oriented
    - Empathy
    - Professional Tone
    - Acknowledgment
    - Clarity
    ...

--save writes a .yaml file to ~/.blankstate/protocols/.


bks sense <protocol> <content>

Measure content against a protocol.

# Inline text
bks sense proto-xxx:1.0 "The agent resolved the customer's issue with clear steps."

# From a file
bks sense proto-xxx:1.0 --file transcript.txt

# Options
bks sense proto-xxx:1.0 "..." --profile discovery
bks sense proto-xxx:1.0 "..." --depth full
bks sense proto-xxx:1.0 "..." --save md         # save trace to ~/.blankstate/measurements/
bks sense proto-xxx:1.0 "..." --save yaml
bks sense proto-xxx:1.0 "..." --save both

The Python CLI prints a framed summary (spectral waveform, fidelity line, optional C×B×I bars, resonance dots, ICS/timing). Example layout (values illustrative):

  ┌─ SENSE ─ ... ─ SGM 1.0 ── 0.8200 ─┐
  │  proto-xxx:1.0                    │
  ├───────────────────────────────────┤
  │  ▁▂▃▄▅▆▇█ ... (waveform)          │
  │  ──────────────── fid 0.74 ─      │
  ...
Flag Description
--file <path> Read content from file
--language <code> Language code (default: en)
--profile <type> raw | detailed | discovery
--depth <level> measure (scores only) | full (+ entities, evidence)
--detail Show full resonance decomposition inline
--save <format> md | yaml | both — save artifact to ~/.blankstate/measurements/
--trace Alias for --save md (also writes legacy ~/.blankstate/traces/)

bks session <protocol> [protocol...]

Interactive sensing session. Type content, get a measurement. Ctrl+C to exit.

# Inline session — single protocol, stays in your terminal
bks session proto-xxx:1.0

# Pipe agent output
my-agent | bks session proto-xxx:1.0 --pipe

# Watch a log file for new lines (polled; appends are detected)
bks session proto-xxx:1.0 --watch ./agent-output.log

# Save session log (markdown under ~/.blankstate/sessions/)
bks session proto-xxx:1.0 --log

# Full-screen dashboard (Textual; optional extra)
pip install 'blankstate-cli[tui]'
bks session proto-xxx:1.0 --tui

# Optional: fake sparkline motion every second (demos only)
bks session proto-xxx:1.0 --tui --demo-spark

# Same dashboard with stdin lines (must be a pipe/redirect, not an interactive TTY)
my-agent | bks session proto-xxx:1.0 --tui --pipe

# Same dashboard while tailing a file (you can still type in the TUI)
bks session proto-xxx:1.0 --tui --watch ./agent-output.log

# Multi-protocol TUI — Tab picks ECG detail; each line is sensed against every pane (Node parity)
bks session proto-a:1.0 proto-b:1.0 --tui

# Verbose MCP / watch tracing (default TUI log is quiet)
bks session proto-xxx:1.0 --tui -v

# Replay entire events.jsonl from the beginning once (can be slow if the file is large)
bks session proto-xxx:1.0 --tui --mcp-replay

The --tui flag launches a Python Textual dashboard:

  • Overview: one sparkline row per protocol. Tab selects which pane drives the ECG detail panel (wave, actants, last, timeline). Typed lines, --pipe, and --watch each run sense in parallel on every loaded protocol (via _sense_all_protocols).
  • Slash commands (TUI): /list, /protocols, /browseinteractive API browser (Space toggles, Enter adds selected, Esc cancels); /add, /remove (max 9 panes; duplicate base protocol ids rejected; failed API lookup still adds raw id); /chronicle, /chr, /tail [n]; /mini, /compact, /full, /expand; /sessions, /historysplit-pane file list + markdown preview under ~/.blankstate/sessions/; /clear, /help, /quit. F1 / Ctrl+H toggle help. After each sense, a background depth: full call merges richer entities into actants.
  • MCP: sense rows in ~/.blankstate/live/events.jsonl merge into the pane whose protocolId matches. Default MCP log is quiet; -v adds detail. --mcp-replay replays the JSONL from the start. MCP polling is ~1s.
  • Resize: spark + ECG reflow. --pipe needs redirected stdin. --demo-spark only in interactive TUI. --log writes all panes to one append-style markdown file with ## [protocol-id] sections. Without --log, quitting after any measurements still writes a snapshot to ~/.blankstate/sessions/session-<iso>.md (scores, chronicle, activity tail).

Parity with the original CLI monitor

Original (Ink/Node) Python (--tui)
Plain text → all protocols in parallel (senseAll) Same (_sense_all_protocols)
Tab = highlighted / ECG-focused cell Same (ECG = active pane)
/list interactive API browser, multi-select, Enter adds Textual modalListView, Space, Enter (ProtocolBrowseScreen)
/chronicle cycles entity context types (C×B×I chronicle column) Cycles entityType filter on ECG actants + CHRONICLE strip; falls back to /tail when empty
/sessions, /history split-pane file browser List + scrollable preview (SessionFilesScreen)
/mini, /full compact layout /mini//compact hide ECG + activity/chronicle strips, slim MCP log; /full//expand restores
/clear resets scores + activity log + entities for all panes Same (all panes + MCP + activity/chronicle log views)
/help toggles help Same (F1 / Ctrl+H / /help)
Phase-2 depth: 'full' sense for richer entities (background) run_worker + depth="full" after each measure pass (_entity_depth_worker)
Auto-save session on exit when measured > 0 session-<ts>.md when not --log; --log still writes the detailed session-<id>.md

Reference implementation: blankstate-node/packages/cli/src/commands/monitor.tsx.

In inline (test) mode, the non-TUI Python session accepts:

Command Description
/clear Reset measurements and actant map in the session
/quit, /exit, /q End the session
/list Show the current protocol id, name, SGM, and measurement count
/tail [n], /chronicle [n] Print the last n measurements (default 15, max 100)
/sessions, /history List recent ~/.blankstate/sessions/*.md
/help, /? Print commands; points to --tui for /add / /remove
Flag Description
--tui Full-screen Textual dashboard (pip install 'blankstate-cli[tui]'; optional --pipe / --watch)
--demo-spark With --tui: append a fake score every second (demos only)
-v, --verbose With --tui: verbose MCP / watch log lines
--mcp-replay With --tui: replay ~/.blankstate/live/events.jsonl from the start
--pipe Read interactions from stdin
--watch <file> Poll a file for new lines
--log Save session to ~/.blankstate/sessions/
--language <code> Language code (default: en)

In TUI mode use q or Ctrl+C to quit, Tab for ECG focus, F1 / Ctrl+H to toggle help. --pipe / --watch lines are sensed against all panes. /clear clears every pane and the MCP log view (not events.jsonl on disk).

Phase 4 (session TUI) — status

In place: Textual dashboard; parallel multi-protocol sense; Tab + ECG; ACTIVITY + CHRONICLE strips; /mini//full; auto-save snapshot on quit (no --log); interactive /list browser; /sessions preview modal; background depth: full entity merge; /tail, chronicle filter, MCP tail, --mcp-replay; batched MCP refresh; ~1s poll; --pipe / --watch; -v; idle shimmer; TTY cleanup; tests in tests/test_tui_dashboard.py and tests/test_session_slash_inline.py.

Remaining stretch: Ink per-entity C×B×I history (we use aggregate + per-measurement scores), mouse layout, huge JSONL perf, real Windows terminal E2E.


Environment Variables

Variable Description Default
BLANKSTATE_API_TOKEN API token (overrides saved config)
BLANKSTATE_API_URL API base URL https://ibf.blankstate.ai

Local Files

The CLI stores config and artifacts in ~/.blankstate/:

Path Description
~/.blankstate/config.json Auth token and API URL
~/.blankstate/protocols/ Protocol snapshots (.yaml, via inspect --save)
~/.blankstate/measurements/ Measurement traces (.md / .yaml, via sense --save)
~/.blankstate/traces/ Legacy mirror of markdown traces (via sense --trace / --save md)
~/.blankstate/sessions/ Session logs (.md, via session --log)
~/.blankstate/live/events.jsonl MCP live events (bks_sense / bks_validate); TUI --tui tails this file

Requirements

  • Python ≥ 3.10
  • API token from atlas.blankstate.ai
  • A terminal that supports ANSI escape codes for session redraws and formatting (Windows Terminal, iTerm2, most modern terminals)

Issues

License

MIT — blankstate.ai

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blankstate_cli-0.1.2.tar.gz (41.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blankstate_cli-0.1.2-py3-none-any.whl (42.2 kB view details)

Uploaded Python 3

File details

Details for the file blankstate_cli-0.1.2.tar.gz.

File metadata

  • Download URL: blankstate_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 41.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for blankstate_cli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 eef4882cc34d8f7692b369221ca31a6d63a1adade6a17d504b0e993128778e9e
MD5 a665c23b57cffb62770ce41cd03568a8
BLAKE2b-256 afeefad137089498cdf26b9b795c5bf466b8dcfb7282d0349fb26b21adcbaaf1

See more details on using hashes here.

File details

Details for the file blankstate_cli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: blankstate_cli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 42.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for blankstate_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 68f8d487e2f2ffa28f6c3825db4a9a54e48ecb12c08192e85639fa266aefa7be
MD5 951c74070486ae37c1e0b691e9d723ef
BLAKE2b-256 48ad3ec99433af299c28a4af894441d76594a79b66d1cd51b76c72abf25c20cf

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 files

0.1.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page