Skip to main content

Rule engine so coding agents obey repo rules (block/warn/ask) with clear explanations.

Project description

Continuum

Rule engine so coding agents obey repo rules across Cursor, Claude, and ChatGPT: they get blocked, warned, or asked before breaking rules, with clear explanations of which rule fired and how to fix.

v0.1 promise

  • Add continuum.yaml to your repo.
  • Run continuum check locally and in CI.
  • Cursor (MCP) agents are gated: blocked / warned / clarification_required before breaking rules.
  • The system explains which rule fired and how to fix it.

Install

pip install -e .   # from repo
# or when published:
pip install continuum-code

Requires Python 3.10+. The CLI is installed as continuum. If another tool named continuum is in your PATH, use continuum-code instead (e.g. continuum-code --version, continuum-code init --pack data-dbt-airflow), or run python -m continuum.

Development on Windows (WSL2)

Keep the repo on the WSL filesystem (e.g. ~/repos/continuum) for best compatibility.

One-time (PowerShell as Admin):

wsl --install -d Ubuntu-24.04

After WSL install, open Ubuntu and run:

# Base (keep repo under WSL, e.g. ~/repos/continuum)
sudo apt update && sudo apt install -y build-essential git curl

# Python via uv (fast, clean venvs)
curl -LsSf https://astral.sh/uv/install.sh | sh
source ~/.local/bin/env  # or restart shell

Per clone (inside WSL, in repo root):

cd ~/repos/continuum   # or your path
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"

Run tests:

pytest

Run CLI:

continuum check
continuum init --pack python-fastapi

For a broader Windows + WSL2 dev setup (Terminal, Docker, Antigravity safety), see your preferred guide.

Quick start

# Create config (optional: use a pack)
continuum init
continuum init --pack python-fastapi   # or node-backend, typescript-monorepo

# Check current changes (git diff)
continuum check
continuum check --staged              # only staged
continuum check --base origin/main    # diff against branch

# Explain why a rule fired
continuum explain
continuum explain ban_lodash

# List active contracts
continuum inspect

Config: continuum.yaml

version: 0.1
scopes:
  - id: repo
    match: ["**/*"]
    contracts:
      - type: ban
        id: ban_lodash
        match:
          deps: ["lodash"]
        message: "Use native JS or approved utils."
      - type: ask_first
        id: confirm_migrations
        match:
          paths: ["**/migrations/**"]
        prompt: "Touching migrations. Confirm: (A) add-only (B) destructive (C) refactor"
  - id: backend
    match: ["backend/**"]
    precedence: 10
    contracts:
      - type: require
        id: require_tests
        match:
          paths: ["backend/**"]
        require:
          - kind: tests
            hint: "Add or adjust unit tests for changed modules."

Contract types: ban (deps/paths/commands), require (tests/logging/ADR), ask_first (confirmation gate), define (metadata).

Escape hatch

To skip checks (e.g. emergency hotfix), set CONTINUUM_SKIP=1; continuum check will exit 0 without running contracts. Prefer adjusting rules (e.g. severity: warn) in continuum.yaml when possible. See docs/adoption.md.

CI (GitHub Action)

- uses: actions/checkout@v4
  with:
    fetch-depth: 0
- uses: ./actions/continuum-check
  with:
    base_ref: ${{ github.event.pull_request.base.sha }}

Or in another repo: uses: your-org/continuum/actions/continuum-check@v0.1 (and install continuum via pip in the action).

Cursor / MCP

Run the MCP server so the Cursor agent can call continuum_check before applying changes:

continuum mcp --transport stdio

Add to Cursor MCP config:

{
  "mcpServers": {
    "continuum": {
      "command": "continuum",
      "args": ["mcp", "--transport", "stdio"]
    }
  }
}

See docs/cursor-mcp.md and docs/demo.md for setup and the “Refactor auth middleware” demo.

Golden demo: Run the 3 scenarios in demo/README.md (dbt marts require, airflow ask-first, banned command) in under 10 minutes.

Packs

Starter configs:

  • node-backend – Node/JS backend (ban lodash, require tests, ask on migrations).
  • python-fastapi – FastAPI app (ban requests in favor of httpx, require tests, ask on migrations).
  • typescript-monorepo – TS monorepo (ban lodash, require tests in packages).
  • data-dbt-airflow – dbt + Airflow repos (ask_first on marts/DAGs, require tests on marts, ban risky commands).
continuum init --pack python-fastapi
continuum init --pack data-dbt-airflow   # dbt + Airflow

5-minute adoption (dbt + Airflow)

  1. pip install continuum-code (or pip install -e . from repo).
  2. continuum init --pack data-dbt-airflow → writes continuum.yaml.
  3. continuum validate → confirm the file is valid.
  4. continuum check (or continuum check --base origin/main for PRs).
  5. Add the GitHub Action for CI; optionally run continuum mcp --transport stdio for Cursor.

Next steps (after v0.1)

  • Richer dependency detection (poetry, pnpm, pip-tools).
  • Pattern bans (regex on diffs).
  • Stricter “require” checks (e.g. tests touched when src touched).
  • Decision diffs / supersession (v0.2).

License

MIT.

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

continuum_code-0.2.1.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

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

continuum_code-0.2.1-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

Details for the file continuum_code-0.2.1.tar.gz.

File metadata

  • Download URL: continuum_code-0.2.1.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for continuum_code-0.2.1.tar.gz
Algorithm Hash digest
SHA256 50b90e61514ef3229a6a445dcb65c4429ad0ab663022f5a0c2d989c2791a197e
MD5 daa0ef6e3e544ca0b4a39eb7f3bc68f4
BLAKE2b-256 a60674bb25aaf8bc4aca6e4bacaec5b803eb3e05f89fded5a247270cad5ea608

See more details on using hashes here.

File details

Details for the file continuum_code-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: continuum_code-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 26.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for continuum_code-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 acb29a093b642d8d35d83a083886c501159534c0bc6b62b41f40fc74eef68f22
MD5 52a64cdc8a3a873241e2212a6a855a4a
BLAKE2b-256 aff7e95d8a10b324a48176acb7a4330596d447c26d81a55c9588a0d547eba139

See more details on using hashes here.

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