> 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/phase03-session03-subagent-lineage-and-mission-graph-runtime/tasks.md).

# Task Checklist

**Session ID**: `phase03-session03-subagent-lineage-and-mission-graph-runtime` **Total Tasks**: 24 **Estimated Duration**: 3-4 hours **Created**: 2026-05-29

***

## 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          | 3      | 3      | 0         |
| Foundation     | 6      | 6      | 0         |
| Implementation | 10     | 10     | 0         |
| Testing        | 5      | 5      | 0         |
| **Total**      | **24** | **24** | **0**     |

***

## Setup (3 tasks)

Initial configuration and environment preparation.

* [x] T001 \[S0303] Verify Session 03 prerequisites, completed Session 01/02 dependencies, and current opaque subagent baseline (`.spec_system/PRD/phase_03/orchestration_gap_matrix.md`)
* [x] T002 \[S0303] Create implementation notes and security artifact placeholders (`.spec_system/specs/phase03-session03-subagent-lineage-and-mission-graph-runtime/implementation-notes.md`)
* [x] T003 \[S0303] Confirm cross-package entry points and focused validation commands (`package.json`)

***

## Foundation (6 tasks)

Core structures and base implementations.

### packages/protocol

* [x] T004 \[S0303] \[P] Create subagent lineage domain contracts with bounded IDs, degraded states, graph snapshots, and exhaustive status vocabulary (`packages/protocol/src/lineage.ts`)
* [x] T005 \[S0303] Add optional parent mission and subagent lineage references to mission contracts without breaking existing mission payloads (`packages/protocol/src/missions.ts`)
* [x] T006 \[S0303] Promote subagent spawn and completion ingest payload contracts with bounded metadata and opaque fallback compatibility (`packages/protocol/src/ingest.ts`)
* [x] T007 \[S0303] Add compact lineage and mission graph WebSocket frames without raw prompt, path, command, token, or transcript fields (`packages/protocol/src/events.ts`)

### apps/server

* [x] T008 \[S0303] \[P] Create bounded mission graph manager with deterministic ordering, duplicate event handling, and degraded missing-ID state (`apps/server/src/managers/missionGraph.ts`)

### apps/hooks

* [x] T009 \[S0303] Harden subagent ID detection and truncation with malformed transcript-path fallback and no transcript path exposure (`apps/hooks/src/_lib.js`)

***

## Implementation (10 tasks)

Main feature implementation.

### packages/protocol

* [x] T010 \[S0303] Export lineage contracts from the protocol package root (`packages/protocol/src/index.ts`)

### apps/hooks

* [x] T011 \[S0303] Update subagent spawn payload shaping with bounded parent lineage metadata and malformed-ID fallback (`apps/hooks/src/factionos-subagent-spawn.js`)
* [x] T012 \[S0303] Update subagent completion payload shaping with bounded completion metadata and missing-ID degraded behavior (`apps/hooks/src/factionos-subagent-complete.js`)

### apps/server

* [x] T013 \[S0303] Update event ingest normalization for first-class subagent spawn and completion with schema-validated input and explicit error mapping (`apps/server/src/lib/eventIngest.ts`)
* [x] T014 \[S0303] Wire typed lineage handling into the event route with missing hero, missing mission, and opaque fallback paths (`apps/server/src/routes/event.ts`)
* [x] T015 \[S0303] Instantiate and pass the mission graph manager through server composition without changing auth, CORS, Origin, rate-limit, or body-size defaults (`apps/server/src/server.ts`)
* [x] T016 \[S0303] Add mission manager parent-child relationship helpers with duplicate link prevention and deterministic child ordering (`apps/server/src/managers/missionManager.ts`)
* [x] T017 \[S0303] Preserve archive, export, replay, and diagnostic redaction for lineage fields and nested graph payloads (`apps/server/src/lib/sessionPrivacy.ts`)
* [x] T018 \[S0303] Include safe lineage fields in session export output with redacted local-only values and deterministic columns (`apps/server/src/lib/exportSession.ts`)

### docs/api

* [x] T019 \[S0303] Update source-backed API and hook docs for typed lineage behavior, opaque compatibility, and deferred control boundaries (`docs/api/event-api-hook-contracts.md`)

***

## Testing (5 tasks)

Verification and quality assurance.

### packages/protocol

* [x] T020 \[S0303] \[P] Write protocol lineage contract tests for states, degraded reasons, graph snapshots, mission fields, and WebSocket discriminants (`packages/protocol/tests/lineage.test.ts`)

### apps/hooks

* [x] T021 \[S0303] \[P] Write hook payload tests for typed lineage fields, absent transcript paths, malformed transcript paths, and safe bounds (`apps/hooks/tests/hookPayloads.test.js`)

### apps/server

* [x] T022 \[S0303] \[P] Write server ingest tests for lineage spawn, completion, missing IDs, malformed IDs, oversized metadata, duplicate IDs, and fallback behavior (`apps/server/tests/eventIngest.test.ts`)
* [x] T023 \[S0303] \[P] Write export and privacy tests for lineage fields and transcript/path redaction (`apps/server/tests/exportSession.test.ts`)

### session

* [x] T024 \[S0303] Run focused protocol, hooks, server, ASCII/LF, and patch hygiene checks and record results (`.spec_system/specs/phase03-session03-subagent-lineage-and-mission-graph-runtime/implementation-notes.md`)

***

## 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] security-compliance.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://faction-os.gitbook.io/faction-os-docs/.spec_system/archive/sessions/phase03-session03-subagent-lineage-and-mission-graph-runtime/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.
