> 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_01/session_07_runtime_contract_documentation.md).

# Session 07: Runtime Contract Documentation

**Session ID**: `phase01-session07-runtime-contract-documentation` **Status**: Not Started **Estimated Tasks**: \~12-18 **Estimated Duration**: 2-4 hours

***

## Objective

Make stable documentation the authoritative runtime contract for Phase 01 behavior so `EXAMPLES/` remains traceability evidence rather than user-facing implementation guidance.

***

## Scope

### In Scope (MVP)

* Update `docs/api/README_api.md` and `docs/api/event-api-hook-contracts.md` after Phase 01 implementation sessions.
* Update package READMEs for CLI, hooks, server, and protocol behavior.
* Update privacy and development docs for local-first boundaries, LLM transfer, exports, archives, and unsupported routes.
* Record which Phase 01 `EXAMPLES/` sources are fully captured in current source, tests, and docs.
* Identify remaining source-intake dependencies for later phases.

### Out of Scope

* Deleting `EXAMPLES/` or `docs/PROGRESS.md`.
* Writing Phase 02 implementation specs.
* Creating new product-surface UI docs beyond runtime contract changes.

***

## Prerequisites

* [ ] Sessions 01 through 06 are validated or have clear retained gaps.
* [ ] Test results and implementation notes from each Phase 01 session are available.
* [ ] Current docs have been checked for stale route, event, hook, and CLI claims.

***

## Deliverables

1. Updated stable API, hook, CLI, server, protocol, privacy, and development docs.
2. Source-intake traceability notes for Phase 01.
3. A concise remaining-gap list for Phase 02 planning and later release cleanup.

***

## EXAMPLES Implementation Sources

| Source                                             | Feature / Contract                                                                                 | Tests Required                                                                | Documentation Owner                                                            |
| -------------------------------------------------- | -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| `EXAMPLES/findings/api-routes.txt`                 | Final Phase 01 shipped, stubbed, planned, unsupported, and obsolete route status                   | Docs cross-check against route tests from sessions 01, 04, 05, and 06         | `docs/api/README_api.md`, `docs/api/event-api-hook-contracts.md`               |
| `EXAMPLES/findings/websocket-events.txt`           | Final Phase 01 WebSocket event and client-message status                                           | Docs cross-check against WebSocket and protocol tests from sessions 01 and 05 | `docs/api/event-api-hook-contracts.md`, `packages/protocol/README_protocol.md` |
| `EXAMPLES/findings/claude-hook-contract.md`        | Final hook contract and compatibility status                                                       | Docs cross-check against hook and ingest tests from sessions 01 and 02        | `apps/hooks/README_hooks.md`, `docs/api/event-api-hook-contracts.md`           |
| `EXAMPLES/findings/architecture.md`                | Final Phase 01 disposition for historical runtime modules and current architecture deltas          | Docs cross-check against all Phase 01 validation notes                        | `docs/ARCHITECTURE.md`, `docs/legacy-consolidation.md`                         |
| `EXAMPLES/findings/BUILD_LINKS.md`                 | Traceability from source-intake files to current implementation                                    | Session validation traceability checklist                                     | `docs/legacy-consolidation.md`                                                 |
| `EXAMPLES/findings/llm-prompts/`                   | Final Phase 01 LLM prompt, fallback, scan, and memory behavior status                              | Docs cross-check against LLM route tests from session 06                      | `apps/server/README_server.md`, `docs/privacy-and-security.md`                 |
| `EXAMPLES/1st-pass-artifacts/agent-templates.json` | Agent-template requirements retained for later orchestration if not implemented now                | Remaining-gap checklist for Phase 03 or later                                 | `docs/legacy-consolidation.md`                                                 |
| `EXAMPLES/1st-pass-artifacts/bundled-README.md`    | CLI lifecycle claims retained or rejected for current workspace                                    | Docs cross-check against CLI tests from session 03                            | `README.md`, `apps/cli/README_cli.md`                                          |
| `EXAMPLES/1st-pass-artifacts/bundled-package.json` | Package metadata, binary, files, scripts, dependency, and engine expectations retained or rejected | Docs cross-check against package metadata and CLI tests                       | `README.md`, `apps/cli/README_cli.md`                                          |
| `EXAMPLES/package-0.4.1/lib/cli.js`                | CLI command semantics retained or rejected                                                         | Docs cross-check against CLI command tests                                    | `apps/cli/README_cli.md`                                                       |
| `EXAMPLES/package-0.4.1/lib/installer.js`          | Install and uninstall behavior retained or rejected                                                | Docs cross-check against installer fixture tests                              | `apps/cli/README_cli.md`, `apps/hooks/README_hooks.md`                         |
| `EXAMPLES/package-0.4.1/lib/launcher.js`           | Launch, stop, PID, port, and workspace behavior retained or rejected                               | Docs cross-check against launcher tests                                       | `README.md`, `apps/cli/README_cli.md`                                          |
| `EXAMPLES/package-0.4.1/lib/config.js`             | Config directory, auth token, PID, env, and project-dir persistence retained or rejected           | Docs cross-check against config fixture tests and privacy notes               | `apps/cli/README_cli.md`, `docs/privacy-and-security.md`                       |

***

## Success Criteria

* [ ] Stable docs describe current runtime behavior without directing users to `EXAMPLES/`.
* [ ] Docs classify behavior as shipped, tested-shipped, stubbed, planned, unsupported, or obsolete where needed.
* [ ] Every Phase 01 session has traceability from direct `EXAMPLES/` sources to current source, tests, and docs.
* [ ] Remaining gaps are specific enough for Phase 02 and later phasebuild runs.


---

# 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_01/session_07_runtime_contract_documentation.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.
