Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/Matt-Dionis/claude-code-configsnpx agentmods add agents/matt-dionis/claude-code-configs/memory-lifecycleWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/agents/matt-dionis/claude-code-configs/memory-lifecycle)<a href="https://agentmods.dev/agents/matt-dionis/claude-code-configs/memory-lifecycle"><img src="https://agentmods.dev/badge/agents/matt-dionis/claude-code-configs/memory-lifecycle/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/agents/matt-dionis/claude-code-configs/memory-lifecycle"><img src="https://agentmods.dev/badge/agents/matt-dionis/claude-code-configs/memory-lifecycle.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What 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.1 | $0.00041 | $0.05176 |
| Opus 5.5 | $0.00016 | $0.02070 |
| Sonnet 5.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 1mo 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.
- 1mo 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 (619 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.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
context-finder
Read-only, memory- and index-aware codebase search. Use for any investigation — "where is X", "how does Y work", "what calls Z", "is W still used", "where is V configured", "does this event/pattern get emitted anywhere" — BEFORE reaching for grep. Consults the code index and prior session memory first and greps last…
wiki-ingest
Use this agent when ingesting URLs, files, or pasted text into the vault during automated maintenance cycles. Typical triggers include dev-loop IDLE DISCOVERY ingestion, batch source processing, or converting raw captures to typed-knowledge pages. See "When to invoke" in the agent body for worked scenarios.
data scientist
Ecosystem Data Scientist.
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.
.NET-Notebook-Migration-Agent
Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.