Skip to content

feat(mcp): add bm_project, bm_project_delete and bm_schema - #1839

Merged
phernandez merged 17 commits into
feat/1831-write-toolsfrom
feat/1832-grouped-tools
Oct 23, 2026
Merged

phernandez merged 17 commits into
feat/1831-write-toolsfrom
feat/1832-grouped-tools

Conversation

@phernandez

@phernandez phernandez commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Part of #1832 and #1827 (SPEC-35.2). Stacked on #1838. bm_man and the section-3 manual regeneration follow in a separate PR.

What this adds

Tool Shape Replaces
bm_project command: list, create, recent list_memory_projects (already grouped by workspace), create_memory_project, recent_activity
bm_project_delete name, delete_notes, workspace delete_project; listed only when enable_project_delete is on (off by default)
bm_schema command: validate, infer, diff schema_validate, schema_infer, schema_diff

One shape for grouped tools

Both grouped tools are thin dispatchers over the implementations they replace. They add the 1.0 name, the command parameter and the shared parameter types.

Delegating was only correct once the replaced tools stopped returning a success that describes a failure. So this PR also fixes them (#1813):

  • schema_validate, schema_infer, schema_diff: the "nothing to report" cases raise NOT_FOUND refusals. Text mode keeps the old guidance as the message; JSON keeps the short message. The broad except Exception blocks that turned API failures into success text are removed, so a failure is a tool error.
  • create_memory_project, delete_project: a constrained session (BASIC_MEMORY_MCP_PROJECT) is an UNSUPPORTED refusal.

refusal() now returns a typed Refusal, a ToolError that carries its code and message. The CLI branches on that code: bm schema validate|infer|diff still print "nothing to report" and exit 0.

Delete is its own tool

bm_project_delete carries the project-delete tag. Following the enable_posix_tools pattern, the module hides it at import and the lifespan shows it when enable_project_delete is true. bm_project is never destructive.

Verification

  • just fast-check is clean.
  • tests/mcp/test_tool_bm_project.py covers the default listing, the lifespan flag, every command, the refusals and the schema dispatch. projects.py and note_schemas.py are at 100%.
  • The legacy schema, project and constrained-mode tests now assert refusals. The CLI schema tests, test_cli_exit, the contract tests and test-int/mcp pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_018CoZ3jWnMJsyQsik4tPySk

@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-23T19:38:16.159642Z 731eae0 New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e5286a8261

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/config_models.py Resolved
Comment thread src/basic_memory/mcp/tools/projects.py Resolved
Comment thread src/basic_memory/mcp/tools/projects.py Resolved
@phernandez phernandez changed the title feat(mcp): add bm_project and bm_schema feat(mcp): add bm_project, bm_project_delete and bm_schema Oct 23, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a2ae076eb

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@phernandez
phernandez added this pull request to stack #1841 October 23, 2026 14:13
@phernandez
phernandez force-pushed the feat/1832-grouped-tools branch from 3a2ae07 to 33bcf97 Compare October 23, 2026 14:15

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 33bcf97a87

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/mcp/tools/schema.py Resolved
@phernandez
phernandez force-pushed the feat/1832-grouped-tools branch from 33bcf97 to 7d78e73 Compare October 23, 2026 14:26
phernandez added a commit that referenced this pull request Oct 23, 2026
…nt docs

Codex review on #1839:
- delete_project carries the project-delete tag, so enable_project_delete
  hides it as well as bm_project_delete; integration tests that delete
  projects opt in through a project_delete_enabled fixture.
- schema_infer refuses a note type with no notes as NOT_FOUND instead of
  returning an empty report as a success.
- bm_project's `recent` description says what omitting `project` does:
  the default project, and every project only when there is no default.
- bm_project_delete takes output_format; JSON carries the outcome as fields.

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 added a commit that referenced this pull request Oct 23, 2026
…nt docs

Codex review on #1839:
- delete_project carries the project-delete tag, so enable_project_delete
  hides it as well as bm_project_delete; integration tests that delete
  projects opt in through a project_delete_enabled fixture.
- schema_infer refuses a note type with no notes as NOT_FOUND instead of
  returning an empty report as a success.
- bm_project's `recent` description says what omitting `project` does:
  the default project, and every project only when there is no default.
- bm_project_delete takes output_format; JSON carries the outcome as fields.

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 force-pushed the feat/1832-grouped-tools branch from a099356 to d6bb3cf Compare October 23, 2026 15:31
@phernandez
phernandez force-pushed the feat/1832-grouped-tools branch from d6bb3cf to 813f977 Compare October 23, 2026 15:33
phernandez added a commit that referenced this pull request Oct 23, 2026
…nt docs

Codex review on #1839:
- delete_project carries the project-delete tag, so enable_project_delete
  hides it as well as bm_project_delete; integration tests that delete
  projects opt in through a project_delete_enabled fixture.
- schema_infer refuses a note type with no notes as NOT_FOUND instead of
  returning an empty report as a success.
- bm_project's `recent` description says what omitting `project` does:
  the default project, and every project only when there is no default.
- bm_project_delete takes output_format; JSON carries the outcome as fields.

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 added a commit that referenced this pull request Oct 23, 2026
The `bm tool schema-validate|infer|diff` wrappers called the MCP tools
directly and fell into the generic error path on a NOT_FOUND refusal,
exiting 1. They now share run_schema_tool (moved to command_utils) with
`bm schema`, so both print {"error": message} and exit 0. Codex review
on #1839.

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 added a commit that referenced this pull request Oct 23, 2026
…nt docs

Codex review on #1839:
- delete_project carries the project-delete tag, so enable_project_delete
  hides it as well as bm_project_delete; integration tests that delete
  projects opt in through a project_delete_enabled fixture.
- schema_infer refuses a note type with no notes as NOT_FOUND instead of
  returning an empty report as a success.
- bm_project's `recent` description says what omitting `project` does:
  the default project, and every project only when there is no default.
- bm_project_delete takes output_format; JSON carries the outcome as fields.

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 force-pushed the feat/1832-grouped-tools branch from 7f06223 to b25f50a Compare October 23, 2026 15:37
phernandez added a commit that referenced this pull request Oct 23, 2026
The `bm tool schema-validate|infer|diff` wrappers called the MCP tools
directly and fell into the generic error path on a NOT_FOUND refusal,
exiting 1. They now share run_schema_tool (moved to command_utils) with
`bm schema`, so both print {"error": message} and exit 0. Codex review
on #1839.

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>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b25f50a1f6

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/mcp/tools/projects.py Resolved
@phernandez
phernandez force-pushed the feat/1832-grouped-tools branch from b25f50a to 7a5770d Compare October 23, 2026 15:41
phernandez added a commit that referenced this pull request Oct 23, 2026
…nt docs

Codex review on #1839:
- delete_project carries the project-delete tag, so enable_project_delete
  hides it as well as bm_project_delete; integration tests that delete
  projects opt in through a project_delete_enabled fixture.
- schema_infer refuses a note type with no notes as NOT_FOUND instead of
  returning an empty report as a success.
- bm_project's `recent` description says what omitting `project` does:
  the default project, and every project only when there is no default.
- bm_project_delete takes output_format; JSON carries the outcome as fields.

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 added a commit that referenced this pull request Oct 23, 2026
The `bm tool schema-validate|infer|diff` wrappers called the MCP tools
directly and fell into the generic error path on a NOT_FOUND refusal,
exiting 1. They now share run_schema_tool (moved to command_utils) with
`bm schema`, so both print {"error": message} and exit 0. Codex review
on #1839.

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 added a commit that referenced this pull request Oct 23, 2026
delete_project takes no output_format, so in a constrained session a JSON
caller got its refusal as text. Refusal.rendered_as() re-renders a
delegated refusal in the caller's format, and bm_project_delete uses it.
Codex review on #1839.

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 force-pushed the feat/1832-grouped-tools branch from ed24fde to 5c344da Compare October 23, 2026 15:56
phernandez added a commit that referenced this pull request Oct 23, 2026
…nt docs

Codex review on #1839:
- delete_project carries the project-delete tag, so enable_project_delete
  hides it as well as bm_project_delete; integration tests that delete
  projects opt in through a project_delete_enabled fixture.
- schema_infer refuses a note type with no notes as NOT_FOUND instead of
  returning an empty report as a success.
- bm_project's `recent` description says what omitting `project` does:
  the default project, and every project only when there is no default.
- bm_project_delete takes output_format; JSON carries the outcome as fields.

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 added a commit that referenced this pull request Oct 23, 2026
The `bm tool schema-validate|infer|diff` wrappers called the MCP tools
directly and fell into the generic error path on a NOT_FOUND refusal,
exiting 1. They now share run_schema_tool (moved to command_utils) with
`bm schema`, so both print {"error": message} and exit 0. Codex review
on #1839.

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 added a commit that referenced this pull request Oct 23, 2026
delete_project takes no output_format, so in a constrained session a JSON
caller got its refusal as text. Refusal.rendered_as() re-renders a
delegated refusal in the caller's format, and bm_project_delete uses it.
Codex review on #1839.

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 added a commit that referenced this pull request Oct 23, 2026
The `bm tool schema-validate|infer|diff` wrappers called the MCP tools
directly and fell into the generic error path on a NOT_FOUND refusal,
exiting 1. They now share run_schema_tool (moved to command_utils) with
`bm schema`, so both print {"error": message} and exit 0. Codex review
on #1839.

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 force-pushed the feat/1832-grouped-tools branch from 659572b to add5ce5 Compare October 23, 2026 17:44
phernandez added a commit that referenced this pull request Oct 23, 2026
delete_project takes no output_format, so in a constrained session a JSON
caller got its refusal as text. Refusal.rendered_as() re-renders a
delegated refusal in the caller's format, and bm_project_delete uses it.
Codex review on #1839.

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 added a commit that referenced this pull request Oct 23, 2026
…s NOT_FOUND

Codex review on #1839:
- DriftReport carries notes_compared; schema_diff (and so bm_schema diff)
  refuses a type with a schema but no notes as NOT_FOUND instead of
  reporting "no drift" for a comparison that never ran. A server that
  predates the field reports null and is not refused.
- delete_project refuses a missing project as NOT_FOUND instead of a bare
  ValueError, so bm_project_delete renders it in the requested format.

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 added a commit that referenced this pull request Oct 23, 2026
…eep the format

Codex review on #1839:
- `recent` in JSON returns {"results": rows}, or {"results": [],
  "guidance": ...} for a never-indexed project, instead of a bare string
  in that case. The same shape bm_search uses.
- bm_project_delete renders the API's own refusals (deleting the default
  project) in the requested format through api_refusal.

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 added a commit that referenced this pull request Oct 23, 2026
Codex review on #1839: bm_project_delete wrapped delete_project's prose
in JSON, hard-coding action "deleted" and echoing the caller's
delete_notes. A Cloud delete always deletes files and can be queued, so
that misreported both. delete_project takes output_format and returns
the effective delete_notes, deletion_status, file_delete_status and
job_id from the API response; bm_project_delete passes the format
through. Refusal.rendered_as is no longer needed and is removed.

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>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: add5ce5814

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/mcp/tools/projects.py Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 555aee7e36

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/mcp/tools/projects.py Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd41d1216c

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/mcp/tools/projects.py Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d9b1106b0b

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

