AgentSkillsCN

Postgres Ttl Cleanup

Postgres TTL清理

SKILL.md

postgres-ttl-cleanup

Lane: ops
Version: 0.1.0
Owner: system
Schedule: 0 3 * * *

Purpose

Daily cleanup of expired rows from Postgres tables lacking native TTL. Deletes old audit logs (90d), idempotency keys, workspace invites (30d), subscriber events (60d). Logs deletions to ClickHouse audit trail.

Memory Contract

Access Mode

service_only - All writes go through MemoryClient. No direct ClickHouse access.

Writes

None - read-only skill

Provenance

Every write includes:

FieldSource
run_idGenerated UUID
trace_idFrom Langfuse or run_id
source_refpostgres-ttl-cleanup:run
actorpostgres-ttl-cleanup

Environment Variables

See task definition in app/cosmocrat_tasks.yaml

Testing

bash
# Run locally
python -m app.services.mcp.jobs.{domain}.{module}

# Integration tests
pytest tests/skills/test_postgres_ttl_cleanup.py -v

Changelog

  • 0.1.0 (2025-12-22): Initial manifest generated via migrate_skills.py