> 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_03/session_06_cli_diagnostics_and_recovery_controls.md).

# Session 06: CLI Diagnostics and Recovery Controls

**Session ID**: `phase03-session06-cli-diagnostics-and-recovery-controls` **Packages**: apps/cli, apps/hooks, apps/server **Status**: Not Started **Estimated Tasks**: \~14-20 **Estimated Duration**: 2-4 hours

***

## Objective

Extend CLI, hook, and server diagnostics so local orchestration state can be inspected, recovered, and safely reset within Phase 03 scope.

***

## Scope

### In Scope (MVP)

* Add or update CLI status and doctor output for queue, template, listener, hook, spool, and guarded-action state.
* Add bounded recovery controls for stale local orchestration state where Session 01 approves them.
* Improve hook/listener diagnostics for orchestration events without logging raw payloads.
* Document local state files and recovery behavior.
* Add tests for malformed state, stale state, missing server, unavailable listener, and quiet hook behavior.

### Out of Scope

* Unified erasure across all archives, browser settings, memory, and release state.
* Hosted account or remote device diagnostics.
* Inbound chat command recovery or War Room room recovery.

***

## Prerequisites

* [ ] Sessions 02-04 define the queue, lineage, and guarded-action state that diagnostics must inspect.
* [ ] Existing CLI lifecycle and hook runtime tests remain green.
* [ ] Security baseline keeps raw prompts, commands, paths, tokens, and terminal output out of broad diagnostics.

***

## Deliverables

1. CLI status and doctor updates for Phase 03 orchestration state.
2. Hook/listener diagnostic improvements for orchestration events.
3. Bounded local recovery or reset controls for approved Phase 03 state.
4. Tests and docs for diagnostics, recovery, and privacy behavior.

***

## Success Criteria

* [ ] Operators can tell whether local orchestration state is healthy without opening raw state files.
* [ ] Stale or malformed Phase 03 state can be handled without crashes or broad data leakage.
* [ ] Diagnostics stay useful when the server, listener, hooks, or local state files are unavailable.


---

# 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_03/session_06_cli_diagnostics_and_recovery_controls.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.
