sema: Command for Claude Code

.claude/commands/swarm-roles.md

swarm-roles is a command for Claude Code from sema-lisp/sema. It costs 0 tokens per session (1,313 once invoked), scanned A, original, MIT.

A method for asking several specialized reviewers to analyze a language-design problem and reach a shared conclusion. The reviewers focus on areas such as evaluation order, parsing, runtime behavior, and testing.

In plain words
What is it for?
Use it to assess syntax, semantics, compiler or interpreter behavior, architecture, and testing choices in the Sema language project.
Why use it?
It reduces the risk of relying on one person's view when a language decision has multiple technical trade-offs. The method also adjusts the number of reviewers to the problem's complexity and stakes.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution.

This is sema-lisp/sema's own configuration. It tells Claude Code how to work on sema itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything sema configures →

Reuse

Borrowing it

Nothing to install: this file belongs to sema-lisp/sema. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/sema-lisp/sema/main/.claude/commands/swarm-roles.md
Clone the repo
git clone --depth 1 https://github.com/sema-lisp/sema

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for swarm-roles

README.md
[![agentmods](https://agentmods.dev/badge/commands/sema-lisp/sema/swarm-roles.svg)](https://agentmods.dev/commands/sema-lisp/sema/swarm-roles)
Your own site
<a href="https://agentmods.dev/commands/sema-lisp/sema/swarm-roles"><img src="https://agentmods.dev/badge/commands/sema-lisp/sema/swarm-roles.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,313 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01313
Opus 5 $0.00000 $0.00656
Sonnet 5 $0.00000 $0.00263
Haiku 4.5 $0.00000 $0.00131

Measured 8d ago against content hash bf83d7a60f6c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

swarm-roles scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/swarm-roles.md · 119 lines

How it starts

The opening of the file, as written. The whole thing — 119 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Swarm Consensus — Sema Role Lenses

You are orchestrating a multi-agent consensus analysis using domain-specific roles tailored to the Sema project. Each agent argues from a specific technical role within language implementation and design.

Step 1 — Determine N from complexity

Assess the problem:

  • Scope: Narrow tactical or broad strategic?
  • Ambiguity: Clear answer or values/tradeoffs?
  • Stakes: How costly is a wrong decision?

Pick N:

Complexity N When
Low 3 Single concern, clear tradeoffs, reversible
Medium 5 Multi-factor, some ambiguity, moderate stakes
High 7 Cross-cutting, high ambiguity, hard to reverse
Critical 10 Strategic direction, high stakes, deeply uncertain

State your chosen N and why before spawning.


Step 2 — Select roles and spawn N agents in parallel

Choose N roles from this list. Pick roles that cover different concerns — don't select three roles that all think about the same thing.

Available Roles

# Role Focus Questions They Ask
1 Semanticist Evaluation order, scoping, closure capture, shadowing, TCO correctness "Does this preserve referential transparency?" "What happens when this is shadowed?"
2 VM Engineer Bytecode lowering, opcode design, stack layout, inline caches, constant folding safety "Can we compile this efficiently?" "Does this need a new opcode or can existing ones compose?"
3 Tree-Walker Defender Interpreter simplicity, trampoline TCO, special form evaluation, debugging ease "Is this implementable in eval_step without complexity explosion?" "Can we step through this?"
4 Stdlib Designer API naming, function signatures, slash-namespacing, discoverability, Scheme compatibility "Does this follow module/verb convention?" "Will users find this?" "Does it conflict with legacy names?"
5 Lisp Historian Precedent in R5RS/R7RS, Common Lisp, Clojure, Racket. What was tried before and why. "How did Racket handle this?" "Why did CL abandon this approach?"
6 Performance Analyst Hot path analysis, allocation pressure, cache behavior, benchmark impact "What's the cost per eval?" "Does this add overhead to the common case?"
7 API Consumer End-user experience, error messages, REPL workflow, documentation, learning curve "What does a beginner see?" "Is the error message actionable?" "Can I discover this from the REPL?"
8 LLM Integration Specialist Provider abstraction, token budgets, streaming, tool use, conversation state, cost tracking "How does this work across providers?" "What happens when the API rate-limits?"
9 Module Architect Import/export, circular dependency prevention, module env isolation, crate boundaries "Does this create a circular dep?" "Which crate owns this?"
10 Safety Auditor Sandbox capabilities, VFS traversal, eval injection, resource exhaustion "Can untrusted code exploit this?" "What's the blast radius?"
11 Dual-Eval Referee Tree-walker and VM must produce identical results for all features "Does this work in both backends?" "Is there a dual_eval test for this?"
12 Embedding Engineer Rust embedding API, InterpreterBuilder, register_fn, sandbox config "Can an embedder use this?" "Does this break the public API?"

Read the full file on GitHub · 119 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 119 lines · 0 tokens per session scan A bf83d7a60f6c

Subscribe to this mod's changes

swarm-roles is a command published in the GitHub repository sema-lisp/sema (41 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,313 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.