Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ See `.claude/commands/release/release.md` (and `beta.md`, `release-check.md`, `c
- Fetch cloud changes (cloud -> local): `basic-memory cloud pull --name "name"` (Team-safe; additive, never deletes local)
- Upload local changes (local -> cloud): `basic-memory cloud push --name "name"` (Team-safe; additive, never deletes cloud)
- Resolve conflicts on push/pull: `--on-conflict [fail|keep-local|keep-cloud|keep-both]` (default `fail` lists conflicts and aborts, git-style)
- Deprecated (#1596), Personal workspaces only, to be removed: `basic-memory cloud sync` (one-way mirror; deletes cloud files missing locally), `basic-memory cloud bisync` and `bisync-reset` (two-way mirror). They warn on every run; use pull/push.
- Removed in 1.0 (#1845): `basic-memory cloud sync`, `bisync`, and `bisync-reset`. They exit nonzero with migration guidance and transfer nothing; use pull/push.

### MCP Capabilities

Expand All @@ -467,7 +467,7 @@ Basic Memory now supports cloud synchronization and storage (requires active sub
**File Sync:**
- `bm cloud pull` / `bm cloud push`: additive, git-style transfers on Personal and Team workspaces
- Conflict resolution with `--on-conflict`
- rclone bisync is deprecated (#1596)
- The rclone mirror commands (`sync`, `bisync`) were removed in 1.0 (#1845)

**Cloud Project Management:**
- Create and manage projects in the cloud
Expand Down
33 changes: 20 additions & 13 deletions docs/1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,23 @@ neither implies that the current published release includes the change.

## Cloud transfers: replace sync and bisync with push/pull

**Status:** planned for v1.0; implementation tracked in
[#1845](https://github.com/basicmachines-co/basic-memory/issues/1845).
**Status:** implemented on the development branch for 1.0
([#1845](https://github.com/basicmachines-co/basic-memory/issues/1845)).
This completes the deprecation introduced through
[#1596](https://github.com/basicmachines-co/basic-memory/issues/1596).

### What is being removed
### What was removed

- `bm cloud sync`: destructive one-way mirroring from local files to Cloud.
- `bm cloud bisync`: bidirectional mirroring.
- `bm cloud bisync-reset`: initialization/reset of bisync state.

The plan is to retain migration-only stubs for these command names in 1.0. They will
exit nonzero with replacement instructions and perform no transfers or deletions.
They will not silently invoke push or pull.
The command names remain as migration-only stubs, hidden from `bm cloud --help`.
Each one prints replacement instructions and exits with status 1. It reads no
credentials, calls no Cloud API, and transfers or deletes nothing. The stubs do not
invoke push or pull.

`bm project remove` no longer deletes a project's old bisync state directory.

### Why

Expand Down Expand Up @@ -51,8 +54,8 @@ bm cloud push --name research
```

Use `--workspace <workspace-slug>` when the project name is ambiguous. Existing
local path configuration remains useful. `bm cloud sync-setup` is not being removed
by this change: it configures that path, rather than running the legacy mirror.
local path configuration remains useful. `bm cloud sync-setup` is not removed by
this change: it configures that path, rather than running the legacy mirror.
Personal transfers still use shared rclone setup; Team transfers use WebDAV with
project-level authorization and do not require rclone setup.

Expand Down Expand Up @@ -118,15 +121,19 @@ bm cloud pull --name research --on-conflict keep-both
5. Handle intentional deletion or rename cleanup separately, after reviewing the
affected files. Do not assume a missing local file authorizes Cloud deletion.

The removal must not automatically delete local files, Cloud files, credentials,
or old bisync state directories. Existing backups and snapshots remain independent
of transfer commands. Removing `cloud check` is outside this migration's scope.
The removal does not delete local files, Cloud files, credentials, or old bisync
state directories (`~/.basic-memory/bisync-state/`, or `bisync-state/` under
`BASIC_MEMORY_CONFIG_DIR`). Delete that directory yourself once you no longer need
it. Existing backups and snapshots remain independent of transfer commands. Removing `cloud check` is outside this migration's scope.

### Release checklist

- [ ] Land #1845 and verify the migration-only command errors.
- [ ] Land #1845. The migration-only command errors are covered by
`tests/cli/cloud/test_removed_mirror_commands.py`.
- [ ] Verify examples against the 1.0 CLI on Personal and Team workspaces.
- [ ] Update CLI help, manuals, setup output, and public Cloud transfer guides.
- [x] Update CLI help, manuals, setup output, and repository Cloud transfer guides
(`docs/cloud-cli.md`, `bm(1)`, AGENTS.md).
- [ ] Update the public Cloud transfer guides on docs.basicmemory.com.
- [ ] Include the removal and behavioral differences in release/upgrade notes.
- [ ] Confirm no active documentation recommends sync or bisync as a transfer workflow.

Expand Down
67 changes: 22 additions & 45 deletions docs/cloud-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The cloud CLI enables you to:

`push` and `pull` never delete on the destination, so they are safe on a shared Team bucket. On Personal workspaces they run over rclone; on Team workspaces they run over WebDAV, where the service applies per-project access. You run the same commands either way.

The older rclone mirror commands (`bm cloud sync`, `bm cloud bisync`, `bm cloud bisync-reset`) are **deprecated**. They still run on Personal workspaces, refuse Team workspaces, and will be removed in a future release. See [Deprecated: rclone mirror commands](#deprecated-rclone-mirror-commands-personal-only).
The rclone mirror commands (`bm cloud sync`, `bm cloud bisync`, `bm cloud bisync-reset`) were **removed in 1.0**. See [Removed in 1.0: sync and bisync](#removed-in-10-sync-and-bisync).

## Prerequisites

Expand Down Expand Up @@ -382,8 +382,9 @@ bm cloud pull --name research --workspace acme

`push`/`pull` are deliberately simple, conflict-aware byte transfers — not a full reconciler. Without a sync baseline:

- **Deletions are not propagated.** A note deleted on one side is not removed from the other (we cannot tell an intentional delete from a file the other side never had). This is surfaced in the command output.
- **Every divergence is treated as a conflict.** We cannot tell a teammate's edit from your stale copy, so any differing file prompts a decision rather than auto-resolving.
- **Deletions are not propagated.** A note deleted on one side is not removed from the other (we cannot tell an intentional delete from a file the other side never had). This is surfaced in the command output. A later transfer in the other direction can copy the deleted file back.
- **Renames are not propagated as moves.** The file at its new path transfers, and the old path remains on the destination until you remove it.
- **Every divergence is treated as a conflict.** We cannot tell a teammate's edit from your stale copy, so any differing file prompts a decision rather than auto-resolving. There is no automatic three-way merge.

For conflict-aware *editing*, write through the MCP/API tools (which merge at the note level). A bidirectional reconciler with a real baseline is tracked in [issue #862](https://github.com/basicmachines-co/basic-memory/issues/862).

Expand Down Expand Up @@ -763,48 +764,26 @@ bm cloud status

If instance is down, wait a few minutes and retry.

## Deprecated: rclone mirror commands (Personal only)
## Removed in 1.0: sync and bisync

`bm cloud sync`, `bm cloud bisync`, and `bm cloud bisync-reset` are **deprecated and will be removed in a future release**. Use `bm cloud pull` / `bm cloud push` instead.
`bm cloud sync`, `bm cloud bisync`, and `bm cloud bisync-reset` were removed in 1.0 ([#1845](https://github.com/basicmachines-co/basic-memory/issues/1845)). `sync` made the cloud match your local folder and deleted cloud-only files, including notes created in the cloud by teammates and agents. Running any of the three now prints migration guidance and exits nonzero. It transfers, deletes, and provisions nothing.

Until removal:
- They are marked deprecated in `--help`.
- Every run prints a deprecation warning that points to `bm cloud pull --name <project>` / `bm cloud push --name <project>`.
- They still run on Personal workspaces.
- They refuse Team workspaces. As mirrors, they can delete a teammate's files on a shared bucket.
Replace them with `bm cloud pull` and `bm cloud push`:

`bm cloud check` is a legacy, Personal-only command that compares against the same mirror remote. Use `bm cloud pull --dry-run` / `bm cloud push --dry-run` to preview differences instead.

This section is kept so existing users can keep working until the commands are removed.

### sync (deprecated): one-way mirror, local → cloud

```bash
bm cloud sync --name research --dry-run
bm cloud sync --name research
```

Makes the cloud identical to local with `rclone sync`. Cloud files that are missing locally are **deleted**. Preview deletions with `--dry-run`.

### bisync (deprecated): two-way mirror, local ↔ cloud

```bash
# First run: establish a baseline
bm cloud bisync --name research --resync --dry-run
bm cloud bisync --name research --resync

# Later runs
bm cloud bisync --name research
```
| Old command | Replacement |
|---|---|
| `bm cloud sync --name research` | `bm cloud push --name research` (add `--on-conflict keep-local` for local precedence) |
| `bm cloud bisync --name research` | `bm cloud pull --name research`, then `bm cloud push --name research` |
| `bm cloud bisync-reset research` | Nothing to reset: push and pull keep no sync state |

Syncs both directions and can delete or overwrite on both sides. Conflicts resolve as newer file wins. State lives in `~/.basic-memory/bisync-state/<project>/`.
How the replacements differ from mirroring:

- **"First bisync requires --resync"** - Run once with `--resync` to create the baseline. Do not use `--resync` again unless you need a new baseline.
- **"Empty prior Path1 listing. Cannot sync to an empty directory"** - Bisync cannot baseline an empty directory. Add a file (for example a `README.md`) and run `--resync` again.
- **"max delete limit (25) exceeded"** - Bisync stops when a run would delete more than 25 files. Check with `--dry-run`, then run `--resync` if the deletes are intended.
- **Corrupted state or listing files** - Clear the state with `bm cloud bisync-reset research`, then run `--resync`. This does not touch your files. Removing a project also clears its bisync state.
- **Deletions are not propagated.** Delete the cloud copy yourself if you deleted a file locally, and the reverse.
- **Renames are not propagated as moves.** The old path remains on the destination until you remove it.
- **Any differing file is a conflict.** The transfer stops before copying anything. Re-run with `--on-conflict keep-local`, `keep-cloud`, or `keep-both`.
- **`push --on-conflict keep-local` is not an exact mirror.** Local content wins for differing files, but cloud-only files remain.

To move off bisync, run `bm cloud pull --name <project>` and `bm cloud push --name <project>` instead. They need no baseline or state.
Old bisync state in `~/.basic-memory/bisync-state/` is no longer used. Basic Memory does not delete it; remove it yourself if you like. To clean up cloud files that match `.bmignore`, use `bm cloud prune --name <project> --dry-run` on Personal workspaces.

### check (legacy): verify mirror integrity

Expand All @@ -813,7 +792,7 @@ bm cloud check --name research
bm cloud check --name research --one-way # faster, one direction
```

Compares checksums between local and the Personal mirror remote. No files are transferred.
Compares checksums between local and the default Personal workspace remote. No files are transferred. Use `bm cloud pull --dry-run` / `bm cloud push --dry-run` to preview differences instead.

## Security

Expand Down Expand Up @@ -890,13 +869,11 @@ bm project ls --name <project> --cloud
bm project ls --name <project> --cloud --path <subpath>
```

### Deprecated (Personal only, removed in a future release)
### Legacy (Personal only)

```bash
bm cloud sync --name <project> # Deprecated one-way mirror
bm cloud bisync --name <project> [--resync] # Deprecated two-way mirror
bm cloud bisync-reset <project> # Deprecated: clear bisync state
bm cloud check --name <project> # Legacy mirror integrity check
bm cloud check --name <project> # Legacy integrity check
bm cloud prune --name <project> [--dry-run] # Delete cloud files matching .bmignore
```

## Summary
Expand Down
2 changes: 1 addition & 1 deletion integrations/hermes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ hermes gateway restart

Tool calls now route from `bm mcp` → `<cloud_host>/proxy` over HTTPS using your OAuth token (or API key). Notes never touch local disk.

**Don't confuse cloud mode with file sync.** `bm cloud pull` / `bm cloud push` copy files between a *local* project and cloud storage, for keeping local working copies (`bm cloud bisync` is deprecated). For agent-driven capture you want true cloud routing (`set-cloud`), not file sync.
**Don't confuse cloud mode with file sync.** `bm cloud pull` / `bm cloud push` copy files between a *local* project and cloud storage, for keeping local working copies. For agent-driven capture you want true cloud routing (`set-cloud`), not file sync.

## Updating / removing

Expand Down
1 change: 1 addition & 0 deletions src/basic_memory/cli/commands/cloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from basic_memory.cli.commands.cloud.api_client import get_authenticated_headers, get_cloud_config # noqa: F401
from basic_memory.cli.commands.cloud.upload_command import * # noqa: F401,F403
from basic_memory.cli.commands.cloud.project_sync import * # noqa: F401,F403
from basic_memory.cli.commands.cloud.removed_mirror_commands import * # noqa: F401,F403

# Register snapshot sub-command group
from basic_memory.cli.commands.cloud.snapshot import snapshot_app
Expand Down
6 changes: 3 additions & 3 deletions src/basic_memory/cli/commands/cloud/core_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
get_cloud_config,
make_api_request,
)
from basic_memory.cli.commands.cloud.bisync_commands import (
BisyncError,
from basic_memory.cli.commands.cloud.mount_api import (
MountApiError,
generate_mount_credentials,
get_mount_info,
)
Expand Down Expand Up @@ -295,7 +295,7 @@ def setup(
"\n[dim]Tip: Always use --dry-run first to preview changes before syncing[/dim]"
)

except (RcloneInstallError, BisyncError, CloudAPIError) as e:
except (RcloneInstallError, MountApiError, CloudAPIError) as e:
console.print(f"\n[red]Setup failed: {literal(e)}[/red]")
raise typer.Exit(1)
except typer.Exit:
Expand Down
74 changes: 74 additions & 0 deletions src/basic_memory/cli/commands/cloud/mount_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
"""Cloud mount API calls for Personal rclone transfers.

`bm cloud setup` mints bucket-scoped storage credentials through these calls,
and the Personal `push`/`pull`/`prune`/`check` commands read the tenant's
bucket name from the mount info endpoint.
"""

from basic_memory.cli.commands.cloud.api_client import make_api_request
from basic_memory.config import ConfigManager
from basic_memory.schemas.cloud import MountCredentials, TenantMountInfo


class MountApiError(Exception):
"""Exception raised when a cloud mount API call fails."""

pass


def _workspace_id_header(workspace_id: str | None) -> dict[str, str]:
"""Header that routes a /tenant/mount/* request to a specific tenant.

The mount endpoints resolve the workspace from X-Workspace-ID (validating
membership + subscription) and fall back to the user's default tenant when
it is absent — so omitting it preserves the original default-tenant behavior.
"""
return {"X-Workspace-ID": workspace_id} if workspace_id else {}


async def get_mount_info(*, workspace_id: str | None = None) -> TenantMountInfo:
"""Get tenant mount info (bucket name + tenant id) from the cloud API.

Args:
workspace_id: Tenant id of the target workspace. When omitted, the API
uses the authenticated user's default tenant.
"""
try:
config_manager = ConfigManager()
config = config_manager.config
host_url = config.cloud_host.rstrip("/")

response = await make_api_request(
method="GET",
url=f"{host_url}/tenant/mount/info",
headers=_workspace_id_header(workspace_id),
)

return TenantMountInfo.model_validate(response.json())
except Exception as e:
raise MountApiError(f"Failed to get tenant info: {e}") from e


async def generate_mount_credentials(tenant_id: str) -> MountCredentials:
"""Generate scoped S3 credentials for transfers against a tenant's bucket.

Args:
tenant_id: Tenant id whose bucket-scoped credentials to mint. Routed via
X-Workspace-ID so team workspaces get their own bucket's credentials.
"""
try:
config_manager = ConfigManager()
config = config_manager.config
host_url = config.cloud_host.rstrip("/")

# The mount endpoints resolve X-Workspace-ID by matching the workspace's
# tenant_id, so passing a tenant_id here is the correct routing key.
response = await make_api_request(
method="POST",
url=f"{host_url}/tenant/mount/credentials",
headers=_workspace_id_header(tenant_id),
)

return MountCredentials.model_validate(response.json())
except Exception as e:
raise MountApiError(f"Failed to generate credentials: {e}") from e
Loading
Loading