Files
ThothII/harness
marcopan e58f6c092e fix(harness): workspace + write-URL + L2 tests per accesso REST reale
Bug trovato provando la connessione reale col .env: il write endpoint vive su un
PATH DEDICATO /vector/write/v1/ (non /vector/v1/), e il modello Config ha write_rest/
vector_write_rest a TOP-LEVEL (non nidificati in vector_db).

- .env.example: aggiunge THOTH_VEC_WRITE_REST_URL (path dedicato del writer, con
  avviso che le due chiavi valgono su path separati).
- workspaces/chirone-test.yaml: riscritto allineato a chirone.example.yaml + config.py
  (vector_rest/vector_write_rest top-level; write_rest punta a THOTH_VEC_WRITE_REST_URL).
- tests/l2/*: corretti gli accessi strutturali (ws.vector_write_rest invece di
  ws.vector_db.write_rest; ws.vector_rest invece di ws.vector_db.rest).
  test_value_grounding_real skip-when-import-fails su nsp.lshindex (modulo deferred da B3).

Verificato end-to-end: save_one_memory (embeddings -> writer REST /vector/write/v1/
-> upsert pgvector -> read-back reader) PASSED. Suite L0+L1: 109 passed. Suite L2:
4 passed, 1 skipped (lshindex deferred).

Nota operativa: THOTH_SSL_CA va lasciato VUOTO sulla workstation (cert GoDaddy
pubblico in certifi). I campi direct-transport (THOTH_DB_*, THOTH_VEC_PASSWORD)
sono obbligatori per il modello ma inutilizzati in transport=rest: riempiti con
dummy nel .env locale (come faceva ChironeWp3).
2026-06-27 08:20:36 +02:00
..

ThothII harness — nsp

The self-contained Pi layer of ThothII: a deterministic Python CLI (nsp) + a Pi gate extension (.pi/extensions/nsp-gate.js) that runs the 8-phase NL→SQL workflow, emitting and consuming widget-descriptor JSON. Derived from ChironeWp3 as a validated starting point, adapted (not assumed reliable) to the ThothII contract.

Install

cd harness
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

The nsp command is now on PATH. Node ≥ 20 is needed for the gate JS tests (npm test).

Configure

.env (gitignored — secrets live ONLY here)

cp .env.example .env
# fill in: THOTH_PROFILE, THOTH_DB_*, THOTH_DWH_API_KEY, THOTH_VEC_API_KEY,
#          THOTH_VEC_WRITE_API_KEY, THOTH_SSL_CA, THOTH_OLLAMA_URL, ...

Keys are never logged; URLs are fine. Rotate any key that appeared in chat.

workspaces/<name>.yaml

A workspace wires the relational DWH + the pgvector (dual-key) + embeddings + evidence. See workspaces/chirone.example.yaml. ${THOTH_*} tokens expand from .env.

The workflow

workflow.yaml is the single source of workflow truth (spec F2). Eight phases (F1 chiarimento → F8 datamart). Edit it to change the workflow; phase.py, the gate, and the skill all read from it — no mirrored constants to drift.

nsp phase meta --json        # the gate reads workflow facts from here
nsp phase meta               # human-readable

Run

The harness runs inside Pi (pi --mode rpc, cwd = harness/):

pi --mode rpc
# in Pi: /nuova-domanda "<your question in natural language>"

The gate (nsp-gate.js) presents reviewer widgets (widget-descriptor), the reviewer decides, and nsp persists decisions to the append-only ledger (review_decisions.jsonl). See docs/testing.md for what each interaction level validates.

Test

pytest            # L0 (testcontainers, real Postgres) + L1 (pure logic + gate builders)
npm test          # gate widget-builder golden + fuzzy tests (JS)
pytest -m l2      # L2: real GLM 5.2 + remote DWH (pre-release; needs .env + VPN + CA bundle)

L0 needs Docker (present on the dev machine). L2 is manual, non-deterministic, and skips cleanly without .env. See docs/testing.md for the honest split of what each level covers and — crucially — does not cover.

Layout

nsp/                 Python package (CLI + workflow + phase + decisions + db/rest/mschema/
                     vectorstore/evidence/search/session + memory)
.pi/                 Pi project (settings, prompts, themes, extensions/nsp-gate.js + gate/)
workflow.yaml        single source of workflow truth (F2)
workspaces/          workspace YAML definitions (D3)
scripts/             reader/writer RPC SQL for pgvector (D11)
tests/               L0 (testcontainers), L1 (logic + builders), L2 (real model + DB)
docs/                testing guide + workflow editing

Reference

  • Architecture spec: docs/superpowers/specs/2026-06-25-thothii-architecture-design.md
  • Implementation plan: docs/superpowers/plans/2026-06-25-harness-implementation.md