> 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/phases/phase_20/session_10_templates_and_channel_intake.md).

# Session 10: Templates And Channel Intake

**Session ID**: `phase20-session10-templates-and-channel-intake` **Packages**: `packages/protocol`, `apps/server`, `apps/web` **Status**: Not Started **Estimated Tasks**: \~12-25 **Estimated Duration**: 2-4 hours

***

## Objective

Let templates and inbound channels create reviewable executable local tasks without automatically executing untrusted input.

***

## Scope

### In Scope (MVP)

* Add template executable defaults only for known local executors with bounded inputs.
* Keep webhook and remote channel content proposal-first by default.
* Allow channel conversion to executable queue tasks only after local operator approval.
* Let guarded channel proposals reference executable payloads, with execution still flowing through the coordinator and capability checks.
* Split UI labels among record inbound command, create review task, create executable local task, and execute.
* Preserve idempotent replay without re-execution.

### Out of Scope

* Automatic execution of remote or untrusted inbound content.
* Hosted channel trust, GitHub signature verification, or production identity claims unless separately scoped.

***

## Prerequisites

* [ ] Relevant executor slices completed for every payload family exposed.
* [ ] Template/channel executable-task acceptance tests defined before implementation starts.

***

## Deliverables

1. Template, channel intake, guarded proposal, UI, and test updates that converge on the executable task contract.
2. Idempotent replay and proposal-first behavior for inbound commands.

***

## Success Criteria

* [ ] Webhook conversion cannot execute on arrival.
* [ ] Channel-to-queue executable payload remains queued until an operator dispatches it.
* [ ] Template preview -> create -> dispatch preserves executable defaults and produces a real execution result.
* [ ] Invalid or unsafe payloads become proposal or attention state, not runnable tasks.
* [ ] Duplicate delivery returns prior records without re-execution.

***

## Folded Source Detail

### User Outcome

Templates and inbound channels can create reviewable executable local tasks, but they never execute remote or untrusted input automatically.

### Current Source Map

* Channel intake: `apps/server/src/managers/channelCommandManager.ts` and `apps/server/src/routes/channelCommands.ts` are proposal-first and can convert to record, queue, attention, or guarded proposal.
* Channel and webhook input must not become trusted remote execution; local executable tasks require local operator approval and capability checks.
* Template executable defaults are allowed only for known local executors with bounded inputs.

### Required Changes

* Template queue preview can include an executable payload only when the template declares a known local executor and bounded inputs.
* Channel intake with `conversion: "queue"` may create an executable task only when the payload is locally authored or explicitly operator-approved.
* Webhook content stays proposal-first by default.
* Channel guarded proposals may reference executable payloads, but approval must go through the same coordinator and capability checks.
* UI must separate `Record inbound command`, `Create review task`, `Create executable local task`, and `Execute`, only after local approval and capability readiness.
* Preserve idempotent replay without re-execution.

### Recovery Paths

* Invalid or unsafe executable payload becomes attention/proposal state, not a runnable queue entry.
* Duplicate delivery replays prior record without re-execution.
* Operator can edit or reject the generated executable payload before dispatch.

### Acceptance Tests From Findings

* Channel route test proves webhook conversion cannot execute on arrival.
* Channel-to-queue test proves executable payload stays queued until operator dispatch.
* Template test proves executable defaults survive preview -> create -> dispatch.
* Web tests prove labels and disabled states are truthful.
* Duplicate delivery returns prior records without re-execution.


---

# 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/phases/phase_20/session_10_templates_and_channel_intake.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.
