> 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/phase29-session05-per-evidence-rationale/tasks.md).

# Task Checklist

**Session ID**: `phase29-session05-per-evidence-rationale` **Total Tasks**: 22 **Estimated Duration**: 3-4 hours **Created**: 2026-06-19

***

## 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          | 2      | 2      | 0         |
| Foundation     | 6      | 6      | 0         |
| Implementation | 9      | 9      | 0         |
| Testing        | 5      | 5      | 0         |
| **Total**      | **22** | **22** | **0**     |

***

## Setup (2 tasks)

Initial configuration and environment preparation.

* [x] T001 \[S2905] Verify analyzer state, completed prerequisites, and Session 05 stub scope before editing (`.spec_system/PRD/phase_29/session_05_per_evidence_rationale.md`)
* [x] T002 \[S2905] Inspect current analyst validation, topic projection, and Evidence to verify rendering paths before adding rationale fields (`scripts/extensions/trend-finder/collector.ts`)

***

## Foundation (6 tasks)

Core structures and base implementations.

* [x] T003 \[S2905] \[P] Create evidence-rationale helper contract with bounded text, fallback result types, omission reasons, and deterministic no-AI fallback (`scripts/lib/ai-runtime/evidence-rationale.ts`)
* [x] T004 \[S2905] Add rationale constants, topic schema defaults, evidence-rationale record schema, and legacy-safe parsing with exhaustive fallback behavior (`src/extensions/trend-finder/schema.ts`)
* [x] T005 \[S2905] Extend analyst output types, prompt example, and Zod schema for per-cited evidence rationales keyed to existing evidence IDs (`scripts/lib/ai-runtime/trend-analyst.ts`)
* [x] T006 \[S2905] Add rationale validator helpers with schema-validated input, explicit issue codes, and rejection for unsupported cited claims (`scripts/lib/ai-runtime/trend-analyst.ts`)
* [x] T007 \[S2905] Prepare evidence link view-model fields for rationale text, tone, and accessibility labels with safe empty defaults (`src/extensions/trend-finder/view-model.ts`)
* [x] T008 \[S2905] Prepare static Brief evidence-row schema and size limits for bounded rationale projection (`scripts/extensions/trend-finder/static-brief-export.ts`)

***

## Implementation (9 tasks)

Main feature implementation.

* [x] T009 \[S2905] Implement deterministic rationale fallback from relevance score, evidence quality, source role, matched entity, source-local signal, and topic identity (`scripts/lib/ai-runtime/evidence-rationale.ts`)
* [x] T010 \[S2905] Implement analyst rationale validation for known evidence IDs, per-topic citation membership, bounded text, and fabricated metadata rejection (`scripts/lib/ai-runtime/trend-analyst.ts`)
* [x] T011 \[S2905] Merge valid AI rationales with deterministic fallbacks and omit unjustified weak links from topic projection while preserving raw evidence rows (`scripts/extensions/trend-finder/collector.ts`)
* [x] T012 \[S2905] Add deterministic fallback rationale assignment for frequency and similarity fallback topics with safe omission behavior (`scripts/extensions/trend-finder/topics.ts`)
* [x] T013 \[S2905] Project rationale fields through joined evidence links with sanitized display text and safe missing-evidence handling (`src/extensions/trend-finder/view-model.ts`)
* [x] T014 \[S2905] Render rationale copy in Evidence to verify cards with platform-appropriate accessibility labels, stable layout, and no layout shift (`src/extensions/trend-finder/components/evidence-links.tsx`)
* [x] T015 \[S2905] Project rationale into static Brief evidence rows using bounded text, safe public URL filtering, and private/raw field exclusion (`scripts/extensions/trend-finder/static-brief-export.ts`)
* [x] T016 \[S2905] Render escaped rationale markup in static Brief evidence cards without exposing raw analyst output or private paths (`scripts/extensions/trend-finder/static-brief-renderer.ts`)
* [x] T017 \[S2905] Update payload reporting and fixtures for AI rationale, fallback rationale, and omitted weak evidence examples (`src/extensions/trend-finder/fixtures.ts`)

***

## Testing (5 tasks)

Verification and quality assurance.

* [x] T018 \[S2905] \[P] Add evidence-rationale helper tests for fallback generation, weak-link omission, bounded text, and grounding behavior (`scripts/lib/ai-runtime/__tests__/evidence-rationale.test.ts`)
* [x] T019 \[S2905] \[P] Add analyst validator tests for accepted grounded rationale, unknown evidence rationale, fabricated metadata, and fallback-required paths (`scripts/lib/ai-runtime/__tests__/trend-analyst.test.ts`)
* [x] T020 \[S2905] \[P] Add collector, schema, view-model, and component tests for projection preservation, legacy defaults, labels, accessibility text, and missing rationale behavior (`src/extensions/trend-finder/__tests__/view-model.test.ts`)
* [x] T021 \[S2905] \[P] Add static Brief export and renderer tests proving rationale output is escaped and excludes raw source dumps, private paths, prompts, provider responses, and credentials (`scripts/extensions/trend-finder/__tests__/static-brief-export.test.ts`)
* [x] T022 \[S2905] Run focused Vitest suites, payload-size check, type checks as needed, and ASCII validation for session files (`package.json`)

***

## 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 to verify session completeness.


---

# 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/phase29-session05-per-evidence-rationale/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.
