RAGSpine
Getting Started

CLI & Scripts

Reference for the make targets and the developer entry-point scripts — ask, demo, server, worker, evals, and fixtures.

RAGSpine wraps its common dev and CI/CD commands in a root Makefile, a thin discoverable layer over the raw scripts in scripts/. Run make help to list every target.

Always run from the repo root. The scripts anchor on a .project-root marker — running from a subfolder breaks path resolution. You can read files anywhere, but invoke from root.

Every target defaults to the project venv interpreter (.venv/bin/python). Override it with make <target> PYTHON=python3.12 (the override is passed through to scripts/ci.sh and scripts/lint.sh too).

Make targets

CommandWhat it does
make venvuv venv .venv — create the project venv
make installeditable install with [dev,service] extras (the usual dev setup)
make install-alleditable install with [dev,service,llm,embed] (adds real LLM + embeddings)
make hooksgit config core.hooksPath .githooks — enable the pre-push CI gate (one-time per clone)
CommandWhat it does
make cithe gate: tests (-m "not gpu") + demo smoke — exactly what the pre-push hook runs
make testpytest tests/ -q -m "not gpu"
make lintruff + mypy (informational, non-blocking — not wired into the gate)
make fmtruff check --fix then ruff format over src/ragspine, scripts, tests
make driftflag docs whose covered code changed since last verified (scripts/check_doc_drift.py)

GitHub Actions is dormant (manual-trigger only) to avoid consuming minutes — the local gate is authoritative. scripts/ci.sh is the single source of truth for "is it green".

CommandWhat it does
make demorun the offline end-to-end demo — expects ALL CHECKS PASSED
make ask Q="…"ask offline via MockProvider, e.g. make ask Q="中国内地FY2024的REVENUE是多少"
make eval-qaQA evaluation against the golden set (baseline-gated)
make eval-retrievalBM25-vs-hybrid retrieval A/B harness
CommandWhat it does
make serverun the FastAPI server (scripts/run_server.py)
make workerrun the RQ worker (scripts/run_worker.py) — needs Redis running

There are also housekeeping and release targets: make fixtures (regenerate synthetic demo data, deterministic), make docs (build the static API-reference site), make clean, and make build / make publish / make publish-test for packaging.

Entry-point scripts

The make targets above are wrappers — here are the underlying scripts and their real flags.

scripts/ask.py

Single-question CLI: intent parse → clarification gateway → tool-use loop → definite value + lineage. mock mode is offline and deterministic and needs no API key.

ask.py
.venv/bin/python scripts/ask.py --provider mock --db data/fact_metric.db "香港去年REVENUE多少"
ArgumentDefaultPurpose
question (positional)the user question
--providermockmock (offline, deterministic) or anthropic (real Claude)
--dbthe default fact DBpath to the fact_metric sqlite store
--chunk-dbNonenarrative chunk-store path; when set, narrative/composite questions use real retrieval (BM25 + RRF + listwise rerank) — otherwise the narrative channel degrades honestly
--embeddingnonevector-channel backend: none (pure BM25), deterministic (offline lexical-hash, non-semantic), or openai (needs the SDK + config)
--reference-datetodaybase date YYYY-MM-DD for relative-period resolution
--modelthe default Anthropic modelmodel name for the anthropic provider
--base-urlNoneoverride the Anthropic API base URL (for an enterprise gateway)

scripts/run_demo.py

Offline end-to-end demo — generate synthetic data, extract, ingest, query, assert against ground truth. No flags; prints ALL CHECKS PASSED on success, exits non-zero on any mismatch.

run_demo.py
.venv/bin/python scripts/run_demo.py

scripts/run_server.py

Starts the FastAPI app under uvicorn. Configuration is injected via RAGSPINE_* environment variables (see Configuration); requires the [service] extra.

run_server.py
RAGSPINE_DB_PATH=data/fact_metric.db .venv/bin/python scripts/run_server.py --host 0.0.0.0 --port 8000
ArgumentDefaultPurpose
--host127.0.0.1listen address
--port8000listen port

scripts/run_worker.py

RQ worker that consumes the ingestion-job queue out-of-process. Needs Redis reachable and the [service] extra. The worker owns its own stores per job.

run_worker.py
RAGSPINE_REDIS_URL=redis://localhost:6379/0 .venv/bin/python scripts/run_worker.py
ArgumentDefaultPurpose
--queueragspine-ingestqueue name (must match the RQQueue default)

Next steps

On this page