Skip to main content

A Python framework implementing the Concept-Synchronization Constitution

Project description

C-S Framework for Python

C-S Framework Header

License Python

English | 日本語

A Python framework implementing the Concept-Synchronization Constitution.

Installation

pip install cs-framework

For development:

git clone https://github.com/shuntacurosu/cs-framework.git
cd cs-framework
pip install -e .[dev]

Usage

Running the Demo

  1. Run the example application:

    python src/examples/simple_demo/main.py
    

    This will generate an execution.ttl file.

  2. Run the Visualization GUI:

    csfw gui --log execution.ttl
    

    Open your browser at http://localhost:8080.

    Execution Graph

Structure

  • src/cs_framework: Core framework library.
  • src/cs_gui: Visualization tool using NiceGUI.
  • src/examples: Example usage.
  • tests: Unit and integration tests.

Testing

pytest

Skill-Driven Development Workflow

The C-S Framework is designed to be developed in collaboration with AI agents (Skills). Below is the standard development workflow based on the Pacman implementation example.

1. Design & Scaffolding (Architect Skill)

Use the Architect tool when creating a new Concept. This generates a robust skeleton including event definitions and Pydantic models.

# Example: Generating the Pacman concept
csfw scaffold \
  --name Pacman \
  --actions move change_direction die teleport \
  --events moved died \
  --output src/examples/pacman/src/concepts/

2. Implementation

Edit the generated files to implement the logic.

  • Python (src/concepts/*.py): Implement individual behaviors (Actions) and state transitions. Events are emitted type-safely via Pydantic models (emit).
  • YAML (src/sync/rules.yaml): Define interactions between Concepts (Event → Action chains). Game rules can be adjusted without changing the code.

3. Static Analysis (Linter Skill)

Check the consistency between the implemented code and YAML definitions. Detects undefined actions or disconnected events (orphaned events).

csfw lint --path src/examples/pacman/src

4. Verification & Debugging (Fuzzer Skill)

Use scenario tests to reproduce bugs or verify specifications.

  1. Create Scenario: Describe a sequence of events and expected states (assertions) in scenario.yaml.
  2. Execute:
    csfw run-scenario \
      src/examples/pacman/run.py \
      src/examples/pacman/scenario_bug_repro.yaml
    

5. Analysis (Debugger Skill)

Execution logs are saved as RDF (execution.ttl). You can use SPARQL queries to analyze event chains and their payloads (states) in detail.

Spec-Kit Integration

You can integrate CSFW with Spec-Kit to enforce framework best practices during the AI-driven development process.

# Integrate CSFW rules into Spec-Kit templates
python -m cs_framework.cli integrate-speckit

This command modifies your local .specify/ configuration to ensure that AI agents:

  1. Follow the Concept-Synchronization architecture.
  2. Use scaffold.py for creating new concepts.
  3. Run lint.py for validation.

Reference

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

cs_framework-0.1.3.tar.gz (55.9 kB view details)

Uploaded Source

Built Distribution

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

cs_framework-0.1.3-py3-none-any.whl (70.8 kB view details)

Uploaded Python 3

File details

Details for the file cs_framework-0.1.3.tar.gz.

File metadata

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

File hashes

Hashes for cs_framework-0.1.3.tar.gz
Algorithm Hash digest
SHA256 3663a9d7c84aaf87ba3e7c2e39ece2cf1ac554e8faa2eb41f610a812c7c23633
MD5 c1300f3fa3e5c040cb042f8b4aa99dba
BLAKE2b-256 940be99874d3f111ef03dd06fccc21b07bcbe6a2ec7fe5394721cbcbfe9671fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for cs_framework-0.1.3.tar.gz:

Publisher: pypi-publish.yml on shuntacurosu/cs-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 cs_framework-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: cs_framework-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 70.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cs_framework-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0569985c672a95346e03a99eb178acd14704d36491204a6ec041c92bc56a917e
MD5 cf910c992c8c4164edc9a9af078b4a21
BLAKE2b-256 cdb8ead2160db15495bc963a32b06bab5f3cf023259cd56ea9d81d69363dda90

See more details on using hashes here.

Provenance

The following attestation bundles were made for cs_framework-0.1.3-py3-none-any.whl:

Publisher: pypi-publish.yml on shuntacurosu/cs-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