@darksol/remem-v2
v0.2.0
Published
ReMEM v2 core: scoped memory planning, recall, extraction, graph expansion, and bounded context assembly for agents
Maintainers
Readme
ReMEM v2
Built by DARKSOL
The stripped-down ReMEM core: scoped memory planning, recall, extraction, graph expansion, and bounded context assembly for agents.
ReMEM v2 is the clean rebuild lane.
Instead of one giant memory class doing everything, this package focuses on the actual product center:
- intake before storage
- extraction before prompt bloat
- graph-aware recursive recall
- scoped execution for tenant/session-aware memory work
- bounded context assembly
- composable repositories and pipelines
Install
npm install @darksol/remem-v2Quick Start
import { randomUUID } from 'node:crypto';
import {
buildBoundedContextPacket,
computeSmartRecallV2,
createMemoryPipeline,
executeRecallPlan,
executeExtractionRequest,
expandGraphRecall,
planRecall,
type Extractor,
type IntakePolicy,
type MemoryRepository,
type SmartRecallCollectors,
} from '@darksol/remem-v2';
const repository: MemoryRepository = {
async store(record) {
return {
id: randomUUID(),
...record,
createdAt: Date.now(),
updatedAt: Date.now(),
};
},
async createLink(link) {
return { id: randomUUID(), ...link, createdAt: Date.now() };
},
async findRecent() {
return [];
},
async search() {
return [];
},
async getLinksFor() {
return [];
},
};
const intakePolicy: IntakePolicy = {
async evaluate(candidate) {
return {
accepted: candidate.content.length > 24,
kind: 'fact',
score: 0.72,
threshold: 0.58,
reason: 'Sufficient signal for storage',
layerHint: 'semantic',
};
},
};
const extractor: Extractor = {
async extract(request) {
return {
query: request.query,
summary: 'No extraction sources wired yet.',
items: [],
links: [],
usedChars: 0,
truncated: false,
};
},
};
const pipeline = createMemoryPipeline({ repository, intakePolicy, extractor });
await pipeline.ingest({
content: 'We decided to rebuild ReMEM around intake and extraction.',
topics: ['roadmap', 'memory'],
source: 'operator',
});
const collectors: SmartRecallCollectors = {
async query(query) {
return { query, results: [], totalAvailable: 0, tookMs: 0 };
},
async graph(query) {
return { query, results: [], totalAvailable: 0, tookMs: 0, linksTraversed: 0 };
},
procedural() {
return [];
},
async recent() {
return [];
},
proceduralToQueryResult(match) {
return match.entry;
},
};
const recall = await computeSmartRecallV2('What matters right now?', {
profile: 'agent-safe',
limit: 8,
}, collectors);
const plan = planRecall({
query: 'What matters right now?',
profile: 'agent-safe',
topics: ['memory', 'roadmap'],
scope: {
namespace: ['tenant', 'memory'],
tenantId: 'tenant-core',
sessionId: 'session-1',
},
});
const packet = buildBoundedContextPacket(
[
{
key: 'summary',
title: 'Summary',
body: 'ReMEM v2 keeps intake, recall, and context assembly as explicit seams.',
required: true,
priority: 10,
},
{
key: 'results',
title: 'Recall Results',
body: recall.results.map((item) => `- ${item.content}`).join('\n'),
priority: 7,
metadata: { laneCount: recall.results.length },
},
],
{
query: 'What matters right now?',
maxChars: 320,
includeSectionMetadata: true,
}
);
console.log(packet.text);
console.log(plan.lanePlans);
const graphExpansion = expandGraphRecall(recall.results, recall.results, [], {
hops: 1,
limit: 4,
minScore: 0.2,
});
console.log(graphExpansion.paths);
const executed = await executeRecallPlan(plan, collectors);
console.log(executed.packet.text);
const extracted = await executeExtractionRequest({
query: 'Summarize active memory',
profile: 'agent-safe',
scope: {
namespace: ['tenant', 'memory'],
tenantId: 'tenant-core',
sessionId: 'session-1',
},
includeMetadata: true,
}, collectors);
console.log(extracted.extraction.summary);What This Package Is
This package is the v2 engine seam, not the whole legacy surface.
Good fit:
- building a custom agent memory engine
- implementing durable intake/extraction flows
- running tenant- or session-aware recall and extraction work
- swapping repositories without rewriting orchestration
- treating graph recall as a first-class memory primitive
Not the goal:
- shipping setup wizards
- bundling HTTP servers
- carrying every legacy ReMEM concern forever
Status
0.2.0 is the current release cut.
It already gives you:
- memory contracts
- ingestion pipelines
- recall planning
- smart recall fusion
- recall plan execution
- scoped execution contracts
- extraction execution over the same planner/runtime spine
- bounded context packet assembly
- graph expansion helpers
- packed artifact verification
Next up:
- direct reuse as the engine under
@darksol/remem
Built with teeth.
