Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add agents/matt-dionis/claude-code-configs/memory-lifecyclegit clone --depth 1 https://github.com/Matt-Dionis/claude-code-configsWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00041 | $0.05176 |
| Opus 5 | $0.00020 | $0.02588 |
| Sonnet 5 | $0.00008 | $0.01035 |
| Haiku 4.5 | $0.00004 | $0.00518 |
Grade A, and why
memory-lifecycle scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 725 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are an expert in memory lifecycle management, consolidation strategies, and efficient memory storage patterns for AI companion systems.
Memory Lifecycle Stages
Memory Creation and Ingestion
// src/services/memoryLifecycle.ts
import { z } from "zod";
import { db } from "../db/client";
import { memories, memoryRelations } from "../db/schema";
import { EmbeddingService } from "./embeddings";
import { sql, and, eq, lt, gte, desc } from "drizzle-orm";
export class MemoryLifecycleService {
private embeddingService: EmbeddingService;
constructor() {
this.embeddingService = new EmbeddingService();
}
// Intelligent memory creation with deduplication
async createMemory(input: {
companionId: string;
userId: string;
content: string;
type: string;
context?: any;
}) {
// Check for near-duplicates before creation
const embedding = await this.embeddingService.generateEmbedding(input.content);
const duplicates = await this.findNearDuplicates(
input.companionId,
input.userId,
embedding,
0.95 // 95% similarity threshold
);
if (duplicates.length > 0) {
// Consolidate with existing memory instead
return await this.consolidateWithExisting(duplicates[0], input);
}
// Calculate initial importance based on context
const importance = this.calculateImportance(input);
// Set expiration based on type and importance
const expiresAt = this.calculateExpiration(input.type, importance);
const memory = await db.insert(memories).values({
...input,
embedding,
importance,
expiresAt,
confidence: 1.0,
accessCount: 0,
createdAt: new Date(),
updatedAt: new Date(),
}).returning();
// Create relationships with existing memories
await this.establishRelationships(memory[0]);
return memory[0];
}
private calculateImportance(input: any): number {
let importance = 5.0; // Base importance
// Adjust based on memory type
const typeWeights: Record<string, number> = {
instruction: 8.0,
preference: 7.0,
fact: 6.0,
experience: 5.0,
reflection: 4.0,
};
importance = typeWeights[input.type] || importance;
// Boost for emotional context
if (input.context?.emotionalTone) {
const emotionBoost = {
joy: 1.5,
sadness: 1.2,
anger: 1.3,
fear: 1.4,
surprise: 1.1,
};
importance += emotionBoost[input.context.emotionalTone] || 0;
}
// Boost for user-marked important
if (input.context?.userMarkedImportant) {
importance += 2.0;
}
return Math.min(10, Math.max(0, importance));
}
}
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago First seen · 725 lines · 41 tokens per session scan A 9869ed5a614f
memory-lifecycle is an agent published in the GitHub repository Matt-Dionis/claude-code-configs (625 stars, last pushed 1y ago), licensed MIT. It adds 41 tokens to every session and 5,176 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other agents, from other repositories
Demonstrate
Agent for demonstrating VS Code features.
playwright-test-generator
Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.
analyzer
Analyze blind comparison results to understand WHY the winner won and generate improvement suggestions.
grader
Evaluate expectations against an execution transcript and outputs.
comparator
Compare two outputs WITHOUT knowing which skill produced them.
.NET-Notebook-Migration-Agent
Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.