A policy-aware NVIDIA NIM engineering preflight layer for AI coding agents.
Project description
PolicyNIM
PolicyNIM is a policy-aware engineering preflight layer for AI coding agents.
It helps an agent retrieve grounded policy evidence, generate implementation guidance with citations attached, and fail closed when the available grounding is too weak to trust.
PolicyNIM currently ships with two main user-facing surfaces:
- a JSON-first CLI for local developer workflows
- an MCP server for integrations such as Codex and Claude Code
What Works Today
- Deterministic Markdown ingest with heading-aware chunking and source line spans.
- Ingest-time compilation of
runtime_rulesfrontmatter into the persisted runtime rules artifact. - NVIDIA-hosted embeddings and reranking for retrieval.
- Local LanceDB storage for the retrievable policy index.
- Task-aware policy routing with citation-preserving selected-policy packets.
- Policy compilation into citation-backed planning and generation constraints.
- Grounded preflight synthesis with compiled plan steps, citation validation, and fail-closed fallback.
- Opt-in preflight evidence traces that link chunks, selected policies, compiled constraints, generated guidance, 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.
- 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
initsetup plus JSON-first CLI commands foringest,dump-index,search,route,compile,preflight,eval,mcp,runtime, andevidence. - MCP tools for
policy_preflightandpolicy_search. - Hosted HTTP
streamable-httpwith/healthz, a self-serve/betaportal, and bearer auth on/mcp.
What To Run First
If you want the shortest path to a real preflight run, start with the hosted beta 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 policynim
uv tool install policynim
policynim --help
policynim init
policynim ingest
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.
Self-Serve Hosted Beta
- Open
https://<railway-domain>/beta. - Sign in with GitHub.
- Generate or rotate your hosted API key.
- 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
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 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. The launcher path is installable in-project with
uv sync --extra nvidia-eval --extra nvidia-eval-launcher --group test --group dev;
the internal Guardrails output-rail wrapper uses uv sync --extra nvidia-guardrails.
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:
- docs/index.md: documentation hub by audience and task
- docs/contributor-guide.md: local setup, env vars, model references, and quality gates
- docs/workflows.md: CLI surfaces, ingest/search/route/compile/preflight, eval, MCP, runtime/evidence, and troubleshooting
- docs/hosted-beta-operations.md: hosted beta quickstart, recovery, container build flow, and Railway deploy notes
- docs/release.md: CLI packaging, GitHub release, PyPI publish, and smoke-test checklist
- docs/architecture.md: package boundaries, runtime flow, and interface rules
- docs/architecture-diagram.md: Mermaid diagram of the current package layout and runtime flow
- docs/demo-script.md: step-by-step demo for the hero use case
- docs/limitations.md: current product limits and non-goals
- docs/public-source-grounding.md: provenance notes for the shipped sample corpus
- tests/README.md: current automated coverage
- examples/codex/README.md: Codex MCP setup example
- examples/claude-code/README.md: Claude Code MCP setup example
Talks And Workflow Notes
- docs/ai-engineer-miami-context-plane.md: centralized context-plane talk notes and project framing
- docs/extreme-programming-with-agents.md: XP, TDD, and agent 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file policynim-0.1.0.tar.gz.
File metadata
- Download URL: policynim-0.1.0.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87ccd05ff53cd120b62fc0524c81e7ee408561242bf060253b2759beaafc6ae5
|
|
| MD5 |
4a792edfc0c251dbdd6f96fc8716decc
|
|
| BLAKE2b-256 |
9713837be616a6fde29deccc4833782ad257734ecfea78b7b9311fb0fa173e2c
|
Provenance
The following attestation bundles were made for policynim-0.1.0.tar.gz:
Publisher:
release.yml on nnennandukwe/policyNIM
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
policynim-0.1.0.tar.gz -
Subject digest:
87ccd05ff53cd120b62fc0524c81e7ee408561242bf060253b2759beaafc6ae5 - Sigstore transparency entry: 1676319013
- Sigstore integration time:
-
Permalink:
nnennandukwe/policyNIM@44f94474856867fad5b0cd899728002b15a32c7a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nnennandukwe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@44f94474856867fad5b0cd899728002b15a32c7a -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file policynim-0.1.0-py3-none-any.whl.
File metadata
- Download URL: policynim-0.1.0-py3-none-any.whl
- Upload date:
- Size: 458.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c28f4a4ce92b7d22d9efb99ff86d709eeea90db011b6647b176e97252ed02f0
|
|
| MD5 |
7be85c310c0df52374678ae9f8d69e43
|
|
| BLAKE2b-256 |
dbbf2f69cba3e15a94a1fc3601d754b2607e2ac3385c4ca1a4205ffdc6142b3d
|
Provenance
The following attestation bundles were made for policynim-0.1.0-py3-none-any.whl:
Publisher:
release.yml on nnennandukwe/policyNIM
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
policynim-0.1.0-py3-none-any.whl -
Subject digest:
9c28f4a4ce92b7d22d9efb99ff86d709eeea90db011b6647b176e97252ed02f0 - Sigstore transparency entry: 1676319042
- Sigstore integration time:
-
Permalink:
nnennandukwe/policyNIM@44f94474856867fad5b0cd899728002b15a32c7a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nnennandukwe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@44f94474856867fad5b0cd899728002b15a32c7a -
Trigger Event:
workflow_dispatch
-
Statement type: