6.9 KiB
P7 — PSD migration to the workspace registry — Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:executing-plans to apply this plan task-by-task.
Goal: Move the existing Policlinico San Donato workspace from the legacy flat layout
(tht-workspace-psd/psd.yaml + root evidence/ + artifacts/mschema/annotations.yaml) into the
P1.1 workspace registry repository, then re-embed/re-index it on the new internal semantic stack so
ThothII can run live against the real PSD DWH.
Source of truth: PRD D7 (docs/prd/2026-08-09-workspace-preprocessing-prd.md), the P1.1 layout
(docs/superpowers/plans/2026-08-11-p1-1-workspace-directory-registry.md), and
docs/workspace-diagnostic-protocol.md.
Architecture: The PSD content becomes an ordinary Git workspace repository consumed by ThothII
via THT_WORKSPACE_GIT_REMOTE. DWH access stays REST (PostgREST); Qdrant and Ollama embedding are
the internal Compose services. The legacy pgvector (768-dim, nomic) is superseded and must be
re-embedded with qwen3-embedding:0.6b (1024-dim).
Tech Stack: Git + YAML (descriptor/catalog), the existing thothctl/registry for validation.
No new code is required unless a validator gap is proven by a test.
Current-state findings recorded by this plan
/Users/mp/projects/tht-workspace-psdis already a Git repo onmain(38 tracked files:.gitignore, legacypsd.yaml, and 36 curatedevidence/*.md) with no remote.- The legacy
psd.yamldeclares REST DWH (database: postgres,schema: datawarehouse), X-API-Key auth, internal CA, and the old external pgvector + Ollama; it has nollm_policy. - Curated FK annotations exist at
artifacts/mschema/annotations.yaml(367 FK lines) in the new canonicalAnnotationsshape and can be copied directly to<id>/schema/annotations.yaml. physical.yamlis absent, so DWH introspection must be re-run (requires VPN + DWH access).- The legacy runtime dirs (
.tht-dwh/,.tht-jobs/,config/,corpus/,runtime-v2/,.legacy-artifacts-backup-premerge/) are untracked runtime state and must not enter the curated repo.
Explicit decisions frozen by this plan
- Repository identity. Reuse
/Users/mp/projects/tht-workspace-psdas the author/curator clone; publish it to a GitHub remote the owner creates. The ThothII installation clones that remote, not any path inside the ThothII repo. - Workspace id:
psd-clinical(catalog, descriptor, Qdrant collection, bindings namespacePSD_CLINICAL). - Descriptor (schema v3):
dwh=postgres/ databasepostgres/ schemadatawarehouse/supported_transports: [rest_api];semantic_index= Qdrantpsd-clinical1024/cosine +qwen3-embedding:0.6b;language: it;llm_policy.allowedstarts from the historically active PSD models (zai/glm-5.2,deepseek/deepseek-v4-flash,deepseek/deepseek-v4-pro,aritmolab/qwen3.6-35b-a3b) and is owner-adjustable. - DWH diagnostic:
diagnostics.dwh_rest=POST /rpc/ping,auth: x-api-key, response{ database: postgres, schema: datawarehouse }. The exact ping RPC path/auth is verified by the owner during the first live smoke and adjusted only in the Git descriptor. - Curated content only: the repo contains
thoth-workspaces.yaml,psd-clinical/workspace.yaml,psd-clinical/evidence/,psd-clinical/schema/annotations.yaml, plus API-generatedworkspace-docs/. Legacy runtime dirs stay untracked (gitignore). - Re-embedding: the legacy pgvector is not reused. DWH introspection + schema/Evidence indexing run afresh on the new stack (or, if the owner prefers, pgvector is exported and re-embedded); this task is gated on VPN + DWH credentials + a running stack.
- Secrets stay out of Git: DWH X-API-Key and CA are written as local secret files referenced by
THT_WS_PSD_CLINICAL_DWH_API_KEY_FILE/_TLS_CA_FILE.
Completion contract
tht-workspace-psdis restructured to the P1.1 layout and commits cleanly (no legacy runtime dirs).- A local registry bootstrap against that repository activates
psd-clinical(schema-v3 valid, Evidence materialized, annotations parsed and synced, docs generated). thothctl … workspace inspect --workspace psd-clinical --jsonsucceeds once the installation bindings + VPN are present.thothctl … workspace preprocess run --workspace psd-clinical --jsoncompletes DWH → FK → schema → Evidence against the real DWH and indexes into the internal Qdrant.- A live session on
psd-clinicalreaches the first reviewer gate (P8 L2 smoke).
Task 1: Restructure the repository (autonomous)
Repo: /Users/mp/projects/tht-workspace-psd (separate checkout).
- Write
thoth-workspaces.yaml(catalog withpsd-clinical). - Write
psd-clinical/workspace.yaml(schema v3, decisions 2–4). git mvthe 36evidence/*.mdfiles topsd-clinical/evidence/.- Copy the curated FK to
psd-clinical/schema/annotations.yaml. - Add
.gitignorefor legacy runtime dirs; remove/leave legacypsd.yamlas a non-contract historical note (do not commit the old flat paths as canonical). - Commit on
main(no remote yet).
Task 2: Local registry validation (autonomous, no DWH/secret)
- From a scratch bare remote of the restructured repo, bootstrap a
WorkspaceRegistryand assertpsd-clinicalactivates: descriptor valid, catalog matches, Evidence materialized with manifest, annotations parsed/synced,workspace-docs/psd-clinicalgenerated. - Verify
thothctl workspace inspectfails only on the missing DWH bindings (not on the descriptor).
Task 3: Installation bindings + secrets (owner)
- Owner creates the GitHub remote and provides its URL + push credentials.
- Owner provides (or confirms reuse of) the DWH X-API-Key and CA; write them as local secret files.
- Fill
THT_WS_PSD_CLINICAL_DWH_*bindings +THT_WORKSPACE_GIT_REMOTE+ LLM provider in the installation env (VPN active).
Task 4: Re-embedding/indexing (owner + stack)
- Start the stack;
embedding-model-initpullsqwen3-embedding:0.6b. thothctl … workspace preprocess run --workspace psd-clinical --json(DWH → FK → schema → Evidence) against the real DWH; verify the Qdrant collection is populated and revision-scoped.
Task 5: Live smoke + manual acceptance (owner, P8 L2)
- New session on
psd-clinicalreaches the first reviewer gate; finalize one real query. - Record the P7/P8 manual acceptance in
docs/testing/p2-p6-manual-verification.mdand PROJECT_STATE.md.
Owner checkpoint
Tasks 1–2 are executed now by the agent. Tasks 3–5 are blocked on owner-provided secrets/access (GitHub remote, VPN, DWH key/CA, LLM provider) and on the live stack.
Non-goals
- No P8/P9/P10 work (end-to-end CI, retention policy changes, ssh_tunnel runtime).
- No change to the accepted P1.1–P6 contracts.
- No secret value, certificate, or response body is committed or printed.