Skip to content

Add cpu-perf, an MCP server for the list and its sources - #5

Closed
usamahz wants to merge 11 commits into
mainfrom
claude/pensive-davinci-51jmk6
Closed

usamahz wants to merge 11 commits into
mainfrom
claude/pensive-davinci-51jmk6

Conversation

@usamahz

@usamahz usamahz commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

misc/mcp/ adds cpu-perf, a read-only MCP server that gives any AI client the whole list as something it can search and reason over. It serves the README in reading order, the drafts' Rejected, Claims and Link notes, the notes, and the fourteen benchmarks. It also builds a full-text and semantic index of the linked sources on the user's own machine, so answers come from the papers and manuals and cite them. One command runs it: uvx cpu-perf (version 0.1.0rc1, not yet on PyPI).

This PR is the MCP server alone. The website, which renders the list and this server's pages, is #6. It builds on this PR and merges after it.

What it adds

  • The server, in misc/mcp/:
    • 13 tools: ask, lookup, search and fetch, get_section, get_entry, reading_path, get_benchmark, editorial_record, check_evidence, read_source, read_file and library_status.
    • 6 prompts, plus cpuperf:// resources and templates.
    • It runs over stdio (Claude Code, Codex, Claude Desktop, Cursor, VS Code) or Streamable HTTP.
  • Pasted output: perf stat, toplev and compiler output are parsed deterministically into metrics and notes, which are routed to the parts of the list about them.
  • Answers: each entry in an answer is marked as quoted, in the library with no matching passage, or not read on this machine. A claim is attributed only through a quoted passage.
  • Keeping current: the list updates itself daily from main, and several clients can share one library. When several clients open a new library at once, the open is retried instead of failing.
  • Crawling: the crawler reads every listed link the way a reader opening it would. --respect-robots makes it skip what robots.txt disallows.
  • Edits outside misc/mcp/:
    • README.md: an MCP badge, and an "Ask it." paragraph with the commands that add the server to Claude Code and Codex.
    • misc/README.md: an mcp/ row.
    • misc/notes/conventions.md: a Tooling bullet.
    • .gitignore: the server's environments and builds.
  • CI:
    • mcp.yml tests the server on Linux (Python 3.10 and 3.13) and Windows (3.12), checks that the wheel carries the corpus, and checks that the container serves HTTP.
    • mcp-release.yml publishes to PyPI on an mcp-v* tag.

The branch. This PR's branch, claude/pensive-davinci-51jmk6, is the MCP branch claude/git-workflow-guidelines-pf1d30 at 54cba1c, with nothing of its own.

Merge order. Merge this first, with a merge commit; #6 then shows only the website.

Why this belongs

  • Mechanism it establishes, defines, measures or proves: not a list entry. The server serves what the repository already says.
    • It reads the README with the same grammar as misc/scripts/check_format.py, and a test fails if the two drift apart.
    • It never writes to the repository.
  • Why it is primary, and why this URL is the canonical home: the README stays the product. Nothing generated is committed; the index lives in each user's own library. misc/notes/conventions.md says so.
  • Place in the dependency order, and why there: it sits with the other tooling under misc/. Only the README's introduction changes; no entry is added or moved.
  • Existing entry it replaces: none.

Performance numbers (only if the entry or its reason carries one)

None added. The server serves the committed numbers as they are, and check_evidence audits a claim against the seven fields.

Checks

  • python3 misc/scripts/check_format.py passes. The README still has 304 entries; the new paragraph adds none.
  • python3 misc/scripts/check_links.py reports no dead links: "Every README URL is live" passes on this PR.

CI on 54cba1c, all green:

  • MCP server:
    • server tests on Ubuntu (Python 3.10 and 3.13) and Windows (3.12)
    • the wheel carries the corpus
    • the container serves HTTP
  • Quality:
    • entry format and anchors
    • the benchmarks compile on Linux x86-64
    • the benchmarks' smoke run on macOS arm64
  • Links: every README URL is live.

Locally on 54cba1c, the server's tests pass: 133 passed, 2 skipped.

Conflict of interest

None.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ATeZEnkxVYpJsHQ3ELz6mN

usamahz and others added 11 commits October 2, 2026 19:32
misc/mcp/ is a read-only MCP server that serves the README, the drafts'
Rejected, Claims and Link notes, the notes and the benchmarks to any AI
client, and builds a searchable index of the linked sources on the user's
own machine.

