Chris4K/agent-prompts
1
๐ฌ agent-prompts
FORGE Prompt & Persona Registry
No more hardcoded system prompts. Every agent fetches its persona at startup from here. Owns: prompt templates, personas, A/B test variants, approval workflow.
Seeded prompts (migrated from existing spaces)
REST API
GET /api/prompts List/search (agent, type, status, tag, q)
GET /api/prompts/{id} Get prompt (latest version)
GET /api/prompts/{id}/render Render โ pass variables as query params
GET /api/prompts/{id}/versions Version history
GET /api/prompts/{id}/ab A/B stats
POST /api/prompts Create/version a prompt
POST /api/prompts/{id}/approve Approve for production
POST /api/prompts/{id}/deprecate Deprecate
GET /api/personas List active personas
GET /api/personas/{agent} Get persona with rendered system prompt
POST /api/personas Upsert persona
POST /api/ab Record A/B outcome
GET /api/stats Registry statsMCP
GET /mcp/sse ยท POST /mcp
Tools: prompts_get, prompts_search, prompts_create, prompts_approve,
persona_get, persona_set, ab_record, prompts_statsIntegration pattern for existing spaces
Add PROMPTS_URL secret, then at startup:
import os, requests
PROMPTS_URL = os.getenv("PROMPTS_URL", "https://chris4k-agent-prompts.hf.space")
_cached_persona = None
def get_system_prompt(fallback: str) -> str:
global _cached_persona
if _cached_persona: return _cached_persona
try:
r = requests.get(f"{PROMPTS_URL}/api/personas/nexus", timeout=3)
_cached_persona = r.json().get("system_prompt", fallback)
return _cached_persona
except Exception:
return fallback # always safe โ never blocks startupSecrets
Built by Chris4K โ ki-fusion-labs.de
