# RDLC Loop

Codex does not have a native `/rdlc` command. This file is the explicit research lifecycle loop.

## The Loop

1. Frame the claim
   State the question, audience, deliverable, source hierarchy, and confidence.
2. Pick the reasoning level
   Default to `xhigh` in this repo. Drop lower only when the user explicitly wants a faster or cheaper pass.
3. Gather evidence
   Use the highest available source tier first. Do not cite a source unless it supports the specific claim.
4. Label every claim
   Use the repo vocabulary from `RDLC.md`: `VERIFIED`, `SUPPORTED`, `INFERRED`, and `UNVERIFIED` or `GAP`.
5. Build the deliverable
   Preserve audience boundaries. Private facts must not leak into public output.
6. Prove it
   Run `bash scripts/slop_scan.sh`, `bash scripts/regression_test.sh`, and any generator or render checks that apply.
7. Review
   Self-review every claim and run Codex-native review for high-stakes work: `codex review --uncommitted`, `codex review --base <branch>`, or `codex review --commit <sha>`.
8. Improve
   Every defect found becomes a permanent regression assertion.

## Task Routing Gate

Task routing gate:

Identify the execution lane before giving instructions: CLI, Desktop/computer-use, browser automation, or human-only setup.

Use `Desktop/computer-use` first when a task crosses Microsoft browser sign-in, developer program qualification, account pickers, MFA, tenant consent, Office UI, admin portal state, paywalls, or other screens that CLI work cannot safely prove. Keep credentials, MFA, tenant consent, sends, deletes, payments, license/admin changes, and publishing behind explicit human action.

## Codex Desktop Handoff

Use Codex Desktop handoff when setup crosses a browser, desktop app, admin portal, screenshot, or auth window that CLI cannot see. Codex Desktop is available on macOS and Windows.

From the repo root:

```bash
codex app .
```

Computer-use work must report back as evidence, not just chat. Prefer a repo-local `.reviews/desktop-computer-use-report.md` or equivalent artifact with findings, blockers, screenshots by path, and the next CLI action.

Human-in-the-loop boundary:

- Codex may navigate, read screens, click non-destructive controls, and explain state.
- The user handles credentials, MFA, tenant consent, sends, deletes, license/admin changes, and policy publishing.
- Return to CLI for file changes, checks, commits, and push.

## Microsoft 365 Auth Lane

For Microsoft 365 auth lane work, prefer Graph PowerShell first when `Get-MgContext` works. Browser or Desktop sign-in success is not enough by itself; verify the resulting script context before treating the lane as proven.

Fallback proof rules:

- Require tenant id plus expected work account before accepting raw OAuth or device-code proof.
- Treat personal Microsoft account success as invalid for work-tenant validation.
- Keep fallback proofs read-only unless the user approves a draft, send, delete, license/admin, or policy action for that exact run.
- Record the proven lane, current status, artifacts, and next CLI action in `.reviews/` so the next agent does not repeat auth discovery from chat memory.

## Review Handoff

For high-stakes deliverables, write `.reviews/handoff.json` with:

- mission
- success criteria
- failure criteria
- audience
- stakes
- files changed
- verification checklist
- preflight path

Mission context matters. Generic review prompts miss research failures.

## Commit Gate

Commit only after:

- sources and labels match the claims
- slop scan is clean or justified by allowlist
- fact regression suite passes
- audience firewall checks pass for generated outputs
- review findings are resolved or explicitly accepted
