monomind 1.18.15 → 1.19.0

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 (183) hide show
  1. package/.claude/agents/core/researcher.md +29 -24
  2. package/.claude/agents/github/code-review-swarm.md +1 -1
  3. package/.claude/agents/github/github-modes.md +1 -1
  4. package/.claude/agents/github/issue-tracker.md +1 -1
  5. package/.claude/agents/github/multi-repo-swarm.md +1 -1
  6. package/.claude/agents/github/pr-manager.md +1 -1
  7. package/.claude/agents/github/project-board-sync.md +1 -1
  8. package/.claude/agents/github/release-manager.md +1 -1
  9. package/.claude/agents/github/repo-architect.md +1 -1
  10. package/.claude/agents/github/swarm-issue.md +1 -1
  11. package/.claude/agents/github/swarm-pr.md +1 -1
  12. package/.claude/agents/github/sync-coordinator.md +1 -1
  13. package/.claude/agents/github/workflow-automation.md +1 -1
  14. package/.claude/agents/goal/goal-planner.md +1 -1
  15. package/.claude/agents/specialized/specialized-workflow-architect.md +11 -14
  16. package/.claude/agents/testing/production-validator.md +8 -7
  17. package/.claude/agents/testing/testing-evidence-collector.md +3 -1
  18. package/.claude/commands/mastermind/code-review.md +4 -4
  19. package/.claude/commands/mastermind/help.md +2 -2
  20. package/.claude/commands/mastermind/okf-export.md +14 -0
  21. package/.claude/commands/mastermind/okf-import.md +15 -0
  22. package/.claude/helpers/handlers/agent-start-handler.cjs +11 -36
  23. package/.claude/helpers/handlers/capture-handler.cjs +110 -0
  24. package/.claude/helpers/handlers/route-handler.cjs +174 -247
  25. package/.claude/helpers/handlers/session-handler.cjs +139 -142
  26. package/.claude/helpers/handlers/session-restore-handler.cjs +15 -10
  27. package/.claude/helpers/handlers/task-handler.cjs +8 -155
  28. package/.claude/helpers/hook-handler.cjs +89 -5
  29. package/.claude/helpers/intelligence.cjs +164 -15
  30. package/.claude/helpers/learning-service.mjs +1 -0
  31. package/.claude/helpers/mastermind-activate.cjs +33 -51
  32. package/.claude/helpers/monolean-activate.cjs +13 -3
  33. package/.claude/helpers/monolean-propagate.cjs +7 -3
  34. package/.claude/helpers/router.cjs +47 -9
  35. package/.claude/settings.json +0 -20
  36. package/.claude/skills/mastermind-skills/architect.md +5 -6
  37. package/.claude/skills/mastermind-skills/autodev.md +8 -5
  38. package/.claude/skills/mastermind-skills/review.md +8 -5
  39. package/.claude/skills/mastermind-skills/techport.md +37 -3
  40. package/.claude/skills/monodesign/document.md +9 -6
  41. package/.claude/skills/monodesign/extract.md +1 -1
  42. package/.claude/skills/monodesign/reference/document.md +1 -1
  43. package/.claude/skills/monodesign/reference/live.md +1 -1
  44. package/.claude/skills/monolean/SKILL.md +1 -1
  45. package/package.json +1 -1
  46. package/packages/@monomind/cli/.claude/agents/core/researcher.md +29 -24
  47. package/packages/@monomind/cli/.claude/agents/github/code-review-swarm.md +1 -1
  48. package/packages/@monomind/cli/.claude/agents/github/github-modes.md +1 -1
  49. package/packages/@monomind/cli/.claude/agents/github/issue-tracker.md +1 -1
  50. package/packages/@monomind/cli/.claude/agents/github/multi-repo-swarm.md +1 -1
  51. package/packages/@monomind/cli/.claude/agents/github/pr-manager.md +1 -1
  52. package/packages/@monomind/cli/.claude/agents/github/project-board-sync.md +1 -1
  53. package/packages/@monomind/cli/.claude/agents/github/release-manager.md +1 -1
  54. package/packages/@monomind/cli/.claude/agents/github/repo-architect.md +1 -1
  55. package/packages/@monomind/cli/.claude/agents/github/swarm-issue.md +1 -1
  56. package/packages/@monomind/cli/.claude/agents/github/swarm-pr.md +1 -1
  57. package/packages/@monomind/cli/.claude/agents/github/sync-coordinator.md +1 -1
  58. package/packages/@monomind/cli/.claude/agents/github/workflow-automation.md +1 -1
  59. package/packages/@monomind/cli/.claude/agents/goal/goal-planner.md +1 -1
  60. package/packages/@monomind/cli/.claude/agents/specialized/specialized-workflow-architect.md +11 -14
  61. package/packages/@monomind/cli/.claude/agents/testing/production-validator.md +8 -7
  62. package/packages/@monomind/cli/.claude/agents/testing/testing-evidence-collector.md +3 -1
  63. package/packages/@monomind/cli/.claude/commands/mastermind/code-review.md +4 -4
  64. package/packages/@monomind/cli/.claude/commands/mastermind/help.md +2 -2
  65. package/packages/@monomind/cli/.claude/commands/mastermind/okf-export.md +14 -0
  66. package/packages/@monomind/cli/.claude/commands/mastermind/okf-import.md +15 -0
  67. package/packages/@monomind/cli/.claude/helpers/handlers/agent-start-handler.cjs +11 -36
  68. package/packages/@monomind/cli/.claude/helpers/handlers/capture-handler.cjs +110 -0
  69. package/packages/@monomind/cli/.claude/helpers/handlers/route-handler.cjs +174 -247
  70. package/packages/@monomind/cli/.claude/helpers/handlers/session-handler.cjs +139 -142
  71. package/packages/@monomind/cli/.claude/helpers/handlers/session-restore-handler.cjs +15 -10
  72. package/packages/@monomind/cli/.claude/helpers/handlers/task-handler.cjs +8 -155
  73. package/packages/@monomind/cli/.claude/helpers/hook-handler.cjs +89 -5
  74. package/packages/@monomind/cli/.claude/helpers/intelligence.cjs +164 -15
  75. package/packages/@monomind/cli/.claude/helpers/learning-service.mjs +1 -0
  76. package/packages/@monomind/cli/.claude/helpers/mastermind-activate.cjs +33 -51
  77. package/packages/@monomind/cli/.claude/helpers/monolean-activate.cjs +13 -3
  78. package/packages/@monomind/cli/.claude/helpers/monolean-propagate.cjs +7 -3
  79. package/packages/@monomind/cli/.claude/helpers/router.cjs +47 -9
  80. package/packages/@monomind/cli/.claude/skills/mastermind-skills/architect.md +5 -6
  81. package/packages/@monomind/cli/.claude/skills/mastermind-skills/autodev.md +8 -5
  82. package/packages/@monomind/cli/.claude/skills/mastermind-skills/review.md +8 -5
  83. package/packages/@monomind/cli/.claude/skills/mastermind-skills/techport.md +37 -3
  84. package/packages/@monomind/cli/.claude/skills/monodesign/document.md +9 -6
  85. package/packages/@monomind/cli/.claude/skills/monodesign/extract.md +1 -1
  86. package/packages/@monomind/cli/.claude/skills/monodesign/reference/document.md +1 -1
  87. package/packages/@monomind/cli/.claude/skills/monodesign/reference/live.md +1 -1
  88. package/packages/@monomind/cli/.claude/skills/monolean/SKILL.md +1 -1
  89. package/packages/@monomind/cli/bin/mcp-server.js +11 -1
  90. package/packages/@monomind/cli/dist/src/commands/agent-ops.d.ts +1 -2
  91. package/packages/@monomind/cli/dist/src/commands/agent-ops.js +1 -59
  92. package/packages/@monomind/cli/dist/src/commands/agent.js +2 -3
  93. package/packages/@monomind/cli/dist/src/commands/analyze-diff.js +1 -1
  94. package/packages/@monomind/cli/dist/src/commands/browse-action.js +94 -2
  95. package/packages/@monomind/cli/dist/src/commands/completions.js +11 -56
  96. package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.d.ts +1 -1
  97. package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.js +1 -1
  98. package/packages/@monomind/cli/dist/src/commands/hive-mind-helpers.js +2 -2
  99. package/packages/@monomind/cli/dist/src/commands/hive-mind-ops.d.ts +1 -3
  100. package/packages/@monomind/cli/dist/src/commands/hive-mind-ops.js +2 -116
  101. package/packages/@monomind/cli/dist/src/commands/hive-mind.js +2 -5
  102. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-commands.js +8 -7
  103. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-gaps.js +1 -1
  104. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-routing.js +2 -2
  105. package/packages/@monomind/cli/dist/src/commands/hooks-extended-commands.d.ts +0 -3
  106. package/packages/@monomind/cli/dist/src/commands/hooks-extended-commands.js +0 -307
  107. package/packages/@monomind/cli/dist/src/commands/hooks.js +1 -12
  108. package/packages/@monomind/cli/dist/src/commands/index.d.ts +3 -51
  109. package/packages/@monomind/cli/dist/src/commands/index.js +36 -184
  110. package/packages/@monomind/cli/dist/src/commands/init-wizard.js +2 -4
  111. package/packages/@monomind/cli/dist/src/commands/mcp.js +32 -4
  112. package/packages/@monomind/cli/dist/src/commands/memory-admin.d.ts +1 -2
  113. package/packages/@monomind/cli/dist/src/commands/memory-admin.js +1 -118
  114. package/packages/@monomind/cli/dist/src/commands/memory-transfer.d.ts +1 -2
  115. package/packages/@monomind/cli/dist/src/commands/memory-transfer.js +5 -171
  116. package/packages/@monomind/cli/dist/src/commands/memory.js +3 -6
  117. package/packages/@monomind/cli/dist/src/commands/neural-core.d.ts +3 -1
  118. package/packages/@monomind/cli/dist/src/commands/neural-core.js +145 -6
  119. package/packages/@monomind/cli/dist/src/commands/neural-optimize.js +4 -4
  120. package/packages/@monomind/cli/dist/src/commands/neural-registry.d.ts +1 -1
  121. package/packages/@monomind/cli/dist/src/commands/neural-registry.js +4 -4
  122. package/packages/@monomind/cli/dist/src/commands/neural.d.ts +1 -1
  123. package/packages/@monomind/cli/dist/src/commands/neural.js +6 -6
  124. package/packages/@monomind/cli/dist/src/commands/performance.js +68 -58
  125. package/packages/@monomind/cli/dist/src/commands/providers.js +2 -131
  126. package/packages/@monomind/cli/dist/src/commands/security-misc.d.ts +0 -1
  127. package/packages/@monomind/cli/dist/src/commands/security-misc.js +69 -45
  128. package/packages/@monomind/cli/dist/src/commands/security.js +2 -4
  129. package/packages/@monomind/cli/dist/src/commands/session.js +1 -285
  130. package/packages/@monomind/cli/dist/src/commands/start.js +2 -41
  131. package/packages/@monomind/cli/dist/src/commands/status.js +18 -29
  132. package/packages/@monomind/cli/dist/src/commands/swarm.js +1 -1
  133. package/packages/@monomind/cli/dist/src/commands/task.js +2 -49
  134. package/packages/@monomind/cli/dist/src/commands/workflow.js +2 -104
  135. package/packages/@monomind/cli/dist/src/index.js +7 -0
  136. package/packages/@monomind/cli/dist/src/init/executor.js +3 -14
  137. package/packages/@monomind/cli/dist/src/init/helpers-generator.js +2 -22
  138. package/packages/@monomind/cli/dist/src/init/settings-generator.js +0 -1
  139. package/packages/@monomind/cli/dist/src/init/types.d.ts +1 -3
  140. package/packages/@monomind/cli/dist/src/init/types.js +0 -2
  141. package/packages/@monomind/cli/dist/src/mcp-client.js +0 -6
  142. package/packages/@monomind/cli/dist/src/mcp-server.js +16 -0
  143. package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.js +0 -17
  144. package/packages/@monomind/cli/dist/src/mcp-tools/coherence/causal-infer.d.ts +5 -5
  145. package/packages/@monomind/cli/dist/src/mcp-tools/coherence/causal-infer.js +32 -46
  146. package/packages/@monomind/cli/dist/src/mcp-tools/coherence/consensus-verify.d.ts +2 -3
  147. package/packages/@monomind/cli/dist/src/mcp-tools/coherence/consensus-verify.js +22 -20
  148. package/packages/@monomind/cli/dist/src/mcp-tools/coherence/memory-gate.d.ts +3 -2
  149. package/packages/@monomind/cli/dist/src/mcp-tools/coherence/memory-gate.js +32 -19
  150. package/packages/@monomind/cli/dist/src/mcp-tools/coherence/quantum-topology.d.ts +4 -4
  151. package/packages/@monomind/cli/dist/src/mcp-tools/coherence/quantum-topology.js +11 -17
  152. package/packages/@monomind/cli/dist/src/mcp-tools/coherence/spectral-analyze.d.ts +2 -3
  153. package/packages/@monomind/cli/dist/src/mcp-tools/coherence/spectral-analyze.js +51 -32
  154. package/packages/@monomind/cli/dist/src/mcp-tools/coherence/types.d.ts +5 -9
  155. package/packages/@monomind/cli/dist/src/mcp-tools/guidance-tools.js +2 -2
  156. package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.js +25 -3
  157. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-routing.d.ts +0 -3
  158. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-routing.js +45 -159
  159. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.js +1 -4
  160. package/packages/@monomind/cli/dist/src/mcp-tools/index.d.ts +0 -2
  161. package/packages/@monomind/cli/dist/src/mcp-tools/index.js +0 -3
  162. package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.js +24 -0
  163. package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.js +428 -11
  164. package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.d.ts +4 -10
  165. package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.js +28 -54
  166. package/packages/@monomind/cli/dist/src/mcp-tools/performance-tools.js +5 -17
  167. package/packages/@monomind/cli/dist/src/mcp-tools/quality/coverage-analysis/prioritize-gaps.js +2 -2
  168. package/packages/@monomind/cli/dist/src/mcp-tools/quality/security-compliance/detect-secrets.d.ts +4 -4
  169. package/packages/@monomind/cli/dist/src/mcp-tools/quality-tools.d.ts +7 -2
  170. package/packages/@monomind/cli/dist/src/mcp-tools/quality-tools.js +7 -257
  171. package/packages/@monomind/cli/dist/src/memory/intelligence.d.ts +7 -8
  172. package/packages/@monomind/cli/dist/src/memory/intelligence.js +15 -16
  173. package/packages/@monomind/cli/dist/src/memory/memory-bridge.d.ts +1 -0
  174. package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +37 -0
  175. package/packages/@monomind/cli/dist/src/services/worker-daemon.d.ts +3 -21
  176. package/packages/@monomind/cli/dist/src/services/worker-daemon.js +13 -80
  177. package/packages/@monomind/cli/dist/src/suggest.js +0 -5
  178. package/packages/@monomind/cli/package.json +1 -1
  179. package/packages/@monomind/guidance/package.json +1 -74
  180. package/.claude/helpers/auto-memory-hook.mjs +0 -503
  181. package/packages/@monomind/cli/.claude/helpers/auto-memory-hook.mjs +0 -503
  182. package/packages/@monomind/cli/dist/src/commands/deployment.d.ts +0 -10
  183. package/packages/@monomind/cli/dist/src/commands/deployment.js +0 -706
