Skip to main content

PolicyNIM

PolicyNIM logo

Built with NVIDIA NIM

PolicyNIM brings a team's reviewed engineering policies into coding-agent workflows. Choose policy packs, add project rules, review replacements, and publish a version that keeps sources, citations, vectors, and runtime rules together.

Agents receive complete selected policy bodies with their conditions and exceptions. PolicyNIM refuses output when source ownership or exact references can't be validated. Its local runtime wrapper can allow, require confirmation for, or block supported actions according to explicitly declared rules, then retain execution evidence.

PolicyNIM ships with three user-facing surfaces:

  • a JSON-first CLI for local developer workflows
  • an MCP server for integrations such as Codex and Claude Code
  • a private local setup UI for policy selection, vector storage, and a verified first result

What The Policy Logic Controls

  • Which rules are effective: pinned packs and reviewed additions, exclusions, replacements, and declared conflicts define the selected policy set.
  • Which source supports a result: whole selected policies retain their original conditions, exceptions, owner metadata, and source coordinates.
  • Which version was used: a complete generation binds policy text, its index, and runtime rules; readers retain that version during updates and rollback.
  • What a declared runtime rule does: command, path, and HTTP-host matchers produce allow, confirm, or block decisions for actions submitted through the wrapper.
  • What actually happened: execution evidence records the decision, confirmation, outcome, and generation. Review applicability and source trust before acting.

See the policy lifecycle and worked migration example.

Choose Your Policies And Storage

PolicyNIM 0.3.0 adds browser setup and configurable vector storage. Install or upgrade the Python package with uv tool install --python 3.11 --upgrade 'policynim>=0.3.0'. For PostgreSQL, install its optional driver before opening setup: uv tool install --python 3.11 --upgrade 'policynim[vector-postgres]>=0.3.0'.

policynim setup

The loopback-only UI previews policy packs, checks database connectivity, builds a complete generation after consent, verifies a policy-backed task, and saves a new private config file. Existing config files are preserved.

SQLite is the default. Bring your own Qdrant server or PostgreSQL database with pgvector. PostgreSQL needs the optional vector-postgres extra. External databases hold a derived vector replica; the sealed local generation remains the source authority and retains vectors for validation and recovery. Open-source database software, infrastructure costs, and NVIDIA service usage have separate boundaries.

Setup and privacy · Vector backend configuration

What Works Today

  • Deterministic Markdown ingest with heading-aware chunking and source line spans.
  • Ingest-time compilation of runtime_rules frontmatter into the persisted runtime rules artifact.
  • NVIDIA-hosted embeddings and reranking for retrieval.
  • Local sqlite-vec storage for the retrievable policy index.
  • Opt-in Qdrant and pgvector retrieval with generation-bound replicas and explicit synchronization.
  • Task-aware policy routing with citation-preserving selected-policy packets.
  • Source-extractive policy compilation and preflight: models select compact IDs, then services quote whole pinned policy bodies with canonical citations. Output semantics and limits describe the empty advisory fields, source budgets and required applicability review.
  • Opt-in preflight evidence traces that link chunks, selected policies, compiled source quotations, and conformance checks.
  • Opt-in policy-backed regeneration for preflight and eval preflight cases, reusing the same compiled packet and typed conformance failures as retry triggers. Repeated attempts retain the same quoted source set; they can't rewrite policy text or establish a policy repair.
  • Eval backend selection with optional policy-conformance scoring for compiled plans and preflight outputs, with compact traces embedded in eval result artifacts and local Phoenix reporting for non-headless runs.
  • Runtime-rule decisions plus SQLite-backed evidence for allowed, confirmed, blocked, and failed runtime actions.
  • Interactive init, quickstart, and doctor setup plus JSON-first CLI commands for ingest, dump-index, search, route, compile, preflight, eval, mcp, mcp-config, mcp-smoke, support-bundle, beta-admin, runtime, and evidence.
  • MCP tools for policy_search, policy_compile, policy_preflight and policy_preflight_evidence, with versioned policy resources and a review prompt.
  • Hosted HTTP streamable-http with /healthz, a self-serve /beta portal, and bearer auth on /mcp.

