Documentation
CharaWeave documentation
Create a character in Studio, learn how the runtime selects actions, and integrate a character into a web or React application.
Start here
Getting started
- Read the root overview and architecture overview.
- Inspect the Simple Cat package.
- Follow First Character and the schema reference.
- Open Studio Web, choose a candidate and compare its settings, effective weights and execution results. Try the Runtime Playground for Host interactions.
- Read the Consumer Integration Manual before binding product surfaces.
Packages are private, version `0.0.0`, and use `workspace:*`. Use the repository workspace. The packages are not published to npm.
pnpm install
pnpm --filter @charaweave/studio devCore concepts
Character, host, runtime and renderer
CharacterDefinition contains validated settings. CharacterSession tracks activities, session history and the selected action. The browser layer executes the action and the renderer draws the result.
Capability, applicability, eligibility, and suppression answer different questions. A supported action may be unavailable because it has no suitable target; suppression reduces its weight without removing it from the supported repertoire.
Read Core Concepts ↗Character Package
Package format
A package provides a versioned manifest, CharacterDefinition, and declared assets. Content loads and validates the package, then returns a typed projection. Package content is data; it does not ship executable behavior.
Character Definition ↗Asset Guide ↗
schemaVersion: 11
capabilities:
autonomousActions:
- inspect
- rest
# V11 source schema exampleCharacterDefinition V11 is the current source schema. Public Content projections are independently versioned; choose V11 when you need repertoire fields.
Examples
Example packages and applications
Simple Cat is a V7 example package. Runtime Playground demonstrates character behavior, while Host Binding Playground demonstrates React element registration without a character runtime.
Behavior
How autonomous actions are selected
Action Repetition adjusts the weight of consecutive completed actions of the same kind by 1.00, 0.70, 0.45 and 0.30 for streaks of 0, 1, 2 and 3 or more. Target history is tracked separately.
Behavior Selection ↗Temporal Behavior ↗Environment behavior
Behavior without registered targets
In Studio and Playground, CharacterSession uses its life state and motivation to choose an episode. The shared browser driver moves the character within the stage or runs rest and sleep without host targets, then reports the result. A supported rest repertoire entry is not itself an automatic threshold. The public API has no numeric rest-threshold setting.
Presentation
Animation bindings
Idle, locomotion, action phases, reactions, and Recovery are semantic states connected to authored bindings. The renderer loads assets and advances frames. Bindings determine when a clip plays. ActivityOwnership prevents competing activities from controlling the character at once.
Host Integration
Registering application targets
Register a stable ID, role, DOM element and capabilities for each target. CharaWeave chooses actions and checks that the target is still registered; your app supplies callbacks and renders the character.
Browser example: attach a semantic target
Given the existing BrowserEnvironment and application-owned element and callback:
const registration = browser.attachHost({
element: cardElement,
id: "feed.photo.42",
role: "photo-card",
capabilities: ["activate"],
onActivate: async ({ surfaceId }) => openPhoto(surfaceId),
});
// Call when the element unmounts or refers to a different product object.
registration.detach();Detach on unmount or semantic identity change; stop active execution before disposing the owning session.
React Integration
React integration options
@charaweave/react binds the standard Core/Browser V10 facade; @charaweave/react-browser binds the Platform V6 helper; @charaweave/react-host-browser binds caller-owned Host services. See the React guide for examples of each integration.
Platform helper example (Content V6 composition)
import { ConsumerSessionProvider, useConsumerHost } from "@charaweave/react-browser";
import type { ConsumerSession } from "@charaweave/platform";
import type { BrowserEnvironment } from "@charaweave/platform/browser";
import type { ReactNode } from "react";
declare function openPhoto(surfaceId: string): Promise<void>;
function PhotoCard({ id }: { id: string }) {
const ref = useConsumerHost<HTMLButtonElement>({
id: `feed.photo.${id}`,
role: "photo-card",
capabilities: ["activate"],
onActivate: ({ surfaceId }) => openPhoto(surfaceId),
});
return <button ref={ref} aria-label={`Open photo ${id}`}>Open photo</button>;
}
function CharacterHost({
session, browser, children,
}: {
session: ConsumerSession; browser: BrowserEnvironment; children: ReactNode;
}) {
return (
<ConsumerSessionProvider session={session} browser={browser}>
{children}
</ConsumerSessionProvider>
);
}For caller-owned registry, geometry and actions, use CharaHostProvider and useCharaSurface from @charaweave/react-host-browser. V11 repertoire integration is not a one-call ConsumerSession helper.
Studio
Creating and testing characters
Use Assets to browse candidates, Editor to build a character, Runtime Lab to test actions, and Package to export or import .chara files. Desktop development builds add editable .cwproject files, recovery and appearance settings.
Detailed Manuals
Detailed manuals
Browse all hosted guides, manuals and references →
The manuals cover character creation, execution and application integration.
API reference
Runtime API
createCharaWeaveRuntime from @charaweave/runtime creates ordinary runtime characters and handles touch, snapshots and disposal. It does not implement the complete V11 autonomous composition by itself.
import { createCharaWeaveRuntime } from "@charaweave/runtime";
const runtime = createCharaWeaveRuntime();
const character = runtime.createCharacter({
instanceId: "example:cat-instance",
characterDefinitionId: "example.simple-cat:cat",
});
const touch = await runtime.touch({
type: "character.touch",
commandId: "example:touch:1",
instanceId: character.instanceId,
expectedRevision: character.revision,
});
console.log(touch.status, runtime.getSnapshot(character.instanceId));
runtime.dispose();Use loadCharacterContentV11 in @charaweave/content for the explicit V11 content projection. Public Platform currently projects V6; Public Core consumes V10. The SDK is not published to npm. See the Host and React sections for integration APIs.
Reference and support
Troubleshooting and reference
When a character is invisible, verify required asset requests/decoding and anchor/scale. For no-selection, check capability, applicability, eligibility and mass in order. Stop Runtime before manual controls; Reset does not delete draft data. See the references below for the API and schema. Access to source files requires repository permission.
Runtime API ↗Character Schema ↗Behavior & Personality Reference ↗Terminal Reference ↗No AI controller, cross-session long-term memory, marketplace, arbitrary behavior DSL, npm distribution, or universal renderer. The application registers its own targets.