Agent and Contributor Rules

Stack Identification

Before executing any task, audit the active dependency stack. Do not assume the presence of any library.

  1. Parse pyproject.toml ([project.dependencies], [project.optional-dependencies], and [dependency-groups]) and uv.lock to identify the exact versions in use.

  2. Use only libraries already declared in those files. Never introduce a conflicting or unlisted package without an explicit instruction to update dependencies.

  3. Apply the following decision matrix when selecting implementation patterns:

Concern

Source of truth

Current library

HTTP client

pyproject.toml

httpx

Data validation / models

pyproject.toml

pydantic v2

CLI framework

packages/core/src/imednet/cli

standard-library argparse

Retry logic

pyproject.toml

tenacity

HTTP mocking in tests

pyproject.toml (dev)

respx

Type checking

pyproject.toml (dev)

mypy

Linting

pyproject.toml (dev)

ruff

Formatting

pyproject.toml (dev)

ruff

Immutable Constraints

Credential Handling

  • Never log, print, write to disk, or transmit API keys, security keys, tokens, or authorization headers in plaintext under any circumstance.

  • Mask credential values in all log output and exception messages.

Testing Boundaries

Test location

Network access

Required mock library

tests/unit/

Forbidden — no live requests

respx for httpx

tests/integration/

Forbidden — use recorded or in-memory fixtures

respx

tests/live/

Permitted — real API calls

None (guarded by IMEDNET_RUN_E2E env var)

  • All new or modified code must include or update tests in tests/unit/.

  • Coverage must remain ≥ 90%.

  • Do not add tests/live/ calls to the default pytest run.

Commit Messages and Pull Requests

  • PR titles must follow Conventional Commits. Permitted prefixes: feat:, fix:, chore:, docs:, ci:, test:, refactor:, perf:, revert:. The Semantic PR Title CI check enforces this.

  • Security updates and CVE remediations must use the fix: prefix (e.g. fix(deps): or fix(security):), which directly maps to patch releases in release-please. Do not use unpermitted prefixes such as security:.

  • Merge to main via Squash and merge so the PR title becomes the commit message.

  • Changes that affect the public API, CLI interface, environment variables, or documentation portal (published via GitHub Pages) must be noted in the PR description.

Release Process

  • Do not manually edit package versions in packages/*/pyproject.toml. Versions are managed automatically by release-please (Automated Release workflow).

  • Releases are fully automated and hermetically gated. After merging a Release PR opened by release-please, the Release workflow (.github/workflows/release.yml) builds impacted workspace distributions with pinned hatchling bounds and SHA256SUMS (30-day dist-<package> retention), runs cache-free static/security, Python 3.11–3.13 wheel-mode pytest, twine check --strict, and scripts/validate_package_consumption.py --wheel-dir dist --require-prebuilt checks in verify, publishes verified artifacts to PyPI (skip-existing: true) with 90-day checksums-<package> artifacts, attaches SHA256SUMS to GitHub Releases in a post-publish job, and supports manual workflow_dispatch recovery on main or release tags.