Skip to main content

Instalação portátil: docs/installation/quickstart.md — clone → setup → install. Delegação agêntica: forge.agentic.json (SpecialistAgenticManifest/v1). Docs: commands · skills · agents · tutorial · economy · troubleshooting

Forge Doctor API

Forge Doctor API

Deterministic, offline-first, evidence-first engine for API architecture intelligence.

Forge Doctor ("the Doctor") inspects API projects — contracts, source code, configuration, and exported runtime artifacts — and produces structured, evidence-bearing findings. It never calls a model, never fetches a URL, and never guesses: anything it cannot establish from local evidence is surfaced as an explicit UnknownFact.

Status: 0.2.0 — the full deterministic surface is implemented (scan, diff, diagnose, inventory, lab, handoff). This is not a stable public API commitment; interfaces may still change before 1.0.

Design principles

Principle What it means in practice
Deterministic Same inputs → byte-identical findings, ordering, and exports. No LLM calls anywhere.
Offline-first Zero network access. Host interaction happens only through ProjectContext. Tests hard-block sockets.
Evidence-first Every finding carries Evidence (file + line + summary) and a Confidence (HIGH/MEDIUM/LOW/UNKNOWN).
Low false positives Passive/absence-of-evidence cases are emitted as candidates, never as verdicts.
Explicit unknowns Missing files, unresolvable references, dynamic code → UnknownFact records, not silence.
Portable Pure Python, no platform-specific imports; supports Python 3.11/3.12/3.13 on Linux/Windows/macOS.

The Doctor is the deterministic half of the Forge product family: it observes and classifies. Agentic code generation lives in api-forge (a separate project); this repository has no dependency on it.

Installation

pip install forge-doctor-api            # from PyPI — Python >= 3.11
pip install 'forge-doctor-api[graphql]' # optional: graphql-core for GraphQL parsing

From a checkout (development):

pip install .            # runtime deps: typer, rich, pyyaml
pip install .[graphql]   # optional: graphql-core for GraphQL parsing

Requirements: Python >= 3.11. For development:

pip install pytest ruff mypy types-PyYAML build
python -m pytest -q
python -m ruff check .
python -m mypy src

Portable install (Forge contract)

The checkout also carries the Forge family's portable-installation contract — clone once, setup once:

./setup.sh          # or .\setup.ps1 — venv + wheel + ~/.forge registry

Installing the Forge into a consumer project (managed .mcp.json key + AGENTS.md marker block, sha256-ledgered) is deliberately a checkout script, not a forge-doctor-api verb: the package boundary bans os/subprocess imports across src/ and the 0.2.0 RC window forbids new CLI commands. Same verbs, same receipts as sibling forges:

python scripts/forge_install.py install --dry-run   # plan only
python scripts/forge_install.py install --yes       # apply to a repo
python scripts/forge_install.py status|doctor|repair
python scripts/forge_install.py uninstall [--purge]
python scripts/forge_install.py update|mcp-verify

# Optional local web UI over the same real services (127.0.0.1, session token)
python scripts/forge_portal.py [--no-browser] [--port N] [--root DIR]

theforge install auto delegates here automatically via the install_command field in forge.json.

Quickstart

# Full deterministic scan of a project directory
forge-doctor-api scan ./my-service

# Scan + CI gate: fail on new breaking changes vs a baseline contract
forge-doctor-api scan ./my-service --fail-on breaking --baseline ./last-release

# Emit SARIF for GitHub code scanning, or a compact agent-readable format
forge-doctor-api scan . --format sarif --out results.sarif
forge-doctor-api scan . --format agent

Exit codes: 0 scan ran and gate passed · 1 gate failed · 2 usage/misconfiguration error.

Command tour

