docs: retrofit domain docs to GLOSSARY.md and chronological ADRs
Publish documentation / publish (push) Successful in 29s

Align domain documentation with the mattpocock-skills v1.3.1 format.

- GLOSSARY.md (Italian) replaces CONTEXT.md and describes the implemented
  system (Phase F1–F8, Gate, Reviewer widget). The unimplemented 2026-08-23
  modular-workflow vocabulary (Workflow Kernel, Stage, Module outcome,
  Extension point, Question Admission, ...) is removed.
- docs/adr/ renumbered chronologically, in English, with status/date
  frontmatter. Retroactive decisions recovered from deleted specs and the
  Evidence ADRs deleted in a54d4769 are restored.
- docs/agents/domain.md regenerated; references updated across docs.

New ADRs:
  0001–0016  retroactive decisions, 2026-06-25 → 2026-08-20
  0017–0024  Evidence ADRs of 2026-08-24 (old 0001–0008, deleted in a54d4769)

Renumbered ADRs (old → new):
  0001 → 0025  postgres-metadata-catalog
  0002 → 0026  workspace-database-secret-references
  0003 → 0027  installation-local-database-bindings
  0004 → 0028  fastify-kysely-metadata-catalog
  0005 → 0029  hard-delete-catalog-tables-during-synchronization
  0006 → 0030  separate-physical-and-logical-relationships
  0007 → 0031  durable-authoritative-schema-synchronization
  0008 → 0032  allow-manual-catalog-metadata-cleanup
  0009 → 0033  use-one-sequential-description-generation-run
  0010 → 0034  allow-bounded-real-source-samples-for-description-generation
  0011 → 0035  gate-source-samples-with-a-sensitive-data-flag
  0012 → 0036  use-the-catalog-as-the-logical-relationship-authority
  0013 → 0037  use-one-installation-model-catalog-with-runtime-projections
  0014 → 0038  assess-sensitive-columns-locally-from-source-content
  0015 → 0039  use-progressive-sampling-for-sensitive-columns
  0016 → 0040  use-postgres-metadata-for-all-core-consumers
  0017 → 0041  separate-reference-vectors-from-runtime-memory
  0018 → 0042  use-postgres-for-memory-and-qdrant-for-retrieval
  0019 → 0043  author-evidence-in-app... → maintain-local-evidence-with-external-editors
  0020 → 0044  unify-administration-pages-and-use-namespaced-routes
  0021 → 0045  separate-shell-modes-and-replaceable-portal-adapter
  0022 → 0046  separate-ui-locale-from-session-interaction-language
  0023 → 0047  separate-delivery-operations-from-finalized-sessions

