A Logic Harness for abductive inference. Anomaly in → Hypothesis out.
Project description
Peircean Abduction
A Logic Harness for Abductive Inference.
Peircean Abduction forces LLMs to stop guessing and start investigating. It implements Charles Sanders Peirce's logical framework to make uncertainty visible and hypotheses testable.
Anomaly in → Hypothesis out.
"The surprising fact, C, is observed.
But if A were true, C would be a matter of course.
Hence, there is reason to suspect that A is true."
— Charles Sanders Peirce, Collected Papers 5.189
🔍 What is this?
Most LLMs act like a Jury: they weigh the evidence they have and give you a verdict (probability-based). They tend to "lump" distinct possibilities into a single, safe conclusion.
Peircean Abduction acts like a Detective: it doesn't just decide; it investigates. It splits anomalies into distinct, testable hypotheses and tells you how to find the truth.
Key Features
- Explicit Uncertainty: Forces the model to quantify "surprise" (0.0 - 1.0).
- Structured Hypotheses: Every explanation comes with specific, testable predictions.
- Inference to Best Explanation (IBE): A rigorous selection process based on Explanatory Power, Parsimony, and Testability.
- Council of Critics: Automatically simulates 5 specialist perspectives (Empiricist, Logician, Pragmatist, Economist, Skeptic) to stress-test ideas.
- MCP Ready: Built as a Model Context Protocol (MCP) server, ready to plug into Claude Desktop, Cursor, or any MCP client.
🚀 Quick Start
1. Install
pip install peircean-abduction
2. Run an Example
We provide runnable Python scripts to demonstrate the logic harness.
Simple Demo (Single-Shot):
# Clone the repo first if you haven't
git clone https://github.com/Hmbown/peircean-abduction.git
cd peircean-abduction
# Run the quickstart
python examples/quickstart.py
Full Scenario (International Law):
python examples/international_law.py
🔌 MCP Server Setup
Connect Peircean Abduction to your AI assistant (Claude, Cursor, etc.) to give it abductive reasoning superpowers.
Claude Desktop
Automatic (recommended):
# macOS
peircean-setup-mcp --write "$HOME/Library/Application Support/Claude/claude_desktop_config.json"
# Windows
peircean-setup-mcp --write "%APPDATA%\Claude\claude_desktop_config.json"
Manual Configuration:
{
"mcpServers": {
"peircean": {
"command": "python",
"args": ["-m", "peircean.mcp.server"]
}
}
}
Cursor / VS Code
- Run
peircean-setup-mcpto generate the config JSON. - Paste it into your editor's MCP settings.
🧠 How It Works (The 3-Phase Loop)
The harness enforces a strict 3-step logical flow:
Phase 1: Observe (peircean_observe_anomaly)
- Input: A raw observation (e.g., "Server latency spiked 10x but CPU is normal").
- Output: A structured "Anomaly" object defining why this is surprising and what baseline was violated.
Phase 2: Hypothesize (peircean_generate_hypotheses)
- Input: The Anomaly from Phase 1.
- Output: A list of distinct, falsifiable hypotheses (A's). Each must explain the anomaly if true.
Phase 3: Evaluate (peircean_evaluate_via_ibe)
- Input: The Hypotheses from Phase 2.
- Output: A final Verdict selected via Inference to Best Explanation (IBE). This phase can optionally convene a "Council of Critics" to debate the options.
⚡ Case Study: The "Lumping" Problem
Scenario: A "defunct" military satellite collides with a commercial station. Flight logs show a controlled burn 10s before impact.
- Standard LLM: "It was likely a malfunction or a hidden military test." (Lumps distinct ideas together, vague).
- Peircean Harness:
- H1 (Attack): "Sleeper weapon activated." -> Prediction: Check for uplink signals at T-10s.
- H2 (Glitch): "Deorbit script misfire." -> Prediction: Check code for specific trigger conditions.
- Verdict: Investigate H1 first because it explains the vector (steering into target), whereas H2 only explains the burn.
Documentation
Contributing
License
MIT License. See LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file peircean_abduction-0.2.0.tar.gz.
File metadata
- Download URL: peircean_abduction-0.2.0.tar.gz
- Upload date:
- Size: 80.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af7c291a7c1f00b49a017e4c64201bfb10f8a7c7942bdf5d4e8612cb10b30c9b
|
|
| MD5 |
a5ceac2d25828be12d4b605a5083b804
|
|
| BLAKE2b-256 |
6b0a59ccd1600b36889b685f0db8341d389a59a02a85fe931e1266dd3dd2ccae
|
Provenance
The following attestation bundles were made for peircean_abduction-0.2.0.tar.gz:
Publisher:
publish.yml on Hmbown/peircean-abduction
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
peircean_abduction-0.2.0.tar.gz -
Subject digest:
af7c291a7c1f00b49a017e4c64201bfb10f8a7c7942bdf5d4e8612cb10b30c9b - Sigstore transparency entry: 731067351
- Sigstore integration time:
-
Permalink:
Hmbown/peircean-abduction@b8c9ff4bac918899734b2132a83d960620041ee4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Hmbown
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b8c9ff4bac918899734b2132a83d960620041ee4 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file peircean_abduction-0.2.0-py3-none-any.whl.
File metadata
- Download URL: peircean_abduction-0.2.0-py3-none-any.whl
- Upload date:
- Size: 39.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33c6cc25e8d773c10ca1cb99cd3dd75769ff58ad0cec8b8aee04f835267e6552
|
|
| MD5 |
fa2de5c57cfa27b6c213ee909e530ba6
|
|
| BLAKE2b-256 |
d4c04a25a9f911255f36c70e609665784f09a0d68468f16c491fa0731f1a2fd7
|
Provenance
The following attestation bundles were made for peircean_abduction-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on Hmbown/peircean-abduction
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
peircean_abduction-0.2.0-py3-none-any.whl -
Subject digest:
33c6cc25e8d773c10ca1cb99cd3dd75769ff58ad0cec8b8aee04f835267e6552 - Sigstore transparency entry: 731067354
- Sigstore integration time:
-
Permalink:
Hmbown/peircean-abduction@b8c9ff4bac918899734b2132a83d960620041ee4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Hmbown
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b8c9ff4bac918899734b2132a83d960620041ee4 -
Trigger Event:
workflow_dispatch
-
Statement type: