> 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/phase15-session03-aggregate-orchestration-refactor/tasks.md).

# Task Checklist

**Session ID**: `phase15-session03-aggregate-orchestration-refactor` **Total Tasks**: 16 **Estimated Duration**: 3-4 hours **Created**: 2026-05-31

***

## 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     | 4      | 4      | 0         |
| Implementation | 7      | 7      | 0         |
| Testing        | 3      | 3      | 0         |
| **Total**      | **16** | **16** | **0**     |

***

## Setup (2 tasks)

Initial configuration and environment preparation.

* [x] T001 \[S1503] Verify Session 02 prerequisites, generated-data writer exports, and aggregate compatibility expectations (`.spec_system/specs/phase15-session02-live-data-merge-boundary/validation.md`)
* [x] T002 \[S1503] Inventory current aggregate scan, Dream load, extension collector, logger, process guard, and write boundaries (`scripts/aggregate.ts`)

***

## Foundation (4 tasks)

Core structures and base implementations.

* [x] T003 \[S1503] \[P] Create aggregate orchestration types, mode names, dependency injection points, and summary contracts (`scripts/lib/aggregate-orchestration.ts`)
* [x] T004 \[S1503] Extract warning normalization, string-warning conversion, extension warning collection, and dedupe helpers without changing warning output (`scripts/lib/aggregate-orchestration.ts`)
* [x] T005 \[S1503] Extract host/local scan context assembly including Codex, Claude, memory, Dream, Hermes, OpenClaw, skills, automations, apps, env-key detection, and integrations with cleanup on scope exit for acquired resources (`scripts/lib/aggregate-orchestration.ts`)
* [x] T006 \[S1503] Extract extension orchestration wrapper using existing runner, enablement parsing, trace logging, and backtest summary preservation with timeout, warning, and failure-path handling (`scripts/lib/aggregate-orchestration.ts`)

***

## Implementation (7 tasks)

Main feature implementation.

* [x] T007 \[S1503] Implement full compatibility orchestration that assembles sanitized `LiveData` and writes with `scope: "full"` without changing `bun run aggregate` behavior (`scripts/lib/aggregate-orchestration.ts`)
* [x] T008 \[S1503] Implement host/local orchestration mode that skips Trend Finder collector execution while preserving Dream projection and local-agent assembly with explicit loading, empty, error, and offline states (`scripts/lib/aggregate-orchestration.ts`)
* [x] T009 \[S1503] Implement separable extension orchestration return path for future Trend Finder scoped writes with schema-validated input and explicit error mapping (`scripts/lib/aggregate-orchestration.ts`)
* [x] T010 \[S1503] Update `runAggregate` to delegate to full orchestration while preserving console output, run logger fields, process guard cleanup, summary shape, and exit behavior (`scripts/aggregate.ts`)
* [x] T011 \[S1503] Update aggregate scheduler handler imports or return-type assumptions after the orchestration extraction without changing scheduler run-state semantics (`scripts/lib/scheduler/aggregate-handler.ts`)
* [x] T012 \[S1503] Update scheduled aggregate runbook to describe reusable orchestration and explicitly keep scoped scheduler jobs deferred (`docs/runbooks/scheduled-aggregate.md`)
* [x] T013 \[S1503] Verify aggregate write helper exports are sufficient for full, host/local, and future Trend Finder scoped modes without adding duplicate write paths (`scripts/lib/aggregate-live-data-write.ts`)

***

## Testing (3 tasks)

Verification and quality assurance.

* [x] T014 \[S1503] \[P] Add focused unit tests for full compatibility orchestration, warning stability, write scope selection, and process cleanup (`scripts/lib/__tests__/aggregate-orchestration.test.ts`)
* [x] T015 \[S1503] \[P] Add focused unit tests proving host/local mode does not execute Trend Finder collectors and extension orchestration remains independently callable (`scripts/lib/__tests__/aggregate-orchestration.test.ts`)
* [x] T016 \[S1503] Run focused aggregate, scheduler handler, extension runner, script typecheck, `git diff --check`, and ASCII artifact validation (`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 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/phase15-session03-aggregate-orchestration-refactor/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.
