Lawyer voice fingerprinting
Turn a lawyer's LinkedIn writing history into a reusable ToneProfile via a MapReduce of Haiku calls, then watch that voice get injected into every drafting agent and the final synthesis.
Analysis pipeline (src/services/toneAnalyzer.ts)
Chunked MapReduce with O(log n) Haiku call depth:
| Constant | Value | Purpose |
|---|---|---|
POST_CHUNK_SIZE |
8 | posts per analyzeChunk call |
NOTE_CHUNK_SIZE |
6 | notes per rollupNotes call |
MAX_POSTS |
500 | cap on posts consumed |
Three Haiku call types: analyzeChunk (posts → prose note), rollupNotes
(notes → merged note), buildProfile (final note → JSON ToneProfile).
sanitizeForHaiku() strips FINDING:, END_FINDING, NO_FINDINGS,
NO_CHALLENGE markers and control characters from user-supplied content before
it enters any prompt. The same guard (sanitizePromptContent) is applied in
src/agents/base.ts before the injectionSnippet is prepended.