Xpersona
R

risk-classification

CLAWHUB · Unverified

Classifies agent tasks into 4 risk tiers (GREEN/YELLOW/RED/CRITICAL) Skill: risk-classification Owner: athola Summary: Classifies agent tasks into 4 risk tiers (GREEN/YELLOW/RED/CRITICAL) Tags: latest:1.9.19 Version history: v1.9.19 | 2026-08-26T13:15:26.380Z | user Release v1.9.19 v1.9.17 | 2026-07-30T05:36:21.215Z | user Release v1.9.17 v1.9.16 | 2026-07-14T19:53:06.519Z | user Release v1.9.16 v1.9.14 | 2026-06-30T18:02:01.312Z | user Release v1.9.14 v1.9.13 | 2026-06-27T16:20:18.52

62
Rank
84
Safety
1.6k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.6K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17emme0e2m3cpf7k2jvp3a84984b8z9:nm-leyline-risk-classification
  1. Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-leyline-risk-classification/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

145,350 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: risk-classification
description: Classifies agent tasks into 4 risk tiers (GREEN/YELLOW/RED/CRITICAL)
version: 1.9.8
triggers:
  - risk
  - classification
  - safety
  - verification
  - gates
  - assessing action reversibility before committing to an approach
metadata: {"openclaw": {"homepage": "https://github.com/athola/claude-night-market/tree/master/plugins/leyline", "emoji": "\ud83e\udd9e", "requires": {"config": ["night-market.error-patterns"]}}}
source: claude-night-market
source_plugin: leyline
---

