> 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/phase27-session06-lifecycle-stage-taxonomy/spec.md).

# Session Specification

**Session ID**: `phase27-session06-lifecycle-stage-taxonomy` **Phase**: 27 - Trend Finder Alpha Radar Adoption **Status**: Not Started **Created**: 2026-06-13

***

## 1. Session Overview

This session adds Trend Finder's first absolute topic maturity label. Current movement labels are relative to score deltas, so a brand-new spike and a long-running crowded topic can both appear as "steady". The new lifecycle classifier gives each topic a deterministic stage derived from existing Phase 27 signals: saturation, role share, velocity dynamics, recurrence, and current movement context.

The work stays additive and deterministic. It creates a script-owned lifecycle helper, publishes a bounded schema field with explicit unknown fallback, and wires the stage into trend cards, Signal Workbench, and Signal Radar coloring. The classifier must never ask the analyst to invent stages and must never guess maturity when history or source-role inputs are insufficient.

This session unlocks Session 07 and Session 08. Convergence visuals need stage context beside their timeline, and dated predictions need `lifecycle_at_filing` and target lifecycle semantics. The contract created here must therefore be stable, browser-safe, and explicit about derivation notes.

***

## 2. Objectives

1. Add a deterministic lifecycle classifier helper with documented thresholds for `unknown`, `whisper`, `builder`, `creator`, and `saturated` stages.
2. Publish an additive lifecycle schema branch with stage, confidence, derivation inputs, and a short provenance note.
3. Render lifecycle chips on trend cards and a lifecycle column/filter in the Signal Workbench with deterministic sorting and tie-breakers.
4. Recolor Signal Radar topics by lifecycle stage and add a compact stage legend while preserving fallback and reduced-motion behavior.

***

## 3. Prerequisites

### Required Sessions

* [x] `phase27-session02-deterministic-derived-signals-and-risk-flags` - provides saturation, role share, builder signal, and risk flag patterns.
* [x] `phase27-session03-data-driven-radar-aliases-and-watching-state` - provides data-driven radar projection, Workbench filters, and watching state patterns.
* [x] `phase27-session04-daily-time-series-persistence-and-sparklines` - provides recurring historical context and daily series used by later lifecycle consumers.
* [x] `phase27-session05-velocity-dynamics-upgrade` - provides acceleration, significance, and burst context consumed by lifecycle rules.

### Required Tools/Knowledge

* Bun 1.3.14 for scripts and test execution.
* TypeScript, Zod, React 19, Tailwind CSS 4, and existing Trend Finder component conventions.
* Current scoring and derived-signal flow in `scripts/lib/ai-runtime/scoring.ts`, `scripts/lib/ai-runtime/source-breakdown.ts`, and `scripts/lib/ai-runtime/velocity-dynamics.ts`.
* Current schema, view-model, Signal Workbench, and Signal Radar patterns under `src/extensions/trend-finder/`.

### Environment Requirements

* Repository rooted at `/home/aiwithapex/projects/aios`.
* Phase 27 session stubs present under `.spec_system/PRD/phase_27/`.
* Existing fixture and unit-test suites runnable with Bun/Vitest.

***

## 4. Scope

### In Scope (MVP)

* Trend Finder runtime classifies each topic into a deterministic lifecycle stage from existing, already-browser-safe or script-safe signals.
* The classifier uses explicit thresholds for saturation, builder/research share, acceleration/significance/burst, recurrence/appearance count, and source diversity.
* Low-history or insufficient-input topics receive `unknown` with a derivation note, never a guessed maturity label.
* Browser payload exposes a bounded lifecycle object with additive defaults, confidence, input summary, and provenance text suitable for UI display.
* Trend cards render lifecycle chips near existing risk and derived-signal context.
* Signal Workbench adds lifecycle row data, a lifecycle filter, lifecycle sort, and stable tie-break ordering.
* Signal Radar colors topic bubbles by lifecycle stage, replacing interim movement coloring while preserving fallback-node distinction.
* A compact radar stage legend is visible and accessible.
* Tests cover classifier boundaries, low-history fallback, legacy payloads, Workbench filtering/sorting, card chips, and radar coloring.

### Out of Scope (Deferred)

