dsh-plugin-imem 0.1.0 → 0.2.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
@@ -6,55 +6,68 @@ Harness to the authenticated remote MCP service at `https://imem.xin/mcp`.
6
6
  ## Requirements
7
7
 
8
8
  - DeepSeek Harness `>=0.2.1-rc.1 <0.3.0`
9
- - An iMem account and a dedicated Personal API Key
9
+ - An iMem account
10
10
  - Network access to `https://imem.xin/mcp`
11
11
 
12
- The package contains configuration and Skill files only. It does not ship an
13
- iMem API Key or run an install script.
12
+ The package contains an adaptive connector plus the canonical Skill files. It
13
+ selects the best authentication mode supported by the installed DSH runtime:
14
14
 
15
- ## Install
15
+ - DSH `>=0.2.3-alpha.1`: OAuth account connection with no API Key.
16
+ - DSH `0.2.1` and `0.2.2`: Personal API Key fallback through the DSH
17
+ credential named `IMEM_API_KEY`.
18
+
19
+ The package does not ship credentials or run an install script.
16
20
 
17
- Create a Personal API Key at <https://imem.xin/app/api-keys>.
21
+ ## Install
18
22
 
19
23
  ### DeepSeek Harness Desktop
20
24
 
21
25
  1. Open **Plugins** and choose **Add plugin**.
22
26
  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.
27
+ 3. Fully quit and reopen DeepSeek Harness. A newly installed or updated Bundle
28
+ joins the Desktop Profile only on its next start.
29
+ 4. Make sure the installed iMem plugin is enabled.
30
+ 5. Complete the authentication path shown by your DSH version:
31
+ - If the plugin has an account section, choose **Connect iMem** and approve
32
+ access in the browser.
33
+ - If no account section is shown, configure the `IMEM_API_KEY` credential
34
+ as described below.
35
+ 6. Fully restart DSH after adding a credential, then start a new session.
31
36
 
32
37
  The package name works in the Desktop installer after the package has been
33
38
  published to npm. During local development, the same dialog also accepts the
34
39
  absolute path to this `plugins/imem-dsh` directory.
35
40
 
36
- ### CLI / Web profile
41
+ ### Personal API Key fallback
37
42
 
38
- Make the key available to the process that starts DeepSeek Harness, then install
39
- the bundle into the profile you use:
43
+ On DSH without the account section, create a Personal API Key at
44
+ <https://imem.xin/app/api-keys> and add it to `~/.dsh/.credentials.yaml`:
40
45
 
41
- ```powershell
42
- $env:IMEM_API_KEY = "your-api-key"
43
- dsh plugin --profile web add dsh-plugin-imem
44
- dsh web
46
+ ```yaml
47
+ version: 1
48
+ refs:
49
+ IMEM_API_KEY: your-personal-api-key
50
+ records: {}
45
51
  ```
46
52
 
47
- On macOS or Linux:
53
+ If that file already exists, preserve its other `refs` and `records`; only
54
+ add `IMEM_API_KEY` under `refs`.
55
+
56
+ Alternatively, add `IMEM_API_KEY=your-personal-api-key` to `~/.dsh/.env`,
57
+ then fully quit and reopen DSH.
58
+
59
+ ### CLI / Web profile
48
60
 
49
61
  ```bash
50
- export IMEM_API_KEY="your-api-key"
51
62
  dsh plugin --profile web add dsh-plugin-imem
52
63
  dsh web
53
64
  ```
54
65
 
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.
66
+ Open **Plugins** and select iMem. When an account section is available, choose
67
+ **Connect iMem**; DSH performs OAuth Authorization Code with PKCE, stores the
68
+ grant, and refreshes it when required. When no account section is available,
69
+ configure `IMEM_API_KEY` before starting `dsh web`. The connector selects the
70
+ matching mode automatically.
58
71
 
59
72
  ## What the bundle adds
60
73
 
@@ -72,16 +85,20 @@ duplicate server names in the same scope.
72
85
 
73
86
  ## Upgrade and uninstall
74
87
 
75
- In Desktop, manage the installed package from the **Plugins** page. For the Web
76
- profile, use:
88
+ In Desktop, manage the installed package from the **Plugins** page, then fully
89
+ quit and reopen DeepSeek Harness after an update. For the Web profile, use:
77
90
 
78
91
  ```bash
79
92
  dsh plugin --profile web update dsh-plugin-imem
80
93
  dsh plugin --profile web remove dsh-plugin-imem