@@ -35,26 +35,29 @@ You are a research specialist focused on thorough investigation, pattern analysi
35
35
 
36
36
  ## Research Methodology
37
37
 
38
- ### 1. Information Gathering
39
- - Use multiple search strategies (glob, grep, semantic search)
38
+ ### 1. Information Gathering (monograph-first)
39
+ - **Always start with monograph** call `monograph_query` or `monograph_suggest` before grep/find
40
+ - Only fall back to grep/find if monograph returns 0 results or the DB is not built
40
41
  - Read relevant files completely for context
41
42
  - Check multiple locations for related information
42
- - Consider different naming conventions and patterns
43
43
 
44
44
  ### 2. Pattern Analysis
45
- ```bash
46
- # Example search patterns
47
- - Implementation patterns: grep -r "class.*Controller" --include="*.ts"
48
- - Configuration patterns: glob "**/*.config.*"
49
- - Test patterns: grep -r "describe\|test\|it" --include="*.test.*"
50
- - Import patterns: grep -r "^import.*from" --include="*.ts"
45
+ ```
46
+ # Preferred: monograph for symbol/definition lookups
47
+ monograph_query({ query: "Controller" }) # find controller classes
48
+ monograph_query({ query: "config" }) # find configuration patterns
49
+ monograph_suggest({ task: "test patterns" }) # find test-related files
50
+
51
+ # Fallback only (if monograph returns 0 results):
52
+ grep -r "class.*Controller" --include="*.ts"
53
+ grep -r "^import.*from" --include="*.ts"
51
54
  ```
52
55
 
53
56
  ### 3. Dependency Analysis
54
- - Track import statements and module dependencies
55
- - Identify external package dependencies
56
- - Map internal module relationships
57
- - Document API contracts and interfaces
57
+ - **Use `monograph_neighbors` and `monograph_impact`** for dependency mapping
58
+ - Call `monograph_god_nodes` for high-centrality files
59
+ - Call `monograph_community` for module cluster boundaries
60
+ - Fall back to grep on import statements only if monograph is unavailable
58
61
 
59
62
  ### 4. Documentation Mining
60
63
  - Extract inline comments and JSDoc
@@ -98,21 +101,23 @@ research_findings:
98
101
 
99
102
  ## Search Strategies
100
103
 
101
- ### 1. Broad to Narrow
102
- ```bash
103
- # Start broad
104
- glob "**/*.ts"
105
- # Narrow by pattern
104
+ ### 1. Monograph-First (preferred)
105
+ ```
106
+ # Start with monograph for any symbol or code lookup
107
+ monograph_query({ query: "symbol-name" }) # BM25 keyword search
108
+ monograph_suggest({ task: "description of task" }) # ranked file suggestions
109
+ monograph_neighbors({ name: "ClassName" }) # direct connections
110
+ monograph_impact({ name: "functionName" }) # blast radius
111
+
112
+ # Only if monograph returns 0 results or DB not built:
106
113
  grep -r "specific-pattern" --include="*.ts"
107
- # Focus on specific files
108
- read specific-file.ts
109
114
  ```
