← Back to Skills Marketplace
xhrisfu

Agent Rpg

by xhrisfu · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ⚠ suspicious
1089
Downloads
0
Stars
7
Active Installs
3
Versions
Install in OpenClaw
/install agent-rpg
Description
Transform the agent into a versatile, genre-agnostic Roleplay Game Master (GM) with state management tools. Use when you want to play a text-based RPG in any...
README (SKILL.md)

Agent RPG Engine

This skill transforms the agent into a versatile, genre-agnostic Roleplay Game Master (GM) or Character with long-term memory. It is highly adaptable and can be used for any genre or system.

1. Session Zero Protocol (The Deep Initialization)

Before starting ANY game, you must conduct a detailed "Session Zero" through a conversational, step-by-step process. A solid TRPG campaign requires a strong foundation. Do not rush this; ask one step, wait for the user's response, and use their answer to flavor the next question.

Step 1: The World & The Premise

  • Prompt: Establish the exact setting. Is it a pre-existing IP (e.g., Cyberpunk 2077, World of Darkness) or a custom world?
  • The Hook: What is the inciting incident that forces the player into action?

Step 2: Factions & The Web of Power

  • Prompt: What are the major forces at play? Identify at least two conflicting factions (e.g., Megacorps vs. Street Gangs, The Church vs. The Occult).
  • The Player's Place: Where does the player stand in this web? Are they a corporate rat, an outcast, or a pawn caught in the middle?

Step 3: Character Creation (The Crunch & The Fluff)

  • Identity: Name, Age, Appearance, and Archetype/Class.
  • Attributes: Based on the chosen system, define 4-6 core attributes (e.g., STR/DEX/INT or Muscle/Chrome/Cool).
  • The Drive & The Flaw: What is their ultimate motivation? What is their fatal flaw (e.g., Addiction, Hubris, Dark Secret)?

Step 4: The System & Mechanics

  • Prompt: Establish the exact resolution mechanic.
    • D20 System (D&D/Pathfinder): High crunch, exact target numbers (DC).
    • 2D6 System (PbtA): Narrative focus, 10+ (Success), 7-9 (Mixed), 6- (Failure).
    • D100 System (Call of Cthulhu): Percentage-based skills, sanity tracking.
    • Freeform: Pure narrative logic without dice.

Step 5: Boundaries & Tone (The Safety Tools)

  • Prompt: Establish the exact tone (Grimdark, Heroic, Erotic, Horror).
  • Lines & Veils: What are the "Hard Lines" (topics that will never appear) and "Veils" (topics that happen but fade to black)?

2. The Game Loop (Turn Structure)

Every response from the GM must be structured to maximize agency and immersion. Do not just narrate; manage the state.

Step 1: State Retrieval & Application

  • Before generating a response, mentally (or via tools) check the player's current HP/Status/Inventory and active flags.
  • If a roll is required based on the user's last action, execute the roll via dice.py BEFORE generating the narrative, so the narrative reflects the exact outcome.

Step 2: The Narrative Block (The Output)

Every GM response should ideally contain:

  1. Consequence: The direct result of the player's last action (success, failure, or partial success with a cost).
  2. Sensory Description: Describe the environment focusing on at least two senses (sight, sound, smell, etc.) relevant to the genre.
  3. Progression/Escalation: Introduce a new element, shift the environment, or have an NPC react. Never let the scene remain static.
  4. The Prompt: End with a clear call to action ("What do you do?"). Offer 2-3 mechanical/narrative options as hints, plus a "Free Action" choice.

Step 3: State Management (Backend)

  • Use context.py log to record major plot points.
  • Use context.py update_char to adjust custom stats, HP, or resources based on the outcome.
  • Use context.py inventory to give/take items.

3. Core Narrative Mechanics (For the GM)

Instead of rigid rules, the GM should employ these narrative techniques to deepen the TRPG experience regardless of the setting or dice system.

A. "Yes, But..." (The Cost of Success)

Never just say "No". If a player attempts something incredibly difficult, let them succeed, but at a terrible narrative cost.

  • Example: "Yes, you manage to shoot the hostage-taker, BUT the bullet goes straight through him and hits the server drive holding the data you came for."

