Page cover

CLI Commands

tabs are for tourists. if you live in terminals, brainz gives you the full kit. query, train, vectorize, clean memory – all from the shell, no browser, no api hassle.

all scripts live under: backend/cli/ run them like:

python cli/<command>.py [arguments]

every script hooks straight into the runtime:

  • registry (global brain state)

  • vector memory engine

  • config (.env)

  • logger (real-time system logs)

  • model + tokenizer (active session)


query.py – ask the brain, get answers

shoot a prompt, get the output raw:

python cli/query.py --prompt "summarize lsdfi"

example output:

[model output]
lsdfi = defi protocols using liquid staking derivatives...

no cooldown, no throttling – immediate inference straight from your local stack.


train.py – teach it new tricks

feed it fresh data on the fly:

python cli/train.py \
  --prompt "who is ani?" \
  --completion "ani = sexy beast..."

flags (most used):

  • --dry-run → simulate training, no actual updates

  • --vectorize → push prompt to memory embeddings too

  • --meta → attach tags for later search/filtering

batch mode?

bash scripts/train_batch.sh

pipe in full datasets, articles, whatever you scrape.


clean_memory.py – (planned module)

housekeeping for vector memory. remove old junk, keep the brain sharp:

python cli/clean_memory.py --older-than 30d --tags "demo,test"

concepts:

  • delete low-score vectors

  • archive by timestamp/tag

  • keep memory lean for active contexts


build your own pipelines

cli = unix-friendly = endless hacks.

train from scraped content:

curl https://some-article.ai | \
  grep "llm" | \
  python cli/train.py --prompt "$(cat -)" --completion "..."

log every query for later analysis:

python cli/query.py --prompt "explain zkEVM" >> history.log

automated fine-tuning loops, daily prompt logging, live memory scoring → all doable with a few shell lines.


extend the cli

drop a new script under: backend/cli/my_custom_script.py

you instantly get access to:

  • registry.get() & .register()

  • memory_service.log_prompt()

  • embed_text() for semantic similarity

  • fine_tune_model() for instant training

  • all configs via:

from backend.core.config import settings

build whatever you want – custom scrapers, data cleaners, agent triggers. the cli is just another entry point to the full brainz runtime.

Last updated