110
115
 
111
116
  ### 2. Cross-Reference
112
- - Search for class/function definitions
113
- - Find all usages and references
114
- - Track data flow through the system
115
- - Identify integration points
117
+ - Use `monograph_neighbors` for usages and references
118
+ - Use `monograph_shortest_path` to trace connections between modules
119
+ - Use `monograph_context` for 360° view of a file
120
+ - Fall back to grep only if monograph is unavailable
116
121
 
117
122
  ### 3. Historical Analysis
118
123
  - Review git history for context
@@ -2,7 +2,7 @@
2
2
  name: code-review-swarm
3
3
  description: |
4
4
  Deploy specialized AI agents to perform comprehensive, intelligent code reviews that go beyond traditional static analysis
5
- tools: mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__task_orchestrate, Bash, Read, Write, TodoWrite
5
+ tools: mcp__monomind__swarm_init, mcp__monomind__agent_spawn, Bash, Read, Write, TodoWrite
6
6
  ---
7
7
 
8
8
  # Code Review Swarm - Automated Code Review with AI Agents
@@ -2,7 +2,7 @@
2
2
  name: github-modes
3
3
  description: |
4
4
  Comprehensive GitHub integration modes for workflow orchestration, PR management, and repository coordination with batch optimization
5
- tools: mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__task_orchestrate, Bash, TodoWrite, Read, Write
5
+ tools: mcp__monomind__swarm_init, mcp__monomind__agent_spawn, Bash, TodoWrite, Read, Write
6
6
  ---
