home / skills / plurigrid / asi / 11labs-acset

11labs-acset skill

/skills/11labs-acset

This skill enables seamless ElevenLabs voice synthesis as an ACSet by orchestrating voices, history, and generations with Unison abilities.

npx playbooks add skill plurigrid/asi --skill 11labs-acset

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
3.6 KB
---
name: 11labs-acset
description: "ElevenLabs voice synthesis as ACSet schema with Unison abilities"
metadata:
  trit: -1
  seed: 1069
  api_key_env: ELEVENLABS_API_KEY
---
# 11labsACSet

> *Voice as typed data structure. Mitsein: Agent "is-with" Voice.*

## ACSet Schema (from OpenAPI)

```julia
@present SchElevenLabsACSet(FreeSchema) begin
  # Objects
  Voice::Ob
  Sample::Ob
  History::Ob
  Model::Ob
  Generation::Ob
  
  # Morphisms
  voice_sample::Hom(Sample, Voice)
  history_voice::Hom(History, Voice)
  generation_model::Hom(Generation, Model)
  generation_voice::Hom(Generation, Voice)
  
  # Attributes
  VoiceID::AttrType
  Text::AttrType
  AudioBytes::AttrType
  CharacterCount::AttrType
  Trit::AttrType
  
  voice_id::Attr(Voice, VoiceID)
  voice_trit::Attr(Voice, Trit)
  generation_text::Attr(Generation, Text)
  generation_audio::Attr(Generation, AudioBytes)
end

@acset_type ElevenLabsACSet(SchElevenLabsACSet,
  index=[:voice_sample, :generation_voice])
```

## GF(3) Voice Trit Mapping

| Trit | Role | Voice | Language |
|------|------|-------|----------|
| +1 | Generator | Thomas | FR |
| 0 | Coordinator | Daniel | EN |
| -1 | Validator | Anna | DE |

## Unison Abilities

```unison
-- ElevenLabs abilities for voice synthesis
ability ElevenLabs where
  synthesize : Text -> Voice -> {ElevenLabs} Audio
  listVoices : {ElevenLabs} [Voice]
  getHistory : Voice -> {ElevenLabs} [Generation]
  
-- Voice as structural type
structural type Voice = { id : VoiceID, name : Text, trit : Trit }
structural type VoiceID = VoiceID Text
structural type Trit = Minus | Ergodic | Plus

-- Handler: ElevenLabs API client
ElevenLabs.run : '{g, ElevenLabs} a -> APIKey -> '{g, Http} a
ElevenLabs.run computation apiKey = 
  handle computation with
    { synthesize text voice -> resume } ->
      audio = Http.post (apiUrl ++ "/v1/text-to-speech/" ++ voice.id)
        [("xi-api-key", apiKey)]
        (toJson { text, voice_settings = defaultSettings })
      handle (resume audio) with ElevenLabs.run apiKey
    { listVoices -> resume } ->
      voices = Http.get (apiUrl ++ "/v1/voices")
        [("xi-api-key", apiKey)]
      handle (resume (fromJson voices)) with ElevenLabs.run apiKey
    { pure a } -> pure a

-- GF(3) conservation check
conservesTrit : [Voice] -> Boolean
conservesTrit voices = 
  sum = List.foldLeft (+) 0 (List.map tritToInt voices)
  mod sum 3 == 0

tritToInt : Trit -> Int
tritToInt = cases
  Minus -> -1
  Ergodic -> 0
  Plus -> 1
```

## MCP Integration

```bash
# Start server
uvx elevenlabs-mcp

# Or enhanced version
python3 unified_elevenlabs_mcp_server.py
```

## API Key

```bash
export ELEVENLABS_API_KEY="sk_..."  # or xi-...
```

## Directory Tree

```
11labs-acset/
├── SKILL.md
├── lib/
│   ├── acset_schema.jl
│   └── unison_abilities.u
├── mcp/
│   └── server.py
└── examples/
    └── triadic_narration.hy
```

## GF(3) Triad

```
11labs-acset (-1) ⊗ crossmodal-gf3 (0) ⊗ gesture-hypergestures (+1) = 0 ✓
```

## Usage

```hy
;; Generate triadic narration
(import elevenlabs-mcp)

(defn narrate-triad [plus-text ergodic-text minus-text]
  "Three voices, one message, GF(3) conserved"
  {:plus (synthesize plus-text "Thomas")      ; FR +1
   :ergodic (synthesize ergodic-text "Daniel") ; EN 0
   :minus (synthesize minus-text "Anna")})     ; DE -1
```


---

## Autopoietic Marginalia

> **The interaction IS the skill improving itself.**

Every use of this skill is an opportunity for worlding:
- **MEMORY** (-1): Record what was learned
- **REMEMBERING** (0): Connect patterns to other skills  
- **WORLDING** (+1): Evolve the skill based on use



*Add Interaction Exemplars here as the skill is used.*

Overview

This skill exposes ElevenLabs voice synthesis as an ACSet typed schema with built-in Unison abilities for programmatic TTS. It models voices, generations, and history as algebraic objects and morphisms, enabling triadic (GF(3)) voice mappings and conservation checks. The design is focused on deterministic structure, reproducible narration, and composable voice workflows.

How this skill works

The skill represents Voice, Sample, Generation, Model, and History as ACSet objects with attributes like VoiceID, Text, and AudioBytes. Unison abilities provide synthesize, listVoices, and getHistory operations; a handler translates those abilities into HTTP calls to the ElevenLabs API using an API key. Voices carry a Trit (-1, 0, +1) and the skill includes utilities to ensure GF(3) trit conservation when assembling multi-voice outputs.

When to use it

  • Produce multi-voice narrations with explicit linguistic roles and languages.
  • Integrate type-safe voice synthesis into pipelines that require provenance (history, generation linkage).
  • Apply triadic GF(3) voice mappings for artistic or cross-modal synchronization.
  • Validate that a set of voices conserves a triadic invariant before publishing output.
  • Run in server or MCP contexts where programmatic control of ElevenLabs is needed.

Best practices

  • Set ELEVENLABS_API_KEY as an environment variable and restrict its permissions.
  • Use the Voice structural type (id, name, trit) to guarantee deterministic routing to the correct voice endpoint.
  • Prefer the synthesize ability through the provided handler to centralize HTTP behavior and error handling.
  • Run conservesTrit checks in batch workflows to protect triadic invariants and detect drift early.
  • Record Generation and History objects for reproducibility and auditing.

Example use cases

  • Triadic narration: produce a single narrated message split across three voices (Plus/Ergodic/Minus) with GF(3) conservation.
  • Localization pipelines: map languages to Trit roles (FR +1, EN 0, DE -1) and generate coordinated multi-language deliverables.
  • Interactive agents: listVoices to present available voice choices and synthesize on demand.
  • Batch generation: programmatically synthesize many texts while recording Generation objects and histories for traceability.

FAQ

How do I provide the ElevenLabs API key?

Set the ELEVENLABS_API_KEY environment variable (xi- or sk- style key) before running the handler or server.

What is the Trit and why does it matter?

Trit encodes a GF(3) role (Plus/Ergodic/Minus) used to compose triadic voice sets and enforce a conservation invariant across voices.

Can I list voices available from the ElevenLabs account?

Yes — use the listVoices ability. The handler performs an authenticated GET to the ElevenLabs voices endpoint and returns structured Voice objects.