agent-enforcement

Multi-agent orchestration enforcement for /team command. Provides claudish CLI validation, validates session directory paths, and ensures /team internal Tasks use dev:researcher. Use when debugging /team orchestration failures.

248 stars

Best use case

agent-enforcement is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Multi-agent orchestration enforcement for /team command. Provides claudish CLI validation, validates session directory paths, and ensures /team internal Tasks use dev:researcher. Use when debugging /team orchestration failures.

Teams using agent-enforcement should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/agent-enforcement/SKILL.md --create-dirs "https://raw.githubusercontent.com/MadAppGang/claude-code/main/plugins/multimodel/skills/agent-enforcement/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/agent-enforcement/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How agent-enforcement Compares

Feature / Agentagent-enforcementStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Multi-agent orchestration enforcement for /team command. Provides claudish CLI validation, validates session directory paths, and ensures /team internal Tasks use dev:researcher. Use when debugging /team orchestration failures.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Agent Enforcement Skill

## Overview

Two-layer defense against orchestration violations in `/team`:

1. **PreToolUse hook** (`hooks/enforce-team-rules.sh`) — runtime violation blocker
2. **Model upgrade** (`team.md: model: opus`) — better instruction following

## How /team Invokes Models

| Model Type | Method | Tool | Reliability |
|------------|--------|------|-------------|
| Internal (Claude) | Task(dev:researcher) | Task tool | High (same process) |
| External (Grok, Gemini, etc.) | Bash(claudish --model) | Bash tool | 100% (deterministic CLI) |

External models are called via claudish CLI directly from Bash — no LLM delegation needed.

## Hook Rules (enforce-team-rules.sh)

The PreToolUse hook intercepts Task and Bash tool calls at runtime:

| Rule | Condition | Action |
|------|-----------|--------|
| 1 | /team Task with wrong agent | DENY (must be dev:researcher) |
| 2 | /tmp/ in Task prompt | DENY |

### Layer 1: PreToolUse Hook

Detects /team workflows by vote template pattern in Task prompts. Blocks:

- **Wrong agent for /team Tasks:** Only `dev:researcher` is allowed for internal model Tasks
- **Insecure paths:** No `/tmp/` paths in Task prompts (use `ai-docs/sessions/`)

### Layer 2: model: opus

The `/team` command uses `model: opus` (Opus 4.6) which follows complex XML instructions
much more reliably than Sonnet (~90% vs ~33% compliance).

## Agent Selection for Task Delegation

| Task Type | Primary Agent | Alternatives |
|-----------|--------------|--------------|
| Investigation | dev:researcher | dev:debugger |
| Review | agentdev:reviewer | frontend:reviewer |
| Architecture | dev:architect | frontend:architect, agentdev:architect |
| Implementation | dev:developer | frontend:developer, agentdev:developer |
| Testing | dev:test-architect | frontend:test-architect |
| DevOps | dev:devops | — |
| UI/Design | dev:ui | frontend:designer, frontend:ui-developer |

## Pre-processor (resolve-agents.sh)

The `/team` command can optionally call `resolve-agents.sh` to determine agent and method
for each model before launching:

```bash
bash "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-agents.sh" \
  --models "internal,x-ai/grok-code-fast-1" \
  --task-type "investigation"
```

Output:
```json
{
  "sessionDir": "ai-docs/sessions/team-slug-timestamp-random",
  "taskType": "investigation",
  "resolutions": [
    { "modelId": "internal", "method": "direct", "agent": "dev:researcher" },
    { "modelId": "x-ai/grok-code-fast-1", "method": "cli", "agent": "dev:researcher" }
  ]
}
```

Methods:
- `"direct"` — Internal Claude via Task(agent)
- `"cli"` — External model via Bash(claudish --model)

## Validation

Run the test suite to verify enforcement:

```bash
cd autotest/team && bash run-tests.sh
```

## Troubleshooting

**Hook blocking legitimate calls:**
The hook triggers on /team vote template patterns in Task prompts and claudish in Bash commands.
Normal Task usage (without vote templates) is never affected.

**resolve-agents.sh not found:**
The `/team` command uses its own built-in logic. The hook still provides runtime protection.

**Hook behavior:**
The hook skips existence checks (`which claudish`, `command -v claudish`).

Related Skills

phase-enforcement

248
from MadAppGang/claude-code

Evidence-based phase completion enforcement for /dev:feature. Use when orchestrating 8-phase feature development to ensure artifacts exist before phase completion, validation criteria are addressed, outer loops are enforced, and show-your-work requirements are met.

test-skill

248
from MadAppGang/claude-code

A test skill for validation testing. Use when testing skill parsing and validation logic.

bad-skill

248
from MadAppGang/claude-code

This skill has invalid YAML in frontmatter

release

248
from MadAppGang/claude-code

Plugin release process for MAG Claude Plugins marketplace. Covers version bumping, marketplace.json updates, git tagging, and common mistakes. Use when releasing new plugin versions or troubleshooting update issues.

openrouter-trending-models

248
from MadAppGang/claude-code

Fetch trending programming models from OpenRouter rankings. Use when selecting models for multi-model review, updating model recommendations, or researching current AI coding trends. Provides model IDs, context windows, pricing, and usage statistics from the most recent week.

Claudish Integration Skill

248
from MadAppGang/claude-code

**Version:** 1.0.0

transcription

248
from MadAppGang/claude-code

Audio/video transcription using OpenAI Whisper. Covers installation, model selection, transcript formats (SRT, VTT, JSON), timing synchronization, and speaker diarization. Use when transcribing media or generating subtitles.

final-cut-pro

248
from MadAppGang/claude-code

Apple Final Cut Pro FCPXML format reference. Covers project structure, timeline creation, clip references, effects, and transitions. Use when generating FCP projects or understanding FCPXML structure.

ffmpeg-core

248
from MadAppGang/claude-code

FFmpeg fundamentals for video/audio manipulation. Covers common operations (trim, concat, convert, extract), codec selection, filter chains, and performance optimization. Use when planning or executing video processing tasks.

statusline-customization

248
from MadAppGang/claude-code

Configuration reference and troubleshooting for the statusline plugin — sections, themes, bar widths, and script architecture

technical-audit

248
from MadAppGang/claude-code

Technical SEO audit methodology including crawlability, indexability, and Core Web Vitals analysis. Use when auditing pages or sites for technical SEO issues.

serp-analysis

248
from MadAppGang/claude-code

SERP analysis techniques for intent classification, feature identification, and competitive intelligence. Use when analyzing search results for content strategy.