7
7
 
8
8
  # GitHub Integration Modes
@@ -2,7 +2,7 @@
2
2
  name: issue-tracker
3
3
  description: |
4
4
  Intelligent issue management and project coordination with automated tracking, progress monitoring, and team coordination
5
- tools: mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__task_orchestrate, mcp__monomind__memory_store, Bash, TodoWrite, Read, Write
5
+ tools: mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__memory_store, Bash, TodoWrite, Read, Write
6
6
  ---
7
7
 
8
8
  # GitHub Issue Tracker
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: multi-repo-swarm
3
3
  description: Cross-repository swarm orchestration for organization-wide automation and intelligent collaboration
4
- tools: Bash, Read, Write, Edit, Glob, Grep, LS, TodoWrite, mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__task_orchestrate, mcp__monomind__swarm_status, mcp__monomind__memory_usage, mcp__monomind__github_repo_analyze, mcp__monomind__github_pr_manage, mcp__monomind__github_sync_coord, mcp__monomind__github_metrics
4
+ tools: Bash, Read, Write, Edit, Glob, Grep, LS, TodoWrite, mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__swarm_status, mcp__monomind__memory_usage, mcp__monomind__github_repo_analyze, mcp__monomind__github_pr_manage, mcp__monomind__github_sync_coord, mcp__monomind__github_metrics
5
5
  ---
6
6
 
7
7
  # Multi-Repo Swarm - Cross-Repository Swarm Orchestration
@@ -2,7 +2,7 @@
2
2
  name: pr-manager
3
3
  description: |
4
4
  Comprehensive pull request management with swarm coordination for automated reviews, testing, and merge workflows
5
- tools: Bash, Read, Write, Edit, Glob, Grep, LS, TodoWrite, mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__task_orchestrate, mcp__monomind__swarm_status, mcp__monomind__memory_store, mcp__monomind__github_pr_manage, mcp__monomind__github_code_review, mcp__monomind__github_metrics
5
+ tools: Bash, Read, Write, Edit, Glob, Grep, LS, TodoWrite, mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__swarm_status, mcp__monomind__memory_store, mcp__monomind__github_pr_manage, mcp__monomind__github_code_review, mcp__monomind__github_metrics
6
6
  ---
7
7
 
8
8
  # GitHub PR Manager
@@ -2,7 +2,7 @@
2
2
  name: project-board-sync
3
3
  description: |
4
4
  Synchronize AI swarms with GitHub Projects for visual task management, progress tracking, and team coordination
5
- tools: Bash, Read, Write, Edit, Glob, Grep, LS, TodoWrite, mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__task_orchestrate, mcp__monomind__swarm_status, mcp__monomind__memory_usage, mcp__monomind__github_repo_analyze, mcp__monomind__github_pr_manage, mcp__monomind__github_issue_track, mcp__monomind__github_metrics, mcp__monomind__workflow_create, mcp__monomind__workflow_execute
5
+ tools: Bash, Read, Write, Edit, Glob, Grep, LS, TodoWrite, mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__swarm_status, mcp__monomind__memory_usage, mcp__monomind__github_repo_analyze, mcp__monomind__github_pr_manage, mcp__monomind__github_issue_track, mcp__monomind__github_metrics, mcp__monomind__workflow_create, mcp__monomind__workflow_execute
6
6
  ---
7
7
 
8
8
  # Project Board Sync - GitHub Projects Integration
@@ -2,7 +2,7 @@
2
2
  name: release-manager
3
3
  description: |
4
4
  Automated release coordination and deployment with Monomind swarm orchestration for seamless version management, testing, and deployment across multiple packages
5
- tools: Bash, Read, Write, Edit, TodoWrite, TodoRead, Task, WebFetch, mcp__github__create_pull_request, mcp__github__merge_pull_request, mcp__github__create_branch, mcp__github__push_files, mcp__github__create_issue, mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__task_orchestrate, mcp__monomind__memory_store
5
+ tools: Bash, Read, Write, Edit, TodoWrite, TodoRead, Task, WebFetch, mcp__github__create_pull_request, mcp__github__merge_pull_request, mcp__github__create_branch, mcp__github__push_files, mcp__github__create_issue, mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__memory_store
6
6
  ---
7
7
 
8
8
  # GitHub Release Manager
@@ -2,7 +2,7 @@
2
2
  name: repo-architect
3
3
  description: |
4
4
  Repository structure optimization and multi-repo management with Monomind swarm coordination for scalable project architecture and development workflows
5
- tools: Bash, Read, Write, Edit, LS, Glob, TodoWrite, TodoRead, Task, WebFetch, mcp__github__create_repository, mcp__github__fork_repository, mcp__github__search_repositories, mcp__github__push_files, mcp__github__create_or_update_file, mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__task_orchestrate, mcp__monomind__memory_store
5
+ tools: Bash, Read, Write, Edit, LS, Glob, TodoWrite, TodoRead, Task, WebFetch, mcp__github__create_repository, mcp__github__fork_repository, mcp__github__search_repositories, mcp__github__push_files, mcp__github__create_or_update_file, mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__memory_store
6
6
  ---
7
7
 
8
8
  # GitHub Repository Architect
@@ -2,7 +2,7 @@
2
2
  name: swarm-issue
3
3
  description: |
4
4
  GitHub issue-based swarm coordination agent that transforms issues into intelligent multi-agent tasks with automatic decomposition and progress tracking
5
- tools: mcp__github__get_issue, mcp__github__create_issue, mcp__github__update_issue, mcp__github__list_issues, mcp__github__create_issue_comment, mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__task_orchestrate, mcp__monomind__memory_usage, TodoWrite, TodoRead, Bash, Grep, Read, Write
5
+ tools: mcp__github__get_issue, mcp__github__create_issue, mcp__github__update_issue, mcp__github__list_issues, mcp__github__create_issue_comment, mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__memory_usage, TodoWrite, TodoRead, Bash, Grep, Read, Write
6
6
  ---
7
7
 
8
8
  # Swarm Issue - Issue-Based Swarm Coordination
@@ -2,7 +2,7 @@
2
2
  name: swarm-pr
3
3
  description: |
4
4
  Pull request swarm management agent that coordinates multi-agent code review, validation, and integration workflows with automated PR lifecycle management
5
- tools: mcp__github__get_pull_request, mcp__github__create_pull_request, mcp__github__update_pull_request, mcp__github__list_pull_requests, mcp__github__create_pr_comment, mcp__github__get_pr_diff, mcp__github__merge_pull_request, mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__task_orchestrate, mcp__monomind__memory_usage, mcp__monomind__coordination_sync, TodoWrite, TodoRead, Bash, Grep, Read, Write, Edit
5
+ tools: mcp__github__get_pull_request, mcp__github__create_pull_request, mcp__github__update_pull_request, mcp__github__list_pull_requests, mcp__github__create_pr_comment, mcp__github__get_pr_diff, mcp__github__merge_pull_request, mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__memory_usage, mcp__monomind__coordination_sync, TodoWrite, TodoRead, Bash, Grep, Read, Write, Edit
6
6
  ---
7
7
 
8
8
  # Swarm PR - Managing Swarms through Pull Requests
@@ -2,7 +2,7 @@
2
2
  name: sync-coordinator
3
3
  description: |
4
4
  Multi-repository synchronization coordinator that manages version alignment, dependency synchronization, and cross-package integration with intelligent swarm orchestration
5
- tools: mcp__github__push_files, mcp__github__create_or_update_file, mcp__github__get_file_contents, mcp__github__create_pull_request, mcp__github__search_repositories, mcp__github__list_repositories, mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__task_orchestrate, mcp__monomind__memory_store, mcp__monomind__coordination_sync, mcp__monomind__load_balance, TodoWrite, TodoRead, Bash, Read, Write, Edit, MultiEdit
5
+ tools: mcp__github__push_files, mcp__github__create_or_update_file, mcp__github__get_file_contents, mcp__github__create_pull_request, mcp__github__search_repositories, mcp__github__list_repositories, mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__memory_store, mcp__monomind__coordination_sync, mcp__monomind__load_balance, TodoWrite, TodoRead, Bash, Read, Write, Edit, MultiEdit
6
6
  ---
7
7
 
8
8
  # GitHub Sync Coordinator
@@ -2,7 +2,7 @@
2
2
  name: workflow-automation
3
3
  description: |
4
4
  GitHub Actions workflow automation agent that creates intelligent, self-organizing CI/CD pipelines with adaptive multi-agent coordination and automated optimization
5
- tools: mcp__github__create_workflow, mcp__github__update_workflow, mcp__github__list_workflows, mcp__github__get_workflow_runs, mcp__github__create_workflow_dispatch, mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__task_orchestrate, mcp__monomind__memory_usage, mcp__monomind__performance_report, mcp__monomind__bottleneck_analyze, mcp__monomind__workflow_create, mcp__monomind__automation_setup, TodoWrite, TodoRead, Bash, Read, Write, Edit, Grep
5
+ tools: mcp__github__create_workflow, mcp__github__update_workflow, mcp__github__list_workflows, mcp__github__get_workflow_runs, mcp__github__create_workflow_dispatch, mcp__monomind__swarm_init, mcp__monomind__agent_spawn, mcp__monomind__memory_usage, mcp__monomind__performance_report, mcp__monomind__bottleneck_analyze, mcp__monomind__workflow_create, mcp__monomind__automation_setup, TodoWrite, TodoRead, Bash, Read, Write, Edit, Grep
6
6
  ---
7
7
 
8
8
  # Workflow Automation - GitHub Actions Integration
@@ -87,7 +87,7 @@ Advanced action definitions with tool groups:
87
87
  Action: analyze_codebase
88
88
  Preconditions: {repository_accessible: true}
89
89
  Effects: {code_analyzed: true, metrics_available: true}
90
- Tools: [grep, ast_parser, complexity_analyzer]
90
+ Tools: [monograph_query, monograph_suggest, grep (fallback), ast_parser, complexity_analyzer]
91
91
  Execution: hybrid (LLM for insights, code for metrics)
92
92
  Cost: 2
93
93
  Fallback: manual_review if tools unavailable
@@ -440,27 +440,24 @@ Use this when joining a new project or auditing an existing system:
440
440
 
441
441
  ### Step 0: Discovery Pass (always first)
442
442
 
443
- Before designing anything, discover what already exists:
443
+ Before designing anything, discover what already exists. **Use monograph first** — fall back to grep only if monograph returns 0 results or the DB is not built.
444
+
445
+ ```
446
+ # PREFERRED: monograph-based discovery
447
+ monograph_query({ query: "route handler" }) # find all route entry points
448
+ monograph_query({ query: "worker job consumer" }) # find background processors
449
+ monograph_query({ query: "state transition status" })# find state machines
450
+ monograph_route_map({}) # list all HTTP routes with handlers
451
+ monograph_suggest({ task: "workflow entry points, workers, state machines, cron jobs" })
452
+ ```
444
453
 