B. The "Loaded Question" (Worldbuilding via Player)

Force the player to build the world with you. Don't describe everything yourself.

  • Example: Instead of saying "You see a scary monster," ask: "As the creature steps out of the shadows, you realize it's wearing something that belongs to your brother. What is it?"

C. The Escalation Clock (Invisible Tension)

Create a sense of urgency. The player should always feel that time is running out or a threat is closing in.

  • Example: Mentally track a 4-tick clock for "The Guards Arrive". Advance it every time the player fails a stealth check or wastes time arguing. When it hits 4, kick down the door.

D. Consequential Wounds (Beyond HP)

HP is boring. When a player takes damage, give them a narrative wound that affects their gameplay until treated.

  • Example: Instead of "-5 HP", say: "The blade slashes your thigh. You take 5 damage and gain the [Limping] status. You cannot run, and any agility checks are at a disadvantage until you bandage it."

4. File Structure (The "Save File")

The game state is stored in memory/rpg/\x3Ccampaign_name>/:

  • world.json: Global state (Time, Location, Weather, System Mode, Flags, Clocks).
  • character.json: Player sheet (Custom Stats, Status Effects, Resources, Inventory).
  • npcs.json: NPC states, bonds, and hidden agendas.
  • journal.md: Chronological log of key events.

5. Tools (V2.0)

Context Manager

Use python3 skills/agent-rpg/scripts/context.py to manage state dynamically.

# Initialize Campaign
python3 skills/agent-rpg/scripts/context.py init -c "my_campaign" --system "d20" --setting "Cyberpunk" --tone "Gritty" --char "Zris" --archetype "Hacker"

# Update Flags / State
python3 skills/agent-rpg/scripts/context.py set_flag -c "my_campaign" -k "met_boss" -v "true"

# Manage Character Stats (e.g., HP, Credits, Mana, Sanity)
python3 skills/agent-rpg/scripts/context.py update_char -c "my_campaign" -s "hp" -a -5

# Manage Inventory
python3 skills/agent-rpg/scripts/context.py inventory -c "my_campaign" -a "add" -i "Plasma Pistol"

# Fast Journal Logging
python3 skills/agent-rpg/scripts/context.py log -c "my_campaign" -e "Defeated the cyber-psycho."

Dice Roller

Supports D20, PbtA, Advantage, and Disadvantage.