Commits and Gitea issues before this commit cite the old numbers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Codex
2026-10-17 22:23:25 +02:00
co-authored by Claude Opus 5.5
parent 3222713ec6
commit 8bd1f3e793
75 changed files with 1327 additions and 1078 deletions
@@ -1,26 +0,0 @@
# PostgreSQL come autorità dei metadati dei database dei workspace
ThothII userà un Metadata Catalog PostgreSQL interno per conservare, per ogni workspace, la
struttura fisica acquisita interrogando il relativo database e i metadati semantici generati con
l'AI. Ogni Workspace Database conserverà un `workspace_id` obbligatorio e univoco: questo realizza
l'associazione uno-a-uno senza introdurre nel catalogo una tabella Workspace o una foreign key SQL.
Identità e lista dei workspace resteranno autorevoli in `thoth-workspaces.yaml`; il servizio
validerà il riferimento contro quel catalogo. `schema/annotations.yaml` verrà sostituito come input
del core in uno step successivo; l'interfaccia e il lifecycle amministrativi resteranno separati dal
workflow NL→SQL.
## Considered Options
- Conservare `annotations.yaml` come fonte di verità avrebbe mantenuto il revisionamento Git, ma
non avrebbe fornito il CRUD e il processo di introspezione/generazione richiesti.
- Leggere metadati mutabili dal catalogo senza un confine esplicito avrebbe accoppiato il workflow
alla disponibilità del nuovo servizio e consentito viste parziali durante gli aggiornamenti.
## Consequences
PSD importerà le annotations esistenti; gli altri workspace genereranno i metadati da zero. Il
cutover futuro dovrà sostituire consapevolmente i consumatori delle annotations e verificarne
l'equivalenza semantica. PostgreSQL può garantire che uno stesso `workspace_id` non sia assegnato a
due database, ma l'esistenza del workspace e la gestione di rename o rimozioni restano responsabilità
del confine applicativo con il catalogo YAML. Le sessioni di test esistenti non sono un vincolo di
migrazione.
@@ -0,0 +1,20 @@
---
status: accepted
date: 2026-06-25
---
# Run the agent through Pi RPC with a gate extension
The model runs inside Pi in `--mode rpc`, one child process per session. Human review is enforced
by a gate extension inside Pi (`harness/.pi/extensions/tht-gate.js`) that emits widget descriptors
through Pi's extension UI requests; the backend only translates those requests and the reviewer's
responses between Pi and the browser and implements no gate logic of its own. The gate,
anti-bypass and kickoff logic came from ChironeWp3 and already relied on Pi's extension and RPC
contract; reimplementing them in the backend would have meant rewriting the most delicate part of
the workflow from scratch.
## Consequences
Every reviewer interaction is a JSON widget descriptor, so the browser, not a terminal, is the
primary reviewer surface (see ADR-0009 for native terminal rendering). Pi upgrades are a direct
dependency of the review contract.
@@ -0,0 +1,21 @@
---
status: accepted
date: 2026-06-25
---
# Keep workflow state in harness phase documents
The harness owns the NL→SQL workflow and all of its persistence. A session is a manifest, one
document per phase (`question.md`, `schema_linking.json`, `sql_final.sql`, …) and an append-only
decision ledger; there is no stored transcript, and a resumed Pi process rebuilds its context from
those documents. The workflow is a linear sequence of phases declared in `harness/workflow.yaml`,
and the current phase is never stored: it is an integer derived by folding the ledger. This keeps
the ChironeWp3 session model, whose append-only ledger was its most reliable part, and makes
resumption independent of chat history.
## Consequences
What is not recorded in a phase document or in the ledger did not happen. Phase logic must be read
from the fold, not from a field, and adding parallel or optional branches would require a different
model than the linear workflow. Where sessions are stored changed later (ADR-0011); this ownership
did not.
@@ -1,19 +0,0 @@
# Riferimenti al secret store per i Workspace Database
Il Metadata Catalog non conserverà credenziali o chiavi dei Workspace Database. Riuserà il secret
store cifrato già posseduto da ThothII e conserverà soltanto riferimenti ai requisiti segreti del
workspace, evitando un secondo vault e impedendo che API, esportazioni o log espongano i valori.
## Considered Options
- Copiare i campi testuali del modello ThothAI avrebbe semplificato il CRUD, ma avrebbe conservato
password e passphrase in chiaro.
- Introdurre subito un secondo vault avrebbe separato il catalogo dal runtime workspace, ma avrebbe
duplicato cifratura, rotazione, autorizzazioni e procedure operative senza un'esigenza distinta.
## Consequences
Il catalogo e il runtime condividono l'identità dei requisiti segreti, mentre permessi e API del
catalogo restano separati. Sostituzione e cancellazione di un Workspace Database dovranno definire
esplicitamente il lifecycle dei relativi riferimenti senza includere i valori nelle transazioni del
catalogo PostgreSQL.
@@ -1,26 +0,0 @@
# Binding di database specifiche dell'installazione
Il Metadata Catalog separa il Workspace Database logico dalla Database Binding che lo rende
raggiungibile in una specifica installazione. Esiste un solo Workspace Database per `workspace_id`
e una sola binding attiva nel catalogo di ciascuna installazione; per esempio PSD usa REST in locale
e PostgreSQL diretto sul server senza diventare due database distinti.
Nel modello finale il catalogo è autorevole per engine, nome fisico, schema, capability e binding,
mentre `thoth-workspaces.yaml` conserva l'identità del workspace. Gli attuali campi DWH dei
descriptor sono una sorgente di bootstrap da importare e confrontare durante un cutover esplicito,
non una seconda fonte di verità permanente.
## Considered Options
- Conservare un record database per ogni trasporto avrebbe duplicato identità, struttura e
metadati dello stesso DWH fra locale e server.
- Conservare permanentemente i dati DWH sia nello YAML sia nel catalogo avrebbe introdotto
conflitti non risolvibili deterministicamente.
- Rendere globali le binding avrebbe mescolato endpoint e credenziali che appartengono a
installazioni con topologie e confini di sicurezza differenti.
## Consequences
La lista amministrativa unisce workspace YAML, database configurati e record orphaned. Il cutover
deve importare e confrontare la configurazione esistente prima di rimuoverla dai descriptor; il
runtime non deve osservare simultaneamente due autorità discordanti.
@@ -0,0 +1,18 @@
---
status: accepted
date: 2026-06-25
---
# Keep the workflow CLI in Python
The deterministic workflow logic (introspection, value sampling, LSH and RRF search, schema
linking, SQL validation and preview) lives in a Python CLI inside the harness, ported from
ChironeWp3, and the gate calls it through `bash`. The Node backend does not reimplement it. Porting
the existing SQLAlchemy, LSH and schema-linking code was less risky than a TypeScript rewrite, and
it kept drivers such as Informix, which have no usable Node driver, available.
## Consequences
The harness has two runtimes (Python and the JavaScript gate), and the CLI's `--json` output is a
machine contract between them and the backend. The backend later gained its own database access
for the Metadata Catalog (ADR-0028); the NL→SQL workflow logic remains in Python.
@@ -1,22 +0,0 @@
# Metadata Catalog nello stesso backend con Kysely
Il Metadata Catalog vive nello stesso processo Fastify come modulo isolato, invece di introdurre un
microservizio. Usa il driver `pg` già presente attraverso Kysely per query, transazioni e migrazioni
tipizzate; route, repository, service, readiness e diagnostica restano separati dal workflow e
l'indisponibilità del catalogo non rende indisponibili sessioni o SSE.
## Considered Options
- Un microservizio avrebbe conservato letteralmente il backend bridge senza database, ma avrebbe
aggiunto deployment, autenticazione e failure mode per un solo contesto amministrativo.
- Usare soltanto `pg` avrebbe evitato una dipendenza, ma avrebbe richiesto infrastruttura locale per
transazioni, tipi delle righe, ordinamento e locking delle migrazioni.
- Drizzle o Prisma avrebbero aggiunto schema DSL, generatori e toolchain non necessari a un servizio
che vuole mantenere SQL e constraint PostgreSQL espliciti.
## Consequences
Il backend possiede una connection pool del catalogo e la chiude con il lifecycle Fastify. Le
migrazioni timestampate sono compilate insieme al backend ma vengono eseguite soltanto da
`catalog:migrate`, con credenziali migrator separate dal ruolo DML usato a runtime. Il modulo resta
dietro un'interfaccia repository per mantenere unit test e route test indipendenti da PostgreSQL.
@@ -0,0 +1,20 @@
---
status: accepted
date: 2026-06-25
---
# Tear down later artifacts when reopening a phase
When the reviewer returns to an earlier phase, every choice made after that point is forgotten and
the artifacts produced by later phases are deleted. `tht phase reopen` first appends
`phase_reopened` to the ledger and then removes the later artifacts; the ledger itself stays
append-only, and an effective view excludes decisions made stale by the reopen. ChironeWp3 only
appended the reopen decision, so stale artifacts and decisions survived and could block
finalization (for example orphan CTEs); a rollback that leaves inconsistent state was judged worse
than none.
## Consequences
Helpers must read the effective view, never the raw ledger. The ledger-first order means a crash
can leave a reopened session with stale files, which later steps must tolerate, but never later
artifacts without the reopen that invalidates them.
@@ -0,0 +1,12 @@
---
status: superseded by ADR-0010
date: 2026-06-25
---
# Run all layers on the operator workstation
The first release runs frontend, backend and harness on the operator's own machine over localhost,
like a desktop application with a browser UI, while the data warehouse and vector store stay
central and are reached over REST. This matched how operators worked on dedicated workstations
with ChironeWp3. Keeping three separate layers even on one machine was meant to allow a later move
to a central web application without changing the contracts.
@@ -0,0 +1,12 @@
---
status: superseded by ADR-0013
date: 2026-06-25
---
# Share a central vector store through reader and writer keys
The pgvector store stays central and is exposed over REST through two allow-listed endpoints with
distinct API keys: a reader key for search and an optional writer key that can only upsert records
and read hashes, never delete. A targeted `memory save-one` upsert lets a remote workstation save
the Memory it just created without a full server-side resync. The split let remote workstations
write Memory without receiving a key that could clear the shared store.
@@ -0,0 +1,12 @@
---
status: superseded by ADR-0015
date: 2026-06-25
---
# Select authentication from none, mock or OIDC
Authentication is chosen by configuration: `none` (a fixed local user, the primary mode for a
single-operator workstation), `mock` (a static user from a header, for tests) or standard `oidc`.
Sessions record the authenticated user as their author. One OIDC code path covers both an external
identity provider and a later central deployment, while `none` keeps the harness and its tests
independent of authentication.
@@ -0,0 +1,11 @@
---
status: superseded by ADR-0012
date: 2026-06-25
---
# Define workspaces as harness YAML
Each workspace (relational database, vector store, Evidence and embeddings) is a YAML file under
`harness/workspaces/`, with secrets kept in `.env` and referenced as `${VAR}`. Loading is isolated
in one harness module so that a later storage change touches only that boundary. This followed
ChironeWp3 and kept workspaces versionable and testable.
@@ -0,0 +1,18 @@
---
status: proposed
date: 2026-07-04
---
# Render gate widgets natively in the Pi terminal
When Pi runs interactively, the gate could render reviewer widgets with Pi's native terminal
primitives (`select`, `confirm`, `editor`) instead of printing the JSON widget descriptor, while
RPC mode keeps emitting descriptors for the browser. The discriminator is `ctx.mode === "tui"`;
`ctx.hasUI` cannot be used because it is also true in RPC mode on current Pi releases. A feasibility
review found the approach supported by Pi, but only the `ctx.mode` guards for terminal-only notices
were implemented; in a terminal the gate still shows raw JSON.
## Consequences
If accepted, every widget kind needs a terminal mapping with the same response shape as the RPC
path, including multi-select and invalid-choice handling, and both paths need round-trip tests.
@@ -0,0 +1,18 @@
---
status: accepted
date: 2026-07-11
---
# Ship two invariant application images
ThothII is distributed as two application images: `core` (backend, harness, Pi and the workflow
CLI) and `frontend` (the React build and its reverse proxy). The same images run on the server that
hosts the data warehouse, on a standalone server and on a PC or Mac. Differences between those
targets are expressed only through adapters, configuration and deployment profiles, never through
workflow variants or differently built images. This replaces the workstation-only model of
ADR-0005.
## Consequences
Customer paths, credentials and certificates never enter an image or the portable Compose files;
they are supplied by installation-local configuration and secrets.
@@ -0,0 +1,19 @@
---
status: accepted
date: 2026-07-16
---
# Store sessions per principal
A session belongs to an authenticated principal identified by `(issuer, subject)`, never by email
or username. On a server, sessions, artifacts, the decision ledger and preferences are stored in a
private PostgreSQL schema protected by forced row-level security, a runtime role without
`BYPASSRLS` and a transaction-local actor context; database failures fail closed. A local
installation keeps them on the filesystem, with no fallback or synchronization between the two.
Only artifacts and the ledger are durable: chat and SSE remain runtime memory, as required by
ADR-0002.
## Consequences
Users in the configured administrators group can manage every session; any other unauthorized
access returns 404. Sessions get no embeddings or vector columns.
@@ -0,0 +1,20 @@
---
status: accepted
date: 2026-08-03
---
# Keep workspaces in a Git registry with pinned revisions
Workspace definitions live as versioned YAML in a generic remote Git repository, independent of
any particular data warehouse, vector store or Git hosting provider. Each installation keeps a
persistent local checkout, resolves its own connectivity through local variables and secret files,
and exchanges changes by pull and push. Every new session is pinned to an immutable workspace
revision, and the installation keeps working from its last valid snapshot when the remote is
unavailable. This replaces harness-local YAML (ADR-0008) so that the same logical workspace can be
used by several installations.
## Consequences
Secret values never enter the repository. The workspace descriptor was later narrowed to identity
and Evidence: database facts moved to the Metadata Catalog (ADR-0025, ADR-0040) and model facts to
the installation (ADR-0037).
@@ -0,0 +1,19 @@
---
status: accepted
date: 2026-08-08
---
# Run Qdrant and Ollama inside the installation
ThothII owns its semantic infrastructure: every deployment includes a private Qdrant vector store
and a private Ollama embedding service as mandatory Compose services, reachable only on the
internal network. Qdrant replaces pgvector as the only vector store, and Ollama replaces
workspace-selected external embedding endpoints, with `qwen3-embedding:0.6b` (1024 dimensions,
CPU-viable, multilingual) as the required model. The data warehouse remains external and
read-only. This replaces the shared vector store of ADR-0006.
## Consequences
Vector indexes are derived data that each installation must build through preprocessing. One
collection per workspace initially held schema, Evidence and Memory points; ADR-0041 later split
reference and memory collections.
@@ -0,0 +1,21 @@
---
status: accepted
date: 2026-08-15
---
# Use one tht command name for host and core
The only product command is `tht`, and the name covers two programs: a native Go binary on the host
for installation, lifecycle, authentication and diagnostics, and the Python workflow CLI inside
`core` used by Pi, the gate and the backend. `thothctl` was removed without an alias or
deprecation period. The host binary needs no Go, Python or virtualenv on macOS, Linux or Windows;
the Python CLI is never installed on the host or shown in operator help.
## Considered Options
- A separate name such as `tht-runtime` for the inner CLI was rejected to keep one product name.
## Consequences
Commands called by Pi, the gate or the backend are machine contracts: their semantics, pristine
`--json` output, stdin handling and exit codes do not change to simplify operator help.
@@ -0,0 +1,19 @@
---
status: accepted
date: 2026-08-16
---
# Authenticate with local accounts or OIDC
Production authentication is either `local` (passwords hashed with Argon2id, optional "remember
me" sessions) or provider-neutral `oidc`. OIDC must return a `groups` claim in the ID token as a
JSON array; a missing or malformed claim fails authentication instead of granting ordinary access.
Groups map to ThothII roles in installation configuration, and each mapped group must be proven to
exist through a provider-specific catalog adapter, initially Authentik. The browser receives only
an opaque `HttpOnly` session cookie and never stores tokens. `none` and `mock` are test-only. This
replaces ADR-0007.
## Consequences
`upstream`, where a trusted proxy injects identity headers, was kept as a migration adapter. It
became the integration path for Omics Portal (ADR-0045).
@@ -0,0 +1,19 @@
---
status: accepted
date: 2026-08-20
---
# Issue one revocable DWH REST key per installation
The single shared `X-API-Key` protecting the data warehouse REST route is replaced by one random
256-bit key per ThothII installation, independently rotatable, optionally expiring and revocable.
A separate `dwh-auth` service checks the key through Nginx `auth_request` against a protected
file-based registry. It is optional server infrastructure that lives in this repository but is not
started by `tht`, and the client protocol is unchanged.
## Considered Options
- Extending the portable `tht` CLI would distribute server-only administration code to every
workstation, although the route has its own lifecycle.
- A manual Nginx key map encourages plaintext keys and makes rotation and revocation unreliable.
- SQLite would add a dependency, migrations and backups without benefit at this registry size.
@@ -0,0 +1,12 @@
---
status: superseded by ADR-0043
date: 2026-08-24
---
# Use workspace activation as the Evidence publication boundary
Curated Evidence becomes Published Evidence only when it is valid, belongs to the
active workspace revision, and belongs to the atomically published Evidence generation.
Human Git review remains required before activation, but its approval is not duplicated
as mutable state in the Evidence manifest; this keeps Git and the workspace registry as
the existing sources of truth instead of introducing a second approval mechanism.
@@ -0,0 +1,13 @@
---
status: accepted
date: 2026-08-24
---
# Keep Evidence identifiers independent from kind
An Evidence Unit keeps the same identifier when its kind is corrected or its Source
Evidence is unambiguously renamed; kind remains a separate validated field. This avoids
breaking citations and evaluation fixtures for a classification change, while genuine
semantic splits receive new identifiers so independent units never share an identity.
Identifiers use `evidence:<slug>`, are assigned once, persisted in the manifest and are
never recomputed automatically from mutable titles, paths or content hashes.
@@ -1,152 +0,0 @@
---
status: accepted
date: 2026-09-08
---
# Maintain local Evidence with external editors and manual consolidation
Evidence management must provide complete access to registered Evidence and a
maintenance path, as accepted in Q11–Q15 and revised during simplification. The owner subsequently
clarified that a context specialist writes drafts independently of the installation
and without PostgreSQL access; the system refines and stores them locally for use
and maintenance. Implementation is pending.
The storage mechanics of Q11 were revisited in the
[simplification review](../plans/2026-09-08-memory-evidence-simplification-review.md).
The original choice combined the workspace repository as Evidence authority with
application-managed Git writes. The owner accepted the separation of external draft
files/repositories from a durable local canonical file archive and removes
commit/push from normal CRUD. The management surface must expose discoverable,
editable Markdown for domain specialists, without JSONL editing. The owner chose
external editors for release 0: their preferred Mac/PC editor or vim/nano on the
server. No web editor or content form is required. The page keeps browsing,
filtering, and detail, with actual host file paths and maintenance instructions.
The owner also requested manual consolidation followed by manual Git diff, commit,
and push, relying on operator discipline rather than automation. The owner accepted
the remaining simplifications and requested explicit clarification of the core
format change and the simple terminal-based Git check. The original application Git writer
is not the final implementation prescription. A suggestion
to move Evidence authority into PostgreSQL was withdrawn after the clarification.
Memory remains a distinct module with its own PostgreSQL authority under
[ADR 0018](0018-use-postgres-for-memory-and-qdrant-for-retrieval.md).
## Manual consolidation and Git follow-up
The external-editor decision replaces the form's single Save with saving files and
running one consolidation command. The command checks expected structure, required
fields, types, identifiers, references, and provenance. It reports the affected file
and the necessary correction. Invalid input stops activation; valid input updates
derived metadata, the corpus, and the Evidence index. New and deleted files use the
same path. An inaccessible archive must not be interpreted as deleted Evidence.
Structural validation does not prove semantic correctness or rerun model refinement
to rewrite manually edited rules.
The core reads only successfully consolidated active content, never the editable
working files directly. Candidate validation and activation must preserve the last
valid corpus on failure, or report unavailability if its integrity cannot be
guaranteed. Unconsolidated edits must not mix new text with old retrieval data.
Consolidation reports full local success only once the updated content is available
to the core. If persistence succeeds but activation fails, the command reports the
partial outcome and can be rerun without duplicating units or losing edits.
The operation does not imply atomicity across
authoritative storage and Qdrant; their failure and recovery behavior requires
explicit implementation. An interrupted operation must not leave a partial corpus
advertised as ready for subsequent use.
The maintained archive is a persistent Git working tree containing the local
Evidence; it may reuse the workspace repository. Draft sources and curated units
remain distinct even when in the same repository. Setup and the page identify the
repository, working tree, actual host paths, branch, and configured remote. A
rebuildable runtime snapshot is not the editing location.
Before consolidation, the operator checks Git status, including inspection of new
untracked files. Normal terminal Git diff commands are available for line-level
inspection when needed; no custom viewer or mandatory double review is required.
After consolidation, the operator stages the Evidence and required metadata changes,
commits, and pushes using normal Git commands. No watcher, automatic Git writes, retrying push, pull, merge,
or dedicated web execution control is required. Missing credentials, unconfigured
upstreams, and Git conflicts are handled by the operator.
Consolidation activates local changes before commit/push. If the operator omits the
Git steps or push fails, the local update remains effective while transfer to the
remote is incomplete. Pushing does not automatically update other installations.
The system relies on operator discipline to complete the sequence; it does not add
a separate editorial publication state machine or require a second reviewer.
Approved conflict repairs from the core still call the same persistence and
activation service directly. They do not require an external editor or manual
consolidation before the session can use its own approved correction. Their local
file changes are included in the operator's subsequent Git maintenance.
## Administration without concurrent core work
The owner's simplification instruction replaces the earlier Q12 requirement to
refresh open sessions after administrative edits. Core activity can be assumed
absent during administration, or its overlap can be ignored. No dedicated live
update, session notification, restart, maintenance mode, or reader coordination
is required. Completed administrative changes apply to subsequent work.
Deliberate writes from the workflow itself still exist: approved conflict repairs
and the final Memory summary use the same persistence services and handle their
outcome before proceeding. In particular, a session must be able to use its own
approved Evidence correction. This does not require updating all other sessions
or rewriting previously approved decisions, artifacts, or SQL.
## Manual corrections survive source updates
When an updated source contradicts an administrator's correction, the saved manual
Evidence remains active. Evidence management shows the conflicting content for an
explicit decision and subsequent save. The source's newer content does not
automatically override the correction. The owner accepts that the manual rule can
remain in use until that comparison is resolved.
Deleted Evidence must not silently reappear after preparation or reindexing. The
authoring implementation must preserve both manual corrections and suppression of
deleted units through source refreshes. The current protection for uncommitted Git
changes is insufficient: it does not preserve already committed manual corrections
against regeneration, and retirement currently removes the unit without recording
suppression for later preparation.
## Manual creation and explicit source refresh
Administrators can create Evidence without providing an external document. In R0,
they add Markdown using the documented example and consolidate it. The application
records a manual declaration as the managed source of the current statement.
Explicit consolidation approves that declaration; it does not
claim independent documentary verification.
A correction that changes a unit's meaning uses the same explicit manual origin.
The original document remains linked for provenance and source-change detection,
but its excerpt is not presented as support for a rule it does not contain. The
canonical contract must distinguish the current supporting source from the original
document rather than silently retaining outdated support metadata.
External sources are reacquired only when an administrator requests a source
refresh. Ordinary saves and session lookups use the acquired local content; they
do not poll sources or fetch their current versions. A remote change is therefore
detected at the next requested refresh, when the manual-precedence rule applies.
The revised storage recommendation reads the specialist's repository as an input;
ordinary local edits do not write back to it or refresh its content automatically.
## Implementation consequences
The existing [Evidence lifecycle](../evidence.md) and
[Workspace Evidence v3 contract](../contracts/workspace-evidence-v3.md) require
explicit evolution for editable local Markdown, manual consolidation, and manual
precedence. Source provenance and coherent canonical metadata remain requirements;
manual changes must not be presented as statements supported by an unrelated source
excerpt. Under the accepted local-file direction, curated files are primary
installation data preserved by Clear and backed up separately from rebuildable
indexes. Visible Markdown content must become authoritative for editing; operators
must not maintain hidden duplicate text, hashes, or manifest entries themselves.
This is a core Evidence contract change: parser, renderer, authoring, validation,
normalization, and their integration with indexing and recall must be adapted
together. E1 includes a new Curated unit format version, conversion of existing
Evidence, reindexing, and end-to-end verification that visible edits reach core
consumption. Preserve the internal typed model where possible; the change does
not require redesigning the NL-to-SQL workflow phases.
Local edits do not automatically change external drafts or another installation;
Git versioning and transfer occur through the explicit manual follow-up.
The [Evidence management project](../plans/2026-09-08-evidence-management.md)
records the implementation sequence and acceptance checks.
@@ -0,0 +1,12 @@
---
status: superseded by ADR-0043
date: 2026-08-24
---
# Evaluate candidate Evidence before activation
Evidence preprocessing builds a candidate vector generation and runs the workspace's
versioned evaluation set against that exact generation before atomically activating it.
The workspace revision may temporarily have no matching active Evidence during this
maintenance window, which is accepted as fail-closed degradation instead of introducing
a distributed transaction across Git, the workspace registry and Qdrant.
@@ -0,0 +1,11 @@
---
status: accepted
date: 2026-08-24
---
# Treat Formula Evidence as a composable SQL expression
Formula Evidence contains one validated PostgreSQL expression with declared input
columns, not a complete query or statement. This makes formulas safely composable by
SQL generation; complete documented queries remain Example Evidence, and incompatible
legacy formulas require human review during migration.
@@ -0,0 +1,22 @@
---
status: accepted
date: 2026-08-24
---
# Let Evidence contribute to workflow phases
The Evidence Module contributes to the existing workflow phases; it is not a visible phase of its
own. Clarification, rewriting, schema linking, CTE and final SQL query it with their corresponding
purpose; Memory remains owned by the Memory Module and synthesis performs no Evidence search. Each
phase searches independently and the workflow records only a minimal receipt containing phase,
purpose, vector generation and returned Evidence IDs.
A successful search may return no matches and does not block the phase. Technical unavailability
is a distinct typed outcome that blocks the calling phase until retry, without stale-generation or
purpose fallback. This favors an explicit temporary stop over silently treating a broken Evidence
dependency as absence of domain knowledge.
## Consequences
Curated Evidence v4 later reduced the declared purposes to `disambiguation`, `rewriting`,
`schema_linking` and `sql_generation`.
@@ -1,101 +0,0 @@
# ADR 0021 — Shell separati e adapter sostituibile per il portale
- Stato: accettato
- Data: 2026-09-13
## Decisione
ThothII espone due modalità di installazione, selezionate da `shell.mode`:
- `embedded` (default): ThothII è ospitato da Omics Portal. Non renderizza alcun header e
riceve dal portale lingua, tema e fullscreen. L'accesso resta verificato dal server.
- `full`: ThothII è autonomo. Renderizza il proprio header, con selettore lingua, tema,
fullscreen e nome utente. Il click sul nome apre il logout. Non mostra mai la rotellina o
altri comandi amministrativi del portale. Mantiene un rail vuoto a sinistra di almeno 20 px.
Il fatto che la shell sia `full` è distinto dallo stato `fullscreen`: la prima decide quale
contenitore viene renderizzato, il secondo indica se è attiva la Fullscreen API del browser.
L'icona passa da “entra in fullscreen” a “torna alla modalità normale”; anche `Esc` aggiorna lo
stato visualizzato.
La configurazione installata resta semplice e retrocompatibile. Sul Mac di sviluppo il profilo
locale userà:
```yaml
shell:
mode: full
defaultLocale: en
```
Il deploy sul server userà invece:
```yaml
shell:
mode: embedded
adapter: omics-portal
```
`defaultLocale` indica la lingua iniziale della shell full; in embedded la fonte autorevole resta
il portale.
L'adapter è l'unico confine tra ThothII e il portale. La sua interfaccia pubblica è volutamente
profonda e minima: consegna solo snapshot dello stato, senza esporre comandi, token, identità o
dettagli di trasporto.
```ts
export type HostShellState = {
locale: string; // BCP-47, inizialmente it/en
theme: "light" | "dark";
fullscreen: boolean;
};
export interface PortalAdapter {
subscribe(
onState: (state: HostShellState) => void,
onError: (error: Error) => void,
): () => void;
}
```
`OmicsPortalAdapter` è l'implementazione corrente. Un adapter per un altro portale potrà
sostituirlo senza modificare shell, i18n o workflow. In `full` l'adapter non viene istanziato:
lo stato è gestito internamente dalla shell.
Per l'integrazione oggi operativa, che monta la SPA direttamente nel DOM di Omics Portal,
l'adapter legge la lingua effettiva dal selettore Omics, osserva l'attributo del tema e ascolta
il fullscreen del documento. Selettori e osservatori restano privati dell'implementazione Omics.
La lingua segue il normale ricaricamento Django; tema e fullscreen cambiano nella pagina aperta.
La revisione approvata del 2026-09-13 elimina il precedente handshake a eventi: non servono
messaggi personalizzati, versioni di trasporto o timeout di avvio. Un futuro adapter potrà usare
un diverso trasporto senza modificare l'interfaccia applicativa.
Se `shell` o l'adapter embedded sono omessi, si usa `embedded` con `omics-portal`. Questo default
supporta il documento Omics esistente; nomi adapter sconosciuti o dati host mancanti producono
un errore esplicito, senza attivare la shell full.
## Confini che restano invariati
L'identità e l'autorizzazione del backend non vengono ricostruite nel browser. In embedded,
Omics Portal continua a gestire login e logout e la catena server-side `auth_request` continua a
fornire i principal header già previsti. Lo stato UI non dichiara l'utente autenticato: il modulo
di accesso usa la verifica backend esistente anche alla riconnessione e al ritorno alla pagina.
Un rifiuto su una singola operazione non equivale automaticamente alla perdita dell'accesso.
La lingua UI e la lingua di interazione con il modello restano separate dalla lingua del
workspace; il relativo contratto è in [ADR 0022](0022-separate-ui-locale-from-session-interaction-language.md).
## Alternative scartate
- Duplicare l'header di Omics in embedded: crea due fonti di stato e incompatibilità visive.
- Spargere controlli `if embedded/full` nei componenti: lega ogni pagina al portale.
- Trasmettere utente o token nel bridge: aumenta superficie e accoppia UI e autenticazione.
- Introdurre un protocollo completo request/response: non aggiunge funzionalità richiesta.
- Usare `profile` per distinguere le shell: `profile` descrive la topologia dell'installazione,
non la sua presentazione.
## Conseguenze
La soluzione richiede un adapter nel frontend che osserva il documento condiviso e mantiene la
logica di shell locale a ThothII. Il backend non necessita di un nuovo protocollo di autenticazione
o di una nuova sessione browser. Un nuovo portale deve soddisfare anche il contratto server di
identità fidata: la sola sostituzione della classe UI non sostituisce quel contratto.
@@ -0,0 +1,17 @@
---
status: accepted
date: 2026-08-24
---
# Ground and atomically apply Evidence preparation
Every proposed Evidence Unit carries one to five short supporting excerpts that can be
found in its normalized Source Evidence. The model may reuse only identifiers supplied
for previous units; deterministic application code assigns all new canonical IDs. This
makes provenance and identity mechanically checkable without pretending that automated
validation can replace human semantic review.
Preparation validates the complete changed batch in a temporary area and applies
curated files plus the manifest atomically. A model timeout or invalid response is not
retried automatically and leaves the worktree unchanged. Explicit `evidence resolve`
actions retire or relink units while preserving an ordinary, recoverable Git diff.
@@ -0,0 +1,18 @@
---
status: superseded by ADR-0041
date: 2026-08-24
---
# Add BM25 without rebuilding the shared Qdrant collection
The workspace keeps its existing unnamed dense vector and adds only the sparse `bm25`
vector with IDF through Qdrant's additive vector-schema operation. Only Evidence points
are repopulated with both default dense and BM25 values. Schema, Memory and solved
questions retain their current dense points and are verified before and after the
upgrade.
This replaces the planned destructive conversion to a named `dense` vector. If BM25 is
missing, Evidence preprocessing may add it and verify the resulting schema; session
runtime remains read-only. An incompatible existing BM25 definition fails without
mutation. A candidate failure leaves the additive schema in place while Evidence stays
unavailable, avoiding data loss in the other workflow modules.
@@ -0,0 +1,29 @@
---
status: accepted
date: 2026-08-24
---
# Make hybrid Evidence retrieval deterministic and diagnosable
Dense and BM25 retrieval receive the same deterministic query text. It preserves the
original question and appends nonempty concepts, tables and columns in a fixed order;
question and context receive Unicode NFC, newline canonicalization and outer trimming.
Context values are then deduplicated exactly and sorted, without lowercasing. Case,
punctuation and internal whitespace remain intact. This avoids accidental ranking
changes caused only by metadata ordering, preserves quoted PostgreSQL identifiers and
keeps the two retrieval branches directly comparable.
Evidence fragmentation follows semantic headings, typed fields and paragraph
boundaries. Formulas, value/meaning pairs, mappings, rules and URLs remain atomic. An
atomic element larger than the existing `max_chunk_chars` limit creates the blocking
`atomic_content_too_large` Review item rather than being split mechanically. The limit
applies to the complete rendered text, defaults to 4,000 characters and is not
duplicated by an Evidence-specific setting.
An L0 contract test starts the exact Qdrant image referenced by `compose.yaml` and
proves Italian server-side `qdrant/bm25` ingestion and search in a temporary collection.
There is no FastEmbed or dense fallback for Evidence when that capability is absent.
The versioned evaluation set contains lexical, semantic and mixed queries. Its report
shows dense-only, BM25-only and fused ranks for expected Evidence. Publication remains
governed only by the simple fused top-10 rule; branch ranks and hit@5 are diagnostic.
@@ -0,0 +1,27 @@
---
status: accepted
date: 2026-08-26
---
# Use PostgreSQL as the metadata catalog
ThothII uses an internal PostgreSQL Metadata Catalog to store, for each workspace, the physical
structure obtained by introspecting its database and the AI-generated semantic metadata. Each
Workspace Database carries a mandatory, unique `workspace_id`, which enforces the one-to-one
association without a Workspace table or SQL foreign key; workspace identity and the workspace list
stay authoritative in the workspace descriptors, and the service validates references against them.
The catalog's administrative interface and lifecycle stay separate from the NL→SQL workflow.
## Considered Options
- Keeping `annotations.yaml` as the source of truth would have kept Git versioning, but not the
required CRUD and introspection/generation process.
- Reading mutable metadata from the catalog without an explicit boundary would have coupled the
workflow to the availability of the new service and allowed partial views during updates.
## Consequences
Replacing `schema/annotations.yaml` as the core input is a later, explicit cutover (ADR-0040).
PostgreSQL guarantees that one `workspace_id` is not assigned to two databases, but workspace
existence, renames and removals remain the responsibility of the application boundary with the
workspace descriptors.
@@ -0,0 +1,23 @@
---
status: accepted
date: 2026-08-27
---
# Reference Workspace Database secrets
The Metadata Catalog stores no Workspace Database credentials or keys. It reuses ThothII's existing
encrypted secret store and keeps only references to the workspace's secret requirements, which
avoids a second vault and keeps values out of APIs, exports and logs.
## Considered Options
- Copying the ThothAI text fields would have simplified CRUD but stored passwords and passphrases
in plaintext.
- A second vault would have duplicated encryption, rotation, authorization and operating procedures
without a distinct need.
## Consequences
Catalog and runtime share the identity of secret requirements while catalog permissions and APIs
remain separate. Replacing or deleting a Workspace Database must define the lifecycle of its
references without including secret values in catalog transactions.
@@ -0,0 +1,27 @@
---
status: accepted
date: 2026-08-27
---
# Bind databases per installation
The Metadata Catalog separates the logical Workspace Database from the Database Binding that makes
it reachable in one installation. There is one Workspace Database per `workspace_id` and one active
binding in each installation's catalog: PSD uses REST locally and direct PostgreSQL on the server
without becoming two databases. The catalog is authoritative for engine, physical name, schema,
capabilities and binding; the DWH fields in workspace descriptors are only a bootstrap source,
imported and compared during an explicit cutover.
## Considered Options
- One database record per transport would have duplicated the identity, structure and metadata of
the same warehouse.
- Keeping warehouse facts permanently in both YAML and catalog would have created conflicts with no
deterministic resolution.
- Global bindings would have mixed endpoints and credentials of installations with different
topologies and security boundaries.
## Consequences
The runtime must never observe two disagreeing authorities: the cutover imports and compares
existing configuration before removing it from descriptors.
@@ -0,0 +1,25 @@
---
status: accepted
date: 2026-08-27
---
# Host the Metadata Catalog in the backend with Kysely
The Metadata Catalog lives in the existing Fastify process as an isolated module rather than a
microservice. It uses the existing `pg` driver through Kysely for typed queries, transactions and
migrations; its routes, repository, readiness and diagnostics stay separate from the workflow, and
catalog unavailability does not make sessions or SSE unavailable.
## Considered Options
- A microservice would have kept the backend free of a database, but added deployment,
authentication and failure modes for a single administrative context.
- Plain `pg` would have avoided a dependency but required local infrastructure for transactions,
row types and migration ordering and locking.
- Drizzle or Prisma would have added a schema DSL, generators and toolchain to a service that keeps
SQL and PostgreSQL constraints explicit.
## Consequences
Migrations ship with the backend but run only through `catalog:migrate`, with migrator credentials
separate from the runtime DML role.
@@ -1,5 +1,6 @@
---
status: superseded by ADR-0008
status: superseded by ADR-0032
date: 2026-08-27
---
# Hard-delete catalog tables during synchronization
@@ -1,3 +1,8 @@
---
status: accepted
date: 2026-08-27
---
# Separate physical and logical relationships
ThothII persists each database-declared foreign-key constraint as an immutable Catalog
@@ -1,3 +1,8 @@
---
status: accepted
date: 2026-08-27
---
# Use durable runs for authoritative schema synchronization
All table, column, relationship, and full-schema synchronizations run as durable background
@@ -1,5 +1,6 @@
---
status: accepted
date: 2026-08-28
---
# Allow explicit manual catalog metadata cleanup
@@ -11,6 +12,6 @@ Catalog Relationships; a table selection can remove its Catalog Columns or every
outgoing Catalog Relationship. Each selection is atomic, and a later Schema Synchronization can
rebuild the removed projection from the external schema.
This supersedes ADR-0005's broader invariant that physical membership cannot be edited manually.
This supersedes ADR-0029's broader invariant that physical membership cannot be edited manually.
Synchronization remains authoritative when it runs, while manual cleanup intentionally permits an
incomplete catalog between cleanup and the next successful synchronization.
@@ -1,5 +1,6 @@
---
status: accepted
date: 2026-08-29
---
# Use one sequential description-generation run
@@ -1,5 +1,6 @@
---
status: accepted
date: 2026-08-29
---
# Allow bounded real source samples for description generation
@@ -1,5 +1,6 @@
---
status: accepted
date: 2026-08-30
---
# Gate source samples with a Sensitive Data Flag
@@ -24,7 +25,7 @@ per-column proposals, prompts, raw provider output, or provider diagnostics. Thi
history of the AI attempt, not an audit trail of human flag decisions; reloading discards an unsaved
proposal.
Description generation extends ADR-0010 by sending bounded real values when `sensitive` is false
Description generation extends ADR-0034 by sending bounded real values when `sensitive` is false
and deterministic plausible synthetic values when it is true, without identifying the synthetic
values to the model. The false default deliberately favors the expected stable schemas and the
minority of protected columns: a new column remains eligible for real sampling until a user marks
@@ -1,7 +1,12 @@
---
status: accepted
date: 2026-09-01
---
# Use the Catalog as the logical relationship authority
ThothII stores database-declared foreign keys and user-managed Logical Relationships in separate
Catalog models, as required by ADR-0006, but exposes them through one effective relationship map.
Catalog models, as required by ADR-0030, but exposes them through one effective relationship map.
Physical relationships remain read-only and are refreshed from the database. Logical relationships
are either Generated by deterministic column-name inference or Manual; inference does not call an
AI model and does not inspect source values.
@@ -1,3 +1,8 @@
---
status: accepted
date: 2026-09-02
---
# Use one Installation Model Catalog with runtime projections
ThothII currently declares model availability independently in installation
@@ -12,7 +17,7 @@ Runtime Projections of that catalog. Runtime Model Selection stores only a canon
identity and use-specific controls such as thinking level; endpoint, provider, capabilities, and
credential references remain catalog facts, while secret values remain in protected secret stores.
The metadata-generation helper continues to use LiteLLM independently of Pi, as established by
ADR-0009: unifying model declaration does not unify execution lifecycles.
ADR-0033: unifying model declaration does not unify execution lifecycles.
The migration is intentionally fail-closed. Workspace schema v4 removes `llm_policy` and the
entire redundant `semantic_index`; collection identity is derived from the workspace identity,
@@ -1,5 +1,6 @@
---
status: superseded by ADR-0015
status: superseded by ADR-0039
date: 2026-09-02
---
# Assess sensitive columns locally from source content
@@ -48,8 +49,8 @@ available, and would reintroduce queue latency, non-deterministic judgments, pro
surface, and contention with normal inference. Introducing such a fallback would require a new
decision based on evidence that the NER path is unusable.
This decision supersedes ADR-0011 only where that ADR assigns draft sensitivity suggestions to an
AI using structural metadata. ADR-0011's human authority, transient draft, explicit scope, and
This decision supersedes ADR-0035 only where that ADR assigns draft sensitivity suggestions to an
AI using structural metadata. ADR-0035's human authority, transient draft, explicit scope, and
Sensitive Data Flag remain in force. How description generation uses the flag is outside this
decision.
@@ -1,5 +1,6 @@
---
status: accepted
date: 2026-09-03
---
# Use progressive sampling for sensitive columns
@@ -27,7 +28,7 @@ The HTTP operation has no global analysis deadline. It is canceled when the clie
the backend restarts. Historic and interrupted run records retain the database field named
`unknown` for compatibility, where it counts unprocessed columns rather than a v2 assessment.
This decision supersedes ADR-0014 only for scan effort, coverage semantics, and the assessment
domain. ADR-0014 remains authoritative for the single local TypeScript decision point, the absence
This decision supersedes ADR-0038 only for scan effort, coverage semantics, and the assessment
domain. ADR-0038 remains authoritative for the single local TypeScript decision point, the absence
of generative LLMs, transient human-reviewed drafts, the 500-character rule, and optional CPU-only
NER evidence.
@@ -1,8 +1,13 @@
---
status: accepted
date: 2026-09-06
---
# Use PostgreSQL metadata for all core consumers
The Metadata Catalog in PostgreSQL is the sole authority for every fact about a Workspace Database
used by the core. This completes the cutover anticipated by ADR-0001 and ADR-0003 and supersedes the
ADR-0012 statements that kept workspace annotations authoritative for descriptions and materialized
used by the core. This completes the cutover anticipated by ADR-0025 and ADR-0027 and supersedes the
ADR-0036 statements that kept workspace annotations authoritative for descriptions and materialized
a relationship-only snapshot per session. The Workspace Descriptor retains workspace identity and
Evidence scope, but contains no database identity, binding, structure, description, or relationship
data.
@@ -1,3 +1,8 @@
---
status: accepted
date: 2026-09-06
---
# Separate reference vectors from runtime memory
Schema, relationships, and Evidence are deterministic projections of PostgreSQL Catalog metadata
@@ -22,7 +22,7 @@ The owner also accepted hybrid semantic/lexical Qdrant retrieval with scope filt
and explicit card links traversed in core. Both belong to the planned first version;
there is no dedicated graph database or external Memory framework.
This extends [ADR 0017](0017-separate-reference-vectors-from-runtime-memory.md):
This extends [ADR 0041](0041-separate-reference-vectors-from-runtime-memory.md):
the separate reference and memory collections remain, while Memory gains sparse
lexical indexing in addition to dense vectors. Memory projections become rebuildable
from the module's PostgreSQL authority. Preprocessing Clear still preserves Memory;
@@ -0,0 +1,41 @@
---
status: accepted
date: 2026-09-08
---
# Maintain local Evidence with external editors
A context specialist writes Evidence drafts independently of the installation and without
PostgreSQL access; the installation refines them and keeps the curated Evidence in a durable local
file archive, a persistent Git working tree that may reuse the workspace repository. Domain
specialists edit visible Markdown with their own editor (or vim/nano on the server), with no web
editor and no JSONL editing, and run one consolidation command that validates, activates and
indexes the change. Git diff, commit and push stay manual. This replaces both the workspace-Git
publication boundary and the evaluation-before-activation gate of ADR-0017 and ADR-0019, and keeps
Evidence separate from Memory (ADR-0042).
## Considered Options
- Application-managed Git writes from the Evidence page: rejected to remove commit and push from
normal editing and to rely on operator discipline.
- Moving Evidence authority into PostgreSQL: withdrawn once it was clear that specialists author
drafts outside the installation.
- A web editor or content form: not needed for the first release.
## Consequences
- The core reads only consolidated, activated content, never the working files. A failed
activation keeps the last valid corpus and can be rerun without duplicating units or losing
edits; persistence and Qdrant are not atomic, so recovery is explicit.
- Activation happens before commit and push: a skipped or failed push leaves the local change in
effect and other installations unchanged.
- A saved manual correction stays active when its source later contradicts it, and deleted
Evidence must not reappear after preparation or reindexing; sources are reacquired only on an
explicit refresh.
- Corrections approved inside a session use the same persistence and activation service, so a
session can use its own correction without manual consolidation.
- Administration assumes no concurrent core work: completed changes apply to subsequent sessions,
without live refresh of open ones.
The format and commands are in the [Curated Evidence v4 contract](../contracts/curated-evidence-v4.md)
and the [Evidence lifecycle](../evidence.md).
@@ -1,6 +1,9 @@
# Unify administration pages and use namespaced routes
---
status: accepted
date: 2026-09-10
---
# Unify administration pages and use namespaced routes
Workspace and Pi management will become full Administration Pages alongside Evidence, Memory and
Database, using one shared Administrative Page Family. The Embedded Thoth Shell will identify the
@@ -0,0 +1,31 @@
---
status: accepted
date: 2026-09-13
---
# Separate shell modes behind a portal adapter
ThothII has two presentation modes selected by `shell.mode`: `embedded` (the default), where Omics
Portal hosts ThothII, which renders no header and takes locale, theme and fullscreen from the
portal; and `full`, where ThothII renders its own header with locale, theme, fullscreen and user
controls. One deliberately minimal `PortalAdapter` is the only boundary with the host portal: it
delivers snapshots of host shell state and never exposes commands, tokens, identity or transport,
so another portal can replace `OmicsPortalAdapter` without touching shell, i18n or workflow. In
`full` no adapter is instantiated. The interface and configuration are in the
[portal shell adapter contract](../contracts/portal-shell-adapter-v1.md).
## Considered Options
- Duplicating the Omics header in embedded mode creates two sources of state and visual mismatch.
- Scattering `embedded`/`full` checks through components ties every page to the portal.
- Passing user or tokens through the bridge widens the surface and couples UI and authentication.
- A full request/response protocol adds no required capability.
- Using `profile` to select the shell conflates installation topology with presentation.
## Consequences
Identity and authorization are never rebuilt in the browser: in embedded mode Omics Portal keeps
login and logout and the server-side `auth_request` chain supplies principal headers (ADR-0015).
A new portal must also satisfy that trusted-identity server contract; replacing the UI adapter
alone is not enough. Shell mode is independent of the browser fullscreen state, and UI locale is
governed by ADR-0046.
@@ -1,6 +1,9 @@
# Separate UI locale from session interaction language
---
status: accepted
date: 2026-09-13
---
# Separate UI locale from session interaction language
ThothII distinguishes three language concepts:
@@ -1,6 +1,9 @@
# Separate delivery operations from finalized SQL sessions
---
status: accepted
date: 2026-09-28
---
# Separate delivery operations from finalized SQL sessions
For [Studio integrazione in ETL — ticket #41](https://git.tylconsulting.it/mptyl/ThothII/issues/41),
SQL file delivery and ETL integration have a lifecycle separate from the session that
+49 -6
View File
@@ -1,10 +1,53 @@
# Domain Docs
This is a single-context repository.
How the engineering skills should consume this repo's domain documentation when exploring the codebase.
Before exploring, read `CONTEXT.md` at the repository root and the relevant decisions in
`docs/adr/`. Use the project's terminology from `CONTEXT.md` in issue titles, proposals, and
tests. Surface conflicts with an ADR instead of silently overriding it.
This is a single-context repository: root `GLOSSARY.md` (Italian) and `docs/adr/` (English).
When the vocabulary is missing or ambiguous, clarify the term with the `domain-modeling` skill and
record the result in `CONTEXT.md` or an ADR before relying on it in implementation work.
## Before exploring, read these
- **`GLOSSARY.md`** at the repo root, or
- **`GLOSSARY-MAP.md`** at the repo root if it exists: it points at one `GLOSSARY.md` per context. Read each one relevant to the topic.
- **`docs/adr/`**: read ADRs that touch the area you're about to work in. In multi-context repos, also check `src/<context>/docs/adr/` for context-scoped decisions.
If any of these files don't exist, **proceed silently**. Don't flag their absence; don't suggest creating them upfront. The `/domain-modeling` skill (reached via `/grill-with-docs` and `/improve-codebase-architecture`) creates them lazily when terms or decisions actually get resolved.
## File structure
Single-context repo (most repos):
```
/
├── GLOSSARY.md
├── docs/adr/
│ ├── 0001-event-sourced-orders.md
│ └── 0002-postgres-for-write-model.md
└── src/
```
Multi-context repo (presence of `GLOSSARY-MAP.md` at the root):
```
/
├── GLOSSARY-MAP.md
├── docs/adr/ ← system-wide decisions
└── src/
├── ordering/
│ ├── GLOSSARY.md
│ └── docs/adr/ ← context-specific decisions
└── billing/
├── GLOSSARY.md
└── docs/adr/
```
## Use the glossary's vocabulary
When your output names a domain concept (in an issue title, a refactor proposal, a hypothesis, a test name), use the term as defined in `GLOSSARY.md`. Don't drift to synonyms the glossary explicitly avoids.
If the concept you need isn't in the glossary yet, that's a signal: either you're inventing language the project doesn't use (reconsider) or there's a real gap (note it for `/domain-modeling`).
## Flag ADR conflicts
If your output contradicts an existing ADR, surface it explicitly rather than silently overriding:
> _Contradicts ADR-0007 (event-sourced orders), but worth reopening because…_
+1 -1
View File
@@ -117,7 +117,7 @@ the core can admit a new session.
PostgreSQL is the current database-metadata authority for all core consumers, not a deferred
catalog-to-core integration. The historical research on a separate catalog service and
`annotations.yaml` publication is superseded by ADRs 0004 and 0016. Preserve read-only DWH access,
`annotations.yaml` publication is superseded by ADRs 0028 and 0040. Preserve read-only DWH access,
installation-local bindings/secrets, revision-pinned workspace identity, and fail-closed readiness
when changing those boundaries. The exact snapshot interface is the
[Catalog Schema Snapshot contract](../contracts/catalog-schema-snapshot.md).
+1 -1
View File
@@ -107,7 +107,7 @@ aperta in un'altra scheda attraverso il solo controllo iniziale del proxy.
Il cambio lingua può ricaricare la pagina: conservare la selezione della sessione,
proteggere le modifiche non salvate e non avviare una nuova generazione al reload.
Non si conserva una trascrizione integrale nel browser. La lingua della sessione
rimane quella registrata nel manifest, secondo ADR 0022.
rimane quella registrata nel manifest, secondo ADR 0046.
## Sostituzione e verifiche
+1 -1
View File
@@ -224,7 +224,7 @@ Catalog or Evidence. A missing or incompatible schema returns a clear operationa
error. Preparation is repeatable and checks migration checksums.
See [the M1 specification](plans/2026-09-08-memory-m1-spec.md) and
[ADR 0018](adr/0018-use-postgres-for-memory-and-qdrant-for-retrieval.md) for the
[ADR 0042](adr/0042-use-postgres-for-memory-and-qdrant-for-retrieval.md) for the
approved scope and acceptance boundaries.
See [M2 implementation and validation](reports/knowledge-archives-release.md)
for the retrieval checks and real embedding test command.
+1 -1
View File
@@ -176,6 +176,6 @@ atomic operation. It skips empty generated descriptions, reports aggregate copie
counts, and retains the generated text. Because this can replace reviewed descriptions, the
interface requires explicit confirmation before applying it.
The decisions behind this surface are [ADRs 0001–0011](https://git.tylconsulting.it/mptyl/ThothII/src/branch/main/docs/adr/0001-postgres-metadata-catalog.md)
The decisions behind this surface are [ADRs 0025–0035](https://git.tylconsulting.it/mptyl/ThothII/src/branch/main/docs/adr/0025-use-postgres-as-the-metadata-catalog.md)
and the detailed acceptance record is
[AI catalog description generation acceptance](https://git.tylconsulting.it/mptyl/ThothII/src/branch/main/docs/testing/2026-08-29-ai-catalog-description-generation-acceptance.md).
+1 -1
View File
@@ -130,7 +130,7 @@ editoriale di pubblicazione. Dopo un errore o un riavvio, un corpus parziale non
deve essere dichiarato pronto per la successiva elaborazione.
Le decisioni Q11–Q15 e il successivo chiarimento sui vincoli sono registrati
nell'[ADR 0019](../adr/0019-author-evidence-in-app-with-automatic-activation.md).
nell'[ADR 0043](../adr/0043-maintain-local-evidence-with-external-editors.md).
## Consolidamento manuale e seguito Git — release 0 {#consolidamento-manuale-e-seguito-git--release-0}
@@ -127,7 +127,7 @@ dichiarazione manuale sostiene il testo corrente, con l'eventuale documento
originario conservato come provenienza distinta. Q15 limita la riacquisizione
delle fonti esterne a una richiesta esplicita dell'amministratore; il normale
salvataggio e il recall usano il contenuto già acquisito.
L'[ADR 0019](../adr/0019-author-evidence-in-app-with-automatic-activation.md) registra
L'[ADR 0043](../adr/0043-maintain-local-evidence-with-external-editors.md) registra
l'evoluzione del contratto, ancora da implementare.
## Stato verificato nel repository
@@ -191,7 +191,7 @@ filtri, percorsi di manutenzione e feedback coerenti, isolamento fra workspace e
incrociati fra i due domini.
La separazione fra Reference Vector Collection e Memory Vector Collection rimane
quella dell'[ADR 0017](../adr/0017-separate-reference-vectors-from-runtime-memory.md).
quella dell'[ADR 0041](../adr/0041-separate-reference-vectors-from-runtime-memory.md).
Un'operazione amministrativa sulle Evidence non cancella le Memory; una cancellazione
di Memory non elimina Evidence, Schema o metadati del database.
+4 -4
View File
@@ -4,7 +4,7 @@ Data: 2026-09-08. Stato: M1 implementato e verificato localmente;
confini di test confermati dal proprietario il 2026-09-08.
Primo incremento del progetto Memory management. Attua le decisioni già approvate
nel piano del 2026-09-08 e nell'ADR 0018. Le scelte tecniche di dettaglio qui
nel piano del 2026-09-08 e nell'ADR 0042. Le scelte tecniche di dettaglio qui
proposte derivano dalla ricognizione del runtime. Gli esiti dell'implementazione
sono riportati nel [rapporto di verifica](../reports/knowledge-archives-release.md).
@@ -167,7 +167,7 @@ M2 e M3, entrambi ancora obbligatori per completare il progetto Memory.
- La ricostruzione degli indici Memory e solved-question usa esclusivamente
le card autorevoli. Non reimporta automaticamente il registro JSONL, i payload
Qdrant o le sessioni di origine. Il preprocessing delle reference mantiene
la separazione delle collezioni stabilita nell'ADR 0017.
la separazione delle collezioni stabilita nell'ADR 0041.
- Anche i produttori attuali di Memory ed exemplar scrivono attraverso il
servizio autorevole. Si adeguano promozione, salvataggio singolo e percorso di
finalizzazione quanto necessario a evitare scritture dirette al solo indice.
@@ -324,8 +324,8 @@ casi reali appartengono agli incrementi che cambiano generazione e workflow.
Fonti: progetto **Memory management** del 2026-09-08; piano comune
**Amministrazione di Memory ed Evidence**; **Revisione di semplicità: Memory ed
Evidence**; glossario di dominio; ADR 0017 sulla separazione delle collezioni e
ADR 0018 su PostgreSQL autorevole e Qdrant per il retrieval.
Evidence**; glossario di dominio; ADR 0041 sulla separazione delle collezioni e
ADR 0042 su PostgreSQL autorevole e Qdrant per il retrieval.
La ricognizione ha verificato MemoryRecord, recall ordinario, ricerca degli
exemplar, comandi Memory, repository PostgreSQL delle sessioni, runner del harness,
+2 -2
View File
@@ -147,7 +147,7 @@ nel core è lavoro applicativo da implementare.
anche i collegamenti che la coinvolgono, conservando le altre card. I collegamenti
contribuiscono al recupero e non applicano automaticamente i contenuti.
La decisione architetturale è registrata nell'[ADR 0018](../adr/0018-use-postgres-for-memory-and-qdrant-for-retrieval.md).
La decisione architetturale è registrata nell'[ADR 0042](../adr/0042-use-postgres-for-memory-and-qdrant-for-retrieval.md).
### Flusso da implementare
@@ -286,7 +286,7 @@ Verificare card attese, esclusioni per ambito, cicli, collegamenti verso card ri
e rigenerazione dell'indice da PostgreSQL. Quando si verifica il recupero effettivo,
usare il percorso di embedding e ricerca configurato su un indice isolato: un fake
che restituisce gli ID predisposti verifica soltanto il contratto applicativo.
La separazione fra le collezioni Reference e Memory rimane quella degli ADR 0017 e 0018.
La separazione fra le collezioni Reference e Memory rimane quella degli ADR 0041 e 0042.
### M3 — Workflow e sincronizzazione fisica
@@ -228,7 +228,7 @@ La skill deve chiedere, a ogni round, soltanto le decisioni i cui prerequisiti s
Le risposte devono distinguere **decisione confermata**, **proposta** e **fatto da verificare**.
Non cambiare implicitamente ADR esistenti. Un nuovo ADR è opportuno soltanto per una decisione
costosa da invertire, sorprendente senza contesto e frutto di alternative reali; può bastare un
titolo e un breve paragrafo. `CONTEXT.md` resta un glossario, non il contenitore del PRD.
titolo e un breve paragrafo. `GLOSSARY.md` resta un glossario, non il contenitore del PRD.
## Strategia di test da approvare
@@ -290,7 +290,7 @@ simboli e i percorsi correnti alla ripresa; le righe e la distribuzione dei modu
| SEC-01 | `harness/tht/session/repository.py` (`resolve_principal`), `filesystem_repository.py`, `backend/src/config.ts`; [architettura auth](../architecture/authentication.md) |
| SEC-02 | `backend/src/pi/pi-process-manager.ts`, `provider-credentials.ts`, `harness/.pi/extensions/tht-gate.js`, repository PostgreSQL e identità di connessione |
| SEC-03 | Renderer dell'installazione, `harness/tht/config.py`, `harness/tht/db/connection.py`; [contratto DWH](../contracts/tht-dwh.md) |
| SEC-04 | `harness/tht/cli/search_cmd.py`, runtime LSH, worker descrizioni; [ADR-0011](../adr/0011-gate-source-samples-with-a-sensitive-data-flag.md) e gate in `PROJECT_STATE.md` |
| SEC-04 | `harness/tht/cli/search_cmd.py`, runtime LSH, worker descrizioni; [ADR-0035](../adr/0035-gate-source-samples-with-a-sensitive-data-flag.md) e gate in `PROJECT_STATE.md` |
| SEC-05 | `backend/src/pi/managed-config.ts`, argomenti del processo Pi, versione Pi nel lockfile e comportamento della libreria effettivamente distribuita |
| SEC-06 | `backend/src/auth/session-store.ts`, `backend/src/routes/sessions.ts`, SSE hub; [OIDC](../install/authentication-oidc.md) |
| SEC-07 | `backend/src/routes/workspaces.ts`, ammissione delle sessioni e policy dei permessi |
@@ -298,8 +298,8 @@ simboli e i percorsi correnti alla ripresa; le righe e la distribuzione dei modu
| SEC-09 | `backend/src/app.ts`, rate limiter del login, configurazione proxy e risposte HTTP del deploy di prova |
| SEC-10 | Lockfile backend/frontend/Pi, installazione Python nell'immagine core e inventario immagini; advisory storici su `undici`, `brace-expansion`, `protobufjs` e relativa dipendenza Pi da rivalutare |
| SEC-11 | Dockerfile e Compose in `deploy/`, confronto fra core e manutenzione, `docker inspect` con output sanitizzato solo su ambiente autorizzato |
| SEC-12 | `backend/src/workspaces/secret-store.ts`, backup/restore in `tools/tht`; [ADR-0002](../adr/0002-workspace-database-secret-references.md) |
| SEC-12 | `backend/src/workspaces/secret-store.ts`, backup/restore in `tools/tht`; [ADR-0026](../adr/0026-reference-workspace-database-secrets.md) |
Per le decisioni collegate consultare anche [ADR-0010](../adr/0010-allow-bounded-real-source-samples-for-description-generation.md),
[ADR-0013](../adr/0013-use-one-installation-model-catalog-with-runtime-projections.md),
Per le decisioni collegate consultare anche [ADR-0034](../adr/0034-allow-bounded-real-source-samples-for-description-generation.md),
[ADR-0037](../adr/0037-use-one-installation-model-catalog-with-runtime-projections.md),
gli ADR correnti sulla sensitivity e le istruzioni in `docs/agents/`.
@@ -77,7 +77,7 @@ Schema migrations, a new preprocessing service, Evidence web editing, new model
## Further Notes
This implements the page direction recorded by ADR 0020, refined by the owner's
This implements the page direction recorded by ADR 0044, refined by the owner's
2026-09-12 acceptance of shelf A and explicit functional-preservation requirements.
Testing reuses the existing public UI seams. Ticket breakdown is recorded alongside
this spec as four independently reviewable increments. Gitea publication is pending
@@ -15,7 +15,7 @@ la destinazione. Chirone costituisce il riferimento concreto indicato nel ticket
La sessione segue `grill-with-docs`: domande per round, raccomandazioni esplicite e
risposte dell'utente prima di consolidare le scelte. Le raccomandazioni non sono decisioni.
I termini concordati saranno registrati in `CONTEXT.md`; eventuali ADR documenteranno
I termini concordati saranno registrati in `GLOSSARY.md`; eventuali ADR documenteranno
solo scelte durevoli con alternative e motivazioni effettivamente discusse.
L'implementazione seguirà la conferma della comprensione condivisa del progetto.
@@ -33,7 +33,8 @@ L'implementazione seguirà la conferma della comprensione condivisa del progetto
con profilo `workstation`, mentre con profilo `server` presenta entrambe le opzioni.
- `PROJECT_STATE.md` conferma che le sessioni DWH sono in sola lettura. L'autorità
necessaria a materializzare un modello ETL va quindi trattata esplicitamente.
- `CONTEXT.md` definisce già `Datamart Plugin`, `Finalized session` e `After-finalize hook`.
- Il glossario definiva `Datamart Plugin`, `Finalized session` e `After-finalize hook`;
`GLOSSARY.md` conserva solo `Datamart` e `Finalized session`.
Tali definizioni non dimostrano da sole che ogni parte del relativo disegno sia implementata.
- Nel checkout di riferimento `~/Chirone/chirone/etl/dbt/dbt_project.yml:41–42`,
i modelli `marts` hanno materializzazione predefinita `materialized_view`.
@@ -102,7 +103,7 @@ Risposte dell'utente: «Q4:ok, Q5:ok, Q6:ok, Q7:ok, Q8:ok».
universale di doppia approvazione.
La separazione dei cicli di vita è registrata in
[ADR 0023](../adr/0023-separate-delivery-operations-from-finalized-sessions.md).
[ADR 0047](../adr/0047-separate-delivery-operations-from-finalized-sessions.md).
### Round 3 — frontiera aperta
@@ -43,13 +43,13 @@ Le seguenti sono osservazioni sul codice e sui contratti attuali, non caratteris
| Autorizzazione | Identità, ruoli e permessi; `PrincipalContext` non ha una dimensione tenant. | Il workspace non va considerato una barriera sufficiente tra aziende indipendenti. |
| Operatività | Configurazione e diverse risorse sono a livello di installazione; il preprocessing richiede un ciclo offline. | Un servizio sempre disponibile e condiviso richiede lavoro ulteriore su lifecycle, concorrenza e disponibilità. |
Riferimenti: [DwhAdapter](../../harness/tht/ports/dwh.py), [factory](../../harness/tht/adapters/factory.py), [architettura](../architecture/overview.md), [catalogo dei modelli](../adr/0013-use-one-installation-model-catalog-with-runtime-projections.md), [identità applicativa](../../backend/src/auth/principal.ts), [configurazione dei binding](../../backend/src/catalog/configuration-schema.ts), [preprocessing e autorità del catalogo](../adr/0016-use-postgres-metadata-for-all-core-consumers.md).
Riferimenti: [DwhAdapter](../../harness/tht/ports/dwh.py), [factory](../../harness/tht/adapters/factory.py), [architettura](../architecture/overview.md), [catalogo dei modelli](../adr/0037-use-one-installation-model-catalog-with-runtime-projections.md), [identità applicativa](../../backend/src/auth/principal.ts), [configurazione dei binding](../../backend/src/catalog/configuration-schema.ts), [preprocessing e autorità del catalogo](../adr/0040-use-postgres-metadata-for-all-core-consumers.md).
La ricerca nei sorgenti `backend/src` e `harness/tht` non ha individuato un'integrazione MCP esistente. La valutazione riguarda quindi una nuova integrazione, non l'attivazione di una modalità già pronta. Il perimetro verificato è PostgreSQL con i trasporti attuali; MCP non aggiunge automaticamente il supporto ad altri motori SQL.
### I trasferimenti da correggere
1. **Descrizioni AI.** Il worker campiona le colonne non marcate sensibili e usa valori sintetici per quelle sensibili. I campioni delle prime arrivano comunque al backend e al modello. Per la modalità proposta occorre generare descrizioni da soli metadati, oppure eseguire localmente la parte che usa valori e controllare anche il testo restituito. Riferimenti: [worker, campionamento intorno alla riga 997](../../backend/src/catalog/description-generation-worker.ts), [sampler](../../backend/src/catalog/description-source-sampler.ts), [decisione sul trattamento dei campioni](../adr/0011-gate-source-samples-with-a-sensitive-data-flag.md).
1. **Descrizioni AI.** Il worker campiona le colonne non marcate sensibili e usa valori sintetici per quelle sensibili. I campioni delle prime arrivano comunque al backend e al modello. Per la modalità proposta occorre generare descrizioni da soli metadati, oppure eseguire localmente la parte che usa valori e controllare anche il testo restituito. Riferimenti: [worker, campionamento intorno alla riga 997](../../backend/src/catalog/description-generation-worker.ts), [sampler](../../backend/src/catalog/description-source-sampler.ts), [decisione sul trattamento dei campioni](../adr/0035-gate-source-samples-with-a-sensitive-data-flag.md).
2. **Analisi della sensibilità.** Il codice attuale contiene scansione dei valori sorgente e classificazione, oltre ai riferimenti storici alle sole informazioni strutturali. Questa scansione deve avvenire sul cliente per rispettare il confine. Riferimenti: [classificatore](../../backend/src/catalog/sensitivity-classifier.ts), [lettura dei valori](../../backend/src/catalog/sensitivity-value-source.ts).
3. **Preprocessing e ricerca dei valori.** I campioni e i valori distinti sono utilizzati per costruire gli indici LSH, che aiutano ad associare le parole dell'utente ai valori effettivi del DB. Queste operazioni devono restare locali o essere disabilitate con una riduzione di funzionalità dichiarata. Riferimenti: [sampling](../../harness/tht/db/sampling.py), [contratto degli artefatti DWH](../contracts/tht-dwh.md).
4. **Query e anteprime.** `ExecResult` contiene righe; `sql run` le restituisce anche in JSON, mentre `sql export` scrive un CSV sul filesystem del runtime. Trasportare lo stesso risultato via MCP conserva questo trasferimento. Riferimenti: [tipi di esecuzione](../../harness/tht/execute/__init__.py), [comandi SQL](../../harness/tht/cli/sql_cmd.py).
@@ -113,7 +113,7 @@ Una chiamata diretta browser → connettore richiede autenticazione, gestione de
Per il modello non bastano sempre API key e URL. L'onboarding deve raccogliere anche provider/protocollo, identificativo modello o deployment, capacità richieste e limiti, quindi verificarli con uno smoke test. Le credenziali vanno conservate in un secret store, isolate per cliente e usate solo dal runtime autorizzato, con rotazione e cancellazione.
Occorre coprire **tre usi**: sessioni Pi, generazione dei metadati ed embedding. Il repository li coordina con un catalogo comune ma ha runtime distinti. Un endpoint utilizzabile da uno non è automaticamente compatibile con tutti. Anche il cambio di modello embedding può richiedere una nuova indicizzazione. Riferimento: [ADR del catalogo modelli](../adr/0013-use-one-installation-model-catalog-with-runtime-projections.md).
Occorre coprire **tre usi**: sessioni Pi, generazione dei metadati ed embedding. Il repository li coordina con un catalogo comune ma ha runtime distinti. Un endpoint utilizzabile da uno non è automaticamente compatibile con tutti. Anche il cambio di modello embedding può richiedere una nuova indicizzazione. Riferimento: [ADR del catalogo modelli](../adr/0037-use-one-installation-model-catalog-with-runtime-projections.md).
Se il cliente non vuole consegnarti la propria chiave, il connettore può custodirla e agire anche da gateway LLM. È un'opzione ulteriore: richiede supporto a streaming, errori, quote e cancellazione e non è necessaria per soddisfare il BYOK che hai proposto.
@@ -58,7 +58,7 @@ projecting the host platform, and shortening navigation labels.
## Standards
Initial independent review: one documented ADR conflict and one maintainability
judgement call. ADR 0020 now records the owner's superseding #29 footer decision.
judgement call. ADR 0044 now records the owner's superseding #29 footer decision.
Workspace and Pi now share keyboard tab navigation rather than duplicate its switch.
The independent follow-up review confirmed both findings resolved, with no new regressions.
@@ -1,6 +1,6 @@
# Revisione della semplificazione della shell
Data: 2026-09-13. Oggetto: piano full/embedded, ADR 0021–0022 e contratto
Data: 2026-09-13. Oggetto: piano full/embedded, ADR 0045–0046 e contratto
Portal Shell Adapter v1. Questa è una revisione con raccomandazioni: non modifica il
codice applicativo né sostituisce automaticamente i contratti accettati.
@@ -147,7 +147,7 @@ contiene già correzioni per reset CSS e altezza `100vh`.
La lingua dell'interfaccia, quella delle domande al revisore e quella dei contenuti
del workspace hanno proprietari e durate diverse. Conservare la separazione di
ADR 0022: semplificarla in un'unica preferenza globale introdurrebbe errori in
ADR 0046: semplificarla in un'unica preferenza globale introdurrebbe errori in
ripresa e nei workspace italiani.
Precisare tre regole d'implementazione:
+5 -5
View File
@@ -23,8 +23,8 @@ across backend restart. Existing PSD archive content was not rewritten by those
## Current authorities and repeatable checks
- [Memory implementation and storage](../gestione-memory.md), ADR 0018.
- [Editable Evidence](../contracts/curated-evidence-v4.md), ADR 0019.
- [Memory implementation and storage](../gestione-memory.md), ADR 0042.
- [Editable Evidence](../contracts/curated-evidence-v4.md), ADR 0043.
- [Session corrections](../contracts/archive-repair.md).
- [Evidence lifecycle acceptance](../testing/evidence-lifecycle-test-plan.md).
- Harness tests under `tests/memory/`, Evidence integration tests, backend route/service tests,
@@ -38,16 +38,16 @@ acceptance or permission to migrate another installation. Those remain explicit
The old metadata-catalog exploration and description-generation plan/spec are no longer
current-state authorities. PostgreSQL/Fastify ownership, installation bindings, description
generation and source-sampling constraints now live in ADRs 0001–0016,
generation and source-sampling constraints now live in ADRs 0025–0040,
[architecture](../architecture/overview.md), [Database Management](../operations/database-management.md)
and the [description acceptance checklist](../testing/2026-08-29-ai-catalog-description-generation-acceptance.md).
The installation-model plan is replaced by ADR 0013 and the
The installation-model plan is replaced by ADR 0037 and the
[current model catalog guide](../general/pi-configuration.md).
Preserve these outstanding questions rather than infer acceptance from implementation:
real provider/DWH acceptance recorded by the owner, licensing review of shipped optional models,
future dialect/multi-schema support, and any desired semantic aliases/value descriptions.
The former proposed catalog-to-core cutover and separate database permissions are already
represented by current ADR 0016 and `database.manage`; do not reopen them as unfinished steps.
represented by current ADR 0040 and `database.manage`; do not reopen them as unfinished steps.
The original description-generation plan referred to issue #4 for final delivery gates;
this consolidation neither changes nor closes its tracker state.
@@ -9,7 +9,7 @@
1. In ThothAI le foreign key dichiarate nel database venivano importate e una procedura separata proponeva relationship basate sul nome dei campi e su una verifica dei valori. Entrambi i percorsi scrivevano però nello stesso modello `Relationship` (`Thoth/ThothAI/backend/thoth_core/dbmanagement.py:484-640`; `Thoth/ThothAI/backend/thoth_core/admin_models/admin_sqldb.py:571-826`; `Thoth/ThothAI/backend/thoth_core/models.py:488-530`).
2. Il ricordo di una relationship inferita persistita come `generated` non trova riscontro nel modello esaminato: `Relationship` contiene solo quattro foreign key verso tabelle e colonne, senza provenienza, stato, confidenza o flag `generated`. La procedura di inferenza calcola localmente pattern e tasso di validazione, ma non li salva (`Thoth/ThothAI/backend/thoth_core/models.py:488-530`; `Thoth/ThothAI/backend/thoth_core/admin_models/admin_sqldb.py:697-801`).
3. L'amministratore Django di ThothAI permetteva CRUD manuale sul medesimo insieme di relationship e verificava che gli endpoint appartenessero allo stesso database e alle tabelle selezionate; non distingueva visivamente o semanticamente relationship fisiche, inferite e manuali (`Thoth/ThothAI/backend/thoth_core/admin_models/admin_relationship.py:19-313`).
4. ThothII oggi separa già i due concetti: il catalogo backend conserva solo le foreign key fisiche dichiarate, mentre il core/harness possiede annotazioni di foreign key logiche curate e un comando che suggerisce candidate per nome, primary key e SQL osservato (`CONTEXT.md:291-300`; `docs/adr/0006-separate-physical-and-logical-relationships.md:3-8`; `harness/tht/cli/schema_cmd.py:203-299`).
4. ThothII oggi separa già i due concetti: il catalogo backend conserva solo le foreign key fisiche dichiarate, mentre il core/harness possiede annotazioni di foreign key logiche curate e un comando che suggerisce candidate per nome, primary key e SQL osservato (`GLOSSARY.md`; `docs/adr/0030-separate-physical-and-logical-relationships.md`; `harness/tht/cli/schema_cmd.py:203-299`).
5. I due mondi ThothII non sono ancora integrati: i record di Database Management non modificano il workflow NL→SQL e l'integrazione catalogo→core/schema-linking è ancora un gate di design esplicitamente differito (`PROJECT_STATE.md:116-124`; `PROJECT_STATE.md:161-165`).
## Evidenze ThothAI
@@ -57,7 +57,7 @@ Il modello di dominio corrente distingue esplicitamente:
- **Physical Relationship:** vincolo dichiarato nel database;
- **Catalog Relationship:** copia persistita di quel fatto fisico, non creabile o modificabile manualmente ma eliminabile per cleanup;
- **Logical Relationship:** relazione semantica curata o inferita, con ownership e lifecycle separati (`CONTEXT.md:291-300`; `docs/adr/0006-separate-physical-and-logical-relationships.md:3-8`).
- **Logical Relationship:** relazione semantica curata o inferita, con ownership e lifecycle separati (`GLOSSARY.md`; `docs/adr/0030-separate-physical-and-logical-relationships.md`).
La migrazione del catalogo crea `catalog_relationships` e le coppie ordinate in `catalog_relationship_columns`. L'identità della relazione fisica è `(source_table_id, constraint_name)`; non esistono campi di origine, stato o confidenza (`backend/src/catalog/migrations/003_catalog_schema_sync.ts:42-74`). Il tipo TypeScript è solo strutturale e le descrizioni generate riguardano esclusivamente tabelle o colonne (`backend/src/catalog/types.ts:123-152`).
@@ -65,7 +65,7 @@ L'introspezione PostgreSQL legge soltanto `pg_constraint` con `contype = 'f'` e
Le API e la UI espongono lettura, sync e cleanup in massa, non CRUD logico per singola relationship (`backend/src/routes/catalog-schema.ts:25-37`; `backend/src/routes/catalog-schema.ts:134-150`; `frontend/src/api/catalog-databases.ts:452-489`; `frontend/src/shell/database-management/DatabaseRelationships.tsx:114-123`; `frontend/src/shell/database-management/DatabaseRelationships.tsx:160-225`).
**Effetto rilevante:** il cleanup è intenzionalmente reversibile tramite una sync successiva e può lasciare temporaneamente un catalogo incompleto (`docs/adr/0008-allow-manual-catalog-metadata-cleanup.md:7-16`). Un test di integrazione ammette anche una relationship rimasta senza coppie di colonne dopo la cancellazione delle colonne catalogate (`backend/test/catalog-repository.integration.test.ts:194-264`, in particolare `:246-252`). Un futuro consumer non può quindi assumere che ogni stato intermedio del catalogo sia pubblicabile così com'è.
**Effetto rilevante:** il cleanup è intenzionalmente reversibile tramite una sync successiva e può lasciare temporaneamente un catalogo incompleto (`docs/adr/0032-allow-manual-catalog-metadata-cleanup.md:7-16`). Un test di integrazione ammette anche una relationship rimasta senza coppie di colonne dopo la cancellazione delle colonne catalogate (`backend/test/catalog-repository.integration.test.ts:194-264`, in particolare `:246-252`). Un futuro consumer non può quindi assumere che ogni stato intermedio del catalogo sia pubblicabile così com'è.
### Core/harness: relationship logiche e suggerimenti
@@ -104,7 +104,7 @@ La review dei join durante una sessione è distinta dalla curatela globale: il r
| Tema | Fatto documentato | Delta/rischio aperto |
|---|---|---|
| Origine | ThothAI perdeva l'origine; ThothII separa fisico e logico a livello concettuale | Decidere quale provenienza debba essere persistita per manuale, euristica, SQL osservato e import fisico |
| `generated` | Non era un flag del modello ThothAI; in ThothII “Generated Description” è già un termine del catalogo (`CONTEXT.md:302-311`) | Usare `generated` anche per relationship potrebbe creare ambiguità terminologica |
| `generated` | Non era un flag del modello ThothAI; in ThothII “Generated Description” è già un termine del catalogo (`GLOSSARY.md`) | Usare `generated` anche per relationship potrebbe creare ambiguità terminologica |
| Cancellazione utente | In ThothAI era CRUD sul record unico; in ThothII il cleanup fisico viene ricostruito dalla sync | “Eliminare” può significare cancellare una relazione logica, sopprimere un fatto fisico per il core oppure pulire temporaneamente la copia catalogata: sono operazioni diverse |
| Inferenza | ThothAI usava sei pattern e valori DWH; ThothII usa PK univoche, nomi e SQL osservato | Stabilire se sostituire, integrare o non portare il campionamento dei valori; servono policy di dati sensibili, query read-only, quoting e limiti |
| Approvazione | ThothII dispone di review Git/digest dell'intero artefatto | Mancano decisioni per candidata, motivazione, attore, sticky rejection, versione algoritmo e gestione dello stale |
@@ -114,7 +114,7 @@ La review dei join durante una sessione è distinta dalla curatela globale: il r
| Retrieval | Le relationship entrano nel render M-Schema ma non nei record vettoriali | Va deciso se e come influenzano selezione tabelle, ranking e descrizioni, oltre al rendering finale |
| Drift | Sync fisica è autoritativa; annotazioni sono una revisione separata | Servono semantiche per endpoint rinominati/eliminati, candidate stale, orphan e riapprovazione |
Nota storica: questa analisi precede il passaggio PostgreSQL catalog-to-core. Per il contratto implementato usare [architettura corrente](../architecture/overview.md) e ADR 0016; le vecchie ipotesi di pubblicazione non sono istruzioni operative.
Nota storica: questa analisi precede il passaggio PostgreSQL catalog-to-core. Per il contratto implementato usare [architettura corrente](../architecture/overview.md) e ADR 0040; le vecchie ipotesi di pubblicazione non sono istruzioni operative.
## Direzione confermata nel grill
@@ -220,7 +220,7 @@ Il 31 agosto 2026 sono state confermate le seguenti scelte:
## Seam tecnico confermato
Il Catalog PostgreSQL è l'unica fonte modificabile delle Logical Relationship. Le relationship
fisiche e logiche restano in modelli distinti, coerentemente con ADR-0006, mentre un servizio profondo
fisiche e logiche restano in modelli distinti, coerentemente con ADR-0030, mentre un servizio profondo
espone a API e UI una sola mappa discriminata per origine e stato.
All'avvio o alla ripresa di una sessione, il backend materializza le sole relationship attive in una
@@ -236,7 +236,7 @@ la snapshot mantiene il precedente comportamento di compatibilità.
Questa proiezione non è un secondo store: non può essere modificata, viene eliminata insieme alla
configurazione runtime e una sessione Pi vede una mappa stabile per tutta la propria vita. La decisione
duratura è registrata in ADR-0012.
duratura è registrata in ADR-0036.
La proiezione e la ricostruzione sono ammesse soltanto dopo una sincronizzazione completa della
versione corrente del database e vengono serializzate con le mutazioni del catalogo. Un catalogo mai
@@ -62,10 +62,10 @@ Il comportamento da verificare deriva da:
- [contratto Catalog Schema Snapshot](../contracts/catalog-schema-snapshot.md);
- [piano del Metadata Catalog](../reports/knowledge-archives-release.md);
- [specifica della generazione descrizioni](../reports/knowledge-archives-release.md);
- [ADR 0007: sincronizzazione autorevole durevole](../adr/0007-durable-authoritative-schema-synchronization.md);
- [ADR 0009: un solo run sequenziale di generazione](../adr/0009-use-one-sequential-description-generation-run.md);
- [ADR 0010: campioni reali limitati](../adr/0010-allow-bounded-real-source-samples-for-description-generation.md);
- [ADR 0011: Sensitive Data Flag](../adr/0011-gate-source-samples-with-a-sensitive-data-flag.md);
- [ADR 0031: sincronizzazione autorevole durevole](../adr/0031-durable-authoritative-schema-synchronization.md);
- [ADR 0033: un solo run sequenziale di generazione](../adr/0033-use-one-sequential-description-generation-run.md);
- [ADR 0034: campioni reali limitati](../adr/0034-allow-bounded-real-source-samples-for-description-generation.md);
- [ADR 0035: Sensitive Data Flag](../adr/0035-gate-source-samples-with-a-sensitive-data-flag.md);
- [accettazione AI del 2026-08-29](./2026-08-29-ai-catalog-description-generation-acceptance.md).
L'accettazione del 2026-08-29 è una baseline utile ma non chiude il gate attuale: precede i commit
@@ -301,7 +301,7 @@ un valore protetto non può mai esserlo.
| Area | Evidenza automatica già presente | Gap principale |
| --- | --- | --- |
| Snapshot e sincronizzazione | `backend/test/catalog-schema-introspector.test.ts`, `catalog-schema-routes.test.ts`, `catalog-table-introspector.test.ts`, `catalog-repository.integration.test.ts` | Introspezione `pg_catalog` realmente end-to-end, parità live dei tre trasporti e un unico E2E con re-scan distruttivo. |
| Privacy | `catalog-sensitivity-classifier.test.ts`, `catalog-sensitivity-value-source.test.ts`, `catalog-local-ner-detector.test.ts` e i test di route/review | Prova shadow PSD con report solo aggregato, corpus italiano etichettato e benchmark NER CPU post-ADR 0014. |
| Privacy | `catalog-sensitivity-classifier.test.ts`, `catalog-sensitivity-value-source.test.ts`, `catalog-local-ner-detector.test.ts` e i test di route/review | Prova shadow PSD con report solo aggregato, corpus italiano etichettato e benchmark NER CPU post-ADR 0038. |
| Generazione | `catalog-description-generation-routes.test.ts`, `catalog-description-generation-worker.test.ts`, `catalog-description-generation.integration.test.ts` e test del helper | Accettazione reale aggiornata, cancellazione di una query PostgreSQL bloccata e integrazione ermetica fino all'endpoint LiteLLM locale. |
| UI | `DatabaseManagementPage.test.tsx`, `DescriptionGenerationDrawer.test.tsx`, `SensitivityAnalysisHistoryDrawer.test.tsx` | L'E2E Playwright corrente verifica soprattutto il layout, non il workflow funzionale. |
+1 -1
View File
@@ -1012,7 +1012,7 @@ Eseguire il teardown solo dopo aver completato e verificato gli allegati:
## 25. Riferimenti normativi
- `CONTEXT.md`, sezione Evidence;
- `GLOSSARY.md`, sezione Evidence;
- `docs/evidence.md`;
- `docs/contracts/workspace-evidence-v3.md`;
- `docs/contracts/workspace-preprocessing-cli.md`;