{"id":"2b7cd428-bf1b-4d6b-938f-d59ff3aaa7ac","entityType":"agent","slug":"clawhub-skills-alexunitario-sketch-prompt-assemble","name":"prompt-assemble","canonicalUrl":"https://www.xpersona.co/agent/clawhub-skills-alexunitario-sketch-prompt-assemble","canonicalPath":"/agent/clawhub-skills-alexunitario-sketch-prompt-assemble","generatedAt":"2026-10-10T07:11:18.101Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":null},"description":"Token-safe prompt assembly with memory orchestration. Use for any agent that needs to construct LLM prompts with memory retrieval. Guarantees no API failure due to token overflow. Implements two-phase context construction, memory safety valve, and hard limits on memory injection. --- name: prompt-assemble description: Token-safe prompt assembly with memory orchestration. Use for any agent that needs to construct LLM prompts with memory retrieval. Guarantees no API failure due to token overflow. Implements two-phase context construction, memory safety valve, and hard limits on memory injection. --- Prompt Assemble Overview A standardized, token-safe prompt assembly framework that guarantees AP","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. Last updated 4/15/2026.","installCommand":"clawhub skill install skills:alexunitario-sketch:prompt-assemble","sourceUrl":"https://github.com/openclaw/skills/tree/main/skills/alexunitario-sketch/prompt-assemble","homepage":null,"primaryLinks":[{"label":"View on ClawHub","url":"https://github.com/openclaw/skills/tree/main/skills/alexunitario-sketch/prompt-assemble","kind":"source"}],"safetyScore":84,"overallRank":62,"popularityScore":50,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Token-safe prompt assembly with memory orchestration. Use for any agent that needs to construct LLM prompts with memory retrieval. Guarantees no API failure due"},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"no-adoption-signals","verified":false,"confidence":"low","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":"No source adoption metrics were available."},"stars":null,"forks":null,"downloads":null,"packageName":null,"latestVersion":null,"tractionLabel":null},"release":{"evidence":{"source":"agent-index","verified":false,"confidence":"medium","updatedAt":"2026-02-25T05:58:55.419Z","emptyReason":null},"lastUpdatedAt":"2026-04-15T00:45:39.800Z","lastCrawledAt":"2026-02-25T05:58:55.419Z","lastIndexedAt":null,"nextCrawlAt":"2026-02-26T05:58:55.419Z","lastVerifiedAt":null,"highlights":[]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install skills:alexunitario-sketch:prompt-assemble","setupComplexity":"low","setupSteps":["Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-skills-alexunitario-sketch-prompt-assemble/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-skills-alexunitario-sketch-prompt-assemble/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-skills-alexunitario-sketch-prompt-assemble/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-skills-alexunitario-sketch-prompt-assemble/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-skills-alexunitario-sketch-prompt-assemble/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-skills-alexunitario-sketch-prompt-assemble/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-10T07:11:18.101Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-skills-alexunitario-sketch-prompt-assemble/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-skills-alexunitario-sketch-prompt-assemble/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-skills-alexunitario-sketch-prompt-assemble/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-skills-alexunitario-sketch-prompt-assemble/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":null},"readme":"---\nname: prompt-assemble\ndescription: Token-safe prompt assembly with memory orchestration. Use for any agent that needs to construct LLM prompts with memory retrieval. Guarantees no API failure due to token overflow. Implements two-phase context construction, memory safety valve, and hard limits on memory injection.\n---\n\n# Prompt Assemble\n\n## Overview\n\nA standardized, token-safe prompt assembly framework that guarantees API stability. Implements **Two-Phase Context Construction** and **Memory Safety Valve** to prevent token overflow while maximizing relevant context.\n\n**Design Goals:**\n- ✅ Never fail due to memory-related token overflow\n- ✅ Memory is always discardable enhancement, never rigid dependency\n- ✅ Token budget decisions centralized at prompt assemble layer\n\n## When to Use\n\nUse this skill when:\n1. Building or modifying any agent that constructs prompts\n2. Implementing memory retrieval systems\n3. Adding new prompt-related logic to existing agents\n4. Any scenario where token budget safety is required\n\n## Core Workflow\n\n```\nUser Input\n    ↓\nNeed-Memory Decision\n    ↓\nMinimal Context Build\n    ↓\nMemory Retrieval (Optional)\n    ↓\nMemory Summarization\n    ↓\nToken Estimation\n    ↓\nSafety Valve Decision\n    ↓\nFinal Prompt → LLM Call\n```\n\n## Phase Details\n\n### Phase 0: Base Configuration\n```python\n# Model Context Windows (2026-02-04)\n# - MiniMax-M2.1: 204,000 tokens (default)\n# - Claude 3.5 Sonnet: 200,000 tokens\n# - GPT-4o: 128,000 tokens\n\nMAX_TOKENS = 204000  # Set to your model's context limit\nSAFETY_MARGIN = 0.75 * MAX_TOKENS  # Conservative: 75% threshold = 153,000 tokens\nMEMORY_TOP_K = 3                     # Max 3 memories\nMEMORY_SUMMARY_MAX = 3 lines        # Max 3 lines per memory\n```\n\n**Design Philosophy**:\n- Leave 25% buffer for safety (model overhead, estimation errors, spikes)\n- Better to underutilize capacity than to overflow\n\n### Phase 1: Minimal Context\n- System prompt\n- Recent N messages (N=3, trimmed)\n- Current user input\n- **No memory by default**\n\n### Phase 2: Memory Need Decision\n```python\ndef need_memory(user_input):\n    triggers = [\n        \"previously\",\n        \"earlier we discussed\",\n        \"do you remember\",\n        \"as I mentioned before\",\n        \"continuing from\",\n        \"before we\",\n        \"last time\",\n        \"previously mentioned\"\n    ]\n    for trigger in triggers:\n        if trigger.lower() in user_input.lower():\n            return True\n    return False\n```\n\n### Phase 3: Memory Retrieval (Optional)\n```python\nmemories = memory_search(query=user_input, top_k=MEMORY_TOP_K)\nfor mem in memories:\n    summarized_memories.append(summarize(mem, max_lines=MEMORY_SUMMARY_MAX))\n```\n\n### Phase 4: Token Estimation\nCalculate estimated tokens for base_context + summarized_memories.\n\n### Phase 5: Safety Valve (Critical)\n```python\nif estimated_tokens > SAFETY_MARGIN:\n    base_context.append(\"[System Notice] Relevant memory skipped due to token budget.\")\n    return assemble(base_context)\n```\n\n**Hard Rules:**\n- ❌ Never downgrade system prompt\n- ❌ Never truncate user input\n- ❌ No \"lucky splicing\"\n- ✅ Only memory layer is expendable\n\n### Phase 6: Final Assembly\n```python\nfinal_prompt = assemble(base_context + summarized_memories)\nreturn final_prompt\n```\n\n## Memory Data Standards\n\n### Allowed in Long-Term Memory\n- ✅ User preferences / identity / long-term goals\n- ✅ Confirmed important conclusions\n- ✅ System-level settings and rules\n\n### Forbidden in Long-Term Memory\n- ❌ Raw conversation logs\n- ❌ Reasoning traces\n- ❌ Temporary discussions\n- ❌ Information recoverable from chat history\n\n## Quick Start\n\nCopy `scripts/prompt_assemble.py` to your agent and use:\n\n```python\nfrom prompt_assemble import build_prompt\n\n# In your agent's prompt construction:\nfinal_prompt = build_prompt(user_input, memory_search_fn, get_recent_dialog_fn)\n```\n\n## Resources\n\n### scripts/\n- `prompt_assemble.py` - Complete implementation with all phases (PromptAssembler class)\n\n### references/\n- `memory_standards.md` - Detailed memory content guidelines\n- `token_estimation.md` - Token counting strategies\n","readmeExcerpt":"--- name: prompt-assemble description: Token-safe prompt assembly with memory orchestration. Use for any agent that needs to construct LLM prompts with memory retrieval. Guarantees no API failure due to token overflow. Implements two-phase context construction, memory safety valve, and hard limits on memory injection. --- Prompt Assemble Overview A standardized, token-safe prompt assembly framework that guarantees AP","codeSnippets":[],"executableExamples":[{"language":"text","snippet":"User Input\n    ↓\nNeed-Memory Decision\n    ↓\nMinimal Context Build\n    ↓\nMemory Retrieval (Optional)\n    ↓\nMemory Summarization\n    ↓\nToken Estimation\n    ↓\nSafety Valve Decision\n    ↓\nFinal Prompt → LLM Call"},{"language":"python","snippet":"# Model Context Windows (2026-02-04)\n# - MiniMax-M2.1: 204,000 tokens (default)\n# - Claude 3.5 Sonnet: 200,000 tokens\n# - GPT-4o: 128,000 tokens\n\nMAX_TOKENS = 204000  # Set to your model's context limit\nSAFETY_MARGIN = 0.75 * MAX_TOKENS  # Conservative: 75% threshold = 153,000 tokens\nMEMORY_TOP_K = 3                     # Max 3 memories\nMEMORY_SUMMARY_MAX = 3 lines        # Max 3 lines per memory"},{"language":"python","snippet":"def need_memory(user_input):\n    triggers = [\n        \"previously\",\n        \"earlier we discussed\",\n        \"do you remember\",\n        \"as I mentioned before\",\n        \"continuing from\",\n        \"before we\",\n        \"last time\",\n        \"previously mentioned\"\n    ]\n    for trigger in triggers:\n        if trigger.lower() in user_input.lower():\n            return True\n    return False"},{"language":"python","snippet":"memories = memory_search(query=user_input, top_k=MEMORY_TOP_K)\nfor mem in memories:\n    summarized_memories.append(summarize(mem, max_lines=MEMORY_SUMMARY_MAX))"},{"language":"python","snippet":"if estimated_tokens > SAFETY_MARGIN:\n    base_context.append(\"[System Notice] Relevant memory skipped due to token budget.\")\n    return assemble(base_context)"},{"language":"python","snippet":"final_prompt = assemble(base_context + summarized_memories)\nreturn final_prompt"}],"parameters":{},"dependencies":[],"permissions":[],"extractedFiles":[],"languages":["typescript"],"docsSourceLabel":"CLAWHUB","editorialOverview":"Token-safe prompt assembly with memory orchestration. Use for any agent that needs to construct LLM prompts with memory retrieval. Guarantees no API failure due to token overflow. Implements two-phase context construction, memory safety valve, and hard limits on memory injection. --- name: prompt-assemble description: Token-safe prompt assembly with memory orchestration. Use for any agent that needs to construct LLM prompts with memory retrieval. Guarantees no API failure due to token overflow. Implements two-phase context construction, memory safety valve, and hard limits on memory injection. --- Prompt Assemble Overview A standardized, token-safe prompt assembly framework that guarantees AP","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":404,"uniquenessScore":61,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-10T07:11:18.101Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}