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 .            # 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.0

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.0
File Size Uploaded
forge_doctor_api-0.2.0.tar.gz 410.2 kB Details

Built distribution (wheel)

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

Total release size: 951.8 kB

Release files / forge_doctor_api-0.2.0.tar.gz

Download URL forge_doctor_api-0.2.0.tar.gz
Size 410.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d5e39653963e6f63f84a6c0d3a299b2b3007a93ecd1f1ac5e78a4402c413a3ec
BLAKE2b-256 checksum
How to use checksums
86868ba8baf83412b6ecc205ae378ab1f5757b7883a2228102bc3a93c5e60d16
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 16, 2026.

Transparency log

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

Download URL forge_doctor_api-0.2.0-py3-none-any.whl
Size 541.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2f105037fc7ab00c4ae6f0922288141d6be83eae16be8c92525cdad1d550b45
BLAKE2b-256 checksum
How to use checksums
4cef3dd08117286b6abd61f3d7188f270b7bda4369365fc900a857283706214e
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 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

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