Skip to content

refactor(cli,helpers,tooling): defer hook imports, split helpers, expand ruff, update Docker and docs - #93

Open
michael-denyer wants to merge 1 commit into
feat/mcp-ergonomics-and-safetyfrom
refactor/perf-structure-and-tooling
Open

michael-denyer wants to merge 1 commit into
feat/mcp-ergonomics-and-safetyfrom
refactor/perf-structure-and-tooling

Conversation

@michael-denyer

Copy link
Copy Markdown
Owner

Why

Cut CLI hook startup overhead, decompose the 1,572-line helpers.py, encode UTC and code-quality checks in Ruff, and align Docker, release scripts, and docs with the current codebase.

What changed

  • Defer rich, importlib.metadata, responses, text_parsing, and EmbeddingEngine imports on SQL-only paths, and replace the tail subprocess in log-response with collections.deque.
  • Split helpers.py into categorization.py, clustering.py, formatting.py, and scoring.py while keeping helpers.py as a re-export facade.
  • Enable Ruff B, UP, SIM, and DTZ rules in pyproject.toml, register the integration pytest marker, convert models.py enums to StrEnum, and sync .pre-commit-config.yaml ruff to v0.17.5.
  • Update Dockerfile to invoke memory-mcp directly from /app/.venv/bin with HF_HOME, make scripts/bump-version.sh cross-platform and cover skills/memory-mcp/SKILL.md, and refresh ARCHITECTURE.md, CLAUDE.md, skills/memory-mcp/SKILL.md, docs/API.md, and CHANGELOG.md.

Scope

Package init, CLI, helper modules, storage lazy imports, models, Ruff/pytest/pre-commit config, Dockerfile, bump script, and documentation.

Tradeoffs

  • Left Storage's 13-mixin class layout unchanged instead of rewriting 3,575 lines of tests/test_storage.py, because moving dashboard SQL onto Storage in PR 2 already closed the leaky boundary.
  • sqlite_vec imports numpy.typing when opened, which bounds how far SQL-only CLI startup can drop while keeping sqlite-vec loaded eagerly in storage/core.py.

Blast Radius

Backwards-compatible re-exports remain in helpers.py. Enum str() values now return the string value via StrEnum.

Verification

  • pytest -q: 476 passed, 1 skipped, 0 warnings.
  • ruff check src/ tests/ (with B, UP, SIM, DTZ) and ruff format --check src/ tests/: passed across 58 files.
  • bash -n scripts/bump-version.sh: passed.
  • memory-mcp-cli hot-cache median cold start (5 runs): 329.1ms baseline vs 275.5ms quiet post-split (316.8ms under background load after final rebase).

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