Skip to content

feat(core): add neverConfigureAiAgents opt-out for AI agent disclaimer#35558

Open
comp615 wants to merge 1 commit intonrwl:masterfrom
comp615:feat/disable-ai-agent-config
Open

feat(core): add neverConfigureAiAgents opt-out for AI agent disclaimer#35558
comp615 wants to merge 1 commit intonrwl:masterfrom
comp615:feat/disable-ai-agent-config

Conversation

@comp615
Copy link
Copy Markdown
Contributor

@comp615 comp615 commented May 4, 2026

Current Behavior

Nx automatically runs an AI-agent configuration drift check after every task run. When the daemon detects that any configured agent (Claude, Codex, Copilot, Cursor, Gemini, opencode) is "outdated" — meaning it has both MCP + rules configured locally and the configure-ai-agents generator would change something — it prints a dim disclaimer:

Your AI agent configuration is outdated. Run "nx configure-ai-agents" to update.

There is currently no way to opt out. This produces noise in workspaces where:

  • AI agent configuration is not standardized at the repo level (e.g., MCP detection for Copilot/Cursor depends on each developer's local Nx Console install, not on repo state).
  • Some teams intentionally do not want Nx to manage their agent configuration files.

The daemon also unconditionally computes status in the background.

Expected Behavior

Workspaces can opt out of the automatic detection via nx.json and/or an env var. The naming mirrors the existing neverConnectToCloud / NX_NO_CLOUD opt-out for Nx Cloud:

// nx.json
{
  "neverConfigureAiAgents": true
}

Or per-invocation:

NX_NEVER_CONFIGURE_AI_AGENTS=true nx run-many -t build

When opted out:

  1. printConfigureAiAgentsDisclaimer() no-ops, so the post-task disclaimer is never printed.
  2. The daemon's handleGetConfigureAiAgentsStatus short-circuits and returns the empty status without computing or caching anything.
  3. The explicit nx configure-ai-agents command is unaffected — running it manually still works as before.

The env var takes precedence over nx.json (matching the precedent set by NX_NO_CLOUD/neverConnectToCloud), so users can temporarily re-enable detection in a workspace that opts out, or vice versa.

Implementation summary

  • New helper isConfigureAiAgentsEnabled at packages/nx/src/ai/is-configure-ai-agents-enabled.ts (with unit tests covering all combinations of env var + nx.json).
  • neverConfigureAiAgents?: boolean added to NxJsonConfiguration, the JSON schema, and the allowedWorkspaceExtensions compat list.
  • Wired into printConfigureAiAgentsDisclaimer in run-command.ts and handleGetConfigureAiAgentsStatus in the daemon handler.
  • Documented in astro-docs/src/content/docs/reference/nx-json.mdoc.

Related Issue(s)

Discussed in #nrwl-block-shared on Slack with @MaxKless — direct request that opt-out be supported via both env var and nx.json. No GitHub issue exists yet.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 4, 2026

👷 Deploy request for nx-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 4307904

@netlify
Copy link
Copy Markdown

netlify Bot commented May 4, 2026

👷 Deploy request for nx-dev pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 4307904

Workspaces can disable Nx's automatic AI agent configuration drift detection
by setting `neverConfigureAiAgents: true` in nx.json or
`NX_NEVER_CONFIGURE_AI_AGENTS=true` (env var takes precedence). When opted
out, Nx skips the post-task 'Run nx configure-ai-agents to update' disclaimer
and the daemon stops computing agent configuration status in the background.

The explicit `nx configure-ai-agents` command is unaffected — only the
implicit detection/nag is suppressed. Naming mirrors `neverConnectToCloud`
for consistency.

This is useful in monorepos where AI agent configuration depends on each
developer's local editor setup (e.g., MCP detection via Nx Console), so
the disclaimer can produce noise that the workspace cannot resolve centrally.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019ddf73-acd7-7107-beed-5c67b1dcb1ec
@comp615 comp615 force-pushed the feat/disable-ai-agent-config branch from f4283a0 to 4307904 Compare May 4, 2026 14:03
@comp615 comp615 marked this pull request as ready for review May 4, 2026 14:04
@comp615 comp615 requested a review from a team as a code owner May 4, 2026 14:04
@comp615 comp615 requested a review from FrozenPandaz May 4, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant