Skip to main content

SUMD - Structured Unified Markdown Descriptor for AI-aware project documentation

Project description

SUMD

AI Cost Tracking

PyPI Version Python License AI Cost Human Time Model

  • ๐Ÿค– LLM usage: $6.3000 (42 commits)
  • ๐Ÿ‘ค Human dev: ~$1482 (14.8h @ $100/h, 30min dedup)

Generated on 2026-04-20 using openrouter/qwen/qwen3-coder-next


Version Python License

SUMD (Structured Unified Markdown Descriptor) is a semantic project descriptor format in Markdown.
It defines intent, structure, execution entry points, and the mental model of a system for both humans and LLMs.

What is SUMD?

SUMD is a lightweight structured markdown format that serves as a single source of truth for project documentation โ€” optimised for both human readability and LLM context injection.

Think of it as a machine-readable README: a file an AI agent can parse, reason over, and act upon.

Purpose

  • Project descriptor โ€” defines API, CLI, workflows, endpoints, and system architecture
  • AI context feed โ€” structured for LLM consumption: inject SUMD.md into any prompt to give the model full project understanding
  • Lightweight manifest โ€” bridges the gap between README, openapi spec, and configuration files
  • Automation anchor โ€” drives sumd scan, sumd lint, sumd scaffold, CI pipelines

Use Cases

  • Generating structured documentation from source code
  • Single-file project context for ChatGPT, Claude, Gemini, or local LLMs
  • LLM agent memory and tool context (via MCP server)
  • Input for testql scenario scaffolding
  • API and CLI contract documentation
  • CI/CD workflow descriptions
  • Structural project manifest

Installation

pip install sumd                  # stable
pip install sumd==0.2.0rc1        # latest release candidate

Developer Workflow

# health check โ€” verify environment
task doctor

# run tests with coverage
task test

# quality gate (CC + vallm + coverage)
task pyqual

# build + publish (runs automatically when gates pass via pyqual pipeline)
task publish

Usage

CLI Commands

# Shortcut: scan current directory (detects if workspace or single project)
sumd .                          # equivalent to: sumd scan . --fix
sumd /path/to/project           # scan a specific directory

# Scan a workspace โ€” auto-generate SUMD.md for every project found
sumd scan .                     # skip projects that already have SUMD.md
sumd scan . --fix               # overwrite existing SUMD.md
sumd scan . --fix --no-raw      # convert sources to structured Markdown instead of raw code blocks
sumd scan . --fix --analyze     # also run analysis tools (code2llm, redup, vallm)
sumd scan . --fix --analyze --tools code2llm,redup  # only selected tools
sumd scan . --fix --depth 2     # limit recursive search depth (default: unlimited)

# Section profiles โ€” control how much is rendered in SUMD.md
sumd scan . --fix --profile minimal  # core sections only (metadata, architecture, workflows, dependencies, deployment)
sumd scan . --fix --profile light    # + interfaces, quality, configuration, environment, extras
sumd scan . --fix --profile rich     # + code analysis, source snippets, call graph, API stubs, test contracts (default)

# Generate SUMR.md (pre-refactoring analysis report for AI-aware refactorization)
sumd scan . --profile refactor       # creates SUMR.md โ€” use sumr alias below
sumr .                               # shorthand: sumr <path> โ‰ก sumd scan <path> --profile refactor

# Lint / validate SUMD files
sumd lint SUMD.md               # validate a single file
sumd lint --workspace .         # validate all SUMD.md files in the workspace
sumd lint --workspace . --json  # output JSON results

# Generate project/map.toon.yaml (static code map โ€” without code2llm)
sumd map ./my-project             # write to project/map.toon.yaml
sumd map ./my-project --force     # overwrite existing
sumd map ./my-project --stdout    # print to stdout

# Generate testql scenario scaffolds from OpenAPI spec
sumd scaffold ./my-project                  # all scenarios (api + smoke)
sumd scaffold ./my-project --type smoke     # only smoke tests
sumd scaffold ./my-project --type crud      # per-resource CRUD scenarios
sumd scaffold ./my-project --force          # overwrite existing files

# Run analysis tools on a single project
sumd analyze ./my-project                    # run all tools
sumd analyze ./my-project --tools code2llm   # only code2llm
sumd analyze ./my-project --force            # reinstall tools

Section Profiles

SUMD renders output in configurable profiles to trade off detail vs. token cost:

Profile Sections Use case
minimal Metadata, Architecture, Workflows, Dependencies, Deployment Quick overview, CI badges
light + Interfaces, Quality, Configuration, Environment, Extras Standard documentation
rich + Code Analysis, Source Snippets, Call Graph, API Stubs, Test Contracts LLM context injection (default)
refactor Refactoring-focused analysis โ†’ generates SUMR.md AI-aware pre-refactoring report

Python API

from sumd import parse, parse_file
from sumd.parser import validate_sumd_file

# Parse SUMD from string
document = parse(content)

# Parse SUMD from file
document = parse_file("SUMD.md")

# Validate SUMD file (markdown structure + codeblock format)
result = validate_sumd_file(Path("SUMD.md"))
# result = {"source": "SUMD.md", "markdown": [...], "codeblocks": [...], "ok": True}
if not result["ok"]:
    for issue in result["markdown"] + result["codeblocks"]:
        print(issue)

What is Embedded in SUMD.md?

SUMD auto-embeds the following sources from a project (when present):

Source Contents markpact kind
pyproject.toml metadata, deps, entry points parsed
Taskfile.yml all tasks as raw YAML markpact:taskfile
openapi.yaml full OpenAPI spec (endpoints as sections) markpact:openapi
testql-scenarios/** all .testql.toon.yaml scenario files markpact:testql
app.doql.less (preferred) or .css DOQL styling markpact:doql
pyqual.yaml quality pipeline config markpact:pyqual
goal.yaml project intent rendered
.env.example env variables list listed
Dockerfile containerisation listed
docker-compose.*.yml services listed
src/**/*.py modules module list listed
package.json Node.js deps (dependencies + devDependencies) listed
project/analysis.toon.yaml static code analysis (CC, pipelines) markpact:analysis
project/project.toon.yaml project topology markpact:analysis
project/evolution.toon.yaml commit evolution markpact:analysis
project/map.toon.yaml module inventory, function signatures, CC metrics markpact:analysis
project/duplication.toon.yaml code duplication report markpact:analysis
project/validation.toon.yaml vallm validation results markpact:analysis
project/calls.toon.yaml call graph with hub metrics markpact:analysis
project/compact_flow.mmd compact call flow diagram markpact:analysis
project/calls.mmd full call graph markpact:analysis
project/flow.mmd execution flow markpact:analysis
project/context.md architecture analysis (code2llm) inline markdown
project/README.md analysis readme inline markdown
project/prompt.txt code2llm prompt used markpact:analysis

Not embedded: *.png (binary images), index.html (generated visualisation), refactor-progress.txt, testql-scenarios/ inside project/.

project/map.toon.yaml is generated by sumd map (built-in, no extra deps). Other project/ files are generated by sumd analyze (invokes code2llm, redup, vallm).

Ecosystem Architecture

SUMD is part of a three-layer system:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     SUMD (opis)                              โ”‚
โ”‚              Structured Unified Markdown Descriptor          โ”‚
โ”‚         Project description, intent, architecture            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    DOQL (wykonanie)                          โ”‚
โ”‚              Declarative Object Query Language               โ”‚
โ”‚              Data manipulation and execution                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                  Taskfile (runtime)                          โ”‚
โ”‚              Task runner and workflow execution              โ”‚
โ”‚              Automation and orchestration                   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • SUMD โ†’ opis (description): Defines what the system is and how it should work
  • DOQL โ†’ wykonanie (execution): Provides the language to manipulate and execute operations
  • Taskfile โ†’ runtime: Manages the actual execution of workflows and tasks

License

Licensed under 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

sumd-0.3.12.tar.gz (53.4 kB view details)

Uploaded Source

Built Distribution

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

sumd-0.3.12-py3-none-any.whl (59.7 kB view details)

Uploaded Python 3

File details

Details for the file sumd-0.3.12.tar.gz.

File metadata

  • Download URL: sumd-0.3.12.tar.gz
  • Upload date:
  • Size: 53.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for sumd-0.3.12.tar.gz
Algorithm Hash digest
SHA256 fc25aba5941f5c2efc244ca0b5777003e2a67a8b8ab5375966733570d72dc62c
MD5 85a7143853c1643037494b6c6ad9edc0
BLAKE2b-256 f668d07f98b39b95f6ef949fec0dfe6f2af5786a1f4ea8b9352fe1c3852ae0bc

See more details on using hashes here.

File details

Details for the file sumd-0.3.12-py3-none-any.whl.

File metadata

  • Download URL: sumd-0.3.12-py3-none-any.whl
  • Upload date:
  • Size: 59.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for sumd-0.3.12-py3-none-any.whl
Algorithm Hash digest
SHA256 870e8c829d0f87b2b84a02ae1f57c11e4d11042152c42120e3b2e2f013c5ae37
MD5 0fe425008ea073534964951bad9a4f6f
BLAKE2b-256 b0cd08ed2fa286658cef3d5f5e096d6f33ec4459a592e9c7864fdccc76591fdf

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