agentleFS
NVIDIAKnown publisherNVIDIA/Personal-AI-Router/.cursor/rules/architecture.mdc

Personal-AI-Router / rules

Cursor rule1.5k starsChanged 2 months agoApache-2.0View on GitHub

Core PAIR boundaries for naming, communication, backend ownership, and reactive state

Trending

Quiet since September.thin dataabout the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 10 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the NVIDIA/Personal-AI-Router repository that our weekly crawl found: only 10 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

Who's talking about NVIDIA/Personal-AI-Router

The biggest 5 of 10 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 10

Talked about on GitHub, Hacker News and Bluesky (10 times).

On GitHub · 6

1 more on GitHub

On Hacker News · 2

The file

We split this architecture.mdc into the rules it gives an agent

10 rules. About 0 are common, 7 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Never run a worker from both Electron and the broker.

    line 27
  2. Distinctive:

    Never add a broker-absent fallback.

    line 28
  3. Distinctive:

    Verify meaningful payload fields, not only method names.

    line 60
  4. Very specific:

    Keep backend-coupled defaults in src/shared/constants/modular-runtime.ts.

    line 61
  5. Distinctive:

    Prefer live backend-reported values over constants.

    line 63
  6. Very specific:

    Call engine:prepare-shutdown before broker teardown.

    line 71
  7. Distinctive:

    Do not add UI or TypeScript code based on cluster secrets, auth proofs, certificates, or a TypeScript-managed CA.

    line 94
  8. Very specific:

    Every ipcMain.handle uses safeHandle().

    line 101
  9. Distinctive:

    When channels, push events, security flows, runtime processes, or ports change, update:

    line 106
  10. Distinctive:

    Document only the current architecture.

    line 115

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
architecture.mdc
---
description: Core PAIR boundaries for naming, communication, backend ownership, and reactive state
alwaysApply: true
---
<!--
SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: Apache-2.0
-->

# PAIR Architecture Rules

## Naming

- User-facing copy and all new code use **engine**, never **backend**.
- Existing wire types such as `BackendInfo` may retain their contract name.
- `EngineType` is a closed union. Narrow external strings with
  `isEngineType()`.
- PAIR has no plugin or custom-engine concept.

## Runtime ownership

The sibling `services/` tree is the backend source of truth.

- Electron starts only `nvpair-ui-broker`.
- The broker supervises all runtime workers.
- PAIR must not reimplement backend services in TypeScript.
- Never run a worker from both Electron and the broker.
- Never add a broker-absent fallback.

The binary inventory and launch ownership live in
`src/shared/constants/modular-binaries.ts`.

## Communication layers

- Renderer service data uses `window.pairApi`.
- Electron-native operations use `window.windowApi`.
- Preload transports service calls through `service-bridge:*` IPC.
- Electron main talks to the broker over stdio JSON-RPC.
- The `nvpair` terminal command launches the bundled Go `nvpair-tui`, which owns
  its own broker. PAIR has no Electron-backed console client.
- Renderer code (`src/ui/`) must not import from `src/electron/`.

The only direct service-data HTTP polling in Electron is `/v1/node-info`.
Inference HTTP endpoints are for local client-compatible traffic.

## Reactive state

- The service is authoritative.
- Commands do not return replacement state.
- Renderer stores fetch snapshots and then consume push events.
- Components do not create local loading state for engine/model operations.
- `src/ui/stores/pending-actions.store.ts` is the single optimistic exception.
- Pending actions always yield to engine state, progress, or error pushes.

## Backend integration

- Backend methods and notifications are implementation details behind
  `WsInvokeChannelMap` and `WsPushChannelMap`.
- Handle every PAIR-relevant backend notification.
- Verify meaningful payload fields, not only method names.
- Keep backend-coupled defaults in
  `src/shared/constants/modular-runtime.ts`.
- Prefer live backend-reported values over constants.

## Engines and routing

`nvpair-engine-manager` owns lifecycle and model operations.

- Engine server ports and proxy ports are persisted by their backend owners.
- Desired engine state is restored by the backend.
- Call `engine:prepare-shutdown` before broker teardown.
- Hide operations the backend cannot perform.

Routing is owned by the proxies, broker, and `nvpair-job-scheduler`. The backend
combines pending work, compact scanner/manual GPU telemetry, and the proxy
process's burst reservations, which every engine facade shares. PAIR must not
pin routes, derive policy from renderer metrics, or
implement a TypeScript scheduling policy.

For model-bearing inference, each proxy admits only nodes whose per-engine
inventory advertises the requested model. Manual selection, scheduler priority,
reservations, and retryable failover operate inside that owner set. Empty or
non-matching inventory is excluded, and no owner produces a local `502`.

## Security

`nvpair-cluster-manager` owns identity, pairing, trust, and membership. PAIR
implements **no** security or cryptography.

- PAIR relays cluster commands and renders cluster events.
- PAIR does not implement cluster cryptography, transport security, or key
  management.
- Pairing uses a six-digit convenience PIN, not a strong authenticator.
- Do not add UI or TypeScript code based on cluster secrets, auth proofs,
  certificates, or a TypeScript-managed CA.

## IPC

- `IpcChannelMap` is for Electron-native operations and the service bridge
  envelope.
- Every `ipcMain.handle` uses `safeHandle()`.
- Handlers return the typed `IpcResult<T>` envelope and never throw across IPC.

## Documentation

When channels, push events, security flows, runtime processes, or ports change,
update:

- `docs/architecture.md`;
- `docs/frontend-api.md`;
- `docs/services-backend.md`;
- `docs/services-parity.md`;
- `system-architecture.mdc`.

Document only the current architecture. Git history records prior designs.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.