mango-brain 3.3.2__tar.gz → 3.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. {mango_brain-3.3.2 → mango_brain-3.3.4}/PKG-INFO +2 -2
  2. {mango_brain-3.3.2 → mango_brain-3.3.4}/README.md +1 -1
  3. {mango_brain-3.3.2 → mango_brain-3.3.4}/mango_brain.egg-info/PKG-INFO +2 -2
  4. {mango_brain-3.3.2 → mango_brain-3.3.4}/pyproject.toml +1 -1
  5. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/cli.py +7 -0
  6. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/config.py +1 -0
  7. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/mcp_tools.py +30 -39
  8. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/retrieval.py +3 -0
  9. mango_brain-3.3.4/server/rules/mangobrain-remember.md +158 -0
  10. mango_brain-3.3.4/server/rules/mangobrain-workflow.md +103 -0
  11. mango_brain-3.3.4/server/work/rules/mangobrain-remember-work.md +79 -0
  12. mango_brain-3.3.4/server/work/rules/mangobrain-workflow-work.md +48 -0
  13. mango_brain-3.3.4/server/work/templates/CLAUDE.md +118 -0
  14. mango_brain-3.3.4/server/work/templates/rules/audience.md +21 -0
  15. mango_brain-3.3.4/server/work/templates/rules/brand.md +20 -0
  16. mango_brain-3.3.4/server/work/templates/rules/channels.md +24 -0
  17. mango_brain-3.3.4/server/work/templates/rules/product.md +19 -0
  18. mango_brain-3.3.4/server/work/templates/rules/strategy.md +27 -0
  19. mango_brain-3.3.4/server/work/templates/rules/tone.md +21 -0
  20. mango_brain-3.3.2/server/rules/mangobrain-remember.md +0 -146
  21. mango_brain-3.3.2/server/rules/mangobrain-workflow.md +0 -98
  22. mango_brain-3.3.2/server/work/rules/mangobrain-remember-work.md +0 -67
  23. mango_brain-3.3.2/server/work/rules/mangobrain-workflow-work.md +0 -43
  24. mango_brain-3.3.2/server/work/templates/CLAUDE.md +0 -118
  25. mango_brain-3.3.2/server/work/templates/rules/audience.md +0 -21
  26. mango_brain-3.3.2/server/work/templates/rules/brand.md +0 -20
  27. mango_brain-3.3.2/server/work/templates/rules/channels.md +0 -24
  28. mango_brain-3.3.2/server/work/templates/rules/product.md +0 -19
  29. mango_brain-3.3.2/server/work/templates/rules/strategy.md +0 -27
  30. mango_brain-3.3.2/server/work/templates/rules/tone.md +0 -21
  31. {mango_brain-3.3.2 → mango_brain-3.3.4}/LICENSE +0 -0
  32. {mango_brain-3.3.2 → mango_brain-3.3.4}/mango_brain.egg-info/SOURCES.txt +0 -0
  33. {mango_brain-3.3.2 → mango_brain-3.3.4}/mango_brain.egg-info/dependency_links.txt +0 -0
  34. {mango_brain-3.3.2 → mango_brain-3.3.4}/mango_brain.egg-info/entry_points.txt +0 -0
  35. {mango_brain-3.3.2 → mango_brain-3.3.4}/mango_brain.egg-info/requires.txt +0 -0
  36. {mango_brain-3.3.2 → mango_brain-3.3.4}/mango_brain.egg-info/top_level.txt +0 -0
  37. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/__init__.py +0 -0
  38. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/__main__.py +0 -0
  39. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/agents/analyzer.md +0 -0
  40. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/agents/executor.md +0 -0
  41. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/agents/mem-manager.md +0 -0
  42. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/agents/verifier.md +0 -0
  43. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/api_routes.py +0 -0
  44. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/dashboard_dist/assets/index-DmI5d2FU.css +0 -0
  45. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/dashboard_dist/assets/index-DojB8F-G.js +0 -0
  46. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/dashboard_dist/favicon.svg +0 -0
  47. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/dashboard_dist/icons.svg +0 -0
  48. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/dashboard_dist/index.html +0 -0
  49. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/dashboard_dist/logo.svg +0 -0
  50. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/database.py +0 -0
  51. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/decay.py +0 -0
  52. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/embeddings.py +0 -0
  53. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/graph.py +0 -0
  54. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/jsonl_parser.py +0 -0
  55. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/main.py +0 -0
  56. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/mangobrain.default.toml +0 -0
  57. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/models.py +0 -0
  58. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/prompts/init/01-doc-base.md +0 -0
  59. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/prompts/init/02-code-base.md +0 -0
  60. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/prompts/init/03-event-base.md +0 -0
  61. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/prompts/init/04-chat-base.md +0 -0
  62. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/prompts/init/05-elaborate-base.md +0 -0
  63. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/prompts/reference/memory-definition.md +0 -0
  64. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/skills/brain-init/SKILL.md +0 -0
  65. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/skills/discuss/SKILL.md +0 -0
  66. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/skills/elaborate/SKILL.md +0 -0
  67. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/skills/health-check/SKILL.md +0 -0
  68. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/skills/memorize/SKILL.md +0 -0
  69. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/skills/smoke-test/SKILL.md +0 -0
  70. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/skills/task/SKILL.md +0 -0
  71. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/work/agents/creator.md +0 -0
  72. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/work/agents/mem-manager.md +0 -0
  73. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/work/agents/researcher.md +0 -0
  74. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/work/agents/reviewer.md +0 -0
  75. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/work/prompts/init-work.md +0 -0
  76. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/work/prompts/memory-definition.md +0 -0
  77. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/work/skills/brain-init-work/SKILL.md +0 -0
  78. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/work/skills/brief/SKILL.md +0 -0
  79. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/work/skills/create/SKILL.md +0 -0
  80. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/work/skills/elaborate-work/SKILL.md +0 -0
  81. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/work/skills/health-check-work/SKILL.md +0 -0
  82. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/work/skills/memorize-work/SKILL.md +0 -0
  83. {mango_brain-3.3.2 → mango_brain-3.3.4}/server/work/skills/smoke-test-work/SKILL.md +0 -0
  84. {mango_brain-3.3.2 → mango_brain-3.3.4}/setup.cfg +0 -0
  85. {mango_brain-3.3.2 → mango_brain-3.3.4}/tests/test_core.py +0 -0
  86. {mango_brain-3.3.2 → mango_brain-3.3.4}/tests/test_init.py +0 -0
  87. {mango_brain-3.3.2 → mango_brain-3.3.4}/tests/test_phase2.py +0 -0
  88. {mango_brain-3.3.2 → mango_brain-3.3.4}/tests/test_setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mango-brain
