> 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/phase10-session02-codex-hook-install-uninstall-and-diagnostics/tasks.md).

# Task Checklist

**Session ID**: `phase10-session02-codex-hook-install-uninstall-and-diagnostics` **Total Tasks**: 23 **Estimated Duration**: 3-4 hours **Created**: 2026-05-31

***

## Legend

* `[x]` = Completed
* `[ ]` = Pending
* `[P]` = Parallelizable (can run with other \[P] tasks)
* `[S1002]` = Session reference (10=phase number, 02=session number)
* `TNNN` = Task ID

***

## Progress Summary

| Category       | Total  | Done   | Remaining |
| -------------- | ------ | ------ | --------- |
| Setup          | 3      | 3      | 0         |
| Foundation     | 6      | 6      | 0         |
| Implementation | 10     | 10     | 0         |
| Testing        | 4      | 4      | 0         |
| **Total**      | **23** | **23** | **0**     |

***

## Setup (3 tasks)

Initial analysis and isolated fixture preparation.

### Cross-package

* [x] T001 \[S1002] Verify Phase 10 Session 02 prerequisites, source scope, and no-overclaim boundaries (`.spec_system/PRD/phase_10/session_02_codex_hook_install_uninstall_and_diagnostics.md`)
* [x] T002 \[S1002] Inspect current deferred Codex provider routing and Claude installer safety patterns (`apps/cli/src/installers/codex.js`)
* [x] T003 \[S1002] \[P] Create focused Codex installer fixture structure with isolated homes and `CODEX_HOME` setup (`apps/cli/tests/codexInstaller.test.js`)

***

## Foundation (6 tasks)

Core helpers and provider implementation primitives.

### apps/cli

* [x] T004 \[S1002] Add Codex directory resolution helper with `CODEX_HOME` support and no real-home test leakage (`apps/cli/src/lib/localFiles.js`)
* [x] T005 \[S1002] Implement Codex hook template loading and `${PLUGIN_ROOT}` interpolation with explicit missing-template errors (`apps/cli/src/installers/codex.js`)
* [x] T006 \[S1002] Implement managed Codex hook detection and compact hook counting without exposing raw command bodies (`apps/cli/src/installers/codex.js`)
* [x] T007 \[S1002] Implement backup-first Codex install merge with idempotency protection, atomic writes, malformed-file fallback, and user-owned hook preservation (`apps/cli/src/installers/codex.js`)
* [x] T008 \[S1002] Implement Codex uninstall backup restore and surgical managed-hook removal with malformed-file no-overwrite behavior (`apps/cli/src/installers/codex.js`)
* [x] T009 \[S1002] Extend provider posture formatting for Codex JSON validity, backup state, managed/unmanaged counts, disabled-hook posture, and trust guidance (`apps/cli/src/lib/providerPosture.js`)

***

## Implementation (10 tasks)

Main CLI wiring, runtime coverage, hook map assertions, and documentation.

### apps/cli

* [x] T010 \[S1002] Replace deferred Codex init summary with installed, unchanged, and guidance states including start, Codex launch, and `/hooks` next steps (`apps/cli/src/commands/init.js`)
* [x] T011 \[S1002] Replace deferred Codex uninstall output with backup-restored, removed, absent, malformed, and not-found states (`apps/cli/src/commands/uninstall.js`)
* [x] T012 \[S1002] Add Codex doctor checks for hooks file posture, managed count, disabled hooks, and trust-review guidance with privacy-safe output (`apps/cli/src/commands/doctor.js`)
* [x] T013 \[S1002] Add compact Codex status output with validity, counts, backup, and disabled-hook labels (`apps/cli/src/commands/status.js`)
* [x] T014 \[S1002] Update provider selection tests from deferred Codex behavior to real install and uninstall expectations (`apps/cli/tests/cliProvider.test.js`)
* [x] T015 \[S1002] Expand CLI runtime tests for `init --cli codex`, `init --cli all`, install alias, uninstall, doctor, and status with duplicate-trigger prevention on rerun (`apps/cli/tests/cliRuntime.test.js`)
* [x] T016 \[S1002] Fill Codex installer tests for missing directory, valid merge, malformed backup, reinstall idempotency, backup restore, surgical uninstall, env interpolation, and `CODEX_HOME` (`apps/cli/tests/codexInstaller.test.js`)

### apps/hooks

* [x] T017 \[S1002] \[P] Add Codex hook map installability assertions for valid JSON, top-level hooks object, `${PLUGIN_ROOT}` placeholders, and FactionOS command hooks (`apps/hooks/tests/codexHookMap.test.js`)

### Documentation

* [x] T018 \[S1002] \[P] Update CLI README for Codex install, uninstall, diagnostics, trust review, and excluded Codex settings (`apps/cli/README_cli.md`)
* [x] T019 \[S1002] \[P] Update hooks README to describe user-level Codex installation support while preserving `/hooks` trust-review and no plugin-packaging claims (`apps/hooks/README_hooks.md`)

***

## Testing (4 tasks)

Verification and quality assurance.

### Cross-package

* [x] T020 \[S1002] Run focused CLI tests for Codex installer, provider routing, and runtime behavior (`apps/cli/tests/codexInstaller.test.js`)
* [x] T021 \[S1002] Run focused hook map tests for Codex template integrity (`apps/hooks/tests/codexHookMap.test.js`)
* [x] T022 \[S1002] Run focused Biome check on touched CLI, hook, and README files (`biome.jsonc`)
* [x] T023 \[S1002] Validate ASCII/LF hygiene and whitespace diff check for session and touched implementation files (`.spec_system/specs/phase10-session02-codex-hook-install-uninstall-and-diagnostics/tasks.md`)

***

## Completion Checklist

Before marking session complete:

* [x] All tasks marked `[x]`
* [x] All tests passing
* [x] All files ASCII-encoded
* [x] implementation-notes.md updated
* [x] Ready for the validate workflow step

***

## Next Steps

Run the validate workflow step to verify session completeness.


---

# 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/phase10-session02-codex-hook-install-uninstall-and-diagnostics/tasks.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.
