dsh-plugin-imem 0.0.0-stage → 0.1.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/README.md CHANGED
@@ -1,3 +1,93 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # iMem for DeepSeek Harness
2
+
3
+ This bundle installs the canonical iMem Agent Skill and connects DeepSeek
4
+ Harness to the authenticated remote MCP service at `https://imem.xin/mcp`.
5
+
6
+ ## Requirements
7
+
8
+ - DeepSeek Harness `>=0.2.1-rc.1 <0.3.0`
9
+ - An iMem account and a dedicated Personal API Key
10
+ - Network access to `https://imem.xin/mcp`
11
+
12
+ The package contains configuration and Skill files only. It does not ship an
13
+ iMem API Key or run an install script.
14
+
15
+ ## Install
16
+
17
+ Create a Personal API Key at <https://imem.xin/app/api-keys>.
18
+
19
+ ### DeepSeek Harness Desktop
20
+
21
+ 1. Open **Plugins** and choose **Add plugin**.
22
+ 2. Enter `dsh-plugin-imem` and choose **Install**.
23
+ 3. Add this line to `%USERPROFILE%\.dsh\.env` on Windows or `~/.dsh/.env` on
24
+ macOS and Linux:
25
+
26
+ ```dotenv
27
+ IMEM_API_KEY=your-api-key
28
+ ```
29
+
30
+ 4. Completely restart DeepSeek Harness, then start a new session.
31
+
32
+ The package name works in the Desktop installer after the package has been
33
+ published to npm. During local development, the same dialog also accepts the
34
+ absolute path to this `plugins/imem-dsh` directory.
35
+
36
+ ### CLI / Web profile
37
+
38
+ Make the key available to the process that starts DeepSeek Harness, then install
39
+ the bundle into the profile you use:
40
+
41
+ ```powershell
42
+ $env:IMEM_API_KEY = "your-api-key"
43
+ dsh plugin --profile web add dsh-plugin-imem
44
+ dsh web
45
+ ```
46
+
47
+ On macOS or Linux:
48
+
49
+ ```bash
50
+ export IMEM_API_KEY="your-api-key"
51
+ dsh plugin --profile web add dsh-plugin-imem
52
+ dsh web
53
+ ```
54
+
55
+ The secret is resolved through the DeepSeek Harness credential provider. It is
56
+ not stored in this package or expanded into the raw plugin configuration. Keep
57
+ the `.env` file private and never commit it.
58
+
59
+ ## What the bundle adds
60
+
61
+ - The canonical `imem-skill` instructions and references
62
+ - One authenticated Streamable HTTP MCP server named `imem`
63
+ - Durable memory, Artifact, schedule, and reminder workflows backed by iMem
64
+
65
+ ## Verify
66
+
67
+ Start a new Session and ask it to use the `imem-skill`. The MCP tools should be
68
+ available under names beginning with `mcp__imem__`.
69
+
70
+ Do not install a second MCP entry named `imem`; DeepSeek Harness rejects
71
+ duplicate server names in the same scope.
72
+
73
+ ## Upgrade and uninstall
74
+
75
+ In Desktop, manage the installed package from the **Plugins** page. For the Web
76
+ profile, use:
77
+
78
+ ```bash
79
+ dsh plugin --profile web update dsh-plugin-imem
80
+ dsh plugin --profile web remove dsh-plugin-imem
81
+ ```
82
+
83
+ Revoke the integration's API Key in the iMem Web App after uninstalling if the
84
+ key is no longer needed.
85
+
86
+ ## Source and support
87
+
88
+ - Source: <https://github.com/hxliu4mcgill/iMem-skill/tree/main/plugins/imem-dsh>
89
+ - Issues: <https://github.com/hxliu4mcgill/iMem-skill/issues>
90
+ - iMem documentation: <https://docs.imem.xin/>
91
+
92
+ This package is an independent, unofficial integration and is not affiliated
93
+ with or endorsed by DeepSeek AI.
@@ -0,0 +1,19 @@
1
+ - insert:
2
+ - id: imem-mcp
3
+ name: '@deepseek-ai/dsh-mcp-client'
4
+ inject: ['credentials']
5
+ config:
6
+ serverName: imem
7
+ transport: streamable-http
8
+ url: https://imem.xin/mcp
9
+ headers:
10
+ Authorization: 'Bearer ${credential:IMEM_API_KEY}'
11
+ expandTemplates: true
12
+ startupTimeoutMs: 30000
13
+ - id: imem-skill-filesystem
14
+ name: '@deepseek-ai/dsh-skill-filesystem'
15
+ config:
16
+ providerName: imem-plugin
17
+ includeDefaultRoots: false
18
+ watch: false
19
+ bundledSkillDir: !!js process.getBuiltinModule('node:path').join(process.getBuiltinModule('node:path').dirname(process.getBuiltinModule('node:module').createRequire(baseUrl).resolve('dsh-plugin-imem/package.json')), 'skills')
package/package.json CHANGED
@@ -1,6 +1,45 @@
1
- {
2
- "name": "dsh-plugin-imem",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "dsh-plugin-imem",
3
+ "version": "0.1.0",
4
+ "description": "iMem durable memory, schedules, and reminders for DeepSeek Harness.",
5
+ "author": "iMem",
6
+ "keywords": [
7
+ "deepseek",
8
+ "deepseek-harness",
9
+ "dsh",
10
+ "dsh-plugin",
11
+ "agent-skill",
12
+ "mcp",
13
+ "durable-memory",
14
+ "memory",
15
+ "schedule",
16
+ "reminders"
17
+ ],
18
+ "homepage": "https://imem.xin",
19
+ "bugs": {
20
+ "url": "https://github.com/hxliu4mcgill/iMem-skill/issues"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/hxliu4mcgill/iMem-skill.git",
25
+ "directory": "plugins/imem-dsh"
26
+ },
27
+ "license": "MIT",
28
+ "files": [
29
+ "cordis.patch.yml",
30
+ "README.md",
31
+ "skills"
32
+ ],
33
+ "engines": {
34
+ "node": "^22.19.0 || >=24.0.0",
35
+ "dsh": ">=0.2.1-rc.1 <0.3.0"
36
+ },
37
+ "dsh": {
38
+ "bundle": {
39
+ "patch": "./cordis.patch.yml"
40
+ }
41
+ },
42
+ "publishConfig": {
43
+ "access": "public"
44
+ }
45
+ }
@@ -0,0 +1,213 @@
1
+ ---
2
+ name: imem-skill
3
+ description: Use the authenticated iMem remote MCP service to create, find, update, and delete durable note or schedule Entries; manage nested Schedule reminder rules and occurrences; and upload text, Markdown, or HTML deliverables as private Artifacts. Trigger for requests to remember, recall, schedule, remind, update, cancel, delete, save a durable deliverable, or publish an Agent-generated artifact to iMem.
4
+ ---
5
+
6
+ # iMem Skill
7
+
8
+ ## Purpose
9
+
10
+ Use iMem as a durable workspace system. Treat every independently manageable
11
+ note or schedule as one `Entry` with one `entry_id`:
12
+
13
+ ```text
14
+ Entry(kind=note) -> durable note or memory
15
+ Entry(kind=schedule) -> common content + schedule_details + reminder_rules
16
+ Artifact -> private generated text, Markdown, or HTML deliverable
17
+ ```
18
+
19
+ Do not make the Agent coordinate legacy Memory, Schedule, and Reminder IDs.
20
+ Read the detailed contracts only when needed:
21
+
22
+ ```text
23
+ references/agent-contract.md
24
+ references/mcp-tool-spec.md
25
+ references/product-language.md
26
+ ```
27
+
28
+ ## Route User Intent
29
+
30
+ ```text
31
+ save a fact, note, reference, decision, preference, or context
32
+ -> imem_create_entry(kind=note)
33
+
34
+ make an explicit time arrangement
35
+ -> imem_create_entry(kind=schedule, schedule_details=...)
36
+
37
+ create a new timed reminder
38
+ -> imem_create_entry(kind=schedule, schedule_details=..., reminder_rules=[...])
39
+
40
+ add another reminder to an existing Schedule Entry
41
+ -> imem_create_entry_reminder_rule(entry_id=...)
42
+
43
+ save a generated text, Markdown, or HTML deliverable
44
+ -> imem_upload_artifact
45
+ ```
46
+
47
+ A date alone does not make content a Schedule:
48
+
49
+ ```text
50
+ "We decided this on June 12." -> note Entry
51
+ "Schedule this for June 12." -> schedule Entry
52
+ "Remind me on June 12." -> schedule Entry with a reminder rule
53
+ ```
54
+
55
+ Ask for clarification only when note and time-based behavior are materially
56
+ different plausible outcomes. For image or screenshot input, understand the
57
+ content first and ask for essential missing fields before writing.
58
+
59
+ ## Resolve Relative Time
60
+
61
+ Before converting relative time such as "today", "tomorrow", "this Thursday",
62
+ "next Monday", or "in two hours":
63
+
64
+ ```text
65
+ 1. Call imem_get_time_context.
66
+ 2. Use data.server_time and data.workspace_timezone as the baseline.
67
+ 3. Stop if the tool is unavailable; do not substitute local or stale time.
68
+ ```
69
+
70
+ Fetch a fresh baseline for every operation involving relative time. Resolve a
71
+ weekday in this order:
72
+
73
+ ```text
74
+ today is that weekday -> today
75
+ this week's weekday is ahead -> this week
76
+ this week's weekday has passed -> next week
77
+ explicit "next <weekday>" -> next week
78
+ ```
79
+
80
+ ## Use The Remote MCP Surface
81
+
82
+ Use only the authenticated remote MCP tools supplied by the Agent host. Do not
83
+ use HTTP, local adapters, service files, SQLite, JSONL, or implementation
84
+ modules as runtime fallbacks.
85
+
86
+ Prefer these canonical tools:
87
+
88
+ ```text
89
+ imem_health
90
+ imem_get_time_context
91
+ imem_create_entry
92
+ imem_list_entries
93
+ imem_get_entry
94
+ imem_update_entry
95
+ imem_delete_entry
96
+ imem_list_entry_occurrences
97
+ imem_create_entry_reminder_rule
98
+ imem_update_entry_reminder_rule
99
+ imem_delete_entry_reminder_rule
100
+ imem_upload_artifact
101
+ ```
102
+
103
+ The following tools are migration aliases only. Do not use them for new
104
+ workflows:
105
+
106
+ ```text
107
+ imem_search
108
+ imem_create_memory
109
+ imem_create_schedule
110
+ imem_create_reminder
111
+ imem_cancel_entry
112
+ ```
113
+
114
+ `imem_update_entry` temporarily accepts either canonical `entry_id` or the
115
+ legacy `entity_type + entity_id` pair. Always use `entry_id`.
116
+
117
+ If tools are not visible, use tool discovery for `imem_health`,
118
+ `imem_create_entry`, or another canonical `imem_*` tool. If discovery still
119
+ cannot expose the needed capability, ask the user or operator to reconnect the
120
+ iMem remote MCP server.
121
+
122
+ ## Follow Core Rules
123
+
124
+ 1. Run `imem_health` before user-visible work when practical.
125
+ 2. Let authentication determine the workspace; never pass `workspace_id`.
126
+ 3. Include `request_id` on mutations.
127
+ 4. Include `idempotency_key` on Entry, Reminder Rule, and Artifact creates.
128
+ 5. List Entries to select a target when `entry_id` is unknown. Before every
129
+ Entry update, get that Entry and capture its latest top-level `revision`,
130
+ even when `entry_id` is already confirmed.
131
+ 6. Before every Reminder Rule update, get the owning Schedule Entry, select the
132
+ rule, and capture that rule's latest `revision`.
133
+ 7. Pass the captured value as `expected_revision` to canonical Entry and
134
+ Reminder Rule update tools.
135
+ 8. Ask the user to choose when multiple Entries plausibly match.
136
+ 9. Never guess `entry_id`, `rule_id`, or a revision.
137
+ 10. Keep `kind` immutable. Put schedule changes under `schedule_details`.
138
+ 11. Manage reminders only through a Schedule Entry's nested reminder-rule tools.
139
+ 12. Preserve MCP error codes and never present a failed write as successful.
140
+ 13. Keep Artifact uploads private. Only the user can enable a Public Link.
141
+
142
+ ## Use Minimal Workflows
143
+
144
+ ```text
145
+ create note
146
+ health -> imem_create_entry(kind=note)
147
+
148
+ create schedule or reminder
149
+ health -> time context if relative -> imem_create_entry(kind=schedule)
150
+
151
+ find content
152
+ health -> imem_list_entries -> imem_get_entry when details are needed
153
+
154
+ update Entry
155
+ health -> list if ID unknown -> get Entry -> capture Entry revision
156
+ -> imem_update_entry(entry_id=..., expected_revision=revision)
157
+
158
+ delete or cancel
159
+ health -> list/get unless ID confirmed -> imem_delete_entry(entry_id=...)
160
+
161
+ calendar or Today range
162
+ health -> time context if relative -> imem_list_entry_occurrences
163
+
164
+ add or delete a reminder rule
165
+ health -> get Schedule Entry -> nested create/delete reminder-rule tool
166
+
167
+ update a reminder rule
168
+ health -> get Schedule Entry -> select rule -> capture rule revision
169
+ -> imem_update_entry_reminder_rule(expected_revision=revision)
170
+
171
+ upload a deliverable
172
+ health -> imem_upload_artifact
173
+ ```
174
+
175
+ Use `text/plain`, `text/markdown`, or `text/html` for Artifacts. Return the
176
+ owner URL and state that the Artifact remains private until the user enables
177
+ its Public Link.
178
+
179
+ ## Handle Errors
180
+
181
+ Follow `references/agent-contract.md`. Minimum behavior:
182
+
183
+ ```text
184
+ UNAUTHORIZED -> ask the user/operator to check the API key
185
+ FORBIDDEN -> report the missing scope
186
+ ENTRY_NOT_FOUND -> list again or ask the user to identify the target
187
+ VALIDATION_FAILED -> fix clear fields or ask for missing information
188
+ INVALID_ENTRY_KIND -> use note or schedule
189
+ IDEMPOTENCY_CONFLICT -> do not retry that key; confirm intent
190
+ REVISION_CONFLICT -> re-read, explain the concurrent change, and ask
191
+ whether to retry with the latest revision or merge
192
+ MCP_TOOL_ERROR -> treat the outcome as failed or uncertain
193
+ ```
194
+
195
+ Never automatically retry `REVISION_CONFLICT` and never omit
196
+ `expected_revision` to force an overwrite. Re-read the Entry, show the user
197
+ what changed, and wait for an explicit retry or merge decision.
198
+
199
+ ## Respect Boundaries
200
+
201
+ Do not edit or generate these directly during normal Agent workflows:
202
+
203
+ ```text
204
+ data/
205
+ *.db
206
+ *.jsonl
207
+ scripts/*.py
208
+ memory_service.operations
209
+ ```
210
+
211
+ Do not treat exports, operation logs, API-key administration, scheduler scans,
212
+ delivery logs, or delivery channels as Agent-callable unless the remote MCP
213
+ explicitly exposes and documents them.
@@ -0,0 +1,12 @@
1
+ interface:
2
+ display_name: "iMem"
3
+ short_description: "Manage durable Entries, schedules, reminders, and Artifacts"
4
+ default_prompt: "Use $imem-skill to create, find, or manage a durable note or schedule Entry."
5
+
6
+ dependencies:
7
+ tools:
8
+ - type: "mcp"
9
+ value: "imem"
10
+ description: "Authenticated iMem Entry, occurrence, reminder-rule, and Artifact tools"
11
+ transport: "streamable_http"
12
+ url: "https://imem.xin/mcp"
@@ -0,0 +1,171 @@
1
+ # iMem Agent Contract
2
+
3
+ Use this contract with the authenticated production MCP at
4
+ `https://imem.xin/mcp`. Read `mcp-tool-spec.md` for exact parameters and
5
+ `product-language.md` for terminology.
6
+
7
+ ## Domain Contract
8
+
9
+ Every independently manageable note or schedule is one Entry with one stable
10
+ `entry_id`:
11
+
12
+ ```text
13
+ Entry(kind=note) -> schedule_details=null, reminder_rules=[]
14
+ Entry(kind=schedule) -> schedule_details object, reminder_rules array
15
+ ```
16
+
17
+ ScheduleDetails belong one-to-one to a Schedule Entry. Reminder Rules belong
18
+ zero-to-many to a Schedule Entry and are not top-level Entries. Occurrences use
19
+ `entry_id` and `occurrence_id`; they do not require legacy Memory or Schedule
20
+ IDs. Artifact remains a separate private deliverable resource.
21
+
22
+ ## Authentication And Workspace
23
+
24
+ Use Personal API Key bearer authentication over Streamable HTTP. Let the
25
+ service derive `user_id`, `workspace_id`, client identity, and scopes from the
26
+ key. Never pass `workspace_id` in normal Agent calls. OAuth remains pending.
27
+
28
+ Do not use service internals during normal work:
29
+
30
+ ```text
31
+ data/
32
+ *.db
33
+ *.jsonl
34
+ scripts/*.py
35
+ memory_service.operations
36
+ ```
37
+
38
+ ## Required Behavior
39
+
40
+ 1. Run `imem_health` before user-visible work when practical.
41
+ 2. Call `imem_get_time_context` before resolving relative dates and use a fresh
42
+ `server_time` and `workspace_timezone` for each operation.
43
+ 3. Include `request_id` on mutations.
44
+ 4. Include `idempotency_key` on Entry, Reminder Rule, and Artifact creates.
45
+ 5. List Entries to select a target when `entry_id` is unknown. Before every
46
+ Entry update, read that Entry and capture its top-level `revision`, even if
47
+ the ID is already confirmed.
48
+ 6. Before every Reminder Rule update, read the owning Schedule Entry and
49
+ capture the selected rule's `revision`.
50
+ 7. Send the captured revision as `expected_revision` on canonical update calls.
51
+ 8. Ask the user to choose when multiple plausible Entries match.
52
+ 9. Never guess `entry_id`, `rule_id`, or a revision.
53
+ 10. Keep Entry `kind` immutable and nest Schedule changes under
54
+ `schedule_details`.
55
+ 11. Preserve service error codes and never report a failed write as successful.
56
+
57
+ ## Intent Routing
58
+
59
+ ```text
60
+ fact, note, reference, decision, preference, or context
61
+ -> imem_create_entry(kind=note)
62
+
63
+ explicit time arrangement
64
+ -> imem_create_entry(kind=schedule, schedule_details=...)
65
+
66
+ new timed reminder
67
+ -> imem_create_entry(kind=schedule, reminder_rules=[...])
68
+
69
+ additional reminder for an existing Schedule Entry
70
+ -> imem_create_entry_reminder_rule(entry_id=...)
71
+
72
+ generated text, Markdown, or HTML deliverable
73
+ -> imem_upload_artifact
74
+ ```
75
+
76
+ Do not route solely from extracted dates. Descriptive or historical dates stay
77
+ in a note unless the user asks for time-based behavior.
78
+
79
+ ## Scope Matrix
80
+
81
+ | Capability | MCP tool | Scope |
82
+ |---|---|---|
83
+ | Health | `imem_health` | `entries:read` |
84
+ | Time baseline | `imem_get_time_context` | `entries:read` |
85
+ | Create Entry | `imem_create_entry` | `entries:write` |
86
+ | List Entries | `imem_list_entries` | `entries:read` |
87
+ | Get Entry | `imem_get_entry` | `entries:read` |
88
+ | Update Entry | `imem_update_entry` | `entries:write` |
89
+ | Delete/cancel Entry | `imem_delete_entry` | `entries:write` |
90
+ | List occurrences | `imem_list_entry_occurrences` | `entries:read` |
91
+ | Create Reminder Rule | `imem_create_entry_reminder_rule` | `entries:write` |
92
+ | Update Reminder Rule | `imem_update_entry_reminder_rule` | `entries:write` |
93
+ | Delete Reminder Rule | `imem_delete_entry_reminder_rule` | `entries:write` |
94
+ | Upload private Artifact | `imem_upload_artifact` | `entries:write` |
95
+
96
+ Exports, operation logs, API-key administration, scheduler scans, and delivery
97
+ operations remain outside the public MCP surface.
98
+
99
+ ## Idempotency
100
+
101
+ Use idempotency for:
102
+
103
+ ```text
104
+ imem_create_entry
105
+ imem_create_entry_reminder_rule
106
+ imem_upload_artifact
107
+ ```
108
+
109
+ Reuse the same key only to retry the identical intended create. A different
110
+ body with the same key returns `IDEMPOTENCY_CONFLICT`. After an uncertain
111
+ update or delete, read current state before retrying.
112
+
113
+ ## Update And Delete
114
+
115
+ Use `imem_update_entry(entry_id=..., expected_revision=...)` with common
116
+ fields at the top level and Schedule fields inside `patch.schedule_details`.
117
+ Never patch `id`, `kind`, or `revision`. Read the latest Entry immediately
118
+ before the update and copy its top-level `revision` into `expected_revision`.
119
+
120
+ Use `imem_delete_entry` for soft deletion. A note becomes deleted. A Schedule
121
+ Entry becomes canceled/deleted together with its active Reminder Rules
122
+ according to service policy. Do not physically delete storage rows or files.
123
+
124
+ Manage Reminder Rules through the nested create, update, and delete tools. A
125
+ Reminder Rule mutation requires both the owning Schedule `entry_id` and the
126
+ rule's `rule_id` where applicable. Before `imem_update_entry_reminder_rule`,
127
+ read the Schedule Entry, select the nested rule, and send that rule's `revision`
128
+ as `expected_revision`.
129
+
130
+ The service keeps `expected_revision` optional for older clients, but canonical
131
+ Skill update paths must always send it. On `REVISION_CONFLICT`, re-read the
132
+ Entry and explain that another client changed it. Never silently retry without
133
+ user review, omit `expected_revision`, or force an overwrite. Retry with the
134
+ new revision only after the user chooses to apply or merge the intended change.
135
+
136
+ ## Artifact Upload
137
+
138
+ Use `imem_upload_artifact` for complete text, Markdown, or HTML deliverables.
139
+ Every upload starts private. Do not claim it is public or try to enable a
140
+ Public Link; only the user can do that in the authenticated iMem App.
141
+
142
+ ## Compatibility
143
+
144
+ The following tools remain temporary migration aliases:
145
+
146
+ ```text
147
+ imem_search
148
+ imem_create_memory
149
+ imem_create_schedule
150
+ imem_create_reminder
151
+ imem_cancel_entry
152
+ ```
153
+
154
+ `imem_update_entry` also accepts the legacy `entity_type + entity_id` form.
155
+ New Agent workflows must use canonical tools and `entry_id` only. Do not remove
156
+ or recommend legacy aliases until a separate deprecation contract authorizes
157
+ it.
158
+
159
+ ## Failure Handling
160
+
161
+ | Error code | Required Agent behavior |
162
+ |---|---|
163
+ | `UNAUTHORIZED` | Ask the user/operator to check API key configuration. |
164
+ | `FORBIDDEN` | Report the missing scope. |
165
+ | `ENTRY_NOT_FOUND` | List again or ask the user to identify the target. |
166
+ | `VALIDATION_FAILED` | Fix clear fields or ask for missing information. |
167
+ | `INVALID_ENTRY_KIND` | Use `note` or `schedule`. |
168
+ | `IDEMPOTENCY_CONFLICT` | Do not retry the same key; confirm intent. |
169
+ | `REVISION_CONFLICT` | Re-read current state, explain the concurrent change, and ask whether to retry or merge. Never force overwrite. |
170
+ | `CONFIGURATION_ERROR` | Check the MCP URL and host configuration. |
171
+ | `MCP_TOOL_ERROR` | Treat the outcome as failed or uncertain. |
@@ -0,0 +1,326 @@
1
+ # iMem Remote MCP Tool Specification
2
+
3
+ This is the public Agent contract for production iMem remote MCP contract
4
+ `2026-11-02`.
5
+
6
+ ## Production Connection
7
+
8
+ ```text
9
+ MCP URL: https://imem.xin/mcp
10
+ Transport: Streamable HTTP
11
+ Authentication: Authorization: Bearer <personal-api-key>
12
+ OAuth: pending
13
+ ```
14
+
15
+ Create a Personal API Key at `https://imem.xin/app/api-keys`. The service
16
+ derives user and workspace identity from that key. Never pass `workspace_id` in
17
+ normal Agent requests.
18
+
19
+ ## Canonical Resource Shape
20
+
21
+ ```json
22
+ {
23
+ "id": "MEM-20261101-001",
24
+ "revision": 1,
25
+ "kind": "schedule",
26
+ "title": "Product review",
27
+ "content": "Review the launch scope",
28
+ "category": "Work",
29
+ "owner": "agent",
30
+ "members": [],
31
+ "tags": [],
32
+ "visibility": "private",
33
+ "source": {"type": "agent"},
34
+ "status": "pending",
35
+ "created_at": "2026-11-01T09:00:00",
36
+ "updated_at": null,
37
+ "deleted_at": null,
38
+ "schedule_details": {
39
+ "start_time": "2026-11-05T10:00:00+08:00",
40
+ "end_time": "2026-11-05T11:00:00+08:00",
41
+ "location": "",
42
+ "participants": [],
43
+ "notes": "",
44
+ "recurrence": null,
45
+ "timezone": "Asia/Shanghai",
46
+ "next_occurrence_at": "2026-11-05T02:00:00Z"
47
+ },
48
+ "reminder_rules": []
49
+ }
50
+ ```
51
+
52
+ `schedule_details` is `null` and `reminder_rules` is empty for a note Entry.
53
+ Every Entry has a top-level integer `revision`. Every nested Reminder Rule also
54
+ has its own integer `revision`. Reminder Rules are nested under Schedule Entries.
55
+ Occurrences expose `entry_id` and `occurrence_id`, never legacy identity as the
56
+ canonical key.
57
+
58
+ ## Canonical Production Tools
59
+
60
+ | Tool | Scope | Purpose |
61
+ |---|---|---|
62
+ | `imem_health` | `entries:read` | Verify authenticated service access and contract version |
63
+ | `imem_get_time_context` | `entries:read` | Get authoritative server and workspace time |
64
+ | `imem_create_entry` | `entries:write` | Create a note or Schedule Entry |
65
+ | `imem_list_entries` | `entries:read` | List and filter Entries |
66
+ | `imem_get_entry` | `entries:read` | Read one Entry by canonical ID |
67
+ | `imem_update_entry` | `entries:write` | Patch one Entry |
68
+ | `imem_delete_entry` | `entries:write` | Soft-delete or cancel one Entry |
69
+ | `imem_list_entry_occurrences` | `entries:read` | Read Schedule occurrences for a range |
70
+ | `imem_create_entry_reminder_rule` | `entries:write` | Add a Reminder Rule to a Schedule Entry |
71
+ | `imem_update_entry_reminder_rule` | `entries:write` | Patch a nested Reminder Rule |
72
+ | `imem_delete_entry_reminder_rule` | `entries:write` | Delete/cancel a nested Reminder Rule |
73
+ | `imem_upload_artifact` | `entries:write` | Upload a private text, Markdown, or HTML Artifact |
74
+
75
+ ## Tool Parameters
76
+
77
+ ### `imem_health`
78
+
79
+ No parameters. Verify `data.status`, `data.mcp_url`, and
80
+ `data.contract_version`.
81
+
82
+ ### `imem_get_time_context`
83
+
84
+ No parameters. Use `data.server_time` and `data.workspace_timezone` before
85
+ resolving relative dates or times.
86
+
87
+ ### `imem_create_entry`
88
+
89
+ ```text
90
+ kind: note | schedule
91
+ title: string
92
+ request_id: string
93
+ idempotency_key: string
94
+ content?: string
95
+ category?: string
96
+ owner?: string
97
+ members?: string[]
98
+ tags?: string[]
99
+ visibility?: string
100
+ source?: object
101
+ status?: string
102
+ created_at?: ISO datetime
103
+ schedule_details?: object
104
+ reminder_rules?: object[]
105
+ ```
106
+
107
+ For `kind=schedule`, set `schedule_details.start_time` and optionally:
108
+
109
+ ```text
110
+ end_time?: ISO datetime
111
+ location?: string
112
+ participants?: string[]
113
+ notes?: string
114
+ recurrence?: object
115
+ timezone?: IANA timezone
116
+ ```
117
+
118
+ For `kind=note`, omit schedule details and reminder rules. Return
119
+ `data.entry`.
120
+
121
+ ### `imem_list_entries`
122
+
123
+ ```text
124
+ kind?: note | schedule
125
+ q?: string
126
+ status?: string
127
+ scheduled_from?: ISO datetime
128
+ scheduled_to?: ISO datetime
129
+ include_deleted?: boolean
130
+ limit?: integer
131
+ offset?: integer
132
+ ```
133
+
134
+ Return `data.entries`, `data.total`, `data.limit`, and `data.offset`.
135
+
136
+ ### `imem_get_entry`
137
+
138
+ ```text
139
+ entry_id: string
140
+ ```
141
+
142
+ Return `data.entry` or `ENTRY_NOT_FOUND`.
143
+
144
+ ### `imem_update_entry`
145
+
146
+ Canonical input:
147
+
148
+ ```text
149
+ entry_id: string
150
+ patch: object
151
+ request_id: string
152
+ expected_revision?: integer
153
+ ```
154
+
155
+ Do not set `id`, `kind`, or `revision`. Nest Schedule changes under
156
+ `patch.schedule_details`. Canonical Skill callers must read `data.entry.revision`
157
+ first and pass it as `expected_revision`; the parameter is optional only for
158
+ legacy client compatibility. Return `data.entry` with its incremented revision.
159
+ A stale value returns `REVISION_CONFLICT` without applying the patch.
160
+
161
+ During migration, the tool also accepts this mutually exclusive legacy form:
162
+
163
+ ```text
164
+ entity_type: memory | schedule | reminder
165
+ entity_id: string
166
+ patch: object
167
+ request_id: string
168
+ ```
169
+
170
+ New integrations must use `entry_id`.
171
+
172
+ ### `imem_delete_entry`
173
+
174
+ ```text
175
+ entry_id: string
176
+ reason: string
177
+ request_id: string
178
+ ```
179
+
180
+ Perform a soft delete/cancel and return `data.entry`.
181
+
182
+ ### `imem_list_entry_occurrences`
183
+
184
+ ```text
185
+ start: ISO datetime
186
+ end: ISO datetime
187
+ limit?: integer
188
+ ```
189
+
190
+ Return `data.occurrences`. Each item uses canonical `entry_id` plus an
191
+ occurrence-specific `occurrence_id`.
192
+
193
+ ### `imem_create_entry_reminder_rule`
194
+
195
+ ```text
196
+ entry_id: string
197
+ request_id: string
198
+ idempotency_key: string
199
+ remind_at?: ISO datetime
200
+ offset_minutes?: integer
201
+ channel?: string
202
+ is_default?: boolean
203
+ status?: string
204
+ message?: string
205
+ title?: string
206
+ notification_endpoint_id?: string
207
+ ```
208
+
209
+ Use only with a Schedule Entry and provide a valid timing rule. Return the
210
+ updated `data.entry`.
211
+
212
+ ### `imem_update_entry_reminder_rule`
213
+
214
+ ```text
215
+ entry_id: string
216
+ rule_id: string
217
+ patch: object
218
+ request_id: string
219
+ expected_revision?: integer
220
+ ```
221
+
222
+ Canonical Skill callers must read the selected nested Reminder Rule's `revision`
223
+ and pass it as `expected_revision`; omission remains only for legacy client
224
+ compatibility. Return the updated `data.entry`, including the incremented rule
225
+ revision. A stale value returns `REVISION_CONFLICT` without applying the patch.
226
+
227
+ ### `imem_delete_entry_reminder_rule`
228
+
229
+ ```text
230
+ entry_id: string
231
+ rule_id: string
232
+ reason: string
233
+ request_id: string
234
+ ```
235
+
236
+ Return the updated `data.entry`.
237
+
238
+ ### `imem_upload_artifact`
239
+
240
+ ```text
241
+ title: string
242
+ content: string
243
+ media_type: text/plain | text/markdown | text/html
244
+ request_id: string
245
+ idempotency_key: string
246
+ ```
247
+
248
+ The Artifact is private and returns an owner URL. The tool cannot enable a
249
+ Public Link.
250
+
251
+ ## Return Envelope
252
+
253
+ Success:
254
+
255
+ ```json
256
+ {
257
+ "ok": true,
258
+ "data": {},
259
+ "error": null,
260
+ "source": "imem-remote-mcp"
261
+ }
262
+ ```
263
+
264
+ Failure:
265
+
266
+ ```json
267
+ {
268
+ "ok": false,
269
+ "data": null,
270
+ "error": {"code": "VALIDATION_FAILED", "message": "..."},
271
+ "source": "imem-remote-mcp"
272
+ }
273
+ ```
274
+
275
+ Preserve `error.code`. Never present a failed write as successful.
276
+
277
+ ## Idempotency And Recovery
278
+
279
+ `imem_create_entry`, `imem_create_entry_reminder_rule`, and
280
+ `imem_upload_artifact` require both `request_id` and `idempotency_key`. Reuse a
281
+ key only for an identical retry. Different arguments with the same key return
282
+ `IDEMPOTENCY_CONFLICT`.
283
+
284
+ After an uncertain update or delete, read current state before retrying. Ask
285
+ the user to choose when a list returns multiple plausible targets.
286
+
287
+ ## Optimistic Concurrency
288
+
289
+ Before `imem_update_entry`, get the Entry and send its top-level `revision` as
290
+ `expected_revision`. Before `imem_update_entry_reminder_rule`, get the owning
291
+ Schedule Entry, select the rule, and send that rule's `revision`. The update
292
+ returns the resource with an incremented revision.
293
+
294
+ If either update returns `REVISION_CONFLICT`, do not retry automatically and do
295
+ not omit `expected_revision` to force a write. Re-read current state, explain
296
+ that another client changed the resource, and ask the user whether to retry the
297
+ intended patch against the latest revision or merge the competing changes.
298
+
299
+ ## Migration Aliases
300
+
301
+ Production temporarily retains:
302
+
303
+ ```text
304
+ imem_search
305
+ imem_create_memory
306
+ imem_create_schedule
307
+ imem_create_reminder
308
+ imem_cancel_entry
309
+ ```
310
+
311
+ These aliases preserve older integrations. New Skill workflows must use the
312
+ canonical Entry tools. Do not remove aliases before a separately approved
313
+ deprecation and telemetry review.
314
+
315
+ ## Error Handling
316
+
317
+ | Error code | Required behavior |
318
+ |---|---|
319
+ | `UNAUTHORIZED` | Check the configured API key. |
320
+ | `FORBIDDEN` | Report the missing scope. |
321
+ | `ENTRY_NOT_FOUND` | List again or ask the user to identify the Entry. |
322
+ | `VALIDATION_FAILED` | Correct clear fields or ask for missing information. |
323
+ | `INVALID_ENTRY_KIND` | Use `note` or `schedule`. |
324
+ | `IDEMPOTENCY_CONFLICT` | Do not retry with that key; confirm intent. |
325
+ | `REVISION_CONFLICT` | Re-read current state, explain the concurrent change, and ask whether to retry or merge. Never force overwrite. |
326
+ | `MCP_TOOL_ERROR` | Treat the outcome as failed or uncertain. |
@@ -0,0 +1,65 @@
1
+ # iMem Product Language
2
+
3
+ iMem is a Workspace Memory System for individuals and teams.
4
+
5
+ ## Canonical Domain Language
6
+
7
+ Use `Entry` as the technical identity for every independently manageable item:
8
+
9
+ ```text
10
+ Entry(kind=note) durable note, fact, decision, preference, or context
11
+ Entry(kind=schedule) time-based content with schedule_details
12
+ ScheduleDetails one-to-one details nested under a Schedule Entry
13
+ ReminderRule zero-to-many policies nested under a Schedule Entry
14
+ Artifact private generated deliverable, separate from Entry
15
+ ```
16
+
17
+ Use `schedule_details` and `reminder_rules` as the canonical wire-field names
18
+ when documenting or debugging the MCP contract. Use `revision` for the current
19
+ Entry or Reminder Rule version and `expected_revision` for the version a
20
+ canonical update expects to replace.
21
+
22
+ Use one stable `entry_id` for create, list, detail, update, delete, occurrence,
23
+ and reminder-rule workflows. Do not ask an Agent to correlate `memory_id` with
24
+ `schedule_id`. An occurrence uses `entry_id` plus its own `occurrence_id`.
25
+
26
+ ## User-Facing Language
27
+
28
+ Use natural words that match the user's intent:
29
+
30
+ ```text
31
+ note or memory for a durable note Entry
32
+ schedule or event for a Schedule Entry
33
+ reminder for a Reminder Rule attached to a Schedule Entry
34
+ workspace instead of assuming family
35
+ workspace member instead of assuming family member
36
+ iMem instead of family schedule assistant
37
+ ```
38
+
39
+ The user does not need to know the internal `Entry` term unless it helps
40
+ explain IDs, API behavior, or a mixed note-and-schedule list. On
41
+ `REVISION_CONFLICT`, say that the item changed in another client after it was
42
+ read. Show the latest state and ask whether to retry or merge; do not describe
43
+ an automatic overwrite as safe.
44
+
45
+ ## Default Assumptions
46
+
47
+ Do not assume:
48
+
49
+ ```text
50
+ every workspace is a family
51
+ every note has a date
52
+ every note needs schedule details or a reminder rule
53
+ a reminder is an independently manageable top-level Entry
54
+ the Agent must maintain legacy Memory, Schedule, or Reminder IDs
55
+ ```
56
+
57
+ A family remains a valid workspace scenario, but it is not the default product
58
+ definition. Include personal, project, and team examples as well as occasional
59
+ explicit family examples.
60
+
61
+ ## Compatibility Language
62
+
63
+ Describe `imem_create_memory`, `imem_create_schedule`, `imem_create_reminder`,
64
+ `imem_search`, `imem_cancel_entry`, and typed update parameters as migration
65
+ aliases. Do not present them as the preferred workflow for new integrations.