phernandez and others added 17 commits October 23, 2026 14:35
bm_project(command=list|create|recent):
- Delegates to list_memory_projects (already grouped by workspace),
  create_memory_project and recent_activity, with the shared parameter
  types (`since`, `items`, paging, `project`).
- `delete` is opt-in: the tool is registered twice under one name, a
  `core` version and a `with-delete` version. The composition root shows
  one from the new enable_project_delete setting (off by default), so
  tools/list never varies per connection and the destructive annotation
  is true only when delete exists.
- A constrained session refuses create/delete as UNSUPPORTED instead of
  the old success payload describing the failure.

bm_schema(command=validate|infer|diff):
- Calls SchemaClient directly; "no schemas", "no notes of this type",
  "no schema for this type" and "nothing above the threshold" are
  NOT_FOUND refusals that point to the next bm_* call (C11).
- The report formatters move to mcp/schema_reports.py, shared with the
  legacy schema tools, whose output is unchanged.

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>
…own tool

- bm_project and bm_schema are both thin dispatchers over the tools they
  replace. The replaced tools now refuse instead of returning a success
  that describes a failure (#1813):
  - schema_validate/infer/diff: "no schemas", "no notes of this type",
    "no schema for this type" and "nothing above the threshold" are
    NOT_FOUND refusals carrying the old guidance; the broad
    `except Exception` blocks that turned API failures into success
    text are gone.
  - create_memory_project/delete_project: a constrained session is an
    UNSUPPORTED refusal.
- Project delete is a separate tool, bm_project_delete, listed only when
  enable_project_delete is on (tag visibility, like enable_posix_tools).
  bm_project is never destructive; the two-version registration and the
  schema_reports move are gone.
- refusal() returns a typed Refusal (a ToolError with code/message), so
  in-process callers branch on the code: `bm schema validate|infer|diff`
  still print "nothing to report" and exit 0.

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>
…nt docs

Codex review on #1839:
- delete_project carries the project-delete tag, so enable_project_delete
  hides it as well as bm_project_delete; integration tests that delete
  projects opt in through a project_delete_enabled fixture.
- schema_infer refuses a note type with no notes as NOT_FOUND instead of
  returning an empty report as a success.
- bm_project's `recent` description says what omitting `project` does:
  the default project, and every project only when there is no default.
- bm_project_delete takes output_format; JSON carries the outcome as fields.

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>
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>
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>
The `bm tool schema-validate|infer|diff` wrappers called the MCP tools
directly and fell into the generic error path on a NOT_FOUND refusal,
exiting 1. They now share run_schema_tool (moved to command_utils) with
`bm schema`, so both print {"error": message} and exit 0. Codex review
on #1839.

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>
delete_project takes no output_format, so in a constrained session a JSON
caller got its refusal as text. Refusal.rendered_as() re-renders a
delegated refusal in the caller's format, and bm_project_delete uses it.
Codex review on #1839.

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>
…s NOT_FOUND

Codex review on #1839:
- DriftReport carries notes_compared; schema_diff (and so bm_schema diff)
  refuses a type with a schema but no notes as NOT_FOUND instead of
  reporting "no drift" for a comparison that never ran. A server that
  predates the field reports null and is not refused.
- delete_project refuses a missing project as NOT_FOUND instead of a bare
  ValueError, so bm_project_delete renders it in the requested format.

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>
…eep the format

Codex review on #1839:
- `recent` in JSON returns {"results": rows}, or {"results": [],
  "guidance": ...} for a never-indexed project, instead of a bare string
  in that case. The same shape bm_search uses.
- bm_project_delete renders the API's own refusals (deleting the default
  project) in the requested format through api_refusal.

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>
Codex review on #1839: bm_project_delete wrapped delete_project's prose
in JSON, hard-coding action "deleted" and echoing the caller's
delete_notes. A Cloud delete always deletes files and can be queued, so
that misreported both. delete_project takes output_format and returns
the effective delete_notes, deletion_status, file_delete_status and
job_id from the API response; bm_project_delete passes the format
through. Refusal.rendered_as is no longer needed and is removed.

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>
Codex review on #1839: the API validates the identifier's note but the
report was labeled with the caller's note_type, so one type was checked
and another reported. The two scopes are mutually exclusive and refused
together.

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>
…format

