diff --git a/planning/issue-4-decision-ledger.md b/planning/issue-4-decision-ledger.md new file mode 100644 index 0000000..fc93723 --- /dev/null +++ b/planning/issue-4-decision-ledger.md @@ -0,0 +1,318 @@ +# Issue #4 Authoritative Decision Ledger + +**Project:** `live-quiz` +**Scope:** Authoritative provenance record, settled architectural baseline, accepted `B2` decisions, unapproved `step 850` recommendations (`S1-01`–`S1-17`), deferred implementation boundaries (`DEF-01`–`DEF-05`), and maintenance protocol for Original Issue #4. +**Repository Baseline:** `main` @ `a4eeccf` ([docs/architecture.md](../docs/architecture.md), [docs/decisions/0001`–`0009](../docs/decisions/README.md)). +**Companion Artifact:** [issue-4-follow-through.md](issue-4-follow-through.md) (authoritative for execution order, dependencies, and work status). + +--- + +## Section 0 — Authority and Provenance Rules + +This ledger governs **decision state and provenance** for Issue #4, while [issue-4-follow-through.md](issue-4-follow-through.md) governs **remaining work, sequencing, and completion conditions**. Together they provide a self-contained handoff baseline without requiring prior chat history. + +### 0.1 Four Provenance Categories + +1. **Explicitly Accepted User Decisions (`USER_EXPLICIT`):** + - Commitments explicitly approved or stipulated by the user in direct `USER_INPUT` turns (verified in `transcript_full.jsonl` at steps `820`, `825`, `827`, `829`, `845`, `847`, and `849`). + - **Rule:** Explicit user input is the sole source of decision authority. These commitments are locked and must not be re-opened unless the user explicitly asks to revise them. + +2. **Previously Established Architectural Invariants:** + - The committed repository architecture on `main` @ `a4eeccf` ([docs/architecture.md](../docs/architecture.md) and [ADR-0001](../docs/decisions/0001-standalone-web-application.md) through [ADR-0009](../docs/decisions/0009-modular-portable-reference-skills.md), resolving Issues #1–#3 and #5–#8) together with the foundational Issue #4 handoff baseline (`steps 820–827`, recorded in Section 1 below). + - **Rule:** Downstream decisions must respect these invariants. Accepting a high-level architectural direction does **not** implicitly approve unreviewed sub-mechanisms or implementation details attached to it later. + +3. **Assistant / Agent Recommendations Awaiting Approval (`UNAPPROVED_RECOMMENDATION — step 850`):** + - In `step 850` of the discovery transcript, a single assistant turn simulated synthetic user prompts and emitted a premature "Stage 1 Decision Closure Report" marking items `B2.4.1` through `E2` as `Accepted`. + - **Rule:** A recommendation marked `Accepted` in that earlier assistant-generated closure report is **not** an approved decision. The transcript audit and [issue-4-follow-through.md](issue-4-follow-through.md) Section 0 govern. All 17 atomic items (`S1-01`–`S1-17`, recorded in Section 3 below) remain `PENDING_USER_REVIEW`. + +4. **Deferred Implementation Decisions (`DEF-01`–`DEF-05`):** + - Concrete engineering specifications (exact JSON field names, library selection, CLI flag spellings, wire framing, systemd unit parameters, backup retention numbers) intentionally postponed until after Stage 3 acceptance criteria (`S3-01`). + - **Rule:** Deferred is not equivalent to decided. An architectural invariant can be accepted while its implementation mechanism remains open; deferred details must not be prematurely written into ADRs as settled architectural commitments. + +--- + +## Section 1 — Settled Architectural Baseline + +The following nine foundational commitments (`BL-01`–`BL-09`) are verified in `steps 820, 825, 827` (`USER_EXPLICIT`). Important qualifications are preserved so accepted principles are not broadened into commitments the user did not make. + +| Baseline ID | Established Invariant & Scope | Rationale | Preserved Qualifications & Open Boundaries | Target ADR / Doc Destinations | +| :--- | :--- | :--- | :--- | :--- | +| **`BL-01`**
*(Cluster A)* | **Immutable Coordinated Assessment Pair & Flat `assessment_id`:**
An assessment definition is an immutable coordinated pair $A = (Q, R)$ (`questionnaire.json` + `rubric.json`) identified by a flat opaque `assessment_id` allocated by `learningctl`; modification of either member of the coordinated assessment pair requires registering a new `assessment_id`. Competency $\leftrightarrow$ Objective and Assessment $\leftrightarrow$ Objective relationships are M:N (Competency $\leftrightarrow$ Assessment is derived, never direct). The Tutor owns pedagogical reassessment decisions, performs an `AVAILABLE` artifact pre-flight check before offering reassessment, and requires explicit learner consent before registering a new assessment or starting a reassessment. | Prevents silent drift between questions and grading criteria, decouples assessment identity from curriculum taxonomy edits, and keeps pedagogical judgment in the Tutor rather than the quiz engine. | How mechanical schema up-converters (`clone-upgrade`) are restricted when contract versions change remains open under `S1-05` (`B2.4.5`). | [ADR-0004](../docs/decisions/0004-questionnaire-rubric-separation.md), [ADR-0007](../docs/decisions/0007-atomic-json-export-contract.md), [ADR-0009](../docs/decisions/0009-modular-portable-reference-skills.md), new Issue #4 ADR(s) (`0010`+), [docs/architecture.md](../docs/architecture.md) | +| **`BL-02`**
*(Cluster A)* | **No `assessment_version` or Version Lineage:**
`assessment_version`, revision chains, and parent/child lineage metadata are eliminated across all contracts. Modification of either member ($Q$ or $R$) requires registering a new `assessment_id` without exception. Longitudinal learner progress across assessments is tracked exclusively through shared `learning_objective_id` links. | Avoids version-graph complexity and invalid longitudinal comparisons across mutated assessments while preserving objective-level progress tracking. | Legacy `attempt.json` (`assessment_version`) schema rejection policy is tracked separately under `S1-08` (`C2`). | [ADR-0007](../docs/decisions/0007-atomic-json-export-contract.md), [ADR-0009](../docs/decisions/0009-modular-portable-reference-skills.md), new Issue #4 ADR(s) (`0010`+), [docs/architecture.md](../docs/architecture.md) | +| **`BL-03`**
*(Cluster B1)* | **`B1` Identity Binding & Hash Domain:**
Registered $Q$ and $R$ both embed `assessment_id`. $R$ embeds `expected_questionnaire_hash` ($H_q$). $H_q = \operatorname{SHA256}(\operatorname{JCS}(Q))$ is calculated over the complete validated public `questionnaire.json` (including `assessment_id` when present). `attempt.json` embeds `questionnaire_hash` ($H_q$) for definition identity and retains `expected_sha256` ([ADR-0007](../docs/decisions/0007-atomic-json-export-contract.md)) as a distinct per-file transport checksum. Standalone execution (`live-quiz start --questionnaire `) is supported without `assessment_id` or `workspace_id`. | Cryptographically binds $R \to Q$ and `attempt.json` $\to Q$ without exposing $R$ to `live-quiz` ([ADR-0004](../docs/decisions/0004-questionnaire-rubric-separation.md)), while preserving standalone CLI usability ([ADR-0001](../docs/decisions/0001-standalone-web-application.md)). | Component-level hash calculation/verification authority (`S1-06` / `B2.5.1`) and canonical byte storage (`S1-07` / `B2.5.2`) remain open. | [ADR-0004](../docs/decisions/0004-questionnaire-rubric-separation.md), [ADR-0007](../docs/decisions/0007-atomic-json-export-contract.md), new Issue #4 ADR(s) (`0010`+), [docs/architecture.md](../docs/architecture.md) | +| **`BL-04`**
*(Cluster C1)* | **`C1` Self-Contained Journal Snapshot & Recovery Independence:**
Before serving any learner-facing HTTP route, `live-quiz` durably commits a complete, self-contained questionnaire snapshot and initial execution metadata (`attempt_id`, optional `assessment_id`, $H_q$, optional `workspace_id`, `time_limit_ns`) to the per-attempt SQLite journal. `live-quiz recover` reconstructs the session strictly from the journal snapshot without reading external questionnaire files or querying the Learning Registry. | Guarantees crash/restart self-sufficiency even after temporary materialized questionnaires are deleted or workspace files move. | Exact persisted snapshot format (`S1-07` / `B2.5.2`) and the startup readiness acknowledgment contract (`S1-12` / `D2b`) remain open. | [ADR-0006](../docs/decisions/0006-ephemeral-sqlite-session-journal.md), [ADR-0007](../docs/decisions/0007-atomic-json-export-contract.md), [docs/architecture.md](../docs/architecture.md) | +| **`BL-05`**
*(Cluster C2 partial)* | **Explicitly Accepted Portion of `C2` — No Historical Journal Migration:**
No backward-compatibility migration or fallback reconstruction path is needed for historical attempt journals lacking embedded questionnaire snapshots, because no prior deployment exists. | Eliminates dead migration complexity in a greenfield pre-implementation repository. | **Qualification:** Only journal migration is settled here. Legacy `attempt.json` (`assessment_version`) handling remains open under `S1-08` (`C2`). | [ADR-0006](../docs/decisions/0006-ephemeral-sqlite-session-journal.md), [ADR-0007](../docs/decisions/0007-atomic-json-export-contract.md) | +| **`BL-06`**
*(Cluster D baseline)* | **Foundational Learning Registry, Workspace, Encryption, Provisioning & Service-Boundary Invariants:**
• One OS-wide persistent encrypted Learning Registry serves all workspaces on the host.
• Workspaces are logical provenance resolved via nearest-ancestor `.learning-workspace` marker (`workspace_id`), explicitly rejecting Git root as workspace boundary.
• Host provisioning is separate from `learningctl init` (`init` registers a workspace and never silently recreates a missing global DB).
• Agents/skills invoke only `learningctl` (narrow domain CLI; black-box `learningctl.md`/`--help` contract) $\to$ private typed UDS IPC $\to$ `learning-registryd` (`learning-registry` OS user, systemd socket activation `Accept=no`, serialized mutations).
• Non-TPM default host key protection stored outside workspaces and separate from DB backups; `learning-registryd` owns Online Backup API encrypted-to-encrypted snapshots on schedule and before disruptive operations.
• `learningctl --json` responses carry per-command `schema_version` with additive/breaking compatibility semantics. | Preserves cross-topic learner state across directories, isolates secrets (`rubric.json`) and DB credentials from workspace files and agent shells, and prevents concurrent agent races against the encrypted registry. | **Qualifications:**
• `SQLCipher` remains a **candidate**, not a selected implementation.
• Exact `"."` CLI `schema_version` string syntax remains unverified (`S1-14` / `D3b`, flagged open at `step 827`).
• Repo ownership (`S1-09` / `D1a`), marker/error taxonomy (`S1-10` / `D1b`), service delegation cutoff (`S1-14` / `D3b`), and key escrow / backup verification (`S1-15` / `D4`) remain open. | [ADR-0008](../docs/decisions/0008-two-product-repository-architecture.md), [ADR-0009](../docs/decisions/0009-modular-portable-reference-skills.md), new Issue #4 ADR(s) (`0010`+), [docs/architecture.md](../docs/architecture.md) | +| **`BL-07`**
*(Cluster D baseline)* | **Foundational Registration & Temporary Questionnaire Handoff Rules:**
Registration uses a two-phase lifecycle (`REGISTERING` $\to$ `AVAILABLE` / `ABORTED`). Only `AVAILABLE` definitions are discoverable for execution/reassessment; allocated `assessment_id`s are never reused; registration failures are strictly distinct from attempt crash recovery. For managed runs, `learningctl` materializes a temporary public-only `questionnaire.json` outside the workspace and deletes it idempotently after `live-quiz` commits its durable journal snapshot. | Prevents half-registered pairs from being executed, keeps `rubric.json` inside the registry service boundary, and avoids leaving stale questionnaire files in learner workspaces. | `REGISTERING` status visibility and `ABORTED` tombstone retention (`S1-11` / `D2a`) and the startup-commit acknowledgment protocol (`S1-12` / `D2b`) remain open. | [ADR-0004](../docs/decisions/0004-questionnaire-rubric-separation.md), [ADR-0006](../docs/decisions/0006-ephemeral-sqlite-session-journal.md), [ADR-0009](../docs/decisions/0009-modular-portable-reference-skills.md), new Issue #4 ADR(s) (`0010`+), [docs/architecture.md](../docs/architecture.md) | +| **`BL-08`**
*(Cluster D baseline)* | **Foundational Status-Discovery & Attempt-State Authority:**
`learningctl status` (`--json`, `--all`) is a read-only command run once at Tutor initialization (no polling loops). `learningctl` discovers candidate attempt journals, while `live-quiz` is the sole authority for active vs. recoverable attempt state without exposing private engine SQLite tables. | Gives the Tutor a single deterministic session-start snapshot while respecting the engine's private persistence encapsulation ([ADR-0006](../docs/decisions/0006-ephemeral-sqlite-session-journal.md)). | The exact read-only active-vs.-recoverable inspection interface between `learningctl` and `live-quiz` remains open under `S1-13` (`D3a`). | [ADR-0006](../docs/decisions/0006-ephemeral-sqlite-session-journal.md), [ADR-0009](../docs/decisions/0009-modular-portable-reference-skills.md), new Issue #4 ADR(s) (`0010`+), [docs/architecture.md](../docs/architecture.md) | +| **`BL-09`**
*(Cluster E baseline)* | **Foundational Interaction Lifecycle, Reversible Abandonment, Debrief Guideline & Atomic Consolidation:**
• In managed workflows, `attempt.json` is staged in a persistent non-workspace staging area (no TTL expiry) until `(attempt, evaluation, Tutor observations)` are committed in one atomic registry transaction (`CONSOLIDATED`) with an idempotent receipt. Standalone `attempt.json` files remain untouched user exports.
• States include `PENDING_DEBRIEF`, `DEFERRED`, `PENDING_CONSOLIDATION`, `CONSOLIDATED`, and `ABANDONED`.
• Abandonment separates **append-only historical events** from **reversible current disposition** (`ABANDONED` is hidden from default `status` and `--all`, and transitions to `DEFERRED` or a new attempt only on explicit learner request).
• Bounded debrief (1 consolidated report + ~1–3 follow-up turns) is a **facilitation guideline**, not a hard technical cutoff; interrupted debriefs store lightweight structured progress, never full chat transcripts. | Prevents partial/un-debriefed quiz exports from polluting canonical mastery records while preserving crash-safe staging, learner agency over abandoned attempts, and transcript-free privacy. | **Qualifications:**
• Bounded debrief duration is a pedagogical facilitation guideline, not an enforced turn limit.
• Per-execution staging slot allocation (`S1-16` / `E1`) and pre-consolidation registry/staging split, pre-debrief discovery, checkpoint storage & `ABANDONED` payload retention (`S1-17` / `E2`) remain open. | [ADR-0007](../docs/decisions/0007-atomic-json-export-contract.md), [ADR-0009](../docs/decisions/0009-modular-portable-reference-skills.md), new Issue #4 ADR(s) (`0010`+), [docs/architecture.md](../docs/architecture.md) | + +--- + +## Section 2 — Explicitly Accepted `B2` Decisions (`B2.1`–`B2.3` & `B2.4` Framing Constraints) + +### 2.1 Accepted `B2.1`–`B2.3` Subdecisions + +| Decision ID & Provenance | Accepted Decision Statement | Rationale | Principal Architectural Consequences | Target ADR / Doc Destinations | +| :--- | :--- | :--- | :--- | :--- | +| **`B2.1`**
`ACCEPTED`
*(`USER_EXPLICIT`, step `829`)* | **Hash Original Parsed JSON After Strict Validation:**
`questionnaire_hash` ($H_q$) is computed over the original parsed JSON data structure after strict validation (`extra="forbid"`, `strict=True`) succeeds, serialized through RFC 8785 JCS. Pydantic's normalized model output (`model_dump()` / `model_dump_json()`) is never used as the hash input. | Decouples the cryptographic identity of an assessment from internal Python/Pydantic model refactoring, field ordering, or default-injection behavior. | • Validators must preserve the raw parsed JSON tree (Layer 1 output) alongside or prior to constructing domain models.
• Default semantics and contract evolution are governed independently under `B2.4` (`S1-01`–`S1-05`). | [ADR-0004](../docs/decisions/0004-questionnaire-rubric-separation.md), [ADR-0007](../docs/decisions/0007-atomic-json-export-contract.md), new Issue #4 ADR(s) (`0010`+), [docs/architecture.md](../docs/architecture.md) | +| **`B2.2`**
`ACCEPTED`
*(`USER_EXPLICIT`, step `845`)* | **Project-Specific Strict RFC 8785-Compatible Input Profile (Scoped to `questionnaire.json`):**
`questionnaire.json` must satisfy a strict project-specific JCS-compatible input profile at the parsing boundary:
1. Valid UTF-8 without BOM; reject unpaired UTF-16 surrogates and Unicode noncharacters; **no Unicode normalization** (such as NFC or NFD) is performed, and decoded code points are preserved exactly (NFC- or NFD-normalized input is accepted as-is without rejection or re-normalization).
2. Reject duplicate object keys after string unescaping (`object_pairs_hook`).
3. Reject `NaN`, `Infinity`, and `-Infinity` (`parse_constant`).
4. Domain restriction: reject all floating-point and exponential lexical tokens (`parse_float`, rejecting `600.0`, `1e0`, `1e400`) and enforce exact integers within $[-(2^{53}-1), +(2^{53}-1)]$ (`parse_int`).
5. Scope restriction: the integer-only restriction applies strictly to `questionnaire.json` and is **not** automatically transferred to `attempt.json` or `evaluation.json`. | Eliminates parser-level ambiguity (duplicate keys, float overflow, surrogate edge cases) before canonicalization, preserves exact authored Unicode code points without distorting inputs, and uses an integer-only domain rule where all questionnaire numeric quantities (timers, limits, counts) are naturally discrete. | • Both `live-quiz` and the registry must enforce identical Layer 1 parser hooks on `questionnaire.json`.
• `attempt.json` and `evaluation.json` remain free to use finite floats/integers as appropriate to scoring and telemetry.
• Shared negative test vectors (`DEF-02`) must cover rejected tokens (`600.0`, `1e0`, `1e400`, duplicate keys, lone surrogates, noncharacters) and positive preservation of NFC/NFD inputs without normalization. | [ADR-0004](../docs/decisions/0004-questionnaire-rubric-separation.md), [ADR-0005](../docs/decisions/0005-python-fastapi-vite-stack.md), [ADR-0007](../docs/decisions/0007-atomic-json-export-contract.md), new Issue #4 ADR(s) (`0010`+), [docs/architecture.md](../docs/architecture.md) | +| **`B2.3`**
`ACCEPTED`
*(`USER_EXPLICIT`, step `847`)* | **Three-Layer Parsing / Canonicalization / Digest Model with Independent Implementations & Shared CI Conformance Suite:**
1. Explicitly separate **Layer 1** (strict JSON parser + `B2.2` input profile), **Layer 2** (full RFC 8785 JCS canonicalizer operating on Layer 1 output to emit deterministic UTF-8 bytes), and **Layer 3** (`SHA-256` lowercase hex digest).
2. Keep `live-quiz` and the Learning Registry independently implemented (no shared first-party runtime helper package), with each component using an established, standards-compliant full RFC 8785 library (never a hand-written canonicalizer or a stripped-down integer-only JCS subset).
3. Enforce cross-component determinism via a **mandatory shared raw-byte CI conformance test suite**. | Preserves the clean product boundary ([ADR-0008](../docs/decisions/0008-two-product-repository-architecture.md)), avoids custom canonicalizer bugs, and guarantees byte-for-byte agreement across products through shared specification and raw-byte test vectors rather than runtime package coupling. | • Even though Layer 1 rejects floats in `questionnaire.json`, Layer 2 remains a complete standard RFC 8785 JCS serializer.
• Exact Python library selection and CI test vector assembly are tracked as `DEF-02`. | [ADR-0004](../docs/decisions/0004-questionnaire-rubric-separation.md), [ADR-0007](../docs/decisions/0007-atomic-json-export-contract.md), [ADR-0008](../docs/decisions/0008-two-product-repository-architecture.md), new Issue #4 ADR(s) (`0010`+), [docs/architecture.md](../docs/architecture.md) | + +### 2.2 Accepted `B2.4` Framing Constraints (`USER_EXPLICIT`, step `849`) + +In `step 849`, the user decomposed `B2.4` into five subdecisions (`B2.4.1`–`B2.4.5`, tracked as `S1-01`–`S1-05`) and established four binding framing constraints: +1. `schema_version` is a top-level field of `questionnaire.json` and is therefore covered by $H_q = \operatorname{SHA256}(\operatorname{JCS}(Q))$. +2. Changing `schema_version` changes $H_q$, which under `BL-01`/`BL-02` requires registering a new `assessment_id` with no version lineage. +3. Registered $(Q, R)$ pairs are never migrated or rewritten in place. +4. Cosmetic UI improvements and internal code refactoring must not require a new `schema_version`. + +--- + +## Section 3 — Unapproved Recommendations Requiring Review (`S1-01` through `S1-17`) + +Every entry below originated in `step 850` and requires an explicit user turn assigning a disposition (`ACCEPTED_AS_PROPOSED`, `ACCEPTED_WITH_MODIFICATIONS`, `REJECTED_IN_FAVOR_OF_ALTERNATIVE`, `DEFERRED_WITH_JUSTIFICATION`, or `NOT_APPLICABLE_WITH_JUSTIFICATION`). + +### `S1-01` — `B2.4.1` (Contract Version Scope) +| Field | Description | +| :--- | :--- | +| **Task ID** | `S1-01` | +| **Decision ID** | `B2.4.1` | +| **Decision question** | What exact scope does `questionnaire.json`'s `schema_version` govern (unified document structure + frozen optional defaults + assessment-significant execution semantics vs. structure-only or split version fields), and how is it recorded in the attempt journal and `attempt.json`? | +| **Already-settled constraints** | `BL-03` (`B1` full-document $H_q$), `B2.1` (hash raw parsed JSON), and `step 849` framing constraints (`schema_version` is inside $H_q$). | +| **Current proposal** | Define `schema_version` as a unified **Questionnaire Contract Version** governing structure, frozen optional-field defaults, and assessment-significant execution semantics, and propagate it into the attempt journal snapshot and `attempt.json` provenance (e.g., `questionnaire_schema_version`). | +| **Provenance** | `UNAPPROVED_RECOMMENDATION — step 850` | +| **Status** | `PENDING_USER_REVIEW` | +| **Tracker reference** | [issue-4-follow-through.md — `S1-01`](issue-4-follow-through.md) | + +### `S1-02` — `B2.4.2` (Semantic Immutability Boundary) +| Field | Description | +| :--- | :--- | +| **Task ID** | `S1-02` | +| **Decision ID** | `B2.4.2` | +| **Decision question** | Which changes to questionnaire interpretation or rendering require a new `schema_version` versus qualifying as contract-preserving implementation improvements? | +| **Already-settled constraints** | `step 849` framing constraint (cosmetic changes and internal refactoring do not require a new contract version). Prerequisite: `S1-01` (`B2.4.1`). | +| **Current proposal** | Require a new `schema_version` for any change altering valid inputs, optional-field meaning, learner interaction mechanics, timing enforcement, or exported response semantics; permit visual/CSS polish, accessibility fixes, internal refactoring, backward-compatible renderer upgrades, and spec-compliance bug fixes within the same version. | +| **Provenance** | `UNAPPROVED_RECOMMENDATION — step 850` | +| **Status** | `PENDING_USER_REVIEW` | +| **Tracker reference** | [issue-4-follow-through.md — `S1-02`](issue-4-follow-through.md) | + +### `S1-03` — `B2.4.3` (Defaults and Explicit Configuration) +| Field | Description | +| :--- | :--- | +| **Task ID** | `S1-03` | +| **Decision ID** | `B2.4.3` | +| **Decision question** | Which behavioral settings in `questionnaire.json` must be explicitly authored, and which optional fields may be omitted with frozen semantics under a contract version? | +| **Already-settled constraints** | `BL-03` (standalone `questionnaire.json` may omit `assessment_id`), `B2.1` (Pydantic defaults are never injected into $H_q$). Prerequisite: `S1-01` (`B2.4.1`). | +| **Current proposal** | Require all assessment-significant behavioral settings (timing policy, question interaction types, selection bounds, objective mappings) to be explicitly authored, allowing omission only where omission permanently means *"absent / not applicable"* (such as omitted `assessment_id` in standalone mode or optional media/stimulus blocks). | +| **Provenance** | `UNAPPROVED_RECOMMENDATION — step 850` | +| **Status** | `PENDING_USER_REVIEW` | +| **Tracker reference** | [issue-4-follow-through.md — `S1-03`](issue-4-follow-through.md) | + +### `S1-04` — `B2.4.4` (Contract Version Support and Retirement) +| Field | Description | +| :--- | :--- | +| **Task ID** | `S1-04` | +| **Decision ID** | `B2.4.4` | +| **Decision question** | How long must `live-quiz` support historical `schema_version`s, and how do `live-quiz`, the Learning Registry, and the Tutor behave when a contract version is eventually retired? | +| **Already-settled constraints** | `BL-01` (Tutor performs `AVAILABLE` pre-flight check before offering reassessment; registered pairs are immutable). Prerequisites: `S1-01` (`B2.4.1`), `S1-02` (`B2.4.2`). | +| **Current proposal** | Freeze contract version semantics permanently in specifications, allow `live-quiz` to retire execution support only across major releases with fail-closed `UNSUPPORTED_SCHEMA_VERSION` errors on `validate`/`start`/`recover`, keep retired `AVAILABLE` definitions intact in the Registry for historical audit, and include engine `schema_version` support in the Tutor's reassessment pre-flight check. | +| **Provenance** | `UNAPPROVED_RECOMMENDATION — step 850` | +| **Status** | `PENDING_USER_REVIEW` | +| **Tracker reference** | [issue-4-follow-through.md — `S1-04`](issue-4-follow-through.md) | + +### `S1-05` — `B2.4.5` (Migration and New Definitions Boundary) +| Field | Description | +| :--- | :--- | +| **Task ID** | `S1-05` | +| **Decision ID** | `B2.4.5` | +| **Decision question** | Should `learningctl` / `learning-registryd` prohibit mechanical schema up-converters (`clone-upgrade` commands) in addition to prohibiting in-place pair rewrites? | +| **Already-settled constraints** | `BL-01`, `BL-02`, and `step 849` framing constraints (no in-place pair migration; changing `schema_version` yields a new `assessment_id` with no version lineage; longitudinal continuity uses shared `learning_objective_id`s). Prerequisite: `S1-01` (`B2.4.1`). | +| **Current proposal** | Prohibit both in-place rewrites and mechanical CLI up-converters (`clone-upgrade`); when an older assessment uses a retired `schema_version`, require consent-gated authoring and registration of a new $(Q', R')$ pair under a fresh `assessment_id` linked strictly via shared learning objectives. | +| **Provenance** | `UNAPPROVED_RECOMMENDATION — step 850` | +| **Status** | `PENDING_USER_REVIEW` | +| **Tracker reference** | [issue-4-follow-through.md — `S1-05`](issue-4-follow-through.md) | + +### `S1-06` — `B2.5.1` (Boundary Hash Calculation and Verification Authority) +| Field | Description | +| :--- | :--- | +| **Task ID** | `S1-06` | +| **Decision ID** | `B2.5.1` | +| **Decision question** | Which components calculate $H_q$ and which components independently recompute and verify $H_q$ at authoring, registration, startup, recovery, evaluation, and consolidation boundaries? | +| **Already-settled constraints** | `BL-03` (`B1`), `BL-04` (`C1`), `B2.1`–`B2.3` (3-layer strict parser $\to$ JCS $\to$ SHA-256). | +| **Current proposal** | Have `live-quiz validate` output $H_q$ during authoring so `quiz-designer` embeds `expected_questionnaire_hash` in $R$; require `learning-registryd` to independently recompute and verify $H_q$ at registration; require `live-quiz start` to compute and store $H_q$ in the journal snapshot and `live-quiz recover` to re-validate and verify the snapshot digest before serving; and require `quiz-evaluator` and `learning-registryd` consolidation to verify $H_q$ correspondence across $Q$, $R$, `attempt.json`, and `evaluation.json` (while the Tutor never computes $H_q$). | +| **Provenance** | `UNAPPROVED_RECOMMENDATION — step 850` | +| **Status** | `PENDING_USER_REVIEW` | +| **Tracker reference** | [issue-4-follow-through.md — `S1-06`](issue-4-follow-through.md) | + +### `S1-07` — `B2.5.2` (Canonical Questionnaire Persistence Representation) +| Field | Description | +| :--- | :--- | +| **Task ID** | `S1-07` | +| **Decision ID** | `B2.5.2` | +| **Decision question** | Should the Learning Registry (`AVAILABLE` questionnaire payload) and the `live-quiz` attempt journal (`C1` snapshot) persist **canonical RFC 8785 JCS UTF-8 bytes** alongside $H_q$, or store raw authored JSON text? | +| **Already-settled constraints** | `BL-04` (`C1` self-contained journal snapshot), `BL-07` (temporary questionnaire materialization), `B2.1`–`B2.3`. Prerequisite: `S1-06` (`B2.5.1`). | +| **Current proposal** | Persist exact Layer 2 RFC 8785 JCS canonical UTF-8 bytes alongside $H_q$ in both the Learning Registry and the `live-quiz` attempt journal, and write those stored canonical bytes directly during temporary questionnaire materialization without model re-serialization. | +| **Provenance** | `UNAPPROVED_RECOMMENDATION — step 850` | +| **Status** | `PENDING_USER_REVIEW` | +| **Tracker reference** | [issue-4-follow-through.md — `S1-07`](issue-4-follow-through.md) | + +### `S1-08` — `C2` (Legacy `attempt.json` `assessment_version` Policy) +| Field | Description | +| :--- | :--- | +| **Task ID** | `S1-08` | +| **Decision ID** | `C2` | +| **Decision question** | How should `live-quiz`, `quiz-evaluator`, and `learningctl` treat any `attempt.json` containing the removed `assessment_version` field? | +| **Already-settled constraints** | `BL-02` (`assessment_version` eliminated), `BL-05` (no historical journal migration needed; greenfield repository with zero prior deployments). | +| **Current proposal** | Omit `assessment_version` from the initial `attempt.json` schema from day one and enforce fail-closed rejection via `extra="forbid"` whenever an input payload contains `assessment_version`, with zero legacy stripping or import shims (leaving static files on disk untouched unless passed to a validator). | +| **Provenance** | `UNAPPROVED_RECOMMENDATION — step 850` | +| **Status** | `PENDING_USER_REVIEW` | +| **Tracker reference** | [issue-4-follow-through.md — `S1-08`](issue-4-follow-through.md) | + +### `S1-09` — `D1a` (Registry Repository and Package Ownership) +| Field | Description | +| :--- | :--- | +| **Task ID** | `S1-09` | +| **Decision ID** | `D1a` | +| **Decision question** | Should `learningctl`, `learning-registryd`, and host provisioning live in a separate dedicated repository (`learning-registry`) or inside the `live-quiz` repository as a multi-component monorepo? | +| **Already-settled constraints** | `BL-06` (`learningctl` + `learning-registryd` service boundary), `B2.3` (independent implementations without a shared runtime package), and [ADR-0008](../docs/decisions/0008-two-product-repository-architecture.md). | +| **Current proposal** | Keep the `live-quiz` repository as a single monorepo housing three strictly isolated top-level components (`live-quiz` engine, `learning-registry` package/daemon/CLI, and portable reference skills) sharing the CI conformance suite (`B2.3`) while enforcing zero cross-package Python imports in CI. | +| **Provenance** | `UNAPPROVED_RECOMMENDATION — step 850` | +| **Status** | `PENDING_USER_REVIEW` | +| **Tracker reference** | [issue-4-follow-through.md — `S1-09`](issue-4-follow-through.md) | + +### `S1-10` — `D1b` (Workspace Marker Edge Cases, Fail-Closed Error Taxonomy & Migration Trigger) +| Field | Description | +| :--- | :--- | +| **Task ID** | `S1-10` | +| **Decision ID** | `D1b` | +| **Decision question** | How should `learningctl` handle duplicate `init` or unregistered `.learning-workspace` markers, classify fail-closed global DB states, and gate registry schema migrations? | +| **Already-settled constraints** | `BL-06` (nearest-ancestor `.learning-workspace` resolution, Git root rejected, host provisioning separate from `learningctl init`, `init` never recreates a missing global DB, pre-disruptive encrypted backup invariant). | +| **Current proposal** | Make same-directory `learningctl init` idempotent when already registered, fail closed (`UNREGISTERED_WORKSPACE_MARKER`) when a marker file's `workspace_id` is unknown to the global DB, classify daemon/DB failures into deterministic categories (`NOT_PROVISIONED`, `MISSING_OR_LOCKED`, `CORRUPT`, `MIGRATION_REQUIRED`, `UNSUPPORTED_SCHEMA`), and require explicit out-of-band admin migration gated on a verified encrypted backup snapshot. | +| **Provenance** | `UNAPPROVED_RECOMMENDATION — step 850` | +| **Status** | `PENDING_USER_REVIEW` | +| **Tracker reference** | [issue-4-follow-through.md — `S1-10`](issue-4-follow-through.md) | + +### `S1-11` — `D2a` (`REGISTERING` Status Visibility and `ABORTED` Tombstone Retention) +| Field | Description | +| :--- | :--- | +| **Task ID** | `S1-11` | +| **Decision ID** | `D2a` | +| **Decision question** | How are incomplete `REGISTERING` records surfaced in `learningctl status`, and how are `ABORTED` registration records and their unverified draft payloads retained? | +| **Already-settled constraints** | `BL-07` (`REGISTERING` $\to$ `AVAILABLE` / `ABORTED`; only `AVAILABLE` is executable; `assessment_id` is never reused; registration failure $\neq$ attempt crash recovery). | +| **Current proposal** | Surface incomplete `REGISTERING` definitions in a dedicated `incomplete_registrations` section of `learningctl status` (with no automatic TTL expiry, so the Tutor can prompt to finalize or abort), and transition aborted registrations to lightweight permanent `ABORTED` metadata tombstones (purging unverified draft $Q$/$R$ blobs while reserving `assessment_id`) hidden from both default `status` and `--all`. | +| **Provenance** | `UNAPPROVED_RECOMMENDATION — step 850` | +| **Status** | `PENDING_USER_REVIEW` | +| **Tracker reference** | [issue-4-follow-through.md — `S1-11`](issue-4-follow-through.md) | + +### `S1-12` — `D2b` (Startup-Commit Acknowledgment and Temporary Questionnaire Cleanup Protocol) +| Field | Description | +| :--- | :--- | +| **Task ID** | `S1-12` | +| **Decision ID** | `D2b` | +| **Decision question** | By what mechanism does `live-quiz start` acknowledge that the `C1` journal snapshot is durably committed and the local HTTP server is bound, so `learningctl` can delete the temporary materialized `questionnaire.json` immediately without waiting for the learner to finish the quiz? | +| **Already-settled constraints** | `BL-04` (`C1` durable snapshot before learner access) and `BL-07` (idempotent temp questionnaire cleanup via `learningctl`). Soft/informational implementation dependency: `S1-07` (`B2.5.2`). | +| **Current proposal** | Order `live-quiz start` startup as validate $\to$ durable SQLite journal snapshot commit (`C1`) $\to$ localhost TCP port bind $\to$ emit a single flushed `SESSION_READY` NDJSON line on `stdout` (`attempt_id`, `assessment_id`, `questionnaire_hash`, `url`), enabling immediate temp file cleanup upon receiving `SESSION_READY`. | +| **Provenance** | `UNAPPROVED_RECOMMENDATION — step 850` | +| **Status** | `PENDING_USER_REVIEW` | +| **Tracker reference** | [issue-4-follow-through.md — `S1-12`](issue-4-follow-through.md) | + +### `S1-13` — `D3a` (Read-Only Active-vs.-Recoverable Attempt Inspection Contract) +| Field | Description | +| :--- | :--- | +| **Task ID** | `S1-13` | +| **Decision ID** | `D3a` | +| **Decision question** | How does `live-quiz` track active process liveness and expose a read-only (`mode=ro`) inspection interface so `learningctl status` can distinguish `ACTIVE_LIVE_ATTEMPT` from `RECOVERABLE_INTERRUPTED_ATTEMPT` without mutating journals or reading private SQLite tables? | +| **Already-settled constraints** | `BL-04` (`C1`), `BL-08` (`learningctl status` is read-only; `live-quiz` is sole authority for active vs. recoverable state without exposing private SQLite tables), and [ADR-0006](../docs/decisions/0006-ephemeral-sqlite-session-journal.md). | +| **Current proposal** | Have `live-quiz` hold an exclusive OS file lock (`flock`) on a sibling `attempt-.lock` file for the full duration of a running session (`start` or `recover`) and expose a read-only batch CLI inspection command (`mode=ro` SQLite URI + non-unlinking lock probe) invoked by `learningctl status`. | +| **Provenance** | `UNAPPROVED_RECOMMENDATION — step 850` | +| **Status** | `PENDING_USER_REVIEW` | +| **Tracker reference** | [issue-4-follow-through.md — `S1-13`](issue-4-follow-through.md) | + +### `S1-14` — `D3b` (Service-Boundary Delegation Cutoff and `schema_version` Format) +| Field | Description | +| :--- | :--- | +| **Task ID** | `S1-14` | +| **Decision ID** | `D3b` | +| **Decision question** | Should per-command `learningctl --json` `schema_version` standardize on `"."` string syntax, and where is the exact boundary between architectural service invariants and deferred host packaging details? | +| **Already-settled constraints** | `BL-06` (`learningctl` $\to$ UDS IPC $\to$ `learning-registryd` under `learning-registry` user, `Accept=no`, serialized mutations, per-command `schema_version` compatibility principles; exact `"."` format flagged open at `step 827`). Prerequisite: `S1-09` (`D1a`). | +| **Current proposal** | Adopt `"."` (e.g., `"1.0"`) string format for every `learningctl --json` response, keep privileged host provisioning/key-escrow/migration/restore out of agent-facing `learningctl`, and delegate exact systemd unit directives, UDS paths/group names/modes, wire framing, and subcommand spellings to `DEF-04`/`DEF-05`. | +| **Provenance** | `UNAPPROVED_RECOMMENDATION — step 850` | +| **Status** | `PENDING_USER_REVIEW` | +| **Tracker reference** | [issue-4-follow-through.md — `S1-14`](issue-4-follow-through.md) | + +### `S1-15` — `D4` (Out-of-Band Key Escrow, Backup Verification Gate & Operational Delegation) +| Field | Description | +| :--- | :--- | +| **Task ID** | `S1-15` | +| **Decision ID** | `D4` | +| **Decision question** | How is non-TPM cross-host portability reconciled with keeping encryption keys out of `learningctl` and DB backups, and how are backup snapshots verified before rotation or destructive maintenance? | +| **Already-settled constraints** | `BL-06` (mandatory encryption, `SQLCipher` candidate only, non-TPM default host key protection separate from workspaces and DB backups, `learning-registryd` Online Backup API snapshots on schedule and pre-disruptive operations). Prerequisite: `S1-10` (`D1b`). | +| **Current proposal** | Require privileged admin out-of-band key escrow/import (never accessible via `learningctl` or stored in backup directories), enforce a stage-then-verify backup pipeline (stage an encrypted-to-encrypted backup $\to$ perform independent keyed integrity verification of the staged snapshot before atomic promotion into the verified catalog, never pruning the last verified recovery point), make the concrete integrity-check primitive conditional on the database/encryption implementation later selected in `DEF-05` (`SQLCipher` remains a candidate, not a decision), and delegate driver/schedule/retention tunables to `DEF-05`. | +| **Provenance** | `UNAPPROVED_RECOMMENDATION — step 850` | +| **Status** | `PENDING_USER_REVIEW` | +| **Tracker reference** | [issue-4-follow-through.md — `S1-15`](issue-4-follow-through.md) | + +### `S1-16` — `E1` (Per-Execution Staging Slot Allocation and `--output` Destination Discipline) +| Field | Description | +| :--- | :--- | +| **Task ID** | `S1-16` | +| **Decision ID** | `E1` | +| **Decision question** | How are managed `attempt.json` export paths allocated before `live-quiz` generates `attempt_id` so reassessments and multiple attempts never collide on `--output` (`CONFLICT_DIFFERENT_ATTEMPT`)? | +| **Already-settled constraints** | `BL-04` (`C1`), `BL-09` (persistent non-workspace staging area for managed `attempt.json` until consolidation; standalone exports remain user-controlled files), and [ADR-0007](../docs/decisions/0007-atomic-json-export-contract.md). | +| **Current proposal** | Have `learningctl` allocate a unique per-execution staging directory slot (`//attempt.json`) during execution preparation and pass that explicit file path to `live-quiz start --output ` and `live-quiz recover --output `, preserving [ADR-0007](../docs/decisions/0007-atomic-json-export-contract.md)'s single-attempt idempotent export contract without adding a separate `--output-dir` mode to `live-quiz`. | +| **Provenance** | `UNAPPROVED_RECOMMENDATION — step 850` | +| **Status** | `PENDING_USER_REVIEW` | +| **Tracker reference** | [issue-4-follow-through.md — `S1-16`](issue-4-follow-through.md) | + +### `S1-17` — `E2` (Pre-Consolidation Storage Split, Pre-Debrief Status Reconciliation & `ABANDONED` Payload Retention) +| Field | Description | +| :--- | :--- | +| **Task ID** | `S1-17` | +| **Decision ID** | `E2` | +| **Decision question** | Where do pre-consolidation interaction metadata, append-only events, payloads, and structured debrief checkpoints live before `CONSOLIDATED`, how does `learningctl status` surface un-evaluated staged `attempt.json` exports without altering the `BL-09` states, and how does transactional consolidation verify artifact correspondence? | +| **Already-settled constraints** | `BL-09` (settled lifecycle states: `PENDING_DEBRIEF`, `DEFERRED`, `PENDING_CONSOLIDATION`, `CONSOLIDATED`, `ABANDONED`; managed `attempt.json` staged until atomic consolidation of `(attempt, evaluation, Tutor observations)` into `CONSOLIDATED` with idempotent receipt; append-only history vs. reversible `ABANDONED` disposition hidden from `status` and `--all`; bounded ~1–3 turn debrief facilitation guideline; structured debrief progress without chat transcripts). Any proposed modification replacing or altering a settled `BL-09` state requires explicit user authorization. Prerequisites: `S1-06` (`B2.5.1`), `S1-16` (`E1`). | +| **Current proposal** | Keep all five settled `BL-09` interaction lifecycle states unchanged while adding read-only `learningctl status` reconciliation of `E1` staging slots to identify un-evaluated staged `attempt.json` files (where `attempt.json` exists before `evaluation.json`) using `awaiting_evaluation`, where `awaiting_evaluation` is a derived, read-only status classification used to identify an incomplete staged interaction (it is not a persisted lifecycle state, does not modify the `BL-09` state set, and does not replace `PENDING_DEBRIEF`); store lightweight interaction envelopes and append-only lifecycle events in the encrypted registry while keeping unconsolidated payloads (`attempt.json`, `evaluation.json`, structured debrief checkpoints) in the `E1` staging slot (retained across `ABANDONED` so learner-requested reconsideration remains executable); and verify `B2.5.1` cryptographic/identifier correspondence and idempotent bundle digests before atomic `CONSOLIDATED` commit and staging slot cleanup. | +| **Provenance** | `UNAPPROVED_RECOMMENDATION — step 850` | +| **Status** | `PENDING_USER_REVIEW` | +| **Tracker reference** | [issue-4-follow-through.md — `S1-17`](issue-4-follow-through.md) | + +--- + +## Section 4 — Deferred Implementation Responsibilities (`DEF-01` through `DEF-05`) + +The following engineering tasks are intentionally postponed to post-Stage-3 implementation: + +- **`DEF-01` — JSON Schemas & Strict Pydantic Models:** Exact field names and `.schema.json` specifications for `questionnaire.json`, `rubric.json`, `attempt.json`, and `evaluation.json`, including recursive `extra="forbid"`, `strict=True`, and negative nesting tests. +- **`DEF-02` — RFC 8785 Library Selection & Shared Conformance Suite:** Selection of the concrete Python RFC 8785 package (`rfc8785` / `jcs` candidates) and assembly of the shared raw-byte CI conformance test suite (official RFC 8785 vectors + `B2.2` negative parser vectors + `attempt.json` float vectors). +- **`DEF-03` — `live-quiz` CLI Interface & Output Schemas:** Exact subcommand spellings, flags, and output/JSON schemas for `live-quiz validate`, startup readiness acknowledgment (`D2b`), and read-only attempt inspection (`D3a`), plus authoring `live-quiz.md`. +- **`DEF-04` — `learningctl` Domain CLI Grammar & JSON Schemas:** Exact `.learning-workspace` optional metadata fields, command/flag spellings, and CLI `schema_version` / JSON output schemas (`status`, consolidation receipt, structured debrief checkpoint), plus authoring `learningctl.md`. +- **`DEF-05` — Host Daemon Packaging, Security & Backup Operations:** Exact `learning-registryd` systemd `.socket`/`.service` units, UDS path/group/modes, private IPC wire framing, XDG runtime/state paths, encrypted DB driver (`SQLCipher` candidate), concrete backup integrity-check primitive, credential mechanism (`LoadCredentialEncrypted=` vs. keyfile), admin key-escrow/migrate/restore tooling, backup timer schedule, retention thresholds, and external sync target. + +> [!IMPORTANT] +> **Boundary Rules for Deferred Items:** +> 1. **Deferred $\neq$ Decided:** Postponing an implementation mechanism does not select a default candidate (e.g., `SQLCipher` and `rfc8785` remain candidates until `DEF-02`/`DEF-05`). +> 2. **Invariants vs. Mechanisms:** An architectural invariant (such as mandatory at-rest encryption, backup integrity verification before promotion, or 3-layer JCS hashing) is binding once approved, while its concrete implementation remains open under `DEF-01`–`DEF-05`. +> 3. **No Premature ADR Encoding:** Stage 2 ADRs (`S2-01`–`S2-05`) must record the actual user-approved architectural contracts and invariants (including any approved modifications or alternatives), never locking in unapproved `DEF-01`–`DEF-05` implementation specifics as if they were settled architecture. + +See [issue-4-follow-through.md — Section 5](issue-4-follow-through.md#5-deferred-implementation-responsibilities-not-completed-architecture) for detailed triggers and completion conditions for `DEF-01`–`DEF-05`. + +--- + +## Section 5 — Decision-Record Maintenance Protocol + +All subsequent sessions working on Issue #4 must follow these eight rules: + +1. **Explicit User Approval Required:** Never transition a decision from `PENDING_USER_REVIEW` without an explicit `USER_INPUT` turn authorizing one of the five valid dispositions: + - `ACCEPTED_AS_PROPOSED` + - `ACCEPTED_WITH_MODIFICATIONS` + - `REJECTED_IN_FAVOR_OF_ALTERNATIVE` + - `DEFERRED_WITH_JUSTIFICATION` + - `NOT_APPLICABLE_WITH_JUSTIFICATION` +2. **Record Modifications Faithfully:** When a decision is `ACCEPTED_WITH_MODIFICATIONS` or `REJECTED_IN_FAVOR_OF_ALTERNATIVE`, replace the summary with the exact user-approved commitment and record the modification delta rather than preserving the original `step 850` recommendation as if unchanged. +3. **Preserve Rejected Alternatives & Rationale:** When alternatives are rejected during review, concisely record the rejected option and why it was rejected so Stage 2 MADR drafting (`S2-01`–`S2-04`) has complete context. +4. **Incremental Dual-Artifact Updates:** Update both [issue-4-decision-ledger.md](issue-4-decision-ledger.md) and [issue-4-follow-through.md](issue-4-follow-through.md) immediately after each atomic decision is resolved, recording the transcript step or date of approval. +5. **Stable Identifiers:** Keep task IDs (`S1-01`–`S1-18`, `CW-01`, `S2-01`–`S2-06`, `S3-01`, `DEF-01`–`DEF-05`, `I9-01`) and decision IDs (`BL-01`–`BL-09`, `B2.1`–`B2.3`, `B2.4.1`–`E2`) stable across sessions. +6. **Immutability of Prior Meaning:** Never silently broaden, narrow, or reinterpret an earlier settled decision (`BL-01`–`BL-09`, `B2.1`–`B2.3`, or any newly resolved `S1-*` item). Any revision to a settled commitment requires an explicit user decision recorded with updated provenance. +7. **New Architectural Questions:** If a new architectural question surfaces during review, assign it a distinct identifier, evaluate whether it is a genuine prerequisite for any existing task, and record it explicitly rather than folding it silently into an existing item. +8. **Separation of Authority:** [issue-4-decision-ledger.md](issue-4-decision-ledger.md) is authoritative for **decision state, provenance, and rationale**; [issue-4-follow-through.md](issue-4-follow-through.md) is authoritative for **work status, dependencies, and execution sequencing**. diff --git a/planning/issue-4-follow-through.md b/planning/issue-4-follow-through.md new file mode 100644 index 0000000..2dfdba8 --- /dev/null +++ b/planning/issue-4-follow-through.md @@ -0,0 +1,130 @@ +# Issue #4 Follow-Through Tracker + +**Project:** `live-quiz` +**Scope:** Atomic Stage 1 decision resolution, Architectural Comprehension Walkthrough, Stage 2 ADR/architecture formalization, Stage 3 acceptance criteria, deferred implementation boundaries, and Issue #9 sequencing. +**Repository Baseline:** `main` @ `a4eeccf` ([docs/architecture.md](../docs/architecture.md), [docs/decisions/0001`–`0009](../docs/decisions/README.md)). +**Companion Artifact:** [issue-4-decision-ledger.md](issue-4-decision-ledger.md) (authoritative record of settled decisions, rationale, unapproved recommendations, and target ADR mappings). + +> [!IMPORTANT] +> **Critical Sequencing Gate & Progress Maintenance Rules:** +> 1. **One Atomic Decision at a Time:** Update each atomic task (`S1-01`–`S1-17`) incrementally only after an explicit `USER_INPUT` turn resolves it. Never mark a parent or downstream milestone complete while any constituent atomic task remains unresolved. +> 2. **Preserve Approval Provenance:** Previously approved invariants (Section 0) are locked and are **not** re-opened during `S1-01`–`S1-17`; each atomic review evaluates *only* the unresolved delta listed in its deliverable. +> 3. **Walkthrough Gate:** Stage 1 closure (`S1-18`) and the **Architectural Comprehension Walkthrough (`CW-01`)** must be completed and explicitly approved by the user **before Stage 2 (`S2-*`) begins**. + +--- + +## 0. Provenance Baseline: Verified Invariants vs. Unverified Recommendations + +Direct audit of `transcript_full.jsonl` separates established user commitments from unapproved assistant recommendations: + +### A. Verified Invariants (`USER_EXPLICIT` Provenance — Do Not Re-Ask) +- **Steps `820`, `825`, `827` (Handoff v2 & Baseline Corrections):** + - **`A`:** Immutable pair $A = (Q, R)$; modification of either member requires registering a new flat `assessment_id` issued by `learningctl`; `assessment_version` and version lineage eliminated; M:N Competency↔Objective and Assessment↔Objective links (Competency↔Assessment derived); Tutor owns pedagogical reassessment decisions, performs `AVAILABLE` artifact pre-flight prior to offering reassessment, and requires explicit learner consent before new registration or reassessment. + - **`B1`:** Registered $Q$ and $R$ embed `assessment_id`; $R$ carries `expected_questionnaire_hash`; $H_q = \operatorname{SHA256}(\operatorname{JCS}(Q))$ over the entire validated public questionnaire (including `assessment_id` when present); `expected_sha256` ([ADR-0007](../docs/decisions/0007-atomic-json-export-contract.md)) remains separate; standalone execution (`live-quiz start --questionnaire `) is supported without `assessment_id` or `workspace_id`. + - **`C1` & Partial `C2`:** `live-quiz` commits a complete, self-contained questionnaire snapshot and initial execution metadata (`attempt_id`, optional `assessment_id`, $H_q$, optional `workspace_id`, `time_limit_ns`) to the attempt journal before learner access; recovery uses only the journal snapshot. No historical journal migration for missing snapshots is needed (no prior deployment). + - **Foundational `D` & `E` Invariants:** + - One OS-wide persistent encrypted Learning Registry (candidate: `SQLCipher`); workspaces are logical provenance resolved via nearest-ancestor `.learning-workspace` marker (`workspace_id`), rejecting Git root as workspace boundary. + - Separate host provisioning vs. `learningctl init` (`init` never silently recreates a missing global DB). + - `learningctl` (narrow domain CLI; black-box `learningctl.md`/`--help` contract) $\to$ private typed UDS IPC $\to$ `learning-registryd` (`learning-registry` OS account, systemd socket activation `Accept=no`, serialized requests). + - Non-TPM default host key protection (stored outside workspaces and separate from DB backups); `learning-registryd` owns Online Backup API encrypted-to-encrypted snapshots on schedule and before disruptive operations. + - Registration lifecycle (`REGISTERING` $\to$ `AVAILABLE` / `ABORTED`; only `AVAILABLE` is discoverable; allocated `assessment_id` never reused; registration failure $\neq$ attempt recovery). + - Temporary public-only questionnaire materialization outside workspace, deleted idempotently via `learningctl` after durable engine snapshot commit. + - Read-only `learningctl status` (`--json`, `--all`) run once at Tutor initialization (no polling); `learningctl` discovers candidate journals while `live-quiz` is sole authority for active vs. recoverable state without exposing private SQLite tables. + - Per-command `schema_version` in `learningctl --json` outputs (additive changes increment compatibly, breaking changes increment incompatibly, ignore unknown fields, reject unsupported breaking versions; exact `major.minor` string syntax remains unverified per step `827`). + - In registry-managed workflows, `attempt.json` is an intermediate artifact staged in a persistent non-workspace staging area (no TTL deletion) until the complete learning interaction (`attempt` + `evaluation` + `Tutor observations`) is committed in one atomic registry transaction (`CONSOLIDATED`) with an idempotent receipt. Standalone `attempt.json` exports remain untouched user files. + - Interaction states: `PENDING_DEBRIEF`, `DEFERRED`, `PENDING_CONSOLIDATION`, `CONSOLIDATED`, `ABANDONED`. Abandonment separates **append-only historical events** from **reversible current disposition** (`ABANDONED` $\to$ `DEFERRED` or new attempt on explicit learner request; hidden from default `status` and `--all`). Bounded debrief (1 consolidated report + ~1–3 follow-up turns) is a **facilitation guideline**, not a hard technical limit; interrupted debriefs preserve lightweight structured progress rather than full chat transcripts. +- **Step `829` (`B2.1` Accepted):** $H_q$ is computed over the original parsed JSON representation after strict validation (`extra="forbid"`, `strict=True`), never Pydantic's `model_dump()`. +- **Step `845` (`B2.2` Accepted):** Project-specific strict RFC 8785 JCS-compatible input profile scoped exclusively to `questionnaire.json` (UTF-8 without BOM, no lone surrogates or Unicode noncharacters, no Unicode normalization such as NFC/NFD performed with decoded code points preserved exactly and already-normalized NFC/NFD input accepted, no duplicate keys after unescaping, no non-finite constants, no float/exponent tokens at `parse_float` boundary, integers in $[-(2^{53}-1), +(2^{53}-1)]$; not transferred to `attempt.json`/`evaluation.json`). +- **Step `847` (`B2.3` Accepted):** 3-layer separation (strict Layer 1 parser $\to$ full RFC 8785 Layer 2 canonicalizer on Layer 1 structure $\to$ SHA-256), independent component implementations using established RFC 8785 libraries (no hand-written JCS, no shared first-party runtime package), verified by a mandatory raw-byte shared CI conformance suite. +- **Step `849` (`B2.4` Decomposition & Framing Constraints):** Decomposed `B2.4` into five subdecisions (`B2.4.1`–`B2.4.5`) with fixed constraints (`schema_version` inside $H_q$; changing it creates a new `assessment_id` without lineage; no in-place pair migration; cosmetic/internal changes do not require a new version). + +### B. Unverified Recommendations Requiring Atomic Resolution (`Step 850`) +In `step 850`, a runaway assistant response simulated synthetic `` turns for `B2.4.1` through `E2`. None of the specific choices inside those 17 atomic items (`S1-01`–`S1-17` below) have `USER_EXPLICIT` approval yet. + +--- + +## 1. Stage 1 Closure & Atomic Decision-Provenance Verification + +> [!NOTE] +> **True Prerequisites, Soft Dependencies & Disposition Rules:** +> - **Genuine Prerequisites** lists *only* hard architectural prerequisites among open tasks (`None (Settled baseline only)` means the task has no open hard prerequisites and is ready immediately). Soft/informational implementation dependencies are labeled explicitly and do not block architectural resolution. +> - **Task IDs (`S1-01` $\to$ `S1-17`)** reflect our recommended sequential review order. +> - **Valid Atomic Dispositions:** Each atomic decision (`S1-01`–`S1-17`) closes when it receives an explicit `USER_INPUT` assigning one of: `ACCEPTED_AS_PROPOSED`, `ACCEPTED_WITH_MODIFICATIONS`, `REJECTED_IN_FAVOR_OF_ALTERNATIVE`, `DEFERRED_WITH_JUSTIFICATION`, or `NOT_APPLICABLE_WITH_JUSTIFICATION`. + +| Task ID | Decision ID | Unresolved Architectural Commitment to Decide (Excluding Already-Settled Baseline) | Genuine Prerequisites | Explicit Completion Condition | Status | Resulting Artifact | +| :--- | :--- | :--- | :--- | :--- | :--- | :--- | +| **`S1-01`** | **`B2.4.1`** | **Contract Version Scope:** Whether `questionnaire.json`'s `schema_version` governs unified structure + frozen optional defaults + assessment-significant execution semantics (vs. structure-only or split version fields), and how it propagates into attempt journal & `attempt.json` provenance. | None *(Settled `BL-03`, `B2.1`, step `849`)* | Explicit `USER_INPUT` recording a justified disposition for `B2.4.1`. | `PENDING_USER_REVIEW` (`UNAPPROVED_RECOMMENDATION — step 850`) | [Ledger §3 — `S1-01`](issue-4-decision-ledger.md#s1-01--b241-contract-version-scope) | +| **`S1-02`** | **`B2.4.2`** | **Semantic Immutability Boundary:** Exact criterion separating contract-significant changes (requiring a new `schema_version`) from contract-preserving improvements (UI/CSS, accessibility, refactoring, compatible renderer patches, spec-compliance bug fixes). | `S1-01` (`B2.4.1`) | Explicit `USER_INPUT` recording a justified disposition for `B2.4.2`. | `PENDING_USER_REVIEW` (`UNAPPROVED_RECOMMENDATION — step 850`) | [Ledger §3 — `S1-02`](issue-4-decision-ledger.md#s1-02--b242-semantic-immutability-boundary) | +| **`S1-03`** | **`B2.4.3`** | **Defaults & Explicit Configuration:** Which questionnaire settings must be explicitly authored (timing, interaction mode, objectives list, behavioral rules) vs. permitted as optional omissions with frozen *"absent/none"* meaning (standalone `assessment_id`, optional stimulus blocks). | `S1-01` (`B2.4.1`) | Explicit `USER_INPUT` recording a justified disposition for `B2.4.3`. | `PENDING_USER_REVIEW` (`UNAPPROVED_RECOMMENDATION — step 850`) | [Ledger §3 — `S1-03`](issue-4-decision-ledger.md#s1-03--b243-defaults-and-explicit-configuration) | +| **`S1-04`** | **`B2.4.4`** | **Contract Version Support & Retirement:** Reconciling permanent semantic freeze with eventual engine retirement of legacy `schema_version`s (`UNSUPPORTED_SCHEMA_VERSION` fail-closed behavior, registry preservation of retired `AVAILABLE` records, and Tutor pre-flight compatibility check). | `S1-01`, `S1-02` (`B2.4.1`–`B2.4.2`) | Explicit `USER_INPUT` recording a justified disposition for `B2.4.4`. | `PENDING_USER_REVIEW` (`UNAPPROVED_RECOMMENDATION — step 850`) | [Ledger §3 — `S1-04`](issue-4-decision-ledger.md#s1-04--b244-contract-version-support-and-retirement) | +| **`S1-05`** | **`B2.4.5`** | **Migration & New Definitions Boundary:** Confirming whether `learningctl`/`learning-registryd` prohibits mechanical schema up-converters (`clone-upgrade`) in addition to prohibiting in-place pair rewrites, requiring consent-gated authoring of a new `assessment_id` linked only via shared objectives. | `S1-01` (`B2.4.1`, settled `BL-01`, `BL-02` & step `849`) | Explicit `USER_INPUT` recording a justified disposition for `B2.4.5`. | `PENDING_USER_REVIEW` (`UNAPPROVED_RECOMMENDATION — step 850`) | [Ledger §3 — `S1-05`](issue-4-decision-ledger.md#s1-05--b245-migration-and-new-definitions-boundary) | +| **`S1-06`** | **`B2.5.1`** | **Boundary Hash Calculation & Verification Authority:** Assigning authoritative $H_q$ calculation vs. verification across authoring (`live-quiz validate` hash output), registration (`learning-registryd` independent recomputation), `live-quiz recover` (digest + structural re-validation), and `learning-registryd` consolidation. | None *(Settled `BL-03`, `BL-04`, `B2.1`–`B2.3`)* | Explicit `USER_INPUT` recording a justified disposition for `B2.5.1`. | `PENDING_USER_REVIEW` (`UNAPPROVED_RECOMMENDATION — step 850`) | [Ledger §3 — `S1-06`](issue-4-decision-ledger.md#s1-06--b251-boundary-hash-calculation-and-verification-authority) | +| **`S1-07`** | **`B2.5.2`** | **Canonical Questionnaire Persistence Representation:** Whether the Learning Registry (`AVAILABLE` payload) and `live-quiz` attempt journal (`C1` snapshot) store **canonical RFC 8785 JCS UTF-8 bytes** (direct `prepare-execution` write without model re-serialization) vs. raw authored JSON bytes. | `S1-06` (`B2.5.1`, settled `BL-04`, `BL-07`) | Explicit `USER_INPUT` recording a justified disposition for `B2.5.2`. | `PENDING_USER_REVIEW` (`UNAPPROVED_RECOMMENDATION — step 850`) | [Ledger §3 — `S1-07`](issue-4-decision-ledger.md#s1-07--b252-canonical-questionnaire-persistence-representation) | +| **`S1-08`** | **`C2`** | **Legacy `attempt.json` (`assessment_version`) Policy:** Confirming whether the initial `attempt.json` schema omits `assessment_version` from day one with fail-closed rejection and zero legacy import/stripping machinery (leaving static files on disk untouched). | None *(Settled `BL-02`, `BL-05`)* | Explicit `USER_INPUT` recording a justified disposition for `C2`. | `PENDING_USER_REVIEW` (`UNAPPROVED_RECOMMENDATION — step 850`) | [Ledger §3 — `S1-08`](issue-4-decision-ledger.md#s1-08--c2-legacy-attemptjson-assessment_version-policy) | +| **`S1-09`** | **`D1a`** | **Registry Repository & Package Ownership:** Whether `learningctl`, `learning-registryd`, and host provisioning live in a separate dedicated repository vs. a three-component monorepo inside the `live-quiz` repository. | None *(Settled `BL-06`, `B2.3`, `ADR-0008`)* | Explicit `USER_INPUT` recording a justified disposition for `D1a`. | `PENDING_USER_REVIEW` (`UNAPPROVED_RECOMMENDATION — step 850`) | [Ledger §3 — `S1-09`](issue-4-decision-ledger.md#s1-09--d1a-registry-repository-and-package-ownership) | +| **`S1-10`** | **`D1b`** | **Workspace Marker Edge Cases, Fail-Closed Taxonomy & Migration Trigger:** Handling duplicate same-dir `init` and unregistered `.learning-workspace` markers, classifying fail-closed DB states (`NOT_PROVISIONED`, `MISSING_OR_LOCKED`, `CORRUPT`, `MIGRATION_REQUIRED`, `UNSUPPORTED_SCHEMA`), and requiring explicit out-of-band backup-gated migrations. | None *(Settled `BL-06`)* | Explicit `USER_INPUT` recording a justified disposition for `D1b`. | `PENDING_USER_REVIEW` (`UNAPPROVED_RECOMMENDATION — step 850`) | [Ledger §3 — `S1-10`](issue-4-decision-ledger.md#s1-10--d1b-workspace-marker-edge-cases-fail-closed-error-taxonomy--migration-trigger) | +| **`S1-11`** | **`D2a`** | **`REGISTERING` Status Visibility & `ABORTED` Tombstone Retention:** Whether incomplete `REGISTERING` definitions appear in a dedicated `learningctl status` category (vs. separate query only) without TTL expiry, and how `ABORTED` tombstones/draft blobs are retained and hidden from ordinary status. | None *(Settled `BL-07`)* | Explicit `USER_INPUT` recording a justified disposition for `D2a`. | `PENDING_USER_REVIEW` (`UNAPPROVED_RECOMMENDATION — step 850`) | [Ledger §3 — `S1-11`](issue-4-decision-ledger.md#s1-11--d2a-registering-status-visibility-and-aborted-tombstone-retention) | +| **`S1-12`** | **`D2b`** | **Startup-Commit Acknowledgment & Temp Questionnaire Cleanup Protocol:** How `live-quiz start` signals durable initial journal snapshot commitment (e.g., port-bind-first + `SESSION_READY` NDJSON line on `stdout` vs. split `init`/`serve`) so `learningctl` cleans up the temp questionnaire before the quiz ends. | None *(Hard prerequisite: settled `BL-04` / `C1` & `BL-07`; Soft / informational dependency: `S1-07` / `B2.5.2`)* | Explicit `USER_INPUT` recording a justified disposition for `D2b`. | `PENDING_USER_REVIEW` (`UNAPPROVED_RECOMMENDATION — step 850`) | [Ledger §3 — `S1-12`](issue-4-decision-ledger.md#s1-12--d2b-startup-commit-acknowledgment-and-temporary-questionnaire-cleanup-protocol) | +| **`S1-13`** | **`D3a`** | **Read-Only Active-vs.-Recoverable Attempt Inspection Contract:** How `live-quiz` tracks active process liveness (continuous `attempt-.lock` `flock`) and exposes a read-only (`mode=ro`, non-unlinking lock probe) batch inspection interface for `learningctl status`. | None *(Settled `BL-04`, `BL-08`, `ADR-0006`)* | Explicit `USER_INPUT` recording a justified disposition for `D3a`. | `PENDING_USER_REVIEW` (`UNAPPROVED_RECOMMENDATION — step 850`) | [Ledger §3 — `S1-13`](issue-4-decision-ledger.md#s1-13--d3a-read-only-active-vs-recoverable-attempt-inspection-contract) | +| **`S1-14`** | **`D3b`** | **Service-Boundary Delegation Cutoff & `schema_version` Format:** Confirming exact `"."` string format for per-command `learningctl --json` `schema_version` (flagged open at step `827`), agent-vs.-admin operation separation, and delegation of systemd/UDS/group/mode/CLI-spelling specifics. | `S1-09` (`D1a` repo boundary) | Explicit `USER_INPUT` recording a justified disposition for `D3b`. | `PENDING_USER_REVIEW` (`UNAPPROVED_RECOMMENDATION — step 850`) | [Ledger §3 — `S1-14`](issue-4-decision-ledger.md#s1-14--d3b-service-boundary-delegation-cutoff-and-schema_version-format) | +| **`S1-15`** | **`D4`** | **Out-of-Band Key Escrow, Backup Integrity Verification Gate & Operational Delegation:** Reconciling non-TPM cross-host portability with `learningctl` key exclusion via privileged admin out-of-band key escrow (separate from DB backups), enforcing independent keyed integrity verification before backup promotion (mechanism conditional on the DB/encryption implementation chosen in `DEF-05`; `SQLCipher` remains a candidate only, never pruning last verified point), and delegating driver/schedule/retention tunables. | `S1-10` (`D1b` fail-closed & pre-migration backup gate) | Explicit `USER_INPUT` recording a justified disposition for `D4`. | `PENDING_USER_REVIEW` (`UNAPPROVED_RECOMMENDATION — step 850`) | [Ledger §3 — `S1-15`](issue-4-decision-ledger.md#s1-15--d4-out-of-band-key-escrow-backup-verification-gate--operational-delegation) | +| **`S1-16`** | **`E1`** | **Per-Execution Staging Slot Allocation & `--output` Destination Discipline:** Preventing reassessment/concurrent `CONFLICT_DIFFERENT_ATTEMPT` collisions before `live-quiz` generates `attempt_id` (e.g., `learningctl`-allocated per-execution staging slot passed via standard `--output /attempt.json` vs. engine `--output-dir` mode). | None *(Settled `BL-04`, `BL-09`, `ADR-0007`)* | Explicit `USER_INPUT` recording a justified disposition for `E1`. | `PENDING_USER_REVIEW` (`UNAPPROVED_RECOMMENDATION — step 850`) | [Ledger §3 — `S1-16`](issue-4-decision-ledger.md#s1-16--e1-per-execution-staging-slot-allocation-and---output-destination-discipline) | +| **`S1-17`** | **`E2`** | **Pre-Consolidation Storage Split, Pre-Debrief Status Reconciliation & `ABANDONED` Payload Retention:** Preserving the settled `BL-09` lifecycle states (`PENDING_DEBRIEF`, `DEFERRED`, `PENDING_CONSOLIDATION`, `CONSOLIDATED`, `ABANDONED`) unchanged while deciding: (1) splitting pre-consolidation registry envelopes/append-only lifecycle events from staged payloads and structured debrief checkpoints (retained in `E1` slot across `ABANDONED`), (2) read-only `status` reconciliation surfacing un-evaluated staged `attempt.json` exports via `awaiting_evaluation` — where `awaiting_evaluation` is a derived, read-only status classification used to identify an incomplete staged interaction (it is not a persisted lifecycle state, does not modify the `BL-09` state set, and does not replace `PENDING_DEBRIEF`), and (3) `B2.5.1` transactional consolidation verification. Any modification to a settled `BL-09` state requires explicit user authorization. | `S1-06` (`B2.5.1`), `S1-16` (`E1`) *(plus settled `BL-09`; no hard prerequisite on `S1-07`/`B2.5.2`)* | Explicit `USER_INPUT` recording a justified disposition for `E2`. | `PENDING_USER_REVIEW` (`UNAPPROVED_RECOMMENDATION — step 850`) | [Ledger §3 — `S1-17`](issue-4-decision-ledger.md#s1-17--e2-pre-consolidation-storage-split-pre-debrief-status-reconciliation--abandoned-payload-retention) | +| **`S1-18`** | **Closure** | **Verified Stage 1 Decision Closure Report:** Reconciled ledger of `A`–`E2` with verified `USER_EXPLICIT` provenance, explicit dispositions, dependency map, and deferred-items boundary. | `S1-01`–`S1-17` | Every atomic decision (`S1-01`–`S1-17`) has received one explicit disposition (`ACCEPTED_AS_PROPOSED`, `ACCEPTED_WITH_MODIFICATIONS`, `REJECTED_IN_FAVOR_OF_ALTERNATIVE`, `DEFERRED_WITH_JUSTIFICATION`, or `NOT_APPLICABLE_WITH_JUSTIFICATION`) backed by explicit user approval or user-authorized deferral, with provenance verified in [issue-4-decision-ledger.md](issue-4-decision-ledger.md). | **Blocked** (on `S1-01`–`S1-17`) | [issue-4-decision-ledger.md](issue-4-decision-ledger.md) | + +--- + +## 2. Architectural Comprehension Walkthrough (Hard Sequencing Gate Before Stage 2) + +> [!WARNING] +> **Hard Gate:** `CW-01` (`CW-01a`–`CW-01e` + supporting system map) must be completed and receive explicit user approval before any Stage 2 (`S2-*`) task begins. The supporting system map is an explanatory walkthrough aid, explicitly distinct from authoritative repository documentation ([docs/architecture.md](../docs/architecture.md)). + +| Task ID | Expected Deliverable | Dependencies | Relevant Decision IDs | Explicit Completion Condition | Status | Resulting Artifact | +| :--- | :--- | :--- | :--- | :--- | :--- | :--- | +| **`CW-01`** | **Complete Architectural Comprehension Walkthrough & Supporting System Map** covering five required subjects:
• **`CW-01a`:** System context and component responsibilities (`tutor`, `quiz-designer`, `learning-objectives`, `quiz-evaluator`, `learningctl`, `learning-registryd`, `live-quiz`).
• **`CW-01b`:** Data flows and integration contracts (`questionnaire.json`, `rubric.json`, `attempt.json`, `evaluation.json`, JCS hashing, approved startup acknowledgment, read-only attempt inspection, consolidation receipts).
• **`CW-01c`:** Persistence domains and artifact lifecycles (global encrypted Learning Registry vs. ephemeral attempt SQLite journals vs. short-lived materialized questionnaires vs. approved pre-consolidation staging/persistence topology vs. standalone exports).
• **`CW-01d`:** Trust boundaries and security assumptions (blind pass, runtime rubric exclusion, `learning-registry` OS service boundary, non-TPM key isolation, black-box CLI guardrail, formative host threat model).
• **`CW-01e`:** Failure scenarios, recovery, and consistency guarantees (crash at every registration, startup, execution, export, evaluation, debrief, migration, and backup boundary). | `S1-18` | `A`–`E2`, Issues #1–#8 | All five walkthrough subjects and the supporting non-normative system map are reviewed with the user, and the user gives **explicit approval** to proceed to Stage 2. | **Blocked** (on `S1-18`) | Pending (Walkthrough Record & Supporting System Map) | + +--- + +## 3. Stage 2 — ADR Formalization & Architecture Documentation Reconciliation + +> [!NOTE] +> **Conditionality Rule:** Stage 2 deliverables (`S2-01`–`S2-06`) must not pre-encode unapproved `step 850` recommendations. Each Stage 2 artifact must incorporate the **actual user-approved Stage 1 dispositions** (including `ACCEPTED_WITH_MODIFICATIONS` and `REJECTED_IN_FAVOR_OF_ALTERNATIVE` outcomes) from [issue-4-decision-ledger.md](issue-4-decision-ledger.md) and preserve all deferred items (`DEF-01`–`DEF-05` and any Stage 1 `DEFERRED_WITH_JUSTIFICATION` dispositions) as unresolved. + +| Task ID | Expected Deliverable | Dependencies | Relevant Decision IDs | Explicit Completion Condition | Status | Resulting Artifact | +| :--- | :--- | :--- | :--- | :--- | :--- | :--- | +| **`S2-01`** | **ADR Allocation & Scope Plan:** Determine exact new ADR count, numbering (`0010`+ against [docs/decisions/README.md](../docs/decisions/README.md)), and repository placement boundary based on the user-approved Stage 1 dispositions (especially `D1a` / `S1-09` and `E2` / `S1-17`), preserving deferred matters as unresolved. | `CW-01` *(Hard Gate)*, `S1-09`, `S1-17` | `A`–`E2` | User approves the exact list of amended ADRs and new ADR titles/numbers before drafting begins. | **Blocked** (on `CW-01`) | Pending | +| **`S2-02`** | **Amend Engine & Execution ADRs (`0002`, `0004`, `0005`, `0006`, `0007`):** Reconcile engine lifecycle (`0002`), input/rubric isolation & contract evolution (`0004`, `0005`), journal snapshot & active-vs.-recoverable inspection (`0006`), and identity/hash/export contracts (`0007`) strictly with the settled baseline (`BL-01`–`BL-05`, `BL-07`–`BL-08`, `B2.1`–`B2.3`) and the **actual user-approved Stage 1 dispositions** (including approved modifications or alternatives for `B2.4.*`, `B2.5.*`, `C2`, `D2b`, `D3a`, `E1`), preserving deferred matters (`DEF-01`–`DEF-03`, `DEF-05`) as unresolved. | `S2-01` | `A`, `B1`–`B2.5.2`, `C1`–`C2`, `D2b`, `D3a`, `E1` | Amended MADRs drafted, verified against approved ledger dispositions and free of regressions against Issues #1–3 & #5–8, and approved by user. | **Blocked** (on `S2-01`) | `../docs/decisions/0002-*.md`, `0004-*.md`, `0005-*.md`, `0006-*.md`, `0007-*.md` | +| **`S2-03`** | **Amend Repository & Reference Skills ADRs (`0008`, `0009`):** Reconcile component/repository ownership (`0008`) and reference skill / Tutor-registry integration (`0009`) strictly with the settled baseline (`BL-01`–`BL-02`, `BL-06`–`BL-09`) and the **actual user-approved Stage 1 dispositions** (including approved modifications or alternatives for `D1a`, `D2a`, `D3b`, `E2`), preserving deferred matters (`DEF-03`–`DEF-05`) as unresolved. | `S2-01` | `A`, `D1a`, `D2a`, `D3b`, `E2` | Amended `ADR-0008` and `ADR-0009` drafted, verified against approved ledger dispositions, and approved by user. | **Blocked** (on `S2-01`) | `../docs/decisions/0008-*.md`, `../docs/decisions/0009-*.md` | +| **`S2-04`** | **Author New MADR(s) (`0010`+) & Update ADR Index:** Formalize the new ADR(s) allocated in `S2-01` from the actual user-approved Stage 1 dispositions (recording accepted choices, selected alternatives, rationales, and explicit boundaries leaving deferred matters unresolved) and update [docs/decisions/README.md](../docs/decisions/README.md). | `S2-01` | `A`–`E2` | New MADR file(s) and `../docs/decisions/README.md` index authored and approved. | **Blocked** (on `S2-01`) | `../docs/decisions/0010-*.md` (+ any additional allocated MADR), `../docs/decisions/README.md` | +| **`S2-05`** | **Reconcile `docs/architecture.md`:** Update system diagram, component table, contract topologies, persistence lifecycles, canonicalization/versioning rules, and interaction/debrief workflows to match the approved Stage 1 dispositions and Stage 2 ADRs; remove stale `assessment_version` and unspecified-registry text while preserving deferred matters as unresolved. | `S2-02`–`S2-04` | `A`–`E2` | [docs/architecture.md](../docs/architecture.md) updated and aligned with `ADR-0001`–`0010+`. | **Blocked** (on `S2-02`–`S2-04`) | `../docs/architecture.md` | +| **`S2-06`** | **Cross-Document Consistency Verification:** Audit [docs/architecture.md](../docs/architecture.md), `../docs/decisions/0001`–`0010+`, and [docs/decisions/README.md](../docs/decisions/README.md) for terminology, invariant, exit-code, ledger-disposition fidelity, deferred-boundary preservation, and boundary consistency across Issues #1–#8. | `S2-05` | Issues #1–#8, `A`–`E2` | Verification check passes with zero cross-document contradictions and user approves Stage 2 completion. | **Blocked** (on `S2-05`) | Pending (Stage 2 Verification Report & Git Commit) | + +--- + +## 4. Stage 3 — Acceptance Criteria + +| Task ID | Expected Deliverable | Dependencies | Relevant Decision IDs | Explicit Completion Condition | Status | Resulting Artifact | +| :--- | :--- | :--- | :--- | :--- | :--- | :--- | +| **`S3-01`** | **Derive Verifiable Acceptance Criteria:** Translate reconciled `docs/architecture.md` and `ADR-0001`–`0010+` into falsifiable acceptance criteria (preserving the boundary between architectural guarantees and deferred implementation details). | `S2-06` | Issues #1–#8, `A`–`E2` | Acceptance criteria document authored, verified traceable to ADRs, and approved by user. | **Blocked** (on `S2-06`) | `../docs/acceptance-framework.md` (planned) | + +--- + +## 5. Deferred Implementation Responsibilities (Not Completed Architecture) + +These items remain **explicitly deferred** to post-Stage-3 technical design and implementation (never counted as completed architectural work): + +| Task ID | Expected Deliverable | Trigger / Prerequisite | Relevant Decision IDs | Explicit Completion Condition | Status | Resulting Artifact | +| :--- | :--- | :--- | :--- | :--- | :--- | :--- | +| **`DEF-01`** | **JSON Schemas & Strict Pydantic Models:** Exact field names and `.schema.json` specs for `questionnaire.json`, `rubric.json`, `attempt.json` (incl. contract-version provenance field spelling per resolved `B2.4.1`), and `evaluation.json`, with recursive `extra="forbid"`, `strict=True`, and negative nesting tests. | Post-`S3-01` (Implementation kickoff) | `B1`, `B2.1`, `B2.2`, `B2.4.1`–`B2.4.3`, `C2` | Schemas and models pass unit + negative validation suites. | **Deferred** | Pending | +| **`DEF-02`** | **RFC 8785 Library Selection & Shared Conformance Suite:** Choose Python JCS package (`rfc8785`/`jcs` candidates) and assemble raw-byte CI conformance test vectors (official RFC 8785 vectors + `B2.2` negative parser vectors + `attempt.json` float vectors). | Post-`S3-01` | `B2.2`, `B2.3` | CI conformance suite passes identically across `live-quiz` and registry implementations. | **Deferred** | Pending | +| **`DEF-03`** | **`live-quiz` CLI Interface & Output Schemas:** Finalize subcommand spellings, flags, and JSON/output schemas for `live-quiz validate`, startup readiness acknowledgment (`D2b`), and read-only attempt inspection (`D3a`); author `live-quiz.md`. | Post-`S3-01` (and `S1-12`, `S1-13`) | `B2.5.1`, `D2b`, `D3a` | `live-quiz.md` and `--help` contracts implemented and integration-tested. | **Deferred** | Pending (`live-quiz.md`) | +| **`DEF-04`** | **`learningctl` Domain CLI Grammar & JSON Schemas:** Finalize `.learning-workspace` optional metadata fields, command/flag spellings (`assessment`, `interaction`, `backup`, reconsideration), and CLI `schema_version` / JSON schemas (`status`, consolidation receipt, structured debrief checkpoint); author `learningctl.md`. | Post-`S3-01` (and `S1-10`–`S1-17`) | `D1b`, `D2a`, `D3b`, `E1`, `E2` | `learningctl.md` and `--help` contracts implemented and validated against `learning-registryd`. | **Deferred** | Pending (`learningctl.md`) | +| **`DEF-05`** | **Host Daemon Packaging, Security & Backup Operations:** Finalize `learning-registryd` systemd `.socket`/`.service` units, UDS path/group/modes, private IPC wire framing, temp/staging XDG paths, encrypted DB driver (`SQLCipher` candidate), concrete backup integrity-check mechanism, credential storage (`LoadCredentialEncrypted=` vs. keyfile), admin key-escrow/migrate/restore tools, backup timer schedule, retention thresholds, and external sync target. | Post-`S3-01` (and `S1-09`, `S1-14`, `S1-15`) | `D1a`, `D1b`, `D2b`, `D3b`, `D4`, `E1` | Host installer, systemd units, and backup/restore drills verified in target Linux/NixOS environment. | **Deferred** | Pending | + +--- + +## 6. Issue #9 — Companion Skill Portability & Integration Contracts (Separate Milestone) + +| Task ID | Expected Deliverable | Dependencies | Relevant Decision IDs | Explicit Completion Condition | Status | Resulting Artifact | +| :--- | :--- | :--- | :--- | :--- | :--- | :--- | +| **`I9-01`** | **Original Issue #9 Discovery, ADR Reconciliation & Acceptance Criteria:** Resolve companion skill portability, single-agent vs. subagent execution fallbacks, `learningctl.md` / `live-quiz.md` black-box operating contracts, host-path neutrality, and optional Tutor facilitation UX guidance. | `S2-06` (or explicit user schedule directive) | Issue #9, `D1a`, `D3b`, `E2`, [ADR-0008](../docs/decisions/0008-two-product-repository-architecture.md), [ADR-0009](../docs/decisions/0009-modular-portable-reference-skills.md) | Issue #9 Stage 1 $\to$ Stage 2 $\to$ Stage 3 completed and explicitly approved by user. | **Open (Separate Milestone)** | Pending |