> 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-session06-cli-diagnostics-and-recovery-controls/security-compliance.md).

# Security and Compliance Notes

**Session ID**: `phase03-session06-cli-diagnostics-and-recovery-controls` **Package**: Cross-cutting (`apps/cli`, `apps/hooks`, `apps/server`) **Created**: 2026-05-29 **Status**: Complete

***

## Scope

This session adds local CLI, hook, listener, and server diagnostics for Phase 03 orchestration state. Recovery controls are limited to stale listener PID files and malformed spool JSON entries under the configured FactionOS home.

## Privacy Boundary

* Diagnostics must report counts, availability, status labels, durations, categories, and sanitized identifiers only.
* Diagnostics must not print raw prompts, command bodies, terminal output, file contents, tokens, transcript paths, broad absolute paths, raw spool payloads, raw queue entries, raw proposal rationale, or raw state files.
* Server diagnostics must inherit existing local auth, CORS, Origin, rate-limit, and JSON body-size boundaries.
* Recovery must not delete archives, memory, lifecycle state, settings, project roots, browser state, session exports, or workspace files.

## Verification Log

* Focused server, CLI, and hook/listener tests passed: 8 files, 30 tests.
* Server typecheck passed with `npm --workspace apps/server run typecheck`.
* Focused Biome lint passed on touched source and test files.
* ASCII and LF checks passed on touched source, tests, docs, and session artifacts.
* `git diff --check` passed.

## Security Posture

* Server diagnostics inherit existing local middleware and expose counts only.
* CLI diagnostics reject non-loopback server URLs and discard unexpected raw response fields before display.
* Hook and listener diagnostics write safe summaries, bounded counts, status labels, durations, bytes, and sanitized identifiers only.
* Recovery requires an explicit flag, uses a local in-flight lock, and removes only stale listener PID files plus malformed spool JSON entries.


---

# 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-session06-cli-diagnostics-and-recovery-controls/security-compliance.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.
