memory-journal-mcp 4.4.2 → 4.5.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 (73) hide show
  1. package/.github/workflows/lint-and-test.yml +1 -1
  2. package/.github/workflows/security-update.yml +1 -1
  3. package/CHANGELOG.md +81 -1
  4. package/DOCKER_README.md +57 -7
  5. package/Dockerfile +17 -17
  6. package/README.md +65 -6
  7. package/SECURITY.md +27 -35
  8. package/dist/cli.js +10 -0
  9. package/dist/cli.js.map +1 -1
  10. package/dist/constants/ServerInstructions.d.ts +5 -1
  11. package/dist/constants/ServerInstructions.d.ts.map +1 -1
  12. package/dist/constants/ServerInstructions.js +137 -83
  13. package/dist/constants/ServerInstructions.js.map +1 -1
  14. package/dist/database/SqliteAdapter.d.ts +2 -1
  15. package/dist/database/SqliteAdapter.d.ts.map +1 -1
  16. package/dist/database/SqliteAdapter.js +15 -8
  17. package/dist/database/SqliteAdapter.js.map +1 -1
  18. package/dist/handlers/resources/index.d.ts +3 -1
  19. package/dist/handlers/resources/index.d.ts.map +1 -1
  20. package/dist/handlers/resources/index.js +5 -2
  21. package/dist/handlers/resources/index.js.map +1 -1
  22. package/dist/handlers/tools/index.d.ts.map +1 -1
  23. package/dist/handlers/tools/index.js +63 -16
  24. package/dist/handlers/tools/index.js.map +1 -1
  25. package/dist/server/McpServer.d.ts +2 -0
  26. package/dist/server/McpServer.d.ts.map +1 -1
  27. package/dist/server/McpServer.js +43 -2
  28. package/dist/server/McpServer.js.map +1 -1
  29. package/dist/server/Scheduler.d.ts +91 -0
  30. package/dist/server/Scheduler.d.ts.map +1 -0
  31. package/dist/server/Scheduler.js +201 -0
  32. package/dist/server/Scheduler.js.map +1 -0
  33. package/dist/utils/logger.d.ts.map +1 -1
  34. package/dist/utils/logger.js +6 -3
  35. package/dist/utils/logger.js.map +1 -1
  36. package/dist/utils/security-utils.d.ts +0 -21
  37. package/dist/utils/security-utils.d.ts.map +1 -1
  38. package/dist/utils/security-utils.js +0 -47
  39. package/dist/utils/security-utils.js.map +1 -1
  40. package/hooks/README.md +107 -0
  41. package/hooks/cursor/hooks.json +10 -0
  42. package/hooks/cursor/memory-journal.mdc +22 -0
  43. package/hooks/cursor/session-end.sh +19 -0
  44. package/hooks/kilo-code/session-end-mode.json +11 -0
  45. package/hooks/kiro/session-end.md +13 -0
  46. package/package.json +8 -8
  47. package/releases/v4.5.0.md +116 -0
  48. package/scripts/generate-server-instructions.ts +176 -0
  49. package/scripts/server-instructions-function-body.ts +77 -0
  50. package/server.json +3 -3
  51. package/src/cli.ts +26 -0
  52. package/src/constants/ServerInstructions.ts +137 -83
  53. package/src/constants/server-instructions.md +262 -0
  54. package/src/database/SqliteAdapter.ts +22 -8
  55. package/src/handlers/resources/index.ts +8 -2
  56. package/src/handlers/tools/index.ts +70 -20
  57. package/src/server/McpServer.ts +60 -2
  58. package/src/server/Scheduler.ts +278 -0
  59. package/src/utils/logger.ts +6 -3
  60. package/src/utils/security-utils.ts +0 -52
  61. package/tests/constants/server-instructions.test.ts +26 -0
  62. package/tests/database/sqlite-adapter.test.ts +84 -0
  63. package/tests/filtering/tool-filter.test.ts +46 -0
  64. package/tests/handlers/github-resource-handlers.test.ts +453 -0
  65. package/tests/handlers/github-tool-handlers.test.ts +899 -0
  66. package/tests/handlers/prompt-handlers.test.ts +40 -0
  67. package/tests/handlers/resource-handlers.test.ts +32 -0
  68. package/tests/handlers/tool-handlers.test.ts +13 -2
  69. package/tests/security/sql-injection.test.ts +3 -54
  70. package/tests/server/mcp-server.test.ts +491 -5
  71. package/tests/server/scheduler.test.ts +400 -0
  72. package/tests/vector/vector-search-manager.test.ts +60 -0
  73. package/.vscode/settings.json +0 -84
@@ -1,10 +1,14 @@
1
1
  /**
2
2
  * Server instructions for Memory Journal MCP.
3
3
  *
4
+ * ⚠️ AUTO-GENERATED — DO NOT EDIT THIS FILE DIRECTLY
5
+ * Edit src/constants/server-instructions.md instead,
6
+ * then run: npm run generate:instructions
7
+ *
4
8
  * These instructions are automatically sent to MCP clients during initialization,
5
9
  * providing guidance for AI agents on tool usage.
6
10
  *
7
- * Unreleased: Optimized for token efficiency with tiered instruction levels.
11
+ * Optimized for token efficiency with tiered instruction levels.
8
12
  */
9
13
 
10
14
  import type { ToolGroup } from '../types/index.js'
