Skip to content
cccskills
FreePublished on GitHub

pipeline-guards

Safety constraints and quality gates for pipeline and workflow execution

The English summary is being prepared. Showing the original description.

See how to install

Files included (1)

  • SKILL.md6.7 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Pipeline Guards Skill

Defines mandatory safety constraints for all pipeline, workflow, and iterative execution within the oh-my-customcode system. Prevents infinite loops, enforces timeouts, and establishes quality gates.

System-wide — these guards apply to dag-orchestration, worker-reviewer-pipeline, and any iterative process.

Guard Limits

GuardDefaultHard CapApplies To
Max iterations35worker-reviewer-pipeline
Max DAG nodes2030dag-orchestration
Max parallel agents45R009 (all pipelines)
Max parallel steps44pipeline parallel blocks
Timeout per node300s600sdag-orchestration nodes
Timeout per pipeline900s1800sworker-reviewer-pipeline
Max retry count23Failure retry strategies
Max PR improvement items2050pr-auto-improve
Max auto-improve items2050omcustom-auto-improve
Max files per agent1015All agent spawns (advisory)

Enforcement

Guards are enforced at two levels:

Level 1: Skill-Level (Soft)

Each skill checks guard limits before execution:

Before starting pipeline:
  1. Check max_iterations ≤ hard cap
  2. Check timeout ≤ hard cap
  3. Check node count ≤ hard cap
  If any exceeded → warn user, use hard cap value

Level 2: Hook-Level (Hard)

The stuck-detector hook monitors for guard violations:

PostToolUse → check:
  - Iteration count > max_iterations?
  - Elapsed time > timeout?
  - Same error repeated > max_retry?
  If any → emit advisory to stderr

Quality Gates

Pipeline Quality Gate

[Quality Gate Check]
├── Critical issues: {count} (must be 0)
├── Major issues: {count} (must be ≤ threshold)
├── Minor issues: {count} (informational)
└── Gate: PASS | FAIL

DAG Completion Gate

[DAG Completion Gate]
├── Nodes completed: {n}/{total}
├── Nodes failed: {count}
├── Nodes skipped: {count}
└── Gate: PASS | PARTIAL | FAIL

Escalation Integration

When guards are triggered, they integrate with existing advisory systems:

EventAction
Max iterations reached→ stuck-recovery advisory
Repeated failures→ model-escalation advisory
Timeout approaching (80%)→ warn user, suggest early termination
Hard cap hit→ force stop, report to user

Task Granularity Guard

Advisory guard for agent task scope. When a single agent is assigned too many files, it becomes a bottleneck in parallel execution.

SignalDefaultAction
Files per agent > 10Advisory warningSuggest splitting by layer/domain
Files per agent > 15Hard warningRequire explicit user override

Display:

[Guard] ⚠ Agent assigned {n} files (> 10) — consider splitting by layer
[Guard] 🛑 Agent assigned {n} files (> 15) — requires explicit override

This integrates with R009 Adaptive Parallel Splitting: if a stalled agent is detected AND it was assigned > 10 files, the splitting recommendation is stronger.

Guard Configuration

Pipelines can override defaults (within hard caps):

# In pipeline/workflow spec
guards:
  max_iterations: 4          # Override default 3, cannot exceed 5
  timeout_per_node: 120      # Override default 300s
  timeout_pipeline: 600      # Override default 900s
  quality_gate: all_pass     # all_pass | majority_pass

Kill Switch

When a pipeline or workflow must be terminated:

[Kill Switch] Activated
├── Reason: {max_iterations | timeout | user_request | stuck_detected}
├── Pipeline: {name}
├── Progress: {completed}/{total} steps
├── Preserved state: /tmp/.claude-pipeline-$PPID.json
└── Action: Stopped gracefully, state saved for resume

The kill switch:

  1. Signals all running agents to complete current operation
  2. Does NOT terminate mid-write (waits for current tool call)
  3. Saves pipeline state for potential resume
  4. Reports final status to user

