> ## Documentation Index
> Fetch the complete documentation index at: https://prism.ntecdev.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# SPEC-023 v1.0: prism_wrap discipline + summary quality

> prism_wrap discipline + summary quality

<Info>**Status:** `draft` · **Version** `1.0` · Filed 2026-04-21</Info>

Closes two failure modes in the current Prism session lifecycle, both inside Ring 0 Layer 4, neither addressed by SPEC-021 or SPEC-022.

**Failure mode 1 — Discipline gap.** Agents often end sessions without calling `prism_wrap`. Deltas go unrecorded, decisions live only in conversation context, the next agent (or future-same-agent) has no clean handoff artifact. When users share context with collaborators or move between surfaces (CD → Claude Code, machine → machine), missing wraps force reconstruction from archaeology.

**Failure mode 2 — Quality gap.** Even when `prism_wrap` is called, the summary is sometimes thin — a one-sentence "wrapped up SPEC-XYZ work" that doesn't close the loops it claims to close.

**Origin.** Surfaced 2026-04-20 PM during SPEC-021 implementation audit. Frank: "a wrap is good hygiene and should be done so things are done and don't build up, it is also helps when you share context to other users." Option 3 selected — address both discipline AND quality.

**Scope in.** Normative expectation that prism\_wrap is called at session close. Detection of unwrapped prior sessions + nudge at next prism\_start. Minimum structural expectations on summaries (what happened / what's next / open loops). Advisory agent-side discipline cues. Observability (wrap\_rate counter).

**Scope out.** Hard enforcement (breaks scripted use). Trigger content (SPEC-021 §4.4 + SPEC-022). Auto-generation of wrap summaries. Intra-session checkpointing.

**Key design choices.**

* §5.4 unwrapped-session detection: prior delta > 10min old AND not wrap-kind AND session was substantive (≥1 mutation verb).
* §6.2 delta\_kind column on session\_deltas (rejected: prefix convention — brittle). Enum: wrap | note | remember | methodology | research | other. Also useful beyond this spec as a semantic\_recall primary filter.
* §7 observability: sessions\_opened, sessions\_wrapped, wrap\_rate over 30-day rolling window. Advisory reminder if rate \< 0.6 (tune upward to 0.8-0.9 as discipline improves).
* Read-only sessions exempt from wrap obligation. Trivial-session exception handled via agent judgment, not hard rules.

**Rejected alternatives.** Hard enforcement (breaks scripts). Auto-wrap on session-start (produces artifact that looks like wrap but isn't). Wrap summary JSON schema (kills prose quality). Reminders in every prism\_start always (noisy).

**Open questions.**

* Q1: Session identity — mint session\_id at prism\_start (clean, small schema add) vs infer from delta sequence (works with current schema, fuzzy across concurrent sessions). Lean: mint.
* Q2: 10-minute unwrapped threshold — tune based on practice.
* Q3: wrap\_rate target — 0.6 initial, aim 0.8-0.9.
* Q4: Agent-drafted summaries (prism\_wrap\_draft helper verb) — defer to future spec.
* Q5: Multi-surface sessions (CD → Claude Code on same PID) interact with Sync Master Controller. Revisit when SMC opens.
* Q6: prism\_journal vs prism\_wrap overlap — keep separate in v1.

**Implementation.** 2-3 PRs.

* PR 1: delta\_kind column + migration (backfill existing wraps via prefix match). Optional session\_id mint.
* PR 2: Unwrapped-session detection in prism\_start + rules\_reminder emission.
* PR 3: Observability counters + wrap\_rate reminder.
  Estimate: \~1.25 days total sequenced tightly.

**Relationships.** Companion to SPEC-022 (independent, either can ship first). Together they close SPEC-021 Ring 0 Layer 4. ADR-24 unchanged — implementation completion of accepted architecture, no new ADR.

Full spec on disk: /Users/fpn/projects/Prism/docs/specs/spec-023-v0-1-wrap-discipline-and-quality.mdx (drafted 2026-04-20 PM, Lola + Frank).
