home / skills / athola / claude-night-market / risk-classification

risk-classification skill

/plugins/leyline/skills/risk-classification

This skill classifies tasks into GREEN, YELLOW, RED, or CRITICAL using fast heuristics and escalates high-risk cases to war-room for reversible scoring.

npx playbooks add skill athola/claude-night-market --skill risk-classification

Review the files below or copy the command above to add this skill to your agents.

Files (4)
SKILL.md
4.4 KB
---
name: risk-classification
description: 'Inline risk classification for agent tasks using a 4-tier model. Hybrid
  routing: GREEN/YELLOW use heuristic file-pattern matching, RED/CRITICAL escalate
  to war-room-checkpoint for full reversibility scoring.'
category: infrastructure
tags:
- risk
- classification
- safety
- verification
- gates
dependencies:
- error-patterns
provides:
  infrastructure:
  - risk-tier-classification
  - verification-gates
  - heuristic-classifier
  patterns:
  - risk-aware-coordination
  - tier-based-verification
usage_patterns:
- task-risk-assessment
- verification-gate-routing
- parallel-safety-validation
complexity: intermediate
estimated_tokens: 500
progressive_loading: true
modules:
- modules/tier-definitions.md
- modules/heuristic-classifier.md
- modules/verification-gates.md
---
## Table of Contents

- [Overview](#overview)
- [When to Use](#when-to-use)
- [4-Tier Risk Model](#4-tier-risk-model)
- [Hybrid Routing](#hybrid-routing)
- [Task Metadata Extension](#task-metadata-extension)
- [Module Reference](#module-reference)
- [Integration Pattern](#integration-pattern)
- [Exit Criteria](#exit-criteria)


# Risk Classification

## Overview

Provides inline risk classification for agent tasks using a 4-tier model (GREEN/YELLOW/RED/CRITICAL). Uses fast heuristic file-pattern matching for low-risk tiers and delegates to `Skill(attune:war-room-checkpoint)` for high-risk tiers requiring full reversibility scoring.

## When To Use

- Assessing risk of tasks before agent assignment
- Determining verification requirements for task completion
- Deciding parallel execution safety between tasks
- Adding risk markers to task checklists

## When NOT To Use

- Single-file trivial changes (assume GREEN)
- Strategic architecture decisions (use full `Skill(attune:war-room)` instead)
- Non-code tasks (documentation-only, configuration comments)

## 4-Tier Risk Model

| Tier | Color | Scope | Example | Verification |
|------|-------|-------|---------|-------------|
| **GREEN** | Safe | Single file, trivial revert | Test files, docs, utils | None required |
| **YELLOW** | Caution | Module-level, user-visible | Components, routes, views | Conflict check + test pass |
| **RED** | Danger | Cross-module, security/data | Migrations, auth, database schema | War-room RS + full test + review |
| **CRITICAL** | Stop | Irreversible, regulated | Data deletion, production deploy | War-room RS + human approval |

## Hybrid Routing

```
Task received
    |
    v
Heuristic classifier (file patterns)
    |
    ├── GREEN/YELLOW → Apply tier, continue
    |
    └── RED/CRITICAL → Invoke Skill(attune:war-room-checkpoint)
                        for reversibility scoring (RS)
                        |
                        └── RS confirms or adjusts tier
```

**Why hybrid**: GREEN/YELLOW classification is fast and deterministic (file pattern matching). RED/CRITICAL tasks warrant the overhead of full reversibility analysis because the cost of getting them wrong is high.

## Task Metadata Extension

Add risk tier to task metadata for downstream consumption:

```json
{
  "id": "5",
  "subject": "Add user authentication",
  "metadata": {
    "risk_tier": "YELLOW",
    "risk_reason": "Modifies src/components/LoginForm.tsx (user-visible component)",
    "classified_at": "2026-02-07T22:00:00Z"
  }
}
```

Tasks without `risk_tier` metadata default to **GREEN** (backward compatible).

## Module Reference

- **tier-definitions.md**: Detailed tier criteria, boundaries, and override mechanism
- **heuristic-classifier.md**: File-pattern rules for automated classification
- **verification-gates.md**: Per-tier verification requirements and parallel safety matrix

## Integration Pattern

```yaml
# In your skill's frontmatter
dependencies: [leyline:risk-classification]
```

### For Task Generators

Append `[R:TIER]` marker to task format:

```markdown
- [ ] T012 [P] [US1] [R:YELLOW] Create LoginForm component in src/components/LoginForm.tsx
```

### For Orchestrators

Check risk tier before task assignment:

```
if task.risk_tier in ["RED", "CRITICAL"]:
    invoke Skill(attune:war-room-checkpoint) for RS scoring
    if CRITICAL: require human approval before proceeding
```

## Exit Criteria

- Every task has a risk tier assigned (explicit or default GREEN)
- RED/CRITICAL tasks have war-room-checkpoint RS scores
- Verification gates passed for the assigned tier
- No parallel execution of prohibited tier combinations

Overview

This skill provides inline risk classification for agent tasks using a 4-tier model (GREEN, YELLOW, RED, CRITICAL). It applies fast heuristic file-pattern matching for low-risk cases and routes high-risk tasks to a war-room checkpoint for full reversibility scoring. The goal is to tag tasks with actionable risk metadata so orchestrators and humans can make safe assignment and verification decisions.

How this skill works

Incoming tasks are scanned by a heuristic classifier that matches file patterns and task scope to GREEN or YELLOW tiers quickly. Tasks that match RED or CRITICAL indicators are escalated to a war-room-checkpoint Skill for reversibility scoring (RS) and possible tier adjustment. The final tier is written into task metadata so downstream systems enforce verification gates and parallel-safety rules.

When to use it

  • Assess risk before assigning or executing agent tasks
  • Decide required verification and reviewer involvement for a task
  • Prevent unsafe parallel execution across tasks
  • Mark task checklists with explicit risk context
  • Trigger human review workflow for irreversible changes

Best practices

  • Keep heuristic patterns focused on file types and directory scopes to minimize false positives
  • Treat unspecified tasks as GREEN to preserve backward compatibility, but log for review
  • Escalate proactively: prefer false-positive escalation to missing a RED/CRITICAL case
  • Store risk_tier, risk_reason, and classified_at in task metadata for traceability
  • Require human approval for CRITICAL tasks and ensure RS scores are recorded

Example use cases

  • Classify a task that edits a test file as GREEN so it runs automatically
  • Detect changes to authentication code and mark YELLOW to add tests and conflict checks
  • Escalate database migration edits to RED to run reversibility scoring and full test suites
  • Flag production data-deletion or deploy actions as CRITICAL and block until human sign-off
  • Annotate generated task lists with [R:TIER] markers so orchestrators can gate assignment

FAQ

What happens if a task has no risk_tier metadata?

Tasks without a risk_tier default to GREEN to maintain backward compatibility; logging and periodic audits can catch misclassifications.

Why use hybrid routing instead of always using full analysis?

Heuristic routing provides speed and determinism for low-risk changes. Full reversibility scoring is expensive and reserved for RED/CRITICAL where mistakes are costly.