Skip to content

feat(memory): native short-term KV + dual-layer resolve_context - #7

Merged
drQedwards merged 1 commit into
mainfrom
feat/memory-kv-resolve-context
Sep 1, 2026
Merged

drQedwards merged 1 commit into
mainfrom
feat/memory-kv-resolve-context

Conversation

@drQedwards

@drQedwards drQedwards commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Native short-term KV + solution engine (ppm/mcp TS port). Tools: init/peek/set/resolve/flush/resolve_context/promote_to_long_term/memory_status. mergeRankHits = unified ranking for dual-layer resolve (NOT a searchGraph bug fix; pmll#14 was harness-stub). PPM three-way only: baseline ~302ms, peek ~26ms, combined ~36ms, peek hits ~0ms. Retrieval = labeled P@k/R@k/MRR not agent accuracy; no 99% claims. No FUNDING/tools hub. Tests: 254 pass.

Upstream pitch for @forloopcodes

Title: Native short-term KV + dual-layer resolve inside Context+ (supersedes docs-only forloopcodes#46)

  • Ships documented KV/solution tools as first-class Context+ MCP tools
  • Ports ppm/mcp TS patterns; no Python dump
  • mergeRankHits for dual-layer resolve ranking without rewriting searchGraph semantics
  • Complementary pmll-memory-mcp optional for Q-promise + SQLite P0
  • Evidence: PPM three-way speeds only; no invented token-%/accuracy claims
  • Cleaner than docs-only feat(memory): native short-term KV + dual-layer resolve_context forloopcodes/contextplus#46: code+tests+docs; no FUNDING/tools hub

Summary by CodeRabbit

  • New Features
    • Added short-term session memory with caching, pending lookups, resolution, flushing, and capacity management.
    • Added unified context retrieval across short- and long-term memory.
    • Added tools for memory initialization, storage, promotion, status monitoring, and ranked search.
    • Improved search result ranking and duplicate handling.
  • Documentation
    • Updated architecture, README, and usage guidance to describe the new memory workflows and tools.
  • Tests
    • Added comprehensive coverage for memory storage, retrieval, lifecycle management, promotion, and ranking.

Port session silo (silo_size LRU), peek/set/flush/resolve, and solution
engine tools from ppm/mcp into Context+ TypeScript. Add mergeRankHits for
unified ranking in resolve_context (KV first, then graph). Docs cite PPM
three-way speed numbers only; complementary pmll-memory-mcp remains optional
for Q-promise / Python SQLite P0.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
drq-greeter-tool Error Error Sep 1, 2026 4:39am UTC

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
contextplus dbc1ba5 Sep 01 2026, 04:38 AM

@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 7b219777-34ba-41b8-98f0-7148baf4470e

📥 Commits

Reviewing files that changed from the base of the PR and between f020317 and dbc1ba5.

📒 Files selected for processing (9)
  • INSTRUCTIONS.md
  • README.md
  • agent-instructions.md
  • src/core/memory-graph.ts
  • src/core/short-term-kv.ts
  • src/core/solution-engine.ts
  • src/index.ts
  • src/tools/memory-tools.ts
  • test/main/short-term-kv.test.mjs

📝 Walkthrough

Walkthrough

The change adds session-scoped short-term KV storage, ranked long-term graph fallback, KV-to-graph promotion, memory status reporting, MCP endpoints, tests, and updated documentation.

Changes

Native memory integration

Layer / File(s) Summary
Short-term KV storage
src/core/short-term-kv.ts, test/main/short-term-kv.test.mjs
Adds session stores with LRU eviction, pending resolution, flushing, status counters, and lifecycle helpers.
Unified retrieval and promotion
src/core/memory-graph.ts, src/core/solution-engine.ts, test/main/short-term-kv.test.mjs
Merges ranked graph hits, resolves short-term context before long-term results, promotes entries, and reports combined memory status.
MCP memory tool exposure
src/tools/memory-tools.ts, src/index.ts, test/main/short-term-kv.test.mjs
Exposes KV, resolution, promotion, status, and ranking operations through validated MCP endpoints.
Memory workflow documentation
INSTRUCTIONS.md, README.md, agent-instructions.md
Documents native memory components, tools, workflows, benchmarks, and pending-status behavior.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant MCP
  participant memory_tools
  participant ShortTermKVStore
  participant solution_engine
  participant MemoryGraph
  Client->>MCP: resolve_context(sessionId, key)
  MCP->>memory_tools: toolResolveContext(...)
  memory_tools->>ShortTermKVStore: peekContext(key)
  alt short-term hit
    ShortTermKVStore-->>memory_tools: resolved value
  else miss
    memory_tools->>solution_engine: resolveContext(...)
    solution_engine->>MemoryGraph: search direct and neighbor hits
    MemoryGraph-->>solution_engine: ranked graph results
    solution_engine-->>memory_tools: long-term result or miss
  end
  memory_tools-->>MCP: JSON response
  MCP-->>Client: context result
Loading
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/memory-kv-resolve-context

Comment @coderabbitai help to get the list of available commands.

@drQedwards
drQedwards merged commit 537b4db into main Sep 1, 2026
3 of 7 checks passed
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