agentleFS
CadastoCadasto/openehr-assistant-mcp/AGENTS.md

openehr-assistant-mcp

AGENTS.md18 starsChanged 6 months agoMITView on GitHub

Instructions for AI agents (Claude Code, Cursor, and others) working in the openEHR Assistant MCP Server repository. This repo follows a lightweight Specification-Driven Development paradigm. The spec set under docs/ is the source of truth; AGENTS.md is the rules layer that links into it. Keep detail in the owning doc and point to it. When authoring or editing guides, prompts, BMM JSON, terminology, AQL grammar, or anything that must track the upstream openEHR standards, do not guess or rely on…

  • Reads credentials
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository3 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When adding or changing guidance on archetypes, templates, or clinical modelling, uphold: two-level modelling (RM vs archetype/template).

    line 43
  2. Very specific:

    When you add or move a REQ-*, a capability class, or its test, update docs/traceability.yaml in the same change, or spec-check fails.

    line 69
  3. Very specific:

    Discovery cache: after adding or renaming a capability class without bumping APP_VERSION, clear the cache or the capability does not …

    line 91
  4. Very specific:

    When updating guides under resources/guides/, prefer substantive improvements that add value.

    line 96
  5. Very specific:

    Do not flag or recommend APP_VERSION bumps during code-review tasks: version bumping is a manual action the maintainer invokes explicitly.

    line 98

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

Instructions for AI agents (Claude Code, Cursor, and others) working in the openEHR Assistant MCP Server repository.

Project Overview

  • A PHP 8.4 MCP server exposing openEHR tools, prompts, and resources to MCP clients, built on mcp/sdk (modelcontextprotocol/php-sdk) with attribute-driven discovery (#[McpTool], #[McpPrompt], #[McpResourceTemplate]/#[McpResource], #[CompletionProvider]). Feature overview: README.md.
  • Two plugins, two audiences; do not confuse them. The openehr-assistant-dev plugin (Claude Code + Cursor) is this repo's maintainer tooling (authoring tools, prompts, guides, examples; releases). The openehr-assistant plugin wraps this server for clinical end users.

Documentation map

This repo follows a lightweight Specification-Driven Development paradigm. The spec set under docs/ is the source of truth; AGENTS.md is the rules layer that links into it. Keep detail in the owning doc and point to it.

DocumentOwns
docs/requirements.mdREQ-# functional and non-functional requirements (the what)
docs/architecture.mdComponents mapped to requirements (the how)
docs/decisions/Architecture Decision Records (the why)
docs/traceability.mdREQ, code, test, ADR matrix; the machine-checked source is docs/traceability.yaml, validated by make spec-check (ADR-0006); SDD settings in docs/.sdd.yaml
docs/conventions.mdCanonical coding and MCP authoring conventions: PSR-12, namespaces, tools, prompts (incl. the prompt policy split), resources, completion providers
docs/development.mdDocker dev environment, services, transports, env vars, discovery cache, Makefile targets
docs/testing.mdTests, PHPStan, coverage, conformance, drift gate
docs/install.mdHosted and local setup, MCP client configurations (user-facing)
CONTRIBUTING.mdPR checklist, branch naming, release housekeeping

Domain Context

Looking up openEHR specification content

When authoring or editing guides, prompts, BMM JSON, terminology, AQL grammar, or anything that must track the upstream openEHR standards, do not guess or rely on training memory. Retrieve from specifications.openehr.org, cheapest representation first: llms.txt index, then .md twin, then structured /api/*.json, then HTML. The Markdown twin omits per-class attribute/function/invariant tables; use type_specification_get (BMM-backed) or the HTML page for those. Track the development branch, not latest.

Full policy and failure modes: the spec-lookup how-to (guide_get(category="howto", name="spec-lookup"); also in resources/server-instructions.md) and ADR-0005.

Guides and specification alignment

  • Guides under resources/guides/ and prompts that describe a standard (e.g. AQL) must stay aligned with the authoritative spec and any formal grammar in the repo. Avoid duplicate or misplaced paragraphs in guide files.
  • Archetypes/templates: guides under resources/guides/archetypes/ and resources/guides/templates/ stay consistent with openEHR modelling docs and the project's ADL/OET conventions.
  • Simplified Formats: guides under resources/guides/simplified_formats/ (Flat and Structured JSON; Web Template field identifiers, ctx, pipe suffixes, underscore prefix) must align with the openEHR ITS Simplified Formats specification, retrieved per the spec-lookup policy above, not from memory.
  • Authoring conventions and templates: guide Markdown style, spec-digest rules, and the copy-ready digest skeleton live under src/templates/. Start there before adding or modifying a guide.

Clinical modelling and governance

When adding or changing guidance on archetypes, templates, or clinical modelling, uphold: two-level modelling (RM vs archetype/template); single-concept archetypes; no workflow/UI in archetypes (those belong in templates or apps); reusability and semantic correctness over app-specific convenience; CKM and spec alignment.

Repository Layout

  • public/index.php: entrypoint; registers MCP capabilities, selects the transport, and uses a file-based discovery cache for fast startup.
  • src/Tools, src/Prompts, src/Resources, src/CompletionProviders: MCP capabilities; how to author each is in docs/conventions.md.
  • src/Apis: internal API clients (CKM). src/Helpers: internal helpers. src/Sdd: the spec-check drift gate. src/templates: guide and spec-digest authoring templates. src/constants.php: env loading and defaults (incl. APP_VERSION). scripts/: CLI entrypoints (spec-check.php).
  • resources/: guides, examples, BMM JSON, terminology, prompt bodies, server-instructions.md.
  • tests/: PHPUnit tests (mirroring src/) and the PHPUnit/PHPStan configs.
  • .docker/: compose files, multi-stage Dockerfile, Caddyfile. .github/workflows/: pr-validation.yml, release.yml.

Development

The runtime is Docker-only: the host (WSL2 on Windows) has no PHP or Composer. Never run php, composer, or vendor/bin/* on the host; they fail. Run them inside the app dev container (ADR-0004). Services: app, ingress (Caddy), dev-only node. Scripts: composer.json scripts.

make up-dev       # start dev containers
make install      # install Composer dev dependencies
make ci           # spec-check + PHPStan + tests (mirrors PR validation); run before pushing
make conformance  # MCP conformance suite (stack must be up)
  • Single test class, inside the container: composer test -- --filter SomeTest (a bare vendor/bin/phpunit finds no config; it lives at tests/phpunit.xml).
  • Full docker compose … exec invocations: docs/testing.md.
  • Transports: streamable-http (default; dev port :8343) and stdio (php public/index.php --transport=stdio, or make run-stdio).
  • Configuration: env vars and their code defaults (which can differ from .env.example) are in docs/development.md.
  • When you add or move a REQ-*, a capability class, or its test, update docs/traceability.yaml in the same change, or spec-check fails.

CHANGELOG style

Keep ## [Unreleased] entries short and high-level: one-line bullets naming the artefact class and scope. Do not enumerate individual files, classes, or audit details (those belong in commit messages and PR bodies). Aim for one sentence with at most one short parenthetical example list; match the terseness of the 0.19.0-and-earlier entries; no stacked enumerations or multi-clause bullets.

Commit Messages

Conventional Commits with a scope, e.g. feat(tools):, fix(resources):, docs:.

Versioning

  • SemVer; APP_VERSION in src/constants.php is the single source, history is in CHANGELOG.md. Never restate the current version here.
  • Tags are bare X.Y.Z (for example 0.20.0), no v prefix; each has a GitHub release titled with the tag name. Pushing any tag runs release.yml, which builds and pushes the Docker image to GHCR.
  • Release housekeeping (README version badge) is in CONTRIBUTING.md.

Branching

Feature branches off main plus pull requests (naming in CONTRIBUTING.md). CI (pr-validation.yml) runs only on pull_request events: every push to an open PR, nothing for a branch without one.

Gotchas

  • Discovery cache: after adding or renaming a capability class without bumping APP_VERSION, clear the cache or the capability does not register. Detail in docs/development.md.
  • DNS rebinding: the streamable-http transport (SDK 0.6 and later) accepts only hosts in MCP_ALLOWED_HOSTS (loopback by default); set it to the reverse-proxy host / public domain when deployed behind a proxy.

Learned User Preferences

  • When updating guides under resources/guides/, prefer substantive improvements that add value; avoid trivial or small changes that do not improve the guidelines.
  • Guide content is consumed by AI agents: keep it short, concise, and scannable.
  • Do not flag or recommend APP_VERSION bumps during code-review tasks: version bumping is a manual action the maintainer invokes explicitly; leave it out of review findings.

Learned Workspace Facts

  • Repo tooling that can be implemented in PHP should live as classes in src/ with CLI entrypoints (e.g. scripts/*.php) and composer.json script entries; update AGENTS.md and related docs when changing such tooling.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.