Role — view or change your platform-discovery filter
This skill is the only entry point for the user's role setting. Role is the filter that decides which capabilities the platform surfaces in offers, in /help-me, and in the capability-awareness hook.
When to invoke
Manual: /role — typed by the developer.
Auto-invoke (after explicit confirmation): when the developer asks "what role am I" or "switch me to product" in natural language, offer to run the skill: "רוצה ש /role יציג / יעדכן את התפקיד?". Don't silently change the role — role changes are user decisions.
Argument forms
| Form | Effect |
|---|---|
/role | Print current role + how it filters + source (permanent / session / default). |
/role dev | Set role to dev (permanent). Writes to user_role.md in personal memory. |
/role product | Set role to product (permanent). Writes to user_role.md in personal memory. |
/role dev --session | Set role to dev for this session only (4 h TTL). Writes to ~/.claude/session-state.json. |
/role product --session | Same as above, product. |
Unknown roles (anything other than dev or product) are rejected with a one-line error.
Storage layout
Role is one setting in the unified per-developer config; /role is the
shortcut, /settings the full surface. The canonical store and all
read/write/resolution live in the deterministic helper
scripts/bewith-config.sh — this skill delegates to it rather than editing
files directly.
- Persistent role —
~/.bewith/config.json.role(dev|product). The source of truth. The helper also keeps a write-through copy in the per-project memory fileuser_role.md($HOME/.claude/projects<cwd-with-/-as->/memory/user_role.md, standard memory shape) so the capability-awareness hook keeps resolving correctly during the transition. - Session-only role —
~/.claude/session-state.jsonholds a 4-hour override in the shape{"role": {"value": "product", "expires_at_iso": "…"}}(the helper also reads the legacy flat{"role": "…", "expires_at_iso": "…"}). On read, a pastexpires_at_isois treated as absent.
Resolution order (session override → config → user_role.md fallback → dev)
is implemented once, in the helper. A fresh session override wins over the
persistent value.
Steps Claude runs
Delegate to the helper. Resolve its path first:
CFG="${CLAUDE_PLUGIN_ROOT:-}/scripts/bewith-config.sh"
[ -f "$CFG" ] || CFG="scripts/bewith-config.sh"
/role (no args) — show current
Run bash "$CFG" resolve role and bash "$CFG" source role. Print:
role: <role>
source: <session (expires …) | config | default>
filters: artifacts tagged `audience: <role>` or `audience: both` are surfaced; `audience: <other>` are hidden.
to change: /role <dev|product> (persistent) · /role <dev|product> --session (4h)
/role <role> — set persistent
Run bash "$CFG" role <role>. The helper validates (dev | product), writes config.json, and write-throughs user_role.md. Relay its result line. On a non-zero exit, relay the error and the valid values (dev | product) — do not guess.
/role <role> --session — set session-only
Run bash "$CFG" role <role> --session. The helper writes a 4-hour override to ~/.claude/session-state.json. Relay the result line; the next session reverts to the persistent value.
Edge cases
$ARGUMENTScontains bothdevandproduct→ reject withcannot specify both roles; don't call the helper.$ARGUMENTScontains--sessionwithout a role → reject with--session requires a role: /role <dev|product> --session.- Invalid role → the helper exits non-zero with the valid values; relay them. Don't crash.
How the capability-awareness hook uses this
The hook does NOT execute this skill — it reads the same files independently:
- Reads session-state.json first, checks expiry.
- Falls back to
user_role.md. - Falls back to
dev.
If the hook and this skill diverge in role-resolution logic, this skill is the spec. Keep them in sync via this document.
Cross-references
- Proposal #38 — the design this skill implements (now merged).
docs/methodology/artifact-types.md— theaudiencefrontmatter convention this skill works against..claude/hooks/capability-awareness.sh— the consumer that filters offers by role./help-me— the discovery command that also filters by role.