port-management

port-management is a cursor rule for Cursor from bernierllc/agents-environment-config. It costs 1,916 tokens per session, scanned A, original, MIT.

A shared system for managing the network ports used by projects. A port is a numbered endpoint that local development servers use to accept connections.

In plain words
What is it for?
Use it to coordinate port assignments across projects and avoid local server conflicts.
Why use it?
It helps prevent two projects from trying to use the same port at the same time. This reduces interruptions when running multiple development servers.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it to coordinate port assignments across projects and avoid local server conflicts.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/bernierllc/agents-environment-config/port-management
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/bernierllc/agents-environment-config

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for port-management

README.md
[![agentmods](https://agentmods.dev/badge/rules/bernierllc/agents-environment-config/port-management/github.svg)](https://agentmods.dev/rules/bernierllc/agents-environment-config/port-management)
Your own site
<a href="https://agentmods.dev/rules/bernierllc/agents-environment-config/port-management"><img src="https://agentmods.dev/badge/rules/bernierllc/agents-environment-config/port-management/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for port-management

Your own site · 80×15
<a href="https://agentmods.dev/rules/bernierllc/agents-environment-config/port-management"><img src="https://agentmods.dev/badge/rules/bernierllc/agents-environment-config/port-management.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,916 This file is loaded in full into every session.
When invoked 1,916 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01916 $0.01916
Opus 5.5 $0.00766 $0.00766
Sonnet 5.5 $0.00383 $0.00383
Haiku 4.5 $0.00192 $0.00192

Measured 1mo ago against content hash 26685da8164b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

port-management scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/general/port-management.mdc · 190 lines

How it starts

The opening of the file, as written. The whole thing — 190 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Port Management Rules

Objective

Prevent port conflicts across all projects on this machine using AEC's port registry.

When this rule applies

The port registry is opt-in. Follow this rule only in a project whose AGENTINFO.md contains the <!-- aec-port-registry:start --> marker; AEC writes that marked block when the user enables the registry and removes it when they turn it off. Without the marker (a ## Port Registry heading alone does not count), the user has opted out: do not run aec ports or require registration, and choose ports as the project already does.

Port Management System

Where ports live

  • Per project: the ports section of the project's .aec.json (source of truth for that project)
  • Across projects: AEC's registry, maintained by aec ports (never edit it by hand)
  • Updates: Declare a port in .aec.json and register it before adding a service or changing a port

Port Allocation Rules

Port Registration Requirements
  • MANDATORY: Declare every service port in the project's .aec.json and register it with aec ports register
  • BEFORE: Adding new services or changing existing ports, run aec ports check
  • VERIFY: Resolve every conflict aec ports check reports before committing
  • UPDATE: After a port change, run aec ports unregister then aec ports register (register only adds)
Port Range Allocations
  • System Ports: 1-1023 (reserved for system)
  • User Ports: 1024-49151 (available for projects)
  • Dynamic Ports: 49152-65535 (OS-assigned)
  • Testing Range: 5000-5999 (test containers)
  • Development Range: 3000-3999 (dev servers)
  • Database Range: 5400-5499 (databases)
  • Cache Range: 6300-6399 (Redis, Memcached)
  • Webhook Range: 34000-34999 (test webhooks)
Declaring ports in .aec.json
{
  "ports": {
    "web": { "port": 3000, "protocol": "http", "description": "Next.js dev server" },
    "db":  { "port": 5432, "protocol": "tcp",  "description": "Postgres" }
  }
}

Name each entry for the service it serves; protocol and description are shown by aec ports list.

Read the full file on GitHub · 190 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +4 lines · +455 tokens per session 26685da8164b
  2. 1mo ago First seen · 186 lines · 1,461 tokens per session scan A 698c5e4121f0

Subscribe to this mod's changes

port-management is a cursor rule published in the GitHub repository bernierllc/agents-environment-config (11 stars, last pushed yesterday), licensed MIT. It adds 1,916 tokens to every session, about $0.0077 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.