@grec0/memory-bank-mcp 0.2.0 → 0.2.2

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.
package/README.md CHANGED
@@ -59,6 +59,13 @@ With Memory Bank, AIs:
59
59
  - **🆔 Identity Management**: Tracks who is doing what (GitHub Copilot, Cursor, etc.)
60
60
  - **🔒 Atomic Locks**: File-system based locking safe across different processes/IDEs
61
61
 
62
+ ### Task Orchestration (Smart Routing) 🧭 NEW
63
+ - **🎯 Intelligent Routing**: Analyzes tasks BEFORE implementation to determine ownership
64
+ - **📋 Enriched Project Registry**: Projects have responsibilities, ownership, and exports metadata
65
+ - **🤖 AI Reasoning**: Uses reasoning models to distribute work across projects
66
+ - **🔀 Auto-Delegation**: Automatically identifies what should be delegated to other projects
67
+ - **📦 Import Suggestions**: Recommends what to import from other projects instead of reimplementing
68
+
62
69
  ## 📋 Requirements
63
70
 
64
71
  - **Node.js** >= 18.0.0
@@ -294,13 +301,16 @@ Reads generated documentation.
294
301
  1. Index code
295
302
  memorybank_index_code({ projectId: "my-project" })
296
303
 
297
- 2. Generate documentation
304
+ 2. Generate documentation (also updates global registry)
298
305
  memorybank_generate_project_docs({ projectId: "my-project" })
299
306
 
300
307
  3. Query documentation at the start of each session
301
308
  memorybank_get_project_docs({ projectId: "my-project", document: "activeContext" })
302
309
 
303
- 4. Search specific code
310
+ 4. Route task BEFORE implementing (mandatory in auto-index mode)
311
+ memorybank_route_task({ projectId: "my-project", taskDescription: "..." })
312
+
313
+ 5. Search specific code
304
314
  memorybank_search({ projectId: "my-project", query: "..." })
305
315
  ```
306
316
 
@@ -308,6 +318,21 @@ Reads generated documentation.
308
318
 
309
319
  If you configure `MEMORYBANK_AUTO_UPDATE_DOCS=true`, documents will be automatically regenerated after each indexing. This is useful for keeping documentation always up to date but consumes more API tokens.
310
320
 
321
+ ### Upgrading Existing Projects 🆕
322
+
323
+ If you have projects already initialized with a previous version, simply regenerate the docs to enable Task Orchestration:
324
+
325
+ ```json
326
+ // For each existing project:
327
+ memorybank_generate_project_docs({ "projectId": "your-project", "force": true })
328
+ ```
329
+
330
+ This will:
331
+ 1. Regenerate all 6 markdown documents
332
+ 2. **NEW**: Extract responsibilities, ownership, and exports
333
+ 3. **NEW**: Update `global_registry.json` with enriched metadata
334
+ 4. Enable `memorybank_route_task` to work with this project
335
+
311
336
  ---
312
337
 
313
338
  ## 🤖 Multi-Agent Coordination
@@ -382,6 +407,71 @@ memorybank_delegate_task({
382
407
  })
383
408
  ```
384
409
 
