A semantic calculator for executing a canonical, multi-stage pipeline for structured problem-solving and knowledge generation.
Project description
Chirality Framework: A Semantic Calculator
Version: 16.3.0 | Status: Active Development
The Chirality Framework is a "semantic calculator" designed to execute a fixed, canonical algorithm for structured problem-solving. It transforms a set of base matrices through a multi-stage semantic pipeline, producing a series of derived matrices that represent a complete traversal of a "semantic valley" from problem to evaluation.
The value of this project is in the unique, insightful output of the calculation and the observability of the process, not in the flexibility of the code.
Core Concept: The Semantic Valley Pipeline
The framework computes a sequence of matrices, each representing a station in the semantic valley. The primary operations involve:
- Semantic Dot Product: A multi-stage process involving mechanical term combination, LLM-driven semantic resolution, and ontological lensing.
- Station Shifting: An LLM-driven transformation of a matrix from one context (e.g., Verification) to another (e.g., Validation).
- Structural Operations: Standard matrix operations like transposing and slicing.
For a complete technical description, see the Canonical Algorithm Documentation.
The Ontological Modality Path
The sequence of stations in the semantic valley is not arbitrary; it follows a deep, underlying pattern of cognitive modalities. This path describes the type of work being done at each stage, revealing a structured cycle of systematic processing, epistemic (knowledge-based) evaluation, and alethic (truth-based) assessment.
| Modality | Station | Operation | Purpose |
|---|---|---|---|
Problem Statement |
1. Problem Statement | A, B |
Define axioms |
Systematic |
2. Requirements | C = A * B |
Systematically enumerate possibilities |
Process |
3. Objectives | D = A + F |
Procedurally construct objectives |
Epistemic |
4. Verification | X = K * J |
First check against knowledge criteria |
Process |
5. Validation | Z = shift(X) |
Procedurally shift context |
Epistemic |
6. Evaluation | E = G * T |
Second check against knowledge criteria |
Alethic |
7. Assessment | M = R x E |
First check against truth modalities |
Epistemic |
8. Implementation | W = M x X |
Ground truth in verified knowledge |
Alethic |
9. Integration & Reflection | U, N |
Final checks against truth modalities |
Resolution |
11. Resolution | Final |
Synthesize final, reliable knowledge |
For a detailed explanation of this conceptual architecture, see the Project Philosophy Documentation.
Quick Start: The End-to-End Workflow
The recommended way to use the framework is to compute the entire pipeline and view the results in the generated HTML viewer.
Prerequisites
- Python 3.9+
- An OpenAI API key set as the
OPENAI_API_KEYenvironment variable.
Step 1: Compute the Full Pipeline
This command runs the entire semantic pipeline (Matrices C through E), generates snapshots of every matrix (including the base matrices A, B, and J), and creates detailed trace files for debugging.
# Install with OpenAI support
pip install 'chirality-framework[openai]'
# Set your API key (add to your shell profile for persistence)
export OPENAI_API_KEY="sk-..."
# Run the full pipeline with the OpenAI resolver
python3 -m chirality.cli compute-pipeline --resolver openai --snapshot-jsonl --include-base
This will create two directories, snapshots/<run_id>/ and traces/<run_id>/, containing the output files.
Step 2: Render and View the Results
This command reads the generated snapshots and creates a self-contained HTML file to display all the matrices in an elegant, readable format.
# Render the latest run and open it in your browser
python3 -m chirality.cli render-viewer --latest --open
This will create a viewer-output/ directory containing the index.html and style.css files and automatically open the page for you. You can change the output location with --output-dir.
Advanced Usage
App Integration Mode (Producer Contract)
For automation by external apps (e.g., chirality-app), use app mode to write a manifest and contract snapshots with a single JSON result to stdout.
python3 -m chirality.cli compute-pipeline \
--resolver echo \
--out runs/my-run-1 \
--problem-file problem.json \
--max-seconds 900
- Writes per-cell JSONL snapshots for
C,D,X,Eunderruns/<run_id>/snapshots/with formatcells-jsonl-v1. - Writes
runs/<run_id>/index.jsonlast and atomically with checksums, sizes, and record counts. - Prints exactly one JSON line to stdout on success:
{ "run_id": "...", "manifest": "runs/<run_id>/index.json" }. - Exit codes:
0success;2invalid args;3timeout;4I/O;5resolver;1general. - Backward compatibility: also dual-writes legacy snapshots for all computed matrices to
snapshots/<run_id>/for the built-in viewer.
Computing Individual Matrices
The compute-matrix command allows you to compute and snapshot any single matrix, automatically handling its prerequisites.
# Compute just the final Evaluation matrix (E)
python3 -m chirality.cli compute-matrix E --resolver openai --snapshot-jsonl
# Snapshot a base matrix for reference
python3 -m chirality.cli compute-matrix A --snapshot-jsonl
Inspecting a Single Cell
For detailed debugging, the compute-cell command lets you observe the full multi-stage pipeline for any single cell in a matrix.
# Observe the computation of cell C[0,0] with verbose output
python3 -m chirality.cli compute-cell C --i 0 --j 0 --resolver openai --verbose --trace
Viewing Options
The render-viewer command has several options for customizing the output:
# Render a specific run with a custom title
python3 -m chirality.cli render-viewer --run-id "<run_id>" --title "My Analysis"
# Render with the "Elements" style for a more code-like view
python3 -m chirality.cli render-viewer --latest --style elements
# Disable the default value sanitization to see raw output
python3 -m chirality.cli render-viewer --latest --style elements --no-sanitize-values
Development
To set up the development environment and run tests, please refer to the instructions in CONTRIBUTING.md.
Additional docs:
docs/INTERFACE.md: Producer mirror of the chirality-app contract (app mode).
Project details
Release history Release notifications | RSS feed
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 chirality_framework-16.3.0.tar.gz.
File metadata
- Download URL: chirality_framework-16.3.0.tar.gz
- Upload date:
- Size: 69.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
301e93ec001a601da3f6a3effb6c8ee0dc52fcbe80ca5d651f5157563c418f3c
|
|
| MD5 |
026a9507ef48d897358ab313be360d04
|
|
| BLAKE2b-256 |
ef63232cca76409320d17413e77d59816617e311455da4cf6c983a70e2b1f93f
|
Provenance
The following attestation bundles were made for chirality_framework-16.3.0.tar.gz:
Publisher:
python-publish.yml on sgttomas/chirality-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chirality_framework-16.3.0.tar.gz -
Subject digest:
301e93ec001a601da3f6a3effb6c8ee0dc52fcbe80ca5d651f5157563c418f3c - Sigstore transparency entry: 468968669
- Sigstore integration time:
-
Permalink:
sgttomas/chirality-framework@ebf77db5c9feef1332ba515418c006d9a1dc538c -
Branch / Tag:
refs/tags/v16.3.0 - Owner: https://github.com/sgttomas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@ebf77db5c9feef1332ba515418c006d9a1dc538c -
Trigger Event:
release
-
Statement type:
File details
Details for the file chirality_framework-16.3.0-py3-none-any.whl.
File metadata
- Download URL: chirality_framework-16.3.0-py3-none-any.whl
- Upload date:
- Size: 69.0 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 |
65bce94dedc4b334b27e0acbe4f809df2f426b4d673796377712669efc650a0e
|
|
| MD5 |
88122148ea395d8758b430503ea2b032
|
|
| BLAKE2b-256 |
3ea4eb2caa7c2eaa1440d84085f6f5db62eaac11a57db51839ef8ce63176621a
|
Provenance
The following attestation bundles were made for chirality_framework-16.3.0-py3-none-any.whl:
Publisher:
python-publish.yml on sgttomas/chirality-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chirality_framework-16.3.0-py3-none-any.whl -
Subject digest:
65bce94dedc4b334b27e0acbe4f809df2f426b4d673796377712669efc650a0e - Sigstore transparency entry: 468968701
- Sigstore integration time:
-
Permalink:
sgttomas/chirality-framework@ebf77db5c9feef1332ba515418c006d9a1dc538c -
Branch / Tag:
refs/tags/v16.3.0 - Owner: https://github.com/sgttomas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@ebf77db5c9feef1332ba515418c006d9a1dc538c -
Trigger Event:
release
-
Statement type: