agentleFS
ChrisDBaldwinChrisDBaldwin/Masques/CLAUDE.md

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.

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
  1. Distinctive:

    Every masque is a YAML file with three required fields and three optional fields.

    line 27
  2. Distinctive:

    No heap allocations in the hot path — static cell buffers, fixed-size particle arrays

    line 169
  3. Distinctive:

    Run quality gates if code changed

    line 288
  4. Very specific:

    Update issue status (bd close)

    line 289
  5. Distinctive:

    Verify with git status — must show "up to date with origin"

    line 291
  6. Distinctive:

    DuckDB is ephemeral: No persistent state. Reads JSONL, scores in-memory, outputs YAML.

    line 297
  7. Very specific:

    No hardcoded credentials: Use .env patterns with .env.example templates.

    line 298
  8. Very specific:

    Update marketplace.json version (must match)

    line 322
  9. Distinctive:

    Commit with message: "Bump to vX.Y.Z"

    line 324

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

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:

NeedMasquesWho Handles It
Identity & framingLens + contextMasque itself
Knowledge lookupDeclares needMCP servers
CredentialsDeclares needVault/credential managers
Tool bundlesDeclares capabilityClaude Code MCP config
Performance trackingDeclares interestObservability (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

  1. Don — agent assumes masque (context + lens injected, spinner verbs applied)
  2. Work — agent operates with full identity context
  3. 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 data

State 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:00Z

2. 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 immediately

Requires 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/)

ModuleLinesPurpose
main.zig~780Event loop, screen routing (lobby/draft), keyboard handling, 30fps animation tick
masque.zig~420Masque struct, YAML manifest loading, detail loading, categorization, complement pairs
state.zig~200AppState: cursor positions, selections, team members, focus state, screen mode
detail.zig~400Detail panel — large theatrical mask + metadata rendering
lobby.zig~340Lobby screen — team file discovery, navigation, team creation
grid.zig~250Portrait card grid — dynamic columns, cursor/selection state
roster.zig~180Team roster — slots, role assignment (Point/Coach), synergy
writer.zig~150Serialize team state to .team.yaml
portrait.zig~350Animated ASCII art per masque with state machine (idle/selecting/selected/deselecting/confirming)
layout.zig~100Dynamic panel position/size calculator
color.zig~200Domain-to-RGB color mapping (30+ domains, primary/dim/bright)
mask.zig~2005 theatrical mask shapes (classic, sovereign, cerebral, theatrical, geometric)
particle.zig~80Fixed-size particle system (64 max) for burst/spark effects
math.zig~100Sin/cos LUTs, Xorshift32 PRNG, FNV-1a hash, lerp
gradient.zig~150Character density gradients, domain-specific glyph sets
patterns/~80010 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 YAML

Directory 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):

  1. Private: ${MASQUES_HOME:-~/.masques}/*.masque.yaml — personal, not version controlled
  2. 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 remote

Building

# 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 collector

Session Completion

Work is NOT complete until git push succeeds. See AGENTS.md for the full checklist:

  1. File issues for remaining work (bd create)
  2. Run quality gates if code changed
  3. Update issue status (bd close)
  4. Push to remote: git pull --rebase && bd sync && git push
  5. 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 .env patterns with .env.example templates.
  • Writes to files, not databases. DDL and DML are output for human review, not executed directly.

Design Principles

  1. Simple — lens, context, attributes. That's the whole identity.
  2. Session-scoped — masques are temporary. Don, work, doff.
  3. Versioned — pin to versions, upgrade deliberately, never silently.
  4. Plugin-first — YAML source, Claude Code delivery.
  5. Slaps on top of any agent — masques are a representation layer, not infrastructure. Core identity needs zero databases.
  6. Telemetry is optional — ClickHouse (analytics) and DuckDB (local scoring) measure sessions when you want them to, and are never required.
  7. 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:

FileFieldPurpose
.claude-plugin/plugin.jsonversionPlugin manifest (Claude Code reads this)
.claude-plugin/marketplace.jsonplugins[0].versionMarketplace listing

Bump checklist (when releasing a new version):

  1. Update plugin.json version
  2. Update marketplace.json version (must match)
  3. Add CHANGELOG.md entry
  4. Commit with message: "Bump to vX.Y.Z"

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.