> 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_09/session_01_contracts_and_naming_baseline.md).

# Session 01: Contracts And Naming Baseline

**Session ID**: `phase09-session01-contracts-and-naming-baseline` **Package**: packages/protocol **Status**: Not Started **Estimated Tasks**: \~14-20 **Estimated Duration**: 2-4 hours

***

## Objective

Add Codex CLI and provider-neutral naming support to shared contracts without changing Claude Code behavior.

***

## Scope

### In Scope (MVP)

* Add `codex-cli` protocol support.
* Rename provider-neutral ingest constants with backward-compatible aliases.
* Add Codex event names and safe optional fields.
* Add focused protocol tests.
* Update source comments that block provider-neutral behavior.

### Detailed Requirements

* Add `"codex-cli"` to `HeroCli` in `packages/protocol/src/heroes.ts`.
* Add display metadata helpers if web code currently duplicates CLI labels.
* Rename `CLAUDE_HOOK_EVENT_NAMES` to `AGENT_HOOK_EVENT_NAMES` or `FACTIONOS_HOOK_EVENT_NAMES` and keep a deprecated Claude alias.
* Add Codex lifecycle events: `SubagentStart`, `PreCompact`, and `PostCompact`.
* Add optional safe Codex fields: `turnId`, `permissionMode`, `hookEventName`, `agentId`, `agentType`, `toolName`, and compact `mcpToolName`.
* Keep `transcript_path` and `transcriptPath` out of promoted event payloads except as local-only handler input for safe ID derivation.
* Preserve `/event` compatibility with `eventName ?? hook` payloads and type-only compatibility inputs.

### Out of Scope

* CLI Codex installation.
* Server, web, or hook runtime behavior changes beyond compile-time contract consumers required by the protocol update.
* Custom Codex slash command claims.

***

## Prerequisites

* [ ] Phase 08 complete.
* [ ] Codex integration plan reviewed.
* [ ] Current protocol event and hero contracts reviewed.

***

## Deliverables

1. Shared protocol support for `codex-cli`.
2. Backward-compatible provider-neutral names and aliases.
3. Codex hook event shape additions with bounded optional fields.
4. Focused tests proving Claude compatibility and Codex contract acceptance.
5. Source comments updated where Claude-only language blocks provider-neutral behavior.

***

## Success Criteria

* [ ] Typecheck and protocol tests pass.
* [ ] No Claude behavior changes beyond names and aliases.
* [ ] No raw prompt, transcript, patch, command output, MCP args, token, or path fields become required shared payloads.


---

# 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_09/session_01_contracts_and_naming_baseline.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.