3
- Version: 3.3.2
3
+ Version: 3.3.4
4
4
  Summary: The learning layer for Claude Code — persistent associative memory + development workflow. Claude Code gets smarter the longer you use it.
5
5
  Author-email: Federico Anastasi <federico.anastasi@outlook.com>
6
6
  License: MIT
@@ -44,7 +44,7 @@ Dynamic: license-file
44
44
 
45
45
  <p align="center">
46
46
  <a href="https://pypi.org/project/mango-brain/"><img src="https://img.shields.io/pypi/v/mangobrain?style=flat-square&color=7c3aed&label=PyPI" /></a>
47
- <img src="https://img.shields.io/badge/v3.3.2-7c3aed?style=flat-square" />
47
+ <img src="https://img.shields.io/badge/v3.3.4-7c3aed?style=flat-square" />
48
48
  <img src="https://img.shields.io/badge/python-3.11+-blue?style=flat-square&logo=python&logoColor=white" />
49
49
  <img src="https://img.shields.io/badge/MCP-compatible-8A2BE2?style=flat-square" />
50
50
  <img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" />
@@ -15,7 +15,7 @@
15
15
 
16
16
  <p align="center">
17
17
  <a href="https://pypi.org/project/mango-brain/"><img src="https://img.shields.io/pypi/v/mangobrain?style=flat-square&color=7c3aed&label=PyPI" /></a>
18
- <img src="https://img.shields.io/badge/v3.3.2-7c3aed?style=flat-square" />
18
+ <img src="https://img.shields.io/badge/v3.3.4-7c3aed?style=flat-square" />
19
19
  <img src="https://img.shields.io/badge/python-3.11+-blue?style=flat-square&logo=python&logoColor=white" />
