Agent skill

Semi Trusted Roles

by PlamenTSV in PlamenTSV/plamen

Trigger Pattern SEMITRUSTEDROLE flag (required) - Inject Into Breadth agents, depth-state-trace

MITAuto-check passed

Install Semi Trusted Roles

skills CLI
$ npx skills add PlamenTSV/plamen --skill semi-trusted-roles -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install PlamenTSV/plamen semi-trusted-roles --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/PlamenTSV/plamen.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agents/skills/sui/semi-trusted-roles .claude/skills/semi-trusted-roles && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
semi-trusted-roles
GitHub stars
303
Token cost
~3.4k tokens
SKILL.md length
1,151 words
Files
1
Skills in repo
87
Repo updated
First seen
Licence
MIT

At a glance

Trigger Pattern SEMITRUSTEDROLE flag (required) - Inject Into Breadth agents, depth-state-trace

  • Works in 6 steps: Inventory Role Permissions → Analyze Within-Scope Abuse → Model Attack Scenarios → …
  • Pattern SEMITRUSTEDROLE flag (required) - Inject Into Breadth agents
  • SKILL.md covers Trigger Patterns, Reasoning Template, Common False Positives and Instantiation Parameters, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Semi Trusted Roles is an agent skill from PlamenTSV/plamen. Trigger Pattern SEMITRUSTEDROLE flag (required) - Inject Into Breadth agents, depth-state-trace

Its SKILL.md is about 3.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: Autonomous Web3 security audit agent for Claude Code. The licence is MIT.

When your agent uses it

  • Pattern SEMITRUSTEDROLE flag (required) - Inject Into Breadth agents
  • Depth-state-trace

Example prompts

  • “/semi-trusted-roles”

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Inventory Role Permissions
  2. Analyze Within-Scope Abuse
  3. Model Attack Scenarios
  4. Assess Mitigations
  5. Model User-Side Exploitation (Reverse Direction)
  6. Precondition Griefability Check

What it can do on your machine

Read from SKILL.md and the folder at commit 795962b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Semi Trusted Roles loads about 3.4k tokens when it runs. Until then it costs about 29 tokens; SKILL.md has 1,151 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~29
When it runs · the whole SKILL.md, loaded when a task matches
~3.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from PlamenTSV/plamen at commit 795962b, republished under its MIT licence (© PlamenTSV). 1,151 words, ~3,380 tokens.

