> 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/sessions/phase28-session07-research-only-calibration-and-cache-retention/tasks.md).

# Task Checklist

**Session ID**: `phase28-session07-research-only-calibration-and-cache-retention` **Total Tasks**: 23 **Estimated Duration**: 3-4 hours **Created**: 2026-06-14

***

## Legend

* `[x]` = Completed
* `[ ]` = Pending
* `[P]` = Parallelizable (can run with other \[P] tasks)
* `[SNNMM]` = Session reference (NN=phase number, MM=session number)
* `TNNN` = Task ID

***

## Progress Summary

| Category       | Total  | Done   | Remaining |
| -------------- | ------ | ------ | --------- |
| Setup          | 3      | 3      | 0         |
| Foundation     | 6      | 6      | 0         |
| Implementation | 9      | 9      | 0         |
| Testing        | 5      | 5      | 0         |
| **Total**      | **23** | **23** | **0**     |

***

## Setup (3 tasks)

Initial verification and implementation notes.

* [x] T001 \[S2807] Verify prerequisite sessions, source mapping, and current target-file paths before edits (`.spec_system/PRD/phase_28/session_07_research_only_calibration_and_cache_retention.md`)
* [x] T002 \[S2807] Create implementation-notes shell for role thresholds, retention constants, preserve-list decisions, validation commands, and residual risks (`.spec_system/specs/phase28-session07-research-only-calibration-and-cache-retention/implementation-notes.md`)
* [x] T003 \[S2807] Compare Trends-Finderz research calibration and retention cleanup policy to current Trend Finder role and cache shapes without copying uncalibrated thresholds (`EXAMPLES/trends-finderz/lib/product/research-signal-calibration.ts`)

***

## Foundation (6 tasks)

Core contracts and pure deterministic helpers.

* [x] T004 \[S2807] Add `research-only` to the additive risk flag enum and legacy-safe topic parsing (`src/extensions/trend-finder/schema.ts`)
* [x] T005 \[S2807] Extend risk flag derivation with role-composition input, schema-validated roles, adoption-role exclusions, bounded issue mapping, and deterministic flag ordering (`scripts/lib/ai-runtime/risk-flags.ts`)
* [x] T006 \[S2807] Wire scoring risk derivation to pass source-role inputs from scoring evidence and source summaries without exposing raw source details (`scripts/lib/ai-runtime/scoring.ts`)
* [x] T007 \[S2807] Add risk flag view-model copy, descriptions, tones, aria labels, and bounded research-only chip text (`src/extensions/trend-finder/view-model.ts`)
* [x] T008 \[S2807] Add snapshot archive retention constants and path-safe helper with retention clamp, `latest.json` preservation, malformed-file handling, and aggregate counts (`scripts/lib/ai-runtime/snapshots.ts`)
* [x] T009 \[S2807] \[P] Add representative research-only fixture topics, role shares, and mixed-role counterexamples for UI and parser coverage (`src/extensions/trend-finder/fixtures.ts`)

***

## Implementation (9 tasks)

Runtime wiring and user-facing surfaces.

* [x] T010 \[S2807] Add prediction archive retention helper with path containment, configurable clamp handling, `latest.json` preservation, and sanitized failure counts (`scripts/lib/ai-runtime/predictions.ts`)
* [x] T011 \[S2807] Add retro archive retention helper under `predictions/retros` with path containment, configurable clamp handling, `latest.json` preservation, and sanitized failure counts (`scripts/lib/ai-runtime/retros.ts`)
* [x] T012 \[S2807] Invoke snapshot, prediction, and retro retention after archive writes with duplicate-trigger prevention for one collect run and failure-path warnings (`scripts/extensions/trend-finder/collector.ts`)
* [x] T013 \[S2807] Emit sanitized retention trace events and aggregate collector warnings with per-store counts only and no private paths (`scripts/extensions/trend-finder/collector.ts`)
* [x] T014 \[S2807] Ensure Trend card risk chips render `research-only` through existing chip layout with platform-appropriate accessibility labels and compact wrapping (`src/extensions/trend-finder/components/trend-card.tsx`)
* [x] T015 \[S2807] Ensure Signal Workbench risk facets and filters include `research-only` with deterministic ordering and explicit empty-state behavior (`src/extensions/trend-finder/signal-workbench-model.ts`)
* [x] T016 \[S2807] Update scoring documentation for the shipped research-only flag, caveat semantics, action-layer input role, and no planned-feature language (`docs/extensions/trend-finder-scoring.md`)
* [x] T017 \[S2807] Update pipeline documentation for private cache retention stores, default/clamped window, preserve list, and sanitized reporting (`docs/extensions/trend-finder-pipeline.md`)
* [x] T018 \[S2807] Record implementation decisions, threshold rationale, retention constants, validation commands, and residual risks as work proceeds (`.spec_system/specs/phase28-session07-research-only-calibration-and-cache-retention/implementation-notes.md`)

***

## Testing (5 tasks)

Verification and quality assurance.

* [x] T019 \[S2807] \[P] Add risk flag and scoring tests for research-only detection, mixed adoption-role exclusions, malformed roles, existing flag coexistence, and stable ordering (`scripts/lib/ai-runtime/__tests__/risk-flags.test.ts`, `scripts/lib/ai-runtime/__tests__/scoring.test.ts`)
* [x] T020 \[S2807] \[P] Add schema, view-model, and Workbench tests for legacy parsing, chip copy, aria labels, facet counts, filtering, and bounded labels (`src/lib/__tests__/trend-finder-schema.test.ts`, `src/extensions/trend-finder/__tests__/view-model.test.ts`, `src/extensions/trend-finder/__tests__/signal-workbench-model.test.ts`)
* [x] T021 \[S2807] \[P] Add archive retention tests for snapshots, predictions, and retros covering clamps, `latest.json`, protected files, malformed entries, path safety, and deletion counts (`scripts/lib/ai-runtime/__tests__/snapshots.test.ts`, `scripts/lib/ai-runtime/__tests__/predictions.test.ts`, `scripts/lib/ai-runtime/__tests__/retros.test.ts`)
* [x] T022 \[S2807] \[P] Add collector tests for end-of-collect retention invocation, per-store aggregate counts, warning behavior, trace sanitization, and no private path leakage (`scripts/extensions/trend-finder/__tests__/collector.test.ts`)
* [x] T023 \[S2807] Run focused tests, ASCII validation, and manual Trend card, Signal Workbench, and retention dry-run checks, then record results and residual risks (`.spec_system/specs/phase28-session07-research-only-calibration-and-cache-retention/implementation-notes.md`)

***

## Completion Checklist

Before marking session complete:

* [x] All tasks marked `[x]`
* [x] All tests passing
* [x] All files ASCII-encoded
* [x] implementation-notes.md updated
* [x] Ready for the validate workflow step

***

## Next Steps

Run the validate workflow step for independent verification.


---

# 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/sessions/phase28-session07-research-only-calibration-and-cache-retention/tasks.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.
