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.1.tar.gz (40.6 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.1-py3-none-any.whl (51.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cs_framework-0.1.1.tar.gz
  • Upload date:
  • Size: 40.6 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.1.tar.gz
Algorithm Hash digest
SHA256 6d2c8d3dc1a62d7260bfe489f1755b2705876040646a37cc860acbefdf92046c
MD5 6be03dd9ba22cc11fa0527a367fd2450
BLAKE2b-256 8bb420a233773ee02361c4b94bd12c6d476fd4d9b91ecaf95bf7d8bdbd678282

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cs_framework-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 51.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a6f76410557b70bf6aa7635d8df7ffdc9c8fa7e75748bf691e031f69ef418d45
MD5 a3d388ee38e420e1b45eb85526c9ce9c
BLAKE2b-256 910c49de0eb4d58f88b8f31f2f868941e0655a7b3360a99ec8a1d482296ec9b2

See more details on using hashes here.

Provenance

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