> **Night Market Skill** — ported from [claude-night-market/leyline](https://github.com/athola/claude-night-market/tree/master/plugins/leyline). For the full experience with agents, hooks, and commands, install the Claude Code plugin.


## 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 and test pass |
| **RED** | Danger | Cross-module, security/data | Migrations, auth, database schema | War-room RS, full test, and review |
| **CRITICAL** | Stop | Irreversible, regulated | Data deletion, production deploy | War-room RS and 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 tie

_meta.json

{
  "ownerId": "kn7d107jg9jv602h9ytsegydq184a42s",
  "slug": "nm-leyline-risk-classification",
  "version": "1.9.19",
  "publishedAt": 1787750126380
}

modules/heuristic-classifier.md

---
name: heuristic-classifier
description: Pattern-based classification rules mapping file paths and change types to risk tiers
parent_skill: leyline:risk-classification
category: infrastructure
estimated_tokens: 250
---

# Heuristic Classifier

## Pattern-Based Classification Rules

The classifier evaluates task risk by matching affected file paths against pattern rules. Higher-tier matches take precedence.

### CRITICAL Patterns

```
migrations/*delete*        # Destructive migration
migrations/*drop*          # Table/column drops
*.sql DROP                 # Raw SQL drops
*.sql TRUNCATE             # Data truncation
security/credentials*      # Credential management
**/secrets*                # Secret files
deploy/production*         # Production deployment
infrastructure/prod*       # Production infrastructure
**/data-deletion*          # Data deletion scripts
```

### RED Patterns

```
migrations/*               # Any database migration
auth/*                     # Authentication modules
**/authentication*         # Auth-related files
**/authorization*          # Authorization logic
*.env*                     # Environment configuration
database/*schema*          # Database schema definitions
**/encryption*             # Encryption modules
**/security/*              # Security directory
**/permissions*            # Permission definitions
**/api/schema*             # API schema (breaking changes)
**/shared/types*           # Shared type definitions (cross-module)
```

### YELLOW Patterns

```
src/components/*           # UI components (user-visible)
routes/*                   # Route definitions
views/*                    # View layer
**/api/endpoints*          # API endpoints
**/api/routes*             # API route handlers
**/services/*              # Service layer
**/middleware/*            # Middleware (request handling)
**/config/*                # Application configuration
**/templates/*             # Templates (user-visible)
**/styles/*                # Stylesheets (user-visible)
```

### GREEN (Default)

Everything not matching above patterns, including:

```
tests/*                    # Test files
docs/*                     # Documentation
**/*.md                    # Markdown files
**/utils/*                 # Utility functions
**/helpers/*               # Helper functions
**/types/*                 # Type definitions (module-local)
**/constants*              # Constants
**/__tests__/*             # Test directories
**/fixtures/*              # Test fixtures
**/mocks/*                 # Mock files
```

## Additional Classification Dimensions

### Change Type Multiplier

| Change Type | Effect |
|------------|--------|
| Add (new file) | No escalation |
| Modify (existing) | No escalation |
| Delete (remove file) | Escalate +1 tier |
| Rename/Move | Escalate +1 tier if cross-module |

### File Count Escalation

| File Count | Effect |
|-----------|--------|
| 1 file | No escalation |
| 2-5 files | No escalation |
| 6-10 files | Escal

modules/readiness-levels.md

# Readiness Levels: 4-Tier Risk Classification

A graduated risk system with required controls at each level.

## Purpose

Readiness Levels classify tasks by risk level before execution.
Higher levels require more controls, verification, and oversight.
This prevents high-risk changes from being treated casually and
ensures appropriate safeguards are in place.

## Quick Classification

Ask these questions in order. Stop at the first "yes":

1. **Is the action irreversible?** → Level 3 (Critical)
2. **Does it involve security/compliance/data integrity?** → Level 2 (Elevated)
3. **Is it user-visible or affects multiple files?** → Level 1 (Watch)
4. **Otherwise** → Level 0 (Routine)

## When to Apply

Apply Readiness Levels when:

- Starting any task that modifies code or configuration
- Planning parallel agent work (determine verification needs)
- Reviewing PRs (check that controls match the level)
- Before executing any task marked in an implementation plan

Do NOT apply when:

- The change is documentation-only with no code implications
- The work is purely exploratory with no production impact
- You're just reading files (no modification)

## Getting Started

1. Assess the task using the Quick Classification questions
2. Find the matching level in Level Definitions below
3. Check all required controls listed for that level
4. Document any additional controls you choose to add
5. Never skip required controls; you may add optional ones

## Why Four Levels

Four levels balance granularity with usability:

- **Too few levels**: Can't distinguish between "needs review" and
  "needs human approval"
- **Too many levels**: People stop using the system because it's
  too complex

The 0-3 scale maps naturally to: Routine/Watch/Elevated/Critical.
Each level has a clear escalation trigger and distinct required
controls. The gap between levels is meaningful, not arbitrary.

This pattern emerged from observing that teams with simple,
actionable risk frameworks actually use them, while teams with
complex matrices create work that everyone ignores.

## Level Definitions

### Level 0: Routine

**When to use**:

- Low blast radius (changes affect single file or function)
- Easy rollback (simple git revert or file restore)
- No user-visible changes
- No data integrity implications

**Required controls**:

- [ ] Basic validation (tests pass, lint clean)
- [ ] Rollback step documented (even if trivial)

**Example tasks**:

- Adding a new utility function
- Updating internal documentation
- Refactoring a single function's internals
- Adding a new test case

### Level 1: Watch

**When to use**:

- User-visible changes (UI, API, behavior)
- Moderate impact (affects multiple files or users)
- Configuration changes
- Dependency version updates

**Required controls**:

- [ ] Independent review (code review or pair programming)
- [ ] Negative test (verify what shouldn't happen doesn't happen)
- [ ] Rollback note (how to revert, estimated impact)
- [ ] Risk assessment checkl

modules/tier-definitions.md

---
name: tier-definitions
description: 4-tier risk model definitions, boundary criteria, and manual override mechanism
parent_skill: leyline:risk-classification
category: infrastructure
estimated_tokens: 250
---

# Tier Definitions

## Tier Table

### GREEN — Safe

**Scope**: Single file, trivially reversible (`git checkout -- <file>`)

**Criteria:**
- Changes confined to a single file
- No user-visible behavior change (or change is additive-only)
- Easily reverted with a single git operation
- No security, data, or infrastructure implications

**Typical files**: Tests, documentation, utility functions, comments, type annotations, formatting

**Verification**: None required

---

### YELLOW — Caution

**Scope**: Module-level changes, user-visible modifications

**Criteria:**
- Changes affect multiple files within a single module
- User-visible behavior changes (UI, API responses, CLI output)
- Revertible but requires coordination (multiple files to revert)
- No security or data integrity implications

**Typical files**: Components, routes, views, service layer methods, configuration

**Verification**: Conflict check and test pass

---

### RED — Danger

**Scope**: Cross-module changes, security-sensitive, data-affecting

**Criteria:**
- Changes span multiple modules or architectural boundaries
- Security implications (authentication, authorization, encryption)
- Data integrity implications (schema changes, data transformations)
- Complex revert requiring migration or data recovery

**Typical files**: Database migrations, authentication modules, encryption, API schemas, shared types

**Verification**: War-room-checkpoint RS scoring, full test suite, and code review

---

### CRITICAL — Stop

**Scope**: Irreversible changes, regulated operations, production impact

**Criteria:**
- Destructive operations that cannot be undone (data deletion, table drops)
- Production deployment or infrastructure changes
- Regulatory or compliance implications
- Changes to security credentials or access controls

**Typical files**: Production configs, data deletion scripts, deployment manifests, security credentials, compliance-related code

**Verification**: War-room-checkpoint RS scoring and human approval before execution

## File Pattern Heuristics per Tier

See `heuristic-classifier.md` for the full pattern-to-tier mapping.

## Override Mechanism

### Manual Escalation

Any task can be manually escalated to a higher tier:

```json
{
  "metadata": {
    "risk_tier": "RED",
    "risk_override": {
      "original_tier": "YELLOW",
      "escalated_by": "team-lead",
      "reason": "This component handles PII data"
    }
  }
}
```

**Rules:**
- Escalation (lower → higher) is always permitted
- De-escalation (higher → lower) requires explicit justification
- CRITICAL can only be de-escalated by human decision
- Override reason is mandatory and logged

### Automatic Escalation

The classifier automatically escalates when:
- File count exceeds module boundary (YELLOW →

Sponsored

Ads related to risk-classification and adjacent AI workflows.