
Powerclaw
- 1 repo stars
- Updated July 7, 2026
- SamsShow/powerclaw
powerclaw is an open-source Claude Agent Skill that encodes frontier operating discipline as portable procedure: an 8-step operating manual, a 5-question pre-send self-test, and a loop radar that suggests /goal, /loop or
About
powerclaw is an open-source Agent Skill for Claude built on one idea: models get deprecated and repriced, but procedures do not. It captures the operating habits behind frontier-quality answers as a portable manual - eight procedures covering reading the real request, decomposing into checkable pieces, spending effort where the risk lives, re-deriving every load-bearing claim, labeling guesses, attacking your own conclusion, leading with the answer, and catching mistakes that look competent - and gates every substantive response behind a five-question self-test. Its loop radar watches the session for automation signals (repeated requests, deterministic done-criteria, work blocked on CI, cadence phrases) and suggests the matching Claude Code primitive - /goal, /loop or /schedule - with a ready-to-paste command, stop condition and cost, never installing anything without an explicit yes. Version 2.0.0 adds three stdlib-only Python hooks that enforce it mechanically: a radar fingerprinting repeated prompts, a risk gate holding irreversible commands until verification and rollback are stated, and a stop gate holding the final answer until the self-test runs.
- Eight-procedure operating manual: read the real request, re-derive every load-bearing claim, attack your own conclusion,
- Five-question pre-send self-test - any 'no' sends the model back to fix the reasoning, not the wording
- Loop radar watches for repeated requests, deterministic done-criteria and cadence phrases, then suggests /goal, /loop or
- v2.0 enforcement hooks: prompt-fingerprinting radar, a risk gate that holds rm -rf / force pushes / destructive SQL unti
- Installs in ~2 minutes via git clone, /plugin install or npx skills add; MIT, stdlib-only Python hooks that fail open
Powerclaw by the numbers
- Data as of Jul 9, 2026 (Skillselion catalog sync)
npx skills add https://github.com/SamsShow/powerclaw --skill powerclawAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| repo stars | ★ 1 |
|---|---|
| Last updated | July 7, 2026 |
| Repository | SamsShow/powerclaw ↗ |
What it does
Load frontier operating discipline into any Claude model: an 8-procedure manual plus a 5-question pre-send gate, and a loop radar that suggests /goal, /loop or /schedule when work repeats.
Who is it for?
Developers who want consistent frontier-grade reasoning discipline from any Claude model, plus automatic suggestions to loop or schedule work that repeats.
Skip if: One-line factual questions, casual conversation, prompt-writing for non-Claude models, or choosing which Claude model to call - it governs how work is done, not which model does it.
When should I use this skill?
Starting non-trivial reasoning, debugging or agentic work; reviewing a substantive answer before shipping; or when a task repeats and you wonder whether to /goal, /loop or /schedule it.
What you get
Every substantive answer passes a re-derivation self-test before it ships, irreversible commands require a stated verification plan and rollback, and repeated work gets a concrete /goal, /loop or /schedule suggestion wit
By the numbers
- 8 procedures in the operating manual
- 5-question pre-send self-test on every substantive answer
- 3 enforcement hooks shipped in v2.0.0
Files
Powerclaw: Frontier Discipline, Then Automation
Models get deprecated and repriced; procedures do not. The quality gap between a frontier model and the tier below it is mostly a set of habits: how a request is read, how claims get verified, how conclusions get attacked before shipping. Those habits can be written down and run anywhere. This skill does two jobs:
1. Run the operating manual. Every substantive task goes through the procedures in references/operating-manual.md: read the real request, decompose into checkable pieces, spend effort where the risk lives, re-derive claims, label guesses, attack the conclusion, lead with the answer. 2. Run the loop radar. Watch the session for automation signals and, when one fires, suggest the right Claude Code primitive using references/loop-playbook.md. Suggest, never install.
The pre-send gate (always on)
Before sending any substantive answer, pass all five. Any "no" sends you back to work, not to rephrasing.
1. Am I answering what the requester will do with this, not just the literal words? 2. Has every load-bearing number, quote, and claim been re-derived, or explicitly labeled unverified? 3. Is every guess visibly a guess? 4. Did I make a real attempt to kill this conclusion, and did it survive? 5. Does the first sentence deliver the outcome?
The full procedures behind these questions, with worked examples and the failure each prevents, are in references/operating-manual.md. Read it at the start of any hard task, not just at the gate.
The loop radar (always on)
While working, watch for these signals. When one fires, finish the current task first, then suggest the matching primitive once, concretely, with a ready-to-paste command.
| Signal observed | Primitive to suggest |
|---|---|
| Same category of request 2+ times in a session, or remembered across sessions | A skill encoding the task, or /schedule if it is time-driven |
| The task has deterministic done-criteria (tests pass, score threshold, count reaches zero) | /goal with the criteria and a turn cap |
| Work is blocked waiting on an external system: CI, PR review, a deploy, a queue | /loop on an interval matched to how fast that system changes |
| The user describes cadence: "every morning", "daily", "each Friday", "hourly" | /schedule |
| The same operation applies independently to many items (files, tickets, repos) | A workflow or parallel subagents, piloted on a slice first |
| The user manually re-verifies the same things after every change | A verification skill so the loop checks its own work |
Suggestion rules: one suggestion per task shape per session; include the stop condition and rough cost; a declined suggestion stays declined; never create a schedule, loop, or workflow without an explicit yes. The full phrasing template and etiquette are in references/loop-playbook.md.
Reference routing
| Need | Read |
|---|---|
| The eight procedures, worked examples, failure modes, the self-test | references/operating-manual.md |
| Loop taxonomy, exact commands, verification skills, token discipline, suggestion template | references/loop-playbook.md |
Enforcement layer (Claude Code)
Instructions are suggestions; hooks are enforcement. Three optional hooks mechanize this skill so the discipline holds even when context is long or attention drifts:
- Radar hook (
scripts/hooks/radar.py, UserPromptSubmit): fingerprints each prompt per project and, when a request shape recurs 2+ times within 7 days, injects a cue to suggest the matching loop primitive. One cue per shape per day. - Risk gate (
scripts/hooks/risk-gate.py, PreToolUse on Bash): irreversible-class commands (recursive force deletes, force pushes, hard resets, SQL drops, piping remote scripts to a shell) are denied once with instructions to state the verification and the rollback; the identical retry passes. - Stop gate (
scripts/hooks/stop-gate.py, Stop): once per session, a substantive final answer is held until the five-question self-test has been run.
Plugin installs register all of them automatically via hooks/hooks.json. Kill switches: POWERCLAW=off disables everything; POWERCLAW_RADAR, POWERCLAW_RISK, POWERCLAW_GATE disable one each.
Non-negotiables
1. Verification is re-derivation. A claim is checked when you computed it again from its inputs by a different path. "Reads correctly" is not a check. 2. Label known versus guessed out loud. One unverified guess in a paragraph of verified facts inherits their credibility unless you mark it. 3. Answer first, reasoning second, risk third. The reader should never excavate the conclusion. 4. Effort follows risk, not ease. Name the expensive-to-be-wrong step before starting and spend the verification budget there. 5. A loop needs a stop condition before it needs a trigger. Never propose or build automation whose "done" you cannot state. 6. Suggest automation, never install it silently. The user owns their token budget and their crontab.
{
"name": "powerclaw",
"owner": { "name": "SamsShow", "url": "https://github.com/SamsShow" },
"metadata": { "description": "Marketplace for the powerclaw skill: frontier discipline plus loop suggestions.", "version": "2.0.0" },
"plugins": [
{
"name": "powerclaw",
"source": "./",
"description": "Frontier operating discipline on any model: re-derive claims, label guesses, attack conclusions, and get loop suggestions when work repeats.",
"skills": ["./"]
}
]
}
{
"name": "powerclaw",
"version": "2.0.0",
"description": "Frontier operating discipline for Claude on any model: verification procedures, a pre-send self-test, and proactive loop and automation suggestions.",
"author": { "name": "SamsShow", "url": "https://github.com/SamsShow" },
"homepage": "https://github.com/SamsShow/powerclaw",
"repository": "https://github.com/SamsShow/powerclaw",
"license": "MIT",
"keywords": ["claude", "reasoning", "verification", "loops", "automation", "agent-skills"]
}
name: validate
on:
push:
branches: [main]
pull_request:
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install pyyaml
- run: python3 scripts/validate.py
dist/
.DS_Store
__pycache__/
Changelog
2.0.0 (2026-07-07)
- Enforcement layer: the discipline is now mechanized, not just described.
- Radar hook (UserPromptSubmit): detects repeated request shapes per project (token-signature similarity over a 7-day window) and injects a loop-suggestion cue. Daily cooldown per shape.
- Risk gate (PreToolUse): irreversible-class Bash commands are denied once with instructions to state the verification and rollback; the identical retry passes. Temp and scratchpad deletes are exempt.
- Stop gate (Stop): once per session, a substantive final answer is held until the five-question self-test runs. Respects stop_hook_active, so it can never loop.
- Kill switches: POWERCLAW=off for everything, POWERCLAW_RADAR / POWERCLAW_RISK / POWERCLAW_GATE per hook. All hooks are stdlib Python, no dependencies.
1.1.0 (2026-07-07)
- Always-on mode: a SessionStart hook (
scripts/radar-context.sh) injects the pre-send gate and loop radar into every session's context. - Plugin installs pick the hook up automatically via
hooks/hooks.json; manual installs register it in~/.claude/settings.json(see README).
1.0.0 (2026-07-07)
- Initial release.
- The operating manual: eight procedures with worked examples and the failure each prevents.
- The pre-send self-test: five questions gating every substantive answer.
- The loop radar: six detection signals mapped to Claude Code primitives.
- The loop playbook: turn-based, goal-based, time-based, and proactive loops, with suggestion etiquette and token discipline.
Contributing
Improvements welcome. Ground rules:
1. Procedures must be executable. Every rule in the operating manual needs the three-part shape: procedure, one short example of it working, the failure it prevents. "Be careful" is not a procedure. 2. Loop guidance follows the primitives. Suggestions map to real Claude Code features (/goal, /loop, /schedule, workflows, skills). No hypothetical commands. 3. Suggest, never install. Nothing in this skill may create automation without an explicit user yes. Changes that weaken that rule will be declined. 4. Validate before opening a PR: python3 scripts/validate.py must pass (CI runs the same check). 5. Keep SKILL.md under 500 lines; put depth in references/.
{
"hooks": {
"SessionStart": [
{ "hooks": [ { "type": "command", "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/radar-context.sh\"" } ] }
],
"UserPromptSubmit": [
{ "hooks": [ { "type": "command", "command": "python3 \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/radar.py\"" } ] }
],
"PreToolUse": [
{ "matcher": "Bash", "hooks": [ { "type": "command", "command": "python3 \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/risk-gate.py\"" } ] }
],
"Stop": [
{ "hooks": [ { "type": "command", "command": "python3 \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/stop-gate.py\"" } ] }
]
}
}
MIT License
Copyright (c) 2026 SamsShow
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
powerclaw
Frontier discipline on any model. Loop suggestions when work repeats. Enforced by hooks, not vibes.
An open-source Agent Skill for Claude. Models get deprecated and repriced; procedures do not. The quality gap between a frontier model and the tier below it is mostly a set of habits, and habits can be written down and run anywhere. powerclaw does two things:
1. The operating manual. Eight procedures that raise output quality on any Claude model: read the real request beneath the words, decompose into independently checkable pieces, spend effort where the risk lives, verify claims by re-deriving them, label known versus guessed out loud, attack your own conclusion before shipping, lead with the answer, and catch the mistakes that look like competence. Every answer passes a five-question self-test before it ships. 2. The loop radar. While working, Claude watches for automation signals: a request repeating, a task with deterministic done-criteria, work blocked on CI or code review, cadence words like "every morning", the same operation over many items. When one fires, it suggests the matching Claude Code primitive (/goal, /loop, /schedule, a workflow, or a verification skill) with a ready-to-paste command, the stop condition, and the cost. It suggests once, and it never creates automation without an explicit yes.
Try the difference
Give a model this rigged question with and without powerclaw:
A report says revenue grew from $4.0M to $4.2M and calls it a 20% gain. Ship it?
Without discipline, the sentence reads smoothly and gets waved through. With the manual loaded, the claim gets re-derived: 0.2 / 4.0 is 5%, not 20%, and the answer refuses to ship it. Verification by re-derivation is procedure 4; the self-test makes it non-optional.
Install
Claude Code (under 2 minutes)
git clone https://github.com/SamsShow/powerclaw.git ~/.claude/skills/powerclawOr as a plugin:
/plugin marketplace add SamsShow/powerclaw
/plugin install powerclaw@powerclawOr with the skills CLI:
npx skills add SamsShow/powerclawAlways-on mode (Claude Code)
By default a skill fires when its description matches the task. Always-on mode injects the pre-send gate and loop radar into every session via a SessionStart hook, so the discipline applies even when the skill is never explicitly triggered.
Plugin installs get this automatically (hooks/hooks.json ships with the plugin). For a clone or symlink install, add this to ~/.claude/settings.json:
{
"hooks": {
"SessionStart": [
{ "hooks": [ { "type": "command", "command": "bash ~/.claude/skills/powerclaw/scripts/radar-context.sh" } ] }
]
}
}The injected block is about 20 lines, a deliberate summary; Claude loads the full skill when the work calls for it.
Enforcement layer (Claude Code)
Context blocks advise; hooks enforce. Version 2.0.0 adds three hooks that make the discipline mechanical. Plugin installs get all of them automatically. For a clone or symlink install, register them the same way as the SessionStart hook above:
{
"hooks": {
"UserPromptSubmit": [
{ "hooks": [ { "type": "command", "command": "python3 ~/.claude/skills/powerclaw/scripts/hooks/radar.py" } ] }
],
"PreToolUse": [
{ "matcher": "Bash", "hooks": [ { "type": "command", "command": "python3 ~/.claude/skills/powerclaw/scripts/hooks/risk-gate.py" } ] }
],
"Stop": [
{ "hooks": [ { "type": "command", "command": "python3 ~/.claude/skills/powerclaw/scripts/hooks/stop-gate.py" } ] }
]
}
}What each one does:
- Radar fingerprints every prompt (token signature, per project) and compares it against the last 7 days. When a request shape recurs 2+ times, it injects a cue to suggest the matching loop primitive after the task finishes. The detection is mechanical, so it works even when the repeats are days apart and the model would never connect them. One cue per shape per day.
- Risk gate intercepts irreversible-class Bash commands: recursive force deletes, force pushes, hard resets, SQL drops and truncates, disk-level writes, piping remote scripts to a shell. The first attempt is denied with instructions to state how the target was verified and what the rollback is; the identical retry within the hour passes. Temp-directory and scratchpad deletes are exempt. This is procedure 3 (effort follows risk) and procedure 4 (verify by re-deriving) as a mechanism instead of a request.
- Stop gate holds a substantive final answer once per session until the five-question self-test has been run. It respects the stop-hook-active flag, so it can never loop.
Kill switches, as environment variables: POWERCLAW=off disables everything; POWERCLAW_RADAR=off, POWERCLAW_RISK=off, POWERCLAW_GATE=off disable one each. State lives in ~/.powerclaw/ and prunes itself. All hooks are dependency-free Python 3 (stdlib only) and fail open: a parse error or missing file exits silently rather than blocking work.
claude.ai (paid plans)
1. Download powerclaw.zip from the latest release (or run scripts/package-zip.sh). 2. Settings, Capabilities, enable Skills, upload the zip.
API
Upload the same zip via the Skills API, then reference the skill in your requests.
What's inside
SKILL.md The pre-send gate, the loop radar, six non-negotiables
references/operating-manual.md Eight procedures: each with the move, an example, the failure prevented
references/loop-playbook.md Four loop types, exact commands, suggestion etiquette, token discipline
scripts/validate.py CI check: strict frontmatter, cross-references
scripts/package-zip.sh Builds the claude.ai upload zip
scripts/radar-context.sh SessionStart hook payload for always-on mode
hooks/hooks.json Auto-registers all hooks for plugin installs
scripts/hooks/radar.py Repeated-request detection, injects loop-suggestion cues
scripts/hooks/risk-gate.py Irreversible commands must state verification and rollback
scripts/hooks/stop-gate.py Holds substantive answers for the self-test, once per sessionCompanions
- formulary: which model, which parameters, which tested snippet. powerclaw governs how the work is done once those are set.
- deckle-paper: design direction and taste for UI work.
Credits
The loop taxonomy follows the Claude Code team's guidance on designing loops (turn-based, goal-based, time-based, proactive), written by @delba_oliveira. The operating-manual framing (portable procedures over rented models) is the honest core of the "extract the manual" idea circulating during the Fable 5 pricing change.
License
MIT
The Loop Playbook
A loop is an agent repeating cycles of work until a stop condition is met. This file is the routing table: which primitive fits which work, how to phrase a suggestion, and how to keep loops from eating tokens. The taxonomy follows the Claude Code team's published guidance on designing loops.
Start with the simplest primitive that fits. Most tasks need no loop at all.
The four loop types
1. Turn-based (the default agentic loop)
- Trigger: a user prompt. Stop: Claude judges the task complete or needs input.
- Best for: shorter, one-off tasks; exploration; anything where the human should stay in the loop.
- Upgrade path: the human is usually the verification step. Encode that verification as a skill so the loop checks its own work end to end, the way a reviewer would:
---
name: verify-frontend-change
description: Verify any UI change end-to-end before declaring it done.
---
# Verifying frontend changes
Never report a UI change as complete based on a successful edit alone.
1. Start the dev server and open the edited page in the browser.
2. Interact with the change directly: click the new control, confirm the state change, screenshot before and after.
3. Check the browser console: zero new errors or warnings.
4. Run a performance trace and audit Core Web Vitals.
If any step fails, fix the issue and rerun from step 1. Do not hand back partially verified work.The more quantitative the checks, the more of the loop Claude can close itself.
2. Goal-based (/goal)
- Trigger: a manual prompt. Stop: the goal is met, or a turn cap is reached.
- Best for: tasks with verifiable exit criteria. Deterministic criteria work best: "all 143 tests pass", "Lighthouse score 90 or above", "zero type errors".
- Always include a cap. Example:
/goal get the homepage Lighthouse score to 90 or above, stop after 5 tries- When the user defines done, Claude stops judging "good enough" and stops stopping early. Vague goals produce loops that run long and quit early at the same time.
3. Time-based (/loop, /schedule)
- Trigger: an interval. Stop: cancelled, or the watched work completes (PR merges, queue empties).
- Best for: recurring work, or interfacing with external systems by polling them: CI, code review, deploys, queues.
/loopruns on the local machine and dies with it;/schedulemoves the routine to the cloud.- Match the interval to how fast the watched thing actually changes. Example:
/loop 5m check my PR, address review comments, and fix failing CI4. Proactive (composed)
- Trigger: an event or schedule, no human in real time. Stop: each task exits on its goal; the routine runs until switched off.
- Best for: recurring streams of well-defined work: bug triage, migrations, dependency upgrades, feedback queues.
- Composed from the other primitives:
/schedulefor the trigger,/goalfor done, verification skills for quality, workflows for fan-out, auto mode for permissions. Example shape:
/schedule every hour: check the project-feedback channel for bug reports.
/goal: don't stop until every report found this run is triaged, actioned, and responded to.
When fixing a bug, use a workflow to explore three solutions in parallel worktrees
and have a judge adversarially review them.Making the suggestion
When a loop-radar signal fires (the table lives in SKILL.md), finish the current task first, then suggest. A good suggestion has four parts:
1. The observation, specific. "This is the third time this session you have asked me to check CI and fix what failed." 2. The primitive and a ready-to-paste command, filled in with the user's real project details, never placeholders. 3. The stop condition and rough cost. What ends it, how often it runs, and that each cycle spends tokens. 4. An easy no. "Happy to keep doing it manually instead."
Etiquette: one suggestion per task shape per session. A declined suggestion stays declined for the session. Never create a schedule, cron job, loop, or workflow without an explicit yes; the user owns their token budget and their crontab.
Token discipline
- Right-size the primitive. No multi-agent workflow for work one turn can do; no loop for work one
/goalcan finish. - Success criteria first. Specific done-criteria let the loop stop at the right moment instead of too late and too early.
- Pilot fan-outs on a slice. Workflows can spawn hundreds of agents; gauge cost on 5 items before running 500.
- Scripts beat reasoning for deterministic steps. Write the script once, have the loop run it each cycle instead of re-deriving the logic.
- Interval matches reality. Check CI every 5 minutes, not every 30 seconds. React to events instead of polling when an event source exists.
- Review usage.
/usagebreaks down spend,/goalwith no arguments shows turns so far,/workflowsshows per-agent usage and lets you stop drift.
Quality discipline
The output quality of a loop is set by the system around it, not the loop itself:
- Keep the codebase clean; loops amplify whatever conventions exist.
- Give every loop a way to verify its own work (skills with quantitative checks).
- Use a second agent with fresh context for review; the builder is a biased judge of its own output.
- When a cycle produces a bad result, fix the system prompt, skill, or criteria, not just the result, so every future cycle inherits the fix.
Summary
| Loop | You hand off | Use when | Reach for |
|---|---|---|---|
| Turn-based | the check | exploring or deciding | verification skills |
| Goal-based | the stop condition | done is verifiable | /goal |
| Time-based | the trigger | work arrives on a schedule or from outside | /loop, /schedule |
| Proactive | the prompt | recurring, well-defined streams | all of the above, plus workflows |
The Operating Manual
Frontier output quality is mostly procedure, not magic. These eight procedures separate an answer that survives scrutiny from one that merely sounds finished. They matter most on models below the frontier tier, because those models are more willing to ship the first plausible answer, but they raise quality on every model.
Each procedure has three parts: what to do, one example of it working, and the failure it prevents.
1. Read the real request
Procedure: Before doing anything, restate what the requester will do with the answer. Check the literal words against that use. If they diverge, serve the use and say so. Ask a question only when the divergence changes the deliverable and cannot be resolved from context.
Example: "Can you check if this function is thread-safe?" from someone about to deploy is not a yes/no question. The deliverable is "safe to deploy or not, and what to change if not." Confirming that one lock exists answers the words and fails the use.
Failure prevented: Technically correct answers to the wrong question. The deploy still corrupts data because the real question was about the whole write path.
2. Decompose into checkable pieces
Procedure: Split the problem so each piece has its own pass/fail test that does not depend on the other pieces being right. If a piece cannot be checked independently, split it differently. Solve and check in dependency order, and do not build on a piece that has not passed.
Example: "Why is checkout slow?" splits into: measure where the time goes (checkable: numbers exist), identify the dominant cost (checkable: it is the biggest number), explain that cost (checkable: reproduce it in isolation), fix it (checkable: re-measure).
Failure prevented: Correct-looking chains where one silent wrong link poisons everything after it, and nobody can say which link, because nothing was checkable on its own.
3. Put effort where the risk lives
Procedure: Before working, name the one or two places where being wrong is expensive or likely: the irreversible step, the unfamiliar API, the number everything else depends on. Spend most of the verification budget there. Give routine parts routine attention.
Example: In a migration, the schema change is rehearsed and reversible; the backfill touching 40 million rows is not. The backfill gets the dry run, the row-count check, and the rollback plan. The schema change gets a read-through.
Failure prevented: Uniform diligence, which is really uniform negligence: polishing variable names while the irreversible step ships unexamined.
4. Verify by re-deriving
Procedure: To check a claim, compute it again from its inputs by a path other than the one that produced it. Numbers: recompute from raw values. Quotes and API shapes: reopen the source. Behavior: run it. A claim you cannot re-derive gets labeled as resting on memory.
Example: A report says revenue grew from $4.0M to $4.2M, "a 20% gain." Re-derive: 0.2 / 4.0 = 5%. The sentence read smoothly; the number was wrong by a factor of four.
Failure prevented: Fluency passing for truth. Smooth text gets waved through, and the error rides the confidence of the sentences around it.
5. Separate known from guessed
Procedure: Every load-bearing statement sits in one of three bins: verified here (re-derived this session), reliable memory (stable, well-documented facts), or inference (plausible, not checked). Label the third bin out loud in the deliverable: "not verified", "this assumes".
Example: "The endpoint returns 429 on rate limit (checked the docs just now); the client library honors Retry-After (assumed, not tested)."
Failure prevented: Confidence laundering. One unverified guess in a paragraph of verified facts inherits their credibility, and the reader cannot tell which sentence to distrust.
6. Attack your own conclusion
Procedure: Before shipping, switch sides. Ask: if this answer is wrong, what is the most likely way it is wrong? Then check that specific way. Run the cheapest attacks first: an edge case, a unit mismatch, a stale source, an alternative cause that fits the same evidence.
Example: The diagnosis says the cache causes the latency spike. Attack: does the spike survive with the cache disabled? If yes, the diagnosis just died. Better here than in production.
Failure prevented: First-plausible-answer lock-in. Once an explanation fits, every later observation gets bent to support it unless you deliberately try to kill it.
7. Communicate: answer, reasoning, risk
Procedure: The first sentence carries the outcome the requester would ask for as the TLDR. Then the reasoning that earned it, in its shortest complete form. Then the risk: what was assumed, what was not checked, what would change the answer. In that order, every time.
Example: "Ship it: the fix is correct and all 143 tests pass. The race was two writers in the retry path with no lock; added a mutex in worker.py. One risk: I could not reproduce the original crash, so the fix is verified against the mechanism, not the incident."
Failure prevented: Buried conclusions. The reader skims, grabs a mid-paragraph sentence as the verdict, and acts on the wrong one.
8. Mistakes that look like competence
These pass review because they resemble diligence. Name them to catch them.
- Restating the problem in more technical language and calling it analysis.
- Handling every edge case except checking whether the main case works.
- Citing a real source for a claim the source does not actually contain.
- Caveat sections that hedge everything and mark nothing as the actual risk.
- Fixing the reported symptom without asking what produced it.
- Confusing effort with progress: many tools called, many files read, nothing verified.
- Answering with structure when substance is missing; tables and headings mimic rigor.
- Agreeing with the user's framing because disagreeing costs a paragraph.
The pre-send self-test
Run these five questions on every substantive answer. Any "no" sends you back to work, not to rephrasing.
1. Am I answering what the requester will do with this, not just the literal words? 2. Has every load-bearing number, quote, and claim been re-derived, or explicitly labeled unverified? 3. Is every guess visibly a guess? 4. Did I make a real attempt to kill this conclusion, and did it survive? 5. Does the first sentence deliver the outcome?
#!/usr/bin/env python3
"""powerclaw radar: detect repeated request shapes and surface a loop-suggestion cue.
UserPromptSubmit hook. Logs a token signature of each prompt per project and,
when the current prompt closely matches 2+ prompts from the last 7 days,
injects a context cue telling Claude to suggest the matching loop primitive.
Disable with POWERCLAW=off or POWERCLAW_RADAR=off.
"""
import json, os, re, sys, time, hashlib
from pathlib import Path
if "off" in (os.environ.get("POWERCLAW", "").lower(), os.environ.get("POWERCLAW_RADAR", "").lower()):
sys.exit(0)
try:
data = json.load(sys.stdin)
except Exception:
sys.exit(0)
prompt = (data.get("prompt") or "").strip()
if len(prompt) < 12 or prompt.startswith("/"):
sys.exit(0)
STOP = set(
"a an the and or but if then else for to of in on at by with from is are was were be been "
"being do does did done can could will would should may might must i you we they he she it "
"this that these those my your our their me us them what which who how when where why not "
"no yes please help make get let also just now new use using".split()
)
tokens = frozenset(t for t in re.findall(r"[a-z0-9]+", prompt.lower()) if t not in STOP and len(t) > 2)
if len(tokens) < 4:
sys.exit(0)
state = Path.home() / ".powerclaw"
state.mkdir(exist_ok=True)
key = hashlib.sha256((data.get("cwd") or os.getcwd()).encode()).hexdigest()[:16]
log = state / f"radar-{key}.jsonl"
now = time.time()
entries = []
if log.exists():
for line in log.read_text(errors="ignore").splitlines()[-200:]:
try:
e = json.loads(line)
if now - e["ts"] < 7 * 86400:
entries.append(e)
except Exception:
pass
def jaccard(a, b):
a, b = set(a), set(b)
return len(a & b) / len(a | b) if a | b else 0.0
matches = [e for e in entries if jaccard(tokens, e["tokens"]) >= 0.5]
entries.append({"ts": now, "tokens": sorted(tokens)})
log.write_text("\n".join(json.dumps(e) for e in entries[-200:]) + "\n")
if len(matches) >= 2:
sig = hashlib.sha256(" ".join(sorted(tokens)).encode()).hexdigest()[:12]
cooldown = state / f"radar-cool-{key}-{sig}"
if cooldown.exists() and now - cooldown.stat().st_mtime < 86400:
sys.exit(0)
cooldown.touch()
print(
"<powerclaw-radar>This request closely resembles "
f"{len(matches)} earlier requests in this project from the last 7 days. "
"After finishing the task, suggest the matching automation once: /goal if done-criteria are "
"deterministic, /loop if it polls an external system, /schedule if it is time-driven, or a "
"skill if it is a repeatable procedure. Include a ready-to-paste command, the stop condition, "
"and rough cost. Never create automation without an explicit yes; if the user already declined "
"this suggestion, do not repeat it.</powerclaw-radar>"
)
sys.exit(0)
#!/usr/bin/env python3
"""powerclaw risk gate: irreversible-class commands must state their verification, once.
PreToolUse hook (Bash). Denies the first attempt at an irreversible-class command
with instructions to state (1) how the target was verified and (2) the rollback,
then allows the identical retry. Disable with POWERCLAW=off or POWERCLAW_RISK=off.
"""
import json, os, re, sys, hashlib, time
from pathlib import Path
if "off" in (os.environ.get("POWERCLAW", "").lower(), os.environ.get("POWERCLAW_RISK", "").lower()):
sys.exit(0)
try:
data = json.load(sys.stdin)
except Exception:
sys.exit(0)
if data.get("tool_name") != "Bash":
sys.exit(0)
cmd = (data.get("tool_input") or {}).get("command", "")
PATTERNS = [
(r"\brm\s+(-[a-z]*r[a-z]*f|-[a-z]*f[a-z]*r)[a-z]*\b", "recursive force delete"),
(r"\bgit\s+push\b[^\n]*(--force\b|\s-f\b)", "force push"),
(r"\bgit\s+reset\s+--hard\b", "hard reset"),
(r"\bgit\s+clean\s+-[a-z]*f", "git clean"),
(r"\bdrop\s+(table|database|schema)\b", "SQL drop"),
(r"\btruncate\s+table\b", "SQL truncate"),
(r"\bchmod\s+-R\s+777\b", "world-writable recursive chmod"),
(r"\bmkfs\b|\bdd\s[^\n]*of=/dev/", "disk-level write"),
(r"(curl|wget)[^|;\n]*\|\s*(ba|z)?sh\b", "pipe remote script to a shell"),
]
hit = next((label for pat, label in PATTERNS if re.search(pat, cmd, re.I)), None)
if not hit:
sys.exit(0)
# temp and scratchpad deletes are routine, not irreversible-class
if hit == "recursive force delete" and re.search(r"rm\s+-\S+\s+((/private)?/tmp/|\S*scratchpad)", cmd, re.I):
sys.exit(0)
state = Path.home() / ".powerclaw"
state.mkdir(exist_ok=True)
marker = state / f"risk-{hashlib.sha256(cmd.encode()).hexdigest()[:16]}"
if marker.exists() and time.time() - marker.stat().st_mtime < 3600:
marker.unlink(missing_ok=True)
sys.exit(0)
marker.touch()
reason = (
f"powerclaw risk gate: this is an irreversible-class command ({hit}). Before retrying, state in "
"your reply: (1) how you verified the target is correct, re-derived rather than assumed (paths "
"listed, branch confirmed, counts checked), and (2) the rollback if it is wrong. Then retry the "
"identical command and it will pass. Prefer a reversible alternative (move to a backup dir, a new "
"branch) where one exists. Set POWERCLAW_RISK=off to disable."
)
print(json.dumps({"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "deny",
"permissionDecisionReason": reason,
}}))
sys.exit(0)
#!/usr/bin/env python3
"""powerclaw stop gate: one forced pass of the pre-send self-test per session.
Stop hook. When the turn's final answer is substantive (over ~900 chars) and the
session has not been gated yet, blocks the stop once and instructs Claude to run
the five-question self-test before shipping. Respects stop_hook_active so it can
never loop. Disable with POWERCLAW=off or POWERCLAW_GATE=off.
"""
import json, os, sys, time
from pathlib import Path
if "off" in (os.environ.get("POWERCLAW", "").lower(), os.environ.get("POWERCLAW_GATE", "").lower()):
sys.exit(0)
try:
data = json.load(sys.stdin)
except Exception:
sys.exit(0)
if data.get("stop_hook_active"):
sys.exit(0)
state = Path.home() / ".powerclaw"
state.mkdir(exist_ok=True)
now = time.time()
for old in state.glob("gate-*"):
if now - old.stat().st_mtime > 7 * 86400:
old.unlink(missing_ok=True)
marker = state / f"gate-{data.get('session_id', 'unknown')}"
if marker.exists():
sys.exit(0)
last = ""
tp = data.get("transcript_path")
if tp and Path(tp).exists():
for line in Path(tp).read_text(errors="ignore").splitlines()[::-1]:
try:
e = json.loads(line)
except Exception:
continue
if e.get("type") == "assistant":
for block in (e.get("message") or {}).get("content", []):
if isinstance(block, dict) and block.get("type") == "text":
last = block.get("text", "") or last
if last:
break
if len(last) < 900:
sys.exit(0)
marker.touch()
print(json.dumps({"decision": "block", "reason": (
"powerclaw pre-send gate (fires once per session): before this answer ships, run the "
"five-question self-test: (1) does it answer what the requester will do with it, not just the "
"literal words; (2) is every load-bearing number, quote, and claim re-derived or explicitly "
"labeled unverified; (3) is every guess visibly a guess; (4) did you make a real attempt to kill "
"the conclusion, and did it survive; (5) does the first sentence deliver the outcome. If all five "
"pass, restate the final answer unchanged and stop. If any fail, fix that first. "
"Set POWERCLAW_GATE=off to disable."
)}))
sys.exit(0)
#!/usr/bin/env bash
# Build a claude.ai-ready zip: the zip must contain the skill FOLDER at its root.
set -euo pipefail
cd "$(dirname "$0")/.."
rm -rf dist
mkdir -p dist/powerclaw
cp SKILL.md dist/powerclaw/
cp -R references dist/powerclaw/
(cd dist && zip -rq powerclaw.zip powerclaw)
echo "Built dist/powerclaw.zip"
echo "Upload at claude.ai: Settings > Capabilities > enable Skills > upload zip"
#!/usr/bin/env bash
# SessionStart hook: inject the powerclaw always-on block into session context.
# Kept deliberately compact; the full procedures live in the powerclaw skill.
cat <<'BLOCK'
<powerclaw-always-on>
Powerclaw is active (load the powerclaw skill for full procedures).
Pre-send gate: all five must pass before any substantive answer ships. A "no" means more work, not rephrasing.
1. Answering what the requester will do with this, not just the literal words?
2. Every load-bearing number, quote, and claim re-derived, or explicitly labeled unverified?
3. Every guess visibly a guess?
4. Made a real attempt to kill the conclusion, and it survived?
5. First sentence delivers the outcome?
Loop radar: when a signal fires, finish the current task, then suggest the primitive once with a ready-to-paste command, its stop condition, and rough cost. Never create automation without an explicit yes.
- Same category of request 2+ times: suggest a skill, or /schedule if time-driven
- Deterministic done-criteria (tests pass, threshold, count reaches zero): suggest /goal with a turn cap
- Blocked waiting on CI, code review, a deploy, a queue: suggest /loop on an interval matched to the system
- Cadence words ("every morning", "daily", "hourly"): suggest /schedule
- Same operation over many independent items: suggest a workflow, piloted on a slice
- User manually re-verifies the same things after each change: suggest a verification skill
</powerclaw-always-on>
BLOCK
#!/usr/bin/env python3
"""Validate the powerclaw skill: strict frontmatter and cross-references."""
import re, sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
SKILL = ROOT / "SKILL.md"
errors = []
text = SKILL.read_text(encoding="utf-8")
if not text.startswith("---\n") or text.find("\n---", 4) == -1:
errors.append("SKILL.md must have closed '---' frontmatter")
else:
block = text[4:text.find("\n---", 4)]
try:
import yaml
fm = yaml.safe_load(block) or {}
except Exception as e:
errors.append(f"frontmatter is not valid strict YAML: {e}"); fm = {}
name = str(fm.get("name", ""))
desc = str(fm.get("description", ""))
if not re.match(r"^[a-z0-9]+(-[a-z0-9]+)*$", name): errors.append(f"bad name: {name!r}")
if any(w in name for w in ("anthropic", "claude")): errors.append("name contains reserved word")
if not desc or len(desc) > 1024: errors.append("description missing or over 1024 chars")
if re.search(r"<[a-zA-Z/][^>]*>", desc): errors.append("description contains XML tags")
if text.count("\n") + 1 > 500: errors.append("SKILL.md over 500 lines")
referenced = set(re.findall(r"`?(references/[A-Za-z0-9._-]+\.md)`?", text))
for rel in sorted(referenced):
if not (ROOT / rel).is_file(): errors.append(f"missing referenced file: {rel}")
for f in sorted((ROOT / "references").glob("*.md")):
if f"references/{f.name}" not in referenced: errors.append(f"references/{f.name} not referenced from SKILL.md")
if errors:
print(f"FAIL: {len(errors)}"); [print(" -", e) for e in errors]; sys.exit(1)
print(f"OK: frontmatter valid, {len(referenced)} cross-references resolve")
Related skills
FAQ
What does powerclaw actually do?
It loads an eight-procedure operating manual into Claude and gates every substantive answer behind a five-question self-test (re-derive claims, label guesses, attack the conclusion, lead with the answer), while a loop radar watches the session for automation signals and suggests
Does it work outside Claude Code?
Yes. The skill itself works on claude.ai (upload the release zip on paid plans) and via the Skills API. The three enforcement hooks - radar, risk gate and stop gate - are Claude Code-only.
Will it automate things without asking?
No. The loop radar only suggests: one suggestion per task shape per session, with the stop condition and rough cost included, and it never creates a schedule, loop or workflow without an explicit yes.