Skip to content

pa-db-save-message

by rob

Data

Save a message to the PA2 SQLite database with conversation tracking. Creates database and schema if needed, assigns unique message ID, and stores message with metadata.

# pa-db-save-message

Save a message to the PA2 SQLite database with conversation tracking. Creates database and schema if needed, generates unique message ID, and stores message with metadata.

## Installation

This is a CmdForge tool. It should be installed and managed through CmdForge's tool system.

## Usage

This tool accepts input via stdin and processes it through its pipeline:

```bash
# Save a message to the database
echo '{"role": "user", "content": "Hello", "conversation_id": "conv-123", "source": "cli"}' | pa-db-save-message --db-path ~/.pa2/data/pa2.db

# Using default database path (from config)
echo '{"role": "assistant", "content": "Hi there!", "conversation_id": "conv-123"}' | pa-db-save-message
```

## Arguments

| Flag | Default | Description |
|------|---------|-------------|
| `--db-path` | (from config) | Path to SQLite database file |

## How It Works

1. **parse_and_save**: Parses the input JSON message, validates required fields, creates the database schema if needed, generates a unique message ID, and stores the message with timestamp and metadata in the SQLite database.

## Dependencies

None

## Output

Returns JSON with the saved message details including the generated message ID and timestamp.

No reviews yet.

Issues

No issues reported for this tool.