Proxyfan networking.instructions.md

Project instructions for a high-throughput networking and proxy system. They define rules for fast byte-stream processing, cancellation, memory use, and asynchronous code.

In plain words
What is it for?
They are for implementing or reviewing networking and proxy-pipeline code, including buffering, parsing, request cancellation, and asynchronous operations.
Why use it?
They reduce the risk of traffic corruption, memory leaks, stalled connections, and unnecessary delay in proxy changes.

Instructions file for GitHub Copilot

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.

agentmods
npx agentmods add instructions/proxyfan/proxyfan/networking
Clone the repo
git clone --depth 1 https://github.com/Proxyfan/Proxyfan

Made for: GitHub Copilot.

Per session 1,645 This file is loaded in full into every session.
When invoked 1,645 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.01645 $0.01645
Opus 5 $0.00822 $0.00822
Sonnet 5 $0.00329 $0.00329
Haiku 4.5 $0.00164 $0.00164

Measured yesterday against content hash 5d439e5843a9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

Proxyfan networking.instructions.md 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 yesterday.

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.

.github/instructions/networking.instructions.md · 159 lines

How it starts

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

Networking and proxy-pipeline rules

The proxy engine is the highest-throughput, lowest-latency surface in the codebase. Bugs here corrupt user traffic, leak memory at line rate, or stall every captured connection. Every change in Framework.Networking or Domain.Proxy is reviewed against this file.

Performance budget

The end-to-end overhead added by the proxy must remain under 1 ms per request (excluding rule evaluation and throttling). To stay inside that budget:

  • Build on System.IO.Pipelines for byte-stream I/O. Do not allocate a per-frame byte[]; use ArrayPool<byte>.Shared or the pipe's own buffer.
  • Use Span<T> / ReadOnlySpan<T> for parsing. Avoid materialising a string from a header line until the rule pipeline actually inspects it.
  • Use ValueTask for hot async paths that frequently complete synchronously (header parsing, frame reads, throttle waits).
  • Pool large buffers (MemoryPool<byte>) for body relay; never allocate the full response body up front.

CancellationToken propagation

  • Every async method in Framework.Networking accepts a CancellationToken as the last parameter (ATXTA008). The token from the proxy listener flows all the way down to socket reads, TLS handshakes, and HPACK parsing.
  • Never create a fresh CancellationToken inside a handler — link to the caller's token with CancellationTokenSource.CreateLinkedTokenSource if a local timeout is needed.
  • Tokens never carry default values (ATXCS005).

Sync-over-async is banned

.Result, .Wait(), .GetAwaiter().GetResult() on a Task are forbidden in the proxy pipeline. They will deadlock under the synchronisation context of the connection dispatcher and stall every captured connection on that listener.

async void is banned

The only legitimate async void is an Avalonia event handler in Presentation code-behind. Networking code is never UI code; use async Task and propagate exceptions through the result type.

Connection dispatch

Read the full file on GitHub · 159 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. yesterday First seen · 159 lines · 1,645 tokens per session scan A 5d439e5843a9

Subscribe to this mod's changes

Proxyfan networking.instructions.md is an instructions file published in the GitHub repository Proxyfan/Proxyfan (2 stars, last pushed 2mo ago), licensed MIT. It adds 1,645 tokens to every session, about $0.0082 per session on Opus 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.