brocogni: Instructions file for Codex

AGENTS.md

brocogni AGENTS.md is an instructions file for Codex, OpenCode from hrshx3o5o6/brocogni. It costs 1,200 tokens per session, scanned A, original, MIT.

Project instructions for Brocogni, a browser-analysis service that examines page structure and creates selectors for page elements.

In plain words
What is it for?
Use it when changing or testing its browser observer, element-purpose detection, selector generation, selector ranking, or state-difference handling.
Why use it?
It explains the processing pipeline and commands needed to build and test the service without relying on browser automation APIs.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions Claude Code; mentions OpenCode.

This is hrshx3o5o6/brocogni's own configuration. It tells Codex and OpenCode how to work on brocogni itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything brocogni configures →

Reuse

Borrowing it

Nothing to install: this file belongs to hrshx3o5o6/brocogni. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/hrshx3o5o6/brocogni/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/hrshx3o5o6/brocogni

Made for: Codex, OpenCode.

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 brocogni AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/hrshx3o5o6/brocogni/agents-md/github.svg)](https://agentmods.dev/instructions/hrshx3o5o6/brocogni/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/hrshx3o5o6/brocogni/agents-md"><img src="https://agentmods.dev/badge/instructions/hrshx3o5o6/brocogni/agents-md/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 brocogni AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/hrshx3o5o6/brocogni/agents-md"><img src="https://agentmods.dev/badge/instructions/hrshx3o5o6/brocogni/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,200 This file is loaded in full into every session.
When invoked 1,200 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.01200 $0.01200
Opus 5 $0.00600 $0.00600
Sonnet 5 $0.00240 $0.00240
Haiku 4.5 $0.00120 $0.00120

Measured 10d ago against content hash f2036370f29b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

brocogni 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 10d 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.

AGENTS.md · 66 lines

How it starts

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

Brocogni

Commands

npm run check       # tsc --noEmit (type-check only, no output)
npm run build       # tsc -p tsconfig.json (emit to dist/)
npm test            # build + node --test 'dist/test/**/*.test.js'
npm start           # node dist/src/runtime/mcp.js

Tests are deterministic, no browser needed. 6 tests across 3 files.

Architecture

src/
  index.ts              Entry — wires observer → semantic → selector pipeline
  observer/cdpObserver  CDP session: AX tree + DOM snapshot via CDP (not Playwright API)
  semantic/infer        Filters AX tree to actionable roles, infers purpose, generates selectors
  semantic/fuse         Extracts DOM geometry and fuses bounding boxes onto AX nodes
  selector/generate     Generates ARIA, CSS, XPath, relational sibling selectors
  selector/rank         Scores selectors (semantic, stability, uniqueness, resilience)
  runtime/service       BrowserCognitionService — orchestrates all pipeline steps
  runtime/mcp           JSON-RPC MCP server (the npm binary entrypoint)
  runtime/contracts     Request/response type interfaces
  runtime/delta         State diffing: keyed by backendDOMNodeId, falls back to node id
  runtime/prompts/instructions  AGENT_INSTRUCTIONS prompt for "write-robust-playwright-script"
  context/compiler      Trims nodes by mode (action/extract/debug) and budget
  types/schema          SemanticNode, SelectorCandidate, SemanticPageState, etc.
  setup/index.ts        Interactive setup — detects 7 clients, writes config files

Key facts an agent will miss without this

  • Entrypoint: src/runtime/mcp.ts is the npm binary (bin in package.json). It's also the start script. The configured entry in opencode.json for this repo points to it.
  • TTY gate: When stdin is a TTY (bare npx browser-cognition-mcp), it runs interactive setup, not the MCP server. Server mode only with piped stdin. Use --help/--version/--setup flags for CLI discoverability.
  • CDP auto-connect: getOrCreatePage() probes ports 9222–9224 for existing Chrome via connectOverCDP before falling back to chromium.launch(). Sets isCdpMode = true, which makes cleanup() skip closing the browser (won't kill user's Chrome).
  • Browser lifecycle: No shared contextInstance variable. Each new page creates or reuses the first available context from browserInstance.contexts()[0]. CDP mode uses the existing browser's contexts directly.
  • MCP protocol quirks: notifications/initialized silently ignored (no response). Error responses guard against null/undefined id. Protocol version echoes client request with fallback to "2024-11-05".
  • 13 MCP tools: navigate, observe, delta, verify, act, get_selector_plan, find_targets, screenshot, evaluate, save_cookies, list_pages, use_page, evaluate (also browser_info and browser_run_script exist in handler but not in TOOLS array — hidden/internal).
  • Semantic nodes only: Only 7 actionable ARIA roles survive filtering (button, link, textbox, combobox, checkbox, radio, menuitem, tab). Other roles dropped.
  • Selector fallback chain: For each node, generates ordered candidates: ARIA role+name → text-based XPath → relational CSS/XPath (preceding/following named sibling). Sorted by score descending.
  • Delta keying: Nodes are matched by attributes.backendDOMNodeId. If absent, falls back to id_${node.id} string key.
  • Packaging: package.json "files" is scoped to dist/src/ only. No test files, no examples shipped.
  • Setup detects 7 clients: Antigravity, Cursor, Windsurf, Claude Desktop, Claude Code, OpenCode, Hermes. Each auto-configures on selection (writes JSON/YAML to the right location). Detection uses env vars (CURSOR_TRACE_ID, TERM_PROGRAM, CLAUDE_CODE, etc.) and fs.existsSync for config paths.
  • @clack/prompts: Dynamic import only in setup path (not at MCP server runtime).

Read the full file on GitHub · 66 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. 10d ago First seen · 66 lines · 1,200 tokens per session scan A f2036370f29b

Subscribe to this mod's changes

brocogni AGENTS.md is an instructions file published in the GitHub repository hrshx3o5o6/brocogni (8 stars, last pushed 1mo ago), licensed MIT. It adds 1,200 tokens to every session, about $0.0060 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.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

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.

openai/codex · 5,153 tokens

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).

microsoft/vscode · 6,785 tokens

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.

github/spec-kit · 7,104 tokens

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).

microsoft/vscode · 5,001 tokens

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.

langchain-ai/langchain · 4,469 tokens