httpstat AGENTS.md

A project plan for httpstat, a Python command-line tool that measures details of an HTTP request. It describes completed maintenance work, testing gaps, and planned structured output.

In plain words
What is it for?
Planning or implementing JSON and JSONL output, service-level thresholds, stable tests, schema improvements, and agent-friendly error handling.
Why use it?
It shows where the tool is reliable today and identifies problems such as tests that depend on public websites and missing machine-readable results.

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

Made for: Codex, OpenCode.

Per session 1,193 This file is loaded in full into every session.
When invoked 1,193 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.01193 $0.01193
Opus 5 $0.00596 $0.00596
Sonnet 5 $0.00239 $0.00239
Haiku 4.5 $0.00119 $0.00119

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

Security

Grade A, and why

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

- `skills/httpstat/SKILL.md`:已完成初版诊断 skill,覆盖自动安装、瓶颈识别、SLO 阈值、curl 转换。
AGENTS.md · 99 lines

How it starts

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

httpstat 项目规划

1) 项目现状

  • 单文件 CLI (httpstat.py, ~370 行),Python >=3.9,版本 2.0.0。
  • 打包完全由 pyproject.toml 驱动(setuptools),setup.py 已删除。
  • 构建/发布使用 uv build / uv publish
  • 测试为 httpstat_test.sh(端到端 shell 脚本,依赖外网站点)。

已完成的现代化工作

  • 去除所有 Python 2 兼容代码,shebang 改为 #!/usr/bin/env python
  • 全量 f-string,新式 class 语法,类型标注(Env 类 overload、NoReturn)。
  • 严格布尔解析 parse_bool(),替代 'true' in value.lower()
  • 临时文件 try/finally 统一清理,不再泄漏。
  • quit() 重命名为 _exit() 并标注 NoReturn

2) 剩余技术债

A. 测试可靠性不足(高优先级)

  • 仅有 shell E2E,强依赖公网与第三方站点行为,CI/本地结果不稳定。
  • 缺少单元测试,核心逻辑(指标换算、区间计算、parse_bool)没有稳定回归保障。

B. Agent 适配能力不足(中高优先级)

  • 当前 JSON 输出缺少 schema version、状态码语义、错误结构、上下文元数据。
  • 缺少"可机器判断"的 SLO/阈值能力(例如总耗时超阈值即非 0 退出)。
  • 输出模式较少,无法直接覆盖 Agent 常见流水线(JSONL、紧凑 JSON、纯错误对象)。

3) 下一阶段推进方案

Phase 1:结构化输出 + SLO(本轮实施)

输出格式
  • 新增 --format-f):pretty | json | jsonl(默认 pretty,兼容现有行为)。
  • HTTPSTAT_METRICS_ONLY 环境变量保留兼容,等价于 --format json
  • JSON v1 schema(最小集,后续通过 schema_version 扩展):
    {
      "schema_version": 1,
      "url": "...",
      "ok": true,
      "exit_code": 0,
      "response": {
        "status_line": "HTTP/2 200",
        "status_code": 200,
        "remote_ip": "...",
        "remote_port": "...",
        "headers": {"Content-Type": "application/json", "Server": "nginx", "...": "..."}
      },
      "timings_ms": {
        "dns": 5,
        "connect": 10,
        "tls": 15,
        "server": 50,
        "transfer": 20,
        "total": 100,
        "namelookup": 5,
        "initial_connect": 15,
        "pretransfer": 30,
        "starttransfer": 80
      },
      "speed": {
        "download_kbs": 1234.5,
        "upload_kbs": 0.0
      },
      "slo": {
        "pass": true,
        "violations": []
      }
    }
    
SLO 阈值
  • 单一参数 --slo key=value,...,例如 --slo total=500,connect=100,ttfb=200
  • 支持的 key:totalconnectttfb(starttransfer)、dnstls
  • 超阈值时退出码为 4,JSON 中 slo.pass=falseslo.violations 列出超标项。
  • pretty 模式下在输出末尾用红色标注超标指标。
颜色控制

Read the full file on GitHub · 99 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 · 99 lines · 1,193 tokens per session scan A 92d29ac94d34

Subscribe to this mod's changes

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