Kontext - an AI agent memory and RAG plugin for KurrentDB#5567
Kontext - an AI agent memory and RAG plugin for KurrentDB#5567
Conversation
Review Summary by QodoAdd KurrentDB.Plugins.Kontext — embedded agent memory plugin with MCP support
WalkthroughsDescription• Adds KurrentDB.Plugins.Kontext embedded agent memory plugin with MCP HTTP endpoint • Implements IKontextClient using internal ISystemClient for reads/writes/subscriptions • Provides KontextStreamAccessChecker for post-filtering search results against stream ACLs • Includes 21 passing tests covering client operations, MCP endpoint, and end-to-end workflows Diagramflowchart LR
Agent["Agent (Claude Code)"]
MCP["MCP HTTP Endpoint<br/>/mcp/kontext"]
Auth["Auth Middleware"]
Plugin["KontextPlugin"]
Client["KontextClient"]
SystemClient["ISystemClient"]
AccessChecker["KontextStreamAccessChecker"]
SQLite["SQLite Database<br/>FTS5 + Vector"]
Agent -->|"JSON-RPC over POST"| MCP
MCP --> Auth
Auth --> Plugin
Plugin --> Client
Plugin --> AccessChecker
Client --> SystemClient
AccessChecker --> SystemClient
Plugin --> SQLite
File Changes1. src/KurrentDB.Plugins.Kontext/KontextPlugin.cs
|
Code Review by Qodo
1. ToolkitTestEnvironment.Initialize() missing assembly
|
| [Before(Assembly)] | ||
| public static ValueTask BeforeAssembly(AssemblyHookContext context) => | ||
| ToolkitTestEnvironment.Initialize(); | ||
|
|
||
| [After(Assembly)] | ||
| public static ValueTask AfterAssembly(AssemblyHookContext context) => | ||
| ToolkitTestEnvironment.Reset(); |
There was a problem hiding this comment.
1. toolkittestenvironment.initialize() missing assembly 📘 Rule violation ⛯ Reliability
The new test wire-up does not pass context.Assembly to ToolkitTestEnvironment.Initialize/Reset, which breaks the required standardized per-assembly test environment lifecycle. This can cause unreliable test setup/cleanup when multiple test assemblies run under the shared toolkit.
Agent Prompt
## Issue description
`TestEnvironmentWireUp` does not call `ToolkitTestEnvironment.Initialize(context.Assembly)` / `Reset(context.Assembly)` as required.
## Issue Context
The repository test infrastructure relies on assembly-scoped initialization/reset to avoid cross-test-project interference.
## Fix Focus Areas
- src/KurrentDB.Plugins.Kontext.Tests/TestEnvironmentWireUp.cs[10-16]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| <ProjectReference Include="..\KurrentDB.Common\KurrentDB.Common.csproj" /> | ||
| <ProjectReference Include="..\KurrentDB.Core\KurrentDB.Core.csproj" /> | ||
| <ProjectReference Include="..\..\libs\Kurrent.Kontext\src\Kurrent.Kontext\Kurrent.Kontext.csproj" /> | ||
| </ItemGroup> |
There was a problem hiding this comment.
2. Ci misses submodules 🐞 Bug ⛯ Reliability
CI uses actions/checkout without enabling submodule checkout, but the solution now includes libs/Kurrent.Kontext as a git submodule and directly ProjectReferences its csproj, causing restore/build failures in CI and for developers without git submodule update --init.
Agent Prompt
### Issue description
The repo now depends on a git submodule (`libs/Kurrent.Kontext`) at build time via `ProjectReference`, but CI workflows check out the repository without fetching submodules. This causes missing project files during restore/build.
### Issue Context
Workflows using `actions/checkout@v4` must set `submodules: recursive` (or at least `true`) for submodules to be present.
### Fix Focus Areas
- .github/workflows/common.yml[21-73]
- .github/workflows/build-reusable.yml[17-97]
- .github/workflows/build-container-reusable.yml[11-97]
### Suggested change
Update each `actions/checkout@v4` step to include:
```yaml
with:
submodules: recursive
```
If you intentionally do not want submodules in some jobs, then remove the `ProjectReference` dependency and consume `Kurrent.Kontext` as a NuGet package or vendored source instead.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
de5de25 to
d4cc993
Compare
1a27b64 to
6c6deef
Compare
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
6c6deef to
7a74efc
Compare
CI Feedback 🧐A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
Adds the Kontext plugin — an embedded agent memory and RAG system for KurrentDB that gives AI agents durable, searchable memory backed by KurrentDB events.
Kontext supports any AI agent that can connect to an MCP server over HTTP (Claude Code, Cursor, Windsurf, Copilot, etc.). Importing data into Kontext requires the agent to be able to run
curlor any equivalent HTTP client tool.Configuration
Data stored under
{index}/kontext/. Memory stream is$kontext-memory.Docker image (preview)
Connecting Claude Code
Add
.mcp.jsonto your project root:{ "mcpServers": { "kontext": { "type": "http", "url": "http://localhost:2113/mcp/kontext", "headers": { "Authorization": "Basic YWRtaW46Y2hhbmdlaXQ=" } } } }Try it out
RAG — ask Claude about events in an existing database:
Data Import — load a dataset and explore it:
Agent Memory — insights are retained across sessions:
How it works
The plugin subscribes to
$alland indexes every event using hybrid text + vector search. Agents connect via MCP over HTTP and can search events, retain synthesized facts, and recall them in future sessions.All configuration options
Use cases
Customer Support — Load ticket logs, ask an AI agent to find patterns and root causes.
Incident Investigation — Import production logs, let agents correlate events across services.
Sales Intelligence — Import CRM data, ask agents to spot trends and opportunities.
Compliance Auditing — Import transaction records, let agents flag anomalies.
Product Analytics — Import user activity events, ask agents to surface insights.
Knowledge Base — Import documentation, let agents answer questions grounded in your docs.