# Send Prompt Safe to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "prompt-assemble",
    "name": "Prompt Safe",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/alexunitario-sketch/prompt-assemble",
    "canonicalUrl": "https://clawhub.ai/alexunitario-sketch/prompt-assemble",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/prompt-assemble",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=prompt-assemble",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "SKILL.md",
      "references/memory_standards.md",
      "references/token_estimation.md",
      "scripts/prompt_assemble.py"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/prompt-assemble"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/prompt-assemble",
    "downloadUrl": "https://openagent3.xyz/downloads/prompt-assemble",
    "agentUrl": "https://openagent3.xyz/skills/prompt-assemble/agent",
    "manifestUrl": "https://openagent3.xyz/skills/prompt-assemble/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/prompt-assemble/agent.md"
  }
}
```
## Documentation

### Overview

A 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.

Design Goals:

✅ Never fail due to memory-related token overflow
✅ Memory is always discardable enhancement, never rigid dependency
✅ Token budget decisions centralized at prompt assemble layer

### When to Use

Use this skill when:

Building or modifying any agent that constructs prompts
Implementing memory retrieval systems
Adding new prompt-related logic to existing agents
Any scenario where token budget safety is required

### Core Workflow

User Input
    ↓
Need-Memory Decision
    ↓
Minimal Context Build
    ↓
Memory Retrieval (Optional)
    ↓
Memory Summarization
    ↓
Token Estimation
    ↓
Safety Valve Decision
    ↓
Final Prompt → LLM Call

### Phase 0: Base Configuration

# Model Context Windows (2026-02-04)
# - MiniMax-M2.1: 204,000 tokens (default)
# - Claude 3.5 Sonnet: 200,000 tokens
# - GPT-4o: 128,000 tokens

MAX_TOKENS = 204000  # Set to your model's context limit
SAFETY_MARGIN = 0.75 * MAX_TOKENS  # Conservative: 75% threshold = 153,000 tokens
MEMORY_TOP_K = 3                     # Max 3 memories
MEMORY_SUMMARY_MAX = 3 lines        # Max 3 lines per memory

Design Philosophy:

Leave 25% buffer for safety (model overhead, estimation errors, spikes)
Better to underutilize capacity than to overflow

### Phase 1: Minimal Context

System prompt
Recent N messages (N=3, trimmed)
Current user input
No memory by default

### Phase 2: Memory Need Decision

def need_memory(user_input):
    triggers = [
        "previously",
        "earlier we discussed",
        "do you remember",
        "as I mentioned before",
        "continuing from",
        "before we",
        "last time",
        "previously mentioned"
    ]
    for trigger in triggers:
        if trigger.lower() in user_input.lower():
            return True
    return False

### Phase 3: Memory Retrieval (Optional)

memories = memory_search(query=user_input, top_k=MEMORY_TOP_K)
for mem in memories:
    summarized_memories.append(summarize(mem, max_lines=MEMORY_SUMMARY_MAX))

### Phase 4: Token Estimation

Calculate estimated tokens for base_context + summarized_memories.

### Phase 5: Safety Valve (Critical)

if estimated_tokens > SAFETY_MARGIN:
    base_context.append("[System Notice] Relevant memory skipped due to token budget.")
    return assemble(base_context)

Hard Rules:

❌ Never downgrade system prompt
❌ Never truncate user input
❌ No "lucky splicing"
✅ Only memory layer is expendable

### Phase 6: Final Assembly

final_prompt = assemble(base_context + summarized_memories)
return final_prompt

### Allowed in Long-Term Memory

✅ User preferences / identity / long-term goals
✅ Confirmed important conclusions
✅ System-level settings and rules

### Forbidden in Long-Term Memory

❌ Raw conversation logs
❌ Reasoning traces
❌ Temporary discussions
❌ Information recoverable from chat history

### Quick Start

Copy scripts/prompt_assemble.py to your agent and use:

from prompt_assemble import build_prompt

# In your agent's prompt construction:
final_prompt = build_prompt(user_input, memory_search_fn, get_recent_dialog_fn)

### scripts/

prompt_assemble.py - Complete implementation with all phases (PromptAssembler class)

### references/

memory_standards.md - Detailed memory content guidelines
token_estimation.md - Token counting strategies
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: alexunitario-sketch
- Version: 1.0.4
## Source health
- Status: healthy
- Source download looks usable.
- Yavira can redirect you to the upstream package for this source.
- Health scope: source
- Reason: direct_download_ok
- Checked at: 2026-04-30T16:55:25.780Z
- Expires at: 2026-05-07T16:55:25.780Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/prompt-assemble)
- [Send to Agent page](https://openagent3.xyz/skills/prompt-assemble/agent)
- [JSON manifest](https://openagent3.xyz/skills/prompt-assemble/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/prompt-assemble/agent.md)
- [Download page](https://openagent3.xyz/downloads/prompt-assemble)