445
454
  ```bash
446
- # Find all workflow entry points (adapt patterns to your framework)
455
+ # FALLBACK (only if monograph returns 0 results):
447
456
  grep -rn "router\.\(post\|put\|delete\|get\|patch\)" src/routes/ --include="*.ts" --include="*.js"
448
457
  grep -rn "@app\.\(route\|get\|post\|put\|delete\)" src/ --include="*.py"
449
- grep -rn "HandleFunc\|Handle(" cmd/ pkg/ --include="*.go"
450
-
451
- # Find all background workers / job processors
452
458
  find src/ -type f -name "*worker*" -o -name "*job*" -o -name "*consumer*" -o -name "*processor*"
453
-
454
- # Find all state transitions in the codebase
455
459
  grep -rn "status.*=\|\.status\s*=\|state.*=\|\.state\s*=" src/ --include="*.ts" --include="*.py" --include="*.go" | grep -v "test\|spec\|mock"
456
-
457
- # Find all database migrations
458
460
  find . -path "*/migrations/*" -type f | head -30
459
-
460
- # Find all infrastructure resources
461
- find . -name "*.tf" -o -name "docker-compose*.yml" -o -name "*.yaml" | xargs grep -l "resource\|service:" 2>/dev/null
462
-
463
- # Find all scheduled / cron jobs
464
461
  grep -rn "cron\|schedule\|setInterval\|@Scheduled" src/ --include="*.ts" --include="*.py" --include="*.go" --include="*.java"
465
462
  ```
466
463
 
