Refactor into proper Python package with pyproject.toml #1

Open
opened 2026-02-28 22:03:25 +00:00 by cal · 0 comments
Owner

Summary

Convert the flat module layout into a proper Python package with pyproject.toml for clean installation and dependency management.

Current State

All modules are flat files in the project root:

  • client.py, cli.py, common.py, analysis.py, edges.py, embeddings.py, mcp_server.py
  • CLI wrapper at ~/.local/bin/claude-memory does cd /mnt/NV2/Development/cognitive-memory && exec uv run python client.py "$@"

Target State

cognitive-memory/
├── pyproject.toml
├── src/
│   └── cognitive_memory/
│       ├── __init__.py
│       ├── client.py
│       ├── cli.py
│       ├── common.py
│       ├── analysis.py
│       ├── edges.py
│       ├── embeddings.py
│       └── mcp_server.py
├── scripts/
│   ├── session_memory.py
│   ├── edge-proposer.py
│   └── memory-git-sync.sh
└── systemd/
    └── ...

Tasks

  • Create pyproject.toml with [project.scripts] entry points
  • Move modules into src/cognitive_memory/ package
  • Fix all internal imports (currently uses relative from common import ... etc.)
  • Add __init__.py with version info
  • uv pip install -e . for development
  • Update claude-memory wrapper to use the installed entry point
  • Update MCP server config to use the installed module
  • Update scripts to use proper package imports
## Summary Convert the flat module layout into a proper Python package with `pyproject.toml` for clean installation and dependency management. ## Current State All modules are flat files in the project root: - `client.py`, `cli.py`, `common.py`, `analysis.py`, `edges.py`, `embeddings.py`, `mcp_server.py` - CLI wrapper at `~/.local/bin/claude-memory` does `cd /mnt/NV2/Development/cognitive-memory && exec uv run python client.py "$@"` ## Target State ``` cognitive-memory/ ├── pyproject.toml ├── src/ │ └── cognitive_memory/ │ ├── __init__.py │ ├── client.py │ ├── cli.py │ ├── common.py │ ├── analysis.py │ ├── edges.py │ ├── embeddings.py │ └── mcp_server.py ├── scripts/ │ ├── session_memory.py │ ├── edge-proposer.py │ └── memory-git-sync.sh └── systemd/ └── ... ``` ## Tasks - [ ] Create `pyproject.toml` with `[project.scripts]` entry points - [ ] Move modules into `src/cognitive_memory/` package - [ ] Fix all internal imports (currently uses relative `from common import ...` etc.) - [ ] Add `__init__.py` with version info - [ ] `uv pip install -e .` for development - [ ] Update `claude-memory` wrapper to use the installed entry point - [ ] Update MCP server config to use the installed module - [ ] Update scripts to use proper package imports
cal added the
ai-working
label 2026-03-04 04:01:00 +00:00
cal added
ai-failed
and removed
ai-working
labels 2026-03-04 04:11:00 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/cognitive-memory#1
No description provided.