* AI-assigned lifecycle labels - Reason: the phase stub requires a deterministic classifier and no analyst-selected stages.
* Lifecycle-targeted predictions - Reason: Session 08 consumes this contract.
* Renaming or changing existing movement statuses - Reason: movement remains the relative score-delta label.
* Convergence timelines or trajectory visuals - Reason: Session 07 owns those surfaces.
* New source adapters, public collection, AI calls, credentials, or third-party transfer paths - Reason: lifecycle derives from existing payload and runtime data.

***

## 5. Technical Approach

### Architecture

Keep the classifier pure and script-owned, then project bounded labels into the browser contract:

* `scripts/lib/ai-runtime/lifecycle.ts` owns lifecycle stage enums, thresholds, derivation input normalization, confidence scoring, and derivation-note construction.
* `scripts/lib/ai-runtime/scoring.ts` calls the helper after saturation, historical context, and velocity dynamics are available, then attaches the lifecycle object to each topic.
* `scripts/extensions/trend-finder/collector.ts` includes lifecycle summary counters in sanitized scoring trace context without exposing private paths or raw archive data.
* `src/extensions/trend-finder/schema.ts` adds stage enums, bounded lifecycle schemas, and defaults so old generated payloads parse as `unknown`.
* `src/extensions/trend-finder/view-model.ts` converts lifecycle objects into chip labels, tones, descriptions, and radar color metadata.
* `src/extensions/trend-finder/components/trend-card.tsx` renders the stage chip with the derivation note available as title and accessible text.
* `src/extensions/trend-finder/signal-workbench-model.ts` adds lifecycle row fields, filter facets, sort support, and search text.
* `src/extensions/trend-finder/components/signal-workbench-controls.tsx` and `src/extensions/trend-finder/components/signal-workbench-table.tsx` expose the filter and column.
* `src/extensions/trend-finder/components/signal-radar.tsx` uses lifecycle tone data for plotted topics and renders a stage legend.

The classifier should prefer explicit unavailable behavior over false precision. Suggested stage semantics:

* `unknown`: insufficient recurrence, saturation, or role/velocity context.
* `whisper`: low saturation, early recurrence, and meaningful velocity or burst from limited but multi-source evidence.
* `builder`: strong developer/research role share with modest saturation and non-negative velocity context.
* `creator`: broader creator/news/discussion mix with growing or significant velocity and moderate saturation.
* `saturated`: high saturation, high recurrence, or crowding even when movement is steady.

Exact numeric thresholds belong in `lifecycle.ts` constants and tests, not inline component code.

### Design Patterns

* Script-only runtime boundary: classification and input normalization stay under `scripts/lib/` and collector code.
* Additive schema defaults: lifecycle defaults to `unknown` for legacy payloads and malformed branches.
* Explicit unavailable states: low history and missing derived inputs are documented as `unknown` with reason text.
* Project before rendering: UI components consume view-model labels and tones, not classifier internals.
* Deterministic ordering: Workbench lifecycle sort uses stage order followed by existing rank, score, name, and ID tie-breakers.
* Behavioral quality by design: filters, chips, and radar points include accessible labels, stable sizing, exhaustive enum handling, and fallback behavior.

### Technology Stack

* TypeScript 6.0.3
* React 19.2.0
* Zod 4.4.3
* Vitest 4.1.6
* Bun 1.3.14

***

## 6. Deliverables

### Files to Create

| File                                                        | Purpose                                                     | Est. Lines |
| ----------------------------------------------------------- | ----------------------------------------------------------- | ---------- |
| `scripts/lib/ai-runtime/lifecycle.ts`                       | Pure lifecycle classifier, thresholds, notes, and defaults. | \~280      |
| `scripts/lib/ai-runtime/__tests__/lifecycle.test.ts`        | Boundary, precedence, fallback, and provenance tests.       | \~260      |
| `src/extensions/trend-finder/components/lifecycle-chip.tsx` | Reusable stage chip and tone mapping for card/table use.    | \~120      |

### Files to Modify

