Repository navigation
Conversation
code-review-graph reviewOverall risk: 0.85 (CRITICAL) — 500 changed function(s)/class(es), 29 affected flow(s), 325 test gap(s) (281 with no tested caller found, 44 reached only through a caller) Risk-scored changes
Affected execution flows
Test gaps
Reached only through a callerNo test names these directly, but a tested caller reaches them along the call path shown. That is a path in the call graph, not a record of execution -- the caller's tests may never take this branch. Treat it as where to look, not as coverage: these count as gaps and are scored as untested.
Token savings: this graph-backed report used ~67,695 fewer tokens (~40%) than reading every changed file in full (estimated, chars/4 approximation).
Powered by code-review-graph — local-first analysis; no code leaves the CI runner. |
There was a problem hiding this comment.
🟡 Changes recommended
Obsolete imports and workspace-contract mismatches prevent the frontend from loading, while additional memory-handling defects can restore forgotten preferences and exclude newly captured ones.
7 open issues
Remove obsolete sessionNames import from the memory drawer · New Migrate the handoff script and guards to the shared-workspace contract · New Block updates that reintroduce forgotten or superseded content · New Use creation timestamps to prioritize newly added memories · New Prevent automatic duplicates from restoring forgotten memories · New Replace removed chat-switching assertions with shared-workspace tests · New Update tests for shared-workspace state and the replay API · New
What changed in this PR
Adds a standalone agent-memory layer alongside the existing Python code graph. User prompts contribute to one workspace-wide memory graph, while retrieval reads memory before querying the separate code index.
Changes:
- Adds a persistent SQLite API with provenance, corrections, forgetting, migration and concurrency protection.
- Adds CLI, MCP and Codex-hook integration with private retry storage and ordered context retrieval.
- Includes a Lovable source mirror, regression tests, setup documentation and 4K explainer source.
| File | Description |
|---|---|
agent-memory/tests/layered-bridge.test.mjs |
Tests layered hook context and capability discovery. |
agent-memory/tests/layered-api.test.mjs |
Tests retrieval ordering, readiness and revision conflicts. |
agent-memory/tests/integration-bridge-api.test.mjs |
Exercises prompt capture through the bridge and API. |
agent-memory/tests/backend-shared.test.mjs |
Tests shared ownership, provenance and legacy migration. |
agent-memory/README.md |
Introduces shared memory and delivery scope. |
agent-memory/README-bridge.md |
Documents tool integration and offline behavior. |
agent-memory/README-backend.md |
Documents API setup, persistence and limits. |
agent-memory/package.json |
Defines Node requirements and package commands. |
agent-memory/lovable-app/src/routes/index.tsx |
Registers the memory workspace route and metadata. |
agent-memory/lovable-app/src/routes/__root.tsx |
Adds the application shell and error boundaries. |
agent-memory/lovable-app/src/lib/memory/live.test.ts |
Tests live API validation and request handling. |
agent-memory/lovable-app/src/lib/memory/graph.test.ts |
Adds memory replay and mutation assertions. |
agent-memory/lovable-app/src/lib/codegraph/handoff.ts |
Implements staged demo retrieval and context preparation. |
agent-memory/lovable-app/src/lib/codegraph/handoff.test.ts |
Tests handoff ordering and graph separation. |
agent-memory/lovable-app/src/lib/codegraph/existing.ts |
Defines code-graph adapters and sample data. |
agent-memory/lovable-app/src/components/memory/TwoGraphStage.tsx |
Visualizes the two-graph retrieval sequence. |
agent-memory/lovable-app/src/components/memory/TwoGraphStage.test.tsx |
Tests visualization and replay controls. |
agent-memory/lovable-app/src/components/memory/RetrievalStatus.tsx |
Displays retrieval readiness and context previews. |
agent-memory/lovable-app/src/components/memory/MemoryDrawers.tsx |
Adds context and connection drawers. |
agent-memory/lovable-app/src/components/memory/LiveReconnect.test.tsx |
Tests saved-mode and paired-tab reconnection. |
agent-memory/lovable-app/roadmap.md |
Records frontend milestones and deployment exclusions. |
agent-memory/docs/video/voiceover.txt |
Supplies the timed narration script. |
agent-memory/docs/video/voiceover.srt |
Supplies timed captions. |
agent-memory/docs/video/motion/render.mjs |
Bundles, renders and muxes the explainer. |
agent-memory/docs/video/motion/README.md |
Documents rendering inputs and workflow. |
agent-memory/docs/video/motion/package.json |
Declares animation and rendering dependencies. |
agent-memory/docs/video/motion/index.jsx |
Registers the 60-second 4K composition. |
agent-memory/docs/video/motion/.gitignore |
Excludes rendering dependencies and generated directories. |
agent-memory/docs/verification.md |
Records reported synthetic and live verification. |
agent-memory/docs/superpowers/specs/2026-10-06-memory-lens-live-design.md |
Defines shared-memory boundaries and retrieval order. |
agent-memory/docs/superpowers/plans/2026-10-06-memory-lens-live.md |
Records implementation milestones and remaining steps. |
agent-memory/docs/diagrams/memory-flow.svg |
Illustrates capture, editing and separate graph retrieval. |
agent-memory/bridge/state.mjs |
Persists private bridge state and prompt tombstones. |
agent-memory/bridge/mcp.mjs |
Exposes memory operations over stdio MCP. |
agent-memory/bridge/install.mjs |
Installs project-local Codex hooks with backups. |
agent-memory/bridge/hooks.mjs |
Captures user prompts and formats bounded context. |
agent-memory/bridge/existing-graph.mjs |
Queries an operator-selected code-graph MCP server. |
agent-memory/bridge/client.mjs |
Coordinates ingestion, retries and revision caching. |
agent-memory/bridge/api.mjs |
Handles authenticated requests and endpoint validation. |
agent-memory/bin/memory-lens.mjs |
Provides CLI, hook and MCP entry points. |
agent-memory/backend/store.mjs |
Stores shared memory and migrates legacy graphs. |
agent-memory/backend/service.mjs |
Coordinates mutations and memory-first retrieval. |
agent-memory/backend/server.mjs |
Hosts the authenticated local HTTP API. |
agent-memory/backend/provider.mjs |
Requests structured, user-only memory extraction. |
agent-memory/backend/graph.mjs |
Validates graph edits and ranks active context. |
agent-memory/backend/errors.mjs |
Defines API errors and field validation. |
Review effort: Balanced
| import { useState } from "react"; | ||
| import { Button } from "@/components/ui/button"; | ||
| import { Sheet, SheetContent, SheetDescription, SheetTitle } from "@/components/ui/sheet"; | ||
| import { demoAdapter, sessionNames, type GraphState } from "@/lib/memory/graph"; |
| | { kind: "stage"; caption: string } | ||
| | { kind: "edit"; command: string; caption: string }; | ||
|
|
||
| export const demoScripts: Record<SessionId, DemoStep[]> = { |
| } else if (operation.op === 'update') { | ||
| const node = scopedNode(operation.node_id); | ||
| const content = contentField(operation.content); | ||
| if (kind === 'turn' && (node.status === 'forgotten' || node.history.some(entry => normalize(entry.content) === normalize(content)))) continue; |
| const lastChange = node => node.history.at(-1)?.changed_at || ''; | ||
| const ranked = active.sort((a, b) => Number(b.pinned) - Number(a.pinned) || score(b) - score(a) || lastChange(b).localeCompare(lastChange(a))); |
| const historical = new Set((original.history || []).filter(entry => ['superseded', 'forgotten'].includes(entry.status)).map(entry => normalize(entry.content))); | ||
| const predecessors = [...nodes.entries()].filter(([content]) => content !== key && historical.has(content)); | ||
| const inherited = [...nodes.values()].find(node => node.history.some(entry => normalize(entry.content) === key)); | ||
| if (!existing && !predecessors.length && inherited && original.source_kind !== 'command') { |
| fireEvent.click(screen.getByRole("button", { name: /Deployment fix/ })); | ||
| expect(screen.queryByText(/1\/11/)).toBeNull(); | ||
| fireEvent.click(screen.getByRole("button", { name: /Billing feature/ })); | ||
| expect(screen.getByText(/1\/11/)).toBeTruthy(); |
| describe("Memory graph replay adapter", () => { | ||
| it("starts Billing with exactly five scoped memories and legible relationships", () => { | ||
| const state = initialState("billing"); | ||
| expect(state.memories).toHaveLength(5); |
There was a problem hiding this comment.
🟡 Changes recommended
Obsolete imports and shared-workspace API mismatches prevent the main app from compiling, while chunk-wise UTF-8 decoding can corrupt persisted prompt text and evidence.
9 open issues
Migrate the handoff script and guards to the shared-workspace contract Remove obsolete sessionNames import from the memory drawer Exclude optional session ID from replay failure-blocking key · New Persist prompts before network activity so interrupted captures replay · New Update tests for shared-workspace state and the replay API Replace removed chat-switching assertions with shared-workspace tests Prevent automatic duplicates from restoring forgotten memories Use creation timestamps to prioritize newly added memories Block updates that reintroduce forgotten or superseded content
Review effort: Balanced
| for (const { path, value } of entries) { | ||
| const event = value.event; | ||
| if (!event || (selection && !sameSession(event, selection))) continue; | ||
| const sessionKey = JSON.stringify([event.source, event.external_session_id, event.session_id]); |
| await bridge.flush(); | ||
| await bridge.ensure(selection.source, selection.external_session_id); | ||
| base_revision = await bridge.cachedRevision(selection); |


User prompts from coding tools now accumulate in one persistent Agent memory graph per local workspace. Natural-language corrections and Forget update that graph, and context retrieval reads memory first before querying the separate existing code knowledge graph. Native chats remain source provenance rather than creating separate graphs.
The implementation is additive under
agent-memory/, with separate commits for the SQLite/OpenAI API, portable CLI/MCP/hooks and code-graph adapter, Lovable source review mirror and documentation, and product-film/live-connection refinements. The existing Python graph engine and repository configuration are unchanged. The video source renders seven distinct animated scenes at native 4K with narration and music. Live mode retains the explicitly paired connection across reloads.Validation: 84/84 offline synthetic tests pass in the exact PR subtree, covering shared ownership, user-only capture, provenance, migration/history restoration, idempotency, CAS, manual-edit protection, authenticated local API, provider boundaries and ordered retrieval. The local live workflow and original code-index retrieval were verified separately. The delivered video passes a complete decode and is exactly 60 seconds at 3840 by 2160 with H.264 video and stereo AAC audio. Run
cd agent-memory && npm testto verify the standalone package.Frontend files are a reviewed Lovable source mirror. Cloud deployment is outside this PR. Generated videos, audio, images, credentials, runtime databases and machine-specific launchers/configuration are excluded.
This PR is for review only; do not merge automatically.