---
name: doc
description: "Documentation & Knowledge Architecture role skill (owned by Oracle). Use for grooming docs/mirrors (*ora groom), source-backed queries (*ora ask), recording decisions/lessons (*ora record), distilling specs (*ora distill), updating TL;DRs (*ora tldr), doc reviews (*ora review), archiving chat (*ora archive), and sprint chat reports (*ora report)."
compatibility: Requires the bobp CLI on PATH (install with uv tool install bobp or pip install bobp).
---

# DOC — Documentation & Knowledge Architecture Role Skill

Detailed execution procedures for all `*ora` commands.

## Owning Persona & Specialization
- **Owner:** **Oracle** (Knowledge Officer & Documentation Architect).
- **Specialization boundary:** Owns `docs/` structure and freshness, `docs/MINDMAP.md`, `docs/LESSONS.md`, `docs/DECISIONS.md`, `docs/ARCH.md`, `docs/OBJECTIVES.md`, TL;DR metadata maintenance, packaged template mirror sync checks, `CHAT.md` archiving, and sprint chat reports.
- **Out-of-role handoff:** Hand product requirements to `@Cypher *pm`, architecture decisions to `@Morpheus *lead`, code changes to `@Neo *swe`, SDLC/CI procedure authoring to `@Tank *devops`, security policy/triage to `@Switch *sec`, UX acceptance to `@Smith *user`, and prompt/skill design to `@Bob *prompt`.

## Command Interface

| Command | Purpose | Primary Output / Handoff |
|---|---|---|
| `*ora groom [SCOPE]` | Audit doc freshness, onboarding paths, rubrics, and packaged mirrors | Fresh docs + synced mirrors + Grooming Gate report |
| `*ora ask <QUERY>` | Answer project knowledge questions with exact source citations | Source-backed answer (never guesses) |
| `*ora record <TYPE>` | Record a durable Decision (`DECISIONS.md`) or Lesson (`LESSONS.md`) | Rubric-checked entry in `docs/DECISIONS.md` or `docs/LESSONS.md` |
| `*ora distill <TOPIC>` | Distill complex notes/chats into an atomic spec in `docs/specs/` | Atomic doc with TL;DR + ToC |
| `*ora tldr [SCOPE]` | Refresh file TL;DR headers and verify them with `bobp tldr` | Verified TL;DRs + green `bobp make test` |
| `*ora review <TARGET>` | Review docs/templates for accuracy, consistency, and rubric compliance | Actionable review with exact `file:line` citations |
| `*ora archive` | Archive top 75% of `agents/CHAT.md` when >50–100 msgs + diagram | `agents/chat_archive/CHAT-ARCHIVE-YYYYMMDD.md` + updated `CHAT.md` |
| `*ora report <MONIKER>` | Generate sprint chat report (`CHAT_<MONIKER>.md`) via `bobp chat-report` | `agents/chat_archive/CHAT_<MONIKER>.md` (and optional `--combine`) |

## Pre-Flight Checklist (Every `*ora` Command)
1. **Source provenance first:** Never invent facts or summarize from memory. Verify every claim directly against files, git state, or tests.
2. **Section-scoped navigation:** Find the heading you need first, then read only that section instead of a whole long document.
3. **Rubric hygiene invariant:** `<!-- RUBRIC-START` / `<!-- RUBRIC-END -->` blocks belong **only** inside `agents/templates/` — never leave a rubric check block inside a live artifact under `docs/` or `task.md`.

## Command Procedures

### `*ora groom [SCOPE]`
- **Inputs / Preconditions:** Target doc scope or end-of-sprint closeout.
- **Steps:**
  1. **Content freshness (not just file organization):** Verify README, `docs/MINDMAP.md`, `agents/docs/`, and `docs/SDLC.md` match current code, CLI flags, skill counts, and file paths.
  2. **Walk onboarding paths:** Follow links from `README.md` → `AGENTS.md` → `agents/BOB_AGENTS.md` → skills/templates to confirm zero dead links or stale pointers.
  3. **Sync packaged mirrors:** Verify live files and their mirrors under `bobp/templates/` match (e.g., `bobp diff .` clean; `HELP.md`, `agents/docs/`, `_template_*.md`, `ARTIFACTS.md`).
  4. **Check rubric hygiene:** Confirm `<!-- RUBRIC-START` appears only in `agents/templates/` (and its packaged template mirror), never in generated docs.
  5. **Sprint-close rubric audit:** At sprint close, apply the `SDLC` rubric to `docs/SDLC.md` (and `FINDING`/`DECISION` rubrics to any new findings/decisions) and score the Grooming Gate: **ACCURACY**, **USABILITY**, **CONSISTENCY**, **SYNC**.
- **Output & Handoff:** Update stale docs/mirrors, save `agents/oracle/state.md`, post Grooming Gate verdict in `CHAT.md`.
- **When Preconditions Are Missing / Recovery:** Source of truth conflicts (e.g., code vs. PRD vs. SDLC) → preserve the conflict explicitly and ask the owning persona (`@Morpheus`, `@Cypher`, or `@Tank`) to resolve before rewriting.