| File                                                                              | Changes                                                                      | Est. Lines |
| --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------- |
| `scripts/lib/ai-runtime/scoring.ts`                                               | Derive lifecycle after saturation and velocity dynamics and attach to topic. | \~140      |
| `scripts/extensions/trend-finder/collector.ts`                                    | Add sanitized lifecycle summary counters to scoring trace context.           | \~50       |
| `src/extensions/trend-finder/schema.ts`                                           | Add lifecycle enums, schema branch, defaults, and topic field.               | \~180      |
| `src/extensions/trend-finder/view-model.ts`                                       | Add lifecycle view models, labels, tones, descriptions, and radar colors.    | \~180      |
| `src/extensions/trend-finder/components/trend-card.tsx`                           | Render lifecycle chip near risk and derived-signal context.                  | \~50       |
| `src/extensions/trend-finder/signal-workbench-model.ts`                           | Add lifecycle fields, facets, filter, sort, and search text.                 | \~180      |
| `src/extensions/trend-finder/components/signal-workbench-controls.tsx`            | Add lifecycle filter select.                                                 | \~40       |
| `src/extensions/trend-finder/components/signal-workbench-table.tsx`               | Add lifecycle column with stable labels.                                     | \~80       |
| `src/extensions/trend-finder/components/signal-radar.tsx`                         | Color points by lifecycle and render compact stage legend.                   | \~150      |
| `src/extensions/trend-finder/fixtures.ts`                                         | Add available and unknown lifecycle states to fixtures.                      | \~120      |
| `src/data/live-data.example.json`                                                 | Add additive lifecycle examples without generated private data.              | \~80       |
| `scripts/lib/ai-runtime/__tests__/scoring.test.ts`                                | Cover scoring integration and legacy topic behavior.                         | \~120      |
| `src/lib/__tests__/trend-finder-schema.test.ts`                                   | Cover lifecycle defaults, bounds, malformed values, and legacy parsing.      | \~120      |
| `src/extensions/trend-finder/__tests__/view-model.test.ts`                        | Cover lifecycle labels, tones, derivation notes, and radar color metadata.   | \~120      |
| `src/extensions/trend-finder/__tests__/signal-workbench-model.test.ts`            | Cover lifecycle filters, sort order, search, and deterministic tie-breakers. | \~120      |
| `src/extensions/trend-finder/__tests__/signal-radar-projection.test.ts`           | Cover radar lifecycle coloring and fallback-node behavior.                   | \~100      |
| `src/extensions/trend-finder/components/__tests__/signal-workbench-view.test.tsx` | Cover visible lifecycle filter/column behavior.                              | \~100      |

***

## 7. Success Criteria

### Functional Requirements

* [ ] Lifecycle stage derives deterministically from existing topic, history, saturation, role-share, and velocity fields.
* [ ] Low-history or insufficient-input topics show `unknown` with a clear reason instead of guessed maturity.
* [ ] Long-running saturated topics and brand-new spikes no longer present the same maturity label.
* [ ] Trend cards show lifecycle chips with derivation notes and accessible labels.
* [ ] Signal Workbench lifecycle filter and sort preserve deterministic tie-break ordering.
* [ ] Signal Radar topic coloring is stage-based, with fallback nodes clearly distinguished from data nodes.
* [ ] Legacy payloads without lifecycle fields still parse and render `unknown`.

### Testing Requirements

* [ ] Unit tests cover classifier thresholds, boundary precedence, low-history fallback, missing saturation, missing role share, and missing velocity dynamics.
* [ ] Scoring tests cover lifecycle integration for representative whisper, builder, creator, saturated, and unknown topics.
* [ ] Schema tests cover additive defaults, malformed branches, enum bounds, and legacy payload compatibility.
* [ ] Workbench tests cover lifecycle row projection, filter facets, sorting, search text, and deterministic tie-breakers.
* [ ] Component and radar tests cover chip rendering, legend copy, stage-based colors, and fallback-node behavior.

### Non-Functional Requirements

* [ ] Browser payload stays within the shared 1 MB extension payload limit.
* [ ] No new public source collection path, credential, AI call, or third-party transfer path is introduced.
* [ ] Private snapshot archives and paths remain out of browser payloads, traces, UI, static exports, and logs.
* [ ] Dense Trend Finder layouts keep at least one actionable trend visible above the fold and avoid horizontal overflow on mobile.
* [ ] Reduced-motion and explicit fallback behavior remain intact for radar and chip surfaces.

