chaos-steady-state-definition
Skill19 starsChanged 6 months agoMITView on GitHub
Define, measure, and validate the steady state of a system before and after chaos experiments. Use this skill whenever the user needs to establish a baseline for a service, define SLIs for chaos, configure LitmusChaos probes, determine what "healthy" means for a system, create pre-experiment checklists, or validate that a system has recovered to normal operation after a chaos experiment. Also trigger when setting up Prometheus queries to measure steady state health metrics.
In this repository37 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- workflow-orchestratorSkill
- user-flow-writingSkill
- ba-requirements-analysisSkill
- taste-memory-managementSkill
- progress-trackerSkill
- harness-pipeline-designSkill
- harness-service-onboardingSkill
- harness-delegate-managementSkill
- harness-secrets-managementSkill
- harness-feature-flagsSkill
- harness-template-librarySkill
- harness-gitopsSkill
- security-scanningSkill
- cloakbrowser-testingSkill
- performance-load-testingSkill
- chaos-experiment-designSkill
- chaos-hypothesis-validationSkill
- chaos-blast-radius-controlSkill
- chaos-infrastructure-faultsSkill
- chaos-application-faultsSkill
- chaos-game-day-planningSkill
- harness-cv-verificationSkill
- chaos-observability-integrationSkill
- alerting-recommendationsSkill
- harness-policy-governanceSkill
- harness-cloud-costSkill
- chaos-resilience-scoringSkill
- chaos-postmortem-learningSkill
- release-managementSkill
- disaster-recovery-business-continuitySkill
- compliance-auditSkill
- strategic-creatorSkill
- deep-researchSkill
- system-optimizationSkill
- documentation-writingSkill
- devils-advocateSkill
The file
Files
Chaos Steady State Definition
Purpose
Establish a rigorous, measurable definition of "healthy" for every service before chaos experiments run. Without a defined steady state, you cannot determine whether chaos caused harm or whether the system recovered.
Prerequisites
- Service definitions from s05 (Service Onboarding)
- Pipeline YAML from s04 (Pipeline Design)
- Prometheus or metrics endpoint accessible
- Observability stack active and collecting metrics
- Performance baselines from s13 (Performance Testing) recommended
Input Contract
| Input | Source | Required |
| Service definitions | s05 (workflow_context.artifacts) | Yes |
| SLO/SLI targets from PRD | s01 context | Yes |
| Observability tools available | s20 output or user | Yes |
| Pipeline CV metrics | s19 output | No |
| Service dependencies map | s01 context | Yes |
Output Contract
| Output | Destination | Format |
| Steady state definition YAML per service | .commandcode/artifacts/steadystate-<service>.yaml | YAML |
| Prometheus recorded rules | .commandcode/artifacts/prometheus-rules-steadystate.yaml | YAML |
| LitmusChaos probe configurations | s12 (experiment manifests) | YAML (probes section) |
| Pre-experiment validation script | .commandcode/artifacts/pre-chaos-check.sh | Bash |
| Steady state violation alert rules | s21 (alerting) | YAML |
Steady State Dimensions
Steady State = {Availability} ∩ {Performance} ∩ {Correctness} ∩ {Resources}
Availability: Is the service responding? → HTTP probe / TCP probe
Performance: Is it responding fast enough? → Latency percentiles
Correctness: Is it returning correct data? → Functional probes
Resources: Is resource use within bounds? → CPU / memory / connectionsStep 1 — Define Steady State Metrics
For each service, document the following baseline (measure over 7-day p50):
# steadystate-<SERVICE>.yaml
# Generated by: hybrid-harness-chaos-process-prm
steadyState:
service: <SERVICE_NAME>
namespace: <NAMESPACE>
measuredAt: <DATE>
environment: <ENV>
availability:
httpHealthEndpoint: /health
expectedStatusCode: 200
maxResponseTimeMs: 500
minimumSuccessRate: 99.9 # %
performance:
p50LatencyMs: <MEASURED> # e.g., 45
p95LatencyMs: <MEASURED> # e.g., 120
p99LatencyMs: <MEASURED> # e.g., 250
maxAllowedP99Ms: <2x p99> # Chaos threshold = 2x baseline
errorRates:
http5xxRate: <MEASURED> # e.g., 0.1%
maxAllowed5xx: 5.0 # % threshold during chaos
throughput:
requestsPerSecond: <MEASURED> # e.g., 1200
minAllowedRPS: <50% of above> # e.g., 600 (50% floor)
resources:
cpuUsagePercent: <MEASURED> # e.g., 35%
memoryUsageMB: <MEASURED> # e.g., 512MB
connectionPoolUsage: <MEASURED> # e.g., 40%
maxCpuAllowed: 80 # % (chaos shouldn't push above this)
dependencies:
- name: postgres
healthCheck: "SELECT 1"
maxLatencyMs: 50
- name: redis
healthCheck: PING
maxLatencyMs: 10
- name: payment-gateway
healthCheck: GET /v1/health
maxLatencyMs: 200Step 2 — Prometheus Steady State Queries
Save these as recorded rules for reuse:
# prometheus-rules-steadystate.yaml
groups:
- name: steady_state_<SERVICE>
interval: 30s
rules:
- record: steady_state:error_rate:rate1m
expr: |
sum(rate(http_requests_total{
namespace="<NAMESPACE>",
job="<SERVICE>",
status=~"5.."
}[1m])) /
sum(rate(http_requests_total{
namespace="<NAMESPACE>",
job="<SERVICE>"
}[1m])) * 100
- record: steady_state:p99_latency:histogram_quantile
expr: |
histogram_quantile(0.99,
sum(rate(http_request_duration_ms_bucket{
namespace="<NAMESPACE>",
job="<SERVICE>"
}[5m])) by (le)
)
- record: steady_state:availability:rate5m
expr: |
sum(rate(http_requests_total{
namespace="<NAMESPACE>",
job="<SERVICE>",
status=~"2..|3.."
}[5m])) /
sum(rate(http_requests_total{
namespace="<NAMESPACE>",
job="<SERVICE>"
}[5m])) * 100
# Alert when steady state is violated during chaos
- alert: SteadyStateViolation
expr: steady_state:error_rate:rate1m > 5.0
for: 1m
labels:
severity: warning
context: chaos
annotations:
summary: "Steady state violated: error rate {{ $value }}% > 5%"Step 3 — LitmusChaos Probes Configuration
Probes are the automated steady state gatekeepers inside chaos experiments:
# Comprehensive probe set for any service
probe:
# ── Probe 1: HTTP Availability (Continuous) ──
- name: http-availability-probe
type: httpProbe
mode: Continuous # Polls throughout entire experiment
httpProbe/inputs:
url: "http://<SERVICE>.<NAMESPACE>.svc.cluster.local/health"
insecureSkipVerify: false
method:
get:
criteria: "=="
responseCode: "200"
runProperties:
probeTimeout: 3s
interval: 5s
retry: 2
probePollingInterval: 2s
stopOnFailure: true # Abort experiment if probe fails
# ── Probe 2: Error Rate (Edge — check before and after) ──
- name: error-rate-probe
type: promProbe
mode: Edge
promProbe/inputs:
endpoint: "http://prometheus.monitoring.svc.cluster.local:9090"
query: steady_state:error_rate:rate1m{namespace="<NAMESPACE>"}
comparator:
type: float
criteria: "<="
value: "5.0"
runProperties:
probeTimeout: 10s
interval: 30s
retry: 3
# ── Probe 3: P99 Latency (SOT) ──
- name: p99-latency-probe
type: promProbe
mode: Continuous
promProbe/inputs:
endpoint: "http://prometheus.monitoring.svc.cluster.local:9090"
query: steady_state:p99_latency:histogram_quantile{namespace="<NAMESPACE>"}
comparator:
type: float
criteria: "<="
value: "500" # Max 500ms p99 during chaos
runProperties:
probeTimeout: 10s
interval: 15s
retry: 2
stopOnFailure: false # Warn but don't abort on latency
# ── Probe 4: Command / Functional (Edge) ──
- name: functional-correctness-probe
type: cmdProbe
mode: Edge
cmdProbe/inputs:
command: |
curl -sf http://<SERVICE>.<NAMESPACE>.svc.cluster.local/api/v1/status \
| python3 -c "import sys,json; d=json.load(sys.stdin); sys.exit(0 if d['status']=='ok' else 1)"
comparator:
type: int
criteria: "=="
value: "0" # Exit code 0 = healthy
runProperties:
probeTimeout: 10s
interval: 30s
retry: 3Step 4 — Pre-Experiment Validation Script
#!/bin/bash
# pre-chaos-check.sh — Run before EVERY chaos experiment
set -euo pipefail
SERVICE="${1:?Usage: $0 <service> <namespace>}"
NAMESPACE="${2:?Usage: $0 <service> <namespace>}"
PROMETHEUS="http://prometheus.monitoring.svc.cluster.local:9090"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " Pre-Chaos Steady State Check"
echo " Service: $SERVICE | Namespace: $NAMESPACE"
echo " $(date -u +%Y-%m-%dT%H:%M:%SZ)"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
PASS=0; FAIL=0
check() {
local name="$1"; local cmd="$2"; local expected="$3"
local result
result=$(eval "$cmd" 2>/dev/null || echo "ERROR")
if [ "$result" = "$expected" ] || [ "$result" != "ERROR" ]; then
echo "✅ $name: $result"
((PASS++))
else
echo "❌ $name: $result (expected: $expected)"
((FAIL++))
fi
}
# 1. Pod count
POD_COUNT=$(kubectl get pods -n "$NAMESPACE" -l "app=$SERVICE" \
--field-selector=status.phase=Running --no-headers | wc -l | tr -d ' ')
[ "$POD_COUNT" -ge 2 ] && echo "✅ Pod count: $POD_COUNT" && ((PASS++)) || \
{ echo "❌ Pod count: $POD_COUNT (need ≥ 2)"; ((FAIL++)); }
# 2. HTTP health
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
"http://$SERVICE.$NAMESPACE.svc.cluster.local/health" || echo "000")
[ "$HTTP_CODE" = "200" ] && echo "✅ HTTP health: $HTTP_CODE" && ((PASS++)) || \
{ echo "❌ HTTP health: $HTTP_CODE"; ((FAIL++)); }
# 3. Error rate < 1%
ERROR_RATE=$(curl -sg "$PROMETHEUS/api/v1/query" \
--data-urlencode "query=steady_state:error_rate:rate1m{namespace=\"$NAMESPACE\"}" \
| python3 -c "import json,sys; r=json.load(sys.stdin)['data']['result']; \
print(r[0]['value'][1] if r else '0')" 2>/dev/null || echo "N/A")
echo "📊 Error rate: ${ERROR_RATE}%"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "PASS: $PASS | FAIL: $FAIL"
if [ "$FAIL" -gt 0 ]; then
echo "❌ ABORT: Steady state not healthy. Fix issues before running chaos."
exit 1
else
echo "✅ PROCEED: Steady state confirmed healthy."
exit 0
fiAI Agent Integration
Autonomy Level
| Aspect | Level | Description |
| Current | L1 | AI identifies baseline metrics and creates probes |
| Target | L2 | AI generates steady-state definitions from telemetry |
Harness AI Agent
Agent: Harness AI Reliability Agent Capabilities:
- Baseline metric identification from observability data
- Probe creation (HTTP, CMD, Prometheus)
- Anomaly detection configuration
Human Gates
- Steady-state definition approval
- Baseline acceptance
MCP
- LitmusChaos MCP (resilience probes)
- Prometheus
Success Criteria
- Steady state YAML documented for every chaos target service
- Prometheus recorded rules deployed and collecting for 7+ days
- At minimum 3 probes: HTTP health + error rate + p99 latency
- Pre-experiment check script runs and passes before any chaos run
- Steady state baseline re-measured after significant releases
- Steady state violations trigger PagerDuty alert during experiments
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

