# Handoff: re-voice (next agent)

## What this repo is

`re-voice` applies a versioned **style bible** to a source document to produce a **shadow dossier** (red-team lens + voice).

Current focus style:
- Dave bible: `style_bibles/IF.DAVE.BIBLE.md` (`if://bible/dave/v1.2`)

## Current behavior (v0.1)

- Extraction:
  - PDF: `pdftotext` fast-path, OCR fallback (`pdftoppm` → `tesseract`)
  - MD/TXT: read as-is
- Generation (Dave v1.2):
  - Section-by-section mirror for the Snyk PDF example using OCR section extraction
  - Adds InfraFabric Red Team “declassified” header + inferred Mermaid diagrams
  - Enforces “no new emojis unless in source”

## How to run (example)

```bash
PYTHONPATH=src python3 -m revoice generate \
  --style if.dave.v1.2 \
  --input examples/ai-code-guardrails/AI-Code-Guardrails.pdf \
  --output examples/ai-code-guardrails/AI-Code-Guardrails.shadow.dave.md

PYTHONPATH=src python3 -m revoice preflight \
  --style if.dave.v1.2 \
  --input examples/ai-code-guardrails/AI-Code-Guardrails.shadow.dave.md \
  --source examples/ai-code-guardrails/AI-Code-Guardrails.pdf

PYTHONPATH=src python3 -m revoice lint \
  --style if.dave.v1.2 \
  --input examples/ai-code-guardrails/AI-Code-Guardrails.shadow.dave.md \
  --source examples/ai-code-guardrails/AI-Code-Guardrails.pdf
```

Mermaid tooling:
- Self-heal script: `tools/mermaid/mermaid-self-heal.js`
- Forgejo-worker validator: `tools/mermaid/mermaid-validate-worker.js` (requires the PDF worker runtime)

## Applying the stack to the full InfraFabric dossier

Source (huge; ~1MB / ~22k lines):
- Repo view: `https://git.infrafabric.io/danny/Infrafabric-POC-docs/src/branch/main/DANNY_STOCKER_INFRAFABRIC_DOSSIER.md`
- Raw (best for tooling): `https://git.infrafabric.io/danny/Infrafabric-POC-docs/raw/branch/main/DANNY_STOCKER_INFRAFABRIC_DOSSIER.md`

Recommended approach (don’t paste the whole file into chats):
- Use `rg '^## '` to enumerate major sections (the dossier is `##`-structured).
- Use `rg '^```mermaid'` to find existing diagrams (there are many).
- Apply Dave as a **sociotechnical red-team lens** in one of two modes:
  1) **Overlay mode (recommended for the dossier):** keep the original content, insert a short “Dave Factor” callout under each major `##` section describing dilution risks + the anti-Dave control (artifact/trace/owner/acceptance test).
  2) **Full rewrite mode (marketing/satire):** rewrite each major section into Dave-voice while mirroring headings; keep evidence/citations as “appendix artifacts” to avoid breaking auditability.

Implementation note:
- To support the dossier properly, `revoice` should add a Markdown-aware section parser (split by headings, preserve code fences) and optionally an LLM-backed rewriter for “full rewrite mode.”
