Skip to main content

Categorical governance engine — morphisms, functors, natural transformations

Project description

Morphism

npm CI Governance Score License: BUSL-1.1

The control plane for AI-assisted engineering. Morphism helps engineering teams keep AI-assisted workflows consistent, auditable, and controllable across repos, agents, CI, and shared workspace review.

Entropy is the default. Governance is the override.

Why Morphism

  • Control, not just observability — Catch repo, workflow, and policy drift before it becomes team-level entropy
  • Mathematical foundation — Functors, natural transformations, and sheaf cohomology (tools for verifying distributed consistency) give Morphism a rigorous model for convergence
  • Typed evidence — Every verdict ties back to explicit artifacts, not hand-wavy policy claims
  • Local-first adoption — CLI and MCP server run in developer workflows and CI; dashboard surfaces shared state for teams

Quick Install

# CLI (recommended — works standalone)
npm install -g @morphism-systems/cli

# MCP server (for Claude Code / Cursor)
npm install -g @morphism-systems/mcp-server

# One-command setup (CLI + MCP server + skills + hooks)
npm install -g @morphism-systems/plugin-bundle

Packages

Package Description Tiers
@morphism-systems/cli Governance CLI — init, validate, score, doctor Free+
@morphism-systems/mcp-server MCP server — validation, scoring, drift metrics Pro+
@morphism-systems/plugin-bundle One-command installer — MCP servers, skills, hooks Free+
@morphism-systems/shared Shared types, schemas, and utilities Free+
@morphism-systems/sdk Embeddable governance client for third-party platforms Pro+
@morphism-systems/agentic-math Category theory MCP server — morphisms, functors, convergence Free+
@morphism-systems/design-tokens Design tokens and theme system — CSS/Tailwind generators Free+

Tiers

Tier Price What you get
Free $0 CLI validate + score, repo baseline checks, up to 10 agents
Pro $29/seat/mo Kappa drift metric, entropy, diff, agent registry, MCP server access
Team $79/seat/mo Shared policies, policy packs, audit log export, typed evidence review
Enterprise Custom Unlimited agents, proof witnesses, custom policy rollout, dedicated support

See packages/shared/src/plans.ts for the canonical entitlement definitions.

Quick Start

Initialize a repo

morphism init        # Creates .morphism/config.json
morphism doctor      # Verifies repo docs, Python, and governance scripts
morphism validate    # Runs the governance pipeline
morphism score       # Prints the full maturity score breakdown

morphism init does not generate AGENTS.md or SSOT.md. morphism doctor expects those repo governance files to already exist.

Add the MCP Server (Claude, Cursor, etc.)

{
  "mcpServers": {
    "morphism": {
      "command": "npx",
      "args": ["@morphism-systems/mcp-server"]
    }
  }
}

Development (contributors)

npm install && npx turbo dev       # TypeScript (Next.js + packages)
pip install -e ".[dev]" && pytest  # Python (governance engine)

Prerequisites

Tool Version Notes
Node.js 20+ (22 recommended) nodejs.org
npm included with Node.js
Python 3.11+ python.org

Environment Setup (web app)

  1. Copy the example env file:
    cp apps/morphism/.env.local.example apps/morphism/.env.local
    
  2. Fill in the required values. See docs/integrations/platform-services.md for service credentials (Clerk, Supabase, Sentry, Pinecone).
  3. Or pull live values from Vercel if you have project access:
    cd apps/morphism && vercel env pull
    

Database Setup

This project uses Supabase (PostgreSQL). For local development, point SUPABASE_URL and SUPABASE_ANON_KEY in .env.local at a Supabase project. See docs/integrations/platform-services.md for connection details and migration instructions.

Architecture

Monorepo structure

