-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_mcp.py
More file actions
67 lines (54 loc) · 2.07 KB
/
test_mcp.py
File metadata and controls
67 lines (54 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import json
from main import engine
def test_memory_bank():
print("=== Memory Bank MCP Test ===\n")
print("1. Creating memory session...")
session_id = engine.start_session(
problem="How to build a recommendation system?",
criteria="Scalable system with <100ms response time",
constraints=["Limited to open source tools", "$1000 budget"],
)
print(f"Started session: {session_id}\n")
print("2. Adding initial memories...")
memory1_id = engine.add_memory(
content="First principle: recommendations match user preferences based on behavior patterns",
confidence=0.9,
)
print(f"Added memory: {memory1_id}")
memory2_id = engine.add_memory(
content="Need to collect user interaction data: clicks, purchases, time spent",
dependencies=[memory1_id],
confidence=0.8,
)
print(f"Added memory: {memory2_id}")
memory3_id = engine.add_memory(
content="This approach is wrong - users don't always follow patterns",
dependencies=[memory1_id],
confidence=0.7,
)
print(f"Added memory with contradiction: {memory3_id}\n")
print("3. Creating collection for alternative approach...")
collection_id = engine.create_collection(
name="collaborative_filtering",
from_memory=memory2_id,
purpose="Explore user-user similarity approach",
)
print(f"Created collection: {collection_id}")
collection_memory_id = engine.add_memory(
content="Calculate user similarity using cosine similarity on interaction vectors",
collection_id=collection_id,
confidence=0.7,
)
print(f"Added collection memory: {collection_memory_id}\n")
print("4. Getting memory tree...")
tree = engine.get_memory_tree()
print(json.dumps(tree, indent=2))
print()
print("5. Analyzing memory quality...")
analysis = engine.get_analysis()
print(json.dumps(analysis, indent=2))
print()
print("6. Patterns detected:")
print(json.dumps(engine.patterns, indent=2))
if __name__ == "__main__":
test_memory_bank()