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+.

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.0.tar.gz (25.9 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.0-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: continuum_code-0.2.0.tar.gz
  • Upload date:
  • Size: 25.9 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.0.tar.gz
Algorithm Hash digest
SHA256 314304fa75acea5407ddf3126b0dd6eb1ead00666faa68b1d2359b34cad58dce
MD5 85cbd56e54e83addeed60ab5b59c4299
BLAKE2b-256 0e453afa8f080e90d7f9ff8f933ee95645f3c7d9ee579032ff41b0573065aab1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: continuum_code-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 25.7 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a8eba6b9170d201fbe29007970745a1dad5ae58696ccc8e765b59ca7d2fb585f
MD5 69efa8579cff118c3d8b70ef2a3a0970
BLAKE2b-256 a01004052d0dd843a309423e0f885bce10a81e2491cde378bad9a18e885d81fe

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