The MCP server supports protocol 2026-07-28 and legacy clients through the official Python SDK 2.2.0, with typed tool outputs and stateless HTTP. Set POLICYNIM_MCP_MAX_CONCURRENT_OPERATIONS to bound expensive tool calls per server (default 10). Excess calls receive a retry-later error. See the MCP workflow for transport and public-origin configuration. For evaluations that need to survive client disconnects, see durable evaluation jobs.

See grounded MCP guidance for tool schemas, evidence and immutable resource links.

The maintained source baseline includes application-security and MCP trust guidance with pinned references, role boundaries, and authored scenarios. See the coverage matrix and source licenses. Policy text has source-specific notices; software licensing remains separate. Source contents don't establish the hosted service's indexed generation.

Inspect Policies Without An API Key

Policy inventory commands work without a provider API key. From a source checkout:

uv run policynim policies list --source
uv run policynim policies show SEC-AUTH-001 --source
uv run policynim policies validate --source --format json
uv run policynim inventory --format json

These examples inspect mutable sources with --source. Without that flag, catalog commands inspect the active generation when one exists.

The catalog commands list policy IDs, source text, pack versions, and content revisions. Inventory inspects the selected Markdown sources and local SQLite index without setup, model credentials, network calls, or data changes. Source documents, source chunks, indexed policy IDs, and indexed chunks are reported separately. Unavailable counts stay null in JSON and unknown in text. The report describes this process's files; it doesn't inspect a remote deployment or prove that source content matches an existing index.

Run uv run policynim doctor for setup checks and recovery instructions. A wheel built from this revision uses the direct policynim entrypoint. See the local profile composition guide, policy inventory and recovery guide and policy pack format.

What To Run First

If you want the shortest path to a real preflight run, start with policynim quickstart --target hosted-mcp instead of cloning the repo.

Install The CLI Without Cloning

Use the Python package path when you already have Python 3.11 or 3.12 and want pipx or uv to manage an isolated CLI environment:

pipx install --python 3.11 policynim
uv tool install --python 3.11 policynim
policynim --help
policynim init
policynim ingest

If your default Python is already supported, the shorter pipx install policynim and uv tool install policynim forms are also valid.

Use --python 3.12 instead when Python 3.12 is your managed runtime. If your machine does not expose 3.11 or 3.12 by name, pass the full path to that Python executable.

Use the GitHub release installers when you want a standalone policynim binary without managing Python dependencies yourself:

curl -fsSL https://github.com/nnennandukwe/policyNIM/releases/latest/download/install.sh | sh
irm https://github.com/nnennandukwe/policyNIM/releases/latest/download/install.ps1 | iex

Both installer paths verify release checksums before installing. After install, run policynim init, then policynim ingest, then policynim --help whenever you need to confirm the entrypoint is available.

If you want the CLI to print a no-network first-run plan for your setup, run:

policynim quickstart --target hosted-mcp
policynim quickstart --target local-cli
policynim quickstart --target local-mcp

Self-Serve Hosted Beta

PolicyNIM hosted beta landing page in dark mode

  1. Open https://<railway-domain>/beta.
  2. Sign in with GitHub.
  3. Generate or rotate your hosted API key.
  4. Export the token and add the hosted MCP server to your client.
export POLICYNIM_TOKEN=<generated-beta-token>
codex mcp add policynim --url https://<railway-domain>/mcp --bearer-token-env-var POLICYNIM_TOKEN
claude mcp add --transport http policynim https://<railway-domain>/mcp --header "Authorization: Bearer $POLICYNIM_TOKEN"

Then ask your client to call the MCP tools directly:

  • Use policy_preflight for: Implement a refresh-token cleanup background job.
  • Use policy_search for: refresh token cleanup background job

Use docs/hosted-beta-operations.md for:

  • hosted beta recovery topics
  • container build and local hosted-image checks
  • Railway deploy setup and smoke-test notes

Existing installations changing embedding models must follow the source-preserving provider recovery runbook. policynim ingest builds a complete immutable generation and atomically activates it. Existing standalone installations require explicit migration. See policy generations for inspection, rollback, retention, and offline deployment bundles.

Local Contributor Setup

