Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.mavera.io/llms.txt

Use this file to discover all available pages before exploring further.

Scenario

Collect diverse writing samples — emails, blog posts, social media, internal docs — and use Claude to identify consistent voice patterns. Rather than guessing at brand voice, Claude extracts vocabulary choices, sentence structures, tone markers, and rhetorical patterns from real writing, then creates a Mavera Brand Voice that captures the authentic organizational tone. Flow: Collect multi-source samples → Anthropic POST /v1/messages (extract voice patterns, vocabulary, tone markers) → Mavera POST /brand-voices → Brand Voice profile

Code

import os, anthropic, requests

MV = os.environ["MAVERA_API_KEY"]
MV_BASE = "https://app.mavera.io/api/v1"
MV_H = {"Authorization": f"Bearer {MV}", "Content-Type": "application/json"}
client = anthropic.Anthropic()

SAMPLES = {
    "blog_posts": [
        "We shipped the dashboard redesign last Tuesday. Not because it was perfect — it wasn't — but because our users had been asking for six months and perfect is the enemy of shipped...",
        "Three things we learned from 10,000 support tickets: most problems aren't product problems, they're expectation problems...",
    ],
    "emails": [
        "Hi Sarah — quick heads up, we're rolling out new API versioning next week. Nothing breaks on your end, but the docs will look different...",
        "Thanks for flagging this. You're right, that error message is confusing. We're rewriting it Thursday. Appreciate you taking the time.",
    ],
    "social_media": [
        "Just pushed our 100th integration. No confetti, no press release — just another Tuesday making your stack work better.",
        "Hot take: most 'AI-powered' features are just if-statements with better marketing.",
    ],
    "internal_docs": [
        "RFC: Moving to event-driven architecture for notifications. Current polling costs $4,200/month in unnecessary compute...",
        "Retro: Two things to keep — incremental updates over big bangs, and changelogs humans can read.",
    ],
}

# 1. Build corpus
corpus = ""
for source_type, texts in SAMPLES.items():
    corpus += f"\n\n## {source_type.upper().replace('_', ' ')}\n"
    for i, text in enumerate(texts, 1):
        corpus += f"\nSample {i}: \"{text}\"\n"
print(f"Corpus: {len(corpus):,} chars, {sum(len(v) for v in SAMPLES.values())} samples")

# 2. Claude voice extraction
voice = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=4096,
    input=[{
        "role": "user",
        "content": "Linguistic analyst specializing in brand voice extraction.\n\n"
            "Analyze writing samples from MULTIPLE channels and identify CONSISTENT voice patterns.\n\n"
            f"SAMPLES:\n{corpus}\n\n"
            "Extract:\n"
            "1. **Voice Archetype** — one phrase capturing the personality\n"
            "2. **Tone Spectrum** — formal↔casual, serious↔playful, technical↔accessible\n"
            "3. **Signature Patterns** — recurring rhetorical devices, sentence structures\n"
            "4. **Vocabulary DNA** — words used repeatedly; words conspicuously avoided\n"
            "5. **Punctuation & Formatting** — em dashes, paragraph length, list usage\n"
            "6. **Channel Adaptation** — how voice shifts across channels\n"
            "7. **Do/Don't Rules** — 5 'always do' and 5 'never do' rules\n"
            "8. **Example Rewrites** — rewrite a generic sentence in this voice"
    }],
)
voice_output = voice.content[0].text
print(f"Voice extraction complete — {voice.usage.output_tokens:,} output tokens")

# 3. Create Mavera Brand Voice
bv = requests.post(f"{MV_BASE}/brand-voices", headers=MV_H, json={
    "name": "Extracted Org Voice — Q4 2025",
    "description": voice_output[:3000],
}).json()

print(f"\nBrand Voice created: {bv.get('id')}")
print(f"\n{voice_output[:1200]}")

Example Output

Voice extraction complete — 1,842 output tokens
Brand Voice created: bv_7f2a9c3d

## Voice Archetype: "The competent friend who happens to be an engineer"

## Tone Spectrum
  Formal ◆───────── Casual (75% casual)
  Serious ─────◆─── Playful (60% serious)
  Technical ───◆──── Accessible (balanced)

## Signature Patterns
  Em dash interjections ("Not because it was perfect — it wasn't")
  Numbers as credibility anchors ("10,000 tickets", "$4,200/month")

## Vocabulary DNA
  USES: "shipped", "flagged", "heads up", "edge case"
  AVOIDS: "leverage", "synergy", "excited to announce", "game-changing"

## Do/Don't Rules
  DO: Lead with what happened, not why it matters
  DO: Use specific numbers over vague qualifiers
  DON'T: Use corporate superlatives ("industry-leading")
  DON'T: Write sentences longer than 25 words

Error Handling

Voice extraction works best with 8-15 samples across 3+ channels. Fewer than 5 samples produces unreliable patterns. If you only have one channel, label it clearly so Claude doesn’t hallucinate cross-channel consistency.
This job uses Claude Sonnet for cost efficiency — voice extraction doesn’t need Opus 4.6’s full reasoning. Switch to Opus if samples exceed 100K tokens or need nuanced cultural analysis.
Mavera’s brand voice description accepts up to 5,000 characters. The output is truncated to 3,000. For richer profiles, split into two brand voices (tone rules + vocabulary/examples).