home / skills / sounder25 / google-antigravity-skills-library / 17_impasse_detector

17_impasse_detector skill

/17_impasse_detector

This skill helps detect reasoning impasses by analyzing recent conversations and tool usage, then escalates when loops are detected.

npx playbooks add skill sounder25/google-antigravity-skills-library --skill 17_impasse_detector

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

Files (5)
SKILL.md
2.1 KB
---
name: Impasse Detector
description: Detects when the agent is stuck in a reasoning loop or unproductive state by analyzing tool usage and sentiment patterns.
version: 1.0.0
author: Antigravity Skills Library
created: 2026-01-16
leverage_score: 5/5
---

# SKILL-017: Impasse Detector

## Overview

Critical **meta-cognitive skill** that acts as a circuit breaker for unproductive loops. It analyzes recent conversation history and tool outputs to detect "stuck" states, preventing token wastage on failing paths and forcing escalation or delegation.

## Trigger Phrases

- `check logic`
- `am i stuck`
- `detect loop`
- `impasse check`

## Inputs

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `--TranscriptPath` | string | No | $null | Path to conversation log/json |
| `--Content` | string | No | $null | Direct string content to analyze |
| `--Lookback` | int | No | 10 | Number of recent turns to analyze |

## Outputs

### 1. Analysis Result (JSON)

```json
{
  "status": "IMPASSE",
  "confidence": 0.95,
  "reasons": [
    "Apology loop detected (4 occurrences)",
    "High frequency of file reads (6 in window)"
  ],
  "recommendation": "ESCALATE_TO_USER",
  "score": 80
}
```

### 2. Status Codes

- `CLEAR`: No issues detected.
- `IMPASSE`: Significant loop/blockage detected.
- `UNKNOWN`: Insufficient data.

## Preconditions

1. Access to conversation history OR a provided transcript string.
2. PowerShell 5.1+ or Core 7+.

## Safety/QA Checks

1. **Read-Only**: This skill only analyzes text; it does not modify state.
2. **Fail-Safe**: If input is missing/malformed, defaults to "UNKNOWN" rather than crashing.

## Stop Conditions

| Condition | Action |
|-----------|--------|
| No input provided | Return status "UNKNOWN" (0 confidence) |
| File not found | Return error JSON |

## Implementation

See `scripts/detect_impasse.ps1`.

## Integration with Other Skills

**All agent loops should:**

1. Call SKILL-017 every 5-10 turns.
2. If status is `IMPASSE`, trigger **SKILL-020 (Failure Postmortem)** AND **SKILL-010 (Async Feedback)**.
3. If score > 90, stop execution and warn user.

Overview

This skill acts as a meta-cognitive circuit breaker that detects when an agent is stuck in a reasoning loop or otherwise unproductive state. It inspects recent conversation turns and tool outputs to identify patterns like apology loops, repeated file reads, or oscillating actions. When an impasse is detected it returns a clear status, confidence score, and actionable recommendation to escalate, delegate, or run a postmortem.

How this skill works

The detector analyzes either a provided transcript string or a conversation log file and examines the last N turns (default 10) for signal patterns: repeated phrases, high-frequency identical tool calls, sentiment shifts, and apology cycles. It outputs a JSON analysis with status codes (CLEAR, IMPASSE, UNKNOWN), a confidence value, reasons for the decision, and a recommended next step. The component is read-only and designed to fail safe by returning UNKNOWN when input is missing or malformed.

When to use it

  • Periodically during long agent loops (every 5–10 turns) to avoid token waste.
  • Before launching expensive actions or external calls to ensure the plan is productive.
  • When the agent repeats apologies, re-reads files, or cycles through identical steps.
  • During debugging to surface hidden loops in multi-tool workflows.
  • As part of escalation logic to decide when to run a failure postmortem or notify a human.

Best practices

  • Provide recent transcript context; increase Lookback when behavior spans more turns.
  • Run the detector in read-only mode to avoid altering agent state.
  • Treat IMPASSE as a hard signal to escalate: trigger a postmortem and async feedback.
  • Tune detection thresholds (e.g., repeated-action counts) to match agent workload.
  • Log detector outputs for offline review to improve loop-detection rules.

Example use cases

  • Detecting an apology loop where the agent repeatedly apologizes and retries the same step.
  • Flagging high-frequency identical file reads that indicate a stuck parsing routine.
  • Stopping execution and notifying the user when score > 90 to prevent wasted resources.
  • Automatically triggering a failure postmortem after an IMPASSE status is reported.
  • Running periodic checks in long-running pipelines to maintain progress and surface stalls.

FAQ

What inputs does the detector need?

It accepts a transcript file path or a direct content string; without input it returns UNKNOWN.

Does it change agent state or files?

No. The skill is read-only and does not modify files or runtime state.