Skip to main content
Glama
@4da/mcp-server

@4da/mcp-server

Official
README.md
# @4da/mcp-server

[![npm version](https://img.shields.io/npm/v/@4da/mcp-server?color=gold)](https://www.npmjs.com/package/@4da/mcp-server)
[![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](LICENSE)
[![Node](https://img.shields.io/badge/Node-%3E%3D22-brightgreen)](https://nodejs.org/)
[![CI](https://github.com/4DA-Systems/4da-mcp-server/actions/workflows/ci.yml/badge.svg)](https://github.com/4DA-Systems/4da-mcp-server/actions/workflows/ci.yml)

**Upgrade intelligence for AI coding agents.** Before your agent bumps a dependency it learns what changes between the version you run and the one you want, which of your files that touches, and which vulnerabilities the move fixes, from your own lockfiles, on your machine. Plus vulnerability scanning at osv-scanner parity on the lockfiles it reads ([what that covers, and how it is measured](#how-it-works)), ranked upgrade plans and decision memory. Zero config, no account.

```
You:     "Upgrade axum to 0.8"
Agent →  upgrade_impact { package: "axum", to_version: "0.8.4" }

         axum 0.7.9 -> 0.8.4: 5 releases (0.8.2 yanked), changelog from the 0.8.4 crate.
         12 breaking entries, 8 touch your code (Path, Query, Router, extract, serve):
           breaking  Remove OptionalFromRequestParts impl for `Query`        (you use Query)
           breaking  Require `Sync` for all handlers added to `Router`       (you use Router)
           ...
         Your code: 10 files import axum.
```

*(Output of version 6.0.0, abridged, from 2026-10-02 on the 4DA desktop app's repository, where this server lived until 2026-10-04. Later releases word the same answer a little differently (6.3.0 counts 11 breaking entries for this upgrade), and the files and symbols an answer names are your project's.)*

One command to install. No API keys. No accounts. Your code never leaves your machine.

## Install

Requires Node.js 22 or later; below it the server stops at once and says why (`--version` and `--help` still answer). CI runs the suite on Node 22 (the newest 22.x on Linux, Windows and macOS, and 22.12, where the server falls back to `better-sqlite3`) and on Node 24 (Linux); other versions are not tested.

The server uses Node's built-in `node:sqlite` (Node 22.13 and later), so it needs no install script and works with npm 12's default of blocking them. On Node 22.0-22.12 it uses the optional `better-sqlite3`, whose native module npm 10 and 11 build on install. `npx @4da/mcp-server@6.6.0 --doctor` shows which one is in use.

```bash
claude mcp add --scope user 4da -- npx -y --prefer-offline @4da/mcp-server@6.6.0
```

Every command and config on this page pins the version, and so do the plugin, the Gemini extension and the entry `--setup` writes, so what runs changes only when you change it. Each configuration starts the server with `npx -y --prefer-offline`: with `--prefer-offline` a cached copy of the pinned version starts without asking the registry first, which matters behind a slow or dead proxy. npx's own options go before the package name; written after it they are passed to the server, which exits with `unknown argument`. Without a version, npx runs whatever it has cached or the newest release, which you did not review.

To update, replace the version with the newest one on npm (`npm view @4da/mcp-server version`, or run `--setup --update` from the newer version, which rewrites the `4da` entry of the editor configs it finds and, for Claude Code, prints the commands that move the pin: `claude mcp remove` and `claude mcp add`, or the plugin's update); the [changelog](CHANGELOG.md) says what changed. A pinned install never updates itself, so the server says when a newer release is published: `get_context` carries `update_notice` (both versions and the command that moves the pin) and `--doctor` prints it as a "Server version" warning. The server reads the newest version from the npm registry only after a tool call of the session has already contacted a package registry, never at start-up and never with `FOURDA_OFFLINE`, at most once a day per data folder.

**As a Claude Code plugin** (the MCP server plus a hook):

```bash
claude plugin marketplace add 4DA-Systems/4da-mcp-server
claude plugin install 4da@4da
```

The hook runs before an edit or a command and holds a dependency version that neither `dependency_check` nor a `what_should_i_know` call that declared the package `public: true` has cleared. What it promises is its reading of edits to the manifests it reads; its reading of shell commands and of requirements files is best effort. What it holds, what it lets through and what it does not see: [The guard hook](#the-guard-hook).

<details>
<summary><b>Cursor / Windsurf / Devin Desktop</b></summary>

Add to `~/.cursor/mcp.json` (Cursor), `~/.codeium/windsurf/mcp_config.json` (Windsurf), or `~/.config/devin/mcp_config.json` (Devin Desktop and Devin CLI; `%APPDATA%\devin\mcp_config.json` on Windows):
```json
{
  "mcpServers": {
    "4da": {
      "command": "npx",
      "args": ["-y", "--prefer-offline", "@4da/mcp-server@6.6.0"]
    }
  }
}
```
</details>

<details>
<summary><b>VS Code (Copilot)</b></summary>

Run **MCP: Open User Configuration** and add the entry, or edit the file directly: `%APPDATA%\Code\User\mcp.json` (Windows), `~/Library/Application Support/Code/User/mcp.json` (macOS), `~/.config/Code/User/mcp.json` (Linux). VS Code uses `servers`, not `mcpServers`:
```json
{
  "servers": {
    "4da": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "--prefer-offline", "@4da/mcp-server@6.6.0"]
    }
  }
}
```
</details>

<details>
<summary><b>Claude Desktop</b></summary>

Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
```json
{
  "mcpServers": {
    "4da": {
      "command": "npx",
      "args": ["-y", "--prefer-offline", "@4da/mcp-server@6.6.0"]
    }
  }
}
```
</details>

<details>
<summary><b>Auto-setup</b> (detects all installed editors)</summary>

```bash
npx @4da/mcp-server@6.6.0 --setup --dry-run   # show each file and entry, write nothing
npx @4da/mcp-server@6.6.0 --setup
npx @4da/mcp-server@6.6.0 --setup --update    # also replace a 4da entry that is already there
```

Writes the entry, pinned to the version you ran it from, into the Cursor, VS Code (and Insiders), Windsurf, Devin Desktop and Claude Desktop configs it finds, merging into what is there: other servers, settings and comments are kept, and a backup (`.bak`) is written first. A `4da` entry that is already there and differs (another version, a local build, a wrapper command) is kept and reported; `--update` replaces its command and keeps its `env` and other fields. A file it cannot read exactly (invalid JSON, not UTF-8, the same key twice at any depth) is left untouched with the entry to add by hand, and the exit code is then 1. A config that is a symbolic link is written where the link points, and a hard-linked one in place after its backup. For Claude Code it edits nothing: it shows which release each `4da` server runs (user, local and project scope, and the 4DA plugin) and prints the commands that move it (`claude mcp remove 4da -s <scope>` and the matching `claude mcp add`; for the plugin, how it updates).
</details>

Then ask your AI: **"What changes if I upgrade X to Y?"**, **"Scan for vulnerabilities"** or **"What should I upgrade first?"**

## How It Works

The server reads every lockfile of the project it is started in, including independently-locked projects below the root (a repo with `src-tauri/Cargo.lock` beside a root `pnpm-lock.yaml` is scanned whole): `package-lock.json` / `npm-shrinkwrap.json`, `pnpm-lock.yaml` (v5–v9), `yarn.lock` (v1 and berry), `bun.lock`, `Cargo.lock` (Cargo workspaces included), `poetry.lock`, `uv.lock`, `pdm.lock`, `Pipfile.lock`, requirements pins (`*requirements*.txt`, `requirements/*.txt`, with `-r` and `-c`), `go.mod` / `go.sum` (Go's build list), `Gemfile.lock` (RubyGems; git and path gems are local code, not releases) and `composer.lock` (Packagist). Every Python source in a folder is read, not only the first. Every installed copy is scanned, not one version per name, with the lockfile's own dev flags. It re-reads them whenever a lockfile changes, and for npm it also checks what `node_modules` actually holds. A lockfile is what is installed, so it is read whether or not `.gitignore` lists it, and a dot-directory (`.github/actions/*`) is a directory like any other; so are `build/`, `dist/`, `out/`, `coverage/`, `.vscode/` and `.idea/`, which are read unless the repository ignores them. What is not scanned is said, lockfile by lockfile, under `coverage.not_scanned.lockfiles` with a `reason`: a directory `.gitignore` excludes is left out (it is as often a scratch clone as the project's own code: `gitignored_directory`); installed code, a tool's build output or cache, and editor or agent state (`node_modules`, `target`, `.venv`, `.next`, `.claude` ...) are never scanned, and when the repository does not ignore such a directory the lockfiles in it are listed (`excluded_directory`; it is searched within 2,000 directories, and the answer says when that bound stopped it); a lockfile sitting directly in an ignored `vendor/`, `target/` or `venv/` is listed too (`output_directory`); version-control data is never entered. A junction or symbolic link whose real path is inside the project is followed, each directory walked once; one that leads outside it is not, and the lockfiles behind it are listed (`symlink_outside_root`); a directory the walk cannot list is named (`unreadable`, its path ending in `/`). A lockfile or manifest holding git merge-conflict markers is not read at all, neither side of it: it is listed with reason `merge_conflict`, `coverage.complete` is false and every tool says `NOT CHECKED (merge conflict)` for it. The walk goes 8 levels down and up to 256 projects; whatever it leaves out is listed the same way (`depth`, `project_limit`). So is every manifest with no lockfile: its declared ranges are not installs and are not scanned, its exact pins are checked but the packages they pull in are resolved nowhere (`coverage.unresolved_manifests`, and `coverage.manifests_without_lockfile` for a manifest in a subdirectory that no lockfile above holds as a workspace member). `vulnerability_scan` always returns a `coverage` block: a scan that left nothing out says `complete: true` with `lockfiles_read` (and `lockfiles_not_scanned: 0`), one that left something out says `complete: false` and lists it; nothing is dropped silently. So are manifests of ecosystems it does not read (Maven `pom.xml`, Gradle, .NET `*.csproj` / `packages.lock.json`, Pub, Hex, SwiftPM, CocoaPods: `coverage.not_covered`), lockfiles that exist but cannot be read (invalid JSON, Bun's binary `bun.lockb`: `coverage.unreadable_lockfiles`), lockfiles that are truncated or damaged and were read only up to the damage, that lack an entry another of their packages needs, or are older than their manifest (a dependency the manifest declares has no entry: `package.json` for npm, pnpm, Yarn and Bun lockfiles, `Cargo.toml`, `pyproject.toml` for uv, Poetry and PDM, `Pipfile`, `Gemfile` or `gems.rb`, `composer.json`; a version changed only in the manifest, with the old one still in the lockfile, is not detected) (`coverage.partial_lockfiles`), a second lockfile in a directory that disagrees with the one that was read (`coverage.conflicting_lockfiles`), requirements with no pinned version such as `pydantic>=2.0.0` (`coverage.unpinned_requirements`: there is no installed version to check), dependencies installed from git or a URL, gems from a `GIT` section and Composer branch checkouts (`coverage.not_checkable`: they are not the registry package of that name, so they are never matched against it), files of a supported ecosystem in a form that is not read (`environment.yml`, `setup.py`, `pylock.toml`), and lockfiles under test-fixture directories (`tests/`, `test/`, `fixtures/`, `testdata/`, `__fixtures__/`, `conformance/` ...), which are not scanned as the project's own unless you pass `include_test_fixtures: true` (`coverage.not_scanned`). Every lockfile problem listed here (unreadable, partial, conflicting, a refused include, a merge conflict, a conflicted `go.sum` included) also makes `upgrade_planner` say `vulnerabilityDataAvailable: false`: the plan and the scan read the same list. Each of them but a conflicted `go.sum` also starts the scan's answer with NOT CHECKED and makes its totals null, with what it found under `found_in_checked_dependencies`. A lockfile read whole that could only not be compared with its manifest (`not_cross_checked_lockfiles`) is a note: it changes neither the totals nor the plan.

Started in a workspace member that has no lockfile of its own, whose manifest an ancestor's lockfile holds as a member (npm, pnpm, Yarn and Bun workspaces, a Cargo workspace, a uv, Poetry or PDM workspace, a `go.work`), the server reads that workspace root and says so (`project_root` is the root; `vulnerability_scan`'s `workspace_note` and `dependency_health`'s summary name the member it was started in). The search stays inside the enclosing git repository, or at most 6 levels up with none, never at or above your home directory; an ancestor lockfile that cannot be confirmed to hold the directory is named in the coverage note, not read. When no lockfile was read for the project at all, no tool scores or clears it: `dependency_health` gives `healthScore: null` with `withheldReason: "no_lockfile"` and a NOT CHECKED summary (never "0 vulnerable"), a dependency known only by its declared range shows `currentVersion: null` beside `declaredRange`, `upgrade_planner` sets `vulnerabilityDataAvailable: false`, `what_should_i_know` never says `safe_to_delegate` on that basis, and `vulnerability_scan` starts its answer with NOT CHECKED and gives null totals (what it found among a manifest's exact pins is a lower bound, under `found_in_checked_dependencies`). A folder that holds nothing the server reads, an empty one or the wrong one, is answered the same way, never as a complete scan with zero findings.

**An incomplete answer is never a clean one.** When OSV.dev cannot answer for some dependencies (outage, HTTP error, timeout, the query budget), `vulnerability_scan` starts with `summary: "NOT CHECKED: ... N of M dependencies have no vulnerability answer"`, counts them in `coverage.unchecked_dependencies`, and sets `total_vulnerable_packages` and `by_severity` to null (what the checked part found is under `found_in_checked_dependencies`); `dependency_health` withholds its score and vulnerable count, and `upgrade_planner` sets `vulnerabilityDataAvailable: false`. Large trees are queried in batches of 1,000 as OSV's budget allows, so a tree past 10,000 dependencies is answered in full, and a long answer is read to its last page. An advisory OSV matched whose record it then failed to return is listed as `details: "NOT CHECKED"`: its severity is unknown, not low, no `severity_filter` drops it, and it is asked for again on the next scan instead of being cached. The scan the other tools reuse is at most one hour old; past that it is taken again.

**Two grades for one advisory.** `severity` and `by_severity` are the grade the 4DA app presents, adjusted for scope (a transitive copy caps critical at high, a dev-only copy drops a level); the advisory's own grade is always visible beside it: `advisory_severity` on a package row whose own grade differs, and `by_advisory_severity` beside `by_severity` (the detailed answer also keeps it as `advisory_by_severity`). When any advisory is critical by its own grade, the `summary` says so first (after any NOT CHECKED headline): how many, on which package versions, and how many are presented lower because they are transitive or dev-only. Every recommendation names the own grade where it differs ("3 high (2 critical by the advisory)").

**What "osv-scanner parity" covers, and how it is measured.** Two things: reading the same installed packages out of a lockfile (inventory), and matching them to the same advisories (findings). It is not feature parity: osv-scanner reads ecosystems this server does not (Maven and Gradle among them). The measurement is the conformance corpus in the 4DA repository, fetched at a pinned commit: 36 cases (32 public repositories at pinned commits, 4 synthetic), scored for npm, crates.io, PyPI, Go, RubyGems and Packagist, with 3,929 OSV records pinned as OSV.dev served them (and 6 synthetic rule records). The expected inventory comes from osv-scanner 2.6.0 and the expected findings from OSV.dev's own evaluation of each installed version, with every correction recorded in the corpus; the corpus is kept by the same maintainers as this server. Against it this engine reads 20,458 inventory entries with none missing and none extra, and reports 4,785 findings with 0 false positives and 0 false negatives. That run is offline, on the pinned records, with this server's own range matcher: it measures the readers and the matching, not the live requests to OSV.dev, and not a lockfile damaged in a way the corpus does not hold. CI runs it on every change (`conformance (pinned)`) and a release requires it; to run it yourself: `node scripts/fetch-conformance.mjs && pnpm exec vitest run src/__tests__/conformance.test.ts --reporter=verbose`, which prints the table per ecosystem (see [conformance/README.md](conformance/README.md)).

Measured with a coding agent on the 6.2.5, 6.2.6, 6.2.7 and 6.5.1 release candidates (pre-registered, 49 dependency tasks x 3 trials, one model, `claude-sonnet-5-5`, tasks written by the authors, shell and web off in both arms): it wrote a vulnerable version in 82 of 138 well-posed runs without the server and 0 of 138 with it. The four runs share one recorded no-server arm and one truth pinned on 2026-10-24; the latest run came a month after that pin, and with the one task that has since become ill-posed set aside it reads 0 of 135 against 79 of 135. No result for the releases in between is published here. Harness, tasks, pinned truth and results: [`bench/g7`](bench/g7/).

- **OSV.dev** for known vulnerabilities, matched to exact installed versions
- **npm registry, crates.io, PyPI, Go module proxy** (registry.npmjs.org, crates.io and index.crates.io, pypi.org, proxy.golang.org) for versions, deprecations and yanks
- **npm download counts** (api.npmjs.org), for `dependency_health`'s weekly-downloads figure (`upgrade_planner` and `what_should_i_know` make the same request when they read registry data for npm packages), and for `dependency_check` when a new dependency's name is a near-miss of a popular package (that name and the popular one, nothing else)
- **The package's own registry archive** (registry.npmjs.org, static.crates.io, files.pythonhosted.org, proxy.golang.org) for the changelog `upgrade_impact` reads; GitHub only if you opt in with `FOURDA_GITHUB_CHANGELOG=true` (below)
- **npm full packument**, the **crates.io versions API**, the **PyPI JSON API** and the **Go proxy's version list** for `dependency_check` (publish times, yanks and retractions; on npm and crates.io also publishers, install scripts, per-version dependencies). These requests carry the package name only. Besides them, `dependency_check` requests per-release documents of the releases it is judging (`to`, a constraint's candidates, the safe releases it names): the Go proxy's `.info` and `.mod` (its list has no dates; the same requests `go get` makes, and `.mod` lists what the release requires), and on PyPI the release's own document (`pypi.org/pypi/<name>/<version>/json`, the only place a release that is not the latest lists its requirements); and it looks up, by name, the release lists of the packages those releases require (crates.io, PyPI) and their advisories at OSV.dev. The version you have installed (`from`) is named only to the Go proxy (its `.info`) and, on PyPI, only when it is also `to`. `upgrade_planner` names a version to a registry in two cases: on PyPI, a parent that uv.lock or a compiled requirements file names without its requirement is asked for by its own release (`pypi.org/pypi/<name>/<version>/json`, the installed version); and on npm, PyPI and Go a fix version is asked for by name. OSV.dev's advisory list for the package lets `dependency_check` name the safe releases in a constraint. Packuments are cached on disk and revalidated with `If-None-Match`; crates.io API reads are spaced one per second.
- **Hacker News Algolia API** (hn.algolia.com), only when you call `ecosystem_pulse`
- **GitHub** (api.github.com, raw.githubusercontent.com), only with `FOURDA_GITHUB_CHANGELOG=true`
- **Your embedding provider**, only if you configure one for semantic recall (a local Ollama URL, or api.openai.com; see below)

A redirect is followed only from a host to itself or to that host's own download hosts: crates.io to static.crates.io or index.crates.io, pypi.org to files.pythonhosted.org, proxy.golang.org to storage.googleapis.com, and GitHub (with `FOURDA_GITHUB_CHANGELOG=true`) to raw.githubusercontent.com, codeload.github.com or objects.githubusercontent.com. Those are all the hosts the server contacts.

Results are cached (24h for registry data, 1h for vulnerabilities, 30min for news) and rate-limited per source.

**What's sent over the network, and when:** nothing when your editor starts the server and lists its tools; the project is read locally, and the first request goes out when a tool that needs it is called (`vulnerability_scan`, `what_should_i_know`, `dependency_check` ...). Then: package names and versions (the same data visible in your lockfile), and, only for `ecosystem_pulse`, the names of a few of your dependencies as search terms. Never a private package's name (below). From a `what_should_i_know` task, the briefing sends a package name (with the version the task names for it) to its public registry and OSV.dev only when the project already depends on it in that same ecosystem (a Go module by its full path), when it is exactly a name on the server's bundled lists (popular npm and PyPI names, and names with a known malicious or hijacked release) for an ecosystem the project uses, a command in the task installs from, or a manifest file the task names, or when you declare it in `packages` with `public: true` (with the version you declare and any version the briefing reads on that name); a name is never looked up in any other ecosystem. A name you declare public is sent, so declare `public: false` for anything from a private registry, an index of its own, git or a path. As a courtesy, when the task holds one of a fixed list of source spellings (`--registry`, `--index-url`, pip's `-i` and `-f`, `--git`, `--path`, `registry=`, `npm_config_registry`, `PIP_INDEX_URL`, `UV_INDEX`, `GOPROXY`, `[[tool.uv.index]]`, `[[tool.poetry.source]]`, a Cargo `[registries]` or `[source.<name>]` table, a go.mod `replace`, and a few more the CHANGELOG lists), no name the task adds is looked up, declared public or not; a source named any other way ("from our Artifactory") is not noticed, and the project's own private rules still override a public declaration. Build metadata and a local version label (`+build7`) are never sent. No other text of the task is sent, and none of it goes to an embedding provider. A name you declare `public: false` or put in `not_packages`, and every other name of the task, is not looked up by the briefing: it waits in `task_packages.to_confirm` until you answer for it. A declaration does not change the project's own vulnerability scan, which reads the installed dependencies and sends their names unless the project's configuration marks them private (`FOURDA_PRIVATE_PACKAGES`, an `.npmrc` scope or registry, a pip index, `GOPRIVATE`): mark an installed private package there. A credential in the task (a token shape, a UUID, a password shape, the value of a TOKEN, KEY, SECRET or PASSWORD setting, a high-entropy word, twelve or more hex digits, a word with a shell expansion in it, a setting such as `password==hunter2` whose value is no version (shown only as its name), a word with a colon inside), a URL's user info, an option's value, a shell variable, a git remote and an email address are never read as names, and a package the task's own command takes from a private registry, git or a path is not looked up, even when declared public; such words are named in `task_packages.not_read` without their value. A credential that looks like an ordinary word can appear in `to_confirm`; nothing about it is sent unless you declare it public. No source code, no file paths, no personal data. The call-site scan of `upgrade_impact` runs locally. Set `FOURDA_OFFLINE=true` to disable all network calls.

**Private packages are never sent.** A package is private, with nothing to configure, when your machine already says so:

- **npm:** its scope is mapped to a registry other than the public one in the project's `.npmrc` (or a parent directory's, or any member directory's the project walk finds, lockfile or not), your user `.npmrc` (or `npm_config_userconfig` in any case), the global npmrc (`npm_config_globalconfig`, else `<prefix>/etc/npmrc` with the prefix from `npm_config_prefix` / `PREFIX`, `%APPDATA%\npm` or node's own), a quoted key (`"@acme:registry"=...`), the environment (`npm_config_@acme:registry`, any case), `.yarnrc.yml` `npmScopes` at any indentation or in flow style (`@acme:registry=https://npm.acme.dev/`; the project's and those above it, `~/.yarnrc.yml`, under the name `YARN_RC_FILENAME` gives, and `YARN_NPM_SCOPES`), or `bunfig.toml` `[install.scopes]` (a URL, `{ url = ... }`, or an `[install.scopes.<scope>]` table; the project's, `~/.bunfig.toml` or `$XDG_CONFIG_HOME/.bunfig.toml`); or your lockfile installs it from another host: the `resolved` location in `package-lock.json` / `npm-shrinkwrap.json` and yarn v1 `yarn.lock`, a yarn berry `resolution` URL (or `__archiveUrl`), the `tarball` in `pnpm-lock.yaml` (GitHub Packages included), the registry URL of a `bun.lock` entry. A default registry that is not public (`registry=` in any of those `.npmrc` files, `npm_config_registry`, yarn's `npmRegistryServer` or `YARN_NPM_REGISTRY_SERVER`, bun's `[install] registry`) makes every npm package of the project private (see "Mirrors" below); registry.npmjs.org, registry.yarnpkg.com and registry.npmmirror.com are public.
- **Go:** its module path matches `GOPRIVATE`, `GONOPROXY` or `GONOSUMDB`, from the environment or from `go env -w` (the `GOENV` file; as go does, an empty variable falls back to it), whatever spelling a tool is given (`https://github.com/acme/mod.git`, `git+ssh://git@github.com/acme/mod`, `git@github.com:acme/mod.git`, `...#v1.2.3`, `.../tree/main`); or `GOPROXY` names a proxy that is not public (see "Mirrors" below).
- **Cargo:** `Cargo.lock` installs it from a registry other than crates.io, or from git (path dependencies are local code and were never sent); or `Cargo.toml` (the root's and every workspace member's, `members` globs and `exclude` respected) takes it from another registry (`registry = "acme"` other than `crates-io`, or `registry-index`) or from git, in any dependency table or `[patch]`, with or without a lockfile; or a `.cargo/config.toml` (in the project, any directory above it, or `CARGO_HOME`) patches it from git or another registry, or replaces crates.io with a registry that is not crates.io (see "Mirrors" below; a vendored directory is crates.io's own crates).
- **PyPI:** `uv.lock`, `poetry.lock` or `Pipfile.lock` installs it from an index other than pypi.org; or a requirements file pins it under `--index-url` / `-i` naming another index (set in the file or in any file it includes with `-r` or `-c`, nested); or `pyproject.toml` takes it from another index (uv `[tool.uv.sources] name = { index = "acme" }` naming a `[[tool.uv.index]]` that is not pypi.org; Poetry `name = { version = ..., source = "acme" }` naming a `[[tool.poetry.source]]` that is not pypi.org), with or without a lockfile; or a direct reference installs it from a location that is not public (`name @ https://pkgs.acme.dev/...`, `name @ git+https://git.acme.dev/...`, `name @ file:...`, uv or Poetry `git` / `url` / `path` sources; pypi.org's files, the public wheel indexes and GitHub, GitLab and Bitbucket are public); or, with no lockfile, uv, Poetry or PDM consults an index that is not pypi.org for any name (a `[[tool.uv.index]]` that is the default or not `explicit`, `[tool.uv]` `index-url` / `extra-index-url`, `uv.toml` in the project or above it, the user's or the system's, `UV_DEFAULT_INDEX`, `UV_INDEX_URL`, `UV_INDEX`, `UV_EXTRA_INDEX_URL`, a Poetry source that is not `priority = "explicit"`, a PDM source): then every package the project declares is private; or pip is configured with another index (`PIP_INDEX_URL`, or `index-url` in any pip config file pip reads: site-wide `%ProgramData%\pip\pip.ini`, `/etc/pip.conf`, `$XDG_CONFIG_DIRS/pip/pip.conf`, `/Library/Application Support/pip/pip.conf`; per-user `%USERPROFILE%\pip\pip.ini`, `%APPDATA%\pip\pip.ini`, `~/.pip/pip.conf`, `~/.config/pip/pip.conf`, `~/Library/Application Support/pip/pip.conf`; the virtualenv's `$VIRTUAL_ENV/pip.ini` or `pip.conf`; `PIP_CONFIG_FILE`) and a requirements file installs it. A company mirror of PyPI named there counts as private too: list nothing, and its packages are reported as not checked. An `--extra-index-url` (in a requirements file, `PIP_EXTRA_INDEX_URL` or pip config) that is not pypi.org counts the same way: pip takes each package from whichever index has the newest release, so any name it installs may come from that index, and the packages a requirements file installs are private (not sent, reported as not checked); the answer names the index (`registry_notice`). A lockfile that records each package's index (`uv.lock`, `poetry.lock`, `Pipfile.lock`) lets the public ones be checked.
- **RubyGems:** `Gemfile.lock` lists it under a `GEM` section that names a `remote:` other than rubygems.org (every gem of such a section is private, whatever other remote it names).
- **Packagist:** `composer.lock` installs it from a host other than Packagist and the public code hosts (a Satis or Private Packagist server), or from a repository `composer.json` declares that is not Packagist (`vcs`, even on GitHub; `composer`; `path`; `artifact`).

**Mirrors: one policy for every ecosystem.** A registry, index or proxy that is not the public one, and that the package manager consults for any name (an `.npmrc` `registry=`, a pip `--index-url` or extra index, a uv or Poetry default index, `GOPROXY`, a Cargo source replacement), can serve packages published nowhere else, so every package of that ecosystem the project installs is private: never sent, reported as not checked, with the reason and the setting named (`registry_notice` for npm and pip). If such a server only mirrors the public registry (Artifactory, Nexus, devpi, Athens as a pure proxy), say so with `FOURDA_PUBLIC_MIRRORS=artifactory.acme.dev,athens.acme.dev` (hosts, comma- or space-separated) and its packages are checked again; the public mirrors of PyPI, crates.io and Go that the server knows count as public without it (pypi.tuna.tsinghua.edu.cn, mirrors.aliyun.com, mirrors.cloud.tencent.com, repo.huaweicloud.com, pypi.mirrors.ustc.edu.cn, mirrors.ustc.edu.cn, rsproxy.cn, mirrors.tuna.tsinghua.edu.cn, goproxy.cn, goproxy.io); its lockfile hosts count as public too. Until 6.3.0 an npm `registry=` host and `GOPROXY` were read as mirrors and unscoped names were sent. Go needs no proxy for a module on your own host: one that neither `GOPRIVATE` (or `GONOPROXY` / `GONOSUMDB`) names nor a private `GOPROXY` covers is fetched by go through the public proxy too, and is looked up here the same way; name it in `GOPRIVATE`.

A dependency taken from a path, git or a URL is not the registry package of its name, and is never looked up by that name, in the manifests and lockfiles the scan reads. npm specs are read as npm reads them: `file:`, `link:`, `workspace:`, a bare path (`../libs/x`, `./x`, `~/x`, `/opt/x`, `C:\x`), a tarball file (`vendor/x-1.0.0.tgz`), GitHub shorthand (`org/repo#ref`) or any git spelling, a URL other than the public registry's own tarball of that package, another protocol, an alias npm refuses, and a protocol spelling with whitespace around it; so is a dependency an override forces to one of those (`overrides`, `resolutions`, `pnpm.overrides`), a name the lockfile installs only as a link (a workspace member), from git, a URL or a local archive, and a workspace member's own name, read from the enclosing workspace root whether or not a lockfile exists. A `catalog:` dependency is what its pnpm or Bun catalog entry says, judged by the same rules; one whose entry cannot be found or read is withheld. Cargo: `path` and `git` crates, a crate a member inherits with `{ workspace = true }` (or `name.workspace = true`) from such an entry, the dotted forms (`name.path = ...`, `name.git = ...`, `"name".path = ...`), and both the key and the package of a `package =` rename. Python: a requirement installed from a local path, editable or archive, a git checkout anywhere (GitHub included), an archive URL on a host other than PyPI's own file host, a uv `{ workspace = true }` source, and the project's own `[project]` or Poetry name. A requirement given as a URL on PyPI's own file host (`six @ https://files.pythonhosted.org/...`) is not withheld: `dependency_check` checks it by name, while the scan lists it under `not_checkable` (no version is read from the URL). npm workspace members linked by a symlink or junction count as members, and a server started in a folder with no manifest below a project, below a folder that holds `.git` (a `.git` file counts; `GIT_DIR` is not read) (`src/lib`, `src/bin`; at most three levels, never above that folder) reads that project, so the first call there does that project's scan; with no `.git` above it, nothing above the start folder is read. Such a dependency gets no registry row in `dependency_health` or `upgrade_planner`, `dependency_check` answers it `unknown` with `not_checked: "private"`, `upgrade_impact` refuses it, and neither the briefing nor `ecosystem_pulse` sends it; what it installs is listed under `coverage.not_checkable`. Such a name is also withheld when you ask about it for another project, while a scanned project still declares it so, unless the project you ask about itself declares it as a registry dependency; an alias key is withheld only inside the project that aliases it. The answer says `NOT CHECKED (not a registry release)` and where the name comes from. 6.5.0 and earlier sent many of these names by themselves: `dependency_health` and `upgrade_planner` asked the registry about them, `ecosystem_pulse` sent them to Hacker News, and `dependency_check`, `upgrade_impact` and the briefing looked them up when asked. Versions, ranges, dist-tags (`latest`, `next`), a catalog entry that is a range and an `npm:` alias's target are registry releases and are checked; inside the project whose `package.json` declares an alias, its own key is never sent, with any lockfile, and asked about directly it is answered with its target named; in another project the same word is an ordinary package name and is looked up as one (a key such as `lodash` or `@types/react` is also a real public package). Not covered: a manifest the scan does not read (a project in a subdirectory with no lockfile, which the scan lists under `manifests_without_lockfile`), so a name declared only there is looked up if you ask about it directly; the project's own root package name in npm, pnpm, Yarn v1 and Bun, when you ask about it directly; a crate in a folder the Cargo workspace `exclude`s that nothing depends on, asked about directly; a Go module replaced by a `GOPRIVATE` fork, asked about directly, is looked up by its original path; and the repository path of an npm git dependency, asked about as a Go module, is looked up as one; an alias only the lockfile records (a `package-lock.json` root that still lists `"x": "npm:y@1"` after `package.json` dropped it, a lockfile out of step with its manifest) has its key sent when that package is found vulnerable, as in 6.5.0; for `npm:npm:x@1` and `npm:x-1.0.0.tgz`, x is looked up if asked about directly; and an alias whose range npm cannot read (`npm:x@=~7`, `npm:x@1.0.0 junk`) is read as an alias to x, and x is sent like any alias target. A package a `workspaces` pattern excludes (`!packages/legacy`) is not a member, so npm installs it from the registry, and it is checked as a registry dependency.

Names are compared the way each registry compares them: a crate is the same whatever its case and whether it is written with `_` or `-` (`acme_core`, `Acme-Core`), PyPI names are PEP 503-normalised, npm, RubyGems and Packagist names are case-insensitive. Look-alike spellings are folded first (NFKC, so fullwidth `@acme/ui` is `@acme/ui`; every Unicode dash or hyphen is `-`), and `acme/ui` or `github:acme/ui` is read as a form of `@acme/ui`.

Add your own with `FOURDA_PRIVATE_PACKAGES`: comma- or space-separated globs, `*` matching anything (`/` included), each optionally prefixed with its ecosystem: `FOURDA_PRIVATE_PACKAGES="npm:@acme/*, crates.io:acme-*, PyPI:acme-*, Go:github.com/acme/*"`. A bare scope (`@acme`) covers the whole scope; PyPI names are compared PEP 503-normalised (`Acme_Auth` is `acme-auth`). The rules are read again whenever one of those files or variables changes. A name your project also installs from the public registry is public (asking about it reveals nothing). A private package is still read from your lockfiles, and is never looked up anywhere, as itself or as the parent of a public one: `vulnerability_scan`, `dependency_health`, `upgrade_planner` and `what_should_i_know` lead with `NOT CHECKED (private)` (the briefing also for a private package the task only names, installed or not, and never calls such a task `safe_to_delegate`) and list each one with the file or setting that made it private (`coverage.private_dependency_list`), so the answer is never a clean one for it; `dependency_check` answers it `unknown` with `not_checked: "private"` (a name withheld only because a lockfile or manifest of the project could not be read is said as that, `NOT CHECKED (unreadable lockfile)` with `unreadable_file`, and the remedy is to repair the file); `upgrade_impact` refuses it; `upgrade_planner` never looks up a private parent's releases, and a step that arrives through one leads with `NOT CHECKED (private)` and names it in `privateParents` (never an inferred refresh); `ecosystem_pulse` never uses its name as a search term (its terms come only from the project the server runs for, never from other projects in the same data folder, and a name another of those projects installs privately is never one). As a second line of defence, every OSV.dev, registry and search request passes one check that refuses it when its URL or body names a private package; a refused request reads as not checked, never clean. Registry URLs are shown without credentials.

**GitHub release notes (opt-in, off by default).** Many packages ship no changelog in their registry archive (vite, zod, cobra, most Go modules). With `FOURDA_GITHUB_CHANGELOG=true` in the server's environment, `upgrade_impact` reads the repository's GitHub releases when the archive has no changelog for the range (for PyPI, first a changelog file the project links on GitHub from its `project_urls`). GitHub then receives the repository name and the versions, nothing else. It uses the unauthenticated REST API (60 requests an hour) or `GITHUB_TOKEN` when set (5,000); a rate limit is reported with its reset time, never retried in a loop, and results are cached. With it off, an answer without a changelog says so and names the setting; nothing is guessed.

**What's written to disk, and where:** only files the server owns, in its folder in your user data directory (`%LOCALAPPDATA%\4da-mcp`, `~/Library/Application Support/4da-mcp` or `~/.local/share/4da-mcp`; `FOURDA_MCP_HOME` moves it): `cache.db` (registry, OSV and changelog responses, in every mode; safe to delete, it costs refetches only), `standalone.db` (without the desktop app: your project scan and the decisions, agent memory and feedback you record; no cache) and `check-ledger.jsonl` (each `dependency_check` verdict, for the plugin hook; started empty when the server starts serving; moved to `check-ledger.1.jsonl` past 512 KB, so the two hold about 1 MB at most). Nothing is written inside your repository. Once per process the server creates and removes an empty `.write-check-<pid>-<ms>.tmp` and `.write-check-<pid>-<ms>.db` in that folder to learn whether it can write there; a folder it cannot write is said plainly ("the data folder <dir> is not writable"), the cache is then kept in memory, and a folder made writable later is used after a restart. A `cache.db` another process holds locked is set aside for 30 s, the cache kept in memory meanwhile. `standalone.db` is known by its path: a file there that a killed first start left empty or half-made is completed in place, and a table that exists is never touched. (Until 6.3.0 standalone mode kept the cache inside `standalone.db`; that table is dropped the first time 6.3.0 opens it.)

When the 4DA desktop app is installed, the server reads the app's database (`4da.db`) through a **read-only** connection and never creates or alters anything in it: no tables, no columns, no cache. It is never the dependency inventory either, and a scan never writes to it: the dependency tools read every lockfile under the project root from disk, exactly as without the app, with the same `coverage` (see "Standalone vs. Full Mode"). The only writes are rows in the four app-owned tables the tools exist to fill, so the app sees them: decisions (`decision_memory` -> `developer_decisions`), agent memory (`agent_memory`), and feedback (`record_feedback` -> `interactions` and `feedback`, which the app's calibration reads). Those go through a separate write connection that waits briefly for the app's lock. If your app version lacks the table or a column a record needs, the record goes to `standalone.db` instead and the response says so in `_meta`. (Before 6.1 the server also created a `live_cache` table inside the app's database; it now keeps that cache in `cache.db`.)

**Where configuration and the database come from:** `FOURDA_DB_PATH` if set, else the desktop app's database in its data directory, else the server's own `standalone.db`. `FOURDA_DB_PATH` must name an existing file (a relative path resolves against the server's working directory); one that names no file is refused and nothing is created there, except when it names the server's own `standalone.db`. A file with no tables is not taken for the app's database either. Then the tools that answer from the project's files (`vulnerability_scan`, `dependency_health`, `dependency_check`, `upgrade_impact`, `upgrade_planner`, `what_should_i_know`, `ecosystem_pulse`) still answer, each answer carrying `_meta.database_note` with the reason (the briefing has no stored decisions, memories or feed rows, and says so in `stored_data_note`); every other tool returns the error, which names the path. A database of this server's own format at a path other than its own `standalone.db`, and an app database that has not finished setting up (before the app's first migration), are not used either: the server changes nothing in that file, runs every tool on its own `standalone.db` (so the tools that need the desktop app are not offered), and says why in `_meta.database_note`, on stderr and in `--doctor`. A fresh clone whose committed `.mcp.json` names `./data/4da.db` therefore still gets dependency answers. Embedding settings come from `FOURDA_SETTINGS_PATH`, else the `settings.json` beside `FOURDA_DB_PATH`, else the desktop app's data directory. Nothing is picked up from the directory the server is started in: until 6.2.5 a `data/settings.json` or `data/4da.db` inside (or beside) the working directory was adopted, so a cloned repository could redirect semantic recall to a host of its choosing or plant "decisions".

> The one exception: if you *explicitly* configure an OpenAI embedding provider (`FOURDA_EMBED_PROVIDER=openai`) for semantic recall, OpenAI receives exactly this, to be embedded: the text of the decisions and memories you stored (subject, decision or content, rationale, rejected alternatives), and the text being searched for: an `agent_memory` recall query, or a `check_decision_alignment` technology and pattern. `what_should_i_know` sends it nothing: it ranks your decisions and memories on this machine. Never the file paths you pass in `files` (they rank results locally), never source code. The default — no embedding provider, or a local Ollama one — keeps everything on your machine, and `FOURDA_OFFLINE=true` overrides it regardless.

**Ecosystems supported:** npm, crates.io (Rust), PyPI (Python), Go; `vulnerability_scan` also reads RubyGems (`Gemfile.lock`) and Packagist (`composer.lock`). Maven, Gradle and .NET are not read, and are listed as not covered. `upgrade_impact` reads npm, crates.io, PyPI and Go. PyPI: versions and dates from the PyPI JSON API, the changelog from the release's sdist, and import sites matched on the module the distribution installs: read from your virtualenv's metadata (`.venv`, `venv`, `env`: `top_level.txt` or `RECORD`), else a table of well-known differences (`PyYAML` -> `yaml`, `Pillow` -> `PIL`), else the distribution name, which the answer then labels an assumption. Go: versions and dates from proxy.golang.org, the changelog from the module zip, and a major version 2+ reported as the module path change it is (`github.com/jackc/pgx/v4` -> `/v5`), with the files that import the old path. `dependency_check` reads all four too; on PyPI and Go, where the registry exposes no publisher identity or install hooks, those signals say "not applicable".

**Known limits, stated plainly:** a `requirements.txt` without a lockfile names only your direct pins, so their transitive dependencies are not scanned (use `uv lock`, `poetry lock` or `pip-compile`). Many packages ship no changelog in their registry archive (fastembed, vite, zod among them); `upgrade_impact` then says so and gives the release-notes URL instead of guessing. Breaking entries are flagged from the changelog's headings and wording, and every entry carries the heading it sits under (`under`). Measured on a panel of 40 real upgrades across npm, crates.io, PyPI and Go (1,618 entries; gold is the majority of three blind raters, each a model instance working to a written rubric, with a verbatim quote for every label; the panel and the measurement are in the test suite): on the 20 upgrades held out from rule-making, 95% of entries flagged breaking were breaking (95% CI 89-98%) and about 72% of breaking entries were flagged; Go release notes written as prose are the weakest (about 54% recall). Treat the flags as a pre-sort: read every entry of a major upgrade. Each answer says this in `_meta.classification`.

The plan has limits of its own. `run_order` is the part of the plan that is safe to run as commands. Rows that need a hand edit (an override that crosses a major of what its parents declare, Yarn classic lockfile entries with copies on several release lines, a requirement edit the manager has no command for) are counted and named in `run_order_note`; running the script alone does not finish them. Measured for 6.5.0 on 14 public projects (`bench/plan-exec`: each project's plan run top to bottom on a copy, then rescanned), the script ran 0 failing steps where 6.4.0's plan had 10, and on Yarn classic projects it leaves most of the work as named hand steps. A target is checked for vulnerable dependencies it holds one level down and, on npm, for the exact pins of those dependencies two levels down (`@hey-api/openapi-ts` 0.97.3 pins `@hey-api/json-schema-ref-parser` 1.4.2, which pins an affected `js-yaml` 4.1.1: the plan says so and gives no command for it, and `dependency_check` names the copy); a range two levels down, anything deeper, and a copy bundled inside the target's tarball (`tap` bundling its own copies) are not detected. A first plan or check of many crates can need a second call: crates.io allows one request a second, so a cold batch of 25 crates may not finish within one call's time, and what it did not reach is answered NOT CHECKED, never clean (the lookups run on, and the next call answers from them). With `project_path: "*"`, the app's plan has one step per package, which can still cover copies whose routes differ between projects; `upgrade_planner` for one project gives each copy its own row. A step can still fail on what the plan could not read, and the package manager's resolver picks the copies no step names: check each step's result before running the next (its `if_it_fails` says how to put back what it changed), and scan again after the run, as `after_run` says.

## What You Can Ask

```
"What changes if I upgrade axum to 0.8?"      -> upgrade_impact
"Check my dependency health"                  -> dependency_health
"Scan for vulnerabilities"                    -> vulnerability_scan
"Which deps should I upgrade first?"          -> upgrade_planner
"Is it safe to bump axios to 1.14.1?"         -> dependency_check
"Pin ws to a 7.x version"                     -> dependency_check (to: "7.x")
"I'm about to bump fastembed 5 -> 7"          -> what_should_i_know
"What's happening in the ecosystem?"          -> ecosystem_pulse
"What's my tech stack?"                       -> get_context
"Record a decision: we chose Postgres"        -> decision_memory
"Does switching to MySQL align?"              -> check_decision_alignment
"Remember: never use ORM for batch inserts"   -> agent_memory
```

## Tools

### Dependency Security

| Tool | What it does |
|------|-------------|
| `upgrade_impact` | What changes between the installed and a target version of one dependency (npm, crates.io, PyPI, Go): releases in between, changelog entries classified breaking / deprecation / security, the breaking ones that touch your code (symbols you import, and route or pattern syntax in your string literals, e.g. axum 0.8's `/:id` -> `/{id}`), the files that import it, advisories fixed. |
| `vulnerability_scan` | Every installed copy in every lockfile matched against OSV.dev. Scope-adjusted `severity` with the advisory's own grade beside it (`advisory_severity`, `by_advisory_severity`; see "Two grades for one advisory"), an upgrade target checked against every advisory of the package (the highest per-advisory fix can itself be affected by another), where each version is pinned, and a `coverage` block on every answer (`complete: true` with `lockfiles_read` when nothing was left out, `complete: false` with what was left out otherwise). Rows come in one fixed order, so detailed pages never lose or repeat a row. Concise by default (one row per vulnerable package version, the 40 most severe; about 10k tokens on a project with about 290 advisories); `package` for one dependency; `response_format: "detailed"` for every advisory. |
| `dependency_health` | Version freshness, deprecation (of the version you run) and vulnerability counts per dependency. With no lockfile read it withholds the score (`healthScore: null`, `withheldReason: "no_lockfile"`), and so it does when a lockfile was read only in part (older than its manifest, cut short, entries skipped) or disagrees with the one read (`withheldReason: "lockfile_partial"`, the summary led by NOT CHECKED and what was not read). After a directory walk that stopped early it leads with NOT CHECKED and scores only the part that was read. |
| `upgrade_planner` | The smallest version no advisory affects for each vulnerable package, majors flagged (a 0.x minor counts as a major). Direct steps (`upgrade_direct`) carry `upgradeCommands`, the command per declaring project directory, keeping how the dependency is declared (`npm install x@v --save-exact` for an exact pin, `npm install "x@^v"`, `pnpm up`, `yarn upgrade` / `yarn up`, `cargo add` with `--dev` / `--build` / `--target` / `--rename`, `go get`; none for a `>=` / `||` / tag / git spec or a yarn workspace member), and a direct target is raised when a slightly newer release also clears a vulnerable transitive it pins. Transitive fixes: `lockfile_refresh` with the exact command (`npm update`, `pnpm update`, `yarn up -R`, `cargo update -p ... --precise`) when every parent's declared requirement already admits a clean version; `upgrade_parent` when a parent pins it but a newer release of that parent admits one, with `parentUpgrades` naming the smallest such release that is itself clear of the parent's advisories (read from the registry), the declared dependencies to bump (`levers`, with their commands; none when the lockfile cannot tie the parent to a declaration) and, when the new requirement still admits the installed copy, the refresh to run after the install (`refreshCommands`); `override_or_replace` with the override syntax (npm `overrides`, pnpm `pnpm.overrides`, yarn `resolutions`, Cargo `[patch]`) when the parent will not move (deprecated, already its latest release, or no release admits a clean version); `waiting_on_upstream` when the parent's releases could not be read, and for a copy bundled inside its owner's package, which only a new owner release (or replacing the owner) can move. `waiting_on_upstream` means no command you can run today fixes that copy; a Python parent the project does not declare is moved by its own refresh (`uv lock --upgrade-package <parent>`) when what requires it admits a release of it that admits the fix. When one version is installed both bundled inside another package and on its own, the row is the `lockfile_refresh` for the copies that are not bundled and `bundledCopies` names each owner whose bundled copy stays; the summary counts that row as a refresh and as waiting on upstream, never as fully fixed. A Cargo upgrade into a release that no longer offers a feature your `Cargo.toml` enables is an instruction naming the feature, not a command cargo would refuse (`upgrade_impact` lists such features in `your_code.cargo_features_removed`). Every row carries `commands` (`{ dir, run }`, `dir` relative to the project, `"."` for the root; empty when its reasons say why nothing is run, such as a hand edit of a lockfile entry or a manifest; a direct upgrade with no command always says why in its reasons, and a freshness upgrade, which no advisory against the installed version makes a security fix, says so, is left out of `run_order` and names the hand step that takes it), and the plan carries `run_order`: the rows shown as one script (`{ n, dir, run, fixes }`) that is safe to run from the first step to the last: one version-setting command per package per directory at the highest release any row needs, nothing set below a version that is installed or that an earlier step sets, every `go get` of one module directory in one command, upgrades before in-range refreshes and a parent upgrade before the refreshes that follow it, and a target that breaks an installed package's peer range run in one command with that package's release when the plan moves it, or left out with the reason. On pnpm the peer step after a parent's upgrade names the release that upgrade leaves, never a lower one. An override within its parents' major is written as commands (`npm pkg set "overrides.<name>=<version>"`, or `pnpm.overrides` / `resolutions`, then the install, in the lockfile's directory), and on Yarn classic a package the lockfile holds on one release line, every copy at or below the target, is refreshed with an exact resolution (`npm pkg set "resolutions.<name>=<target>"`, then `yarn install`; the resolution stays). In a uv workspace each command runs once, at the root, and a copy only a member's leftover `uv.lock` lists is a hand step (delete the file); a uv pin whose release needs a newer Python than the project supports is a hand step that says to raise `requires-python` first; a Cargo row whose release needs a newer Rust than the `rust-version` its `Cargo.toml` declares (inherited from `[workspace.package]` too) carries `needsNewerRust` (`{ crate, version, needs, declared, manifest }`) and a reason, and the step stays, since `cargo update --precise` and `cargo add` install it anyway and only the build on the declared Rust fails (the summary and `run_order_note` count such rows); a package a uv, npm/pnpm/Yarn or Cargo workspace member defines is taken from the workspace and never upgraded from the registry. `run_order_note` says what it covers and what it leaves out, and why, and counts and names the rows that are hand edits and not in the script. A `run_order` step of Cargo, Go, `uv lock`, Poetry, a compiled requirements file, npm, pnpm, Yarn or Bun names the files it changes (`changes`, relative to the project) and, where its failure can leave a file edited (a `cargo add`; `npm install x@v`, `pnpm up`, `pnpm add`, `yarn upgrade`, `yarn up` or `yarn add`; `npm pkg set`), how to put exactly that back (`if_it_fails`); the plan ends with `after_run`: call `vulnerability_scan` again when the steps have run, and what the plan cannot promise. A Cargo `--precise` step carries the pre-update its target needs (read from the crates.io index), Cargo moves run a crate before the crates that depend on it, every uv upgrade of one lockfile is one `uv lock`, a Yarn Berry upgrade of a dev dependency also listed as a peer carries `--dev`, and at a pnpm workspace root or on Yarn Berry a copy another package keeps is refreshed after the step (`pnpm update -r <name> --depth Infinity --no-save`, `yarn up -R <name>`) or the row says it stays. A step whose precondition the plan could not establish (a `cargo add` whose old and new lines link one native library, a uv target that requires the project itself, a uv pin that would install an affected release on the project's lowest supported Python, a check that could not finish, a target that clears none of the row's advisories) is words with the reason, not a command, and the row is not counted as fixed. Dev-only packages are included and labelled `isDev`, as in `vulnerability_scan`. `package` for a one-package plan.<br><br>**Which plan.** For one project (the default, the project the server was started in, or `project_path`) the plan is always computed by this server from that project's lockfiles, with or without the desktop app (`provenance.mode: "lockfile_engine"`). With the app attached, `app_plan_check` says how the app's stored plan compares, by ecosystem, package and installed version: `agrees`, `differs` (up to 10 `differences`), `not_comparable` (a plan format this server does not read, the app's advisory data more than 24 hours old, a lockfile changed after the plan was generated, or this server's own scan incomplete) or `no_plan`, with `plan_generated_at` and `advisory_data_age_hours`; the app's plan never replaces this one. `project_path: "*"` with the app attached returns the app's stored plan across every project it tracks, labelled as such (`provenance.mode: "app_plan"`, `app_plan_check.status: "unverified"`, or `"not_comparable"` on old advisory data): it is not checked against the lockfiles on disk, and `stale` is true when it is past its expiry, when its advisory data is more than 24 hours old, or when a lockfile of a project it covers changed after it was generated (up to 5 named). When `"*"` is asked and no app plan can be read (no app attached, no plan stored, a plan format this server does not read), the answer is the plan for the project the server was started in, led by NOT CHECKED saying it does not cover every project and why, with `vulnerabilityDataAvailable: false` and `allProjects: { covered: false, reason }`. A step in a directory whose name a shell would read as code (it holds `$`, a backquote, a quote, `\`, `%`, `!`, `;`, `&`, `|`, `<`, `>`, a parenthesis, a brace, `*`, `?`, `[`, `]`, `^`, a `:` after the drive, a control or invisible character or a space other than U+0020, or starts with `-`, `~` or `#`, or is a bare `@name`) names no command and no directory: the row's reasons name the directory escaped, the step is left out of `run_order` while the row's steps in other directories stay, and the row is not counted as fixed. `vulnerability_scan` gives no fix command there either, and every answer names such a directory only escaped. A command written with a range carries `installs`, the release it installs when that is not the target, checked as the target was; otherwise the command names the checked release exactly. A direct upgrade that would leave other packages on an affected copy is a hand edit, not in `run_order`. Scan again after running a plan: what an upgraded package brings in deeper than that (a range two levels down, anything below, a bundled copy) is not checked. |
| `dependency_check` | Call before writing any dependency version into a manifest: adding, pinning, upgrading, bumping, downgrading. `to` is the exact version, or the constraint you were given (`"7.x"`, `"^1.20"`, `"~=3.1"`, `"v1"`): then `safe` names the smallest and newest release in it that no known advisory affects, and the verdict is for the one it picks. The answer is concise by default (verdict, a reason carrying the evidence of every avoid / review / unknown / wait finding, `safe`, advisory ids and any registry quotes: about 10 KB for 25 items); `response_format: "detailed"` adds every signal with its evidence, `to_read_as` and the full `range_check`. An exact version an advisory affects gets the safe releases on its line. Verdict per item (`proceed` / `wait` / `review` / `avoid` / `unknown`) with evidence: advisories on the target, release age (holds releases under 3 days unless they fix an advisory you have), publish-trust drop, new install scripts, brand-new transitive dependencies, yanked or deprecated, and a breaking version range (a major, or a 0.x minor) is `review` with a pointer to `upgrade_impact`. A name that is malware itself is `avoid`; a new npm dependency one or two edits from a popular package (`expres`) is `review` with "did you mean" unless its downloads and age show it is established, and a new PyPI name one or two edits from a popular project is `review` with "did you mean" too (`avoid` when under 30 days old with at most 3 releases; PyPI publishes no download counts). A release is also judged by what it requires: an npm release's exact pins and ranges, a crate's dependencies and a PyPI release's `requires_dist` (an environment marker is judged against the Python versions the project declares): one whose newest admitted release, or pin, has an advisory counts against the release; a Go release's go.mod minimums with advisories are a caveat naming the `go get` that raises them. On PyPI, `python_support` says whether the release supports every Python the project declares (`requires-python`, Poetry, uv.lock, Pipfile, `.python-version`, `runtime.txt`): a release whose lower bound excludes one is `review` and never a safe pick; an upper cap is a note. `to_read_as` (in every answer to a constraint or "latest", and in the detailed form) says how `to` was read: a bare PyPI `"3.1"` is the release 3.1.0, as pip reads `==3.1`, never the series. A prerelease is never named as the safe release unless you ask for one. A registry's own words (a deprecation message) are quoted in `quoted_from_registry`, capped, never inside `reason`. A private package is `unknown` and never looked up (see "Private packages are never sent"). npm, crates.io, PyPI and Go (publisher trust, install scripts and new transitive dependencies are npm/crates.io signals and say "not applicable" elsewhere). One item refused as written is `unknown` with `not_checked: "input"` and its reason, nothing about it is sent, and the rest of the batch is answered: an npm dist-tag other than `latest`, a Poetry caret, an unknown ecosystem, a field other than `ecosystem`, `package`, `to` and `from` (`registry` or `index_url`: this tool reads only the public registry), and a package that is no name its registry can have (npm's name rule, with a scope written without its `@` or a version in the name, `lodash@4.17.21`, named as such; PEP 508 names for PyPI, so `requests[socks]` is refused; crates.io's crate-name rule; a Go module path), which covers a local path, a URL, a git source and a whole requirement line. crates.io build metadata (`1.0.0+build`) is dropped before any lookup, as Cargo drops it, and the answer says so; an npm alias in `to` (`npm:lodash@4.17.20`) is checked as the package it installs, and the answer names that package first. A clean answer from OSV.dev's batch endpoint counts only when the package's own advisory list could be read to confirm it, otherwise the item is NOT CHECKED and nothing is cached; an advisory with no grade of its own whose GHSA alias could not be read counts as high. This server's own request limit for a registry is said as such, with `retry_after_seconds`. An item whose OSV.dev batch answer came from the local cache carries `advisory_data_age_minutes` (the summary says so at 5 minutes or more), and `_meta.osv_cached` is true when any answer behind the verdicts came from the cache. A Go module path with upper-case letters whose release reads clean is checked again under its lower-case path, and advisories there make it `review` (`module_path_case`). A field the tool does not define is refused as written (`" to"`, with its blank). When no item could be checked the summary starts with NOT CHECKED, and `_meta.offline_note` says whether `FOURDA_OFFLINE` is set or the network, a proxy or OSV.dev failed. Go: a release is judged against the module's retractions, and when the list of retractions could not be read the item is `unknown`, never `proceed`, and nothing is cached for it; an item this server's own Go request limit held back says so (the proxy was not asked) and carries `retry_after_seconds`. |

### Intelligence

| Tool | What it does |
|------|-------------|
| `what_should_i_know` | Pre-task briefing built from the task, for npm, PyPI, crates.io and Go packages (what a task installs through any other manager or tool is outside its answer, and every `safe_to_delegate` reason says so): the dependencies it names (and the families it names: "all tauri plugins" adds the project's tauri-*, tauri-plugin-* and @tauri-apps/* packages; for "latest", whether each is already on the newest major), their versions and confirmed vulnerabilities, majors crossed, your recorded decisions, and a delegation level. The level rests on your declaration and on your statement of which words are not packages: each package you declare public is checked at the `version` you state. Declare the version the task writes. Pass the request in the user's words (a misspelt name may be the finding) and, on the first call, `packages: [{ ecosystem, name, version?, public }]` (at most 100) with every package the task adds, pins, bumps, downgrades or swaps in, or `packages: []` if it changes none; words of the task that are not packages go in `not_packages` (at most 100). A `public: true` entry states the `version` you will write (an exact version, a range, or `"latest"`), is sent to its public registry and is checked in that call; an entry without `version` is still checked, but the answer is never `safe_to_delegate` (`confirmation_needed`, or a stricter level another rule sets) and `next_step` asks for the version. Declare `public: false` for anything the task or the project takes from a private registry, an index of its own, git or a path: it is never looked up for the task. What the briefing promises beyond that: a name it read and reported (a command's operand, a snippet entry, a name with a version written on it, a line of a requirements file the task names) that you put in `not_packages` keeps the answer from `safe_to_delegate`; a name you dismiss or declare private, and any path under it, is never in a request the call makes, whatever its spelling, and a public entry for it or under it is refused (a public parent of a private path is a name of its own, sent when you declare it public); a value of a known credential shape in any tool's arguments is refused before any lookup (a name, version, ecosystem or path) or masked (free text a tool stores), and never appears, whole, in any response of the server (over stdio and over HTTP, body and headers) except this answer's `task` field, which is the briefing's best-effort reading copy of your task, not your text (`task_note` says when it differs from your task in more than blanks); only known credential shapes count, matched at their issuers' lengths and glued to other text or not (a Stripe or `sk-` key needs a word boundary before it); each declared package gets the check ledger line `dependency_check` writes for it, so the guard hook treats it the same. The briefing also checks versions it happens to read in the task (on a command's operand, in a snippet, beside a name, for example name@1.2.3, name==1.2.3, `"name": "1.2.3"`), the worst answer setting the level; that reading is best effort: a version written in a spelling it does not read is not checked. In a call that declared at least one package, every `safe_to_delegate` reason says so: "The versions this briefing read in the task's commands and snippets are best effort: a version written in a spelling it does not read was not checked, so declare the version the task writes." The level is raised, for example, by a finding on a checked package, a vulnerability of a package the task touches (a declared one's installed copy included, even where the declared version is its fix), malware or an npm security placeholder (version `0.0.1-security` of a name) in a lockfile the scan reads (dev and transitive entries included; a direct npm dependency's copy on disk is read too, best effort, with no promise to see every copy) (`human_only` for every task), running install drift, a decision conflict over the packages declared, named in the task or touched, a name waiting in `to_confirm`, or something the briefing noticed it could not read: a command or snippet it could not read whole, a command of a manager it does not read (gem, brew, composer ...; best effort: it does not promise to notice each one), more snippets or words than one call reads, the call's time running out, or a part of the project the scan could not read, a lockfile more than 8 folders down or behind a link, or a folder it could not list (the level is then `unknown`); each is said in the reason. Another vulnerability of the project is listed in `advisories` with scope "project" and leaves the level as it is. A task that holds one of a fixed list of package-source spellings (`--registry`, `--index-url`, pip's `-i`, `--git`, `PIP_INDEX_URL`, `[[tool.uv.index]]` and the others the CHANGELOG lists) has nothing it adds looked up, and the answer is kept from `safe_to_delegate` when that held a name; any other way of naming a source is not noticed. `task_packages` holds every package-like word of the task once: `status`, `to_confirm` (the names it noticed and did not look up, at most 25 listed and `to_confirm_total` counting all, each with the `ecosystems` it could be in, how it was `seen`, and a `hint` or `caution` for the agent, never a version), `checked` (each with its verdict and `basis`), `private`, `not_read` (what the screen kept back, shown without its value), `dismissed` and `next_step`. `to_confirm` is a prompt, not a complete reading: declare every package the task adds or changes, in each ecosystem. The level is `safe_to_delegate`, `review_needed`, `human_only`, `unknown` (no ready vulnerability scan; the reason names the cause, such as every installed dependency being private, an unreadable `.npmrc` or an unreadable lockfile) or `confirmation_needed`: the agent acts next, by doing `next_step`. A call without `packages`, and any call while a name waits in `to_confirm`, is `confirmation_needed` (or `human_only` when something it looked up on its own is malicious or critical), never `safe_to_delegate`. "Confirming packages" below shows the two calls. On its own the briefing looks up only packages the project already uses in the same ecosystem and names on the server's bundled lists ("What's sent over the network" has the rule); the project's own scan still reads the installed dependencies, including one you put in `not_packages`, and no task text goes to an embedding provider. |
| `ecosystem_pulse` | Hacker News headlines that name your dependencies, then your languages (labelled as such). Fetched only when called; the search terms are the frameworks and direct dependencies of the project on disk (with or without the desktop app), never a private name. |
| `get_context` | Your tech stack, resolved dependency versions, interests, detected topics. |
| `get_relevant_content`* | Scored content feed that passed the desktop app's relevance judge, one item per advisory. A `since_hours` you pass is never widened; the default 24 hours is widened to 168 and then 720 hours when it holds nothing, and `window` (`requested_hours`, `used_hours`, `widened`) and `summary` say so. |
| `get_actionable_signals`* | Judge-accepted feed items the app classified (advisories, breaking changes), plus this project's own vulnerabilities, with the scan's instruction for each. It starts the project's scan and waits for it when none has run in the session (`scan`: `status`, `scanned_at`; `note` starts NOT CHECKED when the scan is missing or incomplete). The same window rule as `get_relevant_content` (default 48 hours; `window` and `note`). |
| `knowledge_gaps`* | Dependencies with judge-accepted advisories or releases you have not looked at. |
| `record_feedback`* | Save or dismiss items; recorded in the app's own feedback tables, which its calibration reads. A record that could not be written (the app holding its write lock) is an error, never a success. |

### Decisions & Memory

| Tool | What it does |
|------|-------------|
| `decision_memory` | Record, query, and manage architectural decisions across sessions. |
| `check_decision_alignment` | Verify if a proposed technology change aligns with recorded decisions. |
| `agent_memory` | Persistent memory that survives across sessions, agents, and editors. |

### Identity

| Tool | What it does |
|------|-------------|
| `developer_dna`* | Your tech identity: primary stack, top dependencies, blind spots. |

*\* Requires the [4DA desktop app](https://4da.ai) for full data.*

### Confirming packages

The briefing makes one promise, resting on your declaration and on your statement of which words are not packages: each package you declare public is checked at the `version` you state, so declare the version the task writes. What it reads in the task is best effort. It never guesses whether a word of a task is a public package. In a clean npm project a first call without `packages`

```
what_should_i_know { "task": "npm install lodahs" }
```

answers `confirmation_needed`, with `"to_confirm": [{ "name": "lodahs", "ecosystems": ["npm"], "seen": "operand of an install command", "hint": "one edit from lodash: if you mean lodash, confirm lodash instead" }]` and a `next_step`. The agent says what it means:

```
what_should_i_know { "task": "npm install lodahs", "packages": [{ "ecosystem": "npm", "name": "lodahs", "version": "latest", "public": true }] }
```

lodahs is checked in that call (`"checked": [{ "name": "lodahs", "ecosystem": "npm", "version": "0.0.1-security", "verdict": "avoid", "basis": "confirmed public by you" }]`), the level is `human_only` (npm took lodahs down as malware), and the `avoid` is in the check ledger, so the guard hook holds `npm install lodahs` as well. Had the agent meant lodash, it would have declared lodash. An agent that knows its packages passes them on the first call and gets the whole briefing at once.

A command written inside a sentence is read to the end of that sentence: "Use npm install msw for tests" holds msw, for and tests, and each waits like any operand. Putting for and tests in `not_packages` keeps the answer from `safe_to_delegate`, since the briefing read them as operands, and the reason says that this command, as the task writes it, keeps the answer from `safe_to_delegate`, that it is not an error, and to check what the command installs with `dependency_check`. Written on its own line, in a code span (`` `npm install msw` ``) or in parentheses ("(npm install msw)") in the user's own request, the command holds only msw.

### Prompt: `deps`

A user-invoked workflow (shown as a slash command by hosts that surface MCP prompts). It tells the agent to run `upgrade_planner`, check every proposed bump with `dependency_check`, apply only `proceed` items in small batches with the project's own tests after each batch, stop and report every `review` / `avoid` / `wait` / `unknown` item with its evidence, and re-run `vulnerability_scan` at the end. Optional argument `scope` (e.g. `security only`).

## The guard hook

The Claude Code plugin adds a hook that runs before every edit and command an agent makes (PreToolUse on Edit, MultiEdit, Write, NotebookEdit, Bash and PowerShell). It is a guard-rail against an agent's mistakes and shortcuts: it holds an edit or a command in which it reads a dependency version that has not been checked. It is not a sandbox. An agent that sets out to get around it can (a script file that runs the install, a path built from pieces), and it says nothing about what a package does once it is installed. It is plain Node, reads no network and contacts nothing.

**What is promised, and what is best effort.** The guard's promises are about edits. A change an agent makes with the Edit, MultiEdit or Write tool to `package.json`, `Cargo.toml`, `pyproject.toml`, `go.mod` (and `go.work`) or `pnpm-workspace.yaml`, or to a package manager's configuration file (`.npmrc`, `.yarnrc`, `.yarnrc.yml`, `bunfig.toml`, `.cargo/config.toml` and `.cargo/config`, `pip.conf` and `pip.ini`, `uv.toml`, `poetry.toml`, `.pnpmfile.cjs` and `.pnpmfile.mjs`), is read with a strict reader of that file's format: each dependency version the edit adds or changes is judged against the ledger as described below, and an edit the guard cannot read is held. The rules for which verdict counts, the guard on the ledger and what the hook does when it cannot finish reading a call are promises too. Its reading of shell commands (`npm install x@1.2.3`, `pip install -r requirements.txt`) and of requirements files is best effort. A package manager's own parser decides what a command line or a requirements file means, and it accepts more spellings (abbreviated options, option letters run together, sub-commands, runners, line continuations) than a reader of text can promise to follow: the independent checks of this release kept finding one more. So everything this section says about commands and requirements files describes what the guard does with the forms it reads, as its tests pin them. A command the guard recognises as an install and cannot read is held; a command or a requirements line written in a spelling it reads differently from the package manager can go ahead unchecked. `vulnerability_scan` reads what was actually installed: run it after an install.

**How a version is cleared.** Every `dependency_check` answer for an item it accepted is recorded in a ledger in the server's data folder (`check-ledger.jsonl`, never sent anywhere), and so is the answer for every package a `what_should_i_know` call declared `public: true` and checked (a task that holds one of the listed source spellings records nothing). The hook reads the answers of the last 24 hours (the last hour for a `latest` answer, which a name alone and a spec that bounds nothing need), each for the reading it judged: an exact version is cleared only by the answer for that one release, a range only by the answer for that range. A crates.io bare `1.2.3` is the caret range `^1.2.3` (ask for `1.2.3`), and only `=1.2.3` is the release; `cargo install x@1.2.3` installs exactly 1.2.3 and needs the answer for `=1.2.3`:

- `proceed` or `review`: the call goes ahead. A `review` answer, for example for a low or moderate advisory, lets the change through as `proceed` does.
- `avoid` or `wait`: it is held, with that answer's reason.
- No answer, or only `unknown`: it is held, and the denial gives the exact `dependency_check` call to make; the same edit or command goes ahead once that call answers `proceed` or `review`.
- A package named without a version (`npm install x`, `pip install x`, `cargo add x`, `go get x`, `cargo install x`, `yarn global add x`) installs the newest release, so it needs an answer for `latest` (`to: "latest"`). As a further guard, with npm, pnpm, Yarn, Bun, `uv add`, `poetry add` and `cargo add` a name alone is held, with the version to name in the manager's syntax (`x@1.2.3`, `x==1.2.3`), when the hook sees a reason the manager may pick another release: a change of folder before it that the hook does not follow (popd, `cd ~`, `cd -`, a folder that does not exist, a cd after `&&` or `||` or in a pipeline, a drive change, a wrapper or prefix with a directory option such as `pwsh -WorkingDirectory`, `pnpm -C … exec`, `uv --directory … run`, `env -C`, or a directory option given twice); a workspace option (`-w`, `--workspace`, `--filter`, `-F`, `-r`, `-p`, `--package`, `yarn workspace`); a workspace root at that folder or up to 12 above (`pnpm-workspace.yaml`, `lerna.json`, `nx.json`, `rush.json`, a `package.json` with `workspaces`, a `pyproject.toml` or `Cargo.toml` that mentions `workspace`, a `go.work`); or a project file there or above that mentions the name. The same guard holds a range (`x@^1`, `'x>=2'`), with "name the exact version". So with those managers every name alone inside a workspace is held until the version is named; `pip install x` and `go get x` are not covered by this further guard. This guard is not a guarantee: see the limits below. `bun update x` is read as an add of x. With npm, pnpm, Yarn and Bun, `x@latest` is judged at the newest release even beside a declared version, which those managers replace. A dist-tag other than `latest` (`x@next`) or a Go branch is held until the command names the version.
- A range or constraint needs an answer for that same constraint, or a `proceed` or `review` for exactly the release its inclusive ceiling names (`<=1.2.3`, `1.0.0 - 1.2.3`, with only lower bounds beside it and no `!=`); a lockfile that already holds a release in the range keeps that one, so check the locked release too. `"latest"` in `package.json` needs an answer for `latest`.

Marking a package `public: false` in `what_should_i_know` records nothing and releases nothing. A package from a private registry is released by a private-registry rule the server reads (`FOURDA_PRIVATE_PACKAGES`, an `.npmrc` scope or registry, `.yarnrc.yml` `npmScopes` or `npmRegistryServer`, `bunfig.toml`, `GOPRIVATE`, `GONOPROXY` or `GONOSUMDB`, `GOPROXY`, a Cargo source replacement, a pip, uv or Poetry index, a requirements `--index-url`, a Pipfile source): `dependency_check` then sends nothing, records the name private. A private record lets an install through, for 24 hours and unless an `avoid` or `wait` for that exact version or constraint came first, only in these cases: the name is on your own `FOURDA_PRIVATE_PACKAGES` list (`private_rule: "listed"`), in every project; a rule names the package or its scope (an npm `@scope:registry`, a `GOPRIVATE` pattern; `private_rule: "named"`), everywhere when the rule is set in the environment, and otherwise only for a command that changes no folder, names no directory option and installs nothing globally, run in the project folder whose configuration holds the rule (npm and pnpm do not read a root `.npmrc` scope in a nested package or a workspace member). A name withheld only because the project's default registry, index or proxy is a host 4DA does not know as public (`private_rule: "registry-wide"`) is released nowhere: the denial names the host and the two ways through, adding the host to `FOURDA_PUBLIC_MIRRORS` when it proxies the public registry, or the name to `FOURDA_PRIVATE_PACKAGES` when it is your own package. A name a project takes from git, a path, its workspace, an alias, a catalog or another registry is not looked up either, and is held when a command or an edit would install it from the public registry instead: that release was not checked, and the denial says how to go through. A name the server withheld because a lockfile could not be read is held, with the file to repair.

**What it reads.** An edit made with the Edit, MultiEdit or Write tool to `package.json`, `Cargo.toml`, `pyproject.toml`, `go.mod`, `pnpm-workspace.yaml` or a requirements file (`requirements*.txt`, or any `.txt` in a folder named `requirements`), the name matched whatever its letter case: only dependency declarations count, never a comment or a description, and each section is compared on its own, so a dependency moved into another section is judged there. An entry counts as unchanged only when its whole declaration is: an edit that keeps a version but changes its condition or its source (a marker, an extra or a platform, a Poetry `python`, `markers` or `optional` key, a Cargo `path` key, or a `[patch]`, `[replace]` or `[tool.uv.sources]` entry for the name, a `[replace]` key's version included) is judged again as a new entry. An Edit or MultiEdit the hook cannot read in its shape (a step without a string `old_string` and `new_string`, or `edits` that is not a list) is held. An Edit is read from the file on disk (a Git Bash path such as `/c/x` is read as `C:/x`); an Edit of a manifest the hook cannot open is held. A declaration that bounds nothing by its meaning (`*`, `""`, `x`, `x.x`, `*.*`, `=*`, `^*`, `v*`, any `||` alternative that is empty or only wildcards, a name alone in a requirements file or a pyproject array, the same wildcards in Poetry and in every Cargo form (`"x"`, `{ version = "x" }`, `[dependencies.x]`, target and workspace tables)) needs an answer for `latest`; a dist-tag other than `latest` is held until it names a version. pnpm's `packageExtensions` are read as declarations, and a change under a `pnpm-workspace.yaml` key the hook neither reads (catalog, catalogs, overrides, packageExtensions, configDependencies) nor knows to install nothing is held. `package.yaml` and `package.json5`, which pnpm reads as manifests, are held with the advice to write the manifest as `package.json`, whatever their spelling (`package.yaml::$DATA`, a trailing dot or space); a NotebookEdit of any manifest is held with the advice to use Edit or Write. A `go.work` is read for its `replace` directives as `go.mod` is. A URL dependency in any manifest (a `package.json` value, `name @ URL` in any pyproject array or a requirements file, a `[tool.uv.sources]` or Poetry `url`) follows one rule: a public registry's own file is read as that name and version and judged, a host private by its shape goes ahead, and any other host is held as a source the hook cannot judge until the name is recorded private. In `go.mod` and `go.work`, `latest` needs an answer for latest, and a branch, `upgrade`, `patch` or a comparison is held until the exact version is named. A range of exclusions only (`!=1.0`) needs an answer for that same constraint. A command: any line in which a package manager's name (npm, pnpm, Yarn, Bun, pip or `python -m pip`, uv, Poetry, Cargo, Go) is followed by one of its words that can add or move a dependency (install, add, up, update, upgrade, link, get, sync, lock, `npm pkg set`, `go mod edit`), also when it runs inside `bash -c`, `pwsh -Command`, `eval`, `npx`, `pnpm dlx`, `uv run`, `poetry run`, corepack and the other wrappers (at most three deep), after `sudo`, `env`, `timeout` and the like, or inside a subshell or a group. A dependency value is read in the forms the hook knows: Yarn 2+ `npm:` and `patch:` values are read as the release they wrap, the project's own forms go ahead, and a value it does not recognise is held until you write the registry version. A requirements or constraints file you install from is read when the command runs; keep index and other resolution options on the command line, where the guard reads them, rather than inside the file or in a config setting. An edit of a package manager's configuration file is read too: setting up a private registry or scope (an `@scope:registry` line, a registry or index URL) is yours to do, and the guard holds such a change when an agent makes it. The guard judges what an edit or an install command names; a manifest, lockfile or configuration file changed some other way (a git checkout, a script, a shell redirect) is installed as it is by the next clean install or sync. If your Python or Rust projects install packages from a private index, list those package names in `FOURDA_PRIVATE_PACKAGES`: the guard does not try to work out where a named index points, so a package it does not know to be private is checked against the public registry. An edit that leaves the manifest unparseable by a strict reader (single quotes, comments or trailing commas in `package.json`, which Bun accepts; broken TOML; a `go.mod` line that is no directive) is held until the syntax is fixed. A configuration file is read strictly: a line the guard cannot classify with certainty (a key behind a tab or other unusual blank, an indented line outside a YAML block or pip's multi-line keys, a continuation backslash, an anchor, tag or second YAML document) holds the edit. An edit that repairs an already broken `package.json` is read normally. Write each package manager option in full (`--save-dev`, not `--save-d`; one letter per dash for npm and pnpm): an abbreviated or clustered spelling is held, because the guard reads options only as written in full. Short options run together are read only when each letter is a switch; write an option that takes a value on its own (`-q -r requirements.txt`). A `go.mod` edit that adds a `toolchain` line or raises the `go` version above the one the file had, in the go command's own order (`go 1.24` to `go 1.24rc1` is a raise), is held, because the go command fetches that toolchain. A `go.mod` version shorter than `v1.2.3` is held, because the go command reads `v1.2` as `v1.2.0`, and so is a module replaced twice. A `Cargo.toml` or `pyproject.toml` is read as Python's tomllib reads TOML, so an edit is held when the file it makes is not such TOML (a control character in a string or a comment, `[x]` and then `[[x]]`) or when the guard's own reader would read it differently, and a `pyproject.toml` that starts with a byte order mark is held because pip cannot read it. A quoted key that holds a dot (`"six.path"`, `'cfg(target_feature = "sse4.1")'`, `"jaraco.classes"`) is one key, inside an inline table too. The `dependencies` of `[tool.hatch.build]`, of its targets and of its build hooks, and `[tool.hatch.env] requires`, are judged as `build-system.requires` is, while `require-runtime-dependencies`, a custom build hook or target, and any variable in a Hatch environment's `env-vars` (a proxy or certificate setting changes what pip in that environment fetches as much as a `PIP_*` one) are held when an edit adds, changes or removes them. In `pyproject.toml`, a `[tool.<name>]` table the guard does not read (for example `[tool.scikit-build]`, whose `build.requires` pip installs, `[tool.maturin]`, `[tool.cibuildwheel]` or `[tool.tox]`) is held when an edit adds, changes or removes a key under it, and the denial says you can make that edit yourself; the tables of the resolvers it reads (Poetry, uv, pdm, Hatch, flit, setuptools, rye and pixi) are read as before, and the tables of linters, formatters, type checkers, test runners, coverage, changelog and version tools (ruff, black, isort, mypy, pyright, pylint, pytest, coverage, setuptools_scm, towncrier, commitizen and the others on `PY_INERT_TOOLS`) go ahead, but for a key whose value is a command such as pylint's `init-hook`. A top-level `pyproject.toml` table other than `project`, `build-system`, `dependency-groups` and `tool`, a `[project]` or `[build-system]` key those standards do not define (an in-tree `backend-path` included), a top-level `Cargo.toml` key outside cargo's own schema, a `package.build` script, a `package.json` script that a package manager runs when it installs the project (`preinstall`, `install`, `postinstall`, `prepare` and the like), `devEngines.runtime`, and a key pnpm does not read in a `packageExtensions` entry are held when an edit adds, changes or removes them. A Write of a manifest or a configuration file at a path the guard cannot place for certain (a drive-relative path such as `Q:.npmrc` or `C:package.json`, on any drive) or over a file it cannot read (a folder of that name) is held; a file that is not there yet is read as empty. In `pnpm-workspace.yaml` and `.yarnrc.yml` a quoted value or key is read only when its quote character does not occur inside it (no `''`, no backslash between double quotes) and nothing but a comment follows it. A version in a `pnpm-workspace.yaml` catalog, override or other version section that YAML reads as something other than the text written (`1.0`, `010`, `null`, `true`) is held until it is quoted, and so is a key YAML reads as no string (`~`, `null`, `<<`) or one holding a colon or a `#`. A `go.mod` or `go.work` edit that adds, changes or removes a directive line other than `require`, `replace`, `go`, `toolchain`, `module`, `retract`, `godebug` and `use` (a `tool`, `exclude` or `ignore` line, for example) is held, because the go command may then pick a release no one checked: for `tool`, first add the module as `require <module> <version>` with a checked version; for `exclude`, name the exact version to move to in its `require` line instead. Removing or changing a `go.work` `use` line, or changing a `go.mod` `module` line, is held too, because the go command then fetches that module from the module proxy; adding a `use` line goes ahead. A key `__proto__`, `constructor` or `prototype`, at any depth and however escaped, in `package.json`, `pnpm-workspace.yaml`, `.npmrc`, `.yarnrc`, `.yarnrc.yml` or `bunfig.toml` is held, because pnpm reads a `__proto__` key as the object's prototype and installs the dependencies under it. pdm's `editable-backend`, Hatch's `dev-mode-exact`, and uv's `package` and `python-preference` settings (`python-preference` in `uv.toml` too) are held when an edit adds, changes or removes them, because each makes a build or `uv sync` fetch something more (`editables`, a build backend, a Python interpreter). A key that names a workspace's member folders goes ahead (`workspaces` in `package.json`, `packages` in `pnpm-workspace.yaml`, Cargo's `workspace.members`, `default-members` and `exclude`, a `use` line added to `go.work`, and uv's `[tool.uv.workspace]`), and the members' own manifests are installed as they stand. In `pyproject.toml`, `[project] dynamic` is read as a list of field names: adding or removing `dependencies` or `optional-dependencies` in it is held, because the build backend then takes the project's requirements from `setup.py`, `setup.cfg`, `[tool.setuptools.dynamic]` or `[tool.poetry.dependencies]`, while `dynamic = ["version"]` and the other metadata fields go ahead. For the same reason an edit that only removes is held when a current build backend or Poetry would then take the requirements from another file or table: the `[project]` table removed, `[project]` left naming no requirement in a file whose `[tool.poetry.dependencies]` names some, a `dependencies` or `optional-dependencies` field removed from `[tool.setuptools.dynamic]` or its file list emptied, and the `build-backend` of an existing `[build-system]` table changed or removed; the denial says you can make that edit yourself. Removing one dependency, emptying the list in a project without a Poetry table, and removing an optional-dependencies group or table go ahead, and so does a `[build-system]` table added to a file that had none, its `requires` judged. A readme, version or description file named in `[tool.setuptools.dynamic]` is no longer read as a requirements file, and a requirements file named there through an inline `[tool]` table is read. An Edit of a configuration file whose old text uses LF line ends is matched against a CRLF file as an Edit of a manifest is. An `.npmrc` credential key for a registry with a port (`//localhost:4873/:_authToken`) goes ahead as the same key without the port does. When an edit removes a package from one `package.json` dependency section while another section still declares it (npm and Bun take `devDependencies` and `optionalDependencies` over `dependencies`, and a `peerDependencies` entry is installed once the other entry goes), or removes or changes one of two `go.mod` `require` lines of a module, the declaration that stays is judged as if added. The same holds when an edit removes or changes an override, a resolution, a `pnpm.overrides` or `pnpm-workspace.yaml` override, a `go.mod` `replace` or a uv `override-dependencies` or `constraint-dependencies` entry of a package the file declares, whatever version it pointed at, and when it removes a peer's `optional` flag in `peerDependenciesMeta` (any value npm reads as true counts). An edit that removes or changes a `pnpm-workspace.yaml` `overrides` section written on one line (`overrides: { x: 1.2.8 }`) is held, because the guard does not read that form; a `go.mod` `replace` that names a version on its left masks only a `require` of that version. A `[dependency-groups]` `include-group` item is read as the included group's entries, and an include of a group the file does not declare, or a cycle, is held. Removing `python-downloads = "never"` or `managed = false` (or changing them to another value) is held, because without them uv downloads a Python interpreter; adding them, or the defaults, goes ahead, and in `uv.toml` any change of those two keys is held. So removing a `devDependencies` entry for a package that `peerDependencies` also names is held until that peer range has its own verdict, even when the range would pick the same release. Removing or changing an override, a resolution or a `pnpm.overrides` entry that points a name at a local folder, a workspace member or git (in `package.json` or `pnpm-workspace.yaml`), or a uv override or pixi path source in `pyproject.toml`, judges that name's entries in the same file again, because the manager then fetches the registry release. A `Cargo.toml` `[features]` item that turns on a dependency's feature (`itoa/no-panic`) is part of that dependency's declaration, so changing it judges the dependency again. A ledger line dated in the future holds its package until its time comes. An `.npmrc` `audit` line goes ahead: it only says whether npm reports an audit, and changes no release. So do a Poetry group's `optional` key and `.cargo/config.toml`'s `[net] retry`.

**It lets such a command through only when it reads it whole.** A command it cannot read whole is held, and the denial names the first part it did not read and how to run the command so that it can: "Run the same command without `<that part>`", or with that part written out (a variable's value, an exact version); an option is named alone ("without the option `--before`; if that option takes a value, remove its value too"). Held this way, among others: a variable or a substitution among the install command's own words (`npm i $PKG`; a variable only in a `cd` before an install of exact, cleared versions does not hold it), beside a named package, every option that is not on that package manager's allow list (the list holds placement such as `--save-dev`, `-g` and `-w`, output, `--ignore-scripts`, `--dry-run` and a few more that cannot change which release is installed or where it comes from (placement options are allowed; the workspace options among them, such as `-w`, `--workspace` and `--filter`, make the hook ask for the exact version beside a name alone or a range: see "How a version is cleared"); `--before`, `--tag`, `--offline`, `--frozen-lockfile`, `--force` and an abbreviated option are not on it), a constraints file beside a named package, a version spec outside its registry's grammar, a package manager's own setting named anywhere at or before the install (`npm_config_registry=...`, `PIP_INDEX_URL=...`, `GOPROXY=...`), `xargs`, an alias or a function beside a package manager's name, a blank or control character other than a plain space or tab on an install line, `sed`, `awk` or `make` with an install on their line, and a PowerShell comma list. Text that only mentions an install goes ahead: `echo`, `grep`, `git commit -m "..."`, `gh pr comment`, a README written with the Write tool.

**Goes ahead without a verdict.** A command that names no package (`npm install`, `npm ci`, `uv sync`): it installs the lockfile or the manifest's own ranges, and what the package manager chooses then is not checked. A package from a path or git. A URL operand follows the same URL rule as a manifest value, whatever stands before it (`name@URL`, `alias@npm:URL`, `name @ URL`): a registry's own file (any letter case, with or without the default port, a percent-encoded scope, a query or fragment) is that name and version and is judged; a git or `file:` URL, or a host private by its shape, goes ahead; any other URL is held. An archive given as a path, a UNC path (`//host/share`) or any `file:` URL included, is taken as local and goes ahead unchecked, whatever host it names. A `file:` location in `--find-links` or an index option is local; there, a UNC path or a `file://host/` URL follows the host rule. Index, registry and source options follow one rule: exactly one option that replaces the public index (`--registry`, `-i`, `--index-url`, `--default-index`, Cargo's `--index`) on a host private by its shape (localhost, a name with no dot, a name ending in .internal, .local, .lan, .corp, .home.arpa, .test, .example, .invalid or .localhost, or a loopback, private or link-local address) goes ahead unjudged as the project's own source; `--no-index` with only local or private `--find-links` goes ahead (no index is read); in every other case and combination (`--extra-index-url`, uv's `--index`, two sources, a registry on any other host) the named packages are judged on the ledger: a proceed or review for the release named, or a private record, lets the install through, and the denial says how to mark a private name (`FOURDA_PRIVATE_PACKAGES`). A denial for such an option never says to leave it out. A requirements file is read, best effort, both when it is written with the Edit, MultiEdit or Write tool and when a command installs from it (`pip install -r requirements.txt`).

**On Windows, through a `.cmd` file.** If you call a package manager through its `.cmd` file (`npm.cmd`), name exact versions: cmd.exe rewrites `^` and other characters in its arguments, so the guard holds a range given that way.

**The ledger is the server's.** Any call that names the check ledger file or the data folder it is in, or that holds the data folder's base name, `FOURDA_MCP_HOME` or `check-ledger.jsonl` as a path segment, is held unless it is one plain read command (`cat`, `Get-Content`), with or without a ledger file: only the server writes there. The Windows 8.3 short form of the folder's name or of the ledger file's name (`4DA-MC~1`, `CHECK-~1.JSO`) counts as that name.

**When it cannot finish.** If the hook fails, or reading a call takes longer than its budget (2 s of reading from its start, and a 5 s wall clock for a payload over 8 KB), it holds every Bash and PowerShell call (the denial says the hook could not finish reading the command, and to run it in smaller parts), every edit of a manifest, of a package manager's configuration file or of the ledger, and a payload under 8 MB that does not parse; any other call goes ahead. What it cannot read inside its bounds is held as not read, and the denial names the part: a requirement or manifest line over 64 KB, a version over 80 characters, a range or constraint over 1,000, an `npm pkg set` key over 600, TOML nested more than 100 levels, a manifest on disk or after the edit over 8 MB, a MultiEdit whose edit count times the file's size passes a fixed bound, a command over 2 MB that names an install, a ledger file over 4 MB or with more than 5,000 entries for one package, and a change to a `pnpm-workspace.yaml` in which any line is not plain, that is, not a comment, a `key:` header, a `- 'entry'` item or a `key: value` with a plain or simply quoted value (or a top-level `packages:` line whose value is a list of quoted strings, `packages: ['pk/*']`), with or without a comment after it (the denial says to rewrite it as plain `name: version` lines). A payload over 8 MB that does not parse, or one over 64 MB, is not read whole and is held like a failure of the hook: every Bash and PowerShell call, every manifest edit, and any payload whose tool cannot be found in its first 64 KB. A call whose stdin is still open after 8 s is judged when its whole payload has arrived, and treated as a failure of the hook when it has not. Claude Code stops a hook after 10 s and then lets the call through.

**What it does not see.** Each of these goes ahead unchecked:

- a command, or a line of a requirements file, written in a spelling the guard reads differently from the package manager (an option it does not know to take a value, an abbreviation, a sub-command, a line end or a continuation): its reading of both is best effort, as said at the top of this section. Where the guard sees that it cannot read an install command it holds it; where it does not see it, the install goes ahead unchecked;
- commands that let the package manager choose versions without naming a package: `npm audit fix` (also with `--force`), `pnpm audit --fix`, `npm update`, `pnpm up` or `yarn upgrade` with or without a name (measured with npm 10.9.2, pnpm 10.34.6 and Yarn 1.22.22: a name the project does not declare is not added), `bun update` with no name, `cargo update`, `cargo upgrade`, `poetry update`, `uv tool upgrade`, `go mod tidy`, `go get -u ./...`. Run `vulnerability_scan` after them;
- a runner that fetches a package and runs it (`npx`, `pnpx`, `bunx`, `npm exec`, `pnpm dlx`, `yarn dlx`, `bun x`, `npm init` and the `create` commands, `uvx`, `uv tool run`, `uv run --with`, `pipx`, `go run mod@v`): reading what it fetches is best effort. Where the guard sees a release named with a version, a range, a dist-tag or `latest`, or on `--package`, `--with`, `--from` or `--spec`, it is judged as an install is and held without a verdict; an option, a prefix or a spec form the guard does not read for that runner is not promised to be seen. Given only a tool's name, `npx` and its kin run the project's installed tool or fetch the newest release unchecked, `uvx` always fetches, and the release of a package manager that `packageManager` in `package.json` names, which corepack downloads, is not checked. `cargo binstall` is not read. A runner that runs a package manager (`npx pnpm add x@1`) is read as that command;
- settings that change what a name resolves to when they were already in a configuration file before the session, when they live in a configuration file the guard does not list (a global one at another path), in a lockfile edited by hand and installed with `npm ci`, in `git config url.<x>.insteadOf`, or when a variable such as `HOME`, `APPDATA`, `CARGO_HOME` or `GOENV` points the manager at other config files. (An edit of `.npmrc`, `.yarnrc`, `.yarnrc.yml`, `bunfig.toml`, `.cargo/config.toml`, `pip.conf`, `uv.toml` or `poetry.toml`, the resolver tables of `pyproject.toml`, a config command such as `npm config set`, `pip config set`, `poetry source add` or `go env -w`, and an option that points a manager at another configuration, such as `--userconfig`, `uv --config-file`, `cargo --config` or `-Z`, `pnpm --config.<key>`, `yarn --use-yarnrc`, `bun -c`, `go -modfile` or `poetry -C`, ARE read: a change that can alter which release resolves is held.);
- a `go` line written in a new `go.mod`, added to one that had none, or lowered: a version above the installed Go makes the go command download that toolchain, unchecked (holding it would hold the file `go mod init` writes);
- a Python requirement that `[tool.uv.sources]`, or a Poetry path or git dependency, maps to a local source: it is the project's own for that tool, while pip and other installers fetch it from PyPI, unchecked unless `dependency_check` has already answered `avoid` or `wait` for that version. uv's `--no-sources`, which makes uv do the same, is held;
- sub-commands beyond each manager's install, add and update words written straight after it: the guard's reading of them is best effort. It holds sub-commands it does not know, but cannot promise to see a tool that runs a command or installs a release through a sub-command it reads as harmless; and a sub-command with no install, fetch or configuration word in it, such as `pnpm patch`, `bun patch`, `bun upgrade`, `pnpm self-update` or `uv self update`, is not examined;
- a manifest, requirements file or lockfile changed by a shell command (a redirection, `sed -i`, `tee`, a script) rather than the Edit, MultiEdit or Write tool;
- a program or script that runs an install (a make target, `npm run x`, `pwsh -File`, code given to `node -e` or `python -c`), and a package manager name the shell assembles or decodes;
- installs through pipenv, pdm, rye, pixi, hatch, conda, gem, composer and dotnet, and commands run inside a container;
- a range is judged as the release its verdict was recorded for; a lockfile or an installed copy that already holds another release in that range is kept by pnpm, Bun, uv, Cargo and pip (npm and Yarn 1 moved to the newest): that release is not checked. Name the exact version, or run `vulnerability_scan` after the install (the advice line says so);
- a name alone can install a release the project already pins where the hook does not look: a folder reached in a way it does not follow (a wrapper's directory option it does not know, a cd that did not run, a directory set in config, a function, alias or script), a workspace root it does not recognise, a sibling member, a lockfile; the manager then keeps or reuses that release. A name alone judged at the newest may also install a release published after the verdict was recorded (within the hour a `latest` verdict is honoured), which is not checked; it may also install the newest that fits this Node, Python or Rust (`engines`, `requires-python`, `rust-version`), the release `latest` names when it is not the highest, or the copy pip finds installed. After an install the advice line recognises, it says to run `vulnerability_scan`, which reads the releases actually installed;
- a change of folder the hook cannot see: a shell function or alias named `cd`, a profile or a script sourced in an earlier call, a PowerShell script or function that calls Set-Location; and settings and pins in files it does not read (`.npmrc`, `.yarnrc.yml`, `bunfig.toml`, `.pnpmfile.cjs`, `pip.conf`, `uv.toml`, `Pipfile`, `deno.json`, `requirements.in`, `constraints.txt`);
- a change in one file that makes another file's entries resolve from the registry: a root override removed that served a workspace member, or a change to a workspace member's own `name` or `version`, after which a sibling that declares that name may fetch the registry release instead of linking the member (holding every version bump would stop ordinary work), and a member folder taken off `workspaces` (measured: npm 10.9.2 then locked the registry release a sibling's range names);
- in `pyproject.toml`, the requirements a build backend takes from the tables and files already there when a `[build-system]` table is added to a file that had none, and those an older backend release keeps after an edit that only removes requirements (setuptools before 69 keeps `setup.py`'s `install_requires` when the `dependencies` key is removed; setuptools 69 and later drop them);
- overrides, resolutions, catalogs, `[patch]` and workspace pins in the project, which can make the manager install another release than the one the command names: the hook judges those entries when they are edited, not when a command meets them. After a Bash or PowerShell command in which a package manager ran an install, add, update, sync or ci, package named or not (`npm ci`, `pnpm install --frozen-lockfile`, `yarn`, `pip install -r`, `uv sync`, `poetry install`, `cargo fetch`, `cargo build` / `b`, `cargo run` / `r`, `cargo test` / `t`, `go mod download`), also when npx, bunx or pnpx runs the manager, with or without a version (`npx pnpm@9 install`), and after `npm`, `pnpm`, `yarn` or `bun link`, the hook adds one line of advice, never a denial: "The package manager decides the releases actually installed. Run vulnerability_scan to check them.";
- a command that removes a folder above the data folder (the ledger guard names the ledger file and its own folder only);
- the allow lists of options are lists, not proofs: each option on them was tested not to change the named release in the tool versions tested, and another version of a tool may differ.

**Modes.** `FOURDA_GUARD=advise` never denies (the ledger guard included) and, after an Edit or MultiEdit of a manifest, tells the agent which versions moved and which calls check them (a Write gets no advice: the file before it is gone); `FOURDA_GUARD=off` turns the hook off. `FOURDA_GUARD` is the user's setting: the denials that ask for a `dependency_check` call, and the ledger and failure denials, tell the agent not to change it. The hook and the server must share a data folder: with `FOURDA_MCP_HOME` set for the server, Claude Code's environment needs the same value. Beside a server older than 6.5.0, which records no verdict and starts no ledger, the hook denies nothing but a call that names the ledger, and advises after a manifest edit as it did before 6.5.0; a server from 6.5.0 on starts the ledger, empty, when it starts serving, and finishes writing it before it exits. This hook counts a `proceed` or `review` answer, and a private record, only from a server at 6.6.0 or later (`avoid` and `wait` count from any version), so beside a 6.5.x server every install that names a version is held until the server is updated. Removing the ledger file turns the other denials off until the server starts again.

## Standalone vs. Full Mode

The MCP server works without the desktop app. It keeps a small local database in your user data folder (`%LOCALAPPDATA%\4da-mcp`, `~/Library/Application Support/4da-mcp` or `~/.local/share/4da-mcp`, never inside your repository) and scans your project on every start:

| Capability | Standalone | With 4DA Desktop |
|------------|-----------|-------------------|
| Upgrade impact (changelog, breaking changes, your call sites) | Yes | Yes |
| Vulnerability scanning (OSV.dev) | Yes | Yes |
| Dependency health (4 registries) | Yes | Yes |
| Upgrade planner | Yes | Yes |
| Pre-install dependency check | Yes | Yes |
| Ecosystem news (Hacker News, on request) | Yes | Yes |
| Pre-task intelligence briefing | Yes | Yes |
| Tech stack detection + resolved versions | Yes | Yes |
| Decision memory + alignment checking | Yes | Yes |
| Agent memory (cross-session) | Yes | Yes |
| Developer news judged against your stack (the app's feed) | -- | Yes |
| Actionable signals + knowledge gaps | -- | Yes |
| The analysis layer (Signal Chains, Knowledge Gaps, temporal analysis) | -- | Yes |

**With the desktop app attached** the dependency tools still read every lockfile under the project root from disk, with the same `coverage`: the same project gives the same packages, counts and coverage either way, and a sub-project the app has not indexed is not lost. The app's database supplies the app-backed tools (marked * above), decisions and memory, and the app's stored plan for `upgrade_planner` with `project_path: "*"`; a scan never writes to it.

**Supported app versions.** This server is tested against 4DA v1.0.3 (schema 124, plan format 4) through the app's main branch of 2026-11-22 (schema 131, plan format 5). With an app outside that range attached the server keeps serving (an answer it cannot serve from that database says which side to update, it does not just fail), and `get_context` and every answer that reads or writes the app's data carry `_meta.app_compatibility` (`status`: `app_older_than_supported` or `app_newer_than_tested`, the app's schema and plan format, the supported range, and a `note` saying whether to update the app or this server).

> **[Download 4DA](https://github.com/4DA-Systems/4DA/releases/latest)** for the full experience.

## Transports

**stdio** (default) -- works with all MCP hosts:
```bash
npx @4da/mcp-server@6.6.0
```

**Streamable HTTP** -- for remote or multi-client setups:
```bash
npx @4da/mcp-server@6.6.0 --http --port 4840
```

The HTTP transport binds to `127.0.0.1` by default and applies a `Host`-header
DNS rebinding guard to every request. Exposing it beyond this machine requires
a shared secret:

```bash
MCP_AUTH_SECRET=<same value as the relay's JWT_SECRET> \
MCP_ALLOWED_HOSTS=mcp.internal \
  npx @4da/mcp-server@6.6.0 --http --host 0.0.0.0
```

Only `localhost`, `::1` and an IPv4 address in 127.0.0.0/8 are loopback; any
other `--host`, a name such as `127.example.com` included, is a non-loopback
bind. Without `MCP_AUTH_SECRET` a non-loopback bind is refused at startup. With
it, every request must carry a Bearer token whose HMAC-SHA256 signature
verifies against that secret, and the token's role is enforced per tool
(`viewer` is read-only; `member` and `admin` may write). Each part of the token
must be base64url with no padding, and the signature in its one canonical spelling;
anything else is refused with 401. Put TLS in front of it.

JSON-RPC batches are refused with `-32600`, as on stdio: MCP removed them in
protocol revision 2025-06-18. A request that speaks 2025-03-26 or earlier (its
`MCP-Protocol-Version` header, an `initialize` in the batch, or no version at
all, which the transport spec reads as 2025-03-26) is still served, because
that revision requires a server to accept batches.

HTTP mode serves through `@hono/node-server`, and refuses to start when the copy
it would load is older than 2.1.6 (every 1.x release and every 2.x release
below 2.1.6 has a known advisory). That happens when the folder the server was
installed into already held an older copy, which npm keeps; the message names
the version. Install `@hono/node-server@^2.1.6` in that folder, or start the
server with npx. A version it cannot read is not refused. The stdio server does
not load it.

**HTTP mode is single-tenant.** A token's `team_id` is verified but not used to
separate data: every authenticated client shares one database, one agent memory
and one set of decisions, and `project_path` lets any authenticated client scan
any directory on the host the server can read. Run one server per team (or per
trust boundary), and only behind clients you would give that access.

## CLI Reference

```
npx @4da/mcp-server@6.6.0              # Start server (stdio)
npx @4da/mcp-server@6.6.0 --http       # Start server (Streamable HTTP)
npx @4da/mcp-server@6.6.0 --setup      # Auto-configure your editors
npx @4da/mcp-server@6.6.0 --doctor     # Check the install (exit code 1 when a check fails)
npx @4da/mcp-server@6.6.0 --version    # Print version
```

`--doctor` prints one line per check (in colour only on a terminal, and never with `NO_COLOR` set): the Node.js version, the SQLite driver, the data folder (a folder the server cannot write to fails), the server's own database, the cache (on disk or in memory, and why) and the app database, each with its path and state; build freshness in a repository checkout; the semantic recall provider; the proxy when one is set; whether OSV.dev and each registry answer; and a "Server version" warning when a session has seen a newer release. When it finds the server's own database empty (0 bytes) or without tables, it completes it in place, as a tool call would, and says so as a warning: anything that file was meant to hold is not in it. It exits 1 when any check fails, among them a server's own database it cannot open or complete, and a `FOURDA_DB_PATH` that names no file or a file with no tables. An app database the app has not finished setting up, or a database of this server's own format that `FOURDA_DB_PATH` names, is a warning that says why it is not used. The app database is only read.

## Environment Variables

| Variable | Description | Default |
|----------|-------------|---------|
| `FOURDA_DB_PATH` | Path to 4DA's SQLite database. An existing file with tables is read as the desktop app's database (a relative path resolves against the working directory), with the exceptions below. A path that names no file, or a file with no tables, is refused and nothing is created there (except at the server's own `standalone.db` path): the tools that answer from the project's files still do, with `_meta.database_note`, and the others return the error. A database of this server's own format at another path, or an app database the app has not finished setting up, is not used and not changed: the server runs on its own `standalone.db` and says why. See "Where configuration and the database come from". | The desktop app's database, else the server's own |
| `FOURDA_DATA_DIR` | Folder searched before the desktop app's own data directory for its `4da.db` and `settings.json` (`FOURDA_DB_PATH` and `FOURDA_SETTINGS_PATH` take precedence) | Unset |
| `FOURDA_SETTINGS_PATH` | `settings.json` holding the optional `embedding` block for semantic recall | Beside `FOURDA_DB_PATH`, else the desktop app's data directory |
| `FOURDA_EMBED_PROVIDER` | Turns semantic recall on with an embedding provider: `ollama` (local) or `openai`. Takes precedence over the `embedding` block of `settings.json`. What the provider receives is in the note on embeddings above. | Unset: no embedding provider |
| `FOURDA_EMBED_MODEL` | The embedding model, with `FOURDA_EMBED_PROVIDER` | `nomic-embed-text` (Ollama), `text-embedding-3-small` (OpenAI) |
| `OLLAMA_URL` | The Ollama endpoint, with `FOURDA_EMBED_PROVIDER=ollama`. An endpoint on another machine receives the text the note above says OpenAI receives. | `http://localhost:11434` |
| `OPENAI_API_KEY` | The API key, with `FOURDA_EMBED_PROVIDER=openai`. Without a key the provider is not used. | Unset |
| `FOURDA_OFFLINE` | Disable all network calls (`1` / `true` / `yes` / `on`, any case; any value other than those and `0` / `false` / `no` / `off` is read as on, and said on stderr) | Off |
| `FOURDA_PRIVATE_PACKAGES` | Package names never sent anywhere, in addition to what `.npmrc`, `GOPRIVATE` and your lockfiles already mark private: globs, `*` matching anything, optionally `npm:` / `crates.io:` / `PyPI:` / `Go:` prefixed. See "Private packages are never sent". | Unset |
| `FOURDA_PUBLIC_MIRRORS` | Hosts of registries, indexes or Go proxies that only mirror the public ones (comma- or space-separated). Without it, a default registry, index or proxy that is not public makes that ecosystem's packages private. See "Mirrors". | Unset |
| `FOURDA_PROJECT_DIR` | The project the server scans and answers for, in place of the directory it was started in (for hosts that start servers from their own directory; the `.mcpb` bundle sets it from its folder picker). A value that still holds an unfilled `${...}` template is ignored. | The working directory |
| `FOURDA_CALL_BUDGET_MS` | The time one tool call may take, counted from the request. A call still running then is answered NOT CHECKED (`dependency_check`: every item `unknown`); its lookups run on and are cached, so the same call made again answers from them. A call made while the project's lockfiles are still being read waits no longer than this, answers NOT CHECKED, and the read goes on. | `20000` |
| `FOURDA_WALK_BUDGET_MS` | The time the startup walk of the project tree may take. Past it the scan is partial and says so. | `10000` |
| `HTTPS_PROXY`, `HTTP_PROXY`, `NO_PROXY` | Every lookup goes through the proxy (NO_PROXY honoured); an unreachable proxy means NOT CHECKED, never a direct connection. See "Behind a proxy". | Unset |
| `FOURDA_GUARD` | The plugin hook: `advise` never denies (the ledger guard included) and advises after an Edit or MultiEdit of a manifest; `off` turns the hook off. The user's setting: denials that ask for a check tell the agent not to change it. See "The guard hook". | Unset: the hook holds what it has not seen cleared |
| `FOURDA_GITHUB_CHANGELOG` | `upgrade_impact`: read GitHub release notes when the registry archive has no changelog for the range (`true` / `1` / `yes` / `on`) | Off |
| `GITHUB_TOKEN` | Used only with `FOURDA_GITHUB_CHANGELOG`: raises GitHub's rate limit from 60 to 5,000 requests an hour | Unset |
| `FOURDA_MCP_HOME` | Folder for the files the server writes (`cache.db`, `standalone.db`, `check-ledger.jsonl`). The guard hook reads the ledger there, so Claude Code's environment needs the same value. | Your user data folder + `4da-mcp` |
| `MCP_AUTH_SECRET` | Shared secret for verifying Bearer tokens on `--http` (HMAC-SHA256). Falls back to `JWT_SECRET`. Unset means no token is accepted. | Unset |
| `MCP_AUTH_REQUIRED` | Require auth on a **loopback** `--http` bind (`1` / `true` / `yes` / `on`; an unreadable value is read as on). Always required on a non-loopback bind. | Off |
| `MCP_ALLOWED_HOSTS` | Extra comma-separated hostnames accepted in `Host`/`Origin` (needed when binding to `0.0.0.0`). | localhost only |

## Limits

The server reads repositories it did not write, so everything it reads is bounded, and a bound that is hit is reported, never passed off as a clean result.

- **Time.** A tool call has 20 s (`FOURDA_CALL_BUDGET_MS`); the walk that finds a project's lockfiles has 10 s (`FOURDA_WALK_BUDGET_MS`), 20,000 directories, 8 levels and 256 projects. Past a walk bound the answer is a partial scan (`coverage.complete: false`), and `what_should_i_know`, `upgrade_planner` and `dependency_health` lead with NOT CHECKED naming the walk.
- **Size.** A lockfile or manifest over 64 MB is not read and is reported as UNREADABLE. A `.gitignore` over 1 MB, its rules past 5,000, and a pattern over 1,024 characters are not applied; a negation that cannot be applied re-includes everything below its file, so a limit can only make the scan cover more.
- **Arguments.** A version or constraint is at most 256 characters, a package name 512. `what_should_i_know` reads at most 100 `packages` entries and 100 `not_packages` words; a task is read for at most 100 packages, and a word longer than 300 characters is not read.
- **Place.** A drive or filesystem root and the operating system's own directories (`C:\Windows` and below, `/usr`, `/etc`, `/System` and the like) are not scanned: pass `project_path` with your project's root, or set `FOURDA_PROJECT_DIR`.

## Behind a proxy

Set `HTTPS_PROXY` (and `HTTP_PROXY`, `NO_PROXY`, in upper or lower case) in the server's environment (the `env` block of the MCP server entry) and every OSV.dev, registry and search lookup goes through that proxy, on every supported Node; nothing else to set. Hosts `NO_PROXY` names are reached directly. A proxy that cannot be reached, or refuses a request, makes the lookup fail, and the answer says NOT CHECKED: nothing is ever retried around the proxy. `dependency_check` then starts its summary with NOT CHECKED when no item could be checked, and `_meta.offline_note` says that `FOURDA_OFFLINE` is not set and the network, a proxy or OSV.dev failed. The server uses undici's `EnvHttpProxyAgent` for this (`undici`, MIT, pinned). An embedding provider you configure is the exception: it uses Node's own `fetch`, which honours the proxy on Node 24.14+, or on 22.21+ started with `NODE_USE_ENV_PROXY=1`.

The first lines of the server's stderr, and `npx @4da/mcp-server@6.6.0 --doctor`, say so whenever a proxy variable is set.

## FAQ

**Does this send my code anywhere?**
No. When a tool needs them (never at startup), the server sends public package names and versions to public APIs ([OSV.dev](https://osv.dev), npm registry, crates.io, PyPI, Go proxy), never a private package's name, downloads the target version's archive from the package's own registry for `upgrade_impact` (and reads GitHub release notes only if you set `FOURDA_GITHUB_CHANGELOG=true`), and, only when you call `ecosystem_pulse`, sends a few dependency names as search terms to [HN Algolia](https://hn.algolia.com/api). No source code, no file paths, no personal data: the call-site scan runs locally. Set `FOURDA_OFFLINE=true` to disable all network calls. (The sole exception is opt-in OpenAI embeddings — see the network note above.)

**How does this compare with GitHub's dependency tool for agents?**
GitHub's hosted MCP server has `check_dependency_vulnerabilities` (dependabot toolset). It needs a GitHub token and reports high and critical advisories and malware. In one comparison on 2026-11-11 (216 identical cases, ground truth from OSV.dev, this server at 6.2.7) it was faster (median 1.2 s against 2.5 s) and covers Maven and .NET, which this server does not read; it missed 102 of 178 known-bad versions, mostly medium and low advisories and RustSec / PyPA / Go-only records, which this server reports, and it does not judge nonexistent, yanked, deprecated or days-old releases. The cases and results of that comparison are not published in this repository, so it cannot be re-run from here: read it as one dated measurement of 6.2.7. This server needs no account and runs on your machine.

**Do I need the 4DA desktop app?**
No. These work standalone: upgrade impact, pre-install dependency checks, vulnerability scanning, dependency health, upgrade planning, ecosystem news, pre-task briefings, project context, decision memory, alignment checking, and agent memory. The desktop app is where the same engine runs day to day: one worklist across every project on the machine, a morning Brief of what changed in your stack, and an Upgrade Plan. With it installed, your agent also gets signals, knowledge gaps, developer news judged against your stack, Developer DNA and feedback.

**Which AI tools does this work with?**
Any tool that supports [MCP](https://modelcontextprotocol.io): Claude Code, Claude Desktop, Cursor, Windsurf, VS Code (Copilot), and any custom MCP client.

## Build from Source

```bash
git clone https://github.com/4DA-Systems/4da-mcp-server.git
cd 4da-mcp-server
pnpm install
pnpm build
pnpm test    # offline
```

## License

Apache License 2.0 (`Apache-2.0`). See [LICENSE](LICENSE).

---

Built by [4DA](https://4da.ai)

TDQS

A3.6/5.0

Scored across 16 tools

Disambiguation3/5

The dependency-security cluster (dependency_check, vulnerability_scan, dependency_health, upgrade_impact, upgrade_planner) is well differentiated by detailed descriptions, but the read-side content tools (get_relevant_content, get_actionable_signals, knowledge_gaps, what_should_i_know) overlap heavily in what they return. The two memory systems (decision_memory vs agent_memory) also blur, since both record decisions and prior context.

Naming Consistency3/5

All names are snake_case, but conventions are mixed: verb_noun (get_context, record_feedback, check_decision_alignment) sits alongside bare noun phrases (knowledge_gaps, developer_dna, ecosystem_pulse, agent_memory) and a full question (what_should_i_know). Readable overall, but an agent cannot infer action type from the name pattern alone.

Tool Count3/5

Sixteen tools sit at the upper edge for this scope; the surface spans four distinct domains (personalized feed, dependency security, upgrade planning, memory) so each tool is defensible, but the feed and memory clusters could be consolidated. It feels somewhat heavy rather than tightly scoped.

Completeness4/5

Coverage is broad: feed reads, user/developer profile, briefing, vulnerability scanning, upgrade planning and impact, ecosystem pulse, feedback recording, and read/write memory for decisions. Minor gaps exist—there is no way to list or audit previously recorded feedback/signals history, and no project enumeration beyond '*' in upgrade_planner.

Maintenance

ActivityActive
ResponsivenessOutdated data