Skip to content

fix: basic memory home env var not respected when project path is changed.#239

Merged
jope-bm merged 3 commits intomainfrom
fix/basic-memory-home-env-var-not-respected
Jul 28, 2025
Merged

fix: basic memory home env var not respected when project path is changed.#239
jope-bm merged 3 commits intomainfrom
fix/basic-memory-home-env-var-not-respected

Conversation

@jope-bm
Copy link
Copy Markdown
Contributor

@jope-bm jope-bm commented Jul 24, 2025

Addresses #219

This PR adds a new CLI command to move a project's location. The BASIC_MEMORY_HOME envvar is only used to set the project directory at startup if the main project does not already exist.

Command Syntax:

basic-memory project move main /my/new/project/path

This command will lookup a project's path in the config and update it there, then sync the new path in the BM database. It will not move your project's files and sub-directories. You will need to do that after the tool has run. BM will then create new notes, read notes, etc for the projects in the new location.

Additionally, this PR

  • Fixes a bug with config loading, so the values in the config file are not overwritten if an error occurs while reading the config file.
  • Re-enables writing to log file.

self.save_config(config)
return config
logger.exception(f"Failed to load config: {e}")
raise e
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this fixes the issue with config file being overwritten by default values. Just propagate the error.

Comment thread src/basic_memory/utils.py
diagnose=True,
enqueue=True,
colorize=False,
)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

re-enable logging to log file

jope-bm added 3 commits July 24, 2025 09:53
Signed-off-by: Joe P <joe@basicmemory.com>
Signed-off-by: Joe P <joe@basicmemory.com>
@jope-bm jope-bm force-pushed the fix/basic-memory-home-env-var-not-respected branch from 73009c7 to 01ece8e Compare July 24, 2025 16:03
@jope-bm jope-bm requested a review from phernandez July 24, 2025 16:04
Copy link
Copy Markdown
Member

@phernandez phernandez left a comment

Choose a reason for hiding this comment

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

One big thing that goes along with this is that now that we have updated the config, we need to stop watching the old project dir and start watching the new one. I think that's outside the scope of this PR, just saying.

There is a PR where I half implemented this, but I didn't love it #176

ValueError: If the project doesn't exist or repository isn't initialized
"""
if not self.repository:
raise ValueError("Repository is required for move_project")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks like Claude doing goldplating BS. We should always have a repository. But whatever.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah seems overkill. All the other service method have it, so that's probably why Claude did it here.

@jope-bm
Copy link
Copy Markdown
Contributor Author

jope-bm commented Jul 28, 2025

One big thing that goes along with this is that now that we have updated the config, we need to stop watching the old project dir and start watching the new one. I think that's outside the scope of this PR, just saying.

There is a PR where I half implemented this, but I didn't love it #176

👍

@jope-bm jope-bm merged commit 6361574 into main Jul 28, 2025
12 checks passed
@jope-bm jope-bm deleted the fix/basic-memory-home-env-var-not-respected branch July 28, 2025 20:50
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