dsh-plugin-imem 0.0.0-stage → 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 +110 -3
- package/cordis.patch.yml +10 -0
- package/index.js +55 -0
- package/package.json +48 -6
- package/skills/imem-skill/SKILL.md +213 -0
- package/skills/imem-skill/agents/openai.yaml +12 -0
- package/skills/imem-skill/references/agent-contract.md +172 -0
- package/skills/imem-skill/references/mcp-tool-spec.md +328 -0
- package/skills/imem-skill/references/product-language.md +65 -0
package/README.md
CHANGED
|
@@ -1,3 +1,110 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
This
|
|
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
|
|
10
|
+
- Network access to `https://imem.xin/mcp`
|
|
11
|
+
|
|
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
|
+
|
|
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.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
### DeepSeek Harness Desktop
|
|
24
|
+
|
|
25
|
+
1. Open **Plugins** and choose **Add plugin**.
|
|
26
|
+
2. Enter `dsh-plugin-imem` and choose **Install**.
|
|
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.
|
|
36
|
+
|
|
37
|
+
The package name works in the Desktop installer after the package has been
|
|
38
|
+
published to npm. During local development, the same dialog also accepts the
|
|
39
|
+
absolute path to this `plugins/imem-dsh` directory.
|
|
40
|
+
|
|
41
|
+
### Personal API Key fallback
|
|
42
|
+
|
|
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`:
|
|
45
|
+
|
|
46
|
+
```yaml
|
|
47
|
+
version: 1
|
|
48
|
+
refs:
|
|
49
|
+
IMEM_API_KEY: your-personal-api-key
|
|
50
|
+
records: {}
|
|
51
|
+
```
|
|
52
|
+
|
|
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
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
dsh plugin --profile web add dsh-plugin-imem
|
|
63
|
+
dsh web
|
|
64
|
+
```
|
|
65
|
+
|
|
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.
|
|
71
|
+
|
|
72
|
+
## What the bundle adds
|
|
73
|
+
|
|
74
|
+
- The canonical `imem-skill` instructions and references
|
|
75
|
+
- One authenticated Streamable HTTP MCP server named `imem`
|
|
76
|
+
- Durable memory, Artifact, schedule, and reminder workflows backed by iMem
|
|
77
|
+
|
|
78
|
+
## Verify
|
|
79
|
+
|
|
80
|
+
Start a new Session and ask it to use the `imem-skill`. The MCP tools should be
|
|
81
|
+
available under names beginning with `mcp__imem__`.
|
|
82
|
+
|
|
83
|
+
Do not install a second MCP entry named `imem`; DeepSeek Harness rejects
|
|
84
|
+
duplicate server names in the same scope.
|
|
85
|
+
|
|
86
|
+
## Upgrade and uninstall
|
|
87
|
+
|
|
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:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
dsh plugin --profile web update dsh-plugin-imem
|
|
93
|
+
dsh plugin --profile web remove dsh-plugin-imem
|
|
94
|
+
```
|
|
95
|
+
|
|
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.
|
|
102
|
+
|
|
103
|
+
## Source and support
|
|
104
|
+
|
|
105
|
+
- Source: <https://github.com/hxliu4mcgill/iMem-skill/tree/main/plugins/imem-dsh>
|
|
106
|
+
- Issues: <https://github.com/hxliu4mcgill/iMem-skill/issues>
|
|
107
|
+
- iMem documentation: <https://docs.imem.xin/>
|
|
108
|
+
|
|
109
|
+
This package is an independent, unofficial integration and is not affiliated
|
|
110
|
+
with or endorsed by DeepSeek AI.
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
- insert:
|
|
2
|
+
- id: imem-connector
|
|
3
|
+
name: dsh-plugin-imem
|
|
4
|
+
- id: imem-skill-filesystem
|
|
5
|
+
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
6
|
+
config:
|
|
7
|
+
providerName: imem-plugin
|
|
8
|
+
includeDefaultRoots: false
|
|
9
|
+
watch: false
|
|
10
|
+
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/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,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dsh-plugin-imem",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-plugin-imem",
|
|
3
|
+
"version": "0.2.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
|
+
"type": "module",
|
|
28
|
+
"main": "index.js",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"files": [
|
|
31
|
+
"index.js",
|
|
32
|
+
"cordis.patch.yml",
|
|
33
|
+
"README.md",
|
|
34
|
+
"skills"
|
|
35
|
+
],
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": "^22.19.0 || >=24.0.0",
|
|
38
|
+
"dsh": ">=0.2.1-rc.1 <0.3.0"
|
|
39
|
+
},
|
|
40
|
+
"dsh": {
|
|
41
|
+
"bundle": {
|
|
42
|
+
"patch": "./cordis.patch.yml"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -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 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.
|
|
@@ -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,172 @@
|
|
|
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 OAuth Authorization Code with PKCE or Personal API Key bearer authentication
|
|
25
|
+
over Streamable HTTP. Let the service derive `user_id`, `workspace_id`, client
|
|
26
|
+
identity, and scopes from the credential. Never pass `workspace_id` in normal
|
|
27
|
+
Agent calls.
|
|
28
|
+
|
|
29
|
+
Do not use service internals during normal work:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
data/
|
|
33
|
+
*.db
|
|
34
|
+
*.jsonl
|
|
35
|
+
scripts/*.py
|
|
36
|
+
memory_service.operations
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Required Behavior
|
|
40
|
+
|
|
41
|
+
1. Run `imem_health` before user-visible work when practical.
|
|
42
|
+
2. Call `imem_get_time_context` before resolving relative dates and use a fresh
|
|
43
|
+
`server_time` and `workspace_timezone` for each operation.
|
|
44
|
+
3. Include `request_id` on mutations.
|
|
45
|
+
4. Include `idempotency_key` on Entry, Reminder Rule, and Artifact creates.
|
|
46
|
+
5. List Entries to select a target when `entry_id` is unknown. Before every
|
|
47
|
+
Entry update, read that Entry and capture its top-level `revision`, even if
|
|
48
|
+
the ID is already confirmed.
|
|
49
|
+
6. Before every Reminder Rule update, read the owning Schedule Entry and
|
|
50
|
+
capture the selected rule's `revision`.
|
|
51
|
+
7. Send the captured revision as `expected_revision` on canonical update calls.
|
|
52
|
+
8. Ask the user to choose when multiple plausible Entries match.
|
|
53
|
+
9. Never guess `entry_id`, `rule_id`, or a revision.
|
|
54
|
+
10. Keep Entry `kind` immutable and nest Schedule changes under
|
|
55
|
+
`schedule_details`.
|
|
56
|
+
11. Preserve service error codes and never report a failed write as successful.
|
|
57
|
+
|
|
58
|
+
## Intent Routing
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
fact, note, reference, decision, preference, or context
|
|
62
|
+
-> imem_create_entry(kind=note)
|
|
63
|
+
|
|
64
|
+
explicit time arrangement
|
|
65
|
+
-> imem_create_entry(kind=schedule, schedule_details=...)
|
|
66
|
+
|
|
67
|
+
new timed reminder
|
|
68
|
+
-> imem_create_entry(kind=schedule, reminder_rules=[...])
|
|
69
|
+
|
|
70
|
+
additional reminder for an existing Schedule Entry
|
|
71
|
+
-> imem_create_entry_reminder_rule(entry_id=...)
|
|
72
|
+
|
|
73
|
+
generated text, Markdown, or HTML deliverable
|
|
74
|
+
-> imem_upload_artifact
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Do not route solely from extracted dates. Descriptive or historical dates stay
|
|
78
|
+
in a note unless the user asks for time-based behavior.
|
|
79
|
+
|
|
80
|
+
## Scope Matrix
|
|
81
|
+
|
|
82
|
+
| Capability | MCP tool | Scope |
|
|
83
|
+
|---|---|---|
|
|
84
|
+
| Health | `imem_health` | `entries:read` |
|
|
85
|
+
| Time baseline | `imem_get_time_context` | `entries:read` |
|
|
86
|
+
| Create Entry | `imem_create_entry` | `entries:write` |
|
|
87
|
+
| List Entries | `imem_list_entries` | `entries:read` |
|
|
88
|
+
| Get Entry | `imem_get_entry` | `entries:read` |
|
|
89
|
+
| Update Entry | `imem_update_entry` | `entries:write` |
|
|
90
|
+
| Delete/cancel Entry | `imem_delete_entry` | `entries:write` |
|
|
91
|
+
| List occurrences | `imem_list_entry_occurrences` | `entries:read` |
|
|
92
|
+
| Create Reminder Rule | `imem_create_entry_reminder_rule` | `entries:write` |
|
|
93
|
+
| Update Reminder Rule | `imem_update_entry_reminder_rule` | `entries:write` |
|
|
94
|
+
| Delete Reminder Rule | `imem_delete_entry_reminder_rule` | `entries:write` |
|
|
95
|
+
| Upload private Artifact | `imem_upload_artifact` | `entries:write` |
|
|
96
|
+
|
|
97
|
+
Exports, operation logs, API-key administration, scheduler scans, and delivery
|
|
98
|
+
operations remain outside the public MCP surface.
|
|
99
|
+
|
|
100
|
+
## Idempotency
|
|
101
|
+
|
|
102
|
+
Use idempotency for:
|
|
103
|
+
|
|
104
|
+
```text
|
|
105
|
+
imem_create_entry
|
|
106
|
+
imem_create_entry_reminder_rule
|
|
107
|
+
imem_upload_artifact
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Reuse the same key only to retry the identical intended create. A different
|
|
111
|
+
body with the same key returns `IDEMPOTENCY_CONFLICT`. After an uncertain
|
|
112
|
+
update or delete, read current state before retrying.
|
|
113
|
+
|
|
114
|
+
## Update And Delete
|
|
115
|
+
|
|
116
|
+
Use `imem_update_entry(entry_id=..., expected_revision=...)` with common
|
|
117
|
+
fields at the top level and Schedule fields inside `patch.schedule_details`.
|
|
118
|
+
Never patch `id`, `kind`, or `revision`. Read the latest Entry immediately
|
|
119
|
+
before the update and copy its top-level `revision` into `expected_revision`.
|
|
120
|
+
|
|
121
|
+
Use `imem_delete_entry` for soft deletion. A note becomes deleted. A Schedule
|
|
122
|
+
Entry becomes canceled/deleted together with its active Reminder Rules
|
|
123
|
+
according to service policy. Do not physically delete storage rows or files.
|
|
124
|
+
|
|
125
|
+
Manage Reminder Rules through the nested create, update, and delete tools. A
|
|
126
|
+
Reminder Rule mutation requires both the owning Schedule `entry_id` and the
|
|
127
|
+
rule's `rule_id` where applicable. Before `imem_update_entry_reminder_rule`,
|
|
128
|
+
read the Schedule Entry, select the nested rule, and send that rule's `revision`
|
|
129
|
+
as `expected_revision`.
|
|
130
|
+
|
|
131
|
+
The service keeps `expected_revision` optional for older clients, but canonical
|
|
132
|
+
Skill update paths must always send it. On `REVISION_CONFLICT`, re-read the
|
|
133
|
+
Entry and explain that another client changed it. Never silently retry without
|
|
134
|
+
user review, omit `expected_revision`, or force an overwrite. Retry with the
|
|
135
|
+
new revision only after the user chooses to apply or merge the intended change.
|
|
136
|
+
|
|
137
|
+
## Artifact Upload
|
|
138
|
+
|
|
139
|
+
Use `imem_upload_artifact` for complete text, Markdown, or HTML deliverables.
|
|
140
|
+
Every upload starts private. Do not claim it is public or try to enable a
|
|
141
|
+
Public Link; only the user can do that in the authenticated iMem App.
|
|
142
|
+
|
|
143
|
+
## Compatibility
|
|
144
|
+
|
|
145
|
+
The following tools remain temporary migration aliases:
|
|
146
|
+
|
|
147
|
+
```text
|
|
148
|
+
imem_search
|
|
149
|
+
imem_create_memory
|
|
150
|
+
imem_create_schedule
|
|
151
|
+
imem_create_reminder
|
|
152
|
+
imem_cancel_entry
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
`imem_update_entry` also accepts the legacy `entity_type + entity_id` form.
|
|
156
|
+
New Agent workflows must use canonical tools and `entry_id` only. Do not remove
|
|
157
|
+
or recommend legacy aliases until a separate deprecation contract authorizes
|
|
158
|
+
it.
|
|
159
|
+
|
|
160
|
+
## Failure Handling
|
|
161
|
+
|
|
162
|
+
| Error code | Required Agent behavior |
|
|
163
|
+
|---|---|
|
|
164
|
+
| `UNAUTHORIZED` | Ask the user/operator to reconnect or check authentication. |
|
|
165
|
+
| `FORBIDDEN` | Report the missing scope. |
|
|
166
|
+
| `ENTRY_NOT_FOUND` | List again or ask the user to identify the target. |
|
|
167
|
+
| `VALIDATION_FAILED` | Fix clear fields or ask for missing information. |
|
|
168
|
+
| `INVALID_ENTRY_KIND` | Use `note` or `schedule`. |
|
|
169
|
+
| `IDEMPOTENCY_CONFLICT` | Do not retry the same key; confirm intent. |
|
|
170
|
+
| `REVISION_CONFLICT` | Re-read current state, explain the concurrent change, and ask whether to retry or merge. Never force overwrite. |
|
|
171
|
+
| `CONFIGURATION_ERROR` | Check the MCP URL and host configuration. |
|
|
172
|
+
| `MCP_TOOL_ERROR` | Treat the outcome as failed or uncertain. |
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# iMem Remote MCP Tool Specification
|
|
2
|
+
|
|
3
|
+
This is the public Agent contract for production iMem remote MCP contract
|
|
4
|
+
`2026-11-26`.
|
|
5
|
+
|
|
6
|
+
## Production Connection
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
MCP URL: https://imem.xin/mcp
|
|
10
|
+
Transport: Streamable HTTP
|
|
11
|
+
Authentication: OAuth Authorization Code with PKCE or Authorization: Bearer <personal-api-key>
|
|
12
|
+
OAuth: available
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
OAuth clients discover protected resource metadata at
|
|
16
|
+
`https://imem.xin/.well-known/oauth-protected-resource/mcp`. Personal API Keys
|
|
17
|
+
remain available at `https://imem.xin/app/api-keys`. The service derives user
|
|
18
|
+
and workspace identity from the active credential. Never pass `workspace_id`
|
|
19
|
+
in normal Agent requests.
|
|
20
|
+
|
|
21
|
+
## Canonical Resource Shape
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"id": "MEM-20261101-001",
|
|
26
|
+
"revision": 1,
|
|
27
|
+
"kind": "schedule",
|
|
28
|
+
"title": "Product review",
|
|
29
|
+
"content": "Review the launch scope",
|
|
30
|
+
"category": "Work",
|
|
31
|
+
"owner": "agent",
|
|
32
|
+
"members": [],
|
|
33
|
+
"tags": [],
|
|
34
|
+
"visibility": "private",
|
|
35
|
+
"source": {"type": "agent"},
|
|
36
|
+
"status": "pending",
|
|
37
|
+
"created_at": "2026-11-01T09:00:00",
|
|
38
|
+
"updated_at": null,
|
|
39
|
+
"deleted_at": null,
|
|
40
|
+
"schedule_details": {
|
|
41
|
+
"start_time": "2026-11-05T10:00:00+08:00",
|
|
42
|
+
"end_time": "2026-11-05T11:00:00+08:00",
|
|
43
|
+
"location": "",
|
|
44
|
+
"participants": [],
|
|
45
|
+
"notes": "",
|
|
46
|
+
"recurrence": null,
|
|
47
|
+
"timezone": "Asia/Shanghai",
|
|
48
|
+
"next_occurrence_at": "2026-11-05T02:00:00Z"
|
|
49
|
+
},
|
|
50
|
+
"reminder_rules": []
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`schedule_details` is `null` and `reminder_rules` is empty for a note Entry.
|
|
55
|
+
Every Entry has a top-level integer `revision`. Every nested Reminder Rule also
|
|
56
|
+
has its own integer `revision`. Reminder Rules are nested under Schedule Entries.
|
|
57
|
+
Occurrences expose `entry_id` and `occurrence_id`, never legacy identity as the
|
|
58
|
+
canonical key.
|
|
59
|
+
|
|
60
|
+
## Canonical Production Tools
|
|
61
|
+
|
|
62
|
+
| Tool | Scope | Purpose |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| `imem_health` | `entries:read` | Verify authenticated service access and contract version |
|
|
65
|
+
| `imem_get_time_context` | `entries:read` | Get authoritative server and workspace time |
|
|
66
|
+
| `imem_create_entry` | `entries:write` | Create a note or Schedule Entry |
|
|
67
|
+
| `imem_list_entries` | `entries:read` | List and filter Entries |
|
|
68
|
+
| `imem_get_entry` | `entries:read` | Read one Entry by canonical ID |
|
|
69
|
+
| `imem_update_entry` | `entries:write` | Patch one Entry |
|
|
70
|
+
| `imem_delete_entry` | `entries:write` | Soft-delete or cancel one Entry |
|
|
71
|
+
| `imem_list_entry_occurrences` | `entries:read` | Read Schedule occurrences for a range |
|
|
72
|
+
| `imem_create_entry_reminder_rule` | `entries:write` | Add a Reminder Rule to a Schedule Entry |
|
|
73
|
+
| `imem_update_entry_reminder_rule` | `entries:write` | Patch a nested Reminder Rule |
|
|
74
|
+
| `imem_delete_entry_reminder_rule` | `entries:write` | Delete/cancel a nested Reminder Rule |
|
|
75
|
+
| `imem_upload_artifact` | `entries:write` | Upload a private text, Markdown, or HTML Artifact |
|
|
76
|
+
|
|
77
|
+
## Tool Parameters
|
|
78
|
+
|
|
79
|
+
### `imem_health`
|
|
80
|
+
|
|
81
|
+
No parameters. Verify `data.status`, `data.mcp_url`, and
|
|
82
|
+
`data.contract_version`.
|
|
83
|
+
|
|
84
|
+
### `imem_get_time_context`
|
|
85
|
+
|
|
86
|
+
No parameters. Use `data.server_time` and `data.workspace_timezone` before
|
|
87
|
+
resolving relative dates or times.
|
|
88
|
+
|
|
89
|
+
### `imem_create_entry`
|
|
90
|
+
|
|
91
|
+
```text
|
|
92
|
+
kind: note | schedule
|
|
93
|
+
title: string
|
|
94
|
+
request_id: string
|
|
95
|
+
idempotency_key: string
|
|
96
|
+
content?: string
|
|
97
|
+
category?: string
|
|
98
|
+
owner?: string
|
|
99
|
+
members?: string[]
|
|
100
|
+
tags?: string[]
|
|
101
|
+
visibility?: string
|
|
102
|
+
source?: object
|
|
103
|
+
status?: string
|
|
104
|
+
created_at?: ISO datetime
|
|
105
|
+
schedule_details?: object
|
|
106
|
+
reminder_rules?: object[]
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
For `kind=schedule`, set `schedule_details.start_time` and optionally:
|
|
110
|
+
|
|
111
|
+
```text
|
|
112
|
+
end_time?: ISO datetime
|
|
113
|
+
location?: string
|
|
114
|
+
participants?: string[]
|
|
115
|
+
notes?: string
|
|
116
|
+
recurrence?: object
|
|
117
|
+
timezone?: IANA timezone
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
For `kind=note`, omit schedule details and reminder rules. Return
|
|
121
|
+
`data.entry`.
|
|
122
|
+
|
|
123
|
+
### `imem_list_entries`
|
|
124
|
+
|
|
125
|
+
```text
|
|
126
|
+
kind?: note | schedule
|
|
127
|
+
q?: string
|
|
128
|
+
status?: string
|
|
129
|
+
scheduled_from?: ISO datetime
|
|
130
|
+
scheduled_to?: ISO datetime
|
|
131
|
+
include_deleted?: boolean
|
|
132
|
+
limit?: integer
|
|
133
|
+
offset?: integer
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Return `data.entries`, `data.total`, `data.limit`, and `data.offset`.
|
|
137
|
+
|
|
138
|
+
### `imem_get_entry`
|
|
139
|
+
|
|
140
|
+
```text
|
|
141
|
+
entry_id: string
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Return `data.entry` or `ENTRY_NOT_FOUND`.
|
|
145
|
+
|
|
146
|
+
### `imem_update_entry`
|
|
147
|
+
|
|
148
|
+
Canonical input:
|
|
149
|
+
|
|
150
|
+
```text
|
|
151
|
+
entry_id: string
|
|
152
|
+
patch: object
|
|
153
|
+
request_id: string
|
|
154
|
+
expected_revision?: integer
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Do not set `id`, `kind`, or `revision`. Nest Schedule changes under
|
|
158
|
+
`patch.schedule_details`. Canonical Skill callers must read `data.entry.revision`
|
|
159
|
+
first and pass it as `expected_revision`; the parameter is optional only for
|
|
160
|
+
legacy client compatibility. Return `data.entry` with its incremented revision.
|
|
161
|
+
A stale value returns `REVISION_CONFLICT` without applying the patch.
|
|
162
|
+
|
|
163
|
+
During migration, the tool also accepts this mutually exclusive legacy form:
|
|
164
|
+
|
|
165
|
+
```text
|
|
166
|
+
entity_type: memory | schedule | reminder
|
|
167
|
+
entity_id: string
|
|
168
|
+
patch: object
|
|
169
|
+
request_id: string
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
New integrations must use `entry_id`.
|
|
173
|
+
|
|
174
|
+
### `imem_delete_entry`
|
|
175
|
+
|
|
176
|
+
```text
|
|
177
|
+
entry_id: string
|
|
178
|
+
reason: string
|
|
179
|
+
request_id: string
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Perform a soft delete/cancel and return `data.entry`.
|
|
183
|
+
|
|
184
|
+
### `imem_list_entry_occurrences`
|
|
185
|
+
|
|
186
|
+
```text
|
|
187
|
+
start: ISO datetime
|
|
188
|
+
end: ISO datetime
|
|
189
|
+
limit?: integer
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Return `data.occurrences`. Each item uses canonical `entry_id` plus an
|
|
193
|
+
occurrence-specific `occurrence_id`.
|
|
194
|
+
|
|
195
|
+
### `imem_create_entry_reminder_rule`
|
|
196
|
+
|
|
197
|
+
```text
|
|
198
|
+
entry_id: string
|
|
199
|
+
request_id: string
|
|
200
|
+
idempotency_key: string
|
|
201
|
+
remind_at?: ISO datetime
|
|
202
|
+
offset_minutes?: integer
|
|
203
|
+
channel?: string
|
|
204
|
+
is_default?: boolean
|
|
205
|
+
status?: string
|
|
206
|
+
message?: string
|
|
207
|
+
title?: string
|
|
208
|
+
notification_endpoint_id?: string
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Use only with a Schedule Entry and provide a valid timing rule. Return the
|
|
212
|
+
updated `data.entry`.
|
|
213
|
+
|
|
214
|
+
### `imem_update_entry_reminder_rule`
|
|
215
|
+
|
|
216
|
+
```text
|
|
217
|
+
entry_id: string
|
|
218
|
+
rule_id: string
|
|
219
|
+
patch: object
|
|
220
|
+
request_id: string
|
|
221
|
+
expected_revision?: integer
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Canonical Skill callers must read the selected nested Reminder Rule's `revision`
|
|
225
|
+
and pass it as `expected_revision`; omission remains only for legacy client
|
|
226
|
+
compatibility. Return the updated `data.entry`, including the incremented rule
|
|
227
|
+
revision. A stale value returns `REVISION_CONFLICT` without applying the patch.
|
|
228
|
+
|
|
229
|
+
### `imem_delete_entry_reminder_rule`
|
|
230
|
+
|
|
231
|
+
```text
|
|
232
|
+
entry_id: string
|
|
233
|
+
rule_id: string
|
|
234
|
+
reason: string
|
|
235
|
+
request_id: string
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Return the updated `data.entry`.
|
|
239
|
+
|
|
240
|
+
### `imem_upload_artifact`
|
|
241
|
+
|
|
242
|
+
```text
|
|
243
|
+
title: string
|
|
244
|
+
content: string
|
|
245
|
+
media_type: text/plain | text/markdown | text/html
|
|
246
|
+
request_id: string
|
|
247
|
+
idempotency_key: string
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
The Artifact is private and returns an owner URL. The tool cannot enable a
|
|
251
|
+
Public Link.
|
|
252
|
+
|
|
253
|
+
## Return Envelope
|
|
254
|
+
|
|
255
|
+
Success:
|
|
256
|
+
|
|
257
|
+
```json
|
|
258
|
+
{
|
|
259
|
+
"ok": true,
|
|
260
|
+
"data": {},
|
|
261
|
+
"error": null,
|
|
262
|
+
"source": "imem-remote-mcp"
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Failure:
|
|
267
|
+
|
|
268
|
+
```json
|
|
269
|
+
{
|
|
270
|
+
"ok": false,
|
|
271
|
+
"data": null,
|
|
272
|
+
"error": {"code": "VALIDATION_FAILED", "message": "..."},
|
|
273
|
+
"source": "imem-remote-mcp"
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Preserve `error.code`. Never present a failed write as successful.
|
|
278
|
+
|
|
279
|
+
## Idempotency And Recovery
|
|
280
|
+
|
|
281
|
+
`imem_create_entry`, `imem_create_entry_reminder_rule`, and
|
|
282
|
+
`imem_upload_artifact` require both `request_id` and `idempotency_key`. Reuse a
|
|
283
|
+
key only for an identical retry. Different arguments with the same key return
|
|
284
|
+
`IDEMPOTENCY_CONFLICT`.
|
|
285
|
+
|
|
286
|
+
After an uncertain update or delete, read current state before retrying. Ask
|
|
287
|
+
the user to choose when a list returns multiple plausible targets.
|
|
288
|
+
|
|
289
|
+
## Optimistic Concurrency
|
|
290
|
+
|
|
291
|
+
Before `imem_update_entry`, get the Entry and send its top-level `revision` as
|
|
292
|
+
`expected_revision`. Before `imem_update_entry_reminder_rule`, get the owning
|
|
293
|
+
Schedule Entry, select the rule, and send that rule's `revision`. The update
|
|
294
|
+
returns the resource with an incremented revision.
|
|
295
|
+
|
|
296
|
+
If either update returns `REVISION_CONFLICT`, do not retry automatically and do
|
|
297
|
+
not omit `expected_revision` to force a write. Re-read current state, explain
|
|
298
|
+
that another client changed the resource, and ask the user whether to retry the
|
|
299
|
+
intended patch against the latest revision or merge the competing changes.
|
|
300
|
+
|
|
301
|
+
## Migration Aliases
|
|
302
|
+
|
|
303
|
+
Production temporarily retains:
|
|
304
|
+
|
|
305
|
+
```text
|
|
306
|
+
imem_search
|
|
307
|
+
imem_create_memory
|
|
308
|
+
imem_create_schedule
|
|
309
|
+
imem_create_reminder
|
|
310
|
+
imem_cancel_entry
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
These aliases preserve older integrations. New Skill workflows must use the
|
|
314
|
+
canonical Entry tools. Do not remove aliases before a separately approved
|
|
315
|
+
deprecation and telemetry review.
|
|
316
|
+
|
|
317
|
+
## Error Handling
|
|
318
|
+
|
|
319
|
+
| Error code | Required behavior |
|
|
320
|
+
|---|---|
|
|
321
|
+
| `UNAUTHORIZED` | Reconnect or check the configured credential. |
|
|
322
|
+
| `FORBIDDEN` | Report the missing scope. |
|
|
323
|
+
| `ENTRY_NOT_FOUND` | List again or ask the user to identify the Entry. |
|
|
324
|
+
| `VALIDATION_FAILED` | Correct clear fields or ask for missing information. |
|
|
325
|
+
| `INVALID_ENTRY_KIND` | Use `note` or `schedule`. |
|
|
326
|
+
| `IDEMPOTENCY_CONFLICT` | Do not retry with that key; confirm intent. |
|
|
327
|
+
| `REVISION_CONFLICT` | Re-read current state, explain the concurrent change, and ask whether to retry or merge. Never force overwrite. |
|
|
328
|
+
| `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.
|