Synthlabs curation

From mkurman/zorai · View interactive version

Synthlabs curation is an AI agent skill from the GitHub repository mkurman/zorai. Use when SynthLabs dataset curation should run as repeatable background HTTP jobs instead of manual UI work.

How to use this skill

Skill file

SynthLabs Curation

Overview

Use this skill for SynthLabs dataset curation that runs through existing HTTP job routes instead of manual UI-first work. This is workflow guidance for an external app; do not assume zorai exposes dedicated SynthLabs tools.

When to Use

Use this skill when:

Do not use this skill when:

Agent Rules

Verification-First Loop

  1. Inspect existing work with GET /api/jobs or session state so you do not start duplicate jobs.
  2. Start exactly one curation route with the narrowest safe payload.
  3. Poll GET /api/jobs/:id until the job is completed or failed.
  4. Review progress, result, and error fields before declaring success.
  5. Update the active zorai session, task, or goal notes with the session ID, job ID, filters used, final counts, and whether UI verification is still pending.
  6. If any rows need human judgment or visual approval, hand that follow-up to synthlabs-ui-operator instead of continuing in blind HTTP mode.

Polling And Discovery

List recent jobs, optionally filtered by type or status:

curl -fsS "http://localhost:8787/api/jobs?type=rewrite&status=running&limit=20"

Fetch the full state of one job after start:

curl -fsS "http://localhost:8787/api/jobs/job_123"

Prefer GET /api/jobs/:id once you have a jobId; use GET /api/jobs for discovery, queue visibility, or to confirm whether a similar run is already active.

AI-Backed Jobs

`POST /api/jobs/autoscore`

Use autoscore when a session's items need model-based 1-5 scoring.

curl -fsS -X POST "http://localhost:8787/api/jobs/autoscore" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "session_abc",
    "provider": "openai",
    "model": "gpt-4.1-mini",
    "baseUrl": "https://api.openai.com/v1",
    "apiKey": "<encrypted iv:ciphertext value>",
    "limit": 100,
    "offset": 0,
    "concurrency": 1,
    "maxRetries": 2,
    "retryDelay": 2000,
    "sleepMs": 500,
    "force": false
  }'

`POST /api/jobs/rewrite`

Use rewrite when the backend should improve query, reasoning, or answer fields in place.

curl -fsS -X POST "http://localhost:8787/api/jobs/rewrite" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "session_abc",
    "provider": "openai",
    "model": "gpt-4.1-mini",
    "baseUrl": "https://api.openai.com/v1",
    "apiKey": "<encrypted iv:ciphertext value>",
    "fields": ["reasoning", "answer"],
    "limit": 50,
    "concurrency": 1,
    "sleepMs": 500
  }'

Autoscore and rewrite both call the SynthLabs AI client and decrypt the submitted apiKey. Use an encrypted value compatible with the backend's VITE_API_KEY_SALT or API_KEY_SALT behavior. Do not send a plaintext provider key and do not invent your own encryption flow.

Non-AI Cleanup And Migration Jobs

`POST /api/jobs/remove-items`

Use remove-items for deterministic cleanup. This route does not need model credentials.

Dry-run a threshold cleanup first:

curl -fsS -X POST "http://localhost:8787/api/jobs/remove-items" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "session_abc",
    "scoreThreshold": 3,
    "scoreField": "score",
    "dryRun": true
  }'

The route accepts exactly one removal method: indices or scoreThreshold, never both.

`POST /api/jobs/migrate-reasoning`

Use migrate-reasoning to move assistant <think> content into reasoning_content fields for a session. This route does not need model credentials.

curl -fsS -X POST "http://localhost:8787/api/jobs/migrate-reasoning" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "session_abc",
    "limit": 200,
    "offset": 0,
    "concurrency": 5,
    "sleepMs": 100,
    "force": false
  }'

Optional Maintenance Surfaces

curl -fsS "http://localhost:8787/api/logs/stats?sessionUid=session_abc"
curl -fsS -X POST "http://localhost:8787/api/orphans/check"

Common Mistakes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.