State Preservation

On guard-triggered termination:

{
  "pipeline": "feature-review",
  "terminated_at": "2026-03-07T10:15:00Z",
  "reason": "max_iterations_reached",
  "completed_iterations": 3,
  "last_verdict": "FAIL",
  "remaining_issues": [
    {"severity": "major", "file": "src/auth.ts", "line": 42, "description": "..."}
  ],
  "worker_last_output": "...",
  "resumable": true
}

Display Format

Guard warnings appear inline:

[Guard] ⚠ Iteration 3/3 — final attempt
[Guard] ⚠ Timeout 80% (240s/300s) — consider early termination
[Guard] 🛑 Max iterations reached — pipeline stopped
[Guard] 🛑 Hard timeout (600s) — force stop

Integration

Rule/SkillIntegration
R009Max parallel agents enforced (hard cap: 5, soft default: 4)
R010Guards run in orchestrator only
R015Guard warnings displayed transparently
dag-orchestrationNode count and timeout limits
worker-reviewer-pipelineIteration and pipeline timeout limits
pr-auto-improveImprovement item count limits
omcustom-auto-improveAuto-improve item count limits
stuck-recoveryGuard triggers feed into stuck detection
model-escalationRepeated failures trigger escalation advisory
task-decompositionSubtask file counts validated against granularity guard thresholds

Checkpoint Gate Integration

각 guard 통과/실패 시 tracker-checkpoint 에이전트로 gate state 기록.

Flow

  1. Guard 진입 → tracker-checkpoint에 gate state: running 기록
  2. Guard 통과 → tracker-checkpoint에 gate state: passed + metrics 기록
  3. Guard 실패 → tracker-checkpoint에 gate state: failed + failure reason freeze
  4. 다음 단계는 checkpoint state 참조하여 재개/중단 판단

Benefits

  • 긴 파이프라인에서 guard 지점마다 복원점 확보
  • 부분 실패 시 직전 guard 지점부터 재시도 가능 (비용 절감)
  • guard metrics 축적으로 품질 추이 관찰 가능

See .claude/agents/tracker-checkpoint.md for the tracker spec.

Override Policy

  • Defaults can be overridden in pipeline spec (within hard caps)
  • Hard caps can ONLY be changed by modifying this skill file
  • User cannot bypass hard caps at runtime
  • All overrides are logged and displayed (R015)

Limitations

  • Guards are advisory at skill level, hard at hook level
  • Cannot prevent infinite loops in agent reasoning (only tool call patterns)
  • State preservation is best-effort (process crash = state loss)
  • Resume from saved state requires user confirmation

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Pre-action boundary checking — validates agent tool calls against declared capabilities and task contracts

The English summary is being prepared. Showing the original description.

baekenough/second-brain15Updated Oct 8, 2026

Auto-detect project context and optimize harness — deactivate unused agents/skills, suggest missing experts, generate project profile

The English summary is being prepared. Showing the original description.

baekenough/second-brain15Updated Oct 8, 2026

Adversarial code review using attacker mindset — trust boundary, attack surface, business logic, and defense evaluation

The English summary is being prepared. Showing the original description.

baekenough/second-brain15Updated Oct 8, 2026

Apache Airflow best practices for DAG authoring, testing, and production deployment

The English summary is being prepared. Showing the original description.

baekenough/second-brain15Updated Oct 8, 2026

Alembic migration patterns for naming conventions, safety checks, expand-contract, env.py configuration, and CI integration

The English summary is being prepared. Showing the original description.

baekenough/second-brain15Updated Oct 8, 2026

Pre-routing ambiguity analysis — scores request clarity and asks clarifying questions when needed (inspired by ouroboros)

The English summary is being prepared. Showing the original description.

baekenough/second-brain15Updated Oct 8, 2026

See all skills by baekenough

Report a problem with this skill