@@ -245,17 +245,18 @@ describe('Performance Validation', () => {
245
245
 
246
246
  ### 1. Code Quality Validation
247
247
 
248
+ **Preferred: monograph-based code quality scan:**
249
+ ```
250
+ monograph_query({ query: "mock fake stub" }) # find mock implementations in prod code
251
+ monograph_query({ query: "TODO FIXME" }) # find unfinished work in critical paths
252
+ monograph_query({ query: "console log warn error" }) # find console statements
253
+ ```
254
+
255
+ **Fallback (if monograph returns 0 results or DB not built):**
248
256
  ```bash
249
- # No mock implementations in production code
250
257
  grep -r "mock\|fake\|stub" src/ --exclude-dir=__tests__ --exclude="*.test.*" --exclude="*.spec.*"
251
-
252
- # No TODO/FIXME in critical paths
253
258
  grep -r "TODO\|FIXME" src/ --exclude-dir=__tests__
254
-
255
- # No hardcoded test data
256
259
  grep -r "test@\|example\|localhost" src/ --exclude-dir=__tests__
257
-
258
- # No console.log statements
259
260
  grep -r "console\." src/ --exclude-dir=__tests__
260
261
  ```
261
262
 
@@ -47,7 +47,9 @@ You are **EvidenceQA**, a skeptical QA specialist who requires visual proof for
47
47
  # 2. Check what's actually built
48
48
  ls -la resources/views/ || ls -la *.html
49
49
 
50
- # 3. Reality check for claimed features
50
+ # 3. Reality check for claimed features (monograph-first, grep fallback)
51
+ # Preferred: monograph_query({ query: "luxury premium glass morphism" })
52
+ # Fallback:
51
53
  grep -r "luxury\|premium\|glass\|morphism" . --include="*.html" --include="*.css" --include="*.blade.php" || echo "NO PREMIUM FEATURES FOUND"
52
54
 
53
55
  # 4. Review comprehensive test results
@@ -66,10 +66,10 @@ Based on `STACK`, determine which specialist agents to run beyond the always-on
66
66
  - `Security Engineer` — injection, auth gaps, secrets exposure, CVE-prone patterns, OWASP Top 10
67
67
  - `Reality Checker` — evidence-based assessment: does the code actually do what it claims?
68
68
 
69
- **Run conditionally** — detect by running these checks and adding the agent if exit 0:
70
- - `Accessibility Auditor` — `find . -maxdepth 5 \( -name "*.html" -o -name "*.jsx" -o -name "*.tsx" \) -not -path "*/node_modules/*" | head -1 | grep -q .`
71
- - `API Tester` — `find . -maxdepth 5 \( -name "*.route.*" -o -name "openapi.yml" -o -name "openapi.json" -o -name "swagger.*" \) -not -path "*/node_modules/*" | head -1 | grep -q . || grep -rqEl "express\(|fastify|hono|koa|router\." --include="*.ts" --include="*.js" . 2>/dev/null`
72
- - `Database Optimizer` — `find . -maxdepth 5 \( -name "*.sql" -o -name "*migration*" -o -name "*schema*" \) -not -path "*/node_modules/*" | head -1 | grep -q . || grep -rqEl "prisma|typeorm|sequelize|drizzle|knex" --include="*.ts" --include="*.js" . 2>/dev/null`
69
+ **Run conditionally** — use `monograph_query` first to detect stack; fall back to find/grep if monograph returns 0 results:
70
+ - `Accessibility Auditor` — `monograph_query({ query: "html jsx tsx component" })` or `find . -maxdepth 5 \( -name "*.html" -o -name "*.jsx" -o -name "*.tsx" \) -not -path "*/node_modules/*" | head -1 | grep -q .`
71
+ - `API Tester` — `monograph_query({ query: "express fastify hono koa router route openapi swagger" })` or `find . -maxdepth 5 \( -name "*.route.*" -o -name "openapi.yml" -o -name "openapi.json" -o -name "swagger.*" \) -not -path "*/node_modules/*" | head -1 | grep -q . || grep -rqEl "express\(|fastify|hono|koa|router\." --include="*.ts" --include="*.js" . 2>/dev/null`
72
+ - `Database Optimizer` — `monograph_query({ query: "prisma typeorm sequelize drizzle knex sql migration schema" })` or `find . -maxdepth 5 \( -name "*.sql" -o -name "*migration*" -o -name "*schema*" \) -not -path "*/node_modules/*" | head -1 | grep -q . || grep -rqEl "prisma|typeorm|sequelize|drizzle|knex" --include="*.ts" --include="*.js" . 2>/dev/null`
73
73
  - `SRE` — `find . -maxdepth 3 \( -name "Dockerfile" -o -name "docker-compose*" -o -name "*.yml" -path "*/.github/workflows/*" \) | head -1 | grep -q .`
74
74
  - `Mobile App Builder` — `find . -maxdepth 3 \( -name "*.swift" -o -name "*.kt" \) | head -1 | grep -q . || grep -q "react-native" package.json 2>/dev/null`
75
75
 
@@ -97,8 +97,8 @@ mcp__monomind__memory_store({ key: "...", value: "...", namespace: "..." })
97
97
  mcp__monomind__memory_search({ query: "...", namespace: "..." })
98
98
 
99
99
  // Knowledge graph
100
- mcp__monomind__graphify_suggest({ task: "..." })
101
- mcp__monomind__graphify_query({ query: "..." })
100
+ mcp__monomind__monograph_suggest({ task: "..." })
101
+ mcp__monomind__monograph_query({ query: "..." })
102
102
 
103
103
  // Swarm
104
104
  mcp__monomind__swarm_init({ topology: "hierarchical", maxAgents: 8, strategy: "specialized" })
@@ -0,0 +1,14 @@
1
+ <!-- Export the Second Brain knowledge base as a portable OKF (Open Knowledge Format) bundle. -->
2
+
3
+ Parse `$ARGUMENTS` for:
4
+ - `--output <dir>` or `-o <dir>` → output directory (default: `.monomind/knowledge-export`)
5
+ - `--scope <name>` or `-s <name>` → knowledge scope (default: `shared`)
6
+ - Remaining positional arg → treated as output directory
7
+
8
+ Run the export:
9
+
10
+ ```bash
11
+ npx monomind doc export -o "<output_dir>" -s "<scope>"
12
+ ```
13
+
14
+ After completion, report what was exported and where. If 0 documents exported, suggest `monomind doc ingest <path>` first.
@@ -0,0 +1,15 @@
1
+ <!-- Import an OKF (Open Knowledge Format) bundle into the Second Brain knowledge base. -->
2
+
3
+ Parse `$ARGUMENTS` for:
4
+ - `--scope <name>` or `-s <name>` → knowledge scope (default: `shared`)
5
+ - Remaining positional arg → bundle directory path (REQUIRED)
6
+
7
+ If no bundle directory provided, ask: "Which directory contains the OKF bundle to import?"
8
+
9
+ Run the import:
10
+
11
+ ```bash
12
+ npx monomind doc ingest "<bundle_dir>" -s "<scope>"
13
+ ```
14
+
15
+ After completion, report files processed, chunks indexed, and any errors. If the bundle directory doesn't exist or contains no `.md` files, say so.
@@ -65,44 +65,19 @@ module.exports = {
65
65
  );
66
66
  } catch (e) { /* non-fatal — never block a subagent from starting */ }
67
67
 
68
- // Subagent context inheritance — inject graph god nodes + parent's last
69
- // pre-resolved suggestions so the spawned agent inherits spatial map.
68
+ // monolean: compact single-line graph context instead of multi-line map.
69
+ // Subagents get task-relevant files only god nodes are noise for a focused task.
70
70
  try {
71
- var subDb = _openMonographDb();
72
- if (subDb) {
73
- try {
74
- var godRows = subDb.prepare(
75
- "SELECT n.name, n.label, n.file_path AS file, " +
76
- "(SELECT COUNT(*) FROM edges WHERE source_id=n.id OR target_id=n.id) AS deg " +
77
- "FROM nodes n " +
78
- "WHERE n.label NOT IN ('Concept') AND n.file_path IS NOT NULL AND n.file_path != '' " +
79
- "ORDER BY deg DESC LIMIT 5"
80
- ).all();
81
- if (godRows.length > 0) {
82
- console.log('[MONOGRAPH_SUBAGENT_CTX] Graph map inherited from parent:');
83
- for (var gi = 0; gi < godRows.length; gi++) {
84
- var gr = godRows[gi];
85
- console.log(' · ' + gr.name + ' [' + gr.label + '] — ' + (gr.file || '') + ' (deg ' + gr.deg + ')');
86
- }
87
- try {
88
- var subAgentDesc = hookInput.description || hookInput.prompt_description || '';
89
- if (subAgentDesc && subAgentDesc.length > 8) {
90
- var subHints = getMonographSuggestions(subAgentDesc, 3);
91
- if (subHints.length > 0) {
92
- console.log(' Top files for this subagent task:');
93
- for (var si2 = 0; si2 < subHints.length; si2++) {
94
- var sh = subHints[si2];
95
- console.log(' · ' + sh.name + ' [' + sh.label + '] — ' + (sh.file || ''));
96
- }
97
- }
98
- }
99
- } catch (_) {}
100
- console.log(' Use mcp__monomind__monograph_suggest / monograph_query in this subagent before grepping.');
101
- }
102
- } catch (e) { /* non-fatal */ }
71
+ var subAgentDesc = hookInput.description || hookInput.prompt_description || '';
72
+ if (subAgentDesc && subAgentDesc.length > 8) {
73
+ var subHints = getMonographSuggestions(subAgentDesc, 3);
74
+ if (subHints.length > 0) {
75
+ var parts = subHints.map(function(s) {
76
+ return s.name + ' [' + s.label + '] ' + (s.file || '');
77
+ });
78
+ console.log('[MONOGRAPH] Top files: ' + parts.join(' · '));
79
+ }
103
80
  }
104
81
  } catch (e) { /* non-fatal */ }
105
-
106
- console.log('[OK] Agent registered');
107
82
  },
108
83
  };
@@ -370,6 +370,84 @@ async function handleSubagentStop(hookInput) {
370
370
  ts: Date.now(),
371
371
  }) + '\n');
372
372
  }
