AI Support
Power mechanics are data: every rule is an asset, and a mechanic is a set of assets connected by relations. An AI agent can build that just as well as a person can, and often faster, as long as it knows the rules for connecting them.
Power ships that knowledge as power-skill, a skill for AI coding agents. With it, you can describe a mechanic in plain words ("when the player slays a foe, it damages the other foes within 4 m") and the agent creates and wires the Stats, Effects, Processors and relations in your project.
power-skill follows the open Agent Skills format (a SKILL.md with references/ and scripts/), so any agent that reads skills can use it: Claude Code, OpenAI Codex, GitHub Copilot, Gemini CLI, Cursor and others.
The optional agent workflow coordinates a mechanic builder and a docs repair agent. Claude Code uses the shipped agent roles and guard hook; Codex can use the same roles and linked skills.
How it started
Kodes was built to see how Power holds up on a long project. Partway through, it became clear that an AI agent could use Power to build mechanics too: a Kodes upgrade is a set of connected assets, which is exactly the kind of work an agent is good at.
power-skill grew out of that, to make building with an agent easier and cheaper. Many of Kodes' features were then implemented with this AI workflow.
What's in the skill
Everything for AI agents ships in Assets/Plugins/Power/Editor/AiFlow. The skill itself is Assets/Plugins/Power/Editor/AiFlow/power-skill.
| Part | What it does |
|---|---|
AGENTS.md (in AiFlow) | Shared entry point for Power agent rules. The skill carries recording rules in references/recording.md and editor requirements in references/editor-ui.md. Keep these together when distributing the workflow. |
SKILL.md | The entry point the agent reads first. It explains how to turn a request into a Power formula (what triggers it, which hook runs, whom it reaches, who owns it, how it is switched on) and how that formula maps to a build. |
references/ | The full catalogue: every Power mechanism and when to use it, the Premade Relation Packs and the formula each one covers, step-by-step recipes, processing chains, signatures, common pitfalls, General Expansions, and notes on each sample project. |
scripts/power.py | A command-line toolkit the agent runs. It looks things up in your project, creates and wires assets, loads Premade Relation Packs, and validates the result. |
power.py works through the Unity Editor
When the Unity Editor is open, power.py sends its work to PowerBridge, a Power Editor script. Assets are then created by the Power Editor's own code, the same way they are when you click through the Power Editor: the same naming conventions, save folders, defaults and identifier database registration.
It can also answer questions about your project:
P() { python3 Assets/Plugins/Power/Editor/AiFlow/power-skill/scripts/power.py "$@"; } # the shorthand the skill uses
P ask stat Health # every Environment, Container and SigSep list that holds Health
P ask refs Stat_Poison # who references an asset, and through which relation
P ask chain <ProcessDefinition> # what the processing chain runs, per Effect kind
P prp list backstab # Premade Relation Packs whose description mentions a word
P validate --under MyGame # Power's asset validation for one folder
With the Editor closed, lookups and simple edits still work offline. Creating Stats and Containers needs the Editor.
Checked asset plans
After the field formula is complete, the agent asks for the selected types' schema once, then builds a JSON command plan. Named outputs (as) and references such as $grant or $stat.key connect the commands without guessing generated asset names. P plan apply plan.json --report result.json preflights the commands on throwaway copies before saving any assets; a preflight failure writes none. Read-only queries can be grouped with P batch.
After applying the plan, the agent audits SigSep/injector order and validates every asset it created or edited. The workflow records the cost and Decision Flow trace when the build ends, including failed attempts.
Setting it up
Requirements: Python 3, and the Unity Editor open on your project while the agent creates assets.
Claude Code
-
Make the skill visible to Claude Code. Link it into your project's skills folder:
mkdir -p .claude/skills && ln -s ../../Assets/Plugins/Power/Editor/AiFlow/power-skill .claude/skills/power-skillKeep the shipped folder as the source of truth instead of maintaining a second copy. If both Claude Code and Codex are used, their skill links should point to this same folder.
-
Start Claude Code in the project's root folder.
-
Ask for a mechanic. The skill is picked up whenever a request touches Power: Stats, Effects, Processors, Counter Effects, "make attacks also do X", "why doesn't this Effect fire", and so on.
Codex and other agents
Link the shipped skill into the project's agent skill folder. This project uses .agents/skills/power-skill for Codex:
mkdir -p .agents/skills
ln -s ../../Assets/Plugins/Power/Editor/AiFlow/power-skill .agents/skills/power-skill
Keep the shipped skill as the source of truth and preserve any existing .claude/skills/power-skill link. A short project-root AGENTS.md can direct agents to Assets/Plugins/Power/Editor/AiFlow/AGENTS.md; the recording and editor rules themselves live in the skill's references, so they travel with Power. Read the Codex skills documentation for other installation scopes.
Other agents use their own skill discovery folders. Start the agent in the Unity project root so power.py finds the project.
The agent starts with P flow start, walks the relevant element questions and writes the field formula before creating assets. Existing assets and Premade Relation Packs are considered at the reuse stage after the formula is complete; they do not choose the mechanism.
The agent workflow (optional)
Next to the skill, Assets/Plugins/Power/Editor/AiFlow ships a workflow that builds a mechanic and repairs missing skill instructions whenever the builder gets stuck:
| Part | What it does |
|---|---|
agents/mechanic-builder.md | Builds the requested mechanic with power.py. When the docs don't say how, it stops and reports the gap instead of guessing. |
agents/skill-builder.md | Fills the reported gap in the power-skill docs. |
agents/doc-tester.md | Independently derives a mechanic from the docs, creates and validates real assets, and reports any guesses. Runs only when you request a cold test. |
build-mechanic/ | The /build-mechanic <request> command that runs the builder and the skill-builder together. |
update-docs/ | The /update-docs <information> command that hands what you know to the skill-builder. |
hooks/agent_guard.py | Enforces the role-specific tool permissions for Claude Code agents. |
tools/csmap.py | Lets the skill-builder read C# member by member instead of whole files. |
Link the agents and commands into .claude the same way as the skill:
mkdir -p .claude/agents .claude/skills
for a in Assets/Plugins/Power/Editor/AiFlow/agents/*.md; do ln -s "../../$a" .claude/agents/; done
ln -s ../../Assets/Plugins/Power/Editor/AiFlow/build-mechanic .claude/skills/build-mechanic
ln -s ../../Assets/Plugins/Power/Editor/AiFlow/update-docs .claude/skills/update-docs
/build-mechanic accepts these flags in any order:
| Flag | Does |
|---|---|
--no-relations | Turns off opening the completed setup in Relations. Relations delivery is on by default and needs the Unity Editor open. |
--no-debug | Turns off the per-step chat cost report, which is on by default. |
--test | Requests an isolated build test that creates and validates real assets. |
For example: /build-mechanic your Attack has a 20 % chance to hit twice. --relations and --debug remain accepted, but are already enabled.
A normal build runs once through any docs repairs. If those repairs changed the docs, the workflow offers a cold build test; it starts only after you agree. The tester builds actual assets under the documented isolation rules.
Every mechanic-build attempt, including fixes and requested cold tests, records its cost and Decision Flow trace. Docs repairs within the build are included; standalone docs updates and other non-build requests are excluded. See them in Tools → Power → AI Runs.
To inspect the mapper's questions and the path taken for a request, see AI Decision Flow.
Working with the agent
- Describe the mechanic, not the assets. "Your Attack has a 20 % chance to hit twice" is enough; the agent derives a Director on the Attack Stat through the element flow, then checks existing assets at the reuse stage.
- Read the formula it gives you. Before building, the agent writes the request as a one-line formula, for example
Source hits => Director[the same hit] -> Target | chance $N | Owner Source | Granted(value DoubleHitChance). If the formula is wrong, the build will be too, so this is the cheapest place to correct it. - Let it validate. After each mechanic, the agent validates every created or edited asset, including both static checks and each asset's Unity
Validate()results, and fixes reported errors. - Check it in Play Mode. The agent wires data. Playing the scene is still how you confirm the mechanic feels right.