diff --git a/docs/manual-pages.md b/docs/manual-pages.md index 7a5b80867..23b014e3c 100644 --- a/docs/manual-pages.md +++ b/docs/manual-pages.md @@ -9,14 +9,15 @@ files bundled in the package, so every install has the same manual: local, Cloud - `src/basic_memory/man/man1/` — shell commands run against a project (`ls(1)`, `grep(1)`, ...) and `bm` subcommands (`okf-export(1)`, `okf-check(1)`). - `src/basic_memory/man/man3/` — one page per MCP tool a server registers: the `bm_*` tools, - plus the Cloud-registered `bm_agent` and ChatGPT `search`/`fetch` adapters. + plus the Cloud-registered `bm_agent`, `bm_log`, `bm_open` and `bm_review` and the ChatGPT + `search`/`fetch` adapters. - `src/basic_memory/man/man7/` — concepts an agent needs, such as `comark(7)`, and `tools-migration(7)`, which maps pre-1.0 tools and `bm tool` commands to 1.0. - `src/basic_memory/man/bm.1` — the groff system page that `bm man install` copies for `man bm`. It is not a `bm man` page. A test holds section 3 equal to the local tool registry plus a hard-coded list of the -Cloud-registered tools (`bm_agent`, `search`, `fetch`). It does not read Cloud's registry, so +Cloud-registered tools (`bm_agent`, `bm_log`, `bm_open`, `bm_review`, `search`, `fetch`). It does not read Cloud's registry, so renaming or removing a Cloud tool needs a matching change to its page and to that list. ## Reading it @@ -60,8 +61,8 @@ of the section 1 pages (`generated: cli`) from the Typer command tree. Drift tes blocks byte-equal to the rendering, so changing a local tool or a command without regenerating fails CI. Everything else on a page is hand-owned. -The pages for Cloud-registered tools (`bm-agent(3)`, `chatgpt-search(3)`, `chatgpt-fetch(3)`) are -maintained by hand: the local registry does not have those tools, so neither the generator nor +The pages for Cloud-registered tools (`bm-agent(3)`, `bm-log(3)`, `bm-open(3)`, `bm-review(3)`, +`chatgpt-search(3)`, `chatgpt-fetch(3)`) are maintained by hand: the local registry does not have those tools, so neither the generator nor the drift tests cover them. Update them when the Cloud tool's parameters change. ## Adding a page diff --git a/src/basic_memory/man/man3/bm-log(3).md b/src/basic_memory/man/man3/bm-log(3).md new file mode 100644 index 000000000..f26b0d8b3 --- /dev/null +++ b/src/basic_memory/man/man3/bm-log(3).md @@ -0,0 +1,81 @@ +--- +title: bm-log(3) +type: manpage +section: 3 +name: bm-log +summary: read the workspace log of who changed which notes, folders and projects (hosted server only) +generated: hand +tool: bm_log +--- + +# bm-log(3) + +## NAME + +**bm-log** — read the workspace log of who changed which notes, folders and projects (hosted server only) + +## SYNOPSIS + +``` +bm_log(since=None, event_types=(), cursor=None, limit=50, full=False, + project=None) +``` + +## PARAMETERS + +- **since** (string | null, optional, default: None) — Events at or after this point: an RFC 3339 instant with a timezone (`2026-07-22T15:30:00Z`) is exact; a date (`2026-07-22`) starts at midnight UTC; `7d` or `2 days ago` look back whole days. Also accepted as `after_date` or `timeframe`. +- **event_types** (array, optional, default: ()) — Event types to include; omit or pass an empty array for all. See DESCRIPTION for the list. +- **cursor** (string | null, optional, default: None) — The `nextCursor` of the previous page, to resume. +- **limit** (integer, optional, default: 50) — Events per page (1-100). +- **full** (boolean, optional, default: False) — Return every field of each event: workspace, project, note and actor ids, versions, checksums and app links. +- **project** (string | null, optional, default: None) — Limit the log to one project: name, `workspace/project`, or external id. Omit for the whole workspace. + +## DESCRIPTION + +**Availability:** registered only on the hosted Basic Memory Cloud MCP +server. A local client will not find this tool. + +`bm_log` reads the workspace log: who changed which notes (created, updated, +moved, deleted), folder and project changes, indexing, imports and agent +runs, with who did each when known. It is read-only. Events come newest +first, as metadata only. The reply carries an opaque `nextCursor`; pass it +back as `cursor` to read the next page. + +Each event holds only the fields that say what happened. `full=True` returns +every field, as the web app's activity API does. + +`event_types` takes any of: `note.created`, `note.updated`, `note.deleted`, +`note.moved`, `folder.moved`, `folder.deleted`, `project.created`, +`project.deleted`, `index.completed`, `user.preferences.updated`, +`operation.import`, `operation.project_index`, `operation.snapshot_export`, +`operation.tenant_provision`, `operation.tenant_deprovision` and +`operation.agent_run`. + +`bm_log` does not return note content. To read a note, use bm_read(3). To +read recently changed notes' content, use `bm_project(command="recent", +project="")`, see bm-project(3). + +## EXAMPLES + +``` +bm_log(since="7d", event_types=["note.deleted", "note.moved"]) +bm_log(project="main", limit=20) +bm_log(cursor="") +bm_log(since="2026-07-22", full=True) +``` + +## GOTCHAS + +- The log is an event stream, not a list of current notes. A note that was + created and then deleted appears as two events. +- `since` with `7d` or `2 days ago` looks back whole days, not hours. +- `project` narrows the log to one project; without it the log covers the + whole workspace. +- Pass `cursor` unchanged. It is opaque and tied to the filters of the call + that returned it. + +## SEE ALSO + +- see_also [[bm-read(3)]] +- see_also [[bm-project(3)]] +- see_also [[bm-man(3)]] diff --git a/src/basic_memory/man/man3/bm-open(3).md b/src/basic_memory/man/man3/bm-open(3).md new file mode 100644 index 000000000..017f9cbc3 --- /dev/null +++ b/src/basic_memory/man/man3/bm-open(3).md @@ -0,0 +1,80 @@ +--- +title: bm-open(3) +type: manpage +section: 3 +name: bm-open +summary: open the Basic Memory app at a notes, folders, note, search or graph view (hosted server only) +generated: hand +tool: bm_open +--- + +# bm-open(3) + +## NAME + +**bm-open** — open the Basic Memory app at a notes, folders, note, search or graph view (hosted server only) + +## SYNOPSIS + +``` +bm_open(view="notes", path=None, identifier=None, query=None, + graph_mode="overview", note_mode="view", project=None) +``` + +## PARAMETERS + +- **view** (`notes` | `note` | `folders` | `search` | `graph`, optional, default: "notes") — Destination screen. Use `note` with `identifier`, `folders` with `path`, `search` with `query`, or `graph` with `graph_mode`. +- **path** (string | null, optional, default: None) — Initial folder for the `notes`, `folders`, `note` or `search` views. Omit for the project root. Also accepted as `directory`. Not valid with `graph`. +- **identifier** (string | null, optional, default: None) — Note title, permalink, `memory://` URL, or exact note external UUID. Required with `view="note"`; optional with `view="graph"` to focus that note; omit for other views. +- **query** (string | null, optional, default: None) — Initial search query. Only valid with `view="search"`; omit to open a blank search. +- **graph_mode** (`overview` | `full`, optional, default: "overview") — Graph display mode. Only valid with `view="graph"`. +- **note_mode** (`view` | `edit`, optional, default: "view") — Initial note mode. `edit` opens the note editor directly. Only valid with `view="note"`. +- **project** (string | null, optional, default: None) — Project name, `workspace/project`, or project external id. Omit to use the default. Also accepted as `project_id`. + +## DESCRIPTION + +**Availability:** registered only on the hosted Basic Memory Cloud MCP +server, and shown to clients that can display the Basic Memory app (MCP Apps +clients and ChatGPT). A local client will not find this tool. It is not +offered to Cloud agent runs. + +`bm_open` shows the person the Basic Memory app: the notes gallery, a folder, +a note, search, or the graph. It is read-only. Use it when the person wants to +open, browse or interact with their notes visually. Do not use it only to get +information for your own answer; use the data tools for that: bm_read(3), +bm_search(3), bm_list(3). + +The default workspace and project resolve on their own, so do not list +projects first. + +Some parameters belong to one view, and the call is refused when they are +combined with another: + +- `identifier` only with `view="note"` or `view="graph"`. +- `query` only with `view="search"`. +- `path` not with `view="graph"`. +- `graph_mode` other than `overview` only with `view="graph"`. +- `note_mode` other than `view` only with `view="note"`. + +## EXAMPLES + +``` +bm_open() +bm_open(view="search", query="launch plan") +bm_open(view="note", identifier="plans/launch-plan", note_mode="edit") +bm_open(view="folders", path="meetings") +bm_open(view="graph", graph_mode="full") +``` + +## GOTCHAS + +- `view="note"` needs `identifier`; without it there is no note to show. +- It opens a view for the person. The reply is not the note's content. +- Clients that cannot display the app do not get this tool. + +## SEE ALSO + +- see_also [[bm-read(3)]] +- see_also [[bm-search(3)]] +- see_also [[bm-list(3)]] +- see_also [[bm-man(3)]] diff --git a/src/basic_memory/man/man3/bm-project(3).md b/src/basic_memory/man/man3/bm-project(3).md index 9c96885e0..ee7bed653 100644 --- a/src/basic_memory/man/man3/bm-project(3).md +++ b/src/basic_memory/man/man3/bm-project(3).md @@ -37,6 +37,25 @@ bm_project(command, name=None, path=None, set_default=False, workspace=None, bm_project never deletes; bm_project_delete does, and only when the server enables it. +**Hosted server only.** The hosted Basic Memory Cloud server replaces this +tool with one that has two more commands and three more parameters. A local +server has neither. + +- `info` — how to register for Basic Memory Cloud and start a trial. If + project or note tools fail, send the person to the Basic Memory app, then + retry. +- `usage` — the workspace's credit usage, for owners and admins. `workspace` + picks the workspace and `project` must be left out, because usage is + counted per workspace. `since` is the first UTC day (`YYYY-MM-DD`) or a + lookback such as `30d`. For `usage` it defaults to the start of the current + billing period, not the `7d` shown in PARAMETERS above, which applies to + `recent`. `until` is the last UTC day (`YYYY-MM-DD`) and + defaults to today. `group_by` is `actor` (who used credits, and background + job types; the default), `day` (credits per day and who used them) or + `job_type` (background work by job type, per day). `customer` is for + partner staff only: a managed customer's slug, id or name, or `all` for + every managed customer this month. + While the local server is running, its watcher picks up a new project's folder at the next project reload. Once the watch is attached, a one-time index pass includes files copied in before attachment; later changes use normal file events. diff --git a/src/basic_memory/man/man3/bm-review(3).md b/src/basic_memory/man/man3/bm-review(3).md new file mode 100644 index 000000000..102b330ba --- /dev/null +++ b/src/basic_memory/man/man3/bm-review(3).md @@ -0,0 +1,99 @@ +--- +title: bm-review(3) +type: manpage +section: 3 +name: bm-review +summary: comment on, suggest changes to, reply to, resolve, accept or reject review items on a note (hosted server only) +generated: hand +tool: bm_review +--- + +# bm-review(3) + +## NAME + +**bm-review** — comment on, suggest changes to, reply to, resolve, accept or reject review items on a note (hosted server only) + +## SYNOPSIS + +``` +bm_review(identifier, command, project, anchor=None, body=None, + suggestion_kind=None, replacement=None, review_id=None, + expected_checksum=None) +``` + +## PARAMETERS + +- **identifier** (string, required) — The note: a file path, permalink, `memory://` URL, exact title, or external id. +- **command** (required) — What to do: `comment`, `suggest`, `reply`, `resolve`, `accept` or `reject`. +- **project** (string, required) — Project name, `workspace/project`, or project external id. +- **anchor** (object | null, optional, default: None) — Where in the prose to attach a `comment` or `suggest`. An object with `exact` (required: exact single-line note text, copied from bm_read(3), without CriticMarkup markers), and optional `prefix` and `suffix` (exact text just before and after, to disambiguate) and `occurrence` (1-based, after prefix and suffix filtering). +- **body** (string | null, optional, default: None) — The text of a `comment` or `reply`. For `suggest`, an optional reason, saved as the first reply on the suggestion thread (it must not be empty if given). For `resolve`, an optional closing reply. +- **suggestion_kind** (`addition` | `deletion` | `replacement` | null, optional, default: None) — The kind of `suggest`. +- **replacement** (string | null, optional, default: None) — The proposed text for an `addition` or `replacement`. Omit for a `deletion`. +- **review_id** (string | null, optional, default: None) — The thread to act on, for `reply`, `resolve`, `accept` and `reject`. +- **expected_checksum** (string | null, optional, default: None) — The revision checksum returned by bm_read(3). Required for `accept` and `reject`; optional for the other commands. + +## DESCRIPTION + +**Availability:** registered only on the hosted Basic Memory Cloud MCP +server. A local client will not find this tool. + +`bm_review` works on the review threads of one existing Markdown note. Call +bm_read(3) first: it shows the note's prose and its open review threads. +Then give one `command` per call: + +- **comment** (`anchor`, `body`): attach a comment to a passage. +- **suggest** (`anchor`, `suggestion_kind`, and `replacement` unless the kind + is `deletion`; optional `body`): propose an addition, deletion or + replacement. `body` is the reason for the change, saved as the first reply + on the suggestion thread. +- **reply** (`review_id`, `body`): answer a thread. +- **resolve** (`review_id`, optional `body`): close a comment thread, with an + optional closing reply. +- **accept** / **reject** (`review_id`, `expected_checksum`): apply or drop a + pending suggestion. + +Do not write CriticMarkup yourself. The tool writes it, attributes each new +record to the detected MCP client, and saves each command atomically with +checksum conflict protection. A command that is missing a field it needs is +refused before anything is saved. + +The reply has `status` `review_updated`, the note's `title`, `permalink`, +`file_path`, `project` and `project_id`, the ids it created (`comment_ids`, +`suggestion_ids`, `reply_id`), the `review_id` acted on, and the note's new +`revision_checksum`. + +## EXAMPLES + +``` +bm_review(identifier="Plan", command="comment", project="main", + anchor={"exact": "this sentence"}, body="Needs a source.") + +bm_review(identifier="Plan", command="suggest", project="main", + anchor={"exact": "ship in May"}, suggestion_kind="replacement", + replacement="ship in June", + body="The vendor slipped a month.") + +bm_review(identifier="Plan", command="accept", project="main", + review_id="", expected_checksum="") +``` + +## GOTCHAS + +- `accept` and `reject` change the note's text, so they refuse to run + without `expected_checksum`. +- If `expected_checksum` no longer matches, the note changed since bm_read(3). + Read it again before applying review work. +- An `anchor.exact` must stay on one line. A `comment` anchor cannot contain + `==}`, and a `suggest` anchor cannot contain `{` or `}`. +- A deletion takes no `replacement`; an addition or replacement needs one. + An addition is inserted right after `anchor.exact`. +- It works only on existing Markdown notes, in the selected project. +- Unlike the note tools, it is marked destructive: `accept` rewrites the note. + +## SEE ALSO + +- see_also [[bm-read(3)]] +- see_also [[bm-edit(3)]] +- see_also [[bm-man(3)]] diff --git a/tests/test_man_pages.py b/tests/test_man_pages.py index 05497d5dd..2c574ee21 100644 --- a/tests/test_man_pages.py +++ b/tests/test_man_pages.py @@ -135,6 +135,9 @@ def test_bundled_pages_are_well_formed_and_sorted() -> None: PAGES_WITHOUT_LOCAL_TOOLS = { # Cloud registers these; core ships their pages so the manual is one corpus. "bm_agent", + "bm_log", + "bm_open", + "bm_review", "fetch", "search", }