openehr-assistant-mcp
AGENTS.md18 starsChanged 5 months agoMITView on GitHub
Instructions for AI agents (Claude Code, Cursor, and others) working in the openEHR Assistant MCP Server repository. This repo follows Specification-Driven Development on the sdd plugin's informative profile: the code leads, docs/ is a knowledge base that describes it, and only the constitution binds. AGENTS.md is the rules layer that links into it. Keep detail in the owning doc and point to it; a change that alters behaviour updates the docs that describe it in the same PR. When authoring…
- Reads credentials
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 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.
- .claude/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/docker-workflow.mdcCursor rule
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 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.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 44
When adding or changing guidance on archetypes, templates, or clinical modelling, uphold: two-level modelling (RM vs archetype/template).
- Very specific: line 92
Discovery cache: after adding or renaming a capability class without bumping APP_VERSION, clear the cache or the capability does not …
- Very specific: line 97
When updating guides under resources/guides/, prefer substantive improvements that add value.
- Very specific: line 99
Do not flag or recommend APP_VERSION bumps during code-review tasks: version bumping is a manual action the maintainer invokes explicitly.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 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.
Files
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 Specification-Driven Development on the sdd plugin's informative profile: the code leads, docs/ is a knowledge base that describes it, and only the constitution binds. AGENTS.md is the rules layer that links into it. Keep detail in the owning doc and point to it; a change that alters behaviour updates the docs that describe it in the same PR.
| Document | Owns |
docs/architecture.md | The constitution: the MUST rules every change respects; the only binding document. Amend it only through /sdd-specify |
docs/components.md | Component map: where each capability lives in the code |
docs/requirements.md | Capability catalogue: REQ-F# functional and REQ-N# non-functional capabilities, as shipped (descriptive) |
docs/decisions/ | Architecture Decision Records (the why) |
docs/development-process.md | SDD process and the PR body; the agent loop is in docs/ai-workflow.md, CI in docs/ci.md; SDD settings in docs/.sdd.yaml |
docs/conventions.md | Canonical coding and MCP authoring conventions: PSR-12, namespaces, tools, prompts (incl. the prompt policy split), resources, completion providers |
docs/development.md | Docker dev environment, services, transports, env vars, discovery cache, Makefile targets |
docs/testing.md | Tests, PHPStan, coverage, conformance, drift gate |
docs/install.md | Hosted and local setup, MCP client configurations (user-facing) |
CONTRIBUTING.md | Contributor workflow, branch naming, release housekeeping; the PR body is .github/PULL_REQUEST_TEMPLATE.md |
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/andresources/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 indocs/conventions.md.src/Apis: internal API clients (CKM).src/Helpers: internal helpers.src/templates: guide and spec-digest authoring templates.src/constants.php: env loading and defaults (incl.APP_VERSION).scripts/: repo tooling, among itsdd-check.py, the vendored sdd drift gate (never edit it by hand).resources/: guides, examples, BMM JSON, terminology, prompt bodies,server-instructions.md.tests/: PHPUnit tests (mirroringsrc/) and the PHPUnit/PHPStan configs..docker/: compose files, multi-stageDockerfile,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 barevendor/bin/phpunitfinds no config; it lives attests/phpunit.xml). - Full
docker compose … execinvocations:docs/testing.md. - Transports:
streamable-http(default; dev port:8343) andstdio(php public/index.php --transport=stdio, ormake run-stdio). - Configuration: env vars and their code defaults (which can differ from
.env.example) are indocs/development.md. - A change must keep every MUST in the constitution; when it adds, moves or changes a capability, update
docs/components.mdanddocs/requirements.mdin the same change.make spec-checkfails on a broken doc link or a missingkind:frontmatter.
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_VERSIONinsrc/constants.phpis the single source, history is inCHANGELOG.md. Never restate the current version here. - Tags are bare
X.Y.Z(for example0.20.0), novprefix; each has a GitHub release titled with the tag name. Pushing any tag runsrelease.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 indocs/development.md. - DNS rebinding: the
streamable-httptransport (SDK 0.6 and later) accepts only hosts inMCP_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_VERSIONbumps 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) andcomposer.jsonscript entries; update AGENTS.md and related docs when changing such tooling. Vendored third-party tooling is the exception: the sdd drift gatescripts/sdd-check.pyis re-vendored from the plugin, never ported.
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
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.

