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. Verify Environment
Ensure everything is set up correctly (Python version, dependencies, path):
peircean --verify
3. Run the Demo
See the logic harness in action (generates an abductive prompt):
python examples/quickstart.py
🔌 MCP Server Setup (Claude Desktop / Cursor)
Give your AI assistant abductive reasoning superpowers.
1. Install Config
Automatically configure Claude Desktop to use the Peircean MCP server:
peircean --install
This adds the server to your claude_desktop_config.json.
2. Restart Claude
Restart Claude Desktop. You should see a 🔌 icon indicating the tool is active.
3. Try it out
Ask Claude:
"Analyze this anomaly: My server latency spiked 10x but CPU usage is flat."
🧠 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.
🛠️ Troubleshooting
"Module not found: peircean" in Claude
- This usually happens if
peirceanwas installed in a virtual environment (venv/conda) but Claude is using the system Python. - Fix: Run
peircean --installfrom within your active environment. It will automatically register the absolute path to the correct Python executable.
"No LLM backend configured"
- The CLI tool (
peircean "observation") currently outputs prompts for you to paste into an LLM. - For fully automated abduction, use the MCP integration with Claude Desktop.
Verify Command Failed
- Run
peircean --verifyto see detailed diagnostics. - Ensure you are on Python 3.10+.
Documentation
- Peircean Specification - Detailed breakdown of the 3-Phase Loop and JSON Schemas.
- MCP Agent Instructions - Guide for AI Agents using the tools.
- Quick Start Guide
- User Guide
- MCP Integration
- Abductive Reasoning Concepts
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-1.1.0.tar.gz.
File metadata
- Download URL: peircean_abduction-1.1.0.tar.gz
- Upload date:
- Size: 86.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
507b88055a16291315a2d4da4039bd14ec1e17917f7345a8a71c1a84e5ebe982
|
|
| MD5 |
5002119ed0bab190aaa271f669e1821d
|
|
| BLAKE2b-256 |
0bf65d4f9f66d453ff829d51348bae987a9562ae349818d741ca217ad1058941
|
Provenance
The following attestation bundles were made for peircean_abduction-1.1.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-1.1.0.tar.gz -
Subject digest:
507b88055a16291315a2d4da4039bd14ec1e17917f7345a8a71c1a84e5ebe982 - Sigstore transparency entry: 733381388
- Sigstore integration time:
-
Permalink:
Hmbown/peircean-abduction@63e9060acb0638c7e150226b4c7ba366949aefb2 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/Hmbown
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@63e9060acb0638c7e150226b4c7ba366949aefb2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file peircean_abduction-1.1.0-py3-none-any.whl.
File metadata
- Download URL: peircean_abduction-1.1.0-py3-none-any.whl
- Upload date:
- Size: 41.8 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 |
a65fccbd3e6dd40ac16c0904c12379676d95e0c2d97c7ccd0ffb88e13d4efbc1
|
|
| MD5 |
3a019e85386bccdf2132ac22d3c73ea2
|
|
| BLAKE2b-256 |
08b0674b4ea3b302152cb9aa570d1d1554dd9137e87b718cc5546f8c339103a5
|
Provenance
The following attestation bundles were made for peircean_abduction-1.1.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-1.1.0-py3-none-any.whl -
Subject digest:
a65fccbd3e6dd40ac16c0904c12379676d95e0c2d97c7ccd0ffb88e13d4efbc1 - Sigstore transparency entry: 733381434
- Sigstore integration time:
-
Permalink:
Hmbown/peircean-abduction@63e9060acb0638c7e150226b4c7ba366949aefb2 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/Hmbown
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@63e9060acb0638c7e150226b4c7ba366949aefb2 -
Trigger Event:
release
-
Statement type: