## Memory System — NeuralMemory

This workspace uses NeuralMemory for persistent memory across sessions.
You have access to nmem_* MCP tools. Use them PROACTIVELY.

### Session Start (ALWAYS)

1. `nmem_recap()` — Resume context from last session
2. `nmem_context(limit=20, fresh_only=true)` — Load recent memories
3. `nmem_session(action="get")` — Check current task/feature/progress

If `gap_detected` is true, run `nmem_auto(action="flush", text="<recent context>")` to recover.

### During Work — Auto-Remember

When a DECISION is made:
  nmem_remember(content="Decision: ...", type="decision", priority=7, tags=["project-name"])

When a BUG is fixed:
  nmem_remember(content="Fixed: ... by ...", type="error", priority=7)

When user states a PREFERENCE:
  nmem_remember(content="User prefers ...", type="preference", priority=6)

When a FACT is learned:
  nmem_remember(content="...", type="fact", priority=5)

When a TODO is identified:
  nmem_todo(task="...", priority=6)

### During Work — Recall Before Asking

ALWAYS check memory before asking the user a question:
  nmem_recall(query="<topic>", depth=1)

Depth: 0=instant, 1=context (default), 2=patterns, 3=deep traversal.

### Session End

  nmem_auto(action="process", text="<session summary>")
  nmem_session(action="set", feature="...", task="...", progress=0.8)

### Emergency Flush (before context reset)

  nmem_auto(action="flush", text="<recent conversation>")

### Codebase Indexing (first time)

  nmem_index(action="scan", path="./src")

After indexing, nmem_recall finds related code through the neural graph.

### Project Context

  nmem_eternal(action="save", project_name="MyApp", tech_stack=["React", "Node.js"])
  nmem_eternal(action="save", decision="Use Redis", reason="Low latency caching")

### Edit & Forget

Wrong type? → nmem_edit(memory_id="...", type="insight")
Wrong content? → nmem_edit(memory_id="...", content="corrected text")
Outdated? → nmem_forget(memory_id="...", reason="outdated")
Sensitive/garbage? → nmem_forget(memory_id="...", hard=true)

### Cognitive Reasoning

  nmem_hypothesize(action="create", content="...", confidence=0.6)
  nmem_evidence(hypothesis_id="h-1", evidence_type="for", content="...")
  nmem_predict(action="create", content="...", hypothesis_id="h-1", deadline="...")
  nmem_verify(prediction_id="p-1", outcome="correct")
  nmem_cognitive(action="summary")
  nmem_gaps(action="detect", topic="...")
  nmem_explain(entity_a="X", entity_b="Y")

### Rules

1. Be proactive — remember important info without being asked
2. Store 3-5 memories per task — a bug fix has: root cause, fix, insight, prevention
3. Use rich language — "Chose X over Y because Z", not just "X"
4. Check memory first — recall before asking repeated questions
5. Use diverse types — fact/decision/error/preference/todo/workflow/insight/instruction
6. Set priority — critical=7-10, normal=5, trivial=1-3
7. Add tags — always include project name + topic
8. Recap on start — always nmem_recap() at session beginning
9. Fix mistakes — nmem_edit for wrong types/content, nmem_forget for outdated
10. Health weekly — nmem_health(), fix highest penalty first
