> For the complete documentation index, see [llms.txt](https://faction-os.gitbook.io/faction-os-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://faction-os.gitbook.io/faction-os-docs/.spec_system/archive/sessions/phase19-session11-templates-and-planning-context/tasks.md).

# Task Checklist

**Session ID**: `phase19-session11-templates-and-planning-context` **Total Tasks**: 22 **Estimated Duration**: 3-4 hours **Created**: 2026-06-26

***

Legend: `[x]` completed; `[ ]` pending; `[P]` parallelizable; `[SNNMM]` session ref; `TNNN` task ID.

***

## Setup (2 tasks)

* [x] T001 \[S1911] Verify Session 11 prerequisites, source scope, and completed Phase 19 dependency artifacts (`.spec_system/PRD/phase_19/session_11_templates_and_planning_context.md`)
* [x] T002 \[S1911] Verify current template, queue, campaign, Quest Board, analysis, and memory surfaces before changing contracts (`packages/protocol/src/agentTemplates.ts`, `packages/protocol/src/taskQueue.ts`, `apps/server/src/managers/agentTemplates.ts`, `apps/server/src/managers/taskQueue.ts`, `apps/server/src/managers/planCampaignManager.ts`, `apps/server/src/lib/memoryStore.ts`)

***

## Foundation (6 tasks)

* [x] T003 \[S1911] Extend shared template contracts with bounded detail metadata, prompt preview, category/model/tool-scope/read-only fields, and suggestion rationale with types matching declared contract; exhaustive enum handling (`packages/protocol/src/agentTemplates.ts`)
* [x] T004 \[S1911] Extend queue and command-center source attribution contracts for template-created queue entries, memory records, Quest Board sources, analysis/project-scan items, session follow-ups, and auto-improvement candidates with schema-validated input and explicit error mapping (`packages/protocol/src/taskQueue.ts`, `packages/protocol/src/orchestrationCommandCenter.ts`)
* [x] T005 \[S1911] \[P] Add protocol parser tests for template metadata, queue source references, memory context, and blocked raw planning-context fields (`packages/protocol/tests/orchestration.test.ts`)
* [x] T006 \[S1911] Create server planning-context helpers for safe source links, memory include/exclude filters, template suggestion inputs, queue preview payloads, and auto-improvement candidates with authorization-safe local boundaries (`apps/server/src/lib/templatePlanningContext.ts`)
* [x] T007 \[S1911] Expand built-in local templates and scoring with descriptions, model labels, categories, workflow instructions, constraints, prompt previews, read-only/tool-scope badges, source-aware suggestions, and deterministic ordering (`apps/server/src/managers/agentTemplates.ts`)
* [x] T008 \[S1911] Preserve source attribution through task queue create/update/event entries with bounded pagination, validated filters, and deterministic ordering (`apps/server/src/managers/taskQueue.ts`)

***

## Implementation (9 tasks)

* [x] T009 \[S1911] Add route parsers for template suggestions, template detail, queue preview/create, source attribution, and memory filters with schema-validated input and explicit error mapping (`apps/server/src/lib/orchestrationValidation.ts`, `apps/server/src/lib/commandCenterValidation.ts`)
* [x] T010 \[S1911] Wire template detail, suggestion, preview, and queue-from-template routes with duplicate-trigger prevention while in-flight (`apps/server/src/routes/orchestration.ts`)
* [x] T011 \[S1911] Wire suggestion and memory dependencies into orchestration routes without adding hosted transfer or raw transcript exposure (`apps/server/src/server.ts`)
* [x] T012 \[S1911] Carry memory category filters through campaign preview/create/refine and keep preview/create idempotency aligned (`apps/server/src/managers/planCampaignManager.ts`, `apps/server/src/routes/commandCenter.ts`)
* [x] T013 \[S1911] Add failed-work auto-improvement attention proposals with safe target refs and no executor activity (`apps/server/src/managers/orchestrationCommandCenter.ts`, `apps/server/src/lib/templatePlanningContext.ts`)
* [x] T014 \[S1911] Add web API clients for template detail, suggestions, preview, queue-from-template, source attribution, and campaign memory filters with duplicate-trigger prevention while in-flight (`apps/web/src/lib/orchestrationApi.ts`)
* [x] T015 \[S1911] Create web planning-context view models for template cards, source badges, memory freshness/confidence labels, prompt previews, and queue preview summaries (`apps/web/src/lib/templatePlanningContext.ts`, `apps/web/src/lib/orchestrationUi.ts`)
* [x] T016 \[S1911] Reconcile template details, compact template events, source attribution, memory filters, queue preview state, and stale selections in the normalized store (`apps/web/src/store/useGameStore.ts`)
* [x] T017 \[S1911] Create the Template Workbench with searchable templates, details, source links, memory controls, preview/create actions, unsupported spawn metadata, and loading/empty/error/offline states (`apps/web/src/components/orchestration/TemplateWorkbench.tsx`)

***

## UI Wiring (2 tasks)

* [x] T018 \[S1911] Wire Template Workbench and memory controls into the Orchestration campaign/planning area with accessible labels, focus management, and product-facing copy only (`apps/web/src/components/orchestration/CommandCenterPanes.tsx`, `apps/web/src/components/orchestration/CampaignWorkbench.tsx`)
* [x] T019 \[S1911] Show safe template/source/memory context in current-state summaries and drawer details without raw prompts, transcripts, file contents, terminal output, diffs, tokens, or broad paths (`apps/web/src/components/orchestration/OrchestrationCurrentState.tsx`, `apps/web/src/components/orchestration/OrchestrationDrawer.tsx`)

***

## Testing (3 tasks)

* [x] T020 \[S1911] \[P] Add server tests for planning-context helpers, template detail/suggestion routes, queue preview/create idempotency, memory filters, and auto-improvement attention proposals (`apps/server/tests/templatePlanningContext.test.ts`, `apps/server/tests/orchestration.test.ts`, `apps/server/tests/planCampaignManager.test.ts`, `apps/server/tests/commandCenterRoutes.test.ts`)
* [x] T021 \[S1911] \[P] Add web tests for API clients, store normalization, Template Workbench UI states, source badges, memory controls, queue preview/create, malformed payloads, and product-facing copy (`apps/web/tests/orchestrationApi.test.ts`, `apps/web/tests/commandCenterStore.test.ts`, `apps/web/tests/TemplateWorkbench.test.tsx`, `apps/web/tests/OrchestrationPanel.test.tsx`)
* [x] T022 \[S1911] Run focused validation, workspace typecheck, root format check, and ASCII/LF verification (`npm test -- orchestration templatePlanningContext planCampaignManager commandCenterRoutes orchestrationApi commandCenterStore TemplateWorkbench OrchestrationPanel && npm run typecheck --workspaces --if-present && npm run format:check`, `.spec_system/specs/phase19-session11-templates-and-planning-context`)

***

## Completion Checklist

* [x] All tasks marked `[x]`
* [x] All tests and checks passing
* [x] All files ASCII-encoded with LF line endings
* [x] implementation-notes.md updated
* [x] Ready for `creview` to continue the implement -> creview -> validate sequence

***

## Next Steps

Run the `creview` workflow step.


---

# 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://faction-os.gitbook.io/faction-os-docs/.spec_system/archive/sessions/phase19-session11-templates-and-planning-context/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.