Codex review on #1839: an unknown or ambiguous workspace selector raised
ValueError before the project request, reaching JSON callers as plain
text. _resolve_workspace_routing turns it into an INVALID_ARGUMENTS
refusal in the caller's format, for project create and delete alike.

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>
… format

The API-refusal translation moves from the bm_project_delete wrapper into
the shared delete_project implementation, so both registered tools honor
output_format when the API refuses (deleting the default project).

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>
API refusals from the project client arrive as plain-text ToolErrors.
refusals.api_refusals(output_format) re-renders them in the requested
format, and project creation (a path inside another project, a colliding
permalink) and deletion both run their client call inside it, so
bm_project create and the legacy create tool honor output_format too.

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>
recent_activity_page returns text, or RecentRows (rows plus paging) for
JSON callers. The legacy recent_activity tool is a wrapper that keeps its
list-of-rows JSON, and bm_project(command='recent') returns the rows with
page, page_size and has_more. In discovery mode has_more is true when any
project has another page.

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>
…idance

Discovery mode returned the first unindexed project's guidance and stopped,
hiding the activity of every other project. It now checks every project:
with no activity anywhere it returns the indexing guidance as before;
otherwise text appends each unindexed project's guidance after the summary,
and bm_project(command='recent') JSON returns the rows with a `guidance`
field.

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>
schema_validate, schema_infer and schema_diff run their SchemaClient call
inside api_refusals(output_format), so an invalid schema definition (a 400
from the API) reaches bm_schema and the legacy schema tools as a refusal in
the requested format, as project create and delete already do.

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>
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