feat(harness): language workspace param + skill riscritta in inglese (semantica completa)

Due cambiamenti interconnessi da user review:

1. language come parametro workspace (spec decisione 9):
   - Config.language (default 'en') + workspaces PSD con 'language: it'
   - Generalizza Thoth oltre l'italiano: descrizioni tabelle/colonne ed evidence
     sono nel workspace language; le istruzioni della skill restano in inglese
     (piu' affidabili per modelli piccoli, meno ambigue)

2. Skill riscritta in INGLESE preservando la semantica COMPLETA dell'originale
   (autocritica: la mia riscrittura precedente aveva perso ~10 vincoli precisi):
   - 'promuovere' ambiguo (3 accezioni: phase advance / recommend / memory promote)
     -> 'never advance a phase or record a decision without confirmation'
   - recuperati vincoli persi: choice-is-confirmation (no reviewer_confirm dopo
     reviewer_decide), reviewer_select SOLO per iterazione no-decision, messaggi
     auto-contenuti obbligatori, artefatto = superficie di decisione (gate rilegge
     da disco per CTE/SQL), candidati con provenienza+score non verita', opzione
     'leave ambiguity open', F1 passa lista completa non solo ultima
   - language contract esplicito (istruzioni EN, output nel workspace language)

Sottomoduli cte/memoria/rewriting/sql-generation in inglese, semantica tecnica
intatta (regole AV-SQL, dim_time trick, max 5 memorie solo 3 tipi riusabili).

Verifica: 0 residui nsp/chirone, tutti i tht <cmd> citati registrati, 165 passed.
This commit is contained in:
2026-06-27 14:50:30 +02:00
parent de61034a8d
commit 292048f777
9 changed files with 317 additions and 262 deletions
+30 -31
View File
@@ -1,39 +1,38 @@
# Tecnica di generazione del piano CTE (Agent View Generation)
# CTE plan generation technique (Agent View Generation)
Adattata dallo step CTE di AV-SQL. I CTE catturano incrementalmente
l'informazione necessaria a rispondere alla domanda riscritta, SENZA
rispondere alla domanda finale (quella e' la fase successiva).
Adapted from the AV-SQL CTE step. CTEs incrementally capture the information needed
to answer the rewritten question, WITHOUT answering the final question (that is the
next phase).
Regole (dalla disciplina AV-SQL, valgono alla lettera):
Rules (from the AV-SQL discipline, hold verbatim):
1. Copia ESATTAMENTE i nomi di tabelle e colonne dal contesto schema fornito
(`tht schema render --format mschema-text --table ...`). Mai inventare
oggetti non presenti.
2. Tieni sempre le chiavi (PK e colonne di join) nei CTE: serviranno dopo.
3. Meglio una colonna in piu' che una in meno: se non sei sicuro, includila.
4. Un CTE = un sottoinsieme informativo con uno scopo chiaro (es. "ricoveri
con ablazione nel 2025"), nominato in snake_case parlante.
5. I CTE possono referenziarsi in catena; l'ultimo del file e' quello che
`tht cte test` interroghera'.
6. Ogni file in sessions/<id>/ctes/<nome>.sql contiene SOLO il blocco
`WITH ... AS (...)` (anche multi-CTE), SENZA SELECT finale. Una riga
`SELECT ...` dopo il blocco WITH causa un errore in `tht cte test`: non
aggiungerla mai. I CTE vengono testati **e approvati (decisione
`cte_approved`) nell'ordine del piano**: il CTE successivo è testabile
SOLO dopo che il precedente è stato approvato con `kind:"cte_result"`. La
CLI rifiuta i CTE fuori ordine (exit 5).
7. Filtri: usa i valori di campo verificati con `tht search` (match LSH sui
valori reali), non valori immaginati.
1. Copy table and column names EXACTLY from the schema context provided
(`tht schema render --format mschema-text --table ...`). Never invent objects
that are not present.
2. Always keep the keys (PK and join columns) in the CTEs: they will be needed later.
3. Better one column too many than one too few: if unsure, include it.
4. One CTE = one informative subset with a clear purpose (e.g. "ricoveri with
ablazione in 2025"), named in a speaking snake_case.
5. CTEs can chain-reference each other; the last one in the file is the one that
`tht cte test` will query.
6. Each file in `sessions/<id>/ctes/<name>.sql` contains ONLY the `WITH ... AS (...)`
block (multi-CTE allowed), WITHOUT a trailing SELECT. A `SELECT ...` line after
the WITH block causes an error in `tht cte test`: never add it. CTEs are tested
**and approved (decision `cte_approved`) in plan order**: the next CTE is testable
ONLY after the previous one is approved with `kind:"cte_result"`. The CLI refuses
out-of-order CTEs (exit 5).
7. Filters: use field values verified with `tht search` (LSH match on real values),
not imagined values.
Presentazione al reviewer, per ogni CTE del piano:
Presentation to the reviewer, for each CTE in the plan:
> **<nome>** — scopo: <una riga>
> Tabelle usate: <elenco> (tutte dal perimetro promosso)
> **<name>** — purpose: <one line>
> Tables used: <list> (all from the promoted perimeter)
> ```sql
> WITH <nome> AS (...)
> WITH <name> AS (...)
> ```
Dopo la conferma (o per revisione diretta del reviewer) scrivi il file e
testa: `tht cte test --session <id> <nome>`. Su errore o warning rilevanti,
discuti la correzione col reviewer prima di riscrivere il file. Se il
reviewer modifica il file a mano, RILEGGILO prima di ritestare.
After confirmation (or for direct reviewer review) write the file and test:
`tht cte test --session <id> <name>`. On error or relevant warnings, discuss the
correction with the reviewer before rewriting the file. If the reviewer edits the
file by hand, RE-READ it before re-testing.