410
+ ### Task Orchestration (Smart Routing) 🧭 NEW
411
+
412
+ The **Task Orchestrator** analyzes tasks BEFORE implementation to prevent agents from creating code that belongs to other projects.
413
+
414
+ #### Why is this needed?
415
+
416
+ Without orchestration, agents often:
417
+ - ❌ Create DTOs in the API project when `lib-dtos` exists
418
+ - ❌ Duplicate utilities that are already in `shared-utils`
419
+ - ❌ Implement features that belong to other microservices
420
+ - ❌ Violate architectural boundaries unknowingly
421
+
422
+ With the orchestrator:
423
+ - ✅ Know exactly what belongs to this project
424
+ - ✅ Automatically delegate work to the right project
425
+ - ✅ Get import suggestions instead of reimplementing
426
+ - ✅ Respect ecosystem boundaries
427
+
428
+ #### How It Works
429
+
430
+ 1. **Enriched Registry**: When you run `memorybank_generate_project_docs`, it automatically extracts:
431
+ - `responsibilities`: What this project is responsible for
432
+ - `owns`: Files/folders that belong to this project
433
+ - `exports`: What this project provides to others
434
+ - `projectType`: api, library, frontend, backend, etc.
435
+
436
+ 2. **Route Before Implementing**: Call `memorybank_route_task` BEFORE any code changes:
437
+ ```json
438
+ memorybank_route_task({
439
+ "projectId": "my-api",
440
+ "taskDescription": "Create DTOs for user management and expose REST endpoints"
441
+ })
442
+ ```
443
+
444
+ 3. **Orchestrator Response**:
445
+ ```json
446
+ {
447
+ "action": "partial_delegate",
448
+ "myResponsibilities": [
449
+ "Create REST endpoints in src/controllers/",
450
+ "Implement business logic in src/services/"
451
+ ],
452
+ "delegations": [
453
+ {
454
+ "targetProjectId": "lib-dtos",
455
+ "taskTitle": "Create UserDTO and UserResponseDTO",
456
+ "reason": "DTOs belong to lib-dtos per project responsibilities"
457
+ }
458
+ ],
459
+ "suggestedImports": [
460
+ "import { UserDTO } from 'lib-dtos'"
461
+ ],
462
+ "architectureNotes": "Use shared DTOs to maintain consistency across services"
463
+ }
464
+ ```
465
+
466
+ #### Possible Actions
467
+
468
+ | Action | Meaning |
469
+ |--------|--------|
470
+ | `implement_here` | Everything belongs to this project, proceed |
471
+ | `delegate_all` | Nothing belongs here, delegate everything |
472
+ | `partial_delegate` | Some parts belong here, delegate the rest |
473
+ | `needs_clarification` | Task is ambiguous, ask user for details |
474
+
385
475
  ---
386
476
 
387
477
  ## 🔀 Multi-Project: Cross-Project Queries
@@ -524,9 +614,36 @@ Analyzes project indexing coverage.
524
614
  }
525
615
  ```
526
616
 
617
+ ### `memorybank_route_task` 🆕
618
+
619
+ Analyzes a task and determines what belongs to this project vs what should be delegated. **MUST be called BEFORE any implementation.**
620
+
621
+ **Parameters:**
622
+ - `projectId` **(REQUIRED)**: Project requesting the routing
623
+ - `taskDescription` **(REQUIRED)**: Detailed description of what needs to be implemented
624
+
625
+ **Example:**
626
+ ```json
627
+ {
628
+ "projectId": "my-api",
629
+ "taskDescription": "Create user registration endpoint with validation and DTOs"
630
+ }
631
+ ```
632
+
633
+ **Response:**
634
+ ```json
635
+ {
636
+ "action": "partial_delegate",
637
+ "myResponsibilities": ["Create POST /users endpoint", "Add validation middleware"],
638
+ "delegations": [{ "targetProjectId": "lib-dtos", "taskTitle": "Create UserDTO" }],
639
+ "suggestedImports": ["import { UserDTO } from 'lib-dtos'"],
640
+ "architectureNotes": "Follow REST conventions, use shared DTOs"
641
+ }
642
+ ```
643
+
527
644
  ### `memorybank_generate_project_docs`
528
645
 
529
- Generates structured project documentation using AI with reasoning.
646
+ Generates structured project documentation using AI with reasoning. **Also automatically updates the global registry with enriched project metadata** (responsibilities, owns, exports, projectType).
530
647
 
531
648
  **Parameters:**
532
649
  - `projectId` **(REQUIRED)**: Project identifier
@@ -721,11 +838,13 @@ Memory Bank includes instruction templates in two formats to configure agent beh
721
838
  **For active development with automatic synchronization.**
722
839
 
723
840
  - ✅ Agent consults Memory Bank automatically
841
+ - ✅ **Routes tasks before implementing** (Rule 0.5)
724
842
  - ✅ Reindexes EVERY file after modifying it
725
843
  - ✅ Keeps Memory Bank always up to date
726
844
  - ✅ Can read/write files directly
845
+ - ✅ **Auto-delegates to other projects** when appropriate
727
846
 
728
- **Ideal for**: Active development, rapid iteration, teams.
847
+ **Ideal for**: Active development, rapid iteration, teams, **multi-project ecosystems**.
729
848
 
730
849
  ### 3. Sandboxed Mode
731
850
 
@@ -889,9 +1008,37 @@ Claude: [executes memorybank_generate_project_docs({ projectId: "my-app" })]
889
1008
  - techContext.md: Tech stack
890
1009
  ...
891
1010
 
1011
+ Also updated the global registry with project responsibilities.
892
1012
  You can query them anytime with memorybank_get_project_docs
893
1013
  ```
