espai AGENTS.md

A set of coding rules for Espai, a small browser extension with a native host program. The rules favor simple files, reusable browser-independent building blocks, and keeping the program's standard output available for communication with the browser.

In plain words
What is it for?
Use it when modifying Espai's Rust host or browser extension, especially when handling captured network data, trusted input, and browser messaging.
Why use it?
It prevents changes that make the small project harder to understand, break browser communication, or depend on fragile selectors for particular websites.

Instructions file for CodexOpenCode

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/pouriya/espai/agents-md
Clone the repo
git clone --depth 1 https://github.com/pouriya/espai

Made for: Codex, OpenCode.

Per session 4,559 This file is loaded in full into every session.
When invoked 4,559 The same file — it is already loaded in full.
Security scan A 1 finding. 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.04559 $0.04559
Opus 5 $0.02279 $0.02279
Sonnet 5 $0.00912 $0.00912
Haiku 4.5 $0.00456 $0.00456

Measured 2d ago against content hash 1f0fbece0a30, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

espai AGENTS.md scanned grade A with 1 finding 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 2d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

commit.** Keep it markdown — it is read straight out of `curl` output.
AGENTS.md · 296 lines

How it starts

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

Agent Guidelines

Coding conventions for this project. Follow these when writing or modifying code.

Kept plain

The native host is one main.rs with four dependencies; the extension is six files the browser loads as they are — no bundler, no npm, no build step beyond copying them next to the manifest rendered from the template in extension/. Anything you add should pay for the loss of "read one file, understand the system".

The style rules below favour locally-readable code over idiomatic density. They are choices, not oversights — do not "modernize" them into iterator chains, combinator pipelines, or extracted abstractions.

Generic primitives, never site adapters

No twitter.js, no instagram.js. Those sites regenerate their markup continuously, so a selector committed here breaks within weeks with nothing to warn us but a user reporting that likes silently stopped working. Snapshot-with-refs, trusted input and the network capture are site-agnostic and together they are enough. Anything site-shaped belongs in the agent's prompt, where it costs nothing to be wrong.

Never write to stdout

println! is a fatal bug. stdout is the native messaging channel: one stray byte desynchronises the length-prefixed frames, Chrome sees a garbage length and kills this process. The symptom is a silent disconnection, not an error.

Diagnostics go to stderr via eprintln!, prefixed espai:. We inherit Chrome's stderr, so they land wherever Chrome was started from — a terminal, or nowhere. Nothing may depend on a human seeing them.

How Chrome starts and kills this process

  • One host process per connectNative(), not per tab or per browser, and lazily: nothing runs until the service worker connects. argv[1] is the calling extension's origin, and the working directory is unspecified, so never use a relative path.
  • Chrome, Chromium, Edge and Brave each read the host manifest from their own profile root, and one in the wrong root is silently ignored — the extension loads fine and the host never starts. make install-chrome / install-chromium copy it where that browser looks.
  • Those targets fail on a profile root that does not exist rather than creating one, since a manifest under ~/.config/google-chrome on a Chromium-only machine is a directory that looks installed and is never read. Edge and Brave get no target for the same reason. install.sh writes every root that already exists and creates none.
  • Manifests point at bin/espai, which release copies out of target/. A path into target/ breaks on the next cargo clean, and a missing binary looks exactly like a missing manifest.
  • version in Cargo.toml and in manifest.chromium.json.in are bumped in the same commit — the halves speak a private frame protocol and ship as one thing. make check-version enforces it, and Chrome refuses a version that goes backwards.
  • Shutdown is EOF on stdin, so UnexpectedEof on the length read is the ordinary exit path, not an error to log loudly.

Read the full file on GitHub · 296 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. 2d ago First seen · 296 lines · 4,559 tokens per session scan A 1f0fbece0a30

Subscribe to this mod's changes

espai AGENTS.md is an instructions file published in the GitHub repository pouriya/espai (11 stars, last pushed 23d ago), licensed MIT. It adds 4,559 tokens to every session, about $0.0228 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.