# Abductive

> Generate and compare plausible explanations for incomplete observations, separating observed evidence from hypotheses and identifying tests that could distingui

- Skill: `samotech/abductive-2` (Agent Skill)
- Install (CLI): `npx get-skill add samotech/abductive-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/samotech/abductive-2/raw
- Safety review: pending
- Works with: any agent that reads SKILL.md (Claude Code, Claude.ai, Cursor, Codex, Windsurf, 60+ more)
- Category: Coding & Dev Tools
- Author: SamoTech (https://skillmd.com/u/samotech)
- Updated: 2026-11-27
- Page: https://skillmd.com/skills/samotech/abductive-2

---

---
name: abductive
description: Generate and compare plausible explanations for incomplete observations, separating observed evidence from hypotheses and identifying tests that could distinguish competing explanations.
metadata:
  source: skills/02-reasoning/abductive.md
  category: 02-reasoning
  version: "v2"
---

![Dependency Status](https://img.shields.io/endpoint?url=https://samotech.github.io/skills-tree/badges/skills-02-reasoning-abductive.json)

# Abductive Reasoning

**Category:** `reasoning`
**Skill Level:** `advanced`
**Stability:** `stable`
**Added:** 2025-03
**Last Updated:** 2026-04

---

## Description

Infer the most plausible explanation for an incomplete set of observations — the logical "inference to the best explanation." Given partial evidence (symptoms, logs, user complaints, sensor spikes), the agent generates ranked hypotheses ordered by likelihood, identifies what evidence supports each, and suggests what additional data would confirm or rule out each candidate. Useful for root-cause analysis, medical triage, debugging, and scientific hypothesis generation.

---

## Inputs

| Input | Type | Required | Description |
|---|---|---|---|
| `observations` | `list` | ✅ | List of observed facts or symptoms |
| `domain` | `string` | ❌ | Domain hint: `medical`, `software`, `mechanical`, etc. |
| `top_n` | `int` | ❌ | Number of hypotheses to return (default: 3) |

---

## Outputs

| Output | Type | Description |
|---|---|---|
| `hypotheses` | `list` | `[{hypothesis, plausibility, supporting_evidence, falsification_test}]` |
| `best_explanation` | `string` | Top-ranked hypothesis |
| `confidence` | `string` | `high` / `medium` / `low` |

---

## Example

```python
import anthropic
import json

client = anthropic.Anthropic()

def abductive_analysis(observations: list[str], domain: str = "") -> dict:
    """
    Return ranked hypotheses explaining the given observations.
    observations: list of factual observations (e.g. error messages, symptoms)
    """
    obs_text = "\n".join(f"- {o}" for o in observations)
    domain_hint = f"Domain context: {domain}\n" if domain else ""

    response = client.messages.create(
        model="claude-opus-4-5",
        max_tokens=2048,
        messages=[{
            "role": "user",
            "content": (
                f"{domain_hint}"
                "Observations:\n"
                f"{obs_text}\n\n"
                "Using abductive reasoning, return JSON with:\n"
                "- hypotheses: top 3 [{hypothesis, plausibility (0-1), "
                "supporting_evidence (list), falsification_test}]\n"
                "- best_explanation: string\n"
                "- confidence: high | medium | low\n"
                "- missing_evidence: what additional data would help\n"
                "Return ONLY valid JSON."
            )
        }]
    )
    return json.loads(response.content[0].text)

result = abductive_analysis(
    observations=[
        "Server CPU spiked to 100% at 03:17 UTC",
        "Database slow query log shows 450ms average at the same time",
        "No deployments in the past 24 hours",
        "Traffic was 30% below normal"
    ],
    domain="software infrastructure"
)
print(json.dumps(result, indent=2))
```

---

## Frameworks & Models

| Framework / Model | Implementation | Since |
|---|---|---|
| Claude claude-opus-4-5 | Extended thinking + direct prompt | 2025-01 |
| GPT-4o | Chain-of-thought prompt | 2024-05 |
| LangGraph | Multi-step hypothesis graph node | v0.1 |

---

## Notes

- Enable extended thinking for complex multi-variable observations
- Frame observations as factual statements, not already-interpreted conclusions
- For software debugging, attach relevant log snippets to the observations list

---

## Failure Modes

- **Plausibility bias:** the "best" explanation is chosen because it is familiar, not because it explains more of the evidence; rank hypotheses by coverage and simplicity, not by precedent.
- **Unfalsifiable hypotheses:** abduction can always produce *some* explanation; require each hypothesis to state a discriminating check that could refute it.
- **Treating abduction as proof:** an inferred explanation is a lead, not a conclusion; confirm it with dedicated evidence before acting on it.
- **Narrative inflation:** partial evidence plus a fluent narrative feels complete; explicitly list what the evidence does *not* explain before committing to the diagnosis.

## Related Skills

- [Causal Reasoning](causal.md) — determining cause-effect chains
- [Bayesian Reasoning](bayesian-reasoning.md) — probabilistic belief updating
- [Hypothesis Generation](hypothesis-generation.md) — generating ranked candidate explanations

---

## Changelog

| Date | Change |
|---|---|
| `2026-04` | Expanded from stub: full description, I/O table, root-cause analysis example |
| `2025-03` | Initial stub entry |

## Evidence
The canonical skill file is the authoritative repository implementation. Repository schema, validation workflows, and the Agent Skills projection contract define structural conformance. Implementation guidance must remain traceable to supplied or independently verified authoritative sources; no benchmark claim is made without reproducible evidence.

