> 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-session09-heroes-and-lineage/validation.md).

# Validation Report

**Session ID**: `phase19-session09-heroes-and-lineage` **Package**: cross-cutting (`Package: null`) **Validated**: 2026-06-26 **Result**: PASS

## Validation Summary

| Check                     | Status | Notes                                                                                                                               |
| ------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------- |
| Code Review               | PASS   | `code-review.md` has `Result: RESOLVED` and scope `All uncommitted changes in the working tree`.                                    |
| Tasks Complete            | PASS   | 25/25 tasks complete.                                                                                                               |
| Files Exist               | PASS   | 33/33 declared deliverables exist and are non-empty.                                                                                |
| ASCII Encoding            | PASS   | 44 changed files passed ASCII/LF before report generation; generated validation artifacts were rechecked after writing.             |
| Tests Passing             | PASS   | `npm test` under Node `v26.2.0`: 235 files passed, 1 skipped; 2833 tests passed, 1 skipped.                                         |
| Database/Schema Alignment | N/A    | No DB layer is configured and no schema/migration files changed.                                                                    |
| Quality Gates             | PASS   | Format, lint, typecheck, tests, and whitespace checks passed.                                                                       |
| Conventions               | PASS   | npm workspace commands, Biome, TypeScript checks, Vitest, bounded local-first behavior, and docs conventions were spot-checked.     |
| Security & GDPR           | PASS   | Security PASS; GDPR N/A. See `security-compliance.md`.                                                                              |
| Behavioral Quality        | PASS   | Targeted inspection found validated trust boundaries, idempotency, stale revision handling, failure states, and contract alignment. |
| UI Product Surface        | PASS   | Hero/Lineage UI has product-facing copy, accessible controls, and no debug/status scaffolding in the primary surface.               |

**Overall**: PASS

## Evidence Ledger

Every row names the exact command or targeted inspection used.

