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

Uploaded Python 3

File details

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

File metadata

  • Download URL: cs_framework-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 8309c12fb3f636eea2bf26d8f6d71a1177b48c835737a3c32db40fdb78958997
MD5 9f1d27f350fe1d2dbe248ddf246a7c1a
BLAKE2b-256 f0c3cf580fb04dfa9500cf2d2ba01753665b6f64a4b505fe3bc395e1c53af82c

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cs_framework-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d79655f81a20df5d21344ba393080979f1a2d2c7186942f5cecd9b52c11a5c36
MD5 bd66a3abc13ba147d8a18afd2fec9058
BLAKE2b-256 c4d11cef0adddbd8896cdf53093b89e77a4bf817764527ce1c32cb0bfb3d1713

See more details on using hashes here.

Provenance

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