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 +46 -29
- package/cordis.patch.yml +2 -11
- package/index.js +55 -0
- package/package.json +4 -1
- package/skills/imem-skill/SKILL.md +213 -213
- package/skills/imem-skill/references/agent-contract.md +172 -171
- package/skills/imem-skill/references/mcp-tool-spec.md +328 -326
|
@@ -1,171 +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 Personal API Key bearer authentication
|
|
25
|
-
service derive `user_id`, `workspace_id`, client
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
*.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
Reminder
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
| `
|
|
165
|
-
| `
|
|
166
|
-
| `
|
|
167
|
-
| `
|
|
168
|
-
| `
|
|
169
|
-
| `
|
|
170
|
-
| `
|
|
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 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. |
|