hpo-link AGENTS.md

Repository guidance for hpo-link, a read-only service built around the Human Phenotype Ontology, a standardized vocabulary for describing medical features. It explains how the data-import layer and the API layer must remain separate.

In plain words
What is it for?
Working on configuration, data ingestion, SQLite database building, phenotype and gene or disease lookups, hierarchy queries, and MCP or REST interfaces without mixing data-processing responsibilities with API response handling.
Why use it?
The rules help contributors preserve the project’s architecture and data guarantees while importing ontology and gene-disease information into SQLite. They also define how errors and returned data should be handled.

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

Made for: Codex, OpenCode.

Per session 1,893 This file is loaded in full into every session.
When invoked 1,893 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.01893 $0.01893
Opus 5 $0.00946 $0.00946
Sonnet 5 $0.00379 $0.00379
Haiku 4.5 $0.00189 $0.00189

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

Security

Grade A, and why

hpo-link 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.

AGENTS.md · 145 lines

How it starts

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

Guidance for agents and contributors working in this repository.

What this is

hpo-link is an MCP + REST server that grounds phenotype work in the Human Phenotype Ontology (HPO). It builds a local SQLite database from the HPO OBO release and HPOA gene/disease annotation files, then serves read-only tools for phenotype term lookup, the is_a hierarchy, cross-ontology mapping, and gene↔phenotype↔disease association queries. It mirrors the sibling mgi-link stack/architecture.

Two planes (non-negotiable boundary)

  • Data planeconfig.py, constants.py, identifiers.py, ingest/, data/, services/. Downloads the HPO release (conditional GET), atomically builds the SQLite database (terms, labels, synonyms, definitions, is_a closure, cross-references with provenance + predicate, deprecated/replaced_by, HPOA gene and disease annotations), and returns plain dicts. It raises typed exceptions from hpo_link.exceptions; it never builds error envelopes.
  • MCP planemcp/. Domain-agnostic scaffolding shared with siblings. run_mcp_tool (in mcp/envelope.py) owns success / _meta and converts exceptions into returned structured errors (never raised to the client).

Architecture: ingest → data DAO → services → MCP

ingest/            download (conditional GET) → lock → parser → builder (schema.sql)
data/              HpoRepository (read-only SQLite DAO)
services/          HpoService, AnnotationService, shaping, pagination, refresh
mcp/               envelope, capabilities, annotations, schemas, next_commands,
                   metrics, middleware, facade, arg_help, resources, tools/
server.py          unified REST + MCP transport (FastAPI + uvicorn)
mcp_server.py      stdio transport (Claude Desktop)

Invariants

  • Services return plain dicts; the envelope owns success/_meta and returns structured errors. 7-code error taxonomy: invalid_input, not_found, ambiguous_query, data_unavailable, rate_limited, upstream_unavailable, internal_error.
  • Every compact (default) or richer response carries _meta.next_commands (ready-to-call follow-ups); minimal is the explicit opt-out and returns only _meta = {tool, request_id}. _meta verbosity is tiered by response_mode (_shape_meta): compact keeps next_commands + capabilities_version but drops the elapsed_ms echo; standard/full add elapsed_ms.
  • Every tool declares output_schema + READ_ONLY_OPEN_WORLD annotations, and its first description sentence is a discovery summary ending with Signature: tool(args...).
  • Every tool's real output (success + error, all response modes) must validate against its own output_schema — enforced by tests/unit/test_output_schemas.py. Grouped-by-prefix payloads (xrefs, mappings) are objects keyed by prefix, not arrays; declare them as objects or the envelope leaks a raw validation error.
  • response_modeminimal | compact | standard | full. List tools also carry a pagination block (total/returned/limit/offset/truncated/next_offset); when truncated, _meta.next_commands offers a forward-page step (advance offset).
  • compact+ _meta echoes capabilities_version (a hash of the discovery contract) so warm clients can skip re-fetching get_server_capabilities (omitted in minimal).
  • Keep mcp/capabilities.py::TOOLS in sync with the registered tool set (tests/unit/test_tool_names.py enforces this).
  • Identifiers are normalised in identifiers.py (HP:NNNNNNN; external CURIEs case-folded).
  • Ground every claim in the local database and cite the HPO id + HPO release version. hpo_version is the per-call citation anchor (echoed on every non-minimal payload). The long-form recommended_citation is inlined only on standard/full payloads — term and association alike (one rule across both planes); compact/minimal carry hpo_version and defer the full citation to get_server_capabilities, which is the canonical source of record per the advertised provenance_policy.
  • structlog logs to stderr only — stdout is reserved for the stdio MCP protocol. Never print to stdout outside the CLI.
  • Files stay under 500 lines (hard cap enforced by scripts/check_file_size.py in CI).

Read the full file on GitHub · 145 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 · 145 lines · 1,893 tokens per session scan A 17e795c3af57

Subscribe to this mod's changes

hpo-link AGENTS.md is an instructions file published in the GitHub repository berntpopp/hpo-link (1 stars, last pushed 8d ago), licensed MIT. It adds 1,893 tokens to every session, about $0.0095 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.