forge-doctor-api scan TARGET        all pipelines + optional §178 gate
forge-doctor-api inventory TARGET   fleet answers over a workspace or repo
forge-doctor-api diff OLD NEW       semantic contract diff + typed events
forge-doctor-api diff OLD NEW --pr  + PR-intel summary and blast radius
forge-doctor-api fingerprint FILE   semantic fingerprint of a contract
forge-doctor-api graph TARGET       merged contract/route/client graph
forge-doctor-api blast-radius O N   operation → clients → services impact
forge-doctor-api diagnose TARGET    root-cause episodes from evidence
forge-doctor-api explain DIR TOKEN  evidence chain for one finding
forge-doctor-api lab [labs]         Forge Lab corpus: precision/recall
forge-doctor-api contract diff O N  contract-level diff
forge-doctor-api contract compat …  compatibility classification
forge-doctor-api runtime requests   per-request execution table
forge-doctor-api runtime baseline   performance baselines per endpoint
forge-doctor-api runtime regress…   regressions vs baseline
forge-doctor-api security inspect   passive security evidence + findings
forge-doctor-api reliability inspect  timeouts/retries/idempotency/SLOs
forge-doctor-api reliability path     hop-by-hop effective policy

--help on any command lists its options. See docs/cli.md for the full reference.

What it understands

  • Contracts: OpenAPI 3.x (YAML/JSON), AsyncAPI, GraphQL SDL + introspection, gRPC .proto.
  • Source: FastAPI route discovery, client call-site extraction (Python/JS/TS), GraphQL client queries (gql tagged literals).
  • Config: timeouts, retries, rate limits, idempotency headers, authentication/CORS/mTLS/TLS evidence, gateway routes, ownership files, policy files.
  • Runtime: OTLP/OTEL JSON traces, access-log records — ingested as compact per-request summaries (raw spans are not retained).

From those inputs it produces: OAS/ASYNC/GQL/GRPC contract checks, contract-drift and semantic compatibility diffs, client impact and blast radius, versioning/deprecation analysis, observability + performance regression findings, reliability checks (retry amplification, SLO budgets), passive OWASP API Top-10 candidates, policy violations, an API digital twin, root-cause diagnosis, safe-fix classification, multi-repo workspace analysis, fleet intelligence, migration portability assessments, and compact handoff bundles for agentic tools.

Documentation

Repository layout

src/forge_doctor_api/   engine (analyzers, checks, models, CLI)
tests/                  pytest suite (offline-blocked sockets)
labs/                   Forge Lab corpus: golden + adversarial fixtures
factory/                Loop Factory specs, run records, quality gate
.github/workflows/      doctor-scan.yml CI gate
docs/                   documentation

Graph Studio

forge-doctor-api graph . --view|--ui projects the service graph through forge/ForgeGraphView/v1 and serves the embedded local explorer (declinable at install via --components). Full docs: the-forge/docs/graph-studio/.

Metadata

Release files for forge-doctor-api 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for forge-doctor-api 0.2.1
File Size Uploaded Provenance
forge_doctor_api-0.2.1.tar.gz 433.0 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for forge-doctor-api 0.2.1
File Interpreter ABI Platform
forge_doctor_api-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 999.2 kB

Release files / forge_doctor_api-0.2.1.tar.gz

Download URL forge_doctor_api-0.2.1.tar.gz
Size 433.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f2ccfe07b13014ab881e0521e59485a7f4fe947ab52d465c0a23d11de96c5090
BLAKE2b-256 checksum
How to use checksums
f9fc18325ddc8826de5709c136d02aadf6936937e6f35d598407d4c7ca147489
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / forge_doctor_api-0.2.1-py3-none-any.whl

Download URL forge_doctor_api-0.2.1-py3-none-any.whl
Size 566.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ee30915a6f21d5d4f6d06c60ac75a2b843c94cc1e307183812f028b229c91ef
BLAKE2b-256 checksum
How to use checksums
cce862e83d2c8ced4823f46a5464b7e32b1a9acf020b0135efa99bc54209daae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Security for forge-doctor-api 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for forge_doctor_api-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page