feat(pkg)!: v0.4.0 — installable package, new backends, scenarios, API server - #35
Merged
Conversation
5 tasks
8 tasks
There was a problem hiding this comment.
Pull request overview
This release-sized PR migrates MemoryLens into an installable memorylens Python package and ships v0.4.0 feature additions (new memory backends, scenario framework, contradiction metric, FastAPI server, dashboard history) alongside expanded CI and integration test coverage.
Changes:
- Package namespace migration to
memorylenswith a newmemorylensCLI entry point, plus PyPI-ready build metadata and optional extras. - New capabilities: GraphMemory + FAISSMemory backends, scenario registry (default/edtech/support/medical), contradiction metric wired through benchmark/logging/dashboard, and a job-based FastAPI server.
- CI and tests expanded (Py 3.10–3.13 matrix, OS coverage, build/wheel smoke test; many new integration tests).
Reviewed changes
Copilot reviewed 35 out of 52 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| utils/init.py | (Unchanged content shown) package init placeholder. |
| tests/test_pipeline.py | Updates imports for new package namespace; adds integration/regression tests for v0.4 features. |
| tests/test_imports.py | Updates import smoke test to validate v0.4 registries/exports. |
| ROADMAP.md | Updates roadmap status to reflect v0.4 shipped scope and v0.5 next items. |
| requirements.txt | Refreshes dev requirements and adds new deps (networkx/fastapi/uvicorn). |
| README.md | Major README refresh: install/extras, new backends/scenarios, results tables, API/dashboard usage. |
| quick_demo.py | Updates imports and refreshes cost projection output formatting. |
| pyproject.toml | Fixes build backend; sets v0.4.0 metadata; defines extras; configures package discovery and pytest. |
| memorylens/utils/providers.py | Updates usage docs to reflect new import path. |
| memorylens/utils/llm.py | Adds Groq-backed LLM helper wrapper used by LLM compression/judging. |
| memorylens/utils/embeddings.py | Adds local embedding utilities (sentence-transformers wrapper) under package namespace. |
| memorylens/utils/init.py | Package init placeholder. |
| memorylens/simulator/scenarios/medical.py | Adds medical scenario definition and filler turns. |
| memorylens/simulator/scenarios/edtech.py | Wraps edtech constants into a Scenario object; updates imports. |
| memorylens/simulator/scenarios/customer_support.py | Adds customer-support scenario (named support) and filler turns. |
| memorylens/simulator/scenarios/base.py | Introduces Scenario dataclass and validation helper. |
| memorylens/simulator/scenarios/init.py | Adds scenario registry + getters/listing. |
| memorylens/simulator/personas.py | Adds persona pool under new namespace for multi-seed runs. |
| memorylens/simulator/facts.py | Adds Fact dataclass + BENCHMARK_FACTS under new namespace. |
| memorylens/simulator/conversation.py | Adds conversation generator with optional scenario filler turns. |
| memorylens/simulator/init.py | Package init placeholder. |
| memorylens/memory/vector_faiss.py | Adds FAISS-backed vector memory backend with optional dependency guard. |
| memorylens/memory/summary.py | Updates LLM compression import to new namespace. |
| memorylens/memory/rag.py | Updates embeddings import path to new namespace. |
| memorylens/memory/rag_chunked.py | Updates embeddings import path to new namespace. |
| memorylens/memory/naive.py | Adds naive memory backend under new namespace. |
| memorylens/memory/graph.py | Adds GraphMemory backend using NetworkX. |
| memorylens/memory/entity.py | Adds EntityMemory backend + shared regex extractor. |
| memorylens/memory/decay.py | Adds decay registry/functions under new namespace. |
| memorylens/memory/cascading.py | Fixes cold-tier merge regression behavior and empty-summary appends; updates embeddings import path. |
| memorylens/memory/base.py | Adds BaseMemory ABC and shared token_count helper. |
| memorylens/memory/init.py | Package init placeholder. |
| memorylens/evaluation/stats.py | Adds aggregation + forgetting-curve fitting utilities. |
| memorylens/evaluation/metrics.py | Updates imports; adds contradiction_score metric; updates provider helper imports. |
| memorylens/evaluation/logger.py | Updates CSV logging to handle new metric column and rotate schema mismatches. |
| memorylens/evaluation/llm_judge.py | Updates imports to new namespace for judging pipeline. |
| memorylens/evaluation/benchmark.py | Registers new backends; wires contradiction into checkpoints and display dict; updates imports. |
| memorylens/evaluation/init.py | Package init placeholder. |
| memorylens/cli.py | New primary CLI implementation (used by console script). |
| memorylens/api.py | Adds FastAPI server with async job execution via threads and status polling endpoints. |
| memorylens/init.py | Exposes version and top-level benchmark API + registries. |
| main.py | Backward-compatible shim delegating to memorylens.cli. |
| docs/why-memory-evaluation-matters.md | Doc wording updates for accuracy/clarity. |
| docs/comparison-with-existing-tools.md | Updates comparison table to reflect 8 backends. |
| docs/adding-a-new-backend.md | Updates paths/examples to new package namespace; documents shipped backends. |
| demo_results.json | Refreshes demo payload schema/metrics for v0.4 outputs. |
| dashboard.py | Adds new backends/colors, contradiction KPI, and run history comparison tab; updates imports. |
| CONTRIBUTING.md | Updates install/test commands and repository structure for v0.4 package layout. |
| CITATION.cff | Updates abstract/version/date for v0.4 release metadata. |
| CHANGELOG.md | Adds v0.4.0 changelog entry and clarifies removed/stale references. |
| .gitignore | Adds new benchmark output artifacts to ignore. |
| .github/workflows/ci.yml | Expands CI matrix (3.10–3.13 + OS coverage) and adds build/wheel validation job. |
Comments suppressed due to low confidence (2)
memorylens/evaluation/metrics.py:70
- contradiction_score() has the same two failure modes as temporal_drift_score():
updated_at=0is treated as no update, andnew_valbecomes "" when updated_value is None, which will always match and can yield false contradictions. Validateupdated_at is not Noneand require updated_value to be present before computing.
memorylens/evaluation/benchmark.py:185 - drift_facts (defined just above) is filtered with a truthiness check on updated_at, which will incorrectly exclude updates at turn 0. It also doesn’t exclude facts with updated_at set but missing updated_value, which can make contradiction/drift calculations misleading.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Restructure all code under a single installable 'memorylens' package: - Fix invalid build-backend (setuptools.backends.legacy:build -> build_meta); the sdist was previously unbuildable and the wheel shipped four generic top-level packages (memory, utils, evaluation, simulator) - 'memorylens' console entry point (memorylens.cli:main); python main.py kept as a thin wrapper - Lean core deps + [dashboard]/[server]/[faiss]/provider/[all]/[dev] extras - CI matrix: Python 3.10-3.13 on Linux + Windows/macOS, plus build job with twine check and wheel-install smoke test New features: - GraphMemory: NetworkX knowledge-graph backend, in-place fact updates - FAISSMemory: FAISS IndexFlatIP vector backend (optional extra) - contradiction_score metric: detects old+new fact values co-occurring in retrieved context; wired through checkpoints, display dict, and CSV logs - Scenario framework (Scenario dataclass + registry) with support and medical scenarios alongside edtech/default; --scenario/--list-scenarios - FastAPI server: job-based POST /v1/benchmarks, GET /v1/backends, /v1/scenarios, /health (uvicorn memorylens.api:app) Fixes: - Cascading cold-tier recall regression: newest-first cold-summary merging truncated away the oldest facts (recall at T=100 collapsed from ~75% to ~8%). Merge oldest-first again — update patching already rewrites stale values in place — and stop appending empty 'No key facts.' summaries. Regression tests added. - Experiment CSV logger crashed on the has_llm_eval bool key; now skips non-backend keys and rotates the CSV on schema changes. 16 new integration tests (38 total), all passing without an API key. Closes #14 Closes #20 Closes #21 Closes #22 Closes #23 Closes #24 Closes #25 Closes #30 Closes #31 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> # Conflicts: # memorylens/evaluation/logger.py # memorylens/utils/migrate_legacy_logs.py # memorylens/utils/storage.py # tests/test_pipeline.py
- Run History tab: overlay Recall@T curves from past experiment_logs runs and compare final metrics side-by-side (#27). Handles both single-seed and multi-seed log schemas. - Backend multiselect now offers all 8 registered backends with per-backend colors; contradiction KPI card added. - Cost table relabelled as an illustrative USD projection with the pricing assumption stated in the UI (was an unexplained INR figure); savings callout now reports measured token reduction instead of a cost claim. - Removed unrelated third-party logo from the sidebar. Closes #27 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- README rewritten: pip-install-first quick start, extras table, results tables regenerated from actual v0.4.0 runs (100-turn and 200-turn stress test), explicit caveats where the benchmark's templated facts favour extraction backends - Removed: dead links to paper/memorylens_paper.md (file never existed in the repo), 'the only evaluation framework' superlatives, stale benchmark numbers that no longer reproduce - ROADMAP: v0.4 marked shipped, benchmark-realism items added for v0.5 - CHANGELOG: full 0.4.0 entry; Unreleased section dated as 0.3.0; stale paper bullet annotated - CONTRIBUTING and docs/ updated to the memorylens package layout and the Scenario registry workflow - CITATION.cff bumped to 0.4.0 Closes #29 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Integrates #26 (SQLite persistent storage, contributed by @Sugaria0427) with the v0.4.0 package restructure: - utils/storage.py and utils/migrate_legacy_logs.py moved to memorylens/utils/ with package-relative imports - Log directory now resolves to the working directory (overridable via MEMORYLENS_LOG_DIR) instead of a path relative to the installed package — pip installs must never write into site-packages - storage metric schema extended with the contradiction metric - logger gains get_run_results(run_id) (SQLite first, JSON fallback); dashboard Run History reads through it instead of the removed 'path' key - migration usage: python -m memorylens.utils.migrate_legacy_logs - contributor's 7 storage/logger tests merged into the suite (45 total) - author surname corrected to Daftary in citation metadata Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The summary CSV is regenerated on every logged run (and rotated on schema changes); only the sample test_run.json stays tracked for the legacy migration path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Neal006
force-pushed
the
feat/v0.4.0-pypi-release
branch
from
July 3, 2026 20:08
50d1a07 to
4d9128d
Compare
groq moved to an optional extra in the packaging split, but utils/llm.py still imported it at module level — importing memorylens without the [groq] extra crashed (caught by CI, missed locally where groq was installed). The import now happens inside get_client() with an install hint, matching how providers.py already handles optional SDKs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review feedback from PR #35: - API rejects checkpoints outside 1..turns with 422 instead of silently extending the run horizon - drift/contradiction guards use 'updated_at is not None' (a turn-0 update was treated as no update) and require updated_value before computing — an empty new value matched every chunk and produced false contradictions Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Release-sized PR that makes MemoryLens pip-installable and closes every remaining v0.4 issue except #28 (HuggingFace, intentionally skipped).
Packaging (#30)
build-backend = "setuptools.backends.legacy:build"is not a valid backend (sdist builds failed), and the wheel shipped four generic top-level packages (memory,utils,evaluation,simulator) that would collide with other installs. Everything now lives under a singlememorylenspackage.pip install memorylens→memorylensCLI (memorylens.cli:main).python main.pystill works.[dashboard][server][faiss][groq][openai][anthropic][all][dev]extras.python -m build,twine check, wheel-install smoke test). Verified locally: wheel installs in a fresh venv, entry point runs.Features
--scenario/--list-scenariosPOST /v1/benchmarks, poll for resultsFixes
has_llm_evalwas added (bool indexed as dict).Docs (#29)
paper/memorylens_paper.mdlinks (file never existed), "the only evaluation framework" superlatives, stale results, fabricated ₹-cost projections.Tests
38 integration tests (16 new), all passing without an API key on Python 3.13/Windows locally.
Closes #14, #20, #21, #22, #23, #24, #25, #27, #29, #30, #31
🤖 Generated with Claude Code