Skip to main content

A semantic calculator for executing a canonical, multi-stage pipeline for structured problem-solving and knowledge generation.

Project description

Chirality Framework: A Semantic Calculator

PyPI Python versions License: MIT Publish Code style: black GitHub release (latest SemVer)

Version: 16.1.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:

  1. Semantic Dot Product: A multi-stage process involving mechanical term combination, LLM-driven semantic resolution, and ontological lensing.
  2. Station Shifting: An LLM-driven transformation of a matrix from one context (e.g., Verification) to another (e.g., Validation).
  3. Structural Operations: Standard matrix operations like transposing and slicing.

For a complete technical description, see the Canonical Algorithm 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_KEY environment 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

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.

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

chirality_framework-16.2.0.tar.gz (62.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chirality_framework-16.2.0-py3-none-any.whl (63.8 kB view details)

Uploaded Python 3

File details

Details for the file chirality_framework-16.2.0.tar.gz.

File metadata

  • Download URL: chirality_framework-16.2.0.tar.gz
  • Upload date:
  • Size: 62.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for chirality_framework-16.2.0.tar.gz
Algorithm Hash digest
SHA256 22cf4bc22818eea279b33a87e09ea7ad5d4734c4a94294aca864bb496cbf418e
MD5 78db66d84d0fee8cad356d2f9c3965e6
BLAKE2b-256 d639e7b59bbcf1be16489fb48f6b6159359390640f719b4b8d546f3cb9225016

See more details on using hashes here.

Provenance

The following attestation bundles were made for chirality_framework-16.2.0.tar.gz:

Publisher: python-publish.yml on sgttomas/chirality-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chirality_framework-16.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for chirality_framework-16.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fce3fe598f1ad4c56245936fda7fa87806f29ea98da3928015db09295bda8fef
MD5 364f2a92754ecb14eaf9ee2681fce1a0
BLAKE2b-256 d7c605e9212e1343331f8856887d28bf9125907454c3e5b4c7a8eea63ebe2b9d

See more details on using hashes here.

Provenance

The following attestation bundles were made for chirality_framework-16.2.0-py3-none-any.whl:

Publisher: python-publish.yml on sgttomas/chirality-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page