graph TD
    subgraph "Developer workflow"
        CLI["@morphism-systems/cli<br/>morphism init · validate · score"]
        MCP["@morphism-systems/mcp-server<br/>33 governance tools"]
        MATH["@morphism-systems/agentic-math<br/>Category theory MCP"]
    end

    subgraph "Shared layer"
        SHARED["@morphism-systems/shared<br/>Types · Schemas · Plan gates"]
        TOKENS["@morphism-systems/design-tokens<br/>10 themes · CSS/Tailwind"]
        SDK["@morphism-systems/sdk<br/>Embeddable client"]
        BUNDLE["@morphism-systems/plugin-bundle<br/>One-command installer"]
    end

    subgraph "Python core — src/morphism/"
        ENGINE["engine/<br/>Morphism · Functor · NaturalTransformation"]
        METRICS["metrics/<br/>Kappa convergence · Delta drift"]
        SHEAF["sheaf/<br/>Consistency cohomology"]
        HEAL["healing/<br/>DriftScanner · DriftHealer"]
    end

    subgraph "App"
        WEB["apps/morphism<br/>Next.js 15 dashboard"]
    end

    CLI --> SHARED
    MCP --> SHARED
    MATH --> SHARED
    WEB --> SHARED
    WEB --> TOKENS
    SDK --> SHARED
    BUNDLE --> CLI
    BUNDLE --> MCP
    MCP -.->|JSON-RPC bridge| ENGINE
    ENGINE --> METRICS
    ENGINE --> SHEAF
    HEAL --> METRICS

Governance data flow

flowchart LR
    A["git commit"] --> B["pre-commit hook"]
    B --> C{"policy_check.py"}
    C -->|pass| D["commit created"]
    C -->|fail| E["blocked + guidance"]
    D --> F["pre-push hook"]
    F --> G{"enforce_repo_conventions.py<br/>verify_pipeline.py<br/>orphan_scan.py"}
    G -->|pass| H["push to remote"]
    G -->|fail| I["blocked + guidance"]
    H --> J["CI: release.yml"]
    J --> K["npm publish<br/>PyPI publish<br/>GitHub Release<br/>Vercel promotion"]

    style C fill:#e9c46a,color:#000
    style G fill:#e9c46a,color:#000
    style K fill:#2d6a4f,color:#fff
Layer Stack Purpose
Web Next.js 15, Turborepo SaaS dashboard
Shared TypeScript, Zod Types, schemas, utilities
MCP TypeScript, MCP SDK AI tool integration (33 tools)
Python Click, Category Theory Control engine, drift metrics
Scripts Python CI validation, scoring, repo enforcement

Governance

The governance framework is the core of Morphism. See AGENTS.md for the full specification.

Document Purpose
AGENTS.md Root governance rules
SSOT.md Single source of truth
Kernel 7 invariants (I-1..I-7)
Docs Index Documentation map (source)
CHANGELOG.md Consolidated release history
morphism.systems Product site and thin docs index
Full docs (MkDocs) Canonical public docs, governance, and reference docs

Contributing

See CONTRIBUTING.md for development setup, architecture overview, and contribution guidelines.

License

Business Source License 1.1 — Change Date 2030-02-20, Change License Apache 2.0

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

morphism-0.1.1.tar.gz (2.3 MB view details)

Uploaded Source

Built Distribution

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

morphism-0.1.1-py3-none-any.whl (102.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: morphism-0.1.1.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.12.1.2 readme-renderer/44.0 requests/2.32.5 requests-toolbelt/1.0.0 urllib3/2.5.0 tqdm/4.67.1 importlib-metadata/8.7.0 keyring/25.7.0 rfc3986/1.5.0 colorama/0.4.6 CPython/3.14.0

File hashes

Hashes for morphism-0.1.1.tar.gz
Algorithm Hash digest
SHA256 12203c3731650052168aa680a69c81730700cdef63d7915869d0839a45817ba4
MD5 693498c4288d352738ad5216991d8e03
BLAKE2b-256 92df0c2a02fd2fa1f41b2822686272a7d0fe8082cc324bcd4f6999d2d6f2d6f3

See more details on using hashes here.

File details

Details for the file morphism-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: morphism-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 102.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.12.1.2 readme-renderer/44.0 requests/2.32.5 requests-toolbelt/1.0.0 urllib3/2.5.0 tqdm/4.67.1 importlib-metadata/8.7.0 keyring/25.7.0 rfc3986/1.5.0 colorama/0.4.6 CPython/3.14.0

File hashes

Hashes for morphism-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0b46dcfd71d9e1e26980308c75693c85016cb3688e7cc13354eabd43acda4c5b
MD5 232f1dedee0ceee71c51c46bca3266f8
BLAKE2b-256 c619ae3be193435b6cff4e268619191845d99f6ba5ab2b55794974a6f0a9db14

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