memory-journal-mcp 4.4.2 → 5.0.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.
- package/.github/workflows/codeql.yml +1 -6
- package/.github/workflows/docker-publish.yml +15 -49
- package/.github/workflows/lint-and-test.yml +1 -1
- package/.github/workflows/secrets-scanning.yml +4 -3
- package/.github/workflows/security-update.yml +3 -3
- package/CHANGELOG.md +213 -0
- package/CONTRIBUTING.md +132 -97
- package/DOCKER_README.md +184 -235
- package/Dockerfile +27 -24
- package/README.md +218 -190
- package/SECURITY.md +27 -35
- package/dist/cli.js +16 -1
- package/dist/cli.js.map +1 -1
- package/dist/constants/ServerInstructions.d.ts +5 -1
- package/dist/constants/ServerInstructions.d.ts.map +1 -1
- package/dist/constants/ServerInstructions.js +133 -73
- package/dist/constants/ServerInstructions.js.map +1 -1
- package/dist/constants/icons.d.ts +2 -2
- package/dist/constants/icons.d.ts.map +1 -1
- package/dist/constants/icons.js +7 -6
- package/dist/constants/icons.js.map +1 -1
- package/dist/database/SqliteAdapter.d.ts +37 -24
- package/dist/database/SqliteAdapter.d.ts.map +1 -1
- package/dist/database/SqliteAdapter.js +319 -157
- package/dist/database/SqliteAdapter.js.map +1 -1
- package/dist/database/schema.d.ts +45 -0
- package/dist/database/schema.d.ts.map +1 -0
- package/dist/database/schema.js +92 -0
- package/dist/database/schema.js.map +1 -0
- package/dist/filtering/ToolFilter.d.ts +1 -1
- package/dist/filtering/ToolFilter.d.ts.map +1 -1
- package/dist/filtering/ToolFilter.js +13 -2
- package/dist/filtering/ToolFilter.js.map +1 -1
- package/dist/github/GitHubIntegration.d.ts.map +1 -1
- package/dist/github/GitHubIntegration.js +1 -3
- package/dist/github/GitHubIntegration.js.map +1 -1
- package/dist/handlers/prompts/github.d.ts +12 -0
- package/dist/handlers/prompts/github.d.ts.map +1 -0
- package/dist/handlers/prompts/github.js +178 -0
- package/dist/handlers/prompts/github.js.map +1 -0
- package/dist/handlers/prompts/index.d.ts +23 -2
- package/dist/handlers/prompts/index.d.ts.map +1 -1
- package/dist/handlers/prompts/index.js +7 -432
- package/dist/handlers/prompts/index.js.map +1 -1
- package/dist/handlers/prompts/workflow.d.ts +12 -0
- package/dist/handlers/prompts/workflow.d.ts.map +1 -0
- package/dist/handlers/prompts/workflow.js +277 -0
- package/dist/handlers/prompts/workflow.js.map +1 -0
- package/dist/handlers/resources/core.d.ts +11 -0
- package/dist/handlers/resources/core.d.ts.map +1 -0
- package/dist/handlers/resources/core.js +433 -0
- package/dist/handlers/resources/core.js.map +1 -0
- package/dist/handlers/resources/github.d.ts +11 -0
- package/dist/handlers/resources/github.d.ts.map +1 -0
- package/dist/handlers/resources/github.js +314 -0
- package/dist/handlers/resources/github.js.map +1 -0
- package/dist/handlers/resources/graph.d.ts +11 -0
- package/dist/handlers/resources/graph.d.ts.map +1 -0
- package/dist/handlers/resources/graph.js +204 -0
- package/dist/handlers/resources/graph.js.map +1 -0
- package/dist/handlers/resources/index.d.ts +5 -20
- package/dist/handlers/resources/index.d.ts.map +1 -1
- package/dist/handlers/resources/index.js +16 -1278
- package/dist/handlers/resources/index.js.map +1 -1
- package/dist/handlers/resources/shared.d.ts +60 -0
- package/dist/handlers/resources/shared.d.ts.map +1 -0
- package/dist/handlers/resources/shared.js +49 -0
- package/dist/handlers/resources/shared.js.map +1 -0
- package/dist/handlers/resources/team.d.ts +13 -0
- package/dist/handlers/resources/team.d.ts.map +1 -0
- package/dist/handlers/resources/team.js +119 -0
- package/dist/handlers/resources/team.js.map +1 -0
- package/dist/handlers/resources/templates.d.ts +13 -0
- package/dist/handlers/resources/templates.d.ts.map +1 -0
- package/dist/handlers/resources/templates.js +310 -0
- package/dist/handlers/resources/templates.js.map +1 -0
- package/dist/handlers/tools/admin.d.ts +8 -0
- package/dist/handlers/tools/admin.d.ts.map +1 -0
- package/dist/handlers/tools/admin.js +270 -0
- package/dist/handlers/tools/admin.js.map +1 -0
- package/dist/handlers/tools/analytics.d.ts +8 -0
- package/dist/handlers/tools/analytics.d.ts.map +1 -0
- package/dist/handlers/tools/analytics.js +256 -0
- package/dist/handlers/tools/analytics.js.map +1 -0
- package/dist/handlers/tools/backup.d.ts +8 -0
- package/dist/handlers/tools/backup.d.ts.map +1 -0
- package/dist/handlers/tools/backup.js +224 -0
- package/dist/handlers/tools/backup.js.map +1 -0
- package/dist/handlers/tools/core.d.ts +9 -0
- package/dist/handlers/tools/core.d.ts.map +1 -0
- package/dist/handlers/tools/core.js +326 -0
- package/dist/handlers/tools/core.js.map +1 -0
- package/dist/handlers/tools/export.d.ts +8 -0
- package/dist/handlers/tools/export.d.ts.map +1 -0
- package/dist/handlers/tools/export.js +89 -0
- package/dist/handlers/tools/export.js.map +1 -0
- package/dist/handlers/tools/github/helpers.d.ts +34 -0
- package/dist/handlers/tools/github/helpers.d.ts.map +1 -0
- package/dist/handlers/tools/github/helpers.js +52 -0
- package/dist/handlers/tools/github/helpers.js.map +1 -0
- package/dist/handlers/tools/github/insights-tools.d.ts +8 -0
- package/dist/handlers/tools/github/insights-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/insights-tools.js +104 -0
- package/dist/handlers/tools/github/insights-tools.js.map +1 -0
- package/dist/handlers/tools/github/issue-tools.d.ts +8 -0
- package/dist/handlers/tools/github/issue-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/issue-tools.js +359 -0
- package/dist/handlers/tools/github/issue-tools.js.map +1 -0
- package/dist/handlers/tools/github/kanban-tools.d.ts +8 -0
- package/dist/handlers/tools/github/kanban-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/kanban-tools.js +108 -0
- package/dist/handlers/tools/github/kanban-tools.js.map +1 -0
- package/dist/handlers/tools/github/milestone-tools.d.ts +9 -0
- package/dist/handlers/tools/github/milestone-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/milestone-tools.js +302 -0
- package/dist/handlers/tools/github/milestone-tools.js.map +1 -0
- package/dist/handlers/tools/github/mutation-tools.d.ts +12 -0
- package/dist/handlers/tools/github/mutation-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/mutation-tools.js +15 -0
- package/dist/handlers/tools/github/mutation-tools.js.map +1 -0
- package/dist/handlers/tools/github/read-tools.d.ts +8 -0
- package/dist/handlers/tools/github/read-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/read-tools.js +260 -0
- package/dist/handlers/tools/github/read-tools.js.map +1 -0
- package/dist/handlers/tools/github/schemas.d.ts +467 -0
- package/dist/handlers/tools/github/schemas.d.ts.map +1 -0
- package/dist/handlers/tools/github/schemas.js +335 -0
- package/dist/handlers/tools/github/schemas.js.map +1 -0
- package/dist/handlers/tools/github.d.ts +14 -0
- package/dist/handlers/tools/github.d.ts.map +1 -0
- package/dist/handlers/tools/github.js +28 -0
- package/dist/handlers/tools/github.js.map +1 -0
- package/dist/handlers/tools/index.d.ts +15 -20
- package/dist/handlers/tools/index.d.ts.map +1 -1
- package/dist/handlers/tools/index.js +117 -2909
- package/dist/handlers/tools/index.js.map +1 -1
- package/dist/handlers/tools/relationships.d.ts +8 -0
- package/dist/handlers/tools/relationships.d.ts.map +1 -0
- package/dist/handlers/tools/relationships.js +308 -0
- package/dist/handlers/tools/relationships.js.map +1 -0
- package/dist/handlers/tools/schemas.d.ts +108 -0
- package/dist/handlers/tools/schemas.d.ts.map +1 -0
- package/dist/handlers/tools/schemas.js +122 -0
- package/dist/handlers/tools/schemas.js.map +1 -0
- package/dist/handlers/tools/search.d.ts +8 -0
- package/dist/handlers/tools/search.d.ts.map +1 -0
- package/dist/handlers/tools/search.js +282 -0
- package/dist/handlers/tools/search.js.map +1 -0
- package/dist/handlers/tools/team.d.ts +11 -0
- package/dist/handlers/tools/team.d.ts.map +1 -0
- package/dist/handlers/tools/team.js +239 -0
- package/dist/handlers/tools/team.js.map +1 -0
- package/dist/server/McpServer.d.ts +4 -0
- package/dist/server/McpServer.d.ts.map +1 -1
- package/dist/server/McpServer.js +48 -297
- package/dist/server/McpServer.js.map +1 -1
- package/dist/server/Scheduler.d.ts +91 -0
- package/dist/server/Scheduler.d.ts.map +1 -0
- package/dist/server/Scheduler.js +201 -0
- package/dist/server/Scheduler.js.map +1 -0
- package/dist/transports/http.d.ts +66 -0
- package/dist/transports/http.d.ts.map +1 -0
- package/dist/transports/http.js +519 -0
- package/dist/transports/http.js.map +1 -0
- package/dist/types/entities.d.ts +101 -0
- package/dist/types/entities.d.ts.map +1 -0
- package/dist/types/entities.js +5 -0
- package/dist/types/entities.js.map +1 -0
- package/dist/types/filtering.d.ts +34 -0
- package/dist/types/filtering.d.ts.map +1 -0
- package/dist/types/filtering.js +5 -0
- package/dist/types/filtering.js.map +1 -0
- package/dist/types/github.d.ts +166 -0
- package/dist/types/github.d.ts.map +1 -0
- package/dist/types/github.js +5 -0
- package/dist/types/github.js.map +1 -0
- package/dist/types/index.d.ts +35 -292
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -2
- package/dist/types/index.js.map +1 -1
- package/dist/utils/error-helpers.d.ts +37 -0
- package/dist/utils/error-helpers.d.ts.map +1 -0
- package/dist/utils/error-helpers.js +47 -0
- package/dist/utils/error-helpers.js.map +1 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +6 -3
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/security-utils.d.ts +0 -21
- package/dist/utils/security-utils.d.ts.map +1 -1
- package/dist/utils/security-utils.js +0 -47
- package/dist/utils/security-utils.js.map +1 -1
- package/dist/vector/VectorSearchManager.d.ts.map +1 -1
- package/dist/vector/VectorSearchManager.js +9 -32
- package/dist/vector/VectorSearchManager.js.map +1 -1
- package/docker-compose.yml +11 -2
- package/hooks/README.md +107 -0
- package/hooks/cursor/hooks.json +10 -0
- package/hooks/cursor/memory-journal.mdc +22 -0
- package/hooks/cursor/session-end.sh +19 -0
- package/hooks/kilo-code/session-end-mode.json +11 -0
- package/hooks/kiro/session-end.md +13 -0
- package/mcp-config-example.json +1 -0
- package/package.json +11 -9
- package/playwright.config.ts +29 -0
- package/releases/v4.5.0.md +116 -0
- package/releases/v5.0.0.md +105 -0
- package/scripts/generate-server-instructions.ts +176 -0
- package/scripts/server-instructions-function-body.ts +77 -0
- package/server.json +3 -3
- package/src/cli.ts +45 -1
- package/src/constants/ServerInstructions.ts +133 -73
- package/src/constants/icons.ts +8 -7
- package/src/constants/server-instructions.md +268 -0
- package/src/database/SqliteAdapter.ts +358 -192
- package/src/database/schema.ts +125 -0
- package/src/filtering/ToolFilter.ts +13 -2
- package/src/github/GitHubIntegration.ts +1 -3
- package/src/handlers/prompts/github.ts +209 -0
- package/src/handlers/prompts/index.ts +10 -499
- package/src/handlers/prompts/workflow.ts +314 -0
- package/src/handlers/resources/core.ts +528 -0
- package/src/handlers/resources/github.ts +358 -0
- package/src/handlers/resources/graph.ts +254 -0
- package/src/handlers/resources/index.ts +23 -1570
- package/src/handlers/resources/shared.ts +103 -0
- package/src/handlers/resources/team.ts +133 -0
- package/src/handlers/resources/templates.ts +374 -0
- package/src/handlers/tools/admin.ts +285 -0
- package/src/handlers/tools/analytics.ts +301 -0
- package/src/handlers/tools/backup.ts +242 -0
- package/src/handlers/tools/core.ts +350 -0
- package/src/handlers/tools/export.ts +115 -0
- package/src/handlers/tools/github/helpers.ts +86 -0
- package/src/handlers/tools/github/insights-tools.ts +119 -0
- package/src/handlers/tools/github/issue-tools.ts +439 -0
- package/src/handlers/tools/github/kanban-tools.ts +134 -0
- package/src/handlers/tools/github/milestone-tools.ts +392 -0
- package/src/handlers/tools/github/mutation-tools.ts +17 -0
- package/src/handlers/tools/github/read-tools.ts +328 -0
- package/src/handlers/tools/github/schemas.ts +369 -0
- package/src/handlers/tools/github.ts +36 -0
- package/src/handlers/tools/index.ts +144 -3325
- package/src/handlers/tools/relationships.ts +358 -0
- package/src/handlers/tools/schemas.ts +132 -0
- package/src/handlers/tools/search.ts +343 -0
- package/src/handlers/tools/team.ts +273 -0
- package/src/server/McpServer.ts +63 -358
- package/src/server/Scheduler.ts +278 -0
- package/src/transports/http.ts +635 -0
- package/src/types/entities.ts +145 -0
- package/src/types/filtering.ts +54 -0
- package/src/types/github.ts +180 -0
- package/src/types/index.ts +67 -375
- package/src/utils/error-helpers.ts +52 -0
- package/src/utils/logger.ts +6 -3
- package/src/utils/security-utils.ts +0 -52
- package/src/vector/VectorSearchManager.ts +9 -33
- package/tests/constants/icons.test.ts +1 -2
- package/tests/constants/server-instructions.test.ts +30 -4
- package/tests/database/sqlite-adapter.test.ts +91 -7
- package/tests/e2e/auth.spec.ts +154 -0
- package/tests/e2e/health.spec.ts +63 -0
- package/tests/e2e/protocols.spec.ts +134 -0
- package/tests/e2e/resources.spec.ts +103 -0
- package/tests/e2e/scheduler.spec.ts +79 -0
- package/tests/e2e/security.spec.ts +91 -0
- package/tests/e2e/sessions.spec.ts +95 -0
- package/tests/e2e/stateless.spec.ts +121 -0
- package/tests/e2e/tools.spec.ts +111 -0
- package/tests/filtering/tool-filter.test.ts +46 -0
- package/tests/handlers/error-path-coverage.test.ts +324 -0
- package/tests/handlers/github-resource-handlers.test.ts +453 -0
- package/tests/handlers/github-tool-handlers.test.ts +899 -0
- package/tests/handlers/prompt-handler-coverage.test.ts +106 -0
- package/tests/handlers/prompt-handlers.test.ts +40 -0
- package/tests/handlers/resource-handler-coverage.test.ts +181 -0
- package/tests/handlers/resource-handlers.test.ts +33 -9
- package/tests/handlers/search-tool-handlers.test.ts +272 -0
- package/tests/handlers/targeted-gap-closure.test.ts +387 -0
- package/tests/handlers/team-resource-handlers.test.ts +156 -0
- package/tests/handlers/team-tool-handlers.test.ts +301 -0
- package/tests/handlers/tool-handler-coverage.test.ts +469 -0
- package/tests/handlers/tool-handlers.test.ts +2 -2
- package/tests/security/sql-injection.test.ts +3 -54
- package/tests/server/mcp-server.test.ts +503 -8
- package/tests/server/scheduler.test.ts +400 -0
- package/tests/transports/http-transport.test.ts +620 -0
- package/tests/vector/vector-search-manager.test.ts +60 -0
- package/vitest.config.ts +4 -1
- package/.memory-journal-team.db +0 -0
- package/.vscode/settings.json +0 -84
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory Journal MCP Server - Workflow Prompt Definitions
|
|
3
|
+
*
|
|
4
|
+
* Prompts: find-related, prepare-standup, prepare-retro, weekly-digest,
|
|
5
|
+
* analyze-period, goal-tracker, get-context-bundle, get-recent-entries, confirm-briefing
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { SqliteAdapter } from '../../database/SqliteAdapter.js'
|
|
9
|
+
import { ICON_PROMPT } from '../../constants/icons.js'
|
|
10
|
+
import { execQuery, type InternalPromptDef } from './index.js'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Get workflow prompt definitions
|
|
14
|
+
*/
|
|
15
|
+
export function getWorkflowPromptDefinitions(): InternalPromptDef[] {
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
name: 'find-related',
|
|
19
|
+
description: 'Discover connected entries via semantic similarity',
|
|
20
|
+
icons: [ICON_PROMPT],
|
|
21
|
+
arguments: [
|
|
22
|
+
{
|
|
23
|
+
name: 'query',
|
|
24
|
+
description: 'Search query for finding related entries',
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
handler: (args: Record<string, string>, db: SqliteAdapter) => {
|
|
29
|
+
const query = args['query'] ?? ''
|
|
30
|
+
const entries = db.searchEntries(query, { limit: 5 })
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
messages: [
|
|
34
|
+
{
|
|
35
|
+
role: 'user',
|
|
36
|
+
content: {
|
|
37
|
+
type: 'text',
|
|
38
|
+
text: `Find entries related to: "${query}"\n\nRecent matching entries:\n${entries.map((e) => `- [${String(e.id)}] ${e.content.slice(0, 100)}...`).join('\n')}`,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'prepare-standup',
|
|
47
|
+
description: 'Daily standup summaries',
|
|
48
|
+
icons: [ICON_PROMPT],
|
|
49
|
+
arguments: [],
|
|
50
|
+
handler: (_args: Record<string, string>, db: SqliteAdapter) => {
|
|
51
|
+
const today = new Date().toISOString().split('T')[0] ?? ''
|
|
52
|
+
const yesterday = new Date(Date.now() - 86400000).toISOString().split('T')[0] ?? ''
|
|
53
|
+
|
|
54
|
+
const entries = db.searchByDateRange(yesterday, today)
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
messages: [
|
|
58
|
+
{
|
|
59
|
+
role: 'user',
|
|
60
|
+
content: {
|
|
61
|
+
type: 'text',
|
|
62
|
+
text: `Prepare a standup summary based on these recent entries:\n\n${entries.map((e) => `[${e.timestamp}] ${e.entryType}: ${e.content}`).join('\n\n')}\n\nFormat as:\n- Yesterday: <summary>\n- Today: <planned work>\n- Blockers: <any blockers>`,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'prepare-retro',
|
|
71
|
+
description: 'Sprint retrospectives',
|
|
72
|
+
icons: [ICON_PROMPT],
|
|
73
|
+
arguments: [
|
|
74
|
+
{
|
|
75
|
+
name: 'days',
|
|
76
|
+
description: 'Number of days to include (default: 14)',
|
|
77
|
+
required: false,
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
handler: (args: Record<string, string>, db: SqliteAdapter) => {
|
|
81
|
+
const days = parseInt(args['days'] ?? '14', 10)
|
|
82
|
+
const endDate = new Date().toISOString().split('T')[0] ?? ''
|
|
83
|
+
const startDate =
|
|
84
|
+
new Date(Date.now() - days * 86400000).toISOString().split('T')[0] ?? ''
|
|
85
|
+
|
|
86
|
+
const entries = db.searchByDateRange(startDate, endDate)
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
messages: [
|
|
90
|
+
{
|
|
91
|
+
role: 'user',
|
|
92
|
+
content: {
|
|
93
|
+
type: 'text',
|
|
94
|
+
text: `Prepare a retrospective for the last ${String(days)} days based on these entries:\n\n${entries
|
|
95
|
+
.slice(0, 20)
|
|
96
|
+
.map(
|
|
97
|
+
(e) =>
|
|
98
|
+
`[${e.timestamp}] ${e.entryType}: ${e.content.slice(0, 200)}`
|
|
99
|
+
)
|
|
100
|
+
.join(
|
|
101
|
+
'\n\n'
|
|
102
|
+
)}\n\nFormat as:\n- What went well\n- What could improve\n- Action items`,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: 'weekly-digest',
|
|
111
|
+
description: 'Day-by-day weekly summaries',
|
|
112
|
+
icons: [ICON_PROMPT],
|
|
113
|
+
arguments: [],
|
|
114
|
+
handler: (_args: Record<string, string>, db: SqliteAdapter) => {
|
|
115
|
+
const endDate = new Date().toISOString().split('T')[0] ?? ''
|
|
116
|
+
const startDate =
|
|
117
|
+
new Date(Date.now() - 7 * 86400000).toISOString().split('T')[0] ?? ''
|
|
118
|
+
|
|
119
|
+
const entries = db.searchByDateRange(startDate, endDate)
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
messages: [
|
|
123
|
+
{
|
|
124
|
+
role: 'user',
|
|
125
|
+
content: {
|
|
126
|
+
type: 'text',
|
|
127
|
+
text: `Create a weekly digest from these entries:\n\n${entries.map((e) => `[${e.timestamp}] ${e.entryType}: ${e.content.slice(0, 150)}`).join('\n\n')}\n\nFormat as day-by-day summary with highlights.`,
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: 'analyze-period',
|
|
136
|
+
description: 'Deep period analysis with insights',
|
|
137
|
+
icons: [ICON_PROMPT],
|
|
138
|
+
arguments: [
|
|
139
|
+
{ name: 'start_date', description: 'Start date (YYYY-MM-DD)', required: true },
|
|
140
|
+
{ name: 'end_date', description: 'End date (YYYY-MM-DD)', required: true },
|
|
141
|
+
],
|
|
142
|
+
handler: (args: Record<string, string>, db: SqliteAdapter) => {
|
|
143
|
+
const startDate = args['start_date'] ?? ''
|
|
144
|
+
const endDate = args['end_date'] ?? ''
|
|
145
|
+
|
|
146
|
+
const entries = db.searchByDateRange(startDate, endDate)
|
|
147
|
+
const stats = db.getStatistics('day')
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
messages: [
|
|
151
|
+
{
|
|
152
|
+
role: 'user',
|
|
153
|
+
content: {
|
|
154
|
+
type: 'text',
|
|
155
|
+
text: `Analyze the period ${startDate} to ${endDate}:\n\nStatistics: ${JSON.stringify(stats, null, 2)}\n\nEntries (${String(entries.length)} total):\n${entries
|
|
156
|
+
.slice(0, 15)
|
|
157
|
+
.map(
|
|
158
|
+
(e) =>
|
|
159
|
+
`[${e.timestamp}] ${e.entryType}: ${e.content.slice(0, 100)}`
|
|
160
|
+
)
|
|
161
|
+
.join(
|
|
162
|
+
'\n'
|
|
163
|
+
)}\n\nProvide insights on patterns, productivity, and recommendations.`,
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: 'goal-tracker',
|
|
172
|
+
description: 'Milestone and achievement tracking',
|
|
173
|
+
icons: [ICON_PROMPT],
|
|
174
|
+
arguments: [],
|
|
175
|
+
handler: (_args: Record<string, string>, db: SqliteAdapter) => {
|
|
176
|
+
const entries = execQuery(
|
|
177
|
+
db,
|
|
178
|
+
`
|
|
179
|
+
SELECT * FROM memory_journal
|
|
180
|
+
WHERE significance_type IS NOT NULL
|
|
181
|
+
AND deleted_at IS NULL
|
|
182
|
+
ORDER BY timestamp DESC
|
|
183
|
+
LIMIT 20
|
|
184
|
+
`
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
return {
|
|
188
|
+
messages: [
|
|
189
|
+
{
|
|
190
|
+
role: 'user',
|
|
191
|
+
content: {
|
|
192
|
+
type: 'text',
|
|
193
|
+
text: `Track goals and milestones based on significant entries:\n\n${JSON.stringify(entries, null, 2)}\n\nSummarize progress toward goals and highlight achievements.`,
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: 'get-context-bundle',
|
|
202
|
+
description: 'Project context with recent entries, statistics, and GitHub status hints',
|
|
203
|
+
icons: [ICON_PROMPT],
|
|
204
|
+
arguments: [],
|
|
205
|
+
handler: (_args: Record<string, string>, db: SqliteAdapter) => {
|
|
206
|
+
const recent = db.getRecentEntries(5)
|
|
207
|
+
const stats = db.getStatistics('week')
|
|
208
|
+
|
|
209
|
+
const entrySummaries = recent.map((e) => ({
|
|
210
|
+
id: e.id,
|
|
211
|
+
type: e.entryType,
|
|
212
|
+
timestamp: e.timestamp,
|
|
213
|
+
preview: e.content.slice(0, 60) + (e.content.length > 60 ? '...' : ''),
|
|
214
|
+
}))
|
|
215
|
+
|
|
216
|
+
return {
|
|
217
|
+
messages: [
|
|
218
|
+
{
|
|
219
|
+
role: 'user',
|
|
220
|
+
content: {
|
|
221
|
+
type: 'text',
|
|
222
|
+
text: `Project context bundle:
|
|
223
|
+
|
|
224
|
+
**Recent Entries (${String(recent.length)}):**
|
|
225
|
+
${entrySummaries.map((e) => `- #${String(e.id)} (${e.type}) ${e.preview}`).join('\n')}
|
|
226
|
+
|
|
227
|
+
**Statistics:** ${JSON.stringify(stats)}
|
|
228
|
+
|
|
229
|
+
**For full GitHub status:** Fetch \`memory://github/status\`
|
|
230
|
+
**For full entry details:** Use \`get_entry_by_id\` with entry ID`,
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
],
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
name: 'get-recent-entries',
|
|
239
|
+
description: 'Formatted recent entries',
|
|
240
|
+
icons: [ICON_PROMPT],
|
|
241
|
+
arguments: [
|
|
242
|
+
{ name: 'limit', description: 'Number of entries (default: 10)', required: false },
|
|
243
|
+
],
|
|
244
|
+
handler: (args: Record<string, string>, db: SqliteAdapter) => {
|
|
245
|
+
const limit = parseInt(args['limit'] ?? '10', 10)
|
|
246
|
+
const entries = db.getRecentEntries(limit)
|
|
247
|
+
|
|
248
|
+
return {
|
|
249
|
+
messages: [
|
|
250
|
+
{
|
|
251
|
+
role: 'user',
|
|
252
|
+
content: {
|
|
253
|
+
type: 'text',
|
|
254
|
+
text: `Recent ${String(limit)} entries:\n\n${entries.map((e) => `## ${e.timestamp} (${e.entryType})\n\n${e.content}\n\nTags: ${e.tags.join(', ') || 'none'}`).join('\n\n---\n\n')}`,
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
],
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
name: 'confirm-briefing',
|
|
263
|
+
description:
|
|
264
|
+
'Acknowledge session context received from memory://briefing to inform the user',
|
|
265
|
+
icons: [ICON_PROMPT],
|
|
266
|
+
arguments: [],
|
|
267
|
+
handler: (_args: Record<string, string>, db: SqliteAdapter) => {
|
|
268
|
+
const recent = db.getRecentEntries(3)
|
|
269
|
+
const stats = db.getStatistics('week')
|
|
270
|
+
const totalEntries = stats.totalEntries ?? 0
|
|
271
|
+
|
|
272
|
+
const entrySummary =
|
|
273
|
+
recent.length > 0
|
|
274
|
+
? recent
|
|
275
|
+
.map(
|
|
276
|
+
(e) =>
|
|
277
|
+
` - #${String(e.id)} (${e.entryType}) ${e.content.slice(0, 40)}...`
|
|
278
|
+
)
|
|
279
|
+
.join('\n')
|
|
280
|
+
: ' - No entries yet'
|
|
281
|
+
|
|
282
|
+
return {
|
|
283
|
+
messages: [
|
|
284
|
+
{
|
|
285
|
+
role: 'user',
|
|
286
|
+
content: {
|
|
287
|
+
type: 'text',
|
|
288
|
+
text: `Generate a briefing acknowledgment for the user with this context:
|
|
289
|
+
|
|
290
|
+
**Session Context Received:**
|
|
291
|
+
- **Journal**: ${String(totalEntries)} total entries
|
|
292
|
+
- **Latest Entries**:
|
|
293
|
+
${entrySummary}
|
|
294
|
+
|
|
295
|
+
**My Behaviors:**
|
|
296
|
+
- Create entries for: implementations, decisions, bug fixes, milestones
|
|
297
|
+
- Search before: major decisions, referencing prior work
|
|
298
|
+
- Link entries: implementation→spec, bugfix→issue
|
|
299
|
+
|
|
300
|
+
**For More Context:**
|
|
301
|
+
- Full entries: \`memory://recent\` or \`get_entry_by_id(ID)\`
|
|
302
|
+
- GitHub status: \`memory://github/status\`
|
|
303
|
+
- Repo insights: \`memory://github/insights\` (stars, traffic, clones)
|
|
304
|
+
- Full health: \`memory://health\`
|
|
305
|
+
|
|
306
|
+
Please confirm this context to the user in a concise, friendly format. Use a table if helpful.`,
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
],
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
]
|
|
314
|
+
}
|