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.5.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.5-py3-none-any.whl (70.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cs_framework-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 2fd477262f3c54c62a028b9789a6bcc925216faba3f8cdda5c9fe2dcd8b2e165
MD5 9968476eabdd141bb90053baa8a1b5b8
BLAKE2b-256 1ec63c8611d6754575bbc7b9beb42a47bdde1cb1bc4cfe8830a4297d5df9a86a

See more details on using hashes here.

Provenance

The following attestation bundles were made for cs_framework-0.1.5.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.5-py3-none-any.whl.

File metadata

  • Download URL: cs_framework-0.1.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6219a7b2e301bdddba3c4fe6b5156867177320ca9c6673f29605fd0720136b33
MD5 7a24ea39a2db358e8bdf3ea9417a1d90
BLAKE2b-256 eeb6486f1ba123f596523efdbf7357f6a0176e753946c6023acca4f4daa7d814

See more details on using hashes here.

Provenance

The following attestation bundles were made for cs_framework-0.1.5-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