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
| Operation | Endpoint | Use Case |
|---|---|---|
| Reindex | POST /v1/{project}/reindex | Refresh embeddings after content changes |
| Memory cleanup | MCP rlm_forget | Remove stale memories |
| Index health | MCP rlm_index_health | Monitor 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 Reindexon: schedule: - cron: '0 2 * * *' # Daily at 2 AM UTC workflow_dispatch: # Allow manual triggerjobs: 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 Pushon: 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 }}"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 UTC0 2 * * * /opt/snipara/scripts/snipara-reindex.sh >> /var/log/snipara-reindex.log 2>&1Use a shell script for retries, polling, and structured logging:
#!/bin/bash# scripts/snipara-reindex.shset -euo pipefailresponse=$(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 1doneOption 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 UTCSELECT 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=incrementalWeekly Full Reindex
Regenerate all embeddings to catch content drift. Deletes existing chunks first.
POST /v1/{project}/reindex?mode=fullMonthly Memory Cleanup
Remove old memories to reduce noise. Uses rlm_forget MCP tool.
rlm_forget({"older_than_days": 90})Daily Index Health Check
Monitor documentation coverage and quality. Integrate with alerting.
rlm_index_health()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 1fiTimeouts
| Operation | Typical Duration | Recommended Timeout |
|---|---|---|
| Incremental reindex (small) | 10-30s | 5 min |
| Incremental reindex (large) | 1-5 min | 15 min |
| Full reindex | 5-30 min | 45 min |
Security
| Platform | Secret Storage |
|---|---|
| GitHub Actions | Repository Secrets |
| Hosted cron runners | Environment Variables |
| Vaultbrix | Environment Variables |
| Local cron | Environment 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