894
1014
 
1015
+ ### 5. Task Orchestration (Multi-Project) 🆕
1016
+
1017
+ ```
1018
+ User: I need to add a UserDTO for the new registration endpoint
1019
+ Claude: [executes memorybank_route_task({
1020
+ projectId: "my-api",
1021
+ taskDescription: "Create UserDTO for registration endpoint"
1022
+ })]
1023
+
1024
+ The orchestrator analyzed your ecosystem and determined:
1025
+
1026
+ ❌ DTOs should NOT be created in my-api
1027
+ ✅ DTOs belong to lib-dtos project
1028
+
1029
+ I'll delegate the DTO creation to lib-dtos and import it:
1030
+
1031
+ [executes memorybank_delegate_task({
1032
+ projectId: "my-api",
1033
+ targetProjectId: "lib-dtos",
1034
+ title: "Create UserDTO",
1035
+ description: "DTO for user registration with email, password fields"
1036
+ })]
1037
+
1038
+ Task delegated! Once lib-dtos creates the DTO, you can:
1039
+ import { UserDTO } from 'lib-dtos'
1040
+ ```
1041
+
895
1042
  ---
896
1043
 
897
1044
  ## 🔧 Configuration Files
@@ -1034,17 +1034,18 @@ ${techContext ? `TECHNICAL CONTEXT:\n${techContext.content}` : ''}
1034
1034
  Extract the following information in JSON format:
1035
1035
  {
1036
1036
  "description": "A concise 1-2 sentence description of what this project does",
1037
- "responsibilities": ["List of 3-5 specific things this project is responsible for"],
1038
- "owns": ["File patterns or types this project owns, e.g., '*DTO.ts', 'services/', 'controllers/'"],
1037
+ "responsibilities": ["COMPLETE list of ALL things this project is responsible for - do NOT limit, include everything"],
1038
+ "owns": ["ALL file patterns or directories this project owns, e.g., '*DTO.ts', 'services/', 'controllers/'"],
1039
1039
  "projectType": "One of: api, library, frontend, backend, cli, service, monorepo, fullstack",
1040
1040
  "exports": "Package name if it's a library (e.g., '@company/lib-dtos'), or null if not applicable",
1041
- "keywords": ["5-8 keywords describing this project"]
1041
+ "keywords": ["Relevant keywords describing this project"]
1042
1042
  }
1043
1043
 
1044
1044
  IMPORTANT:
1045
- - Be specific about responsibilities - they help the orchestrator decide where code belongs
1046
- - For "owns", think about what file patterns ONLY this project should create
1045
+ - responsibilities MUST be COMPLETE - list ALL responsibilities, not just 3-5. Missing responsibilities will cause the orchestrator to fail at delegating tasks correctly.
1046
+ - For "owns", include ALL file patterns and directories that ONLY this project should create/modify
1047
1047
  - If it's a library, identify what it exports/provides to other projects
1048
+ - Be thorough - incomplete information leads to incorrect task routing
1048
1049
 
1049
1050
  Respond ONLY with the JSON object, no markdown or explanation.`;
1050
1051
  try {
@@ -1,2 +1,2 @@
1
1
  // Version of the MCP Kanban server
2
- export const VERSION = "0.1.39";
2
+ export const VERSION = "0.2.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grec0/memory-bank-mcp",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "MCP server for semantic code indexing with Memory Bank - AI-powered codebase understanding",
5
5
  "license": "MIT",
6
6
  "author": "@grec0",