Use this path only if you want to run PolicyNIM from a local checkout.

uv sync --group test --group dev
export NVIDIA_API_KEY=<your-nvidia-api-key>
uv run policynim ingest
uv run pytest -q

If you want the CLI to prompt for the required values and write the local config file for you, run:

uv run policynim init

In a source checkout, init writes the checkout .env file that PolicyNIM loads by default. Installed copies should keep using the direct policynim init entrypoint described below.

If you want a quick local readiness check after setup, run:

uv run policynim doctor
uv run policynim mcp-smoke --format json

If you prefer to manage .env manually, copy the template first:

cp .env.development.example .env

After the index is built, the fastest local sanity checks are:

uv run policynim search --query "refresh token cleanup background job" --top-k 5
uv run policynim route --task "Implement a refresh-token cleanup background job" --top-k 5
uv run policynim compile --task "Implement a refresh-token cleanup background job" --top-k 5
uv run policynim preflight --task "Implement a refresh-token cleanup background job" --top-k 5
uv run policynim preflight --task "Implement a refresh-token cleanup background job" --top-k 5 --trace
uv run policynim preflight --task "Implement a refresh-token cleanup background job" --top-k 5 --regenerate --backend nemo

Use docs/contributor-guide.md for environment templates, runtime settings, optional NVIDIA eval and Guardrails extras, and contributor quality gates. Optional evaluation adapters use uv sync --locked --extra nvidia-eval --group test --group dev; the internal Guardrails output-rail wrapper uses uv sync --locked --extra nvidia-guardrails. The separate upstream launcher setup is described in installation profiles.

If you are using an installed copy instead of a source checkout, run policynim init once first so PolicyNIM can write the standalone config file and data-path defaults before policynim ingest. Use uv run only when running commands from the source checkout's uv-managed project environment.

Use docs/workflows.md for the CLI, MCP, runtime, eval, and troubleshooting handbook.

Docs Map

Start here when you want the longer version of a specific path:

Talks And Workflow Notes

Limits And Scope

Current limitations are intentional:

  • the system is local-first and aimed at a single developer workflow
  • CI is offline-only and does not run live NVIDIA end-to-end checks by default
  • the sample corpus is narrow and synthetic, not a broad enterprise handbook
  • grounded answers may fail closed even when raw retrieval finds useful chunks

See docs/limitations.md for the full list and future expansion areas.

Install the optional Phoenix UI command in a separate tool environment; see installation profiles. policynim eval --headless needs no Phoenix server.

Metadata

Release files for policynim 0.3.0

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

Source distribution (sdist)

Source distribution for policynim 0.3.0
File Size Uploaded Provenance Actions
policynim-0.3.0.tar.gz 864.0 kB With provenance Details for policynim-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for policynim 0.3.0
File Interpreter ABI Platform Actions
policynim-0.3.0-py3-none-any.whl Python 3 none any Details for policynim-0.3.0-py3-none-any.whl

Total release size: 1.7 MB

Release files / policynim-0.3.0.tar.gz

Download URL policynim-0.3.0.tar.gz
Size 864.0 kB
Tags Source
SHA-256 checksum
How to use checksums
25e0db5904528ea43537e8b9cb81b9a92fcee55d1e1c4316f003538f97eb42a0
BLAKE2b-256 checksum
How to use checksums
0e3a53a902fb912a007172e95be960b467a2c66ef1dfe909c2f2c35a6ff5c805
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

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

PyPI Publish Attestation

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

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

Transparency log

Release files / policynim-0.3.0-py3-none-any.whl

Download URL policynim-0.3.0-py3-none-any.whl
Size 827.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ce8b5074dadbfeef06fd3e89ff0dd35c73fb6072e209a4fb07a28eae6a9b0a8
BLAKE2b-256 checksum
How to use checksums
e91a6c92934db19058b9aa5409fbd8329a67b2c995e1480f5a429bdbbc256560
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

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

PyPI Publish Attestation

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

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

Transparency log

Security for policynim 0.3.0

Provenance

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

Full provenance

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

Select from 2 files

Attestation for policynim-0.3.0.tar.gz

PyPI Publish Attestation

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

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

Transparency log

A note on package security

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

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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