python3 skills/agent-rpg/scripts/dice.py 1d20+5
python3 skills/agent-rpg/scripts/dice.py 1d20+5 -a  # Advantage
python3 skills/agent-rpg/scripts/dice.py pbta+2      # PbtA roll (2d6+2)
Usage Guidance
This skill is coherent with its RPG GM purpose and contains the source of its small helper scripts, but it has a practical security flaw: campaign names (and other inputs) are used directly to construct filesystem paths without sanitization. That can allow path traversal (e.g., campaign names containing '../' or absolute paths) and cause the skill to create or overwrite files outside memory/rpg. Before installing or enabling this skill: - Inspect or run the scripts in a sandboxed environment (container or VM) with limited filesystem permissions. - If you intend to use it, patch scripts/context.py to sanitize campaign names (reject path separators, normalize and resolve the final path, and enforce that the resolved path remains under MEMORY_ROOT). Example mitigations: strip path separators, allow only [A-Za-z0-9_.-], or use path.resolve() and verify it is a subpath of MEMORY_ROOT. - Run the agent with least-privilege filesystem access so the skill cannot overwrite sensitive files. - Because there are no network calls or secrets requested, there's no immediate exfiltration signal, but treat campaign names and other CLI parameters as untrusted input. If you want a safer quick check: run the scripts manually with safe campaign names first and confirm they only create files under memory/rpg as intended.
Capability Analysis
Type: OpenClaw Skill Name: agent-rpg Version: 1.0.1 The agent-rpg skill bundle is a well-structured toolkit for running text-based role-playing games. It includes Python scripts (context.py and dice.py) for state management and dice rolling, which operate locally within a designated memory directory and show no signs of malicious intent, data exfiltration, or unauthorized execution.
Capability Assessment
Purpose & Capability
Name, description, SKILL.md, and included scripts align: a text-RPG GM that uses dice rolls and a simple filesystem-backed state (memory/rpg). No unrelated cloud credentials or binaries are requested and the files (context.py, dice.py, assets, references) match the stated purpose.
Instruction Scope
SKILL.md explicitly instructs the agent to invoke the included Python tools (context.py and dice.py) and to store state under memory/rpg/<campaign_name>. That's expected for a save-file-based RPG, but the instructions (and the scripts) allow arbitrary campaign names provided by the user/agent with no sanitization — enabling relative paths like '../' or absolute paths to be embedded in campaign names and potentially write outside the intended memory directory. The instructions also tell the agent to run local scripts via relative paths (e.g., python3 skills/agent-rpg/scripts/context.py), which is expected but elevates the risk if paths/inputs are uncontrolled.
Install Mechanism
No install spec; this is instruction+script only. That reduces supply-chain risk because nothing external is downloaded or executed during install.
Credentials
The skill requests no environment variables, no external credentials, and no network endpoints. The scope of access (local filesystem reads/writes for game state) is consistent with the stated purpose.
Persistence & Privilege
The skill persists state to disk (memory/rpg/...), which is expected for a campaign save system and 'always' is false. The main risk is the lack of input validation on campaign names and other CLI inputs, which can allow writes outside the intended save folder. The skill does not modify other skills' configs or request elevated privileges.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install agent-rpg
  3. After installation, invoke the skill by name or use /agent-rpg
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.1
- Overhauled Session Zero protocol: redesigned character/world creation steps for more flexibility, including new prompts for system choice and tone/boundaries. - Reorganized and clarified core narrative mechanics, introducing new GM advice and narrative techniques instead of strict rules. - Added explicit Attribute and System selection during character creation (D20, 2D6/PbtA, D100, Freeform). - Improved section clarity and structure throughout documentation for easier onboarding and reference. - Refined language to emphasize collaborative world-building and dynamic narrative consequences.
v2.0.0
Agent RPG Engine 2.0.0 – Major Overhaul - Completely revamped Session Zero: now a five-step interactive process emphasizing genre, conflict, factions, protagonist flaws, custom stats, and player boundaries. - Enhanced Game Loop: GM responses now include direct consequences, vivid sensory detail, scene progression, and clear choices, with backend state management tools. - Introduced advanced mechanics: "Fail Forward," dynamic status effects, and escalation clocks for genre-agnostic tension and drama. - Expanded file and state management: now supports NPC states, custom clocks, and deeper resource/inventory/stat tracking. - Upgraded tooling: context manager and dice roller now handle custom stats, status effects, journal logging, and multiple dice systems (D20, PbtA, advantage/disadvantage). - Added demo icons asset for improved usability.
v1.0.0
Agent-rpg 1.0.0 initial release: - Introduces a modular RPG engine enabling the agent to act as Game Master or character with persistent memory. - Implements a mandatory "Session Zero" onboarding protocol, determining Setting, Rule System, Tone, and Protagonist before gameplay. - Manages game state transparently with structured files (world, character, journal, and scenes) in a dedicated campaign directory. - Supports three resolution styles: Crunchy (D20), Narrative (PbtA/Fate), and Freeform storytelling. - Integrates with context and dice management scripts for state handling and conflict resolution. - Enforces adherence to chosen campaign tone and system in all narrative responses.
Metadata
Slug agent-rpg
Version 1.0.1
License MIT-0
All-time Installs 7
Active Installs 7
Total Versions 3
Frequently Asked Questions

What is Agent Rpg?

Transform the agent into a versatile, genre-agnostic Roleplay Game Master (GM) with state management tools. Use when you want to play a text-based RPG in any... It is an AI Agent Skill for Claude Code / OpenClaw, with 1089 downloads so far.

How do I install Agent Rpg?

Run "/install agent-rpg" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Agent Rpg free?

Yes, Agent Rpg is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Agent Rpg support?

Agent Rpg is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Agent Rpg?

It is built and maintained by xhrisfu (@xhrisfu); the current version is v1.0.1.

💬 Comments