@@ -52,23 +56,48 @@ export type InstructionLevel = 'essential' | 'standard' | 'full'
52
56
  const ESSENTIAL_INSTRUCTIONS = `# memory-journal-mcp
53
57
 
54
58
  ## Session Start
59
+
55
60
  1. Read \`memory://briefing\` for project context
61
+ - In Cursor, use \`FetchMcpResource(server: "user-memory-journal-mcp", uri: "memory://briefing")\`
56
62
  2. **Show the \`userMessage\` to the user** (it contains a formatted summary of project context)
57
63
  3. Proceed with the user's request
58
64
 
59
65
  ## Behaviors
66
+
60
67
  - **Create entries for**: implementations, decisions, bug fixes, milestones, user requests to "remember"
61
68
  - **Search before**: major decisions, referencing prior work, understanding project context
62
69
  - **Link entries**: implementation→spec, bugfix→issue, followup→prior work
63
70
 
71
+ ## Session End
72
+
73
+ When a conversation or task is wrapping up (user says "thanks," final deliverable complete, no more work planned):
74
+
75
+ 1. Create a journal entry summarizing the session:
76
+ - **What was accomplished** (key changes, decisions, files modified)
77
+ - **What's unfinished or blocked** (pending items, open questions)
78
+ - **Context for next session** (relevant entry IDs, branch names, PR numbers)
79
+ 2. Use \`entry_type: "retrospective"\` and tag with \`session-summary\`
80
+ 3. This is opt-out — ALWAYS create the entry, even for short/trivial sessions, unless the user explicitly says to skip it
81
+
82
+ > If your client has hooks configured for session-end journaling (e.g., Cursor \`sessionEnd\` hook), this is handled automatically. Otherwise, follow the steps above.
83
+
84
+ ## Rule & Skill Suggestions
85
+
86
+ When you notice the user consistently applies patterns, preferences, or workflows that could be codified:
87
+
88
+ - **Offer to create a rule or skill** — always ask the user first, never create silently
89
+ - Examples: coding conventions, testing patterns, deployment steps, project-specific commands
90
+ - Frame it as: "I noticed you always [pattern]. Would you like me to save this as a rule/skill so future agents follow it automatically?"
91
+
64
92
  ## Quick Access
65
- | Purpose | Action |
66
- |---------|--------|
67
- | Session context | \`memory://briefing\` |
68
- | Recent entries | \`memory://recent\` |
69
- | Health/time | \`memory://health\` |
70
- | Semantic search | \`semantic_search(query)\` |
71
- | Full context | \`get-context-bundle\` prompt |
93
+
94
+ | Purpose | Action |
95
+ | --------------- | --------------------------- |
96
+ | Session context | \`memory://briefing\` |
97
+ | Recent entries | \`memory://recent\` |
98
+ | Health/time | \`memory://health\` |
99
+ | Semantic search | \`semantic_search(query)\` |
100
+ | Full context | \`get-context-bundle\` prompt |
72
101
  `
73
102
 
74
103
  /**
@@ -76,6 +105,7 @@ const ESSENTIAL_INSTRUCTIONS = `# memory-journal-mcp
76
105
  */
77
106
  const GITHUB_INSTRUCTIONS = `
78
107
  ## GitHub Integration
108
+
79
109
  - Include \`issue_number\`/\`pr_number\` in \`create_entry\` to auto-link
80
110
  - After closing issue/merging PR → create summary entry with learnings
81
111
  - CI failures → \`actions-failure-digest\` prompt or \`memory://actions/recent\`
@@ -91,26 +121,34 @@ const SERVER_ACCESS_INSTRUCTIONS = `
91
121
  ## How to Access This Server
92
122
 
93
123
  ### Calling Tools
124
+
94
125
  Use \`CallMcpTool\` with server name \`user-memory-journal-mcp\`:
126
+
95
127
  \`\`\`
96
128
  CallMcpTool(server: "user-memory-journal-mcp", toolName: "create_entry", arguments: {...})
97
129
  \`\`\`
98
130
 
99
131
  ### Listing Resources
132
+
100
133
  Use \`ListMcpResources\` with server name:
134
+
101
135
  \`\`\`
102
136
  ListMcpResources(server: "user-memory-journal-mcp")
103
137
  \`\`\`
138
+
104
139
  Do NOT try to browse filesystem paths for MCP tool/resource definitions - use the MCP protocol directly.
105
140
 
106
141
  ### Fetching Resources
142
+
107
143
  Use \`FetchMcpResource\` with server name and \`memory://\` URI:
144
+
108
145
  \`\`\`
109
146
  FetchMcpResource(server: "user-memory-journal-mcp", uri: "memory://recent")
110
147
  FetchMcpResource(server: "user-memory-journal-mcp", uri: "memory://kanban/1")
111
148
  \`\`\`
112
149
 
113
150
  ## Quick Health Check
151
+
114
152
  Fetch \`memory://health\` to verify server status, database stats, and tool availability.
115
153
  `
116
154
 