20
20
  <img src="https://img.shields.io/badge/MCP-compatible-8A2BE2?style=flat-square" />
21
21
  <img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" />
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mango-brain
3
- Version: 3.3.2
3
+ Version: 3.3.4
4
4
  Summary: The learning layer for Claude Code — persistent associative memory + development workflow. Claude Code gets smarter the longer you use it.
5
5
  Author-email: Federico Anastasi <federico.anastasi@outlook.com>
6
6
  License: MIT
@@ -44,7 +44,7 @@ Dynamic: license-file
44
44
 
45
45
  <p align="center">
46
46
  <a href="https://pypi.org/project/mango-brain/"><img src="https://img.shields.io/pypi/v/mangobrain?style=flat-square&color=7c3aed&label=PyPI" /></a>
47
- <img src="https://img.shields.io/badge/v3.3.2-7c3aed?style=flat-square" />
47
+ <img src="https://img.shields.io/badge/v3.3.4-7c3aed?style=flat-square" />
48
48
  <img src="https://img.shields.io/badge/python-3.11+-blue?style=flat-square&logo=python&logoColor=white" />
49
49
  <img src="https://img.shields.io/badge/MCP-compatible-8A2BE2?style=flat-square" />
50
50
  <img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" />
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mango-brain"
7
- version = "3.3.2"
7
+ version = "3.3.4"
8
8
  description = "The learning layer for Claude Code — persistent associative memory + development workflow. Claude Code gets smarter the longer you use it."
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -683,10 +683,17 @@ apply_elaboration, reinforce, decay, stats, diagnose, list_memories, sync_codeba
683
683
 
684
684
  def main() -> None:
685
685
  """CLI entry point."""
686
+ from importlib.metadata import version as pkg_version
687
+
686
688
  parser = argparse.ArgumentParser(
687
689
  prog="mangobrain",
688
690
  description="MangoBrain — Persistent memory + workflow system for Claude Code",
689
691
  )
692
+ try:
693
+ ver = pkg_version("mango-brain")
694
+ except Exception:
695
+ ver = "dev"
696
+ parser.add_argument("--version", "-V", action="version", version=f"%(prog)s {ver}")
690
697
  sub = parser.add_subparsers(dest="command")
691
698
 
692
699
  # serve
@@ -164,6 +164,7 @@ QUICK_BUDGET = int(_get("retrieval", "quick_budget", "2000"))
164
164
  SESSION_QUICK_BUDGET = int(_get("retrieval", "session_quick_budget", "4000"))
165
165
  DEEP_MAX_RESULTS = int(_get("retrieval", "deep_max_results", "20"))
166
166
  QUICK_MAX_RESULTS = int(_get("retrieval", "quick_max_results", "6"))
167
+ RECENT_MAX_RESULTS = int(_get("retrieval", "recent_max_results", "20"))
167
168
  RELEVANCE_THRESHOLD_RATIO = float(_get("retrieval", "deep_threshold", "0.78"))
168
169
  QUICK_RELEVANCE_THRESHOLD_RATIO = float(_get("retrieval", "quick_threshold", "0.85"))
169
170
 
