memory-journal-mcp 6.1.2 → 6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -28
- package/dist/{chunk-X4SWFATC.js → chunk-BI4ZNSKA.js} +38 -24
- package/dist/{chunk-HCEWINSB.js → chunk-N6EBIDN7.js} +99 -102
- package/dist/cli.js +2 -2
- package/dist/index.js +2 -2
- package/dist/tools-WPRY5MJ6.js +2 -0
- package/package.json +10 -1
- package/skills/github-commander/SKILL.md +151 -0
- package/skills/github-commander/config/project-config.example.md +125 -0
- package/skills/github-commander/workflows/code-quality-audit.md +80 -0
- package/skills/github-commander/workflows/full-audit.md +134 -0
- package/skills/github-commander/workflows/issue-triage.md +239 -0
- package/skills/github-commander/workflows/milestone-sprint.md +81 -0
- package/skills/github-commander/workflows/perf-audit.md +142 -0
- package/skills/github-commander/workflows/pr-review.md +123 -0
- package/skills/github-commander/workflows/security-audit.md +170 -0
- package/skills/github-commander/workflows/update-deps.md +109 -0
- package/.dockerignore +0 -139
- package/.gitattributes +0 -20
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -95
- package/.github/ISSUE_TEMPLATE/config.yml +0 -11
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -110
- package/.github/ISSUE_TEMPLATE/question.md +0 -78
- package/.github/aw/actions-lock.json +0 -14
- package/.github/copilot-instructions.md +0 -122
- package/.github/dependabot.yml +0 -93
- package/.github/pull_request_template.md +0 -135
- package/.github/workflows/README.md +0 -133
- package/.github/workflows/agentics-maintenance.yml +0 -141
- package/.github/workflows/auto-release.yml +0 -68
- package/.github/workflows/ci-health-monitor.lock.yml +0 -1121
- package/.github/workflows/ci-health-monitor.md +0 -87
- package/.github/workflows/codeql.yml +0 -41
- package/.github/workflows/dependabot-auto-merge.yml +0 -42
- package/.github/workflows/dependency-maintenance.lock.yml +0 -1182
- package/.github/workflows/dependency-maintenance.md +0 -147
- package/.github/workflows/docker-publish.yml +0 -254
- package/.github/workflows/docs-drift-detector.lock.yml +0 -1142
- package/.github/workflows/docs-drift-detector.md +0 -115
- package/.github/workflows/lint-and-test.yml +0 -60
- package/.github/workflows/publish-npm.yml +0 -85
- package/.github/workflows/secrets-scanning.yml +0 -32
- package/.github/workflows/security-update.yml +0 -127
- package/.gitleaks.toml +0 -9
- package/.prettierignore +0 -21
- package/.prettierrc +0 -33
- package/.scout-ignore +0 -12
- package/.trivyignore +0 -21
- package/CHANGELOG.md +0 -1814
- package/CODE_OF_CONDUCT.md +0 -133
- package/CONTRIBUTING.md +0 -263
- package/DOCKER_README.md +0 -331
- package/Dockerfile +0 -128
- package/SECURITY.md +0 -227
- package/UNRELEASED.md +0 -1
- package/dist/tools-T4U5A3X4.js +0 -2
- package/docker-compose.yml +0 -71
- package/docs/README.md +0 -18
- package/docs/agentic-journal-synergy.md +0 -175
- package/docs/copilot-setup.md +0 -72
- package/eslint.config.js +0 -110
- package/mcp-config-example.json +0 -21
- package/playwright.config.ts +0 -35
- package/releases/v2.1.0.md +0 -220
- package/releases/v2.2.0.md +0 -168
- package/releases/v3.0.0.md +0 -237
- package/releases/v3.1.0.md +0 -104
- package/releases/v3.1.1.md +0 -42
- package/releases/v3.1.2.md +0 -40
- package/releases/v3.1.3.md +0 -64
- package/releases/v3.1.4.md +0 -32
- package/releases/v3.1.5.md +0 -44
- package/releases/v4.0.0.md +0 -71
- package/releases/v4.1.0.md +0 -88
- package/releases/v4.2.0.md +0 -90
- package/releases/v4.3.0.md +0 -92
- package/releases/v4.3.1.md +0 -69
- package/releases/v4.4.0.md +0 -120
- package/releases/v4.4.1.md +0 -33
- package/releases/v4.4.2.md +0 -31
- package/releases/v4.5.0.md +0 -116
- package/releases/v5.0.0.md +0 -105
- package/releases/v5.0.1.md +0 -25
- package/releases/v5.1.0.md +0 -83
- package/releases/v5.1.1.md +0 -10
- package/releases/v6.0.0.md +0 -48
- package/releases/v6.0.1.md +0 -36
- package/releases/v6.1.0.md +0 -68
- package/releases/v6.1.1.md +0 -30
- package/releases/v6.1.2.md +0 -23
- package/scripts/generate-server-instructions.ts +0 -306
- package/scripts/server-instructions-function-body.ts +0 -107
- package/scripts/server-instructions-gotchas.ts +0 -45
- package/server.json +0 -42
- package/social-preview.png +0 -0
- package/src/auth/auth-context.ts +0 -78
- package/src/auth/authorization-server-discovery.ts +0 -263
- package/src/auth/errors.ts +0 -215
- package/src/auth/index.ts +0 -58
- package/src/auth/middleware.ts +0 -392
- package/src/auth/oauth-resource-server.ts +0 -170
- package/src/auth/scope-map.ts +0 -46
- package/src/auth/scopes.ts +0 -256
- package/src/auth/token-validator.ts +0 -293
- package/src/auth/transport-agnostic.ts +0 -164
- package/src/auth/types.ts +0 -372
- package/src/cli.ts +0 -279
- package/src/codemode/api-constants.ts +0 -263
- package/src/codemode/api.ts +0 -302
- package/src/codemode/auto-return.ts +0 -65
- package/src/codemode/index.ts +0 -47
- package/src/codemode/sandbox-factory.ts +0 -144
- package/src/codemode/sandbox.ts +0 -220
- package/src/codemode/security.ts +0 -155
- package/src/codemode/types.ts +0 -228
- package/src/codemode/worker-sandbox.ts +0 -277
- package/src/codemode/worker-script.ts +0 -239
- package/src/constants/icons.ts +0 -183
- package/src/constants/server-instructions.md +0 -166
- package/src/constants/server-instructions.ts +0 -514
- package/src/database/adapter-factory.ts +0 -16
- package/src/database/core/entry-columns.ts +0 -10
- package/src/database/core/interfaces.ts +0 -188
- package/src/database/core/schema.ts +0 -152
- package/src/database/sqlite-adapter/backup.ts +0 -167
- package/src/database/sqlite-adapter/entries/crud.ts +0 -233
- package/src/database/sqlite-adapter/entries/importance.ts +0 -76
- package/src/database/sqlite-adapter/entries/index.ts +0 -142
- package/src/database/sqlite-adapter/entries/search.ts +0 -294
- package/src/database/sqlite-adapter/entries/shared.ts +0 -102
- package/src/database/sqlite-adapter/entries/statistics.ts +0 -162
- package/src/database/sqlite-adapter/index.ts +0 -265
- package/src/database/sqlite-adapter/native-connection.ts +0 -301
- package/src/database/sqlite-adapter/relationships.ts +0 -70
- package/src/database/sqlite-adapter/tags.ts +0 -182
- package/src/filtering/tool-filter.ts +0 -312
- package/src/github/github-integration/client.ts +0 -114
- package/src/github/github-integration/index.ts +0 -297
- package/src/github/github-integration/insights.ts +0 -155
- package/src/github/github-integration/issues.ts +0 -213
- package/src/github/github-integration/milestones.ts +0 -262
- package/src/github/github-integration/projects.ts +0 -414
- package/src/github/github-integration/pull-requests.ts +0 -235
- package/src/github/github-integration/repository.ts +0 -110
- package/src/github/github-integration/types.ts +0 -43
- package/src/handlers/prompts/github.ts +0 -210
- package/src/handlers/prompts/index.ts +0 -97
- package/src/handlers/prompts/workflow.ts +0 -361
- package/src/handlers/resources/core/briefing/context-section.ts +0 -182
- package/src/handlers/resources/core/briefing/github-section.ts +0 -354
- package/src/handlers/resources/core/briefing/index.ts +0 -106
- package/src/handlers/resources/core/briefing/user-message.ts +0 -114
- package/src/handlers/resources/core/health.ts +0 -75
- package/src/handlers/resources/core/index.ts +0 -31
- package/src/handlers/resources/core/instructions.ts +0 -45
- package/src/handlers/resources/core/utilities.ts +0 -310
- package/src/handlers/resources/github.ts +0 -340
- package/src/handlers/resources/graph.ts +0 -218
- package/src/handlers/resources/help.ts +0 -410
- package/src/handlers/resources/index.ts +0 -143
- package/src/handlers/resources/shared.ts +0 -219
- package/src/handlers/resources/team.ts +0 -134
- package/src/handlers/resources/templates.ts +0 -334
- package/src/handlers/tools/admin.ts +0 -351
- package/src/handlers/tools/analytics.ts +0 -346
- package/src/handlers/tools/backup.ts +0 -272
- package/src/handlers/tools/codemode.ts +0 -188
- package/src/handlers/tools/core.ts +0 -359
- package/src/handlers/tools/error-fields-mixin.ts +0 -10
- package/src/handlers/tools/export.ts +0 -150
- package/src/handlers/tools/github/copilot-tools.ts +0 -72
- package/src/handlers/tools/github/helpers.ts +0 -125
- package/src/handlers/tools/github/insights-tools.ts +0 -112
- package/src/handlers/tools/github/issue-tools.ts +0 -442
- package/src/handlers/tools/github/kanban-tools.ts +0 -153
- package/src/handlers/tools/github/milestone-tools.ts +0 -371
- package/src/handlers/tools/github/mutation-tools.ts +0 -17
- package/src/handlers/tools/github/read-tools.ts +0 -302
- package/src/handlers/tools/github/schemas.ts +0 -435
- package/src/handlers/tools/github.ts +0 -39
- package/src/handlers/tools/index.ts +0 -255
- package/src/handlers/tools/relationships.ts +0 -390
- package/src/handlers/tools/schemas.ts +0 -165
- package/src/handlers/tools/search.ts +0 -448
- package/src/handlers/tools/team/admin-tools.ts +0 -164
- package/src/handlers/tools/team/analytics-tools.ts +0 -233
- package/src/handlers/tools/team/backup-tools.ts +0 -83
- package/src/handlers/tools/team/core-tools.ts +0 -197
- package/src/handlers/tools/team/export-tools.ts +0 -130
- package/src/handlers/tools/team/helpers.ts +0 -66
- package/src/handlers/tools/team/index.ts +0 -45
- package/src/handlers/tools/team/relationship-tools.ts +0 -219
- package/src/handlers/tools/team/schemas.ts +0 -558
- package/src/handlers/tools/team/search-tools.ts +0 -145
- package/src/handlers/tools/team/vector-tools.ts +0 -261
- package/src/index.ts +0 -57
- package/src/server/mcp-server.ts +0 -446
- package/src/server/registration.ts +0 -141
- package/src/server/scheduler.ts +0 -283
- package/src/transports/http/handlers.ts +0 -78
- package/src/transports/http/index.ts +0 -8
- package/src/transports/http/security.ts +0 -147
- package/src/transports/http/server/index.ts +0 -397
- package/src/transports/http/server/legacy-sse.ts +0 -87
- package/src/transports/http/server/stateful.ts +0 -222
- package/src/transports/http/server/stateless.ts +0 -42
- package/src/transports/http/types.ts +0 -132
- package/src/types/entities.ts +0 -145
- package/src/types/error-types.ts +0 -92
- package/src/types/errors.ts +0 -200
- package/src/types/filtering.ts +0 -55
- package/src/types/github.ts +0 -216
- package/src/types/index.ts +0 -348
- package/src/utils/error-helpers.ts +0 -78
- package/src/utils/errors/error-response-fields.ts +0 -29
- package/src/utils/errors/suggestions.ts +0 -94
- package/src/utils/github-helpers.ts +0 -33
- package/src/utils/logger.ts +0 -107
- package/src/utils/mcp-logger.ts +0 -155
- package/src/utils/progress-utils.ts +0 -100
- package/src/utils/query-helpers.ts +0 -78
- package/src/utils/resource-annotations.ts +0 -75
- package/src/utils/security-utils.ts +0 -198
- package/src/utils/vector-index-helpers.ts +0 -24
- package/src/vector/vector-search-manager.ts +0 -409
- package/src/version.ts +0 -15
- package/test-server/README.md +0 -193
- package/test-server/code-map.md +0 -399
- package/test-server/test-agent-experience.md +0 -213
- package/test-server/test-filter-instructions.mjs +0 -295
- package/test-server/test-instruction-levels.mjs +0 -102
- package/test-server/test-preflight.md +0 -55
- package/test-server/test-prompts.mjs +0 -185
- package/test-server/test-scheduler.mjs +0 -174
- package/test-server/test-tool-annotations.mjs +0 -115
- package/test-server/test-tools-codemode.md +0 -632
- package/test-server/test-tools-codemode2.md +0 -1218
- package/test-server/test-tools-team.md +0 -215
- package/test-server/test-tools.md +0 -429
- package/test-server/test-tools2.md +0 -361
- package/test-server/test-tools3.md +0 -396
- package/test-server/tool-reference.md +0 -231
- package/tests/README.md +0 -54
- package/tests/auth/auth-context.test.ts +0 -162
- package/tests/auth/authorization-server-discovery.test.ts +0 -265
- package/tests/auth/errors.test.ts +0 -170
- package/tests/auth/middleware.test.ts +0 -585
- package/tests/auth/oauth-resource-server.test.ts +0 -173
- package/tests/auth/scope-map.test.ts +0 -66
- package/tests/auth/scopes.test.ts +0 -347
- package/tests/auth/token-validator.test.ts +0 -271
- package/tests/codemode/api.test.ts +0 -396
- package/tests/codemode/auto-return.test.ts +0 -167
- package/tests/codemode/codemode-tool-handlers.test.ts +0 -197
- package/tests/codemode/sandbox-factory.test.ts +0 -152
- package/tests/codemode/sandbox.test.ts +0 -190
- package/tests/codemode/security.test.ts +0 -242
- package/tests/codemode/worker-sandbox.test.ts +0 -106
- package/tests/constants/icons.test.ts +0 -101
- package/tests/constants/server-instructions.test.ts +0 -514
- package/tests/database/crud-workflow-branches.test.ts +0 -418
- package/tests/database/database-branches.test.ts +0 -132
- package/tests/database/entries-auth-branches.test.ts +0 -390
- package/tests/database/native-connection.test.ts +0 -249
- package/tests/database/shared-helpers.test.ts +0 -103
- package/tests/database/sqlite-adapter.bench.ts +0 -63
- package/tests/database/sqlite-adapter.test.ts +0 -690
- package/tests/database/tags.test.ts +0 -134
- package/tests/e2e/README.md +0 -39
- package/tests/e2e/auth.spec.ts +0 -106
- package/tests/e2e/codemode-abuse.spec.ts +0 -75
- package/tests/e2e/health.spec.ts +0 -63
- package/tests/e2e/helpers.ts +0 -139
- package/tests/e2e/oauth-discovery.spec.ts +0 -102
- package/tests/e2e/oauth-scopes.spec.ts +0 -222
- package/tests/e2e/payloads-admin.spec.ts +0 -76
- package/tests/e2e/payloads-analytics.spec.ts +0 -37
- package/tests/e2e/payloads-backup-restore.spec.ts +0 -102
- package/tests/e2e/payloads-backup.spec.ts +0 -44
- package/tests/e2e/payloads-codemode-api.spec.ts +0 -131
- package/tests/e2e/payloads-codemode-readonly.spec.ts +0 -116
- package/tests/e2e/payloads-codemode.spec.ts +0 -116
- package/tests/e2e/payloads-core.spec.ts +0 -82
- package/tests/e2e/payloads-error-contracts.spec.ts +0 -159
- package/tests/e2e/payloads-export.spec.ts +0 -46
- package/tests/e2e/payloads-github-degradation.spec.ts +0 -73
- package/tests/e2e/payloads-github.spec.ts +0 -176
- package/tests/e2e/payloads-relationships.spec.ts +0 -56
- package/tests/e2e/payloads-search.spec.ts +0 -64
- package/tests/e2e/payloads-team-happy.spec.ts +0 -231
- package/tests/e2e/payloads-team.spec.ts +0 -174
- package/tests/e2e/prompts-expanded.spec.ts +0 -137
- package/tests/e2e/prompts.spec.ts +0 -62
- package/tests/e2e/protocols.spec.ts +0 -134
- package/tests/e2e/rate-limiting.spec.ts +0 -291
- package/tests/e2e/resources-briefing-env.spec.ts +0 -106
- package/tests/e2e/resources-complete.spec.ts +0 -180
- package/tests/e2e/resources-expanded.spec.ts +0 -83
- package/tests/e2e/resources-instructions-levels.spec.ts +0 -145
- package/tests/e2e/resources-templates.spec.ts +0 -123
- package/tests/e2e/resources.spec.ts +0 -103
- package/tests/e2e/scheduler.spec.ts +0 -79
- package/tests/e2e/security.spec.ts +0 -112
- package/tests/e2e/session-advanced.spec.ts +0 -152
- package/tests/e2e/sessions.spec.ts +0 -95
- package/tests/e2e/stateless.spec.ts +0 -79
- package/tests/e2e/streaming.spec.ts +0 -176
- package/tests/e2e/tool-filtering-presets.spec.ts +0 -192
- package/tests/e2e/tool-filtering.spec.ts +0 -77
- package/tests/e2e/tools.spec.ts +0 -111
- package/tests/filtering/tool-filter.test.ts +0 -314
- package/tests/github/client-issues-errors.test.ts +0 -433
- package/tests/github/github-integration-branches.test.ts +0 -490
- package/tests/github/github-integration.test.ts +0 -1015
- package/tests/github/github-managers-branches.test.ts +0 -907
- package/tests/github/pull-requests.test.ts +0 -334
- package/tests/handlers/analytics-branches.test.ts +0 -222
- package/tests/handlers/backup-branches.test.ts +0 -270
- package/tests/handlers/briefing-context-section.test.ts +0 -388
- package/tests/handlers/briefing-github-section.test.ts +0 -392
- package/tests/handlers/briefing-user-message.test.ts +0 -405
- package/tests/handlers/codemode-tools.test.ts +0 -85
- package/tests/handlers/copilot-tools.test.ts +0 -126
- package/tests/handlers/error-path-coverage.test.ts +0 -324
- package/tests/handlers/export-tools.test.ts +0 -203
- package/tests/handlers/github-resource-handlers.test.ts +0 -929
- package/tests/handlers/github-tool-handlers.test.ts +0 -1452
- package/tests/handlers/handler-error-branches.test.ts +0 -346
- package/tests/handlers/help-resource.test.ts +0 -92
- package/tests/handlers/prompt-handler-coverage.test.ts +0 -108
- package/tests/handlers/prompt-handlers.test.ts +0 -131
- package/tests/handlers/resource-handler-coverage.test.ts +0 -281
- package/tests/handlers/resource-handlers.test.ts +0 -357
- package/tests/handlers/resource-prompt-branches.test.ts +0 -495
- package/tests/handlers/search-tool-handlers.test.ts +0 -379
- package/tests/handlers/targeted-gap-closure.test.ts +0 -387
- package/tests/handlers/team-admin.test.ts +0 -291
- package/tests/handlers/team-analytics.test.ts +0 -220
- package/tests/handlers/team-core.test.ts +0 -148
- package/tests/handlers/team-data.test.ts +0 -198
- package/tests/handlers/team-relationships.test.ts +0 -271
- package/tests/handlers/team-resource-handlers.test.ts +0 -161
- package/tests/handlers/team-search.test.ts +0 -134
- package/tests/handlers/team-tool-handlers.test.ts +0 -301
- package/tests/handlers/team-vector.test.ts +0 -213
- package/tests/handlers/template-github-branches.test.ts +0 -676
- package/tests/handlers/tool-annotations.test.ts +0 -90
- package/tests/handlers/tool-handler-coverage.test.ts +0 -514
- package/tests/handlers/tool-handlers.test.ts +0 -510
- package/tests/handlers/tool-output-schemas.test.ts +0 -116
- package/tests/handlers/vector-tool-handlers.test.ts +0 -238
- package/tests/security/sql-injection.test.ts +0 -284
- package/tests/server/mcp-server.bench.ts +0 -55
- package/tests/server/mcp-server.test.ts +0 -1326
- package/tests/server/scheduler.test.ts +0 -400
- package/tests/transports/http-legacy-sse.test.ts +0 -275
- package/tests/transports/http-security.test.ts +0 -322
- package/tests/transports/http-stateful.test.ts +0 -487
- package/tests/transports/http-transport-server.test.ts +0 -301
- package/tests/transports/http-transport.test.ts +0 -771
- package/tests/utils/github-helpers.test.ts +0 -58
- package/tests/utils/logger.test.ts +0 -180
- package/tests/utils/mcp-logger.test.ts +0 -211
- package/tests/utils/progress-utils.test.ts +0 -156
- package/tests/utils/query-helpers.test.ts +0 -80
- package/tests/utils/security-utils.test.ts +0 -82
- package/tests/vector/vector-search-branches.test.ts +0 -111
- package/tests/vector/vector-search-manager.test.ts +0 -375
- package/tests/vector/vector-search.bench.ts +0 -48
- package/tsconfig.json +0 -42
- package/tsup.config.ts +0 -19
- package/vitest.config.ts +0 -25
package/test-server/code-map.md
DELETED
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
# memory-journal-mcp Code Map
|
|
2
|
-
|
|
3
|
-
> **Agent-optimized navigation reference.** Read this before searching the codebase. Covers directory layout, handler→tool mapping, resources, prompts, error hierarchy, and key constants.
|
|
4
|
-
>
|
|
5
|
-
> Last updated: March 21, 2026
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Directory Tree
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
src/
|
|
13
|
-
├── cli.ts # CLI entry point (arg parsing, transport selection)
|
|
14
|
-
├── index.ts # Barrel re-export for library consumers
|
|
15
|
-
├── version.ts # Version SSoT — reads package.json, exports VERSION
|
|
16
|
-
│
|
|
17
|
-
├── server/
|
|
18
|
-
│ ├── mcp-server.ts # McpServer setup, tool/resource/prompt wiring
|
|
19
|
-
│ ├── registration.ts # Tool/resource/prompt registration logic
|
|
20
|
-
│ └── scheduler.ts # HTTP-only automated scheduling (backup, vacuum, rebuild-index)
|
|
21
|
-
│
|
|
22
|
-
├── types/ # Core TypeScript types (barrel: types/index.ts)
|
|
23
|
-
│ ├── entities.ts # EntryType, SignificanceType, RelationshipType, JournalEntry, Tag, Relationship, Embedding
|
|
24
|
-
│ ├── error-types.ts # ErrorCategory enum + ErrorResponse/ErrorContext interfaces
|
|
25
|
-
│ ├── errors.ts # MemoryJournalMcpError (base) + 5 concrete error subclasses
|
|
26
|
-
│ ├── filtering.ts # ToolGroup, MetaGroup, ToolFilterRule, ToolFilterConfig
|
|
27
|
-
│ ├── github.ts # GitHubProject, GitHubIssue, GitHubPullRequest, GitHubMilestone, KanbanBoard, RepoStats, etc.
|
|
28
|
-
│ └── index.ts # Barrel — re-exports all sub-modules + ToolDefinition, ResourceDefinition, PromptDefinition, ServerConfig
|
|
29
|
-
│
|
|
30
|
-
├── constants/
|
|
31
|
-
│ ├── icons.ts # MCP icon definitions per tool group (CDN SVG URLs)
|
|
32
|
-
│ ├── server-instructions.md # Source markdown for behavioral instruction levels
|
|
33
|
-
│ └── server-instructions.ts # Behavioral guidance + GOTCHAS_CONTENT export + generateInstructions() + composable segment builders (buildQuickAccess, buildCodeModeInstructions)
|
|
34
|
-
│
|
|
35
|
-
├── filtering/
|
|
36
|
-
│ └── tool-filter.ts # ToolFilter class — parse/apply --tool-filter expressions, group/shortcut/tool resolution
|
|
37
|
-
│
|
|
38
|
-
├── utils/
|
|
39
|
-
│ ├── error-helpers.ts # formatHandlerError() — structured {success:false} builder
|
|
40
|
-
│ ├── github-helpers.ts # GitHub token scrubbing and helper utilities
|
|
41
|
-
│ ├── logger.ts # Logger class (structured JSON, severity filtering)
|
|
42
|
-
│ ├── mcp-logger.ts # MCP-specific logger with module prefixing
|
|
43
|
-
│ ├── progress-utils.ts # MCP progress notification helpers (ProgressContext)
|
|
44
|
-
│ ├── security-utils.ts # Input validation, SQL injection prevention, path traversal guards
|
|
45
|
-
│ ├── vector-index-helpers.ts # Vector index utility helpers
|
|
46
|
-
│ └── errors/
|
|
47
|
-
│ └── error-response-fields.ts # ErrorFieldsMixin SSoT — 6 optional error fields for output schemas
|
|
48
|
-
│
|
|
49
|
-
├── auth/ # OAuth 2.1 implementation
|
|
50
|
-
│ ├── auth-context.ts # Auth context utilities
|
|
51
|
-
│ ├── middleware.ts # Express-style OAuth middleware
|
|
52
|
-
│ ├── token-validator.ts # JWT/JWKS token validation
|
|
53
|
-
│ ├── scopes.ts # Scope parsing and enforcement
|
|
54
|
-
│ ├── scope-map.ts # Tool→scope mapping (read/write/admin)
|
|
55
|
-
│ ├── oauth-resource-server.ts # RFC 9728 /.well-known/oauth-protected-resource
|
|
56
|
-
│ ├── authorization-server-discovery.ts # RFC 8414 auth server metadata discovery
|
|
57
|
-
│ ├── transport-agnostic.ts # Non-Express auth re-exports for transport portability
|
|
58
|
-
│ ├── errors.ts # OAuth-specific error classes
|
|
59
|
-
│ ├── types.ts # OAuth TypeScript types
|
|
60
|
-
│ └── index.ts # Barrel
|
|
61
|
-
│
|
|
62
|
-
├── transports/
|
|
63
|
-
│ └── http/
|
|
64
|
-
│ ├── handlers.ts # HTTP request handlers (root info, health)
|
|
65
|
-
│ ├── security.ts # Security headers, rate limiting, CORS, body parsing
|
|
66
|
-
│ ├── types.ts # HTTP transport types
|
|
67
|
-
│ ├── index.ts # Barrel
|
|
68
|
-
│ └── server/
|
|
69
|
-
│ ├── index.ts # HTTP server factory (stateful/stateless selection)
|
|
70
|
-
│ ├── stateful.ts # Stateful HTTP transport (Streamable HTTP + session management)
|
|
71
|
-
│ ├── stateless.ts # Stateless HTTP transport (serverless mode)
|
|
72
|
-
│ └── legacy-sse.ts # Legacy SSE transport (MCP 2024-11-05 compat)
|
|
73
|
-
│
|
|
74
|
-
├── codemode/ # Code Mode sandbox (secure JS execution)
|
|
75
|
-
│ ├── sandbox.ts # SandboxPool lifecycle manager
|
|
76
|
-
│ ├── sandbox-factory.ts # Sandbox creation factory
|
|
77
|
-
│ ├── auto-return.ts # Last-expression auto-return transform (IIFE helper)
|
|
78
|
-
│ ├── worker-sandbox.ts # Worker thread sandbox (MessagePort RPC bridge)
|
|
79
|
-
│ ├── worker-script.ts # Worker thread entry point — builds mj.* API proxy; Proxy trap returns structured errors for readonly mode
|
|
80
|
-
│ ├── api.ts # mj.* API bridge (exposes tools to sandbox)
|
|
81
|
-
│ ├── api-constants.ts # API bridge constants, method→group map, JSON-RPC codes
|
|
82
|
-
│ ├── security.ts # Code validation (blocked patterns, injection prevention)
|
|
83
|
-
│ ├── types.ts # Sandbox TypeScript types
|
|
84
|
-
│ └── index.ts # Barrel
|
|
85
|
-
│
|
|
86
|
-
├── database/
|
|
87
|
-
│ ├── adapter-factory.ts # Database adapter factory (creates SqliteAdapter)
|
|
88
|
-
│ ├── core/
|
|
89
|
-
│ │ ├── interfaces.ts # IDatabaseAdapter interface (database contract)
|
|
90
|
-
│ │ ├── schema.ts # Database schema DDL (tables, indexes, FTS5)
|
|
91
|
-
│ │ └── entry-columns.ts # Column name constants for entry queries
|
|
92
|
-
│ └── sqlite-adapter/
|
|
93
|
-
│ ├── index.ts # SqliteAdapter class (implements IDatabaseAdapter)
|
|
94
|
-
│ ├── native-connection.ts # better-sqlite3 connection management
|
|
95
|
-
│ ├── backup.ts # Backup/restore operations
|
|
96
|
-
│ ├── tags.ts # Tag CRUD and merge operations
|
|
97
|
-
│ ├── relationships.ts # Entry relationship operations
|
|
98
|
-
│ └── entries/
|
|
99
|
-
│ ├── index.ts # Entry operations barrel
|
|
100
|
-
│ ├── crud.ts # Entry create/read/update/delete
|
|
101
|
-
│ ├── search.ts # FTS5 search, date-range search
|
|
102
|
-
│ ├── importance.ts # Importance scoring algorithm
|
|
103
|
-
│ ├── statistics.ts # Journal statistics and analytics
|
|
104
|
-
│ └── shared.ts # Shared entry query helpers
|
|
105
|
-
│
|
|
106
|
-
├── vector/
|
|
107
|
-
│ └── vector-search-manager.ts # VectorSearchManager — sqlite-vec + @huggingface/transformers integration
|
|
108
|
-
│
|
|
109
|
-
├── github/
|
|
110
|
-
│ └── github-integration/
|
|
111
|
-
│ ├── index.ts # GitHubIntegration class (facade for all GitHub operations)
|
|
112
|
-
│ ├── client.ts # GitHub REST API client (Octokit wrapper)
|
|
113
|
-
│ ├── repository.ts # Repository context detection (owner/repo from git remote)
|
|
114
|
-
│ ├── issues.ts # Issue operations (list, get, create, close)
|
|
115
|
-
│ ├── pull-requests.ts # PR operations (list, get)
|
|
116
|
-
│ ├── projects.ts # GitHub Projects v2 / Kanban operations (GraphQL)
|
|
117
|
-
│ ├── milestones.ts # Milestone CRUD (create, get, update, delete)
|
|
118
|
-
│ ├── insights.ts # Repository insights (stars, forks, traffic, referrers)
|
|
119
|
-
│ └── types.ts # GitHub integration internal types
|
|
120
|
-
│
|
|
121
|
-
└── handlers/
|
|
122
|
-
├── tools/ # Tool handlers — see § Handler Map below
|
|
123
|
-
│ ├── index.ts # getTools() / callTool() dispatch, tool map cache
|
|
124
|
-
│ ├── schemas.ts # Shared Zod input schemas (reused across groups)
|
|
125
|
-
│ ├── error-fields-mixin.ts # Re-export stub → canonical SSoT at utils/errors/error-response-fields.ts
|
|
126
|
-
│ ├── core.ts # Core tool group (6 tools)
|
|
127
|
-
│ ├── search.ts # Search tool group (4 tools)
|
|
128
|
-
│ ├── analytics.ts # Analytics tool group (2 tools)
|
|
129
|
-
│ ├── relationships.ts # Relationships tool group (2 tools)
|
|
130
|
-
│ ├── export.ts # Export tool group (1 tool)
|
|
131
|
-
│ ├── admin.ts # Admin tool group (5 tools)
|
|
132
|
-
│ ├── backup.ts # Backup tool group (4 tools)
|
|
133
|
-
│ ├── codemode.ts # Code Mode tool group (1 tool)
|
|
134
|
-
│ ├── team/ # Team tool group (20 tools)
|
|
135
|
-
│ │ ├── index.ts # Barrel — composes all team sub-modules
|
|
136
|
-
│ │ ├── helpers.ts # Shared team helpers (author batch-fetch, constants)
|
|
137
|
-
│ │ ├── schemas.ts # Team Zod input/output schemas (all 20 tools)
|
|
138
|
-
│ │ ├── core-tools.ts # Core team tools (create, get_by_id, get_recent, list_tags)
|
|
139
|
-
│ │ ├── search-tools.ts # Search team tools (search, search_by_date_range)
|
|
140
|
-
│ │ ├── admin-tools.ts # Admin team tools (update, delete, merge_tags)
|
|
141
|
-
│ │ ├── analytics-tools.ts # Analytics team tools (get_statistics, get_cross_project_insights)
|
|
142
|
-
│ │ ├── relationship-tools.ts # Relationship team tools (link, visualize)
|
|
143
|
-
│ │ ├── export-tools.ts # Export team tool (export_entries)
|
|
144
|
-
│ │ ├── backup-tools.ts # Backup team tools (backup, list_backups)
|
|
145
|
-
│ │ └── vector-tools.ts # Vector team tools (semantic_search, vector_index_stats, rebuild, add)
|
|
146
|
-
│ ├── github.ts # GitHub tools barrel (re-exports from github/ subdirectory)
|
|
147
|
-
│ └── github/ # GitHub tool handlers (split by domain)
|
|
148
|
-
│ ├── helpers.ts # Shared GitHub tool helpers (repo detection, error formatting)
|
|
149
|
-
│ ├── schemas.ts # GitHub tool Zod input/output schemas
|
|
150
|
-
│ ├── read-tools.ts # Read-only GitHub tools (get_github_issues, get_github_prs, get_github_issue, get_github_pr, get_github_context)
|
|
151
|
-
│ ├── issue-tools.ts # Issue lifecycle tools (create_github_issue_with_entry, close_github_issue_with_entry)
|
|
152
|
-
│ ├── kanban-tools.ts # Kanban tools (get_kanban_board, move_kanban_item)
|
|
153
|
-
│ ├── milestone-tools.ts # Milestone CRUD tools (5 tools)
|
|
154
|
-
│ ├── insights-tools.ts # Insights tool (get_repo_insights)
|
|
155
|
-
│ ├── copilot-tools.ts # Copilot tool (get_copilot_reviews)
|
|
156
|
-
│ └── mutation-tools.ts # Mutation tools barrel
|
|
157
|
-
│
|
|
158
|
-
├── resources/ # Resource handlers
|
|
159
|
-
│ ├── index.ts # Resource registration barrel
|
|
160
|
-
│ ├── shared.ts # Shared resource helpers (formatters, entry rendering)
|
|
161
|
-
│ ├── github.ts # GitHub static resources (status, insights, milestones)
|
|
162
|
-
│ ├── graph.ts # Graph resources (recent relationships, actions narrative)
|
|
163
|
-
│ ├── team.ts # Team resources (recent, statistics)
|
|
164
|
-
│ ├── help.ts # Dynamic help resources (memory://help, memory://help/{group}, memory://help/gotchas)
|
|
165
|
-
│ ├── templates.ts # Template resources (projects, issues, PRs, kanban, milestones)
|
|
166
|
-
│ └── core/
|
|
167
|
-
│ ├── index.ts # Core static resources barrel
|
|
168
|
-
│ ├── health.ts # memory://health resource
|
|
169
|
-
│ ├── instructions.ts # memory://instructions resource
|
|
170
|
-
│ ├── utilities.ts # memory://recent, memory://significant, memory://tags, memory://statistics, memory://rules, memory://workflows, memory://skills
|
|
171
|
-
│ └── briefing/
|
|
172
|
-
│ ├── index.ts # memory://briefing resource (assembles sections)
|
|
173
|
-
│ ├── context-section.ts # Journal context section (entry count, recent entries)
|
|
174
|
-
│ ├── github-section.ts # GitHub context section (repo, CI, issues, PRs, milestones, insights)
|
|
175
|
-
│ └── user-message.ts # User message section (rules, skills awareness)
|
|
176
|
-
│
|
|
177
|
-
└── prompts/ # Prompt handlers
|
|
178
|
-
├── index.ts # Prompt registration barrel
|
|
179
|
-
├── workflow.ts # 10 workflow prompts (standup, retro, digest, analysis, etc., confirm-briefing)
|
|
180
|
-
└── github.ts # 6 GitHub prompts (project-status-summary, pr-summary, code-review-prep, pr-retrospective, actions-failure-digest, project-milestone-tracker)
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
---
|
|
184
|
-
|
|
185
|
-
## Handler → Tool Mapping
|
|
186
|
-
|
|
187
|
-
Each file below registers tools with `group` labels. The `index.ts` barrel composes all groups via `getAllToolDefinitions()`.
|
|
188
|
-
|
|
189
|
-
### Tool Handlers (`src/handlers/tools/`)
|
|
190
|
-
|
|
191
|
-
| Group | Handler File(s) | Tools | Key Exports |
|
|
192
|
-
| ----------------- | ---------------------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
193
|
-
| **codemode** | `codemode.ts` | 1 | `mj_execute_code` |
|
|
194
|
-
| **core** | `core.ts` | 6 | `create_entry`, `get_entry_by_id`, `get_recent_entries`, `create_entry_minimal`, `test_simple`, `list_tags` |
|
|
195
|
-
| **search** | `search.ts` | 4 | `search_entries`, `search_by_date_range`, `semantic_search`, `get_vector_index_stats` |
|
|
196
|
-
| **analytics** | `analytics.ts` | 2 | `get_statistics`, `get_cross_project_insights` |
|
|
197
|
-
| **relationships** | `relationships.ts` | 2 | `link_entries`, `visualize_relationships` |
|
|
198
|
-
| **export** | `export.ts` | 1 | `export_entries` |
|
|
199
|
-
| **admin** | `admin.ts` | 5 | `update_entry`, `delete_entry`, `merge_tags`, `rebuild_vector_index`, `add_to_vector_index` |
|
|
200
|
-
| **github** | `github/read-tools.ts` | 5 | `get_github_issues`, `get_github_prs`, `get_github_issue`, `get_github_pr`, `get_github_context` |
|
|
201
|
-
| | `github/issue-tools.ts` | 2 | `create_github_issue_with_entry`, `close_github_issue_with_entry` |
|
|
202
|
-
| | `github/kanban-tools.ts` | 2 | `get_kanban_board`, `move_kanban_item` |
|
|
203
|
-
| | `github/milestone-tools.ts` | 5 | `get_github_milestones`, `get_github_milestone`, `create_github_milestone`, `update_github_milestone`, `delete_github_milestone` |
|
|
204
|
-
| | `github/insights-tools.ts` | 1 | `get_repo_insights` |
|
|
205
|
-
| | `github/copilot-tools.ts` | 1 | `get_copilot_reviews` |
|
|
206
|
-
| **backup** | `backup.ts` | 4 | `backup_journal`, `list_backups`, `restore_backup`, `cleanup_backups` |
|
|
207
|
-
| **team** | `team/core-tools.ts` | 4 | `team_create_entry`, `team_get_entry_by_id`, `team_get_recent`, `team_list_tags` |
|
|
208
|
-
| | `team/search-tools.ts` | 2 | `team_search`, `team_search_by_date_range` |
|
|
209
|
-
| | `team/admin-tools.ts` | 3 | `team_update_entry`, `team_delete_entry`, `team_merge_tags` |
|
|
210
|
-
| | `team/analytics-tools.ts` | 2 | `team_get_statistics`, `team_get_cross_project_insights` |
|
|
211
|
-
| | `team/relationship-tools.ts` | 2 | `team_link_entries`, `team_visualize_relationships` |
|
|
212
|
-
| | `team/export-tools.ts` | 1 | `team_export_entries` |
|
|
213
|
-
| | `team/backup-tools.ts` | 2 | `team_backup`, `team_list_backups` |
|
|
214
|
-
| | `team/vector-tools.ts` | 4 | `team_semantic_search`, `team_get_vector_index_stats`, `team_rebuild_vector_index`, `team_add_to_vector_index` |
|
|
215
|
-
|
|
216
|
-
### Utility Files (no tools, shared helpers)
|
|
217
|
-
|
|
218
|
-
| File | Purpose |
|
|
219
|
-
| -------------------------- | -------------------------------------------------------------------------- |
|
|
220
|
-
| `index.ts` | `getTools()` / `callTool()` dispatch, O(1) tool map cache, icon mapping |
|
|
221
|
-
| `schemas.ts` | Shared Zod input/output schemas reused across multiple tool groups |
|
|
222
|
-
| `error-fields-mixin.ts` | Re-export stub → `utils/errors/error-response-fields.ts` (canonical SSoT) |
|
|
223
|
-
| `../version.ts` | Version SSoT — reads `package.json`, exports `VERSION` |
|
|
224
|
-
| `github/helpers.ts` | GitHub repo auto-detection, error formatting, token scrubbing |
|
|
225
|
-
| `github/schemas.ts` | Zod input/output schemas for all 16 GitHub tools |
|
|
226
|
-
| `github/mutation-tools.ts` | GitHub mutation tools barrel (re-exports issue + kanban + milestone tools) |
|
|
227
|
-
|
|
228
|
-
---
|
|
229
|
-
|
|
230
|
-
## Resources (`src/handlers/resources/`)
|
|
231
|
-
|
|
232
|
-
28 resources total — 20 static + 8 template.
|
|
233
|
-
|
|
234
|
-
### Static Resources
|
|
235
|
-
|
|
236
|
-
| Handler File | Resources |
|
|
237
|
-
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
238
|
-
| `core/briefing/index.ts` | `memory://briefing` — session initialization (~300 tokens) |
|
|
239
|
-
| `core/instructions.ts` | `memory://instructions` — behavioral guidance for AI agents |
|
|
240
|
-
| `core/health.ts` | `memory://health` — server health & diagnostics |
|
|
241
|
-
| `core/utilities.ts` | `memory://recent`, `memory://significant`, `memory://tags`, `memory://statistics`, `memory://rules`, `memory://workflows`, `memory://skills` |
|
|
242
|
-
| `github.ts` | `memory://github/status`, `memory://github/insights`, `memory://github/milestones` |
|
|
243
|
-
| `graph.ts` | `memory://graph/recent`, `memory://graph/actions`, `memory://actions/recent` |
|
|
244
|
-
| `team.ts` | `memory://team/recent`, `memory://team/statistics` |
|
|
245
|
-
| `help.ts` | `memory://help` (tool group index), `memory://help/{group}` (per-group tool details), `memory://help/gotchas` (field notes) |
|
|
246
|
-
|
|
247
|
-
### Template Resources
|
|
248
|
-
|
|
249
|
-
| Handler File | Resources |
|
|
250
|
-
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
251
|
-
| `templates.ts` | `memory://projects/{number}/timeline`, `memory://issues/{issue_number}/entries`, `memory://prs/{pr_number}/entries`, `memory://prs/{pr_number}/timeline`, `memory://kanban/{project_number}`, `memory://kanban/{project_number}/diagram`, `memory://milestones/{number}` |
|
|
252
|
-
|
|
253
|
-
### Briefing Assembly (`src/handlers/resources/core/briefing/`)
|
|
254
|
-
|
|
255
|
-
The `memory://briefing` resource is modular — each section is a separate file:
|
|
256
|
-
|
|
257
|
-
| File | Section |
|
|
258
|
-
| -------------------- | ------------------------------------------------------------ |
|
|
259
|
-
| `index.ts` | Assembles all sections, respects instruction level |
|
|
260
|
-
| `context-section.ts` | Journal context (entry count, recent entries, team DB) |
|
|
261
|
-
| `github-section.ts` | GitHub context (repo, CI, issues, PRs, milestones, insights) |
|
|
262
|
-
| `user-message.ts` | User message (rules file, skills directory awareness) |
|
|
263
|
-
|
|
264
|
-
---
|
|
265
|
-
|
|
266
|
-
## Prompts (`src/handlers/prompts/`)
|
|
267
|
-
|
|
268
|
-
16 workflow prompts total.
|
|
269
|
-
|
|
270
|
-
| File | Prompts |
|
|
271
|
-
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
272
|
-
| `workflow.ts` | `find-related`, `prepare-standup`, `prepare-retro`, `weekly-digest`, `analyze-period`, `goal-tracker`, `get-context-bundle`, `get-recent-entries`, `confirm-briefing`, `session-summary` |
|
|
273
|
-
| `github.ts` | `project-status-summary`, `pr-summary`, `code-review-prep`, `pr-retrospective`, `actions-failure-digest`, `project-milestone-tracker` |
|
|
274
|
-
| `index.ts` | Barrel — re-exports workflow + GitHub prompts, `getPrompt()` / `getPrompts()` dispatch |
|
|
275
|
-
|
|
276
|
-
---
|
|
277
|
-
|
|
278
|
-
## Error Class Hierarchy
|
|
279
|
-
|
|
280
|
-
All errors extend `MemoryJournalMcpError` (defined in `src/types/errors.ts`). Every tool returns structured `{success: false, error, code, category, suggestion, recoverable}` via `formatHandlerError()` — never raw MCP exceptions.
|
|
281
|
-
|
|
282
|
-
```
|
|
283
|
-
MemoryJournalMcpError (errors.ts)
|
|
284
|
-
├── ConnectionError code: CONNECTION_FAILED category: connection recoverable: true
|
|
285
|
-
├── QueryError code: QUERY_FAILED category: query
|
|
286
|
-
├── ValidationError code: VALIDATION_FAILED category: validation
|
|
287
|
-
├── ResourceNotFoundError code: RESOURCE_NOT_FOUND category: resource accepts: resourceType, identifier
|
|
288
|
-
├── ConfigurationError code: CONFIGURATION_ERROR category: configuration
|
|
289
|
-
└── PermissionError code: PERMISSION_DENIED category: permission
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
**ErrorCategory enum** (`src/types/error-types.ts`): `validation`, `connection`, `query`, `permission`, `configuration`, `resource`, `authentication`, `authorization`, `internal`
|
|
293
|
-
|
|
294
|
-
**Usage pattern** — all tool handlers:
|
|
295
|
-
|
|
296
|
-
```typescript
|
|
297
|
-
import { ValidationError } from '../../types/index.js'
|
|
298
|
-
import { formatHandlerError } from '../../utils/error-helpers.js'
|
|
299
|
-
|
|
300
|
-
// Throw typed errors:
|
|
301
|
-
throw new ValidationError('Entry ID required')
|
|
302
|
-
|
|
303
|
-
// Catch at handler boundary:
|
|
304
|
-
catch (error) {
|
|
305
|
-
return formatHandlerError(error)
|
|
306
|
-
}
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
---
|
|
310
|
-
|
|
311
|
-
## Key Constants & Config
|
|
312
|
-
|
|
313
|
-
| What | Where | Notes |
|
|
314
|
-
| ---------------------------------- | -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
315
|
-
| Server instructions (agent prompt) | `src/constants/server-instructions.ts` | Filter-aware composable segments; `GOTCHAS_CONTENT` + `generateInstructions()` (`essential`, `standard`, `full`, optional `enabledGroups`) |
|
|
316
|
-
| Instruction source markdown | `src/constants/server-instructions.md` | 6 sections (`CORE`, `COPILOT`, `CODE_MODE`, `GITHUB`, `HELP_POINTERS`, `SERVER_ACCESS`); parsed by `npm run generate:instructions` |
|
|
317
|
-
| Tool filter logic | `src/filtering/tool-filter.ts` | `ToolFilter` class — shortcuts, groups, tool-level whitelist/blacklist + `getEnabledGroups()` for instruction section gating |
|
|
318
|
-
| Tool group icon mapping | `src/constants/icons.ts` | CDN SVG URLs per tool group (used in `tools/list` responses) |
|
|
319
|
-
| Resource annotation presets | `src/utils/resource-annotations.ts` | Centralized presets (`HIGH_PRIORITY`, `MEDIUM_PRIORITY`, `LOW_PRIORITY`, `ASSISTANT_FOCUSED`) + helpers (`withPriority`, `withAutoRead`, `withSessionInit`) |
|
|
320
|
-
| Code Mode API constants | `src/codemode/api-constants.ts` | Method→group map, JSON-RPC error codes, sandbox method names |
|
|
321
|
-
| Logger | `src/utils/logger.ts` | Structured JSON logging with severity filtering |
|
|
322
|
-
| Security utilities | `src/utils/security-utils.ts` | Input validation, SQL injection prevention, path traversal protection, token scrubbing |
|
|
323
|
-
| Error formatter | `src/utils/error-helpers.ts` | `formatHandlerError()` — structured error response builder |
|
|
324
|
-
| Database schema DDL | `src/database/core/schema.ts` | Table definitions, indexes, FTS5 virtual table |
|
|
325
|
-
| Database adapter interface | `src/database/core/interfaces.ts` | `IDatabaseAdapter` contract (all DB operations) |
|
|
326
|
-
| Default config | `src/types/index.ts` | `DEFAULT_CONFIG` with default db path, model name, semantic search enabled |
|
|
327
|
-
| OAuth scope mapping | `src/auth/scope-map.ts` | Tool→scope mapping: `read`, `write`, `admin` |
|
|
328
|
-
|
|
329
|
-
---
|
|
330
|
-
|
|
331
|
-
## Architecture Patterns (Quick Reference)
|
|
332
|
-
|
|
333
|
-
| Pattern | Description |
|
|
334
|
-
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
335
|
-
| **Structured Errors** | Every tool returns `{success: false, error, code, category, suggestion, recoverable}` — never raw exceptions. Uses `formatHandlerError()`. |
|
|
336
|
-
| **Tool Context** | `ToolContext` passes `db`, `teamDb?`, `vectorManager?`, `teamVectorManager?`, `github?`, `config?`, `progress?` to all tool group modules. Each group factory receives context and returns `ToolDefinition[]`. |
|
|
337
|
-
| **Tool Map Cache** | `getTools()` + `callTool()` share a `Map<string, ToolDefinition>` cache (O(1) lookup). Cache invalidates when context refs change. `mappedToolsCache` avoids re-mapping for unfiltered calls. |
|
|
338
|
-
| **Code Mode Bridge** | `mj.*` API in worker thread communicates via MessagePort RPC to main thread tool handlers. All 10 groups exposed (`core`, `search`, `analytics`, `relationships`, `export`, `admin`, `github`, `backup`, `team`). Readonly mode halts execution gracefully and returns structured errors via proxy traps. |
|
|
339
|
-
| **Tool Filtering** | `ToolFilter` parses `--tool-filter` string → whitelist/blacklist of tool names. `codemode` auto-injected unless explicitly excluded. Shortcuts: `starter`, `essential`, `readonly`. |
|
|
340
|
-
| **Briefing System** | `memory://briefing` assembled from modular sections (context, GitHub, user message). Configurable via 12 env vars / CLI flags (incl. `--workflow-summary`/`MEMORY_JOURNAL_WORKFLOW_SUMMARY` for `memory://workflows`). Instruction levels: `essential`, `standard`, `full`. |
|
|
341
|
-
| **GitHub Split** | GitHub tools split across 7 handler files by domain (read, issues, kanban, milestones, insights, copilot, mutations). `GitHubIntegration` facade in `github/github-integration/` handles all API calls. |
|
|
342
|
-
| **Database Adapter** | `IDatabaseAdapter` interface → `SqliteAdapter` (better-sqlite3). Entry operations split into `entries/` subdirectory (crud, search, importance, statistics, shared). |
|
|
343
|
-
| **Vector Search** | `VectorSearchManager` integrates `sqlite-vec` + `@huggingface/transformers`. Lazy model loading on first use. |
|
|
344
|
-
| **OAuth 2.1** | RFC 9728/8414 compliant. Scope enforcement via `scope-map.ts` (read/write/admin). JWT/JWKS validation. Optional — falls back to bearer token or no auth. |
|
|
345
|
-
| **HTTP Transport** | Stateful (Streamable HTTP + legacy SSE) / Stateless (serverless) modes. Security headers, rate limiting (100 req/min), CORS, 1MB body limit, session management. |
|
|
346
|
-
| **Scheduler** | HTTP-only `setInterval` jobs: automated backup, vacuum, vector index rebuild. Error-isolated — failure in one job doesn't affect others. Status visible via `memory://health`. |
|
|
347
|
-
| **ErrorFieldsMixin** | All output schemas extend `ErrorFieldsMixin.shape` — 6 optional error fields so error responses always pass validation. Canonical SSoT at `utils/errors/error-response-fields.ts`; handler layer re-export stub preserved. |
|
|
348
|
-
| **Barrel Re-exports** | Every directory has `index.ts` barrel. Import from `./module/index.js` (with `.js` extension for ESM). |
|
|
349
|
-
| **Team Database** | Separate SQLite file (`TEAM_DB_PATH`) with author attribution. 20 dedicated tools split into `team/` subdirectory (core, search, admin, analytics, relationships, export, backup, vector). Cross-DB isolation with dedicated `teamVectorManager`. |
|
|
350
|
-
|
|
351
|
-
---
|
|
352
|
-
|
|
353
|
-
## Import Path Conventions
|
|
354
|
-
|
|
355
|
-
- All imports use **`.js` extension** (ESM requirement): `import { x } from './foo/index.js'`
|
|
356
|
-
- After splitting `foo.ts` → `foo/` directory: update imports from `./foo.js` → `./foo/index.js`
|
|
357
|
-
- Error classes can be imported from:
|
|
358
|
-
- `../../types/errors.js` (direct)
|
|
359
|
-
- `../../types/index.js` (re-exported: `MemoryJournalMcpError`, `ConnectionError`, `QueryError`, `ValidationError`, `ResourceNotFoundError`, `ConfigurationError`, `PermissionError`)
|
|
360
|
-
- Error formatter: `import { formatHandlerError } from '../../utils/error-helpers.js'`
|
|
361
|
-
|
|
362
|
-
---
|
|
363
|
-
|
|
364
|
-
## Test Infrastructure
|
|
365
|
-
|
|
366
|
-
| File / Directory | Purpose |
|
|
367
|
-
| ----------------------------------------- | ----------------------------------------------------------------------------- | --- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
368
|
-
| `test-server/README.md` | Agent testing orchestration doc |
|
|
369
|
-
| `test-server/tool-reference.md` | Complete 61-tool inventory with descriptions |
|
|
370
|
-
| `test-server/code-map.md` | This file — agent-optimized codebase navigation |
|
|
371
|
-
| `test-server/test-preflight.md` | Pre-test verification checklist |
|
|
372
|
-
| `test-server/test-tools.md` | Entry-point agent test protocol (main tool tests) |
|
|
373
|
-
| `test-server/test-tools2.md` | Additional tool test scenarios |
|
|
374
|
-
| `test-server/test-tools-codemode.md` | Code mode specific test prompts |
|
|
375
|
-
| `test-server/test-tools-codemode2.md` | Additional code mode test scenarios |
|
|
376
|
-
| `test-server/test-agent-experience.md` | Open-ended agent experience scenarios |
|
|
377
|
-
| `test-server/test-instruction-levels.mjs` | Integration test — instruction level (essential/standard/full) token ordering | \n | `test-server/test-filter-instructions.mjs` | Integration test — filter-aware instruction sections per `--tool-filter` config; reports token estimates per filter combination |
|
|
378
|
-
| `test-server/test-scheduler.mjs` | Integration test — scheduler behavior |
|
|
379
|
-
| `test-server/test-tool-annotations.mjs` | Integration test — tool annotation verification |
|
|
380
|
-
| `tests/` | Vitest unit/integration tests (13 subdirectories) |
|
|
381
|
-
| `tests/e2e/` | Playwright E2E tests — HTTP/SSE transport |
|
|
382
|
-
|
|
383
|
-
### Test Subdirectories (`tests/`)
|
|
384
|
-
|
|
385
|
-
| Directory | Coverage |
|
|
386
|
-
| ------------- | --------------------------------------------------- |
|
|
387
|
-
| `auth/` | OAuth 2.1 middleware, scopes, token validation |
|
|
388
|
-
| `codemode/` | Sandbox security, API bridge, worker lifecycle |
|
|
389
|
-
| `constants/` | Server instructions, icons |
|
|
390
|
-
| `database/` | SQLite adapter, entry CRUD, search, tags, backup |
|
|
391
|
-
| `e2e/` | Playwright end-to-end (HTTP/SSE transport parity) |
|
|
392
|
-
| `filtering/` | Tool filter parsing, group/shortcut resolution |
|
|
393
|
-
| `github/` | GitHub integration, issues, PRs, milestones, kanban |
|
|
394
|
-
| `handlers/` | Tool handlers, resource handlers, prompt handlers |
|
|
395
|
-
| `security/` | Input validation, SQL injection, path traversal |
|
|
396
|
-
| `server/` | MCP server setup, registration |
|
|
397
|
-
| `transports/` | HTTP transport, sessions, rate limiting |
|
|
398
|
-
| `utils/` | Logger, error helpers, security utils |
|
|
399
|
-
| `vector/` | Vector search manager, semantic search |
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
# Agent Experience Test — memory-journal-mcp
|
|
2
|
-
|
|
3
|
-
> **Purpose:** Validate that the server instructions (`essential`/`standard`/`full` tiers) and dynamic help resources are sufficient for an agent to operate the server cold — with **zero** tool checklists, parameter tables, or behavioral hints in the prompt.
|
|
4
|
-
|
|
5
|
-
## How to Run
|
|
6
|
-
|
|
7
|
-
Run **each pass** as a separate conversation with the corresponding `--tool-filter`. Each pass tests whether the agent can complete realistic tasks using only the tools + resources available under that filter. Instruction sections are **automatically gated** by the filter — e.g. Code Mode guidance only appears when `codemode` is enabled, GitHub patterns only when `github` is enabled.
|
|
8
|
-
|
|
9
|
-
| Pass | `--tool-filter` | Groups | Tools | Scenarios |
|
|
10
|
-
| ------ | --------------- | ---------------------- | ----- | --------- |
|
|
11
|
-
| Pass 1 | `essential` | core, codemode | 7 | 1–6 |
|
|
12
|
-
| Pass 2 | `starter` | core, search, codemode | 11 | 7–10 |
|
|
13
|
-
| Pass 3 | `full` | All 10 groups | 61 | 11–19 |
|
|
14
|
-
| Pass 4 | `codemode` | codemode only | 1 | 20–22 |
|
|
15
|
-
|
|
16
|
-
> **Important:** Do NOT combine passes. Each pass is a fresh conversation with a clean context. The agent has never used this server before.
|
|
17
|
-
|
|
18
|
-
## Rules
|
|
19
|
-
|
|
20
|
-
1. **Do NOT read** `test-tools.md`, `test-tools2.md`, `test-tools-codemode.md`, or any other test documentation before running these scenarios
|
|
21
|
-
2. **Do NOT read** test scripts (`test-filter-instructions.mjs`, `test-instruction-levels.mjs`, etc.)
|
|
22
|
-
3. **Do NOT read** source code files (`src/`) — you are a user, not a developer
|
|
23
|
-
4. **DO** use the MCP instructions you received during initialization
|
|
24
|
-
5. **DO** read `memory://briefing` as your first action (the instructions say to)
|
|
25
|
-
6. **DO** use `memory://health`, `memory://recent`, `memory://help`, and other resources for discovery
|
|
26
|
-
7. The server is already running and connected to a journal database with existing entries
|
|
27
|
-
|
|
28
|
-
## Success Criteria
|
|
29
|
-
|
|
30
|
-
| Symbol | Meaning |
|
|
31
|
-
| ------ | --------------------------------------------------------------------- |
|
|
32
|
-
| ✅ | Agent completed the task correctly without external help |
|
|
33
|
-
| ⚠️ | Agent completed but needed multiple retries or used wrong tools first |
|
|
34
|
-
| ❌ | Agent failed or produced incorrect results |
|
|
35
|
-
| 📖 | Agent read a resource — note which ones |
|
|
36
|
-
|
|
37
|
-
Track **every** resource read and whether it provided what was needed. Gaps are the actionable finding.
|
|
38
|
-
|
|
39
|
-
## Reporting Format
|
|
40
|
-
|
|
41
|
-
For each scenario, report:
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
### Scenario N: [title]
|
|
45
|
-
**Result:** ✅/⚠️/❌
|
|
46
|
-
**Resources read:** memory://briefing, memory://health (or "none beyond instructions")
|
|
47
|
-
**Tools used:** create_entry, search_entries, ...
|
|
48
|
-
**Issues:** (any gaps in instructions, confusing tool names, missing guidance)
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
> **What we're testing:** Can the agent discover `mj_execute_code` and the `mj.*` namespace from the instruction sections (which are present since `codemode` is enabled)? Does the agent discover Code Mode from the instructions and use it unprompted?
|
|
54
|
-
|
|
55
|
-
## Test Pass 1: `essential`
|
|
56
|
-
|
|
57
|
-
**Tool groups under test:** `core` (6 tools), `codemode` (1 tool) — 7 total
|
|
58
|
-
**Instruction sections present:** Core behaviors, Code Mode (namespace table)
|
|
59
|
-
**Instruction sections absent:** GitHub Integration, Copilot Review Patterns, `semantic_search` Quick Access
|
|
60
|
-
|
|
61
|
-
### Phase 1 — Session Start & Discovery
|
|
62
|
-
|
|
63
|
-
#### Scenario 1 — Cold start briefing
|
|
64
|
-
|
|
65
|
-
Start a new session. The instructions say to do something first — can the agent figure out what? Does it correctly present the briefing to the user?
|
|
66
|
-
|
|
67
|
-
> **What we're testing:** Does the agent follow the "REQUIRED: read `memory://briefing`" instruction without being told?
|
|
68
|
-
|
|
69
|
-
#### Scenario 2 — Server health check
|
|
70
|
-
|
|
71
|
-
Check if the server is healthy. What database backend is it using? How many entries exist? What tools are available?
|
|
72
|
-
|
|
73
|
-
#### Scenario 3 — Help resource discovery
|
|
74
|
-
|
|
75
|
-
Explore what tools are available using `memory://help`. Then look up a specific group's tool details via `memory://help/{group}`. Can the agent discover parameter signatures without instruction tables?
|
|
76
|
-
|
|
77
|
-
> **What we're testing:** Does the agent discover `memory://help` and use it for self-serve tool reference? Does it find `memory://help/gotchas`?
|
|
78
|
-
|
|
79
|
-
### Phase 2 — Core Entry Operations
|
|
80
|
-
|
|
81
|
-
#### Scenario 4 — Create and retrieve
|
|
82
|
-
|
|
83
|
-
Create a journal entry about "Evaluating new CI/CD pipeline options — comparing GitHub Actions vs GitLab CI". Then retrieve it by ID and verify all fields.
|
|
84
|
-
|
|
85
|
-
#### Scenario 5 — Recent context
|
|
86
|
-
|
|
87
|
-
What has the user been working on recently? Summarize the last few journal entries.
|
|
88
|
-
|
|
89
|
-
#### Scenario 6 — Code Mode quick workflow
|
|
90
|
-
|
|
91
|
-
Using `mj_execute_code`, create an entry and immediately retrieve it in a single call.
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
> **What we're testing:** Can the agent discover `create_github_issue_with_entry` and `close_github_issue_with_entry` without being told they exist? Can the agent find `get_vector_index_stats` (part of the `search` group) and interpret the results?
|
|
96
|
-
|
|
97
|
-
> **Note:** In scenario 18, the agent needs to discover `get_kanban_board` and figure out project numbers. This tests whether the instructions + `memory://help/github` are sufficient.
|
|
98
|
-
|
|
99
|
-
## Test Pass 2: `starter`
|
|
100
|
-
|
|
101
|
-
**Tool groups under test:** `core` (6 tools), `search` (4 tools), `codemode` (1 tool) — 11 total
|
|
102
|
-
**Instruction sections present:** Core behaviors, Code Mode, `semantic_search` Quick Access row
|
|
103
|
-
**Instruction sections absent:** GitHub Integration, Copilot Review Patterns
|
|
104
|
-
|
|
105
|
-
### Phase 3 — Search Operations
|
|
106
|
-
|
|
107
|
-
#### Scenario 7 — Search by text
|
|
108
|
-
|
|
109
|
-
Search for entries about "performance" or "optimization". Try both keyword search and semantic search. Which returns better results?
|
|
110
|
-
|
|
111
|
-
> **What we're testing:** Does the `semantic_search` Quick Access row in the instructions guide the agent to try semantic search alongside FTS5?
|
|
112
|
-
|
|
113
|
-
#### Scenario 8 — Date-range search
|
|
114
|
-
|
|
115
|
-
Find all entries from the last 7 days. Filter to only `bug_fix` or `feature_implementation` types if any exist.
|
|
116
|
-
|
|
117
|
-
#### Scenario 9 — Vector index awareness
|
|
118
|
-
|
|
119
|
-
Check the vector index stats. Is the index count matching the entry count?
|
|
120
|
-
|
|
121
|
-
#### Scenario 10 — Combined search + Code Mode
|
|
122
|
-
|
|
123
|
-
Using a single `mj_execute_code` call: search for entries, then summarize findings as a new entry. Compare the experience to doing it with individual tools.
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
> **What we're testing:** Can the agent discover the 20 team tools and compose a cross-tool workflow? Does `memory://help/team` provide enough parameter guidance?
|
|
128
|
-
|
|
129
|
-
## Test Pass 3: `full`
|
|
130
|
-
|
|
131
|
-
**Tool groups under test:** All 10 groups — 61 tools total
|
|
132
|
-
**Instruction sections present:** All sections (Core, Code Mode, GitHub Integration, Copilot Review Patterns, `semantic_search` Quick Access, Help Pointers)
|
|
133
|
-
|
|
134
|
-
### Phase 4 — Relationships & Analytics
|
|
135
|
-
|
|
136
|
-
#### Scenario 11 — Link entries
|
|
137
|
-
|
|
138
|
-
Create two related entries: a decision entry ("Decided to use PostgreSQL for the new service") and an implementation entry ("Implemented PostgreSQL connection pooling"). Link them with the appropriate relationship type.
|
|
139
|
-
|
|
140
|
-
#### Scenario 12 — Analyze patterns
|
|
141
|
-
|
|
142
|
-
Get journal statistics. What entry types are most common? What's the activity trend? What's the relationship complexity?
|
|
143
|
-
|
|
144
|
-
### Phase 5 — Export, Backup & Admin
|
|
145
|
-
|
|
146
|
-
#### Scenario 13 — Export entries
|
|
147
|
-
|
|
148
|
-
Export the most recent 20 entries in JSON format. Then export again in markdown. Which format is more useful for sharing?
|
|
149
|
-
|
|
150
|
-
#### Scenario 14 — Backup lifecycle
|
|
151
|
-
|
|
152
|
-
Create a backup of the journal. List existing backups. How would you restore one? (Don't actually restore unless the agent confirms it understands the consequences.)
|
|
153
|
-
|
|
154
|
-
#### Scenario 15 — Tag management & cleanup
|
|
155
|
-
|
|
156
|
-
List all tags in use. Are there any that look like duplicates or inconsistencies (e.g., `bug` vs `bug-fix`)? If so, how would you consolidate them? Find and soft-delete any test entries created during this session.
|
|
157
|
-
|
|
158
|
-
### Phase 6 — GitHub Integration
|
|
159
|
-
|
|
160
|
-
#### Scenario 16 — Repository context
|
|
161
|
-
|
|
162
|
-
Get the GitHub context. What repo is connected? How many open issues and PRs are there? What's the CI status?
|
|
163
|
-
|
|
164
|
-
#### Scenario 17 — Issue lifecycle
|
|
165
|
-
|
|
166
|
-
Create a GitHub issue titled "Improve error handling in webhook processor" with labels `bug` and `priority:high`. Create a linked journal entry documenting the decision. Then close the issue with a resolution note.
|
|
167
|
-
|
|
168
|
-
#### Scenario 18 — Kanban board
|
|
169
|
-
|
|
170
|
-
Find the user's GitHub project boards. Display the Kanban board and describe the workflow state.
|
|
171
|
-
|
|
172
|
-
### Phase 7 — Team & Cross-Feature Workflows
|
|
173
|
-
|
|
174
|
-
#### Scenario 19 — Team knowledge sharing
|
|
175
|
-
|
|
176
|
-
Create a team entry about a design decision. Search the team database for related entries. Check team statistics to see the contributor breakdown. Export this week's team entries as markdown.
|
|
177
|
-
|
|
178
|
-
---
|
|
179
|
-
|
|
180
|
-
## Test Pass 4: `codemode`
|
|
181
|
-
|
|
182
|
-
**Tool groups under test:** `codemode` (1 tool)
|
|
183
|
-
**Instruction sections present:** Core behaviors, Code Mode (namespace table)
|
|
184
|
-
**Instruction sections absent:** GitHub Integration, Copilot Review Patterns, `semantic_search` Quick Access
|
|
185
|
-
|
|
186
|
-
### Phase 8 — Code Mode as Sole Interface
|
|
187
|
-
|
|
188
|
-
#### Scenario 20 — Cold-start Code Mode
|
|
189
|
-
|
|
190
|
-
Using only `mj_execute_code`, discover what API groups are available (`mj.help()`). List the groups and pick one to explore.
|
|
191
|
-
|
|
192
|
-
#### Scenario 21 — Multi-step workflow
|
|
193
|
-
|
|
194
|
-
Using a single `mj_execute_code` call: search for entries about "deployment", get statistics, and create a summary entry linking findings. Compare token efficiency vs individual tool calls.
|
|
195
|
-
|
|
196
|
-
#### Scenario 22 — Read-only mode
|
|
197
|
-
|
|
198
|
-
Execute code with `readonly: true`. Verify that write operations fail gracefully. What error message does the agent get?
|
|
199
|
-
|
|
200
|
-
---
|
|
201
|
-
|
|
202
|
-
## Post-Test Summary
|
|
203
|
-
|
|
204
|
-
Compile findings across all passes into:
|
|
205
|
-
|
|
206
|
-
1. **Instruction gaps** — scenarios where the instructions were missing, incomplete, or misleading
|
|
207
|
-
2. **Help resource sufficiency** — did `memory://help/{group}` provide enough parameter detail to replace the old instruction tables?
|
|
208
|
-
3. **Filter gating accuracy** — did the absent instruction sections (e.g. no GitHub in Pass 1–2) cause confusion, or was the agent unaware of those tools (correctly)?
|
|
209
|
-
4. **Discovery friction** — cases where the agent struggled to find the right tool or resource
|
|
210
|
-
5. **Resource sufficiency** — were `memory://briefing`, `memory://health`, `memory://help`, etc. enough context?
|
|
211
|
-
6. **Suggested improvements** — specific additions to instruction tiers or resource content
|
|
212
|
-
|
|
213
|
-
> **Key metric:** How many of the 22 scenarios did the agent complete on the first try with ≤1 resource read? This measures whether the tiered instructions + dynamic help resources are self-sufficient.
|