@@ -121,57 +159,64 @@ const TOOL_PARAMETER_REFERENCE = `
121
159
  ## Tool Parameter Reference
122
160
 
123
161
  ### Entry Operations
124
- | Tool | Required Parameters | Optional Parameters |
125
- |------|---------------------|---------------------|
126
- | \`create_entry\` | \`content\` (string) | \`entry_type\`, \`tags\` (array), \`is_personal\`, \`significance_type\`, \`share_with_team\`, \`auto_context\`, \`issue_number\`, \`issue_url\`, \`pr_number\`, \`pr_url\`, \`pr_status\`, \`project_number\`, \`project_owner\`, \`workflow_run_id\`, \`workflow_name\`, \`workflow_status\` |
127
- | \`create_entry_minimal\` | \`content\` (string) | none |
128
- | \`get_entry_by_id\` | \`entry_id\` (number) | \`include_relationships\` (bool, default true) |
129
- | \`get_recent_entries\` | none | \`limit\` (default 5), \`is_personal\` (bool) |
130
- | \`update_entry\` | \`entry_id\` (number) | \`content\`, \`tags\`, \`entry_type\`, \`is_personal\` |
131
- | \`delete_entry\` | \`entry_id\` (number) | \`permanent\` (bool, default false) |
132
- | \`list_tags\` | none | none |
162
+
163
+ | Tool | Required Parameters | Optional Parameters |
164
+ | ---------------------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
165
+ | \`create_entry\` | \`content\` (string) | \`entry_type\`, \`tags\` (array), \`is_personal\`, \`significance_type\`, \`share_with_team\`, \`auto_context\`, \`issue_number\`, \`issue_url\`, \`pr_number\`, \`pr_url\`, \`pr_status\`, \`project_number\`, \`project_owner\`, \`workflow_run_id\`, \`workflow_name\`, \`workflow_status\` |
166
+ | \`create_entry_minimal\` | \`content\` (string) | none |
167
+ | \`get_entry_by_id\` | \`entry_id\` (number) | \`include_relationships\` (bool, default true) |
168
+ | \`get_recent_entries\` | none | \`limit\` (default 5), \`is_personal\` (bool) |
169
+ | \`update_entry\` | \`entry_id\` (number) | \`content\`, \`tags\`, \`entry_type\`, \`is_personal\` |
170
+ | \`delete_entry\` | \`entry_id\` (number) | \`permanent\` (bool, default false) |
171
+ | \`list_tags\` | none | none |
133
172
 
134
173
  ### Search Tools
135
- | Tool | Required Parameters | Optional Parameters |
136
- |------|---------------------|---------------------|
137
- | \`search_entries\` | none | \`query\`, \`limit\`, \`is_personal\`, \`issue_number\`, \`pr_number\`, \`pr_status\`, \`project_number\`, \`workflow_run_id\` |
138
- | \`search_by_date_range\` | \`start_date\`, \`end_date\` (YYYY-MM-DD) | \`tags\`, \`entry_type\`, \`is_personal\`, \`issue_number\`, \`pr_number\`, \`project_number\`, \`workflow_run_id\` |
139
- | \`semantic_search\` | \`query\` (string) | \`limit\`, \`similarity_threshold\` (default 0.25), \`is_personal\`, \`hint_on_empty\` (bool, default true) |
140
- | \`get_vector_index_stats\` | none | none |
174
+
175
+ | Tool | Required Parameters | Optional Parameters |
176
+ | ------------------------ | ------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
177
+ | \`search_entries\` | none | \`query\`, \`limit\`, \`is_personal\`, \`issue_number\`, \`pr_number\`, \`pr_status\`, \`project_number\`, \`workflow_run_id\` |
178
+ | \`search_by_date_range\` | \`start_date\`, \`end_date\` (YYYY-MM-DD) | \`tags\`, \`entry_type\`, \`is_personal\`, \`issue_number\`, \`pr_number\`, \`project_number\`, \`workflow_run_id\` |
179
+ | \`semantic_search\` | \`query\` (string) | \`limit\`, \`similarity_threshold\` (default 0.25), \`is_personal\`, \`hint_on_empty\` (bool, default true) |
180
+ | \`get_vector_index_stats\` | none | none |
141
181
 
142
182
  ### Relationship Tools
143
- | Tool | Required Parameters | Notes |
144
- |------|---------------------|-------|
145
- | \`link_entries\` | \`from_entry_id\`, \`to_entry_id\` (numbers) | Types: \`evolves_from\`, \`references\`, \`implements\`, \`clarifies\`, \`response_to\`, \`blocked_by\`, \`resolved\`, \`caused\`. Optional \`description\`. |
146
- | \`visualize_relationships\` | none | Optional \`entry_id\`, \`tags\` (array), \`depth\` (1-3, default 2), \`limit\` (default 20). Returns Mermaid diagram. |
183
+
184
+ | Tool | Required Parameters | Notes |
185
+ | ------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
186
+ | \`link_entries\` | \`from_entry_id\`, \`to_entry_id\` (numbers) | Types: \`evolves_from\`, \`references\`, \`implements\`, \`clarifies\`, \`response_to\`, \`blocked_by\`, \`resolved\`, \`caused\`. Optional \`description\`. |
187
+ | \`visualize_relationships\` | none | Optional \`entry_id\`, \`tags\` (array), \`depth\` (1-3, default 2), \`limit\` (default 20). Returns Mermaid diagram. |
147
188
 
148
189
  ### GitHub Tools
149
- | Tool | Required Parameters | Notes |
150
- |------|---------------------|-------|
151
- | \`get_github_context\` | none | Returns repo info, open issues/PRs. Only counts OPEN items. |
152
- | \`get_github_issues\` | none | Optional \`state\` (open/closed/all), \`limit\`, \`owner\`, \`repo\` |
153
- | \`get_github_prs\` | none | Optional \`state\`, \`limit\`, \`owner\`, \`repo\` |
154
- | \`get_github_issue\` | \`issue_number\` (number) | Optional \`owner\`, \`repo\`. Fetches single issue details. |
155
- | \`get_github_pr\` | \`pr_number\` (number) | Optional \`owner\`, \`repo\`. Fetches single PR details. |
156
- | \`get_repo_insights\` | none | Optional \`sections\` (stars/traffic/referrers/paths/all, default "stars"), \`owner\`, \`repo\`. Requires push access for traffic. |
190
+
191
+ | Tool | Required Parameters | Notes |
192
+ | -------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
193
+ | \`get_github_context\` | none | Returns repo info, open issues/PRs. Only counts OPEN items. |
194
+ | \`get_github_issues\` | none | Optional \`state\` (open/closed/all), \`limit\`, \`owner\`, \`repo\` |
195
+ | \`get_github_prs\` | none | Optional \`state\`, \`limit\`, \`owner\`, \`repo\` |
196
+ | \`get_github_issue\` | \`issue_number\` (number) | Optional \`owner\`, \`repo\`. Fetches single issue details. |
197
+ | \`get_github_pr\` | \`pr_number\` (number) | Optional \`owner\`, \`repo\`. Fetches single PR details. |
198
+ | \`get_repo_insights\` | none | Optional \`sections\` (stars/traffic/referrers/paths/all, default "stars"), \`owner\`, \`repo\`. Requires push access for traffic. |
157
199
 
158
200
  GitHub tools auto-detect owner/repo from GITHUB_REPO_PATH. If \`detectedOwner\`/\`detectedRepo\` are null in response, specify \`owner\` and \`repo\` parameters explicitly.
159
201
 
160
202
  ### Issue Lifecycle Tools
161
- | Tool | Required Parameters | Notes |
162
- |------|---------------------|-------|
163
- | \`create_github_issue_with_entry\` | \`title\` (string) | Optional \`body\`, \`labels\` (array), \`assignees\` (array), \`project_number\`, \`initial_status\`, \`milestone_number\`, \`entry_content\`, \`tags\`, \`owner\`, \`repo\` |
164
- | \`close_github_issue_with_entry\` | \`issue_number\` (number) | Optional \`comment\`, \`resolution_notes\`, \`tags\`, \`move_to_done\` (bool), \`project_number\`, \`owner\`, \`repo\` |
203
+
204
+ | Tool | Required Parameters | Notes |
205
+ | -------------------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
206
+ | \`create_github_issue_with_entry\` | \`title\` (string) | Optional \`body\`, \`labels\` (array), \`assignees\` (array), \`project_number\`, \`initial_status\`, \`milestone_number\`, \`entry_content\`, \`tags\`, \`owner\`, \`repo\` |
207
+ | \`close_github_issue_with_entry\` | \`issue_number\` (number) | Optional \`comment\`, \`resolution_notes\`, \`tags\`, \`move_to_done\` (bool), \`project_number\`, \`owner\`, \`repo\` |
165
208
 
166
209
  ### Kanban Tools (GitHub Projects v2)
167
- | Tool | Required Parameters | Notes |
168
- |------|---------------------|-------|
169
- | \`get_kanban_board\` | \`project_number\` (number) | Optional \`owner\`. Returns columns with items grouped by Status |
210
+
211
+ | Tool | Required Parameters | Notes |
212
+ | ------------------ | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
213
+ | \`get_kanban_board\` | \`project_number\` (number) | Optional \`owner\`. Returns columns with items grouped by Status |
170
214
  | \`move_kanban_item\` | \`project_number\`, \`item_id\` (string), \`target_status\` (string) | Optional \`owner\`. \`item_id\` is the GraphQL node ID from board items. Status matching is case-insensitive. |
171
215
 
172
216
  **Finding the right project**: User may have multiple projects. Use \`get_kanban_board\` with different project numbers (1, 2, 3...) to find the correct one by checking \`projectTitle\`.
173
217
 
174
218
  **Default Status columns** (typical GitHub Projects v2):
219
+
175
220
  - \`Backlog\` - Items not yet started
176
221
  - \`Ready\` - Ready to be picked up
177
222
  - \`In progress\` - Actively being worked on
@@ -181,39 +226,46 @@ GitHub tools auto-detect owner/repo from GITHUB_REPO_PATH. If \`detectedOwner\`/
181
226
  Note: Status columns are dynamic per project. The \`statusOptions\` in the response shows available statuses for that specific project.
182
227
 
183
228
  Kanban resources:
229
+
184
230
  - \`memory://kanban/{project_number}\` - JSON board data
185
231
  - \`memory://kanban/{project_number}/diagram\` - Mermaid visualization
186
232
 
187
233
  ### Milestone Tools
188
- | Tool | Required Parameters | Notes |
189
- |------|---------------------|-------|
190
- | \`get_github_milestones\` | none | Optional \`state\` (open/closed/all), \`limit\`, \`owner\`, \`repo\` |
191
- | \`get_github_milestone\` | \`milestone_number\` (number) | Optional \`owner\`, \`repo\`. Single milestone with completion %. |
192
- | \`create_github_milestone\` | \`title\` (string) | Optional \`description\`, \`due_on\` (YYYY-MM-DD), \`owner\`, \`repo\` |
193
- | \`update_github_milestone\` | \`milestone_number\` (number) | Optional \`title\`, \`description\`, \`due_on\`, \`state\` (open/closed), \`owner\`, \`repo\` |
194
- | \`delete_github_milestone\` | \`milestone_number\`, \`confirm: true\` | Optional \`owner\`, \`repo\`. Permanent deletion. |
234
+
235
+ | Tool | Required Parameters | Notes |
236
+ | ------------------------- | ----------------------------------- | --------------------------------------------------------------------------------- |
237
+ | \`get_github_milestones\` | none | Optional \`state\` (open/closed/all), \`limit\`, \`owner\`, \`repo\` |
238
+ | \`get_github_milestone\` | \`milestone_number\` (number) | Optional \`owner\`, \`repo\`. Single milestone with completion %. |
239
+ | \`create_github_milestone\` | \`title\` (string) | Optional \`description\`, \`due_on\` (YYYY-MM-DD), \`owner\`, \`repo\` |
240
+ | \`update_github_milestone\` | \`milestone_number\` (number) | Optional \`title\`, \`description\`, \`due_on\`, \`state\` (open/closed), \`owner\`, \`repo\` |
241
+ | \`delete_github_milestone\` | \`milestone_number\`, \`confirm: true\` | Optional \`owner\`, \`repo\`. Permanent deletion. |
195
242
 
196
243
  Milestone resources:
244
+
197
245
  - \`memory://github/milestones\` - Open milestones with completion %
198
246
  - \`memory://milestones/{number}\` - Single milestone detail
199
247
 
200
248
  ### Admin Tools
201
- | Tool | Required Parameters | Notes |
202
- |------|---------------------|-------|
203
- | \`backup_journal\` | none | Optional \`name\` (custom backup name) |
204
- | \`list_backups\` | none | Returns available backup files |
205
- | \`cleanup_backups\` | none | Optional \`keep_count\` (default 5). Deletes old backups, keeps N most recent. |
206
- | \`restore_backup\` | \`filename\`, \`confirm: true\` | Creates auto-backup before restore |
207
- | \`add_to_vector_index\` | \`entry_id\` (single number) | Indexes one entry for semantic search |
208
- | \`rebuild_vector_index\` | none | Re-indexes all entries |
249
+
250
+ | Tool | Required Parameters | Notes |
251
+ | ---------------------- | --------------------------- | ---------------------------------------------------------------------------- |
252
+ | \`backup_journal\` | none | Optional \`name\` (custom backup name) |
253
+ | \`list_backups\` | none | Returns available backup files |
254
+ | \`cleanup_backups\` | none | Optional \`keep_count\` (default 5). Deletes old backups, keeps N most recent. |
255
+ | \`restore_backup\` | \`filename\`, \`confirm: true\` | Creates auto-backup before restore |
256
+ | \`add_to_vector_index\` | \`entry_id\` (single number) | Indexes one entry for semantic search |
257
+ | \`rebuild_vector_index\` | none | Re-indexes all entries |
209
258
 
210
259
  ### Export Tools
211
- | Tool | Required Parameters | Notes |
212
- |------|---------------------|-------|
213
- | \`export_entries\` | none | Optional \`format\` (json/markdown), \`limit\` (default 100), \`tags\`, \`start_date\`, \`end_date\`, \`entry_types\` |
260
+
261
+ | Tool | Required Parameters | Notes |
262
+ | ---------------- | ------------------- | --------------------------------------------------------------------------------------------------------- |
263
+ | \`export_entries\` | none | Optional \`format\` (json/markdown), \`limit\` (default 100), \`tags\`, \`start_date\`, \`end_date\`, \`entry_types\` |
214
264
 
215
265
  ## Entry Types
266
+
216
267
  Valid values for \`entry_type\` parameter:
268
+
217
269
  - \`personal_reflection\` (default) - Personal thoughts and notes
218
270
  - \`project_decision\` - Architectural and team decisions
219
271
  - \`technical_achievement\` - Milestones and breakthroughs
@@ -229,6 +281,7 @@ Valid values for \`entry_type\` parameter:
229
281
  - \`other\` - Miscellaneous
230
282
 
231
283
  ## Field Notes
284
+
232
285
  - **\`autoContext\`**: Reserved for future automatic context capture. Currently always \`null\`.
233
286
  - **\`memory://tags\` vs \`list_tags\`**: Resource includes \`id\`, \`name\`, \`count\`; tool returns only \`name\`, \`count\`. Neither returns orphan tags with zero usage.
234
287
  - **Tag naming**: Use lowercase with dashes (e.g., \`bug-fix\`, \`phase-2\`). Use \`merge_tags\` to consolidate duplicates (e.g., merge \`phase2\` into \`phase-2\`).
@@ -245,29 +298,30 @@ Valid values for \`entry_type\` parameter:
245
298
  - **\`delete_entry\` on soft-deleted**: \`delete_entry(id, permanent: true)\` works on previously soft-deleted entries. Returns \`success: false\` for nonexistent entries.
246
299
 
247
300
  ## Key Resources
248
- | URI | Description |
249
- |-----|-------------|
250
- | \`memory://health\` | Server health, DB stats, tool filter status |
251
- | \`memory://briefing\` | Session context with userMessage to show user |
252
- | \`memory://instructions\` | Full server instructions and tool reference |
253
- | \`memory://statistics\` | Entry counts by type and period |
254
- | \`memory://recent\` | 10 most recent entries |
255
- | \`memory://tags\` | All tags with usage counts |
256
- | \`memory://significant\` | Entries sorted by importance score |
257
- | \`memory://graph/recent\` | Mermaid diagram of recent relationships |
258
- | \`memory://graph/actions\` | CI/CD narrative graph |
259
- | \`memory://actions/recent\` | Recent workflow runs |
260
- | \`memory://team/recent\` | Team-shared entries |
261
- | \`memory://github/status\` | GitHub repo overview (CI, issues, PRs, milestones) |
262
- | \`memory://github/milestones\` | Open milestones with completion % |
263
- | \`memory://github/insights\` | Stars, forks, and 14-day traffic summary |
264
- | \`memory://kanban/{n}\` | Kanban board for project number n |
265
- | \`memory://kanban/{n}/diagram\` | Mermaid Kanban visualization |
266
- | \`memory://milestones/{n}\` | Single milestone detail + progress |
267
- | \`memory://projects/{n}/timeline\` | Project entries timeline |
268
- | \`memory://issues/{n}/entries\` | Entries linked to issue n |
269
- | \`memory://prs/{n}/entries\` | Entries linked to PR n |
270
- | \`memory://prs/{n}/timeline\` | PR lifecycle and linked entries |
301
+
302
+ | URI | Description |
303
+ | -------------------------------- | -------------------------------------------------- |
304
+ | \`memory://health\` | Server health, DB stats, tool filter status |
305
+ | \`memory://briefing\` | Session context with userMessage to show user |
306
+ | \`memory://instructions\` | Full server instructions and tool reference |
307
+ | \`memory://statistics\` | Entry counts by type and period |
308
+ | \`memory://recent\` | 10 most recent entries |
309
+ | \`memory://tags\` | All tags with usage counts |
310
+ | \`memory://significant\` | Entries sorted by importance score |
311
+ | \`memory://graph/recent\` | Mermaid diagram of recent relationships |
312
+ | \`memory://graph/actions\` | CI/CD narrative graph |
313
+ | \`memory://actions/recent\` | Recent workflow runs |
314
+ | \`memory://team/recent\` | Team-shared entries |
315
+ | \`memory://github/status\` | GitHub repo overview (CI, issues, PRs, milestones) |
316
+ | \`memory://github/milestones\` | Open milestones with completion % |
317
+ | \`memory://github/insights\` | Stars, forks, and 14-day traffic summary |
318
+ | \`memory://kanban/{n}\` | Kanban board for project number n |
319
+ | \`memory://kanban/{n}/diagram\` | Mermaid Kanban visualization |
320
+ | \`memory://milestones/{n}\` | Single milestone detail + progress |
321
+ | \`memory://projects/{n}/timeline\` | Project entries timeline |
322
+ | \`memory://issues/{n}/entries\` | Entries linked to issue n |
323
+ | \`memory://prs/{n}/entries\` | Entries linked to PR n |
324
+ | \`memory://prs/{n}/timeline\` | PR lifecycle and linked entries |
271
325
  `
