We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/danielsimonjr/memory-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
PHASE_6_SPRINT_3_TODO.json•8.57 kB
{
"phase": 6,
"sprint": 3,
"title": "NameIndex Utilization",
"priority": "HIGH",
"effort": "2.25 hours",
"status": "completed",
"impact": "Eliminate unnecessary graph loads for entity existence checks by using existing O(1) NameIndex where applicable",
"targetMetrics": {
"addTagsLookup": { "current": "loadGraph() + O(n) find()", "target": "O(1) getEntityByName()" },
"setImportanceLookup": { "current": "loadGraph() + O(n) find()", "target": "O(1) getEntityByName()" },
"removeTagsLookup": { "current": "getGraphForMutation() + O(n) find()", "target": "Review - different pattern, may not be optimizable" }
},
"tasks": [
{
"id": 1,
"category": "Core",
"description": "Optimize addTags Entity Existence Check - Replace loadGraph() + find() with getEntityByName() for O(1) entity lookup in EntityManager.addTags()",
"status": "completed",
"estimatedHours": 0.75,
"agent": "haiku",
"files": ["src/core/EntityManager.ts"],
"location": "Lines 342-362 (addTags method)",
"testCategories": [
"All existing addTags tests must pass",
"Benchmark should show improvement"
],
"currentCode": {
"description": "Current O(n) implementation",
"lines": "const readGraph = await this.storage.loadGraph();\nconst entity = readGraph.entities.find(e => e.name === entityName);\nif (!entity) {\n throw new EntityNotFoundError(entityName);\n}"
},
"optimizedCode": {
"description": "Optimized O(1) implementation",
"lines": "const entity = this.storage.getEntityByName(entityName);\nif (!entity) {\n throw new EntityNotFoundError(entityName);\n}"
},
"stepByStep": [
"Open src/core/EntityManager.ts",
"Locate addTags method (search for 'async addTags')",
"Remove or comment out: const readGraph = await this.storage.loadGraph();",
"Replace: const entity = readGraph.entities.find(e => e.name === entityName);",
"With: const entity = this.storage.getEntityByName(entityName);",
"Verify rest of method still works (existingTags access, updateEntity call)",
"Run: npx vitest run tests/unit/core/EntityManager.test.ts -t 'addTags'"
],
"importantNote": "The entity from getEntityByName() is the same object reference as in the graph. Reads are valid, but we correctly use updateEntity() for mutations - this is already the case in the current code.",
"acceptanceCriteria": [
"addTags uses getEntityByName() instead of loadGraph() + find()",
"No loadGraph() call in addTags method",
"All addTags tests pass",
"No changes to method signature or return type"
]
},
{
"id": 2,
"category": "Core",
"description": "Optimize setImportance Entity Existence Check - Replace loadGraph() + find() with getEntityByName() for O(1) entity lookup in EntityManager.setImportance()",
"status": "completed",
"estimatedHours": 0.5,
"agent": "haiku",
"files": ["src/core/EntityManager.ts"],
"location": "Lines 417-433 (setImportance method)",
"testCategories": [
"All existing setImportance tests must pass"
],
"currentCode": {
"description": "Current O(n) implementation",
"lines": "const readGraph = await this.storage.loadGraph();\nconst entity = readGraph.entities.find(e => e.name === entityName);\nif (!entity) {\n throw new EntityNotFoundError(entityName);\n}"
},
"optimizedCode": {
"description": "Optimized O(1) implementation",
"lines": "const entity = this.storage.getEntityByName(entityName);\nif (!entity) {\n throw new EntityNotFoundError(entityName);\n}"
},
"stepByStep": [
"Locate setImportance method (search for 'async setImportance')",
"Apply same pattern as addTags",
"Remove loadGraph() call, use getEntityByName() instead",
"Run: npx vitest run tests/unit/core/EntityManager.test.ts -t 'importance'"
],
"acceptanceCriteria": [
"setImportance uses getEntityByName() instead of loadGraph() + find()",
"All setImportance tests pass",
"No changes to method signature or return type"
]
},
{
"id": 3,
"category": "Core",
"description": "Analyze removeTags Pattern - Review removeTags implementation to determine if optimization is applicable. Note: removeTags uses getGraphForMutation() + saveGraph() pattern (full graph mutation), not loadGraph() + updateEntity() pattern.",
"status": "completed",
"estimatedHours": 0.25,
"agent": "haiku",
"files": ["src/core/EntityManager.ts"],
"location": "Lines 372-406 (removeTags method)",
"testCategories": [
"Verify current implementation pattern"
],
"currentCode": {
"description": "Current implementation uses getGraphForMutation() for full graph mutation",
"lines": "const graph = await this.storage.getGraphForMutation();\nconst timestamp = new Date().toISOString();\n\nconst entity = graph.entities.find(e => e.name === entityName);\nif (!entity) {\n throw new EntityNotFoundError(entityName);\n}\n// ... modifies entity.tags directly ...\nawait this.storage.saveGraph(graph);"
},
"analysis": {
"note": "removeTags uses a different pattern than addTags/setImportance. It calls getGraphForMutation() which returns a mutable graph reference, modifies the entity directly, then calls saveGraph(). This is fundamentally different from the loadGraph() + updateEntity() pattern.",
"optimizationOptions": [
"Option A: Refactor to use updateEntity() pattern (requires code change beyond simple optimization)",
"Option B: Use Set-based lookup within the existing graph reference (replace find() with Map lookup)",
"Option C: Keep as-is since getGraphForMutation() already provides direct graph access"
],
"recommendation": "Option C - The optimization benefit is minimal here since we already have direct graph access. The find() is only called once per removeTags call, not in a loop. Focus optimization efforts on batch operations instead."
},
"stepByStep": [
"Locate removeTags method at line 367",
"Verify it uses getGraphForMutation() + saveGraph() pattern",
"Document that this method is NOT a candidate for the same optimization as addTags/setImportance",
"Update metrics document to note this finding"
],
"acceptanceCriteria": [
"removeTags implementation pattern documented",
"Decision recorded on whether to optimize or skip",
"No changes made if optimization not applicable"
]
},
{
"id": 4,
"category": "Verification",
"description": "Run Full Test Suite and Update Metrics - Verify all tests pass and update metrics document with Sprint 3 results",
"status": "completed",
"estimatedHours": 0.75,
"agent": "haiku",
"files": ["docs/reports/PHASE_6_BASELINE_METRICS.md"],
"testCategories": [
"All 2109 tests must pass"
],
"commands": [
"npm run typecheck",
"npm test",
"npx vitest run tests/performance/optimization-benchmarks.test.ts"
],
"implementation": {
"newSection": "## Post-Optimization Measurements (Sprint 3)",
"table": "| Operation | Pre (ms) | Post (ms) | Improvement |"
},
"acceptanceCriteria": [
"All 2109 tests pass",
"Post-Sprint-3 metrics documented",
"Improvement factors calculated for addTags, setImportance, removeTags"
]
}
],
"successCriteria": [
"addTags and setImportance use getEntityByName() for O(1) lookups",
"removeTags pattern analyzed and documented (uses different mutation pattern)",
"No unnecessary loadGraph() calls for existence checks in applicable methods",
"All 2109 tests pass",
"Benchmark shows improvement for entity operations"
],
"filesModified": [
"src/core/EntityManager.ts",
"docs/reports/PHASE_6_BASELINE_METRICS.md"
],
"filesCreated": [],
"totalNewTests": 0,
"totalEstimatedHours": 2.25,
"dependencies": [1],
"notes": "Can run in parallel with Sprint 2 after Sprint 1 completes. The NameIndex already exists and is maintained by GraphStorage - we're just using it instead of doing redundant O(n) searches. This optimization is especially impactful when called repeatedly (e.g., adding tags to many entities in sequence)."
}