Skip to content

feat(mcp): bm_man and manual pages for the 1.0 tools - #1844

Merged
phernandez merged 1 commit into
mainfrom
feat/1832-bm-man
Oct 23, 2026
Merged

phernandez merged 1 commit into
mainfrom
feat/1832-bm-man

Conversation

@phernandez

Copy link
Copy Markdown
Member

Closes the bm_man part of #1832 (SPEC-35.2, #1827).

What changed

bm_man tool

  • Reads the manual bundled in the package:
    • bm_man() returns the index.
    • bm_man(page=...) reads one page, under any spelling: bm-search(3), bm_search or 3/bm-search.
    • bm_man(query=...) lists the pages that mention every word, like man -k.
  • Never reads a manual project, so it works in any workspace with no network.
  • Accepts topic, name, command and tool as spellings of page. Production man calls failed validation on each of those names.
  • Refusals are typed tool errors (NOT_FOUND, INVALID_ARGUMENTS) in the requested output_format.

Manual pages

  • One section-3 page for each bm_* tool (13 pages).
    • Every example was run in-process against an isolated local project.
    • The gotchas come from those runs.
  • Section-1 pages now link to their bm_* counterparts:
    • cat(1) and head(1) → bm-read(3)
    • grep(1) → bm-search(3)
    • ls(1) → bm-list(3)
    • find(1) → bm-find(3)
    • tail(1) → bm-project(3)
    • apropos(1) → bm-man(3)
  • scripts/update_man_pages.py --new TOOL ... scaffolds a page from the registry. It never overwrites an existing page.
  • Regeneration now turns on the hidden project-delete tools first. That refreshed delete-project(3), which was missing the output_format parameter added in feat(mcp): add bm_project, bm_project_delete and bm_schema #1839.

Bundled-only manual everywhere

  • The legacy man tool, bm man <topic> and bm man apropos now read only the bundled pages.
  • Production Logfire, last 30 days:
    • About 90% of man errors were Project 'manual' was not found: hosted workspaces have no such project.
    • Most of the rest were wrong argument names, which the aliases above now accept.

Reserved project name

  • man is now a reserved project name, because memory://man/ is the manual.
  • The manual resource no longer falls back to a note in a project named man.

Not in this PR

Verification

  • just fast-check
  • just test-unit-sqlite: 8800 passed. That run was before the reserved-name commit; just fast-test covered that change afterwards.
  • just man-regen reports no drift.
  • Examples were run with a scratch harness that calls each tool through fastmcp.Client(mcp) with temporary HOME, BASIC_MEMORY_HOME and config directories.

🤖 Generated with Claude Code

https://claude.ai/code/session_018CoZ3jWnMJsyQsik4tPySk

- bm_man reads the bundled manual: the index, one page by any spelling
  (bm-search(3), bm_search), or the pages that mention every word of a
  query. It never reads a manual project, so it works in every workspace.
  `topic`, `name`, `command` and `tool` are accepted for `page`.
- Section 3 gets a page for each bm_* tool, with examples verified against
  an isolated local project. Section 1 pages cross-reference their bm_*
  counterparts.
- scripts/update_man_pages.py --new TOOL scaffolds a section-3 page from
  the registry; regeneration now sees the project-delete tools, which
  refreshed delete-project(3).
- The legacy man tool, bm man <topic> and bm man apropos read only the
  bundled pages. Falling back to a "manual" project caused about 90% of
  man's production errors (2026-10): hosted workspaces have no such project.
- "man" is a reserved project name, since memory://man/ is the manual; the
  manual resource no longer falls back to a note in a project named man.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CoZ3jWnMJsyQsik4tPySk
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez phernandez added this to the v1.0 milestone Oct 23, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T20:12:30.020791Z c5dc913 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@phernandez
phernandez merged commit aa8bf26 into main Oct 23, 2026
31 checks passed
@phernandez
phernandez deleted the feat/1832-bm-man branch October 23, 2026 20:40
phernandez added a commit that referenced this pull request Nov 6, 2026
…urrently (#2072)

## Why

A version prune deletes old object versions, and Tigris sends one
`OBJECT_DELETED` notification per version. In production on 2026-11-06
the webhook batches during a prune averaged **30.3 events for 10.3
distinct paths**. `run_runtime_storage_event_operations` handled every
event one after another (entity lookup plus a current-object HEAD, about
0.33 s each), so a batch took about 10 s and the cloud webhook queue
fell 30+ minutes behind. That delay hits every workspace's sync and
external edits, because they share the queue.

## What

- **One check per path per batch.** Operations are grouped by path in
arrival order, and consecutive deletes of one path collapse into a
single step that stands for all the events it covers. A delete only asks
whether the object is still there, so one check answers them all. Counts
stay per event: a collapsed step adds its event count to processed or
failed.
- **Paths run concurrently, opt in.**
`run_runtime_storage_event_operations(..., max_concurrent_paths=1)`. The
default keeps today's behavior. Above 1, different paths run
concurrently while one path's steps stay in order (a create between two
deletes still runs between them). A failure the processor chooses to
raise cancels the other paths and fails the batch as that exception, as
it stopped the sequential loop before.
- `StorageEventIndexRuntime.max_concurrent_paths` passes the setting
through project routing.
- `StorageEventOperationProcessor` creates its lazy delete resources
under a lock, so concurrent paths share one set.

Local Basic Memory keeps the default (one path at a time). Cloud will
pass the webhook job's share of the worker's tenant database connection
budget, so the fan-out never exceeds connections the job can hold (the
cloud #1844 rule).

## Tests

New tests in `tests/test_runtime_storage_events.py` and
`tests/index/test_storage_event_operation_processor.py`:
- repeated deletes of one path run one check and count every event;
- a create between deletes keeps each step in order;
- a failed collapsed check counts every event it covers as failed;
- paths run concurrently up to the limit and never overlap themselves;
the default runs one at a time;
- a raised failure fails a concurrent batch as itself, not as an
`ExceptionGroup`;
- concurrent deletes create delete resources once.

Each guard was checked by breaking it: no collapse fails 2 tests, never
concurrent fails the cap test, no lock fails the shared-resources test.
`tests/test_runtime_storage_events.py` plus `tests/index/` pass (252).
Ruff clean; `just typecheck` reports only the existing `pymilvus`
optional-dependency imports.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_016N9c6ouiT4Wid3arGR41Dv

Signed-off-by: phernandez <paul@basicmachines.co>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant