> For the complete documentation index, see [llms.txt](https://docs.meganova.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.meganova.ai/character-studio/advanced/character-specs.md). Agents can also search and read this documentation through its [MCP server](https://docs.meganova.ai/~gitbook/mcp).

# Character Specs

> **Note:** Technical specifications for character data formats. Understand CCv2 and CCv3 structures for advanced character creation and integration.

## Overview

Character Studio uses standard formats:

| Format   | Description                           |
| -------- | ------------------------------------- |
| **CCv2** | Character Card v2 - widely supported  |
| **CCv3** | Character Card v3 - extended features |

## CCv2 Specification

### Core Fields

```json
{
  "name": "string",
  "description": "string",
  "personality": "string",
  "scenario": "string",
  "first_mes": "string",
  "mes_example": "string"
}
```

### Field Descriptions

| Field         | Required | Description                     |
| ------------- | -------- | ------------------------------- |
| `name`        | Yes      | Character's display name        |
| `description` | No       | Background, appearance, history |
| `personality` | No       | Personality traits, behaviors   |
| `scenario`    | No       | Conversation setting/context    |
| `first_mes`   | Yes      | Initial greeting message        |
| `mes_example` | No       | Example dialogue exchanges      |

### Example

```json
{
  "name": "Elena",
  "description": "Elena is a 45-year-old elven wizard with silver-streaked hair and emerald eyes. She runs an ancient magical library and has spent centuries collecting forbidden knowledge.",
  "personality": "Wise, patient, mysterious. Speaks in measured tones but shows warmth to those who earn her trust. Has a dry wit and loves riddles.",
  "scenario": "You've traveled to the Library of Shadows seeking ancient knowledge. Elena, the eternal librarian, has agreed to meet with you.",
  "first_mes": "*Elena looks up from an ancient tome as you enter, her emerald eyes studying you with centuries of wisdom.* Welcome, seeker. The Library of Shadows does not receive visitors often. What knowledge do you seek?",
  "mes_example": "{{user}}: What is magic?\n{{char}}: *adjusts her spectacles* Magic is neither good nor evil—it is merely a tool. The question is always who wields it, and to what end. *gestures to the shelves* These books contain power beyond measure. The real test is whether you have the wisdom to use it."
}
```

## CCv3 Specification

### Full Structure

```json
{
  "spec": "chara_card_v3",
  "spec_version": "3.0",
  "data": {
    "name": "string",
    "description": "string",
    "personality": "string",
    "scenario": "string",
    "first_mes": "string",
    "mes_example": "string",
    "creator_notes": "string",
    "system_prompt": "string",
    "post_history_instructions": "string",
    "alternate_greetings": ["string"],
    "tags": ["string"],
    "creator": "string",
    "character_version": "string",
    "character_book": {
      "name": "string",
      "entries": [...]
    },
    "assets": [...],
    "extensions": {}
  }
}
```

### Extended Fields

| Field                       | Type   | Description                     |
| --------------------------- | ------ | ------------------------------- |
| `creator_notes`             | string | Notes for other creators        |
| `system_prompt`             | string | Custom system instructions      |
| `post_history_instructions` | string | Instructions after chat history |
| `alternate_greetings`       | array  | Multiple first message options  |
| `tags`                      | array  | Categories/tags                 |
| `creator`                   | string | Creator username                |
| `character_version`         | string | Version identifier              |
| `character_book`            | object | Embedded lorebook               |
| `assets`                    | array  | Multimodal assets               |
| `extensions`                | object | Custom extensions               |

### Character Book Structure

```json
{
  "character_book": {
    "name": "Elena's World",
    "description": "Lore for the Library of Shadows setting",
    "entries": [
      {
        "keys": ["library", "shadows"],
        "secondary_keys": ["books", "knowledge"],
        "content": "The Library of Shadows is an ancient repository...",
        "enabled": true,
        "priority": 5,
        "comment": "Core setting info",
        "extensions": {}
      }
    ],
    "extensions": {}
  }
}
```

### Assets Structure

```json
{
  "assets": [
    {
      "type": "image",
      "name": "avatar",
      "uri": "data:image/png;base64,...",
      "ext": "png"
    },
    {
      "type": "image",
      "name": "expression_happy",
      "uri": "data:image/png;base64,...",
      "ext": "png"
    }
  ]
}
```

## Character Studio Internal Format

### Full Character Object

```json
{
  "id": "uuid",
  "name": "string",
  "description": "string",
  "personality": "string",
  "scenario": "string",
  "first_message": "string",
  "example_dialogues": "string",
  "system_prompt": "string",
  "post_history_instructions": "string",
  "tags": ["string"],
  "visibility": "private|public",
  "avatar_url": "string",
  "creator_id": "uuid",
  "space_id": "uuid",
  "model": "string",
  "temperature": 0.7,
  "created_at": "datetime",
  "updated_at": "datetime",
  "version": 1
}
```

## Placeholder Variables

### Standard Placeholders

| Variable   | Description              |
| ---------- | ------------------------ |
| `{{char}}` | Character's name         |
| `{{user}}` | User's name/persona name |

### Usage in Fields

```
"first_mes": "{{char}} waves hello to {{user}}."
```

Becomes:

```
"Elena waves hello to Alex."
```

## Validation Rules

### Required Fields

| Format   | Required             |
| -------- | -------------------- |
| CCv2     | name, first\_mes     |
| CCv3     | name, first\_mes     |
| Internal | name, first\_message |

### Length Limits

| Field        | Max Length   |
| ------------ | ------------ |
| name         | 100 chars    |
| description  | 10,000 chars |
| personality  | 10,000 chars |
| scenario     | 5,000 chars  |
| first\_mes   | 5,000 chars  |
| mes\_example | 20,000 chars |

### Token Recommendations

| Total Definition | Recommended     |
| ---------------- | --------------- |
| 4K models        | < 2,000 tokens  |
| 8K models        | < 4,000 tokens  |
| 128K models      | < 10,000 tokens |

## Format Conversion

### CCv2 → CCv3

```javascript
function ccv2ToCcv3(ccv2) {
  return {
    spec: "chara_card_v3",
    spec_version: "3.0",
    data: {
      ...ccv2,
      alternate_greetings: [],
      tags: [],
      extensions: {}
    }
  };
}
```

### CCv3 → CCv2

```javascript
function ccv3ToCcv2(ccv3) {
  const { data } = ccv3;
  return {
    name: data.name,
    description: data.description,
    personality: data.personality,
    scenario: data.scenario,
    first_mes: data.first_mes,
    mes_example: data.mes_example
  };
}
```

## See Also

* [Character Cards](https://docs.meganova.ai/character-studio/import-export/character-cards.md) — PNG embedding
* [JSON Format](https://docs.meganova.ai/character-studio/import-export/json-format.md) — JSON export
* [Platform Compatibility](https://docs.meganova.ai/character-studio/import-export/platform-compatibility.md) — Cross-platform
