> For the complete documentation index, see [llms.txt](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/archive/phases/phase_33/session_04_harden_dream_projection.md).

# Session 04: Harden Dream Projection

**Session ID**: `phase33-session04-harden-dream-projection` **Status**: Not Started **Estimated Tasks**: \~12-25 **Estimated Duration**: 2-4 hours

***

## Objective

Add a deliberately small, public-safe Dream Review projection to the demo snapshot.

***

## Scope

### In Scope (MVP)

* Audit Dream output contracts, live-data validation, and home dashboard transforms that consume `dream`.
* Audit `scripts/lib/dream/contracts.ts`, `scripts/lib/dream/output-reader.ts`, `scripts/lib/dream/loader.ts`, `src/lib/validate-live-data.ts`, and `src/lib/home-transforms.ts` for the private-to-public Dream boundary.
* Preserve safe Dream Review prescription fields needed by the home dashboard and any Dream Review presentation surface.
* Project only safe Dream fields: generated timestamp, prescriptions, titles, summaries, rationales, next actions, priorities, tags, evidence, command, dollar impact, and time impact when each field passes public scanning.
* Keep `generatedAt` and optionally `lastRun` or `date` when useful for UI labels.
* Keep a bounded `prescriptions` array.
* For each prescription, keep safe `id`, `title`, `summary`, `rationale`, `nextAction`, `priority`, `tags`, `evidence`, `dollarImpact`, `timeImpactMins`, and `command` only when each field passes public scanning.
* Drop provider labels, model names, runtime metadata, raw material, prompts, request context, output paths, warnings, diagnostics, and private fields.
* Drop `model`, warning bodies, raw material fields, and any private diagnostic fields.
* Add Dream field policy metadata to the public snapshot manifest.
* Add Dream field policy and count summaries to the existing `demo-website/snapshot-manifest.json` review manifest.
* Replace generic fallback labels with frozen-real-demo labels when the source Dream Review payload is populated and passes privacy scans.
* Add negative tests for private Dream fields, local paths, raw prompt/provider text, and token-like strings.
* Add a negative exporter test that injects private Dream fields, local paths, raw prompt/provider text, and token-like strings and verifies the exporter drops or rejects them.
* Add positive tests for safe Dream titles, summaries, priorities, tags, next actions, evidence, and impact fields.
* Add or update tests for frozen real Dream Review fixture policy.
* Ensure Dream projection output works with home-dashboard Dream transforms.

### Out of Scope

* Exposing private Dream output files directly.
* Running Dream Review during Cloudflare Pages builds.
* Adding hosted Dream runtime or hosted Dream run controls.

***

## Prerequisites

* [ ] Session 01 produced meaningful local Dream data or documented frozen Dream snapshot unavailability.
* [ ] Dream projection uses an allowlist smaller than private `DreamOutput`.
* [ ] Existing public scans are extended before committing Dream data.
* [ ] Current local Dream data has 4 prescriptions and is the first candidate input after manual privacy review.
* [ ] If reviewed Dream data is unavailable, public demo mode renders a frozen-snapshot-unavailable state with disabled Dream controls.
* [ ] Public demo mode does not instruct hosted users to run local Dream commands.
* [ ] One-off private Dream output authoring input, if needed, remains operator-local and is never read by the Cloudflare build.
* [ ] Committed public Dream output belongs only in `demo-website/public/demo/live-data.snapshot.json`.

***

## Deliverables

1. Updated Dream public projection code.
2. Updated snapshot metadata or manifest field policy for Dream Review.
3. Positive and negative Dream projection tests.

***

## Success Criteria

* [ ] Public snapshot contains useful Dream Review prescriptions instead of `null`.
* [ ] Safe Dream titles, summaries, next actions, priorities, tags, evidence, and impact fields survive when present.
* [ ] Real Dream Review titles, summaries, priorities, tags, and next actions survive projection when they are safe.
* [ ] Private Dream fields, local paths, raw logs, prompts, provider bodies, credentials, and token-like strings are removed or rejected.
* [ ] Public scan coverage fails on Dream privacy leaks.
* [ ] Dream projection output remains compatible with `deriveDreamData()` and existing home-dashboard Dream transforms.
* [ ] Enough prescriptions survive to make the home dashboard feel like a real local AI OS review, not an empty hosted shell.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/archive/phases/phase_33/session_04_harden_dream_projection.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
