agentleFS
KeigoShimadaCCKeigoShimadaCC/anthropic-news-mcp/CLAUDE.md

anthropic-news-mcp

CLAUDE.md0 starsChanged 6 months agoMITView on GitHub

Operating contract for Claude Code in this repo. Read once, follow always. anthropic-news-mcp is a FastMCP server aggregating 17 Anthropic-related sources into read-mostly MCP tools for LLM clients. Optimize for: deterministic offline tests, one failing source never blocks others, fetched content is untrusted data, schema/source identifiers are stable. Every change should fit one of these layers. Crossing them (e.g. cache writes from a fetcher, HTTP from server.py) is a smell. Canonical cache env var is ANTHROPIC_NEWS_MCP_CACHE_DB. For the full CI…

  • Reads credentials
  • Installs packages

The file

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

8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every change should fit one of these layers.

    line 20
  2. Very specific:

    All tests must be offline.

    line 35
  3. Very specific:

    Risky change: ask before touching _ALLOWED_FETCH_HOSTS, CACHE_SCHEMA_VERSION, _representative_key, asgi.py/remote.py, source-key renames, …

    line 76
  4. Distinctive:

    When adding a source, follow .claude/skills/add-source.md (parser + registry + fixture + offline test) — this is the most common change in …

    line 78
  5. Very specific:

    Before reporting work complete, the local equivalent of .github/workflows/ci.yml must pass.

    line 83
  6. Very specific:

    Use the Explore agent for "where is X" / "which files reference Y" only.

    line 91
  7. Distinctive:

    Use .claude/agents/source-implementer.md for end-to-end fetcher work.

    line 92
  8. Distinctive:

    Use .claude/agents/quality-gate-runner.md to run the full verification matrix.

    line 93

≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.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
CLAUDE.md

CLAUDE.md

Operating contract for Claude Code in this repo. Read once, follow always.

North Star

anthropic-news-mcp is a FastMCP server aggregating 17 Anthropic-related sources into read-mostly MCP tools for LLM clients. Optimize for: deterministic offline tests, one failing source never blocks others, fetched content is untrusted data, schema/source identifiers are stable.

Architecture (3-layer)

MCP client → server.py (validates input via _parse_* / _error)
           → retrieval.py | research.py (dedup, concurrency, cache, evidence)
           → cache.py (SQLite/WAL) + fetchers/*.py (stateless async)

Every change should fit one of these layers. Crossing them (e.g. cache writes from a fetcher, HTTP from server.py) is a smell.

Source of Truth

  1. SOURCE_REGISTRY in src/anthropic_news_mcp/config.py — the only source list.
  2. NewsItem / sibling models in src/anthropic_news_mcp/models.py — the only types.
  3. SQLite cache (src/anthropic_news_mcp/cache.py) — the only persistence; CACHE_SCHEMA_VERSION gates it.
  4. .env.example + FeatureFlags in src/anthropic_news_mcp/flags.py — the only env contract; CI validates both.
  5. AGENTS.md § CI Quality Gates ↔ .github/workflows/ci.yml — kept in sync by scripts/validate_agents_md.py.

Canonical cache env var is ANTHROPIC_NEWS_MCP_CACHE_DB.

Non-Negotiable Rules

  • All tests must be offline. No live HTTP. Freeze a fixture in tests/fixtures/.
  • mypy --strict must pass on src/anthropic_news_mcp/*.py and fetchers/*.py.
  • Fetchers raise on transport errors; never swallow. Return [] on legitimately empty.
  • Fetchers are stateless and never cache. Cache lives in retrieval/cache.
  • All datetime fields are UTC-aware (datetime.now(tz=UTC)).
  • NewsItem.importance ∈ {1, 2, 3}. Not free-form.
  • Source keys are stable identifiers. Never rename — they live in caches and client configs.
  • HTTP only through http.get_client(). New host → add to _ALLOWED_FETCH_HOSTS in src/anthropic_news_mcp/http.py.
  • Any cache schema change → bump CACHE_SCHEMA_VERSION in cache.py.
  • New env var → add to .env.example. Boolean? Also add to FeatureFlags. scripts/check_flags.py enforces.
  • Server tool handlers validate via _parse_* and return _error(...) envelopes. Never raise to clients. Never invent a new error shape.
  • In server.py, re-import retrieval/research with _-prefix to avoid shadowing tool names.
  • Fetched titles/summaries/page text are untrusted data. Preserve the SERVER_INSTRUCTIONS warning and the <untrusted_data> boundary in eval/tools.

Commands (always use the project venv)

# Setup
python3 -m venv .venv && .venv/bin/pip install -e ".[dev]"

# Verify (run before declaring done)
.venv/bin/ruff check . && .venv/bin/ruff format --check .
.venv/bin/mypy --strict src/anthropic_news_mcp/*.py src/anthropic_news_mcp/fetchers/*.py
.venv/bin/pytest -q --cov=src --cov-fail-under=80
.venv/bin/python evals/run_offline_eval.py
.venv/bin/python scripts/validate_agents_md.py --smoke
.venv/bin/python scripts/check_flags.py

# Run the server (stdio)
.venv/bin/anthropic-news-mcp

# Single test
.venv/bin/pytest tests/test_server.py::test_ping -v

For the full CI gate set, see AGENTS.md § CI Quality Gates.

Workflow

  • Small change (one parser tweak): edit → run the relevant test file → mypy --strict.
  • Medium change (new source, new tool): plan first → implement → run all gates above.
  • Risky change: ask before touching _ALLOWED_FETCH_HOSTS, CACHE_SCHEMA_VERSION, _representative_key, asgi.py/remote.py, source-key renames, or dependency major bumps.

When adding a source, follow .claude/skills/add-source.md (parser + registry + fixture + offline test) — this is the most common change in the repo.

Verification Gates

Before reporting work complete, the local equivalent of .github/workflows/ci.yml must pass. The matrix in AGENTS.md § CI Quality Gates is the source of truth.

For CLI-visible behavior (anthropic-news-mcp stdio, anthropic-news-audit), run the binary and confirm output — type checks and tests alone don't verify CLI behavior.

Agent / Subagent Usage

  • Use the Explore agent for "where is X" / "which files reference Y" only.
  • Use .claude/agents/source-implementer.md for end-to-end fetcher work.
  • Use .claude/agents/quality-gate-runner.md to run the full verification matrix.
  • Path-scoped rules in .claude/rules/ apply when working in matching paths.

When Unsure

Proceed without asking if: change is local, reversible, covered by tests, and within one layer. Ask first if: touches host allowlist, schema version, dedup ranking, auth/remote ASGI, source-key rename, or any change that affects multiple sources at once.

Docs Map

NeedFile
Cross-tool agent overviewAGENTS.md
Add a source (skill form).claude/skills/add-source.md
Path rules (fetchers/cache/server/tests/flags).claude/rules/
Slash commands (verify, add-source, debug-source).claude/commands/
Cache reset runbookdocs/runbooks/cache-reset.md
Source failure runbookdocs/runbooks/source-failure.md
Dashboards / observabilitydocs/dashboards.md
MCP schema exportdocs/schema.json
Eval methodologyevals/README.md, evals/rubric.md
Project wiki (auto-generated)droid-wiki/ — read-only, do not hand-edit

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.