373
+
374
+ // ── Wire captured interaction into EpisodicStore ────
375
+ try {
376
+ var episodicPath = path.join(CWD, '.monomind', 'episodic', 'episodes.jsonl');
377
+ var episodicDir = path.dirname(episodicPath);
378
+ if (!fs.existsSync(episodicDir)) fs.mkdirSync(episodicDir, { recursive: true });
379
+
380
+ // Append a lightweight episode entry directly (avoid importing @monomind/memory)
381
+ var episodeEntry = {
382
+ episodeId: require('crypto').randomUUID(),
383
+ sessionId: session || '',
384
+ runIds: [runId || 'unknown'],
385
+ summary: [
386
+ '[agent:' + (agentType || 'unknown') + ']',
387
+ summary ? summary.slice(0, 500) : '',
388
+ totalTin ? '[memory:write] tokens_in=' + totalTin : '',
389
+ totalTout ? '[memory:write] tokens_out=' + totalTout : ''
390
+ ].filter(Boolean).join('\n'),
391
+ startedAt: snap.ts || Date.now(),
392
+ endedAt: Date.now(),
393
+ agentSlugs: [agentType || 'unknown'],
394
+ taskTypes: [agentType || 'unknown'],
395
+ tokenEstimate: Math.ceil(((summary || '').length) / 4)
396
+ };
397
+ fs.appendFileSync(episodicPath, JSON.stringify(episodeEntry) + '\n', 'utf-8');
398
+ } catch (e) { /* non-fatal */ }
399
+
400
+ // ── Record agent interaction in Monograph SQLite ────────────────────────────
401
+ try {
402
+ var mgDbPath = path.join(CWD, '.monomind', 'monograph.db');
403
+ if (fs.existsSync(mgDbPath)) {
404
+ var monographMod = null;
405
+ var mgCandidates = [
406
+ path.join(CWD, 'node_modules/.pnpm/node_modules/@monoes/monograph'),
407
+ path.join(CWD, 'packages/node_modules/.pnpm/node_modules/@monoes/monograph'),
408
+ path.join(CWD, 'node_modules/@monoes/monograph'),
409
+ ];
410
+ for (var mi = 0; mi < mgCandidates.length; mi++) {
411
+ try { if (fs.existsSync(mgCandidates[mi])) { monographMod = require(mgCandidates[mi]); break; } } catch (e2) {}
412
+ }
413
+ if (!monographMod) { try { monographMod = require('@monoes/monograph'); } catch (e2) {} }
414
+ if (monographMod && monographMod.openDb) {
415
+ var mgDb = monographMod.openDb(mgDbPath);
416
+ try {
417
+ mgDb.prepare(
418
+ 'INSERT OR IGNORE INTO agent_interactions ' +
419
+ '(id, session_id, org_name, agent_type, parent_agent, prompt_summary, result_summary, tokens_in, tokens_out, cost_usd, success, duration_ms, timestamp) ' +
420
+ 'VALUES (@id, @session_id, @org_name, @agent_type, @parent_agent, @prompt_summary, @result_summary, @tokens_in, @tokens_out, @cost_usd, @success, @duration_ms, @timestamp)'
421
+ ).run({
422
+ id: require('crypto').randomUUID(),
423
+ session_id: session || '',
424
+ org_name: org || null,
425
+ agent_type: agentType || 'unknown',
426
+ parent_agent: null,
427
+ prompt_summary: agentDesc ? agentDesc.slice(0, 500) : null,
428
+ result_summary: summary ? summary.slice(0, 1000) : null,
429
+ tokens_in: totalTin || 0,
430
+ tokens_out: totalTout || 0,
431
+ cost_usd: costUsd || 0,
432
+ success: (function() {
433
+ // Determine success from result summary — errors/failures/exceptions indicate failure
434
+ if (summary) {
435
+ var sumLower = summary.toLowerCase();
436
+ if (sumLower.includes('error') || sumLower.includes('failed') || sumLower.includes('exception') || sumLower.includes('fatal')) {
437
+ return 0;
438
+ }
439
+ }
440
+ return 1;
441
+ })(),
442
+ duration_ms: snap.ts ? (Date.now() - snap.ts) : 0,
443
+ timestamp: Date.now(),
444
+ });
445
+ } finally {
446
+ if (monographMod.closeDb) monographMod.closeDb(mgDb);
447
+ }
448
+ }
449
+ }
450
+ } catch (e) { /* non-fatal — monograph may not be available */ }
373
451
  }
374
452
 
375
453
  // ─── Phase 3: PreToolUse accumulator (Issue 9) ────────────────────────────────
@@ -424,6 +502,38 @@ async function handlePostTool(hookInput) {
424
502
 
425
503
  const isBash = toolName === 'bash' || toolName === 'shell';
426
504
  const isEdit = toolName === 'edit' || toolName === 'write' || toolName === 'multiedit';
505
+ const isMemoryStore = toolName.includes('memory_store') || toolName.includes('memory_pattern');
506
+ const isMemorySearch = toolName.includes('memory_search') || toolName.includes('memory_retrieve');
507
+
508
+ // Track real memory ops (writes stats to session file)
509
+ if (isMemoryStore || isMemorySearch) {
510
+ try {
511
+ var sessionId = process.env.CLAUDE_SESSION_ID || '';
512
+ var statsPath = path.join(CWD, '.monomind', 'memory-ops-' + sessionId.slice(0, 16) + '.json');
513
+ var stats = { writes: 0, searches: 0, redundantWrites: 0, emptySearches: 0 };
514
+ try { stats = JSON.parse(fs.readFileSync(statsPath, 'utf-8')); } catch {}
515
+ if (isMemoryStore) {
516
+ stats.writes++;
517
+ // Detect duplicate: response contains "already exists" or "duplicate"
518
+ var respStr = JSON.stringify(toolResponse).toLowerCase();
519
+ if (respStr.includes('duplicate') || respStr.includes('already exists') || respStr.includes('skip')) {
520
+ stats.redundantWrites++;
521
+ }
522
+ }
523
+ if (isMemorySearch) {
524
+ stats.searches++;
525
+ // Detect empty results
526
+ var results = toolResponse.results || toolResponse.entries || toolResponse.data;
527
+ if (Array.isArray(results) && results.length === 0) {
528
+ stats.emptySearches++;
529
+ } else if (toolResponse.count === 0 || toolResponse.total === 0) {
530
+ stats.emptySearches++;
531
+ }
532
+ }
533
+ fs.mkdirSync(path.dirname(statsPath), { recursive: true });
534
+ fs.writeFileSync(statsPath, JSON.stringify(stats), 'utf-8');
535
+ } catch (e) { /* non-fatal */ }
536
+ }
427
537
 
428
538
  if (!isBash && !isEdit) return;
429
539