@@ -103,26 +103,9 @@ def register_tools(
103
103
  recent_count = sum(1 for m in memories if m.id in recent_ids)
104
104
  neighbor_count = len(memories) - recent_count
105
105
 
106
- result = {
107
- "memories": [
108
- {
109
- "id": m.id,
110
- "content": m.content,
111
- "type": m.type.value if hasattr(m.type, 'value') else m.type,
112
- "project": m.project,
113
- "tags": m.tags,
114
- "relevance": round(scores[i], 4),
115
- "file_path": m.file_path,
116
- "code_signature": m.code_signature,
117
- "is_recent": m.id in recent_ids,
118
- }
119
- for i, m in enumerate(memories)
120
- ],
121
- "total_tokens": total_tokens,
122
- "count": len(memories),
123
- "recent_count": recent_count,
124
- "neighbor_count": neighbor_count,
125
- }
106
+ count = len(memories)
107
+ recent_count_val = recent_count
108
+ neighbor_count_val = neighbor_count
126
109
  else:
127
110
  if not query:
128
111
  return json.dumps({"error": "query is required for deep/quick mode"})
@@ -130,29 +113,37 @@ def register_tools(
130
113
  query=query, mode=mode, project=project,
131
114
  budget=budget, session_id=session_id,
132
115
  )
133
- result = {
134
- "memories": [
135
- {
136
- "id": m.id,
137
- "content": m.content,
138
- "type": m.type.value if hasattr(m.type, 'value') else m.type,
139
- "project": m.project,
140
- "tags": m.tags,
141
- "relevance": round(scores[i], 4),
142
- "file_path": m.file_path,
143
- "code_signature": m.code_signature,
144
- }
145
- for i, m in enumerate(memories)
146
- ],
147
- "total_tokens": total_tokens,
148
- "count": len(memories),
149
- }
116
+ count = len(memories)
117
+ recent_count_val = None
118
+ neighbor_count_val = None
119
+
120
+ # Format as readable text (not raw JSON)
150
121
  _dur = int((_time.monotonic_ns() - _t0) / 1_000_000)
151
122
  await _log_op(db, "remember", project=project,
152
123
  params={"query": query, "mode": mode, "limit": limit},
153
- result={"count": result["count"], "total_tokens": result["total_tokens"]},
124
+ result={"count": count, "total_tokens": total_tokens},
154
125
  duration_ms=_dur)
155
- return json.dumps(result, indent=2)
126
+
127
+ lines = []
128
+ header = f"{count} memories · {mode} mode · {_dur}ms"
129
+ if recent_count_val is not None:
130
+ header += f" · {recent_count_val} recent + {neighbor_count_val} neighbors"
131
+ lines.append(header)
132
+ lines.append("")
133
+
134
+ for i, m in enumerate(memories):
135
+ mtype = m.type.value if hasattr(m.type, 'value') else m.type
136
+ rel = round(scores[i], 4)
137
+ lines.append(f"[{mtype}] {m.content}")
138
+ meta_parts = []
139
+ if m.file_path:
140
+ meta_parts.append(f"file: {m.file_path}")
141
+ meta_parts.append(f"relevance: {rel}")
142
+ meta_parts.append(f"id: {m.id}")
143
+ lines.append(" " + " · ".join(meta_parts))
144
+ lines.append("")
145
+
146
+ return "\n".join(lines)
156
147
  except ValueError as e:
157
148
  _dur = int((_time.monotonic_ns() - _t0) / 1_000_000)
158
149
  await _log_op(db, "remember", project=project,
@@ -185,10 +185,13 @@ class RetrievalEngine:
185
185
  candidates.append((score / max(m.token_count, 1), score, m))
186
186
  candidates.sort(key=lambda x: x[0], reverse=True)
187
187
 
188
+ from server.config import RECENT_MAX_RESULTS
188
189
  selected: list[Memory] = []
189
190
  scores: list[float] = []
190
191
  total_tokens = 0
191
192
  for _, score, m in candidates:
193
+ if len(selected) >= RECENT_MAX_RESULTS:
194
+ break
192
195
  if total_tokens + m.token_count > budget:
193
196
  continue
194
197
  selected.append(m)
@@ -0,0 +1,158 @@
1
+ # MangoBrain — Remember Query Strategy
2
+
3
+ You have access to the `remember` MCP tool to retrieve relevant memories from the project.
4
+ Use it often, not just at the start of a task. Memories contain gotchas, patterns, decisions, and references that code alone doesn't tell you.
5
+
6
+ ## Query Language
7
+
8
+ **All remember() queries MUST use English keywords**, regardless of session language.
9
+ Memories are stored in English — queries in other languages degrade retrieval by ~15-20%.
10
+
11
+ ```
12
+ GOOD: remember(query="formatPrice cents euros conversion gotcha", ...)
13
+ BAD: remember(query="formattazione prezzi conversione centesimi", ...)
14
+ ```
15
+
16
+ Always translate concepts before querying. The conversation stays in the user's language, but queries go to the DB in English.
17
+
18
+ ## When to use remember
19
+
20
+ - **Task/session start**: broad context (see multi-query strategy below)
21
+ - **Before touching an unfamiliar area**: targeted quick query
22
+ - **When you find a bug**: quick query to check for known patterns
23
+ - **Before creating a component/utility**: quick query to verify if something similar already exists
24
+ - **When making an architectural decision**: quick query for precedents
25
+ - **End of task**: remember(mode="recent") to check WIP and context for mem-manager
26
+
27
+ ## Multi-query strategy (task start)
28
+
29
+ Do NOT make a single generic query. Use **1 deep + N quick**:
30
+
31
+ ### 1. Read the task and identify 2-4 distinct technical areas
32
+
33
+ ### 2. 1x deep — big picture
34
+ ```
35
+ remember(query="[max 10 keywords from the task]", mode="deep", project="{PROJECT}")
36
+ ```
37
+ Captures: cross-cutting patterns, conventions, recurring gotchas. ~20 results.
38
+
39
+ ### 3. 2-4x quick — one per technical area
40
+ ```
41
+ remember(query="[specific names: components, hooks, services, files]", mode="quick", project="{PROJECT}")
42
+ ```
43
+ Captures: specific details per cluster. ~6 results each.
44
+
45
+ ### Why this works
46
+ Each query pulls from a different cluster in the associative graph. A single generic deep query hits 1-2 clusters and misses the rest. 3 targeted quick queries cover 3 different clusters.
47
+
48
+ ## How to formulate queries
49
+
50
+ ### Keywords > natural language
51
+ ```
52
+ GOOD: "formatPrice cents euros conversion gotcha"
53
+ BAD: "how does price formatting work in the system"
54
+ ```
55
+
56
+ ### Always use proper names
57
+ Use component names, hooks, services, files, utilities when you know them:
58
+ ```
59
+ GOOD: "useStripeConnect ConnectAccountManagement onboarding embedded"
60
+ BAD: "the Stripe payment onboarding system"
61
+ ```
62
+
63
+ ### Mix technical + domain
64
+ ```
65
+ GOOD: "booking wizard localStorage state persistence gotcha"
66
+ BAD: "issues with the booking wizard"
67
+ ```
68
+
69
+ ## Quick vs Deep vs Recent
70
+
71
+ | Mode | Results | Graph | When |
72
+ |------|---------|-------|------|
73
+ | deep | ~20 | full (alpha=0.3) | Task start, big picture |
74
+ | quick | ~6 | light (alpha=0.15) | Mid-task, specific areas, lookup |
75
+ | recent | ~15 + neighbors | by time | Session start, understand WIP |
76
+
77
+ ## Work context strategy
78
+
79
+ ### Session start (always)
80
+ ```
81
+ remember(mode="recent", project="{PROJECT}", limit=15, k_neighbors=2)
82
+ ```
83
+ Returns: last 15 memories + graph-connected context. Understand WIP, blockers, recent decisions.
84
+
85
+ ### Mid-task: about to touch a new area
86
+ ```
87
+ remember(query="[file names, components, concepts of the area]", mode="quick", project="{PROJECT}")
88
+ ```
89
+
90
+ ### Mid-task: found a bug
91
+ ```
92
+ remember(query="[bug keywords + area + pattern]", mode="quick", project="{PROJECT}")
93
+ ```
94
+
95
+ ### End of task / pre-mem-manager
96
+ ```
97
+ remember(mode="recent", project="{PROJECT}")
98
+ ```
99
+ Check WIP and context to pass to mem-manager for sync.
100
+
101
+ ## Real examples
102
+
103
+ ### Task: "Fix wrong price in booking wizard"
104
+ ```
105
+ deep: "booking wizard UX fix price bug mobile layout"
106
+ quick: "formatPrice cents euros conversion serializeBooking gotcha"
107
+ quick: "OrderWizard steps PaymentStep SummaryStep"
108
+ ```
109
+
110
+ ### Task: "Refactor profile + shared payments"
111
+ ```
112
+ deep: "account profile refactor shared components owner teacher payments Stripe"
113
+ quick: "ProfiloPage TeacherAccountPage structure password removal"
114
+ quick: "Stripe Connect onboarding useStripeConnect ConnectAccountManagement"
115
+ quick: "User model schema getMe provider stripeAccountId Prisma"
116
+ quick: "Google Calendar routes sync disconnect auth calendarSyncJob"
117
+ ```
118
+
119
+ ### Mid-task: about to touch the email system
120
+ ```
121
+ quick: "email Resend templates transactional React Email service"
122
+ ```
123
+
124
+ ### Mid-task: found a price bug
125
+ ```
126
+ quick: "price double-division cents euros formatPrice formatMoneyValue"
127
+ ```
128
+
129
+ ### Generic session start
130
+ ```
131
+ recent: limit=15, k_neighbors=2
132
+ deep: "project overview architecture current state WIP"
133
+ ```
134
+
135
+ ## How to interpret results
136
+
137
+ Each memory returned by `remember` has:
138
+ - **type**: episodic (specific event, dated), semantic (fact/architecture, stable), procedural (how-to, instructions)
139
+ - **tags**: thematic cluster (bug, gotcha, convention, reference, pattern, decision, state, wip...)
140
+ - **relevance score**: semantic proximity to query (>0.7 high, 0.4-0.7 medium, <0.4 low)
141
+ - **file_path**: if present, the file it refers to — verify it still exists before trusting it
142
+ - **age**: old episodic memories may be stale, semantic ones stay valid longer
143
+
144
+ ### How to weigh memories by tag
145
+
146
+ | Tag | Priority | How to use |
147
+ |-----|----------|------------|
148
+ | **gotcha**, **bug** | High | Warnings from past experience. Read carefully before touching that area. |
149
+ | **convention**, **pattern** | High | Follow them unless current code explicitly contradicts them. |
150
+ | **reference** | Medium | Point to utilities/hooks/services. Verify they still exist before using. |
151
+ | **decision** | Medium | Contain the WHY. Respect the decision or discuss with user if you want to change it. |
152
+ | **state**, **wip** | Context | Inform about ongoing work. Most recent ones are most relevant. |
153
+
154
+ ### Stale memory signals
155
+
156
+ - Memory says "file X uses pattern Y" but code shows otherwise → flag as potentially stale
157
+ - Old episodic memory (months) about an area that was rewritten → probably no longer relevant
158
+ - Memory with file_path that no longer exists → file was renamed or removed
@@ -0,0 +1,103 @@
1
+ # MangoBrain — Workflow Integration
2
+
3
+ MangoBrain provides persistent associative memory across Claude Code sessions. This rule describes how and when to use it in daily workflow.
4
+
5
+ ## Server
6
+
7
+ MangoBrain requires the server to be running. If the user asks to start it or if MCP tools are not responding:
8
+ ```
9
+ mangobrain serve --api # start server + dashboard (http://localhost:3101)
10
+ ```
11
+ Run it in the background. If the server is already running, no need to restart.
12
+
13
+ ## Overview
14
+
15
+ MangoBrain is not a file to read at the start. It's an active retrieval system: ask for what you need, when you need it. Memories contain past bugs, architectural decisions, patterns, gotchas, references to utilities and components — knowledge that code alone doesn't communicate.
16
+
17
+ ## Query Language
18
+
19
+ **All remember() queries MUST use English keywords**, regardless of session language.
20
+ Memories are stored in English — queries in other languages degrade retrieval by ~15-20%. The conversation stays in the user's language, but queries go to the DB in English.
21
+
22
+ ## Integration with /discuss
23
+
24
+ **INTAKE** (start of discussion):
25
+ 1. `remember(mode="recent")` — recent context, WIP, decisions
26
+ 2. Identify 2-3 technical areas of the topic
27
+ 3. `remember(mode="deep", query="[topic in max 10 keywords]")` — big picture
28
+ 4. 1-2x `remember(mode="quick", query="[specific names per area]")` — targeted details
29
+ 5. Show relevant memories to the user as context
30
+
31
+ **EXPLORE** (code analysis):
32
+ - The analyzer explores the code, enriched by memory context
33
+ - If an unexplored area emerges, do a quick query before responding
34
+
35
+ **BRAINSTORM** (discussion):
36
+ - Memories inform the brainstorm:
37
+ - Past bugs in the same area: "careful, last time..."
38
+ - Architectural decisions: "this was decided because..."
39
+ - Consolidated patterns: "the pattern used elsewhere is..."
40
+
41
+ ## Integration with /task
42
+
43
+ **ANALYZE** (task start):
44
+ 1. `remember(mode="recent")` — WIP, context
45
+ 2. Multi-query strategy (1 deep + N quick) — see mangobrain-remember.md
46
+ 3. Memories guide the analysis: you already know gotchas, patterns, available utilities
47
+
48
+ **Mid-task** (during development):
49
+ - Before touching a new area: quick query
50
+ - When you find a bug: quick query for known patterns
51
+ - Before creating a component: quick query to check if something similar exists
52
+
53
+ **CLOSE** (end of task):
54
+ The main orchestrator spawns the **mem-manager** as a sub-agent with:
55
+ - Summary of work done
56
+ - List of modified files (git diff)
57
+ - Decisions made
58
+ - WIP/blockers
59
+
60
+ The mem-manager autonomously:
61
+ 1. Creates memories for significant work (memorize)
62
+ 2. Syncs changed files with existing memories (sync_codebase + update_memory)
63
+ 3. Records WIP if present (memorize with tags "state", "wip")
64
+
65
+ ## Free sessions (without /task)
66
+
67
+ For sessions without /task (discussions, explorations, quick fixes):
68
+ - Use `remember` during the session as described above
69
+ - At end of session, use **/memorize** to sync work to memory
70
+ - /memorize prepares a summary and spawns the mem-manager
71
+
72
+ ## Periodic maintenance
73
+
74
+ | Activity | Frequency | Skill | What it does |
75
+ |----------|-----------|-------|--------------|
76
+ | Elaboration | Weekly | /elaborate | Consolidates, creates edges, abstractions, deprecates duplicates |
77
+ | Health check | Monthly | /health-check | Diagnosis of structure + content, targeted fixes |
78
+ | Smoke test | Post-init, post-elaboration | /smoke-test | Verifies retrieval quality with test queries |
79
+
80
+ ## The mem-manager agent
81
+
82
+ The mem-manager is a specialized sub-agent for memory management. It's not interactive — it's spawned by main with precise context and operates autonomously.
83
+
84
+ **What it does:**
85
+ - Creates atomic memories (2-5 lines, English, self-contained)
86
+ - Classifies: episodic (events), semantic (facts), procedural (how-to)
87
+ - Tags: 3-6 lowercase tags
88
+ - Adds relationships between memories (relates_to, depends_on, caused_by)
89
+ - Syncs changed files with existing memories
90
+ - Records WIP for the next session
91
+
92
+ **What it does NOT do:**
93
+ - Does not interact with the user
94
+ - Does not make architectural decisions
95
+
96
+ ## When NOT to use memory
97
+
98
+ - **Purely mechanical tasks**: "rename this variable", "add an import"
99
+ - **One-line fixes**: if the fix is obvious and there's no lesson to learn
100
+ - **Routine operations**: npm install, docker restart, git merge
101
+ - **When context is entirely in the task**: if the task is self-contained and doesn't touch complex areas
102
+
103
+ The rule: if the work doesn't produce reusable knowledge, it doesn't need to be memorized.
@@ -0,0 +1,79 @@
1
+ # MangoBrain Work — Query Strategy
2
+
3
+ You have access to the `remember` MCP tool to retrieve information from the project.
4
+ Use it often. Memory contains brand decisions, feedback, patterns, target insights, and references that documents alone don't communicate.
5
+
6
+ ## When to use remember
7
+
8
+ - **Session start**: recent context + project overview
9
+ - **Before creating content**: query brand, tone, audience for that channel
10
+ - **When the user asks something new**: check for past decisions
11
+ - **When the user gives feedback**: check if it's a pattern (have they said the same thing before?)
12
+ - **End of session**: `remember(mode="recent")` to confirm what to save
13
+
14
+ ## Multi-query strategy (session start)
15
+
16
+ ### 1. Recent — where we left off
17
+ ```
18
+ remember(mode="recent", project="{PROJECT}", limit=10, k_neighbors=2)
19
+ ```
20
+
21
+ ### 2. Deep — broad context on the topic
22
+ ```
23
+ remember(query="[5-10 keywords from the requested topic]", mode="deep", project="{PROJECT}")
24
+ ```
25
+
26
+ ### 3. Quick — specific areas
27
+ ```
28
+ remember(query="[brand tone voice guidelines]", mode="quick", project="{PROJECT}")
29
+ remember(query="[Instagram format carousel content rules]", mode="quick", project="{PROJECT}")
30
+ ```
31
+
32
+ ## Query Language
33
+
34
+ **All remember() queries MUST use English keywords**, regardless of session language.
35
+ Memories are stored in English — queries in other languages degrade retrieval by ~15-20%.
36
+
37
+ ```
38
+ GOOD: remember(query="Instagram post engagement CTA caption", ...)
39
+ BAD: remember(query="post Instagram coinvolgimento didascalia", ...)
40
+ ```
41
+
42
+ Always translate concepts before querying. The conversation stays in the user's language, but queries go to the DB in English.
43
+
44
+ ## How to formulate queries
45
+
46
+ ### Keywords > natural language
47
+ ```
48
+ GOOD: "Instagram carousel CTA engagement caption hashtags"
49
+ BAD: "how should I write Instagram posts"
50
+ ```
51
+
52
+ ### Domain proper names
53
+ ```
54
+ GOOD: "target musician band rehearsal studio booking"
55
+ BAD: "our target audience"
56
+ ```
57
+
58
+ ### Mix area + specific
59
+ ```
60
+ GOOD: "competitor pricing studio booking platform market"
61
+ BAD: "competitive analysis"
62
+ ```
63
+
64
+ ## Cross-project (if available)
65
+
66
+ If the project has an associated Code memory, you can pull product information:
67
+ ```
68
+ remember(query="feature booking user flow value proposition", project="{CODE_PROJECT}", mode="quick")
69
+ ```
70
+
71
+ **RULE**: always translate to non-technical language before using or showing this information to the user.
72
+
73
+ ## Quick vs Deep vs Recent
74
+
75
+ | Mode | Results | When |
76
+ |------|---------|------|
77
+ | deep | ~20 | Session start, strategy, broad analysis |
78
+ | quick | ~6 | Mid-session, specific area, quick lookup |
79
+ | recent | ~15 | Session start, understand WIP and state |
@@ -0,0 +1,48 @@
1
+ # MangoBrain Work — Workflow
2
+
3
+ MangoBrain provides persistent memory across sessions. This rule describes how to use it in daily workflow.
4
+
5
+ ## Principle
6
+
7
+ Memory is not a file to consult. It's an active system: ask for what you need, when you need it. It contains brand decisions, user feedback, target insights, content patterns, past mistakes — knowledge that documents alone don't transmit.
8
+
9
+ ## Query Language
10
+
11
+ **All remember() queries MUST use English keywords**, regardless of session language.
12
+ Memories are stored in English — queries in other languages degrade retrieval by ~15-20%. The conversation stays in the user's language, but queries go to the DB in English.
13
+
14
+ ## Integration with /brief
15
+
16
+ **INTAKE**: remember recent + deep + quick → full context before asking questions
17
+ **CLARIFICATION**: use context to NOT ask things you already know
18
+ **MATERIAL EXPLORATION**: search documents AND memory
19
+ **BRIEF**: the brief is informed by project history
20
+
21
+ ## Integration with /create
22
+
23
+ **RESEARCH**: the Researcher pulls from memory for brand, tone, audience, past content
24
+ **CREATION**: the Creator receives pre-digested context (does not query)
25
+ **REVIEW**: the Reviewer compares against past decisions and historical feedback
26
+ **CLOSE**: the Mem-manager saves new decisions, feedback, patterns
27
+
28
+ ## Free sessions
29
+
30
+ For sessions without /create (brainstorm, analysis, strategy):
31
+ - Use `remember` during the session
32
+ - At end of session: `/memorize-work`
33
+
34
+ ## What to memorize and what not to
35
+
36
+ ### YES — produces reusable knowledge
37
+ - Brand decision ("we use teal as primary color")
38
+ - User feedback ("the tone was too formal, prefers casual")
39
+ - Target insight ("musicians under 25 prefer Reels over static posts")
40
+ - Content pattern ("carousels with a question in the title perform better")
41
+ - Strategic choice ("for launch we focus on Instagram + TikTok, no LinkedIn")
42
+ - Mistake not to repeat ("the last CTA was too aggressive")
43
+
44
+ ### NO — not worth memorizing
45
+ - Discarded drafts and intermediate iterations
46
+ - Information already in rule files (those are auto-loaded every session)
47
+ - Generic facts not specific to the project
48
+ - Content already produced (the file exists, no need to duplicate it in memory)