### Quality Gates

* [ ] All files ASCII-encoded.
* [ ] Unix LF line endings.
* [ ] Code follows project conventions.
* [ ] Relevant TypeScript and Vitest checks pass.

***

## 8. Implementation Notes

### Key Considerations

* Use Trend Finder language: `whisper`, `builder`, `creator`, `saturated`, and `unknown`. Do not inherit Alpha Radar's `hype` label unless a later PRD deliberately renames the stage.
* Keep movement as a relative delta label. Lifecycle is an absolute maturity label and should not replace `movementStatus`.
* Derivation notes must be short, browser-safe, and based only on published fields or sanitized runtime context.
* Stage thresholds should be constants exported from the helper and covered by tests so downstream prediction work can trust them.

### Potential Challenges

* Threshold disputes: Keep the first classifier conservative, documented, and deterministic, with tests showing why boundary cases land where they do.
* UI color conflicts: Use stage tones in radar only and keep risk/movement chips visually distinct so operators can scan both concepts.
* Legacy payload drift: Add schema defaults and fixture coverage before UI reads the lifecycle field.
* Payload growth: Publish a compact lifecycle object and short derivation note, not raw input dumps.

### Relevant Considerations

* \[P02] **Extension payloads and demo labels stay bounded**: Lifecycle output must be compact and fit the shared 1 MB extension payload limit.
* \[P05] **Script-only runtime boundary**: Classification belongs under `scripts/lib/ai-runtime/`, not browser component code.
* \[P24] **Project before rendering**: Lifecycle UI should consume dedicated view-model labels and tones.
* \[P24] **Additive defaults keep legacy payloads alive**: Missing lifecycle data must parse as `unknown`.
* \[P24] **Deterministic ordering helps dense triage**: Workbench lifecycle sort and filters need stable tie-breakers.

### Behavioral Quality Focus

Checklist active: Yes

Top behavioral risks for this session:

* Low-history topics could look falsely mature if fallback logic guesses a stage instead of returning `unknown`.
* Radar recoloring could hide fallback nodes or make movement and lifecycle concepts indistinguishable.
* Workbench filters and sorts could reorder ties nondeterministically or drop legacy topics without lifecycle fields.

***

## 9. Testing Strategy

### Unit Tests

* Test `lifecycle.ts` classifier boundaries with hand-computed inputs for all stages.
* Test scoring integration with realistic topic objects and historical context.
* Test schema defaults, malformed values, and legacy payload parsing.

### Integration Tests

* Test Signal Workbench row projection, lifecycle filter facets, lifecycle sorting, and search text.
* Test radar projection and rendering inputs so lifecycle colors are used only for data points while fallback nodes remain distinct.
* Test card/table chip rendering through existing component test patterns.

### Manual Testing

* Generate or load a representative Trend Finder fixture and verify that cards, Workbench, and Signal Radar show the same lifecycle stage for the same topic.
* Check desktop and mobile Trend Finder layouts for visible trend value, readable stage chips, no horizontal overflow, and preserved trust signals.
* Verify reduced-motion mode does not obscure lifecycle legend or radar interpretation.

### Edge Cases

* Missing saturation but available novelty and velocity.
* Missing role shares and builder signal.
* Low recurrence or first-seen topics with high burst.
* High saturation with flat movement.
* Legacy payloads without lifecycle fields.
* Malformed lifecycle branch in generated data.

***

## 10. Dependencies

### External Libraries

* No new external libraries.

### Other Sessions

* **Depends on**: `phase27-session02-deterministic-derived-signals-and-risk-flags`, `phase27-session03-data-driven-radar-aliases-and-watching-state`, `phase27-session04-daily-time-series-persistence-and-sparklines`, `phase27-session05-velocity-dynamics-upgrade`
* **Depended by**: `phase27-session07-convergence-detection-and-trajectory-visuals`, `phase27-session08-dated-predictions-and-story-log`, `phase27-session12-documentation-validation-and-release`

***

## Next Steps

Run the implement workflow step to begin AI-led implementation.


---

# 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/phase27-session06-lifecycle-stage-taxonomy/spec.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.