Download SKILL.mdSave it as .claude/skills/semi-trusted-roles/SKILL.md (or your agent's skills folder).
name
semi-trusted-roles
description
Trigger Pattern SEMI_TRUSTED_ROLE flag (required) - Inject Into Breadth agents, depth-state-trace

Skill: Semi-Trusted Role Analysis (Sui)

Trigger Pattern: SEMI_TRUSTED_ROLE flag (required) Inject Into: Breadth agents, depth-state-trace Purpose: Analyze capability-based privilege model in Sui Move protocols for both role-to-user and user-to-role attack vectors

Trigger Patterns

AdminCap|OwnerCap|TreasuryCap|OperatorCap|KeeperCap|GovernanceCap|
MinterCap|ManagerCap|UpgradeCap|PublisherCap|has_cap|assert_cap|
capability|cap_check|admin_only

Reasoning Template

Step 1: Inventory Role Permissions

Enumerate ALL capability objects in the protocol:

Capability TypeAbilitiesHolderFunctions CallableState ModifiableTransferable?
{AdminCap}{key, store?}{deployer/multisig}{list all functions requiring &AdminCap}{list state}{YES if has store / NO if only key}

Sui capability model:

  • Capabilities are owned objects. Holding the object = having the role.
  • key ability: object can exist on-chain. Transferred with transfer::transfer (module-only) or transfer::public_transfer (if also has store).
  • key + store: freely transferable by anyone. High risk -- capability can be sent to arbitrary addresses.
  • key only: transferable only by the defining module's functions. Lower risk -- controlled transfer.
  • Capabilities are checked by reference: fun admin_action(cap: &AdminCap, ...) -- presence of reference proves ownership.

For each capability at {CAPABILITY_OBJECTS}:

  • What state does it grant access to modify?
  • What external calls does it authorize?
  • What parameters does it allow setting?
  • Is the capability shared (share_object) or owned? Shared caps are NOT single-holder.
Step 2: Analyze Within-Scope Abuse

For each permitted action, ask:

Timing Abuse:

  • Can {ROLE_NAME} execute at harmful times? (front-run users via shared object contention, during rebalance)
  • Can {ROLE_NAME} delay execution to harm users? (withhold keeper actions)

Parameter Abuse:

  • Can {ROLE_NAME} pass harmful parameters? (max slippage, wrong recipient, extreme fee)
  • Are parameters validated against bounds, or trusted implicitly?

Sequence Abuse:

  • Can {ROLE_NAME} execute operations out of order?
  • Can {ROLE_NAME} skip required operations in a multi-step flow?

Omission Abuse:

  • Can {ROLE_NAME} harm users by NOT acting? (skip price update, delay distribution, not calling keeper function)
Step 3: Model Attack Scenarios
Scenario A: Timing Attack
1. {ROLE_NAME} monitors pending transactions on shared objects
2. {ROLE_NAME} submits transaction to modify shared object state
3. Due to Sui's object-based execution, contention determines ordering
4. User's transaction executes with worse conditions
5. Impact: {TIMING_IMPACT}

Scenario B: Parameter Attack
1. {ROLE_NAME} calls {ROLE_FUNCTION} with {MALICIOUS_PARAMS}
2. Parameters are not validated against {EXPECTED_CONSTRAINTS}
3. Impact: {PARAM_IMPACT}

Scenario C: Key Compromise / Capability Theft
1. {ROLE_NAME} capability object is transferred to attacker
2. If cap has `store` ability: attacker can receive it via `transfer::public_transfer`
3. Attacker can call: {ROLE_FUNCTIONS}
4. Maximum extractable value: {MAX_DAMAGE}
5. Recovery options: {RECOVERY_PATH}
   - Can a higher-level cap revoke or re-create the compromised cap?
   - Is there an UpgradeCap that can patch the module?

Scenario C2: Shared Capability Abuse
1. {ROLE_NAME} capability is a shared object (created via `transfer::share_object`)
2. ANY user can include the shared cap in their PTB as `&SharedCap` reference
3. Attacker calls admin functions by passing the shared cap reference
4. Attacker can atomically compose admin operations with exploitation in a single PTB
5. Maximum extractable value: {MAX_DAMAGE}
6. NOTE: Shared caps effectively give EVERYONE the admin role -- this is almost always a critical finding
Step 4: Assess Mitigations
MitigationPresent?Effective?
Timelock on {ROLE_NAME} actionsYES/NO{clock-based delay?}
Multisig ownership (Sui multisig or custom)YES/NO{threshold?}
Removal/revocation function for {ROLE_NAME}YES/NO{who can revoke?}
Rate limits or cooldowns (clock-based)YES/NO{duration?}
Parameter bounds enforcementYES/NO{min/max checked?}
UpgradeCap held separatelyYES/NO{who holds it?}

Does a removal/revocation function for {ROLE_NAME} EXIST? If NO -> FINDING: capability is irrevocable without module upgrade. Severity: minimum Medium if cap can modify user-facing state.

Capability transfer control:

  • If cap has store: anyone holding it can transfer freely. Is this intended?
  • If cap has only key: only module functions can transfer. Are those functions properly access-controlled?
  • Is there a destroy function for the capability? If NO and cap has store: it can never be burned.
  • Is the capability frozen (immutable via transfer::freeze_object)? Frozen caps can be read (&Cap) but not consumed or mutated -- limits authorized actions to read-only gating.

PTB composition risk: Can the capability holder compose a PTB that atomically: (1) changes parameters via admin function, (2) exploits the changed parameters via user function? If YES and cap is owned by a semi-trusted role -> the role can atomically manipulate + exploit without time for users to react.

Step 5: Model User-Side Exploitation (Reverse Direction)

Predictability Analysis:

  • Is the role's behavior predictable? (scheduled tasks, triggered by events, epoch-based)
  • Can users observe when the role will act via on-chain state?
  • Can users front-run or back-run the role's actions via shared object contention?

Scenario D: User Exploits Keeper Timing

1. User observes that {ROLE_NAME} executes {ROLE_ACTION} at predictable times (e.g., epoch boundaries)
2. User positions themselves before {ROLE_ACTION} (deposit/stake before reward distribution)
3. {ROLE_ACTION} executes, changing state
4. User benefits from known state change
5. Impact: {USER_EXPLOIT_IMPACT}

Scenario E: User Griefs Role Preconditions

1. {ROLE_FUNCTION} has precondition: {PRECONDITION} (stored in shared object)
2. User calls a permissionless function that modifies the shared object to violate {PRECONDITION}
3. {ROLE_NAME} calls {ROLE_FUNCTION}, which aborts
4. System enters degraded state (no keeper actions possible)
5. Impact: {GRIEF_IMPACT}

Scenario F: User Forces Suboptimal Role Action

1. {ROLE_NAME} must choose between options based on shared object state
2. User manipulates shared object state to make worst option appear best
3. {ROLE_NAME} (following honest behavior) chooses suboptimal path
4. User profits from forced suboptimal execution
5. Impact: {SUBOPTIMAL_IMPACT}

Scenario G: Same-Chain Rate Staleness via Discrete Updates

1. Protocol's exchange rate only updates when {ROLE_NAME} acts (discrete updates)
2. Between role actions, rate is stale -- does not reflect accumulated value
3. User monitors for {ROLE_NAME} pending transaction on shared object
4. User enters at stale rate (favorable), {ROLE_NAME} executes, rate updates
5. User exits at updated rate (or holds appreciating position)
6. Impact: {RATE_ARBIT_IMPACT}
Step 6: Precondition Griefability Check

For each function callable by {ROLE_NAME}:

FunctionPreconditionsStored InUser Can Manipulate?Grief Impact
{func}balance > 0Shared pool objectYES - withdraw allKeeper stuck
{func}epoch elapsedClock (0x6)NO - time-basedN/A
{func}threshold metShared config objectYES - partial withdrawDelayed execution

Generic Rule: Any admin/keeper function precondition that depends on user-modifiable shared object state is potentially griefable.

Sui-specific griefability: Shared object contention can cause transaction ordering issues. If a keeper transaction and a user transaction both touch the same shared object, Sui's consensus determines ordering -- neither party can guarantee priority.

Show full SKILL.md (505 more words)Show less
Step 6b: Admin/Privileged Function Griefability (EXHAUSTIVE)

MANDATORY: Enumerate ALL functions that require a capability parameter. Do NOT rely on manual scanning -- grep for all capability types found in Step 1.

For each function requiring ANY capability:

FunctionRequired CapPreconditionsShared Object Dependency?User Can Manipulate?Grief Impact
{admin_fn}{AdminCap}{preconditions}YES/NOYES/NO{impact if griefed}

Enumeration completeness check:

  • Grep count for functions accepting capability references: {N}
  • Functions analyzed in this table: {M}
  • If M < N -> INCOMPLETE -- analyze missing functions before proceeding

Specific checks:

  • Can users create shared object state that blocks admin operations? (pending withdrawals blocking migration, non-zero balances blocking cleanup)
  • Can users create dynamic field entries that block operations? (table entries preventing deletion)
  • Can users initiate multi-step operations whose in-flight state blocks admin actions?

RULE: If ANY admin function has a user-griefable precondition -> severity >= MEDIUM if it blocks critical protocol operations.

Key Questions (must answer all)
  1. What is the maximum damage if {ROLE_NAME} acts maliciously?
  2. What is the maximum damage if {ROLE_NAME} capability is stolen?
  3. Are there time-sensitive operations where {ROLE_NAME} timing matters?
  4. What user funds or protocol state can {ROLE_NAME} affect?
  5. Can users predict when {ROLE_NAME} will act?
  6. Can users manipulate preconditions to block {ROLE_NAME}?
  7. Can users profit by positioning around {ROLE_NAME}'s scheduled actions?
  8. What happens if {ROLE_NAME} cannot execute? (system degradation)
  9. Can users block admin operations via shared object state manipulation?

Common False Positives

  • View-only operations: If role can only read state, no abuse vector
  • Idempotent operations: If calling twice has same effect as once, timing abuse is limited
  • User-initiated dependency: If role action requires user to initiate first, front-running may not apply
  • Economic alignment: If role is economically aligned (staked collateral), malicious action has cost
  • Module-locked capability: If cap has only key and no transfer function exists, theft requires module compromise

Instantiation Parameters

{CONTRACTS}           -- Move modules to analyze
{ROLE_NAME}           -- Specific capability type (AdminCap, OperatorCap, etc.)
{CAPABILITY_OBJECTS}  -- Capability object types and their abilities
{ROLE_FUNCTIONS}      -- Functions this capability grants access to
{USER_ACTION}         -- User action that could be front-run
{ROLE_ACTION}         -- Role action used in attack
{TIMING_IMPACT}       -- Impact of timing attack
{MALICIOUS_PARAMS}    -- Harmful parameter values
{EXPECTED_CONSTRAINTS}-- What params should be validated against
{PARAM_IMPACT}        -- Impact of parameter attack
{MAX_DAMAGE}          -- Maximum extractable value
{RECOVERY_PATH}       -- How to recover from compromise

Output Schema

FieldRequiredDescription
capability_inventoryyesAll capability objects and their permissions
timing_vectorsyesTiming-based abuse opportunities
parameter_vectorsyesParameter-based abuse opportunities
omission_vectorsyesHarm from inaction
user_exploit_vectorsyesHow users can exploit the role (reverse direction)
transfer_riskyesCapability transferability analysis
max_damageyesWorst-case damage assessment
mitigationsyesExisting protections
findingyesCONFIRMED / REFUTED / CONTESTED / NEEDS_DEPTH
evidenceyesCode locations with line numbers
step_executionyesStatus for each step

Step Execution Checklist (MANDATORY)

StepRequiredCompleted?Notes
1. Inventory Role PermissionsYES
2. Analyze Within-Scope AbuseYES
3. Model Attack Scenarios (A,B,C,C2)YESIncluding shared cap scenario
4. Assess MitigationsYES
5. Model User-Side Exploitation (D,E,F,G)YESMANDATORY -- never skip
6. Precondition Griefability CheckYESMANDATORY -- never skip
6b. Admin Function GriefabilityYESMANDATORY -- never skip
Cross-Reference Markers

After Step 4 (Assess Mitigations):

  • DO NOT STOP HERE -- Steps 5-6 analyze the reverse direction
  • IF role has any preconditions depending on shared object state -> MUST complete Step 6

After Step 5 (User-Side Exploitation):

  • Cross-reference with TOKEN_FLOW_TRACING.md for token-related griefing vectors
  • IF keeper actions are predictable -> document MEV/front-running vectors

After Step 6 (Precondition Griefability):

  • IF any precondition is user-griefable -> severity >= MEDIUM
  • Document system degradation if keeper is blocked

© PlamenTSV, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in agents/skills/sui/semi-trusted-roles of PlamenTSV/plamen.

Open the folder on GitHubat commit 795962b

Compare with similar skills

Semi Trusted Roles next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Semi Trusted Roles compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Semi Trusted Roles this skillPlamenTSV/plamen303—~3.4kAutomated safety check: PassMIT
Golang Patternsaffaan-m/ECC276k—~1.1kAutomated safety check: PassMIT
Dotnet Patternsaffaan-m/ECC277k1 repos~2.3kAutomated safety check: PassMIT
Fastapi Patternsaffaan-m/ECC276k—~2.3kAutomated safety check: PassMIT
Flagsvercel/next.js143k—~746Automated safety check: PassMIT
Kotlin Exposed Patternsaffaan-m/ECC277k4 repos~5.5kAutomated safety check: PassMIT

Similar skills

  • Golang Patterns

    affaan-m/ECC

    Go-specific design patterns and best practices including functional options, small interfaces, dependency injection, concurrency patterns, error handling, and package organization.

    276k GitHub stars~1.1k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Dotnet Patterns

    affaan-m/ECC

    Idiomatic C and .NET patterns, conventions, dependency injection, async/await, and best practices for building robust, maintainable .NET applications.

    277k GitHub starsUsed in 1 repo~2.3k tokens
    DevelopmentAuto-check passed
  • Fastapi Patterns

    affaan-m/ECC

    FastAPI patterns for async APIs, dependency injection, Pydantic request and response models, OpenAPI docs, tests, security, and production readiness.

    276k GitHub stars~2.3k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Flags

    vercel/next.js

    Official

    How to add or modify Next.js experimental feature flags end-to-end.

    143k GitHub stars~746 tokensUpdated today
    DevelopmentAuto-check passed
  • JetBrains Exposed ORM patterns including DSL queries, DAO pattern, transactions, HikariCP connection pooling, Flyway migrations, and repository pattern.

    277k GitHub starsUsed in 4 repos~5.5k tokens
    DatabasesAuto-check passed
  • Python Patterns

    affaan-m/ECC

    Python-specific design patterns and best practices including protocols, dataclasses, context managers, decorators, async/await, type hints, and package organization.

    276k GitHub stars~2.3k tokensUpdated yesterday
    DevelopmentAuto-check passed

More from PlamenTSV/plamen

All 87 skills in this repo
  • Audit Prep

    PlamenTSV/plamen

    Prepare Solidity projects for a security audit — test coverage, test quality, NatSpec docs, code hygiene, dependency health, best-practice enforcement, deployment readiness, and project…

    303 GitHub stars~3.7k tokensUpdated 14 days ago
    Auto-check passed
  • Verification Protocol

    PlamenTSV/plamen

    Trigger Pattern Always (used by all verifier agents) - Inject Into security-verifier agents (Phase 5)

    303 GitHub stars~3.5k tokensUpdated 14 days ago
    Auto-check passed
  • Ability Analysis

    PlamenTSV/plamen

    Trigger Pattern Always (Aptos Move) - foundational security check - Inject Into Breadth agents, depth agents

    303 GitHub stars~3.3k tokensUpdated 14 days ago
    Auto-check passed
  • Ability Analysis

    PlamenTSV/plamen

    Trigger Pattern Always (Sui Move) -- foundational security check - Inject Into Breadth agents, depth agents

    303 GitHub stars~3.2k tokensUpdated 14 days ago
    Auto-check passed
  • Account Lifecycle

    PlamenTSV/plamen

    Trigger Pattern ACCOUNTCLOSING flag detected (close/CloseAccount usage) - Inject Into Breadth agents, depth agents

    303 GitHub stars~1.2k tokensUpdated 14 days ago
    Auto-check passed
  • Account Validation

    PlamenTSV/plamen

    Trigger Pattern Always required for Solana audits - Inject Into Breadth agents, depth agents

    303 GitHub stars~1.7k tokensUpdated 14 days ago
    Auto-check passed

Questions about Semi Trusted Roles

What does Semi Trusted Roles do?

Trigger Pattern SEMITRUSTEDROLE flag (required) - Inject Into Breadth agents, depth-state-trace. Semi Trusted Roles is an agent skill from PlamenTSV/plamen.

When should I use Semi Trusted Roles?

Semi Trusted Roles fits situations like: pattern SEMITRUSTEDROLE flag (required) - Inject Into Breadth agents; depth-state-trace.

How do I install Semi Trusted Roles in Claude Code?

Run `npx skills add PlamenTSV/plamen --skill semi-trusted-roles -a claude-code`. Or copy the skill folder (agents/skills/sui/semi-trusted-roles in PlamenTSV/plamen) into .claude/skills/semi-trusted-roles in your project. Claude Code loads it when a task matches its description.

How do I install Semi Trusted Roles in Codex?

Run `npx skills add PlamenTSV/plamen --skill semi-trusted-roles -a codex`. Or copy the skill folder (agents/skills/sui/semi-trusted-roles in PlamenTSV/plamen) into .agents/skills/semi-trusted-roles in your project. Codex loads it when a task matches its description.

Can I use Semi Trusted Roles in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add PlamenTSV/plamen --skill semi-trusted-roles -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/semi-trusted-roles, .gemini/skills/semi-trusted-roles, .github/skills/semi-trusted-roles and .opencode/skills/semi-trusted-roles in your project.

What does Semi Trusted Roles need to run?

SKILL.md names no scripts, command-line tools or credentials: Semi Trusted Roles is instructions for the agent only.

Does Semi Trusted Roles access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Semi Trusted Roles safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Semi Trusted Roles use?

Semi Trusted Roles is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Semi Trusted Roles use?

About 3.4k tokens (SKILL.md is roughly 14k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Semi Trusted Roles?

Skills that share tags, products or a category with Semi Trusted Roles: Golang Patterns (affaan-m/ECC, 276k stars), Dotnet Patterns (affaan-m/ECC, 277k stars), Fastapi Patterns (affaan-m/ECC, 276k stars) and Flags (vercel/next.js, 143k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Semi Trusted Roles?

PlamenTSV (a GitHub user) maintains it in PlamenTSV/plamen, which has 303 GitHub stars. The repository holds 87 skills in this directory. The repository was last updated on September 26, 2026.

Source: PlamenTSV/plamen on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.