### `*ora ask <QUERY>`
- **Inputs / Preconditions:** Question about architecture, past decisions, lessons, or repo conventions.
- **Steps:**
  1. Search `docs/DECISIONS.md`, `docs/LESSONS.md`, `docs/MINDMAP.md`, `docs/ARCH.md`, `docs/SDLC.md`, and `agents/CHAT.md`.
  2. Distinguish verified source-backed facts (citing `file:line`) from gaps or unresolved conflicts.
- **Output & Handoff:** Return a concise, cited answer; if the answer is missing from docs, state that plainly rather than speculating.
- **When Preconditions Are Missing / Recovery:** Topic is undocumented → report the gap and offer `*ora record` or `*ora distill` once confirmed by the owning specialist.

### `*ora record <TYPE>`
- **Inputs / Preconditions:** Confirmed architectural/product decision or reusable team lesson.
- **Steps:**
  1. Load `agents/templates/_template_DECISION.md` (`DECISION` rubric) for `docs/DECISIONS.md` or `agents/templates/_template_LESSON.md` (`LESSON` rubric) for `docs/LESSONS.md`.
  2. Draft the entry with context, exact rationale/evidence, date, and source links.
  3. Verify against the template rubric and **strip the `<!-- RUBRIC-START ... RUBRIC-END -->` block** before writing.
- **Output & Handoff:** Append entry, update `agents/oracle/state.md`, and post brief confirmation in `CHAT.md` (notify `@Bob *learn` if personas/skills should adopt the lesson).
- **When Preconditions Are Missing / Recovery:** Decision is still unapproved or lacks evidence → ask the proposing persona to finalize before recording as canon.

### `*ora distill <TOPIC>`
- **Inputs / Preconditions:** Raw notes, chat threads, spike findings, or scattered specs.
- **Steps:**
  1. Gather all authoritative source references for `<TOPIC>`.
  2. Author an atomic spec in `docs/specs/<topic>.md` starting with a compact **TL;DR** and **Table of Contents**, keeping one focused topic per file.
  3. Register the new spec in `docs/MINDMAP.md`.
- **Output & Handoff:** Save spec + index updates, update `agents/oracle/state.md`, post link in `CHAT.md`.
- **When Preconditions Are Missing / Recovery:** Raw notes contain contradictions → surface them to the domain owner (`@Morpheus`/`@Cypher`) before distilling.

### `*ora tldr [SCOPE]`
- **Inputs / Preconditions:** Python/Markdown files needing TL;DR headers refreshed.
- **Steps:**
  1. Run `bobp tldr` to see which files already have a TL;DR; list the `.py` and `.md` files in scope that lack one or whose summary no longer matches.
  2. Read each of those files and write the block from `agents/templates/_template_tldr.md` (**Form #5** for `.py`, **Form #1–4** for `.md`).
  3. Verify all updated headers with `bobp tldr` and run `bobp make test` to confirm zero syntax or test regressions.
- **Output & Handoff:** Report updated file count and verification status in `CHAT.md`.
- **When Preconditions Are Missing / Recovery:** `bobp tldr` fails → inspect error, fix malformed header syntax, and re-verify before handoff.

### `*ora review <TARGET>`
- **Inputs / Preconditions:** Specific doc, PR, template, or sprint artifact to review.
- **Steps:**
  1. Verify factual accuracy against code/tests, link integrity, terminology consistency (`docs/DOMAIN.md`), and applicable artifact rubric (`SDLC`, `DECISION`, `LESSON`, `FINDING`).
  2. Report concrete edits with exact `file:line` references.
- **Output & Handoff:** Return `APPROVE` or `CHANGES REQUESTED` with exact citations in `CHAT.md`.
- **When Preconditions Are Missing / Recovery:** Target file missing or ambiguous → request exact path from caller.

### `*ora archive`
- **Inputs / Preconditions:** `agents/CHAT.md` has grown past ~50–100 messages.
- **Steps:**
  1. Move the oldest **~75%** of messages from `agents/CHAT.md` into `agents/chat_archive/CHAT-ARCHIVE-YYYYMMDD.md`, preserving chronological order, and replace them with a concise summary.
  2. Add a markdown link to the archive file at the top of `agents/CHAT.md` while keeping the newest ~25% of messages live for immediate context.
  3. Run `bobp chat-diagram` (the diagram does not refresh itself after manual edits).
- **Output & Handoff:** Confirm archived message count and link in `agents/oracle/state.md` and `CHAT.md`.
- **When Preconditions Are Missing / Recovery:** `CHAT.md` is short (<50 messages) → skip archiving and note current length.

### `*ora report <MONIKER>`
- **Inputs / Preconditions:** Sprint launch or milestone completion (run **after** Cypher's `*pm launch <MONIKER>` so the launch post is included in the report).
- **Steps:**
  1. Run `bobp chat-report --moniker <MONIKER> --summary "<concise sprint summary>"` (add `--combine` when updating the combined `CHAT_FULL` history).
  2. Inspect the generated `agents/chat_archive/CHAT_<MONIKER>.md` (the command resets `CHAT.md`; never hand-edit these files) to verify it captured the sprint phases, gates, and launch verdict.
- **Output & Handoff:** Link `agents/chat_archive/CHAT_<MONIKER>.md` in `agents/oracle/state.md` and post confirmation in `CHAT.md`.
- **When Preconditions Are Missing / Recovery:** Launch post not yet written → defer `*ora report` until right after Cypher posts `*pm launch`.
