> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Memory CLI

> CLI commands for memory management in PraisonAI TypeScript

The `praisonai-ts` CLI provides commands for managing agent memory.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
graph LR
    User([User]) --> CLI[CLI]
    CLI --> Svc[Memory]

    classDef agent fill:#8B0000,stroke:#7C90A0,color:#fff
    classDef tool fill:#189AB4,stroke:#7C90A0,color:#fff

    class Svc agent
    class User,CLI tool
    classDef agent fill:#8B0000,color:#fff
    classDef tool fill:#189AB4,color:#fff

```

## Quick Start

<Steps>
  <Step title="Simple Usage">
    ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    praisonai-ts memory list
    ```
  </Step>

  <Step title="With Configuration">
    ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    praisonai-ts memory search "important" --json
    ```
  </Step>
</Steps>

## List Memories

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# List all memories
praisonai-ts memory list

# Get JSON output
praisonai-ts memory list --json
```

## Add Memory

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Add a memory entry
praisonai-ts memory add "Important information to remember"
```

## Search Memory

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Search memories
praisonai-ts memory search "query"

# Get JSON output
praisonai-ts memory search "TypeScript" --json
```

## Clear Memory

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Clear all memories
praisonai-ts memory clear
```

## SDK Usage

For programmatic memory management:

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import { Memory } from 'praisonai';

const mem = new Memory();

// Add entries
await mem.add('Hello', 'user');
await mem.add('Hi there', 'assistant');

// Search
const results = await mem.search('Hello');

// Get recent
const recent = mem.getRecent(5);

// Build context
const context = mem.buildContext();

// Export
const data = mem.toJSON();
```

For more details, see the [Memory SDK documentation](/docs/js/memory).

## Related

<CardGroup cols={2}>
  <Card title="Memory" icon="book" href="/docs/js/memory">Memory overview</Card>
  <Card title="Sessions" icon="robot" href="/docs/js/sessions">Sessions overview</Card>
</CardGroup>
