Skip to content
Agentmart
Submit a tool

memory-management

Persist Pi conversation messages to js-doc-store-server.

Skill by MauricioPerera

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/mauricioperera-memory-management

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Persist Pi conversation messages to js-doc-store-server. Auto-incremented turns, recovery after compaction, admin queries, best practices. v2.2.1 with 4 core tools.

Use cases: documents, backend

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/memory-management

What's inside

Skill name
memory-management
Description
Persist Pi conversation messages to js-doc-store-server. Auto-incremented turns, recovery after compaction, admin queries, best practices. v2.2.1 with 4 core tools.
License
MIT
Instructions
152 lines in SKILL.md · view on GitHub

Before installing

  • Instructions call the network

Agent Skills spec issues

  • files: referenced but missing: scripts/bootstrap.cjs

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Memory Management Skill

## Purpose

Prevent conversation data loss when Pi compacts/summarizes long sessions. Every user and assistant message is persisted to the `messages` table in js-doc-store-server with auto-incremented turns.

## Prerequisites

- js-doc-store-server running on `http://localhost:3000` (or your URL)
- Valid JWT token (admin role)
- Extension `pi-extension-data-architect` v2.2.0+ installed in Pi

## Schema

Table: `messages`

| Column | Type | Required | Notes |
|--------|------|----------|-------|
| `conversation_id` | text | ✅ | Group messages by session |
| `turn` | number | ❌ | Auto-incremented per conversation |
| `role` | text | ✅ | `user`, `assistant`, or `system` |
| `content` | text | ✅ | Full message text |
| `timestamp` | text | ❌ | ISO 8601 datetime |
| `model` | text | ❌ | Model name (e.g., `claude-sonnet`) |
| `tool_calls` | text | ❌ | JSON-serialized tool calls |

## Setup (First Time)

```typescript
// 1. Create the messages table
arch_message_create_table()

// 2. Save a test message
arch_message_save({
    conversationId: "my-session-001",
    role: "user",
    content: "Hola, recordá todo lo que digo"
})

// 3. Verify it was saved
arch_message_history({
    conversationId: "my-session-001",
    limit: 10
})
```

## Daily Workflow

### After each user message

```typescript
arch_message_save({
    conversationId: "my-session-001",
    role: "user",
    content: "El usuario pidió crear un nuevo pipeline CI/CD"
})
```

### After each assistant response

```typescript
arch_message_save({
    conversationId: "my-session-001",
    role: "assistant",
    content: "Creado el archivo .github/workflows/deploy.yml con 3 jobs: build, test, deploy.",
    model: "claude-sonnet",
    toolCalls: JSON.stringify([{ tool: "write_file", args: { path: ".github/workflows/deploy.yml" } }])
})
```

> **Auto-turn**: If `turn` is omitted, the tool queries the last turn for that `conversationId` and increments automatically.

## Recovery After Compaction

When Pi compacts history into a summary, the full content is lost from context. To recover:

```typescript
// Get last 50 messages
const history = await arch_message_history({
    conversationId: "my-session-001",
    limit: 50
});

// Inject back into context (as text) so Pi can answer follow-ups
// e.g. "What did we discuss about the database schema?"
```

## Listing All Active Conversations

```typescript
arch_conversations()
// Returns:
// - my-session-001: 47 messages
// - dev-task-ssh: 12 messages
// - deploy-plan: 8 messages
```

## Admin Queries (via REST API)

If you need raw access outside Pi tools:

```bash
TOKEN=$(curl -s -X POST http://localhost:3000/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"admin@example.com","password":"Admin123!"}' \
  | sed -n 's/.*"token":"\\([^"]*\\)".*/\\1/p')

# Count messages by role
curl -s -X POST http://localhost:3000/admin/query \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "tableName": "messages",
    "filter": {"conversation_id":"my-session-001"},
    "sort": {"turn":1}
  }'
```

## Best Practices

From MauricioPerera/pi-extension-data-architect, MIT.

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
May 11, 2026 (5 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from MauricioPerera

Cite this page

memory-management skill. Agent Mart. https://agentmart.dev/skills/mauricioperera-memory-management (last updated 2026-10-24)