81
94
  ```
82
95
 
83
- Revoke the integration's API Key in the iMem Web App after uninstalling if the
84
- key is no longer needed.
96
+ Restart the Web profile after updating the Bundle.
97
+
98
+ In OAuth mode, sign out from the iMem account section before uninstalling if
99
+ you also want DSH to delete its saved grant. In API Key mode, remove
100
+ `IMEM_API_KEY` from the DSH credential store separately when it is no longer
101
+ needed.
85
102
 
86
103
  ## Source and support
87
104
 
package/cordis.patch.yml CHANGED
@@ -1,15 +1,6 @@
1
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
2
+ - id: imem-connector
3
+ name: dsh-plugin-imem
13
4
  - id: imem-skill-filesystem
14
5
  name: '@deepseek-ai/dsh-skill-filesystem'
15
6
  config:
package/index.js ADDED
@@ -0,0 +1,55 @@
1
+ /** Adaptive iMem connector for DeepSeek Harness Desktop and Web. */
2
+ export const name = 'imem-connector'
3
+ export const inject = ['mcpManager']
4
+
5
+ const SERVER_NAME = 'imem'
6
+ const CREDENTIAL_KEY = 'mcp-client/imem'
7
+ const API_KEY_REF = '${credential:IMEM_API_KEY}'
8
+ const PACKAGE_NAME = 'dsh-plugin-imem'
9
+ const text = (zh, en) => ({ zh, en })
10
+
11
+ const COPY = {
12
+ title: text('iMem 账号', 'iMem account'),
13
+ connect: text('连接 iMem', 'Connect iMem'),
14
+ activation: {
15
+ title: text('连接 iMem 账号', 'Connect your iMem account'),
16
+ body: text('iMem 插件已开启。连接账号后即可在对话中使用长期记忆、日程与提醒。', 'The iMem plugin is on. Connect your account to use durable memory, schedules, and reminders in conversations.'),
17
+ },
18
+ detail: {
19
+ disconnected: text('连接 iMem 账号后,即可在对话中使用长期记忆、日程与提醒。', 'Connect your iMem account to use durable memory, schedules, and reminders in conversations.'),
20
+ waitingBrowser: text('已打开 iMem 授权页面。完成授权后请返回这里。', 'The iMem authorization page is open. Finish authorization, then return here.'),
21
+ authorizing: text('正在完成 iMem 授权。', 'Finishing authorization with iMem.'),
22
+ connecting: text('正在连接 iMem。', 'Connecting to iMem.'),
23
+ connected: text('现在可以在对话中直接请 Agent 使用 iMem。', 'Ask the agent to use iMem directly in a conversation.'),
24
+ rejected: text('iMem 不再接受当前授权,请重新连接。', 'iMem no longer accepts the current authorization. Connect again.'),
25
+ scope: text('当前授权缺少所需权限,请重新连接并确认权限。', 'The current authorization lacks required permissions. Connect again and confirm them.'),
26
+ },
27
+ signOut: {
28
+ title: text('退出 iMem 登录?', 'Sign out of iMem?'),
29
+ body: text('这会删除 DSH 保存的 iMem 授权,之后对话将无法使用 iMem。', 'This deletes the iMem authorization saved by DSH, so conversations can no longer use iMem.'),
30
+ },
31
+ notice: {
32
+ connected: text('iMem 已连接', 'iMem connected'),
33
+ signedOut: text('已退出 iMem 登录', 'Signed out of iMem'),
34
+ },
35
+ }
36
+
37
+ export function apply(ctx) {
38
+ const oauthAvailable = typeof ctx.mcpManager.startAuthorization === 'function'
39
+ ctx.mcpManager.register(SERVER_NAME, {
40
+ transport: 'streamable-http',
41
+ url: 'https://imem.xin/mcp',
42
+ ...(oauthAvailable
43
+ ? { oauth: { credentialKey: CREDENTIAL_KEY, scope: 'entries:read entries:write' } }
44
+ : { headers: { Authorization: `Bearer ${API_KEY_REF}` } }),
45
+ startupTimeoutMs: 30_000,
46
+ })
47
+
48
+ if (!oauthAvailable) return
49
+ ctx.inject(['mcpAccounts'], (scope) => {
50
+ scope.effect(
51
+ () => scope.mcpAccounts.register({ server: SERVER_NAME, packageName: PACKAGE_NAME, copy: COPY }),
52
+ 'imem: Plugins page account',
53
+ )
54
+ })
55
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-imem",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "iMem durable memory, schedules, and reminders for DeepSeek Harness.",
5
5
  "author": "iMem",
6
6
  "keywords": [
@@ -24,8 +24,11 @@
24
24
  "url": "git+https://github.com/hxliu4mcgill/iMem-skill.git",
25
25
  "directory": "plugins/imem-dsh"
26
26
  },
27
+ "type": "module",
28
+ "main": "index.js",
27
29
  "license": "MIT",
28
30
  "files": [
31
+ "index.js",
29
32
  "cordis.patch.yml",
30
33
  "README.md",
31
34
  "skills"
@@ -1,213 +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.
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 reconnect or check authentication
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.