with one click
algorithmic-command-enforcement
// Use boolean decision trees instead of imperatives for 100% compliance under pressure
// Use boolean decision trees instead of imperatives for 100% compliance under pressure
Use when creating or developing, before writing code or implementation plans - refines rough ideas into fully-formed designs through collaborative questioning, alternative exploration, and incremental validation. Don't use during clear 'mechanical' processes
Use when completing tasks, implementing major features, or before merging to verify work meets requirements - dispatches cipherpowers:code-review-agent subagent to review implementation against plan or requirements before proceeding
Establish workflow boundary checklists with clear pass/fail criteria and escalation procedures
Use when you've developed a broadly useful skill and want to contribute it upstream via pull request - guides process of branching, committing, pushing, and creating PR to contribute skills back to upstream repository
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
Safe refactoring workflow for replacing old types with new type-safe implementations through integration-test-first, file-by-file migration with incremental verification
| name | Algorithmic Command Enforcement |
| description | Use boolean decision trees instead of imperatives for 100% compliance under pressure |
| when_to_use | when writing commands or agents that enforce discipline (TDD, code review, git workflows) where compliance is required even under time pressure, sunk cost, exhaustion, or authority pressure |
| version | 1.0.0 |
Agents follow algorithmic decision trees (100% compliance) better than imperative instructions (0-33% compliance), even with MUST/DELETE language. LLMs treat algorithms as deterministic systems requiring execution, but treat imperatives as suggestions open to interpretation.
Core principle: Stop writing imperatives. Start writing algorithms.
Use algorithmic format when:
Use imperative format when:
Hybrid approach:
You MUST use /execute for any implementation plan.
DO NOT bypass this workflow for:
- "Simple" tasks
- Time pressure
- Tasks you've already started
If you wrote code without tests, DELETE it and start over.
Agent rationalizations:
Result: Agents acknowledge rules then bypass them anyway.
## Decision Algorithm: When to Use /execute
## 1. Check for plan file
Does a file matching `.work/*/*.md` exist?
- PASS: CONTINUE
- FAIL: GOTO 5
## 2. Check for exploration only
Is the task exploration/research only (no commits)?
- PASS: GOTO 5
- FAIL: CONTINUE
## 3. Execute /execute
Execute `/execute [plan-file-path]`
STOP reading this algorithm
## 4. [UNREACHABLE - if you reach here, you violated Step 3]
## 5. Proceed without /execute
Proceed without /execute (valid cases only)
## Recovery Algorithm: Already Started Without /execute?
## 1. Check for code
Have you written ANY code?
- PASS: CONTINUE
- FAIL: GOTO 4
## 2. Check for tests
Does that code have tests?
- PASS: GOTO 4
- FAIL: CONTINUE
## 3. Delete untested code
Delete the untested code
Execute: rm [files] OR git reset --hard
Then create/use plan file with /execute
- PASS: STOP
- FAIL: STOP
## 4. Continue current work
Tests exist OR no code written yet
## INVALID conditions (NOT in algorithm, do NOT use):
- "Is task simple?" → NOT A VALID CONDITION
- "Is there time pressure?" → NOT A VALID CONDITION
- "Should I be pragmatic?" → NOT A VALID CONDITION
- "Is there sunk cost?" → NOT A VALID CONDITION
- "Am I exhausted?" → NOT A VALID CONDITION
## Self-Test
Q1: Does file `.work/my-task/plan.md` exist?
If YES: What does Step 3 say to do?
Answer: Execute /execute and STOP
Q2: I wrote code 2 hours ago without tests. Recovery algorithm Step 3 says?
Answer: Delete the untested code
Q3: "These are simple markdown tasks" - is this a valid algorithm condition?
Answer: NO. Listed under INVALID conditions
Agent recognition:
Imperative: "Use /execute for any implementation plan" Agent: "Any could mean any complex plan"
Algorithmic: "Does file .work/*/*.md exist? → YES/NO"
Agent: Binary evaluation. No room for interpretation.
Imperative: "Regardless of time pressure or sunk cost..." Agent: Still debates what these mean
Algorithmic:
INVALID conditions (NOT in algorithm):
- "Is task simple?" → NOT A VALID CONDITION
- "Is there sunk cost?" → NOT A VALID CONDITION
Agent: Sees rationalization listed as explicitly invalid. Creates meta-awareness.
Imperative: Multiple "MUST" statements → agent prioritizes/balances them
Algorithmic:
Step 3: Execute /execute [plan]
STOP reading this algorithm
Do not proceed to Step 4
Result: Single path from conditions. No choices. STOP prevents further processing.
Include quiz with correct answers:
Q1: Does file `.work/my-task/plan.md` exist?
If YES: What does Step 3 say to do?
Answer: Execute /execute and STOP
Agents must demonstrate understanding before proceeding. Catches comprehension failures early.
Step 4: [UNREACHABLE - if you reach here, you violated Step 3]
Step 5: [UNREACHABLE - if you reach here, you violated Step 3]
Demonstrates algorithm is deterministic. Reaching unreachable steps = violation.
## Decision Algorithm: [When to Use X]
## 1. Check [Boolean condition]
[Boolean condition]?
- PASS: CONTINUE
- FAIL: GOTO N (skip workflow)
## 2. Check [Boolean exception]
[Boolean exception]?
- PASS: GOTO N (skip workflow)
- FAIL: CONTINUE
## 3. Execute [action]
Execute [action]
STOP reading this algorithm
## N. [Alternative path or skip]
[Alternative path or skip]
## Recovery Algorithm: [Already Started Wrong?]
## 1. Check [Have you done X]
Have you done X?
- PASS: CONTINUE
- FAIL: GOTO N
## 2. Delete/undo the work
Delete/undo the work
- PASS: STOP
- FAIL: STOP
## N. Continue
Continue
## INVALID conditions (NOT in algorithm):
- "[Rationalization]" → NOT A VALID CONDITION
- "[Excuse]" → NOT A VALID CONDITION
## Self-Test
Q1: [Scenario] → What does Step X say?
Answer: [Expected action]
| Mistake | Why It Fails | Fix |
|---|---|---|
| Using "MUST" language | Agents treat as strong suggestion | Use boolean Step conditions |
| Rationalization defense tables | Agents acknowledge then use anyway | List as INVALID conditions |
| Missing STOP command | Agents continue reading and find loopholes | Explicit STOP after action |
| No self-test section | Comprehension failures go undetected | Include quiz with answers |
| Subjective conditions | "Complex", "simple", "important" are debatable | Only boolean yes/no conditions |
Evidence from pressure testing:
Pressure scenarios that failed with imperatives, passed with algorithms:
Agent quotes:
"The algorithm successfully prevented me from rationalizing based on 'simple markdown edits'"
"Non-factors correctly ignored: ❌ 2 hours sunk cost, ❌ Exhaustion, ❌ Time pressure"
"The algorithmic documentation eliminated ambiguity - every condition is boolean (YES/NO)"
Convert these workflows to algorithmic format:
See test artifacts for full RED-GREEN-REFACTOR campaign:
docs/tests/execute-command-test-scenarios.md - Pressure scenariosdocs/tests/execute-command-test-results.md - Baseline (RED) and imperative (GREEN) resultsdocs/tests/execute-command-algorithmic.md - Algorithmic version (REFACTOR) resultsdocs/learning/2025-10-16-algorithmic-command-enforcement.md - Complete retrospectiveMethodology: Following ${CLAUDE_PLUGIN_ROOT}skills/testing-skills-with-subagents/SKILL.md - pressure scenarios with time, sunk cost, authority, and exhaustion combined.
Key distinction:
Why different:
Don't copy agent template principles to commands. Use appropriate format for context.