- ask, lookup, search/fetch and the other tools answer from the list and
  the indexed sources, with citations; pasted perf stat, toplev and
  compiler output is parsed deterministically into metrics and notes
- the list updates itself daily from main; several clients can share one
  data directory
- runs over stdio (Claude Code, Codex, Claude Desktop, Cursor, VS Code)
  or Streamable HTTP
- mcp.yml tests it on Linux and Windows and checks the wheel and the
  container; mcp-release.yml publishes to PyPI on an mcp-v* tag
- route a flagged top-down level to the list's part about it: a
  memory-bound run to the memory hierarchy (by level 2 when measured,
  else by the cache counters), a front-end-bound one to fetch and decode
- detect Intel, AMD or Arm from the PMUs and event names (then the
  question) and leave the other vendors' sources out of the answer;
  with no vendor known, vendor-neutral sources lead
- add frequency, page faults per second, cache, dTLB and iTLB MPKI, and
  per-second rates over task-clock as perf computes them; no frequency
  on hybrid parts, where task-clock spans both core types
- count -I intervals and use the last one as elapsed time
- take the lowest running share from TopdownL1 metric lines too, and
  name the group it came from
- explain perf's own errors (missing metric group, perf_event_paranoid,
  unknown or unsupported events, NMI watchdog) instead of searching for
  their words
- read TopdownL2 lines; level 2 orders the reading and is never flagged
The vector cache test told a full reload from an append by its
time stamp; on Windows the clock can return the same value for both
reads, so the reload looked like none. The store now counts full
reloads and the test checks the count.

A prefetch still queued at exit no longer raises from a thread pool
that the interpreter has already shut down.
ask listed the list's entries the same way whether or not the server had
their text, so a model cited a link's one-line reason as if it had read the
paper. Each entry in an answer is now marked quoted (with its passages and
pages), in the library with no matching passage (with the read_source call
that looks inside) or not read on this machine (with the reason), a coverage
line says which sources the answer rests on, and the rules say a claim is
attributed only through a quoted passage.

- Passages carry the list's title for their source, not a PDF's placeholder
  ("Untitled Document") or a README's first heading.
- A listed paper the question is about comes with its abstract, joined
  across passages, instead of only a keyword window into its results.
- PDFium's U+FFFE line-end hyphens are joined at extraction (pdf extract 2)
  and when passages are read, so quotes and the index hold whole words.
- A failed refresh keeps the copy already in the library unless the
  document is gone, and its retry waits for next_try.
- Pasted output: objdump --no-show-raw-insn and gdb disassembly are read as
  assembly; plain C is code, with float sums carried across a loop, early
  exits and array-of-struct fields routed (and benchmarks 03 and 07 named);
  remarks are counted per loop with the missed ones first; clang's
  floating-point reorder remark is no longer read as aliasing; a pasted note
  with commas is no longer taken for perf stat -x.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SbP33zK6gcmsakKiLxS7kW
cpu-perf: answer from the sources' own text, and say which were read
The crawler fetches only the documents the list links, the way a reader
opening each link would, so it no longer consults robots.txt unless asked:
--respect-robots (CPU_PERF_RESPECT_ROBOTS=1) restores the old behaviour, and
--ignore-robots is still accepted. It still identifies itself, keeps a gap
between requests to one host and backs off on rate limits.
When several MCP clients start at once on a machine with no library yet,
each process creates the file and switches it to WAL. SQLite can answer
"database is locked" at once there, without waiting out the busy timeout,
and the losing client failed to start (21 of 480 simultaneous opens in a
stress run). Those setup steps are idempotent, so they are now retried
with a short random backoff. A test races six processes over twenty fresh
libraries; it fails without the retry.
@usamahz
usamahz changed the base branch from claude/git-workflow-guidelines-pf1d30 to main October 4, 2026 19:23
@usamahz
usamahz force-pushed the claude/pensive-davinci-51jmk6 branch from 0c7286b to 54cba1c Compare October 4, 2026 19:23
@usamahz usamahz changed the title A website for the list and its MCP server, generated from the repository Add cpu-perf, an MCP server for the list and its sources Oct 4, 2026

usamahz commented Oct 4, 2026

Copy link
Copy Markdown
Owner Author

Closing as superseded by #7. Every commit here (up to 54cba1c) is in #7, together with the fixes from an end-to-end test as a new user and the 0.1.0 version. Since this branch can't take those commits, #7 is the one to merge.


Generated by Claude Code

@usamahz usamahz closed this Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants