agent-sync/CLAUDE.md
nickviljoen f3a63d5d54 added system prompt syncing for audit and project documentation
- Removed instructions exclusion from export pipeline so system prompts flow through
- Added system_prompt field to registration payload for compliance audits
- Added tool_resources and actions to metadata
- Created README.md and CLAUDE.md for project documentation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 11:56:36 +02:00

2.2 KiB

Agent Sync - Project Context

Overview

This is the agent-sync tool — a lightweight pipeline that exports agent metadata from LibreChat's MongoDB and registers it with the Agent Tracker API. It runs on the optical-librechat GCP server as a daily cron job.

Architecture

  • No running service — these are standalone scripts triggered by cron
  • Pipeline: export_shared_agents.js (MongoDB export) -> shared_agents.json -> register_agents.py (API POST)
  • Orchestrated by weekly_agent_sync.sh

Key Files

  • export_shared_agents.js — MongoDB aggregation pipeline run via mongosh inside the chat-mongodb Docker container. Queries aclentries, agents, users, conversations, messages, and transactions collections.
  • register_agents.py — Python script that maps exported fields to the Agent Tracker AgentCollectorCreate schema and POSTs them. Has retry logic, dry-run mode, and result logging.
  • weekly_agent_sync.sh — Bash wrapper for the full pipeline. Deployed to /opt/agent-sync/ on the server.

Server Details

  • Server: optical-librechat (GCP)
  • Deploy path: /opt/agent-sync/
  • LibreChat source: /home/michael_clervi/LibreChat/ (Docker Compose, owned by michael_clervi)
  • Cron: 0 0 * * * (daily midnight, root crontab)
  • MongoDB container: chat-mongodb, database LibreChat

API Target

  • Endpoint: https://ai-sandbox.oliver.solutions/agent_collector/agents
  • Auth: Static API key via X-API-Key header
  • SSL verification is disabled (internal/dev API)

Conventions

  • The JS export script uses MongoDB Extended JSON (relaxed mode)
  • The Python script prunes None/empty fields before POSTing
  • shared_agents.json and registration_results.json are generated output — not committed
  • Python dependencies are minimal: requests and urllib3 only

Dependencies

  • Agent Tracker API must accept any new fields added to the payload (Pydantic model: AgentCollectorCreate). Unknown fields are silently stripped.
  • The system_prompt field requires Agent Tracker to be updated to accept it.

Deployment

Files are copied manually to /opt/agent-sync/ on the server. No restart needed — scripts execute on-demand via cron.