# TrulyMEM - OpenClaw Adapter Give AI true long-term memory capability - OpenClaw framework adapter version [ไธญๆ–‡็‰ˆๆœฌ](./README.md) --- ## ๐Ÿค– AI Self-Installation Guide > This section is for AI Agents, guiding them how to self-install this Skill to OpenClaw ### Installation Steps #### Step 1: Locate Skill Directory OpenClaw Skill precedence: `/.agents/skills/` > `~/.agents/skills/` > `~/.openclaw/skills/` Copy the `skills/` directory to a high-priority location: ```bash # Method 1: User-level installation (recommended) cp -r skills/ ~/.agents/skills/graph_memory # Method 2: System-level installation sudo cp -r skills/ /.agents/skills/graph_memory ``` #### Step 2: Verify Installation Invoke Skill in OpenClaw: ``` Remember: I like programming and am learning TypeScript ``` AI should receive a confirmation message. #### Step 3: Use the Skill After installation, AI can use these commands: | Command | Function | |---------|----------| | `commit` | Commit memories | | `recall` | Retrieve memories | | `purge` | Delete memories | | `introspect` | Inspect status | | `persona_update/clear` | Persona management | | `task_create/set_state/delete` | Task management | --- ## Introduction This project ports TrulyMEM's graph memory capability to TypeScript for the OpenClaw framework. As an OpenClaw Skill module, it provides graph memory functionality: - **recall**: Retrieve memories - **commit**: Commit memories - **purge**: Delete memories - **introspect**: Inspect status - **persona_update/clear**: Persona management - **task_create/set_state/delete**: Task management --- ## Directory Structure ``` ts/ โ”œโ”€โ”€ src/runtime/core/ โ”‚ โ”œโ”€โ”€ graph_memory/ # Graph memory core module โ”‚ โ”‚ โ”œโ”€โ”€ types.ts # Type definitions โ”‚ โ”‚ โ”œโ”€โ”€ graph_database.ts # Graph database โ”‚ โ”‚ โ”œโ”€โ”€ memory_service.ts # Memory service โ”‚ โ”‚ โ””โ”€โ”€ index.ts # Module exports โ”‚ โ””โ”€โ”€ tools/ โ”‚ โ””โ”€โ”€ builtin/ โ”‚ โ””โ”€โ”€ graph_memory_tool.ts # Tool implementation โ”‚ โ”œโ”€โ”€ package.json # Project config โ””โ”€โ”€ tsconfig.json # TypeScript config skills/ # OpenClaw Skill definitions โ””โ”€โ”€ graph_memory/ โ”œโ”€โ”€ SKILL.md # Memory operations โ”œโ”€โ”€ persona/SKILL.md # Persona management โ””โ”€โ”€ task/SKILL.md # Task management ``` --- ## Using in OpenClaw ### Method 1: As Module (for Developer Integration) #### Step 1: Copy Source Code Copy the `ts/` directory to your OpenClaw project: ``` yourOpenClawProject/ โ””โ”€โ”€ src/ โ””โ”€โ”€ runtime/ โ””โ”€โ”€ core/ โ””โ”€โ”€ graph_memory/ # Copy from ts/src/runtime/core/ ``` #### Step 2: Compile TypeScript ```bash cd ts/ npm install npm run build ``` Compiled files output to `ts/dist/` directory. #### Step 3: Import in Code ```typescript import { createGraphMemoryTool } from './runtime/core/tools/builtin/graph_memory_tool'; // Create tool instance const tool = createGraphMemoryTool('my-session-id'); // Commit memory example const commitResult = await tool.handler({ action: 'commit', params: { triplets: [ { subject: '็”จๆˆท', relation: 'ๅ–œๆฌข', object: '็ผ–็จ‹' }, { subject: '็”จๆˆท', relation: 'ๆญฃๅœจๅญฆไน ', object: 'TypeScript' } ] } }, context); // Recall memory example const recallResult = await tool.handler({ action: 'recall', params: { queryIntent: '็”จๆˆท ็ผ–็จ‹' } }, context); ``` ### Method 2: Use Skill (Recommended for AI Agent) #### Step 1: Place Skill Files Copy `skills/` directory to OpenClaw's Skill directory: ```bash cp -r skills/ ~/.agents/skills/graph_memory ``` #### Step 2: Invoke Skill Use directly in OpenClaw: ``` Use graph_memory to remember: I like programming and am learning TypeScript ``` #### Available Skills | Skill Name | Function | Use Case | |------------|----------|----------| | `graph_memory` | Memory CRUD | Read/write/delete memories | | `graph_memory_persona` | Persona management | Set AI persona | | `graph_memory_task` | Task management | Create/update tasks | --- ## API ### GraphMemoryTool ```typescript const tool = new GraphMemoryTool(sessionId?: string); ``` #### Actions | Action | Description | Parameters | |--------|-------------|------------| | `recall` | Retrieve memories | `queryIntent`, `seedEntities`, `sessionFilter` | | `commit` | Commit memories | `triplets`, `sessionId`, `turnId` | | `purge` | Delete memories | `criteria`, `mode` | | `introspect` | Inspect status | - | | `persona_update` | Update persona | `attributes`, `mode` | | `persona_clear` | Clear persona | `confirm` | | `task_create` | Create task | `task_id`, `description`, `info_nodes` | | `task_set_state` | Set task state | `task_id`, `state` | | `task_delete` | Delete task | `task_id` | --- ## Examples ### Commit Memory ```json { "action": "commit", "params": { "triplets": [ { "subject": "็”จๆˆท", "relation": "ๅ–œๆฌข", "object": "TypeScript" }, { "subject": "็”จๆˆท", "relation": "ๆญฃๅœจๅญฆไน ", "object": "OpenClaw" } ] } } ``` ### Recall Memory ```json { "action": "recall", "params": { "queryIntent": "็”จๆˆท ๅญฆไน " } } ``` ### Create Task ```json { "action": "task_create", "params": { "task_id": "Task_ๅญฆไน TypeScript", "description": "ๅญฆไน  TypeScript ๅนถๅฎŒๆˆ้กน็›ฎ", "info_nodes": ["ๆ–‡ๆกฃ้“พๆŽฅ", "ๆ•™็จ‹้“พๆŽฅ"] } } ``` --- ## License [GNU General Public License v3.0 (GPLv3)](LICENSE)