Scheduled Workflows

Automate Snipara operations using external schedulers like GitHub Actions, system cron, or pg_cron. No custom Snipara job runner is required.

Philosophy

Snipara optimizes context. Scheduling is a solved problem — use the right tool for each job.

Quick Start

Trigger a reindex with a single curl command:

curl -X POST "https://api.snipara.com/v1/{project_id}/reindex" \
  -H "X-API-Key: rlm_your_api_key"

Available Scheduled Operations

OperationEndpointUse Case
ReindexPOST /v1/{project}/reindexRefresh embeddings after content changes
Memory cleanupMCP rlm_forgetRemove stale memories
Index healthMCP rlm_index_healthMonitor documentation quality

Option 1: GitHub Actions

The easiest option for GitHub-hosted projects. Create a workflow file to trigger Snipara operations on a schedule or after pushes.

Daily Reindex

Create .github/workflows/snipara-reindex.yml:

name: Snipara Daily Reindex
on:
  schedule:
    - cron: '0 2 * * *'  # Daily at 2 AM UTC
  workflow_dispatch:  # Allow manual trigger
jobs:
  reindex:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
      - name: Trigger Snipara Reindex
        env:
          SNIPARA_API_KEY: ${{ secrets.SNIPARA_API_KEY }}
          SNIPARA_PROJECT_ID: ${{ secrets.SNIPARA_PROJECT_ID }}
        run: |
          response=$(curl -s -X POST \
            "https://api.snipara.com/v1/$SNIPARA_PROJECT_ID/reindex" \
            -H "X-API-Key: $SNIPARA_API_KEY")
          
          job_id=$(echo "$response" | jq -r '.job_id')
          echo "Started reindex job: $job_id"

Post-Push Sync

Trigger reindex when documentation changes:

name: Snipara Sync on Push
on:
  push:
    paths:
      - 'docs/**'
      - 'README.md'
      - 'CLAUDE.md'
    branches: [main]
jobs:
  sync:
    runs-on: ubuntu-latest
    steps:
      - name: Trigger Incremental Reindex
        run: |
          curl -X POST \
            "https://api.snipara.com/v1/${{ secrets.SNIPARA_PROJECT_ID }}/reindex" \
            -H "X-API-Key: ${{ secrets.SNIPARA_API_KEY }}"
GitHub Secrets: Add SNIPARA_API_KEY and SNIPARA_PROJECT_ID to your repository secrets (Settings → Secrets and variables → Actions).

Option 2: Any Cron Runner

If you already have a cron-capable platform or VPS, trigger the same workflows with a shell script and a standard cron schedule.

Setup

Add a crontab entry like:

# Daily at 02:00 UTC
0 2 * * * /opt/snipara/scripts/snipara-reindex.sh >> /var/log/snipara-reindex.log 2>&1

Use a shell script for retries, polling, and structured logging:

#!/bin/bash
# scripts/snipara-reindex.sh
set -euo pipefail
response=$(curl -s -X POST \
  "https://api.snipara.com/v1/$SNIPARA_PROJECT_ID/reindex?mode=incremental" \
  -H "X-API-Key: $SNIPARA_API_KEY")
job_id=$(echo "$response" | jq -r '.job_id')
echo "[$(date -Iseconds)] Started reindex job: $job_id"
# Poll for completion (max 10 min)
for i in $(seq 1 60); do
  sleep 10
  status=$(curl -s \
    "https://api.snipara.com/v1/$SNIPARA_PROJECT_ID/reindex/$job_id" \
    -H "X-API-Key: $SNIPARA_API_KEY" | jq -r '.status')
  
  [ "$status" = "completed" ] && echo "Done!" && exit 0
  [ "$status" = "failed" ] && echo "Failed!" && exit 1
done

Option 3: Vaultbrix pg_cron

For Vaultbrix (or any PostgreSQL with pg_cron), use the pg_cron extension for database-level scheduling.

-- Daily reindex at 2 AM UTC
SELECT cron.schedule(
  'snipara-daily-reindex',
  '0 2 * * *',
  $$
  SELECT net.http_post(
    url := 'https://api.snipara.com/v1/YOUR_PROJECT_ID/reindex',
    headers := jsonb_build_object(
      'X-API-Key', 'rlm_your_api_key',
      'Content-Type', 'application/json'
    ),
    body := '{}'::jsonb
  );
  $$
);

Common Scheduled Tasks

Daily Incremental Reindex

Keep embeddings fresh for new/changed documents. Only indexes documents without existing chunks.

POST /v1/{project}/reindex?mode=incremental
Schedule: Daily 2 AM

Weekly Full Reindex

Regenerate all embeddings to catch content drift. Deletes existing chunks first.

POST /v1/{project}/reindex?mode=full
Schedule: Sunday 3 AM

Monthly Memory Cleanup

Remove old memories to reduce noise. Uses rlm_forget MCP tool.

rlm_forget({"older_than_days": 90})
Agents Starter+

Daily Index Health Check

Monitor documentation coverage and quality. Integrate with alerting.

rlm_index_health()
All Plans

Best Practices

Idempotency

The reindex endpoint handles idempotency automatically:

{
  "job_id": "existing-job-id",
  "already_exists": true,
  "status": "running"
}

If a job is already running, a new one won't be created.

Error Handling

Always check response status:

response=$(curl -s -w "\n%{http_code}" -X POST "$API_URL/v1/$PROJECT/reindex" \
    -H "X-API-Key: $API_KEY")
http_code=$(echo "$response" | tail -1)
if [ "$http_code" != "200" ] && [ "$http_code" != "201" ]; then
  echo "ERROR: HTTP $http_code"
  # Send alert (Slack, PagerDuty, etc.)
  exit 1
fi

Timeouts

OperationTypical DurationRecommended Timeout
Incremental reindex (small)10-30s5 min
Incremental reindex (large)1-5 min15 min
Full reindex5-30 min45 min

Security

Never commit API keys to version control. Use secrets/environment variables provided by your CI/CD platform.
PlatformSecret Storage
GitHub ActionsRepository Secrets
Hosted cron runnersEnvironment Variables
VaultbrixEnvironment Variables
Local cronEnvironment file (chmod 600)

Monitoring

Check the Snipara dashboard for:

  • Recent index jobs with status
  • Index health metrics
  • Memory usage over time

Access at: snipara.com/dashboard/projects/{project}/settings

Next Steps