scan

scan is a command for coding agents from mitulgarg/env-doctor. It costs 0 tokens per session (538 once invoked), scanned A, original, MIT.

A command-line scanner that looks for deprecated imports and APIs from AI and machine-learning libraries. It reports the old code and suggests newer replacements.

In plain words
What is it for?
Use it to scan a project for outdated LangChain imports, Pydantic version-one syntax, TensorFlow one-era patterns, and deprecated PyTorch APIs.
Why use it?
It helps find library changes that can break a project or produce warnings during upgrades.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/mitulgarg/env-doctor/scan
Clone the repo
git clone --depth 1 https://github.com/mitulgarg/env-doctor

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for scan

README.md
[![agentmods](https://agentmods.dev/badge/commands/mitulgarg/env-doctor/scan.svg)](https://agentmods.dev/commands/mitulgarg/env-doctor/scan)
Your own site
<a href="https://agentmods.dev/commands/mitulgarg/env-doctor/scan"><img src="https://agentmods.dev/badge/commands/mitulgarg/env-doctor/scan.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 538 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00538
Opus 5 $0.00000 $0.00269
Sonnet 5 $0.00000 $0.00108
Haiku 4.5 $0.00000 $0.00054

Measured 3d ago against content hash 254e4e02cd2e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

scan scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/commands/scan.md · 98 lines

What it actually says

scan

Scan your project for deprecated AI library imports and suggest fixes. [BETA]

Usage

env-doctor scan [PATH]

If no path is provided, scans the current directory.

What It Detects

LangChain Deprecations

  • Old import paths from langchain
  • Migration to langchain-core, langchain-community, etc.

Pydantic V1 → V2

  • Deprecated validator syntax
  • Old import paths

Other Library Changes

  • TensorFlow 1.x patterns
  • PyTorch deprecated APIs

Example Output

🔍 SCANNING PROJECT: ./my_project

📁 Files scanned: 47
📝 Issues found: 3

------------------------------------------------------------

src/chains/qa.py:12
  ❌ Deprecated import: from langchain.chat_models import ChatOpenAI
  ✅ Replace with: from langchain_openai import ChatOpenAI

src/chains/qa.py:15
  ❌ Deprecated import: from langchain.embeddings import OpenAIEmbeddings
  ✅ Replace with: from langchain_openai import OpenAIEmbeddings

src/models/user.py:8
  ⚠️  Pydantic V1 syntax: @validator
  ✅ Replace with: @field_validator (Pydantic V2)

SUMMARY:
  ❌ Errors:   2
  ⚠️  Warnings: 1

Scan Patterns

LangChain

Old Import New Import
langchain.chat_models langchain_openai or langchain_anthropic
langchain.embeddings langchain_openai
langchain.vectorstores langchain_community.vectorstores
langchain.document_loaders langchain_community.document_loaders

Pydantic

V1 Syntax V2 Syntax
@validator @field_validator
@root_validator @model_validator
class Config: model_config = ConfigDict(...)

Excluding Files

The scan automatically excludes:

  • .git/
  • __pycache__/
  • node_modules/
  • .venv/, venv/
  • *.pyc, *.pyo

Advanced Options

JSON Output

env-doctor scan --json

See Also

  • check - Environment diagnosis
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 98 lines · 0 tokens per session scan A 254e4e02cd2e

Subscribe to this mod's changes

scan is a command published in the GitHub repository mitulgarg/env-doctor (172 stars, last pushed 4d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 538 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.