| Check              | Command or Inspection                                                                                                                                                                                                                                                             | Result                                                                                                             | Evidence / Blocker                                                                                                                                                                                  |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Project state      | `if [ -d ".spec_system/scripts" ]; then bash .spec_system/scripts/analyze-project.sh --json; else bash /home/aiwithapex/.codex/plugins/cache/apex-spec-system/apex-spec/2.1.3-codex/skills/apex-spec/scripts/analyze-project.sh --json; fi`                                       | PASS                                                                                                               | Current session `phase19-session09-heroes-and-lineage`; monorepo true; `Package: null`; session directory exists.                                                                                   |
| Package runtime    | `. "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && node -v && npm -v`                                                                                                                                                                                                         | PASS                                                                                                               | Node `v26.2.0`; npm `11.16.0`.                                                                                                                                                                      |
| Code review        | \`rg -n '\*\*Result\*\*: RESOLVED                                                                                                                                                                                                                                                 | \*\*Scope\*\*: All uncommitted changes' .spec\_system/specs/phase19-session09-heroes-and-lineage/code-review\.md\` | PASS                                                                                                                                                                                                |
| Task completion    | \`grep -E '^- \[\[ x]] T\[0-9]{3}' .../tasks.md                                                                                                                                                                                                                                   | wc -l`;` grep -E '^- \[x] T\[0-9]{3}' .../tasks.md                                                                 | wc -l\`                                                                                                                                                                                             |
| Deliverables       | Bash deliverable existence loop over all files declared in `spec.md` deliverables                                                                                                                                                                                                 | PASS                                                                                                               | 33/33 declared deliverables exist and are non-empty.                                                                                                                                                |
| ASCII/LF           | Changed-file script using `file`, `LC_ALL=C grep -n '[^[:print:][:space:]]'`, and `grep -l $'\r'`                                                                                                                                                                                 | PASS                                                                                                               | 44 changed files passed ASCII and LF checks before report generation.                                                                                                                               |
| Format             | `. "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm run format:check`                                                                                                                                                                                                      | PASS                                                                                                               | Biome checked 694 files; no fixes applied.                                                                                                                                                          |
| Lint               | `. "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm run lint`                                                                                                                                                                                                              | PASS                                                                                                               | Biome checked 696 files; no fixes applied.                                                                                                                                                          |
| Typecheck          | `. "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm run typecheck`                                                                                                                                                                                                         | PASS                                                                                                               | Workspace typechecks passed for adapters, server, warroom, web, protocol, and public website.                                                                                                       |
| Tests              | `. "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm test`                                                                                                                                                                                                                  | PASS                                                                                                               | 235 test files passed, 1 skipped; 2833 tests passed, 1 skipped.                                                                                                                                     |
| Whitespace         | `git diff --check`                                                                                                                                                                                                                                                                | PASS                                                                                                               | Exited 0 with no whitespace errors.                                                                                                                                                                 |
| Database/schema    | \`git diff --name-only HEAD                                                                                                                                                                                                                                                       | rg -n '(migration                                                                                                  | migrations                                                                                                                                                                                          |
| Success criteria   | \`rg -n "lifecycle                                                                                                                                                                                                                                                                | lineage                                                                                                            | roster                                                                                                                                                                                              |
| Conventions        | `.spec_system/CONVENTIONS.md` inspection plus `npm run format:check`, `npm run lint`, `npm run typecheck`, `npm test`                                                                                                                                                             | PASS                                                                                                               | npm workspace, Biome, TypeScript, Vitest, and local-first no-unsafe-execution conventions were followed.                                                                                            |
| Security/GDPR      | `npm run security:secrets`; dependency manifest diff command; targeted sensitive-pattern search                                                                                                                                                                                   | PASS/N/A                                                                                                           | Secret scan passed; no dependency manifest or lockfile changes; no hardcoded secrets or unsafe exposure found. GDPR N/A.                                                                            |
| Behavioral quality | Targeted inspection of `apps/server/src/managers/heroLifecycleManager.ts`, `apps/server/src/lib/commandCenterValidation.ts`, `apps/server/src/managers/missionGraph.ts`, `apps/web/src/lib/orchestrationApi.ts`, `apps/web/src/components/orchestration/HeroLineageWorkbench.tsx` | PASS                                                                                                               | Inputs validated through protocol parsers; lifecycle commands use idempotency and stale revision checks; roster text is bounded/redacted; web failures and duplicate in-flight states are explicit. |
| UI product surface | \`rg -n -i "debug                                                                                                                                                                                                                                                                 | diagnostic                                                                                                         | telemetry                                                                                                                                                                                           |

## 1. Code Review Gate

### Status: PASS

**Report**: `code-review.md` **Result**: RESOLVED **Issues**: None. Code review recorded 0 critical, 1 high, 2 medium, and 2 low findings; all fixed.

## 2. Task Completion

### Status: PASS

**Tasks**: 25/25 complete **Incomplete tasks**: None

## 3. Deliverables Verification

### Status: PASS

| File                                                             | Found | Status |
| ---------------------------------------------------------------- | ----- | ------ |
| `apps/server/src/managers/heroLifecycleManager.ts`               | Yes   | PASS   |
| `apps/server/tests/heroLifecycleManager.test.ts`                 | Yes   | PASS   |
| `apps/web/src/components/orchestration/HeroLineageWorkbench.tsx` | Yes   | PASS   |
| `apps/web/tests/HeroLineageWorkbench.test.tsx`                   | Yes   | PASS   |
| `packages/protocol/src/orchestrationCommandCenter.ts`            | Yes   | PASS   |
| `packages/protocol/src/lineage.ts`                               | Yes   | PASS   |
| `packages/protocol/src/guardedActions.ts`                        | Yes   | PASS   |
| `packages/protocol/tests/orchestrationCommandCenter.test.ts`     | Yes   | PASS   |
| `packages/protocol/tests/lineage.test.ts`                        | Yes   | PASS   |
| `packages/protocol/tests/guardedActions.test.ts`                 | Yes   | PASS   |
| `apps/server/src/managers/orchestrationCommandCenter.ts`         | Yes   | PASS   |
| `apps/server/src/managers/missionGraph.ts`                       | Yes   | PASS   |
| `apps/server/src/managers/executorRegistry.ts`                   | Yes   | PASS   |
| `apps/server/src/lib/commandCenterValidation.ts`                 | Yes   | PASS   |
| `apps/server/src/routes/commandCenter.ts`                        | Yes   | PASS   |
| `apps/server/src/routes/event.ts`                                | Yes   | PASS   |
| `apps/server/src/server.ts`                                      | Yes   | PASS   |
| `apps/hooks/src/factionos-hero-spawn.js`                         | Yes   | PASS   |
| `apps/hooks/src/factionos-subagent-start.js`                     | Yes   | PASS   |
| `apps/hooks/tests/hookRuntime.test.js`                           | Yes   | PASS   |
| `apps/web/src/lib/orchestrationApi.ts`                           | Yes   | PASS   |
| `apps/web/src/lib/commandCenterUi.ts`                            | Yes   | PASS   |
| `apps/web/src/components/orchestration/CommandCenterPanes.tsx`   | Yes   | PASS   |
| `apps/web/src/components/orchestration/OrchestrationShell.tsx`   | Yes   | PASS   |
| `apps/web/src/store/useGameStore.ts`                             | Yes   | PASS   |
| `apps/server/tests/commandCenterRoutes.test.ts`                  | Yes   | PASS   |
| `apps/web/tests/OrchestrationPanel.test.tsx`                     | Yes   | PASS   |
| `apps/web/tests/commandCenterStore.test.ts`                      | Yes   | PASS   |
| `docs/api/README_api.md`                                         | Yes   | PASS   |
| `docs/api/event-api-hook-contracts.md`                           | Yes   | PASS   |
| `apps/server/README_server.md`                                   | Yes   | PASS   |
| `apps/web/README_web.md`                                         | Yes   | PASS   |
| `apps/hooks/README_hooks.md`                                     | Yes   | PASS   |

**Missing deliverables**: None

## 4. ASCII Encoding Check

### Status: PASS

| File Set                                                                      | Encoding              | Line Endings | Status |
| ----------------------------------------------------------------------------- | --------------------- | ------------ | ------ |
| 44 changed files before report generation                                     | ASCII-compatible text | LF           | PASS   |
| Generated `security-compliance.md`, `validation.md`, and updated `state.json` | ASCII-compatible text | LF           | PASS   |

**Encoding issues**: None

## 5. Test Results

### Status: PASS

| Metric      | Value                       |
| ----------- | --------------------------- |
| Total Tests | 2834                        |
| Passed      | 2833                        |
| Failed      | 0                           |
| Skipped     | 1                           |
| Test Files  | 235 passed, 1 skipped       |
| Coverage    | Not collected by `npm test` |

**Failed tests**: None

## 6. Database/Schema Alignment

### Status: N/A

**Evidence**: `.spec_system/CONVENTIONS.md` lists Database as `not configured`. `git diff --name-only HEAD | rg -n '(migration|migrations|schema|prisma|drizzle|typeorm|sequelize|knex|sql|database|db)' || true` returned no changed schema or migration files.

**Issues found**: None

## 7. Success Criteria

From `spec.md`:

**Functional requirements**:

* [x] Lifecycle commands validate supported intent kinds, hero references, expected revisions, idempotency keys, and bounded metadata. Evidence: `apps/server/src/lib/commandCenterValidation.ts`, `apps/server/src/managers/heroLifecycleManager.ts`, `apps/server/tests/heroLifecycleManager.test.ts`, `apps/server/tests/commandCenterValidation.test.ts`.
* [x] Unsupported lifecycle commands return unavailable or approved-not-executing explanations without running unsafe executors. Evidence: `apps/server/src/managers/heroLifecycleManager.ts`, `apps/server/src/managers/executorRegistry.ts`, `apps/server/tests/executorRegistry.test.ts`.
* [x] Hero lifecycle rows show provider/model/permission/worktree/process/terminal/listener/event metadata where safe metadata exists. Evidence: protocol contract tests, event ingest tests, hook runtime tests, and `HeroLineageWorkbench` component tests.
* [x] Lineage roster rows show parent hero, child mission, subagent type, bounded description, active/completed state, duration, result, and degraded reason. Evidence: `apps/server/src/managers/missionGraph.ts`, `packages/protocol/tests/lineage.test.ts`, `apps/server/tests/missionGraph.test.ts`.
* [x] Roster filters by parent hero, state, and subagent type are deterministic and bounded. Evidence: `parseLineageRosterQuery`, `MissionGraphManager.roster()`, route tests, and component tests.

**Testing requirements**:

* [x] Protocol tests cover lifecycle intent vocabulary, compatibility aliases, lifecycle metadata parsing, and lineage roster contracts. Evidence: `packages/protocol/tests/orchestrationCommandCenter.test.ts`, `packages/protocol/tests/lineage.test.ts`.
* [x] Server tests cover lifecycle validation, state transitions, stale revisions, duplicate triggers, malformed lineage events, duplicate lineage events, route errors, and WebSocket updates. Evidence: `apps/server/tests/heroLifecycleManager.test.ts`, `apps/server/tests/commandCenterRoutes.test.ts`, `apps/server/tests/eventIngest.test.ts`.
* [x] Hook tests cover bounded lifecycle and subagent association payloads without prompts, transcripts, or broad paths. Evidence: `apps/hooks/tests/hookRuntime.test.js`.
* [x] Web tests cover loading, empty, error, offline, filtered, degraded, unavailable, active, completed, and duplicate-trigger states. Evidence: `apps/web/tests/HeroLineageWorkbench.test.tsx`, `apps/web/tests/OrchestrationPanel.test.tsx`, `apps/web/tests/commandCenterStore.test.ts`.

**Quality gates**:

* [x] All files ASCII-encoded. Evidence: changed-file ASCII/LF script.
* [x] Unix LF line endings. Evidence: changed-file ASCII/LF script.
* [x] Code follows project conventions. Evidence: format, lint, typecheck, tests, and targeted conventions inspection.
* [x] Primary user-facing surfaces contain product-facing copy only. Evidence: UI product-surface search and Hero/Lineage component inspection.
* [x] Focused package checks plus root format, lint, typecheck, and tests pass. Evidence: root checks under Node `v26.2.0`.

## 8. Conventions Compliance

### Status: PASS

**Categories spot-checked**: naming, file structure, error handling, comments, testing, and database conventions when relevant.

**Convention violations**: None. Runtime baseline was satisfied by running validation under Node `v26.2.0` and npm `11.16.0`.

## 9. Security & GDPR Compliance

### Status: PASS

**Full report**: See `security-compliance.md` in this session directory.

#### Summary

| Area     | Status | Findings |
| -------- | ------ | -------- |
| Security | PASS   | 0 issues |
| GDPR     | N/A    | 0 issues |

**Critical violations**: None

## 10. Behavioral Quality Spot-Check

### Status: PASS

**Checklist applied**: Yes **Files spot-checked**:

* `apps/server/src/managers/heroLifecycleManager.ts`
* `apps/server/src/lib/commandCenterValidation.ts`
* `apps/server/src/managers/missionGraph.ts`
* `apps/web/src/lib/orchestrationApi.ts`
* `apps/web/src/components/orchestration/HeroLineageWorkbench.tsx`

**Categories spot-checked**: trust boundaries, resource cleanup, mutation safety, failure paths, and contract alignment.

**Violations found**: None

**Fixes applied during validation**: None

## 11. UI Product-Surface Spot-Check

### Status: PASS

**Surfaces inspected**: `HeroLineageWorkbench` component and Orchestration pane/shell wiring by code inspection and web tests (`HeroLineageWorkbench.test.tsx`, `OrchestrationPanel.test.tsx`).

**Diagnostics found in primary UI**: None. Search matches for diagnostics are existing explicit diagnostics surfaces outside the Hero/Lineage tab; `placeholder="Subagent type"` is product input copy, not scaffolding.

**Allowed debug/admin surfaces**: Existing diagnostics tab only.

**Fixes applied during validation**: None

## Validation Result

### PASS

The session satisfies the code review gate, task completion, deliverables, encoding, tests, schema alignment, success criteria, conventions, security/GDPR, behavioral quality, and UI product-surface checks.

### Unresolved Failures And Blockers

None

## Next Steps

Next command: `updateprd`


---

# 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-session09-heroes-and-lineage/validation.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.
