Summary
On a brand-new config dir, the first bm project add <name> produces a wedged state: config.json contains the auto-created main project AND default_project: "main", but the projects table only contains the explicitly added project — and no row has is_default=1. Every default-project code path then fails with Project not found: 'main'.
Repro
export BASIC_MEMORY_CONFIG_DIR=/tmp/bm-fresh/config BASIC_MEMORY_HOME=/tmp/bm-fresh/home
bm project add qa /tmp/bm-fresh/notes --local
bm tool read-note "anything"
# Error during read_note: Project not found: 'main'
bm project list # shows only 'qa'
config.json after: projects = {main: $BASIC_MEMORY_HOME, qa: ...}, default_project: main. DB after: only qa, is_default empty everywhere.
Root cause (observed, not fully traced)
ConfigManager auto-creates main (config.py ~:191) when initializing a fresh config, but project add only inserts the added project into the DB — nothing reconciles the auto-created main (or the default_project pointer) into the projects table. Reconciliation presumably happens on some other path (server/sync startup), which a CLI-only flow never hits.
Severity
Combined with the set-default bug (filed separately), the user cannot self-heal from the CLI: reads fail on the missing default and bm project default <name> refuses to run. Workaround today: pass --project everywhere or hand-edit config.json.
Possible directions
- Reconcile config projects -> DB during
project add / CLI init (same reconciliation the server path uses)
- Or: don't auto-create
main/default_project in config when the first real action is an explicit project add — make the added project the default when it is the only one
Found during manual QA (same session as #972).
🤖 Generated with Claude Code
Summary
On a brand-new config dir, the first
bm project add <name>produces a wedged state: config.json contains the auto-createdmainproject ANDdefault_project: "main", but the projects table only contains the explicitly added project — and no row hasis_default=1. Every default-project code path then fails withProject not found: 'main'.Repro
config.json after:
projects = {main: $BASIC_MEMORY_HOME, qa: ...},default_project: main. DB after: onlyqa,is_defaultempty everywhere.Root cause (observed, not fully traced)
ConfigManager auto-creates
main(config.py ~:191) when initializing a fresh config, butproject addonly inserts the added project into the DB — nothing reconciles the auto-createdmain(or thedefault_projectpointer) into the projects table. Reconciliation presumably happens on some other path (server/sync startup), which a CLI-only flow never hits.Severity
Combined with the set-default bug (filed separately), the user cannot self-heal from the CLI: reads fail on the missing default and
bm project default <name>refuses to run. Workaround today: pass--projecteverywhere or hand-edit config.json.Possible directions
project add/ CLI init (same reconciliation the server path uses)main/default_projectin config when the first real action is an explicitproject add— make the added project the default when it is the only oneFound during manual QA (same session as #972).
🤖 Generated with Claude Code