본문으로 건너뛰기
cccskills
무료GitHub에 공개

memory-patterns

Persistent memory patterns for moflo agents — session memory, long-term knowledge, pattern learning, and cross-session context via moflo's node:sqlite + HNSW vector store. Use when building stateful agents or assistants that need to remember across runs.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md5.3 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

MoFlo Memory Patterns

Persistent, semantically-searchable memory for moflo-enabled projects. Backed by .moflo/moflo.db (node:sqlite + HNSW vector index) and exposed through MCP tools.

Core API

Three things to know:

  1. MCP tools — call from Claude Code sessions:

    • mcp__moflo__memory_store { key, value, namespace?, tags?, ttl?, upsert? }
    • mcp__moflo__memory_search { query, namespace?, limit?, threshold? } — semantic, HNSW-backed
    • mcp__moflo__memory_retrieve { key, namespace? } — exact key lookup
    • mcp__moflo__memory_list { namespace?, limit? }
    • mcp__moflo__memory_delete { key, namespace? }
    • mcp__moflo__memory_stats {}
  2. CLI — flo-search "<query>" --namespace <ns> for quick semantic lookup from the shell.

  3. Namespaces — namespace + key is the unique identity. Default namespaces shipped by moflo: learnings, patterns, guidance, code-map. (knowledge is a deprecated alias — writes are transparently redirected to learnings.) Create your own for application memory (e.g. app:sessions, app:users).

Pattern 1: Session Memory

Rolling per-conversation memory with TTL so old sessions expire:

// Store a turn
await mcp.memory_store({
  namespace: 'app:sessions',
  key: `${sessionId}:msg:${turnIndex}`,
  value: { role, content, ts: Date.now() },
  ttl: 60 * 60 * 24 * 7, // 7 days
});

// Recall the session — keys sort lexicographically, so prefixing with
// sessionId groups a conversation.
const all = await mcp.memory_list({ namespace: 'app:sessions' });
const current = all.filter(t => t.key.startsWith(`${sessionId}:`));

Why namespace-per-use: search scope stays small and delete-by-namespace becomes memory_list + memory_delete in a loop.

Pattern 2: Long-Term Knowledge

Facts that should survive any session and be findable by meaning, not exact key:

await mcp.memory_store({
  namespace: 'learnings',
  key: 'auth:session-token-rotation',
  value: 'Session tokens are rotated every 15 minutes by the auth middleware. Refresh happens transparently on the client.',
  tags: ['auth', 'security'],
  upsert: true,
});

// Retrieval: semantic, not keyword
const hits = await mcp.memory_search({
  namespace: 'learnings',
  query: 'how do auth tokens refresh?',
  limit: 5,
  threshold: 0.4,
});

upsert: true is the norm — you're updating your own knowledge, not guarding against collisions.

Pattern 3: Pattern Learning (store + promote)

Capture what worked, then let the next run find it:

// After a successful task
await mcp.memory_store({
  namespace: 'patterns',
  key: `${patternType}:${shortHash(signature)}`,
  value: {
    signature,          // what triggered this
    approach,           // what you did
    outcome: 'success', // how it landed
    occurrences: 1,
  },
  tags: [patternType],
  upsert: true,
});

// Before starting a similar task
const similar = await mcp.memory_search({
  namespace: 'patterns',
  query: currentTaskDescription,
  limit: 3,
  threshold: 0.5,
});

On repeated hits, read the existing entry, increment occurrences, and upsert.

Pattern 4: Context Recall at Prompt Start

moflo's gate hooks enforce "search memory before exploring files." Mirror that in your own agents:

async function beforeTask(description: string) {
  const [guidance, patterns, codeMap] = await Promise.all([
    mcp.memory_search({ namespace: 'guidance', query: description, limit: 5 }),
    mcp.memory_search({ namespace: 'patterns',  query: description, limit: 5 }),
    mcp.memory_search({ namespace: 'code-map',  query: description, limit: 8 }),
  ]);
  return { guidance, patterns, codeMap };
}

This is the same fan-out the /flo spell does — cheap (HNSW, parallel) and replaces a lot of exploratory Glob/Grep.

Anti-Patterns

  • Don't put large blobs in value. Store pointers/keys — the embedding is built from the value string, and huge values bloat the index.
  • Don't search without a namespace. Cross-namespace search mixes guidance (prose) with patterns (structured) — signal collapses.
  • Don't use sequential numeric keys if you also want semantic search over them. Pick keys humans/agents would search for by meaning.
  • Don't use ttl on knowledge you want long-lived. TTL is for sessions, ephemeral cache, WIP notes.

Persistence & Indexing

  • File: .moflo/moflo.db at project root (node:sqlite, Node 22+ built-in).
  • Embeddings: built by cli's embeddings module; indexed with HNSW from src/cli/memory/.
  • Cold-start cost: ~5 seconds to initialize HNSW. Tests should share a single instance (beforeAll, not beforeEach).
  • Namespace isolation: each namespace is a logical partition, but the HNSW index spans the table. Query time scales with limit and threshold, not total row count.

See Also

  • vector-search skill — RAG patterns over your own documents
  • memory-optimization skill — HNSW tuning, quantization, batch ops
  • .claude/guidance/moflo-core-guidance.md — CLI/MCP reference

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

commune

무료

Turn a vague idea into a concrete, actionable spec through a short Socratic dialogue, then hand the result off to an existing moflo surface — a /flo ticket, a spell, or memory. Use BEFORE you have a defined unit of work, when the goal is still fuzzy.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

eric-cielo/moflo192026년 10월 18일 업데이트

Scaffold new spell step commands and connectors. Use when building new step commands for spells or extending the spell engine with new capabilities. Connectors are for new I/O transport types OR platforms requiring complex multi-step interaction (e.g., browser-based automation).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

eric-cielo/moflo192026년 10월 18일 업데이트

distill

무료

Alias for /flo-simplify — see that skill's description.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

eric-cielo/moflo192026년 10월 18일 업데이트

divine

무료

Structured multi-hop web research with explicit confidence gating — plan the inquiry, search (WebSearch/WebFetch), score your own confidence, and keep digging until the answer is well-supported or a hop cap is hit, then emit a cited synthesis. Learns across sessions by storing each research case to memory and reusing prior strategies. Use when a question needs more than one search — comparisons, current-best-practice questions, anything where a single lookup leaves you unsure.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

eric-cielo/moflo192026년 10월 18일 업데이트

eldar

무료

Consult the Eldar — audit a project's moflo + Claude Code setup for portable, high-leverage gaps and guide remediation. Default mode is read-only audit with severity-ranked findings; --fix presents an interactive triage menu and walks the user through each chosen fix (healer, missing CLAUDE.md, sparse guidance, hook/MCP wiring, empty memory namespaces, stack→guidance gaps). Use when starting in a new project, when Claude feels lost or inefficient, when guidance/CLAUDE.md is sparse, or as a periodic health check.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

eric-cielo/moflo192026년 10월 18일 업데이트

flfl

무료

Run /fl on a ticket with moflo's three standing considerations loaded first — cross-platform (Rule

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

eric-cielo/moflo192026년 10월 18일 업데이트

eric-cielo의 스킬 모두 보기

이 스킬의 문제 신고