Agent Memory
Report structured memory events from third-party applications
Agent Memory allows third-party applications to report user activity events into SecondMe. When your app observes a user action on an external platform (posting, replying, performing an operation), you can send a structured event so SecondMe's avatar builds richer memory about the user's digital life.
The user sees these events in their Activity Timeline — each event shows the actionLabel, displayText, importance level, and a link to jump back to the original content. Design your events with this display in mind.
Base URL: https://api.mindverse.com/gate/lab
Ingest Event
Report an agent memory event.
POST /api/secondme/agent_memory/ingestAuthentication
Requires OAuth2 Token with agent_memory scope.
Request Body
Core Fields
These are the fields you will use in most integrations.
| Parameter | Type | Required | Description |
|---|---|---|---|
| channel | ChannelInfo | Yes | Source channel where the event occurred |
| action | string | Yes | Action identifier describing what happened. Open string — use a short, descriptive name like post_created, reply, liked, endorsed, notification_received, etc. |
| refs | RefItem[] | Yes | Evidence references (min 1 item) |
| display_text | string | Recommended | User-facing summary shown in the Activity Timeline. Strongly recommended — if omitted, the server attempts to auto-generate one |
| action_label | string | Recommended | Human-readable action label (e.g., "Replied to thread", "Found a match"). Displayed alongside the event |
| importance | number | Recommended | Importance score from 0.0 to 1.0. Events with importance >= 0.7 are marked as "important" in the timeline. See Importance Levels |
| payload | Payload | Recommended | Extension data. See below for required and optional fields |
| event_time | integer | No | Event timestamp in milliseconds. Defaults to server time |
| event_desc | string | No | Developer-facing description (not shown to users) |
| idempotency_key | string | No | Custom idempotency key for deduplication. See Idempotency |
ChannelInfo
Describes the source channel where the event occurred.
| Field | Type | Required | Description |
|---|---|---|---|
| kind | string | Yes | Resource type identifier (e.g., thread, post, comment, channel, document) |
| id | string | Recommended | Channel object ID on the source platform (e.g., thread ID, channel ID) |
| url | string | Recommended | Direct URL to the channel or resource |
| platform | string | No | Auto-populated from your OAuth app's Client ID. Do not set manually |
| meta | object | No | Additional channel metadata (freeform JSON) |
RefItem
Each ref is an evidence pointer to the source content that triggered the event.
| Field | Type | Required | Description |
|---|---|---|---|
| object_type | string | Yes | Type of the referenced object (e.g., thread_reply, post, comment, message) |
| object_id | string | Yes | Unique identifier of the referenced object on the source platform |
| type | string | No | Reference type. Defaults to "external_action" |
| platform | string | No | Inherits from channel.platform if not set |
| url | string | No | Direct URL to the referenced object |
| content_preview | string | No | Short text preview of the referenced content |
| snapshot | RefSnapshot | No | Content snapshot for evidence preservation |
RefSnapshot
A captured snapshot of the source content at the time of the event.
| Field | Type | Required | Description |
|---|---|---|---|
| text | string | Yes | Original text content of the evidence |
| captured_at | integer | No | Capture timestamp in milliseconds |
| hash | string | No | Content integrity hash (e.g., sha256:...) |
Payload
The payload object carries extension data. The jumpUrl field is especially important — it provides the link users click to navigate back to the original content from the Activity Timeline.
| Field | Type | Recommended | Description |
|---|---|---|---|
| jumpUrl | string | Yes | URL linking back to the source content. Displayed as a clickable link in the user's Activity Timeline |
| tags | string[] | No | Custom labels for categorization (e.g., ["ai", "discussion"]) |
You can include any additional fields relevant to your app (e.g., postId, commentId, authorName). These are stored as-is and available for future retrieval.
Request Examples
Example 1: Typical event with recommended fields
curl -X POST "https://api.mindverse.com/gate/lab/api/secondme/agent_memory/ingest" \
-H "Authorization: Bearer lba_at_your_access_token" \
-H "Content-Type: application/json" \
-d '{
"channel": {
"kind": "thread",
"id": "thread_12345",
"url": "https://community.example.com/threads/12345"
},
"action": "reply",
"action_label": "Replied to thread",
"display_text": "Replied in AI Trends discussion: transformer architectures will continue to dominate",
"importance": 0.7,
"refs": [
{
"object_type": "thread_reply",
"object_id": "reply_67890",
"url": "https://community.example.com/threads/12345#reply-67890",
"snapshot": {
"text": "I think transformer architectures will continue to dominate NLP for the foreseeable future. The efficiency gains from sparse attention mechanisms are particularly promising.",
"captured_at": 1711900800000
}
}
],
"payload": {
"jumpUrl": "https://community.example.com/threads/12345#reply-67890",
"tags": ["ai", "discussion"]
}
}'Example 2: Minimal event (required fields only)
curl -X POST "https://api.mindverse.com/gate/lab/api/secondme/agent_memory/ingest" \
-H "Authorization: Bearer lba_at_your_access_token" \
-H "Content-Type: application/json" \
-d '{
"channel": {
"kind": "post"
},
"action": "post",
"refs": [
{
"object_type": "post",
"object_id": "post_abc123"
}
]
}'Response
Success (200)
{
"code": 0,
"data": {
"eventId": 12345,
"isDuplicate": false
}
}| Field | Type | Description |
|---|---|---|
| eventId | number | Created event ID. Returns 0 if the event was a duplicate or invalid |
| isDuplicate | boolean | Whether this event was detected as a duplicate |
Idempotency
The system automatically deduplicates events. If you don't provide an idempotency_key, the server generates one using:
sha256("external:" + platform + ":" + objectType + ":" + objectId + ":" + userId)When a duplicate is detected:
eventIdreturns0isDuplicatereturnstrue- The original event is not modified
You can also provide your own idempotency_key to control deduplication behavior. This is useful when the same object_type + object_id combination might legitimately produce multiple events.
Error Codes
| Error Code | HTTP Status | Description |
|---|---|---|
| auth.token.invalid | 401 | Token is invalid or expired |
| oauth2.scope.insufficient | 403 | Missing required agent_memory scope |
| agent.memory.write.disabled | 403 | Agent memory write is disabled for this user |
| apikey.permission.denied | 403 | API Key lacks required permission |
| invalid.param | 400 | Invalid request parameter (e.g., missing required fields, empty refs) |
Importance Levels
The importance field affects how the event is prioritized and displayed:
| Score Range | Behavior | Usage |
|---|---|---|
0.0 - 0.3 | Normal event, may be filtered out in summaries | Low-value events (e.g., page views, passive browsing) |
0.3 - 0.69 | Normal event, shown in the timeline | Routine actions (e.g., likes, bookmarks) |
0.7 - 1.0 | Treated as "important", counted in daily important event stats, may be featured or highlighted | Notable interactions (e.g., posts, replies, meaningful discoveries) |
The threshold importance >= 0.7 is the key cutoff — events at or above this value are classified as important and included in the user's daily summary.
Best Practices
- Always provide
display_textandaction_label. These are what users see in their Activity Timeline. If omitted, the server attempts auto-generation, which may not match your intended wording. - Set
importance >= 0.7for events you want highlighted as important. Use0.0 - 0.69for routine events. - Include
payload.jumpUrlso users can navigate back to the original content from the timeline. - Provide
snapshot.textwhenever possible — this gives the avatar direct access to the original content for better recall. - Do not set
channel.platformmanually — it is auto-populated from your OAuth app registration. - Place custom labels in
payload.tags(as a string array). There is no top-leveltagfield. - Handle
isDuplicate: trueresponses gracefully — they are not errors, just confirmations that the event already exists.