272
326
 
273
327
  /**
@@ -0,0 +1,262 @@
1
+ <!-- SECTION:ESSENTIAL -->
2
+
3
+ # memory-journal-mcp
4
+
5
+ ## Session Start
6
+
7
+ 1. Read `memory://briefing` for project context
8
+ - In Cursor, use `FetchMcpResource(server: "user-memory-journal-mcp", uri: "memory://briefing")`
9
+ 2. **Show the `userMessage` to the user** (it contains a formatted summary of project context)
10
+ 3. Proceed with the user's request
11
+
12
+ ## Behaviors
13
+
14
+ - **Create entries for**: implementations, decisions, bug fixes, milestones, user requests to "remember"
15
+ - **Search before**: major decisions, referencing prior work, understanding project context
16
+ - **Link entries**: implementation→spec, bugfix→issue, followup→prior work
17
+
18
+ ## Session End
19
+
20
+ When a conversation or task is wrapping up (user says "thanks," final deliverable complete, no more work planned):
21
+
22
+ 1. Create a journal entry summarizing the session:
23
+ - **What was accomplished** (key changes, decisions, files modified)
24
+ - **What's unfinished or blocked** (pending items, open questions)
25
+ - **Context for next session** (relevant entry IDs, branch names, PR numbers)
26
+ 2. Use `entry_type: "retrospective"` and tag with `session-summary`
27
+ 3. This is opt-out — ALWAYS create the entry, even for short/trivial sessions, unless the user explicitly says to skip it
28
+
29
+ > If your client has hooks configured for session-end journaling (e.g., Cursor `sessionEnd` hook), this is handled automatically. Otherwise, follow the steps above.
30
+
31
+ ## Rule & Skill Suggestions
32
+
33
+ When you notice the user consistently applies patterns, preferences, or workflows that could be codified:
34
+
35
+ - **Offer to create a rule or skill** — always ask the user first, never create silently
36
+ - Examples: coding conventions, testing patterns, deployment steps, project-specific commands
37
+ - Frame it as: "I noticed you always [pattern]. Would you like me to save this as a rule/skill so future agents follow it automatically?"
38
+
39
+ ## Quick Access
40
+
41
+ | Purpose | Action |
42
+ | --------------- | --------------------------- |
43
+ | Session context | `memory://briefing` |
44
+ | Recent entries | `memory://recent` |
45
+ | Health/time | `memory://health` |
46
+ | Semantic search | `semantic_search(query)` |
47
+ | Full context | `get-context-bundle` prompt |
48
+
49
+ <!-- SECTION:GITHUB -->
50
+
51
+ ## GitHub Integration
52
+
53
+ - Include `issue_number`/`pr_number` in `create_entry` to auto-link
54
+ - After closing issue/merging PR → create summary entry with learnings
55
+ - CI failures → `actions-failure-digest` prompt or `memory://actions/recent`
56
+ - Kanban: `get_kanban_board(project_number)` → `move_kanban_item` → document completion
57
+ - Milestones: `get_github_milestones` → track project progress, `memory://github/milestones`
58
+ - GitHub tools auto-detect owner/repo from git context; specify explicitly if null
59
+
60
+ <!-- SECTION:SERVER_ACCESS -->
61
+
62
+ ## How to Access This Server
63
+
64
+ ### Calling Tools
65
+
66
+ Use `CallMcpTool` with server name `user-memory-journal-mcp`:
67
+
68
+ ```
69
+ CallMcpTool(server: "user-memory-journal-mcp", toolName: "create_entry", arguments: {...})
70
+ ```
71
+
72
+ ### Listing Resources
73
+
74
+ Use `ListMcpResources` with server name:
75
+
76
+ ```
77
+ ListMcpResources(server: "user-memory-journal-mcp")
78
+ ```
79
+
80
+ Do NOT try to browse filesystem paths for MCP tool/resource definitions - use the MCP protocol directly.
81
+
82
+ ### Fetching Resources
83
+
84
+ Use `FetchMcpResource` with server name and `memory://` URI:
85
+
86
+ ```
87
+ FetchMcpResource(server: "user-memory-journal-mcp", uri: "memory://recent")
88
+ FetchMcpResource(server: "user-memory-journal-mcp", uri: "memory://kanban/1")
89
+ ```
90
+
91
+ ## Quick Health Check
92
+
93
+ Fetch `memory://health` to verify server status, database stats, and tool availability.
94
+
95
+ <!-- SECTION:TOOL_PARAMETER_REFERENCE -->
96
+
97
+ ## Tool Parameter Reference
98
+
99
+ ### Entry Operations
100
+
101
+ | Tool | Required Parameters | Optional Parameters |
102
+ | ---------------------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
103
+ | `create_entry` | `content` (string) | `entry_type`, `tags` (array), `is_personal`, `significance_type`, `share_with_team`, `auto_context`, `issue_number`, `issue_url`, `pr_number`, `pr_url`, `pr_status`, `project_number`, `project_owner`, `workflow_run_id`, `workflow_name`, `workflow_status` |
104
+ | `create_entry_minimal` | `content` (string) | none |
105
+ | `get_entry_by_id` | `entry_id` (number) | `include_relationships` (bool, default true) |
106
+ | `get_recent_entries` | none | `limit` (default 5), `is_personal` (bool) |
107
+ | `update_entry` | `entry_id` (number) | `content`, `tags`, `entry_type`, `is_personal` |
108
+ | `delete_entry` | `entry_id` (number) | `permanent` (bool, default false) |
109
+ | `list_tags` | none | none |
110
+
111
+ ### Search Tools
112
+
113
+ | Tool | Required Parameters | Optional Parameters |
114
+ | ------------------------ | ------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
115
+ | `search_entries` | none | `query`, `limit`, `is_personal`, `issue_number`, `pr_number`, `pr_status`, `project_number`, `workflow_run_id` |
116
+ | `search_by_date_range` | `start_date`, `end_date` (YYYY-MM-DD) | `tags`, `entry_type`, `is_personal`, `issue_number`, `pr_number`, `project_number`, `workflow_run_id` |
117
+ | `semantic_search` | `query` (string) | `limit`, `similarity_threshold` (default 0.25), `is_personal`, `hint_on_empty` (bool, default true) |
118
+ | `get_vector_index_stats` | none | none |
119
+
120
+ ### Relationship Tools
121
+
122
+ | Tool | Required Parameters | Notes |
123
+ | ------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
124
+ | `link_entries` | `from_entry_id`, `to_entry_id` (numbers) | Types: `evolves_from`, `references`, `implements`, `clarifies`, `response_to`, `blocked_by`, `resolved`, `caused`. Optional `description`. |
125
+ | `visualize_relationships` | none | Optional `entry_id`, `tags` (array), `depth` (1-3, default 2), `limit` (default 20). Returns Mermaid diagram. |
126
+
127
+ ### GitHub Tools
128
+
129
+ | Tool | Required Parameters | Notes |
130
+ | -------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
131
+ | `get_github_context` | none | Returns repo info, open issues/PRs. Only counts OPEN items. |
132
+ | `get_github_issues` | none | Optional `state` (open/closed/all), `limit`, `owner`, `repo` |
133
+ | `get_github_prs` | none | Optional `state`, `limit`, `owner`, `repo` |
134
+ | `get_github_issue` | `issue_number` (number) | Optional `owner`, `repo`. Fetches single issue details. |
135
+ | `get_github_pr` | `pr_number` (number) | Optional `owner`, `repo`. Fetches single PR details. |
136
+ | `get_repo_insights` | none | Optional `sections` (stars/traffic/referrers/paths/all, default "stars"), `owner`, `repo`. Requires push access for traffic. |
137
+
138
+ GitHub tools auto-detect owner/repo from GITHUB_REPO_PATH. If `detectedOwner`/`detectedRepo` are null in response, specify `owner` and `repo` parameters explicitly.
139
+
140
+ ### Issue Lifecycle Tools
141
+
142
+ | Tool | Required Parameters | Notes |
143
+ | -------------------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
144
+ | `create_github_issue_with_entry` | `title` (string) | Optional `body`, `labels` (array), `assignees` (array), `project_number`, `initial_status`, `milestone_number`, `entry_content`, `tags`, `owner`, `repo` |
145
+ | `close_github_issue_with_entry` | `issue_number` (number) | Optional `comment`, `resolution_notes`, `tags`, `move_to_done` (bool), `project_number`, `owner`, `repo` |
146
+
147
+ ### Kanban Tools (GitHub Projects v2)
148
+
149
+ | Tool | Required Parameters | Notes |
150
+ | ------------------ | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
151
+ | `get_kanban_board` | `project_number` (number) | Optional `owner`. Returns columns with items grouped by Status |
152
+ | `move_kanban_item` | `project_number`, `item_id` (string), `target_status` (string) | Optional `owner`. `item_id` is the GraphQL node ID from board items. Status matching is case-insensitive. |
153
+
154
+ **Finding the right project**: User may have multiple projects. Use `get_kanban_board` with different project numbers (1, 2, 3...) to find the correct one by checking `projectTitle`.
155
+
156
+ **Default Status columns** (typical GitHub Projects v2):
157
+
158
+ - `Backlog` - Items not yet started
159
+ - `Ready` - Ready to be picked up
160
+ - `In progress` - Actively being worked on
161
+ - `In review` - In review
162
+ - `Done` - Completed
163
+
164
+ Note: Status columns are dynamic per project. The `statusOptions` in the response shows available statuses for that specific project.
165
+
166
+ Kanban resources:
167
+
168
+ - `memory://kanban/{project_number}` - JSON board data
169
+ - `memory://kanban/{project_number}/diagram` - Mermaid visualization
170
+
171
+ ### Milestone Tools
172
+
173
+ | Tool | Required Parameters | Notes |
174
+ | ------------------------- | ----------------------------------- | --------------------------------------------------------------------------------- |
175
+ | `get_github_milestones` | none | Optional `state` (open/closed/all), `limit`, `owner`, `repo` |
176
+ | `get_github_milestone` | `milestone_number` (number) | Optional `owner`, `repo`. Single milestone with completion %. |
177
+ | `create_github_milestone` | `title` (string) | Optional `description`, `due_on` (YYYY-MM-DD), `owner`, `repo` |
178
+ | `update_github_milestone` | `milestone_number` (number) | Optional `title`, `description`, `due_on`, `state` (open/closed), `owner`, `repo` |
179
+ | `delete_github_milestone` | `milestone_number`, `confirm: true` | Optional `owner`, `repo`. Permanent deletion. |
180
+
181
+ Milestone resources:
182
+
183
+ - `memory://github/milestones` - Open milestones with completion %
184
+ - `memory://milestones/{number}` - Single milestone detail
185
+
186
+ ### Admin Tools
187
+
188
+ | Tool | Required Parameters | Notes |
189
+ | ---------------------- | --------------------------- | ---------------------------------------------------------------------------- |
190
+ | `backup_journal` | none | Optional `name` (custom backup name) |
191
+ | `list_backups` | none | Returns available backup files |
192
+ | `cleanup_backups` | none | Optional `keep_count` (default 5). Deletes old backups, keeps N most recent. |
193
+ | `restore_backup` | `filename`, `confirm: true` | Creates auto-backup before restore |
194
+ | `add_to_vector_index` | `entry_id` (single number) | Indexes one entry for semantic search |
195
+ | `rebuild_vector_index` | none | Re-indexes all entries |
196
+
197
+ ### Export Tools
198
+
199
+ | Tool | Required Parameters | Notes |
200
+ | ---------------- | ------------------- | --------------------------------------------------------------------------------------------------------- |
201
+ | `export_entries` | none | Optional `format` (json/markdown), `limit` (default 100), `tags`, `start_date`, `end_date`, `entry_types` |
202
+
203
+ ## Entry Types
204
+
205
+ Valid values for `entry_type` parameter:
206
+
207
+ - `personal_reflection` (default) - Personal thoughts and notes
208
+ - `project_decision` - Architectural and team decisions
209
+ - `technical_achievement` - Milestones and breakthroughs
210
+ - `bug_fix` - Bug fixes and resolutions
211
+ - `feature_implementation` - Feature builds and rollouts
212
+ - `code_review` - Code review notes
213
+ - `meeting_notes` - Meeting summaries
214
+ - `learning` - Learning and research insights
215
+ - `research` - Research and exploration
216
+ - `planning` - Planning sessions and roadmaps (`create_github_issue_with_entry` uses this type)
217
+ - `retrospective` - Sprint and project retrospectives
218
+ - `standup` - Daily standup notes
219
+ - `other` - Miscellaneous
220
+
221
+ ## Field Notes
222
+
223
+ - **`autoContext`**: Reserved for future automatic context capture. Currently always `null`.
224
+ - **`memory://tags` vs `list_tags`**: Resource includes `id`, `name`, `count`; tool returns only `name`, `count`. Neither returns orphan tags with zero usage.
225
+ - **Tag naming**: Use lowercase with dashes (e.g., `bug-fix`, `phase-2`). Use `merge_tags` to consolidate duplicates (e.g., merge `phase2` into `phase-2`).
226
+ - **`merge_tags` behavior**: Only updates non-deleted entries. Deleted entries retain their original tags.
227
+ - **`prStatus` in entries**: Reflects PR state at entry creation time, not current state. Use `get_github_pr` for live status.
228
+ - **`restore_backup` behavior**: Restores entire database state. Any recent changes (new entries, tag merges via `merge_tags`, relationships) are reverted. A pre-restore backup is automatically created for safety.
229
+ - **Semantic search indexing**: Entries are auto-indexed on creation (fire-and-forget). If index count drifts from DB count, use `rebuild_vector_index` or enable `AUTO_REBUILD_INDEX=true` for automatic reconciliation on server startup.
230
+ - **`semantic_search` thresholds**: Default similarity threshold is 0.25. For broader matches, try 0.15-0.2. Higher values (0.4+) return only very close semantic matches.
231
+ - **Causal relationship types**: Use `blocked_by` (A was blocked by B), `resolved` (A resolved B), `caused` (A caused B) for decision tracing and failure analysis. Visualizations use distinct arrow styles for causal types.
232
+ - **Enhanced analytics**: `get_statistics` returns `decisionDensity` (significant entries per period), `relationshipComplexity` (avg relationships per entry), `activityTrend` (period-over-period growth %), and `causalMetrics` (counts for blocked_by/resolved/caused).
233
+ - **Importance scores**: `get_entry_by_id` returns `importance` (0.0-1.0) and `importanceBreakdown` showing weighted components: significance (30%), relationships (35%), causal (20%), recency (15%). `memory://significant` sorts entries by importance.
234
+ - **`inactiveThresholdDays`**: `get_cross_project_insights` includes `inactiveThresholdDays: 7` in output, documenting the inactive project classification cutoff.
235
+ - **GitHub metadata in entries**: Entry output includes 10 GitHub fields (`issueNumber`, `issueUrl`, `prNumber`, `prUrl`, `prStatus`, `projectNumber`, `projectOwner`, `workflowRunId`, `workflowName`, `workflowStatus`) in all tool responses.
236
+ - **`delete_entry` on soft-deleted**: `delete_entry(id, permanent: true)` works on previously soft-deleted entries. Returns `success: false` for nonexistent entries.
237
+
238
+ ## Key Resources
239
+
240
+ | URI | Description |
241
+ | -------------------------------- | -------------------------------------------------- |
242
+ | `memory://health` | Server health, DB stats, tool filter status |
243
+ | `memory://briefing` | Session context with userMessage to show user |
244
+ | `memory://instructions` | Full server instructions and tool reference |
245
+ | `memory://statistics` | Entry counts by type and period |
246
+ | `memory://recent` | 10 most recent entries |
247
+ | `memory://tags` | All tags with usage counts |
248
+ | `memory://significant` | Entries sorted by importance score |
249
+ | `memory://graph/recent` | Mermaid diagram of recent relationships |
250
+ | `memory://graph/actions` | CI/CD narrative graph |
251
+ | `memory://actions/recent` | Recent workflow runs |
252
+ | `memory://team/recent` | Team-shared entries |
253
+ | `memory://github/status` | GitHub repo overview (CI, issues, PRs, milestones) |
254
+ | `memory://github/milestones` | Open milestones with completion % |
255
+ | `memory://github/insights` | Stars, forks, and 14-day traffic summary |
256
+ | `memory://kanban/{n}` | Kanban board for project number n |
257
+ | `memory://kanban/{n}/diagram` | Mermaid Kanban visualization |
258
+ | `memory://milestones/{n}` | Single milestone detail + progress |
259
+ | `memory://projects/{n}/timeline` | Project entries timeline |
260
+ | `memory://issues/{n}/entries` | Entries linked to issue n |
261
+ | `memory://prs/{n}/entries` | Entries linked to PR n |
262
+ | `memory://prs/{n}/timeline` | PR lifecycle and linked entries |