Masques
CLAUDE.md14 starsChanged 6 months agoApache-2.0View on GitHub
Masques applies theater's ancient coordination model to AI agents. Just as actors don costumes, adopt roles, and operate within defined boundaries — then step backstage to become themselves again — agents can temporarily assume identities called masques. The core problem: today agents get configured through scattered mechanisms (system prompts, MCP servers, credentials, knowledge bases, tool permissions). These are disconnected. A masque unifies cognitive identity into a single "become this" operation — one don, one doff, session over. Masques is "AssumeRole…
- Reads credentials
- Commits and pushes
In this repositoryOne other file it gives its agents.
- AGENTS.mdAGENTS.md
The file
We split this CLAUDE.md into the rules it gives an agent
9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 27
Every masque is a YAML file with three required fields and three optional fields.
- Distinctive: line 169
No heap allocations in the hot path — static cell buffers, fixed-size particle arrays
- Distinctive: line 288
Run quality gates if code changed
- Very specific: line 289
Update issue status (bd close)
- Distinctive: line 291
Verify with git status — must show "up to date with origin"
- Distinctive: line 297
DuckDB is ephemeral: No persistent state. Reads JSONL, scores in-memory, outputs YAML.
- Very specific: line 298
No hardcoded credentials: Use .env patterns with .env.example templates.
- Very specific: line 322
Update marketplace.json version (must match)
- Distinctive: line 324
Commit with message: "Bump to vX.Y.Z"
≈ “Common” is an estimate: at least 1 in 5 of the 28,633 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Purpose
Masques applies theater's ancient coordination model to AI agents. Just as actors don costumes, adopt roles, and operate within defined boundaries — then step backstage to become themselves again — agents can temporarily assume identities called masques.
The core problem: today agents get configured through scattered mechanisms (system prompts, MCP servers, credentials, knowledge bases, tool permissions). These are disconnected. A masque unifies cognitive identity into a single "become this" operation — one don, one doff, session over.
Masques is "AssumeRole for Agents." A masque is a temporary cognitive identity bundling lens (how to think), context (situational grounding), and attributes (metadata). It's a representation tool that slaps on top of any agent — don, work, doff.
What Masques Own (and Don't)
Masques own cognitive identity — nothing else. Separation of concerns:
| Need | Masques | Who Handles It |
| Identity & framing | Lens + context | Masque itself |
| Knowledge lookup | Declares need | MCP servers |
| Credentials | Declares need | Vault/credential managers |
| Tool bundles | Declares capability | Claude Code MCP config |
| Performance tracking | Declares interest | Observability (OTEL) |
Masque Schema
Every masque is a YAML file with three required fields and three optional fields. The schema is intentionally minimal.
Required Fields
name: string # Human-readable identifier (minLength: 1)
version: "x.y.z" # Semantic version (pinned — upgrading is deliberate, not automatic)
lens: | # Cognitive framing — the core of the masque
How to think, how to work, what to refuse.
This is intent guidance as prose.Optional Fields
attributes: # Flexible key-value metadata (additionalProperties: true)
domain: string # Primary domain (e.g., "systems-programming")
tagline: string # One-line promise (e.g., "every line should teach")
style: string # Working style description
philosophy: string # Core philosophy
# Any additional keys are allowed
context: | # Situational grounding
Who you're helping. What they value.
What's the operational environment.
spinnerVerbs: # Custom activity indicators
mode: replace # replace | append | prepend
verbs: # min 1 item
- "Masque:Verbing" # e.g., "Codesmith:Forging"What Each Field Means
Lens is the identity. It defines how to think, not just what to do:
- Core principles and beliefs
- Working style and approach
- Priorities and heuristics
- Boundaries — what to do, what to avoid, what to refuse
- A good lens reads as natural prose and keeps all behavioral guidance in one place
Context is the situation. It grounds the identity in a real scenario:
- Who you're helping and what they value
- Constraints of the environment
- What matters right now
Attributes are metadata for discovery and display — domain, tagline, style. They describe the masque without affecting behavior directly.
SpinnerVerbs give the masque a visual presence during work — custom activity messages.
What Makes a Good Masque
- Clear boundaries — explicit about what to refuse
- Specific context — grounded in a real situation with real constraints
- Coherent lens — core principles reinforce each other
- Self-awareness — knows its occupational hazards (shadow awareness)
- Actionable guidance — not just values, but how to work
- Appropriate scope — focused enough to be coherent, broad enough to be useful
Session Lifecycle
- Don — agent assumes masque (context + lens injected, spinner verbs applied)
- Work — agent operates with full identity context
- Doff — session ends (state cleared, returns to baseline)
Versions are pinned. If an author updates a masque, you keep using the version you donned until you consciously upgrade. This is opposite to typical prompt evolution (which silently upgrades).
Two Delivery Surfaces
1. Claude Code Plugin
The primary interface. Eight slash commands for identity management:
/don <masque> [intent] # Adopt a masque identity
/doff # Return to baseline Claude
/id # Show current identity state
/list # List available masques (reads from manifests)
/inspect [masque] # Detailed masque introspection
/sync-manifest [scope] # Regenerate manifest files for fast listing
/audience [action] # Manage telemetry observers (start/stop/status/config/logs)
/performance # Show masque performance scoring from telemetry dataState persists in .claude/masque.session.yaml:
active:
name: Codesmith # null if no masque active
source: shared # "private" or "shared"
donned_at: 2026-01-26T12:00:00Z
previous:
name: Firekeeper
source: private
doffed_at: 2026-01-26T11:00:00Z2. TUI — masques
A Zig terminal application for visually composing masque teams. Lives in tui/.
Purpose: Interactive team drafting — browse masques in an animated grid, select members, assign roles, save team compositions.
Two-screen design:
- Lobby — browse saved teams from
~/.masques/*.team.yaml, create new ones - Draft — three-panel workspace:
- Left: filterable grid of masque portrait cards (6 tabs: All, Executive, Cognitive, Specialist, Art, Meta)
- Right: detail panel with animated theatrical mask + metadata (name, version, domain, lens excerpt)
- Bottom: team roster with role assignment (Point/Coach) and synergy indicators
Build and run:
cd tui && zig build # Compile
cd tui && zig build run # Run immediatelyRequires Zig 0.16.0+. Dependencies: libvaxis (TUI framework, fetched), and zig-yaml (YAML parsing) — vendored under tui/vendor/zig-yaml because upstream's build.zig doesn't yet compile under Zig 0.16.
Writes to: ~/.masques/{name}.team.yaml — team composition files loadable from the lobby.
TUI Source Map (tui/src/)
| Module | Lines | Purpose |
main.zig | ~780 | Event loop, screen routing (lobby/draft), keyboard handling, 30fps animation tick |
masque.zig | ~420 | Masque struct, YAML manifest loading, detail loading, categorization, complement pairs |
state.zig | ~200 | AppState: cursor positions, selections, team members, focus state, screen mode |
detail.zig | ~400 | Detail panel — large theatrical mask + metadata rendering |
lobby.zig | ~340 | Lobby screen — team file discovery, navigation, team creation |
grid.zig | ~250 | Portrait card grid — dynamic columns, cursor/selection state |
roster.zig | ~180 | Team roster — slots, role assignment (Point/Coach), synergy |
writer.zig | ~150 | Serialize team state to .team.yaml |
portrait.zig | ~350 | Animated ASCII art per masque with state machine (idle/selecting/selected/deselecting/confirming) |
layout.zig | ~100 | Dynamic panel position/size calculator |
color.zig | ~200 | Domain-to-RGB color mapping (30+ domains, primary/dim/bright) |
mask.zig | ~200 | 5 theatrical mask shapes (classic, sovereign, cerebral, theatrical, geometric) |
particle.zig | ~80 | Fixed-size particle system (64 max) for burst/spark effects |
math.zig | ~100 | Sin/cos LUTs, Xorshift32 PRNG, FNV-1a hash, lerp |
gradient.zig | ~150 | Character density gradients, domain-specific glyph sets |
patterns/ | ~800 | 10 domain-specific pattern generators for animated portraits |
Technical approach:
- No heap allocations in the hot path — static cell buffers, fixed-size particle arrays
- Lookup tables over runtime math — sin/cos, character density, color mapping all precomputed
- Deterministic randomness — Xorshift32 PRNG seeded per masque name hash
- 30fps animation driven by background thread tick
Architecture
Telemetry is optional and entirely separate from donning a masque. When enabled, two databases each do what they're best at:
- ClickHouse — Analytics (optional). Remote sink for OTEL metrics/logs from the collector; auto-creates its schema. Columnar, cost-efficient at scale. Leave it unset to keep everything local.
- DuckDB — Local performance scoring. Reads OTEL JSONL exports from the collector, scores masque sessions across 5 dimensions. Zero-infrastructure, ephemeral.
Data flow (only when telemetry is enabled):
Agent dons masque → session state written (no infra required)
↓
OTEL metrics/logs → Collector → ClickHouse (remote, optional) + JSONL (local)
↓
DuckDB reads JSONL → scores session → /performance outputs YAMLDirectory Structure
~/.masques/ # Private masques (user's home)
├── manifest.yaml # Auto-generated listing cache
├── *.masque.yaml # Private masque definitions
└── *.team.yaml # Saved team compositions (from masque TUI)
masques/ # Plugin repo root
├── CLAUDE.md # This file
├── AGENTS.md # Agent session workflow (landing the plane)
├── .claude-plugin/
│ └── plugin.json # Plugin manifest (name, version, description)
├── commands/ # Plugin slash commands (Markdown specs)
│ ├── don.md # /don <masque> - adopt identity
│ ├── doff.md # /doff - return to baseline
│ ├── id.md # /id - show current identity
│ ├── list.md # /list - list masques
│ ├── inspect.md # /inspect - detailed view
│ ├── sync-manifest.md # /sync-manifest - regenerate manifests
│ ├── audience.md # /audience - manage telemetry observers
│ └── performance.md # /performance - telemetry performance scoring
├── personas/ # Shared masque definitions (30+ YAML files)
│ ├── manifest.yaml # Auto-generated listing cache
│ ├── codesmith.masque.yaml
│ ├── firekeeper.masque.yaml
│ ├── mirror.masque.yaml
│ ├── witness.masque.yaml
│ └── ... # 25+ more across domains
├── schemas/
│ └── masque.schema.yaml # JSON Schema for masque validation
├── services/
│ ├── collector/ # OTEL collector (Docker)
│ │ ├── config.yaml # Dual export: ClickHouse + JSONL
│ │ └── docker-compose.yml
│ └── judge/ # DuckDB performance scoring
│ ├── judge.sh # Entry point — runs DuckDB, outputs YAML
│ ├── sessions.sql # Extract session boundaries from JSONL
│ └── score.sql # 5-dimension scoring + composite
├── tui/ # Terminal UI — masque
│ ├── build.zig # Zig build config (v0.16.0+)
│ ├── build.zig.zon # Dependency manifest (vaxis, zig-yaml)
│ ├── vendor/zig-yaml/ # Vendored YAML lib (0.16-compatible build.zig)
│ └── src/ # Source (see TUI Source Map above)
├── evals/ # Promptfoo behavioral fidelity tests
│ ├── codesmith/
│ ├── chartwright/
│ ├── firekeeper/
│ └── mirror/
└── docs/
├── vision.md # Theater metaphor and philosophy
├── concepts.md # Components explained
├── schema.md # Schema reference guide
├── otel-setup.md # Telemetry pipeline setup
└── future/ # Deferred vision (agent marketplace, payments)Masque Discovery
Masques are loaded from two locations (private takes precedence):
- Private:
${MASQUES_HOME:-~/.masques}/*.masque.yaml— personal, not version controlled - Shared:
${CLAUDE_PLUGIN_ROOT}/personas/*.masque.yaml— bundled with plugin, version controlled
Manifests (manifest.yaml in each location) provide fast listing without scanning every file. Regenerate with /sync-manifest.
Development Workflow
Issue Tracking — Beads (bd)
bd ready # Find available work (unblocked, unassigned)
bd show <id> # View issue details
bd update <id> --status=in_progress # Claim work
bd close <id> # Complete work
bd sync # Sync with git remoteBuilding
# TUI
cd tui && zig build # Compile masque TUI
cd tui && zig build run # Run the TUI
# Evals
promptfoo eval -c evals/codesmith/promptfooconfig.yaml
promptfoo view # Interactive results UI
# Services
docker compose -f services/collector/docker-compose.yml up # OTEL collectorSession Completion
Work is NOT complete until git push succeeds. See AGENTS.md for the full checklist:
- File issues for remaining work (
bd create) - Run quality gates if code changed
- Update issue status (
bd close) - Push to remote:
git pull --rebase && bd sync && git push - Verify with
git status— must show "up to date with origin"
Database Conventions
- Telemetry is optional. Donning a masque never requires a database. ClickHouse and DuckDB only come into play if you enable the collector.
- ClickHouse is analytics only. The collector auto-creates its schema; there are no migrations to run.
- DuckDB is ephemeral. No persistent state. Reads JSONL, scores in-memory, outputs YAML.
- No hardcoded credentials. Use
.envpatterns with.env.exampletemplates. - Writes to files, not databases. DDL and DML are output for human review, not executed directly.
Design Principles
- Simple — lens, context, attributes. That's the whole identity.
- Session-scoped — masques are temporary. Don, work, doff.
- Versioned — pin to versions, upgrade deliberately, never silently.
- Plugin-first — YAML source, Claude Code delivery.
- Slaps on top of any agent — masques are a representation layer, not infrastructure. Core identity needs zero databases.
- Telemetry is optional — ClickHouse (analytics) and DuckDB (local scoring) measure sessions when you want them to, and are never required.
- Separation of concerns — masques own identity. MCP owns knowledge. Vaults own credentials. Observability owns metrics.
Version Management
Plugin version must be updated in two files that must stay in sync:
| File | Field | Purpose |
.claude-plugin/plugin.json | version | Plugin manifest (Claude Code reads this) |
.claude-plugin/marketplace.json | plugins[0].version | Marketplace listing |
Bump checklist (when releasing a new version):
- Update
plugin.jsonversion - Update
marketplace.jsonversion (must match) - Add CHANGELOG.md entry
- Commit with message: "Bump to vX.Y.Z"
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

