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.
npx agentmods add instructions/link0-o/perflens/agents-mdgit clone --depth 1 https://github.com/link0-o/PerfLensWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.01002 | $0.01002 |
| Opus 5 | $0.00501 | $0.00501 |
| Sonnet 5 | $0.00200 | $0.00200 |
| Haiku 4.5 | $0.00100 | $0.00100 |
Grade A, and why
PerfLens AGENTS.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.
How it starts
The opening of the file, as written. The whole thing — 79 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Repository Goals
PerfLens is a general Linux performance-analysis toolkit. It must not depend on any specific application, database, RPC framework, or previous user project.
Architecture Boundaries
- Keep deterministic analysis separate from LLM reasoning.
- Do not build a custom agent framework.
- Do not add an LLM API dependency in the MVP.
- Do not add a Web UI in the MVP.
- Do not directly parse perf.data binary formats.
- Use adapters for all external tools.
- Keep Pydantic and CLI dependencies outside hot-path domain code.
- Treat automatic collection as a plan -> policy -> broker -> artifact workflow.
- Keep the MCP server and Skill unprivileged; privilege belongs only to the optional Collector.
- Keep the CLI, MCP, Skill, deterministic analysis, policy planning, and public Collector Broker
in Python. Implement the optional
paranoid=3execution Helper as a small Rust binary; do not rewrite unrelated Python components in Rust. - Keep the public Python Broker and the privileged Rust Helper as separate processes, Unix sockets, service users, policies, and systemd units. The Helper socket must never be exposed to ordinary client users.
- Support two explicit Collector privilege modes: the default
cap_perfmonmode and the opt-inparanoid3_helpermode. Installing packages must not select or activate the latter automatically.
Safety
- Never use
shell=True. - Validate and canonicalize every user-provided path.
- Keep read-only tools separate from process-execution tools.
- Never attach to a running process without explicit authorization.
- Never require root by default.
- Never let the Agent, Skill, or MCP server invoke sudo, modify sysctl/capabilities, or start a privileged Collector.
- Never run the Python Broker as root and never grant it
CAP_SYS_ADMIN. - Never run the Rust Helper with an unrestricted root capability set. Debian
paranoid=3compatibility may grant only the capabilities explicitly required by the reviewed systemd unit, and only after an administrator selectsparanoid3_helperand acknowledges the risk. - The privileged Collector must accept typed PID plans only: no shell, arbitrary command, arbitrary environment, arbitrary output path, or system-wide target.
- The Rust Helper must independently revalidate peer UID, protocol version, request expiry, single-use identity, PID owner/start time, mode, event allowlist, duration, frequency, output limit, concurrency, and fixed spool policy. Trusting validation performed only by Python is a security defect.
- The Rust Helper may execute only the configured, root-owned absolute
perfpath. It must derive every argument and artifact name from validated typed fields, useexecve/equivalent without a shell, accept no workload command, and never launch user code with Helper privileges. - Keep unsafe Rust isolated, documented, and minimal. New
unsafeblocks require a safety comment, focused tests, and review of the affected syscall and lifetime invariants. - PerfLens may detect and explain
perf_event_paranoid, but it must never modify sysctl. The installer may offer deployment choices, not silently weaken host policy. - Authenticate local Collector peers, bind plans to PID owner/start time, make plans short-lived and single-use, enforce an independent immutable policy, and write only to a fixed spool.
- Never launch a user-provided workload with Collector privileges.
- Preserve bounded raw diagnostics when parsing fails.
- Never overwrite a source profile.
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.
- yesterday First seen · 79 lines · 1,002 tokens per session scan A d97385980cb5
PerfLens AGENTS.md is an instructions file published in the GitHub repository link0-o/PerfLens (0 stars, last pushed 6d ago), licensed Apache-2.0. It adds 1,002 tokens to every session, about $0.0050 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-09-01.
Other instructions, from other repositories
spec-kit AGENTS.md
AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
next.js AGENTS.md
Instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.