Prompt Assemble for Openclaw

A standardized prompt assembly framework designed to guarantee AI agent stability by preventing token overflow through intelligent memory orchestration.

alexunitario-sketch
v1.0.4
Feb 4, 2026
4
3.1k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install prompt-assemble

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install prompt-assemble using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Prompt Assemble?

Prompt Assemble provides a robust foundation for building reliable agents within the Openclaw Skills ecosystem. It addresses the common challenge of API failures caused by context window exhaustion by implementing a Two-Phase Context Construction strategy. This framework treats memory as a discardable enhancement rather than a rigid dependency, ensuring that critical instructions and user inputs are always preserved while supplementary context is managed dynamically.

By centralizing token budget decisions at the assembly layer, Prompt Assemble allows developers to maximize the utility of large context windows in models like Claude 3.5 or GPT-4o without the risk of hitting hard limits. This approach is essential for any production-grade implementation of Openclaw Skills that relies on long-term memory retrieval or complex dialogue histories.

Prompt Assemble Use Cases

  • Building or modifying autonomous agents that require dynamic prompt construction.
  • Implementing Retrieval-Augmented Generation (RAG) systems where memory safety is a priority.
  • Scaling agent capabilities to handle large-scale context windows without risking API crashes.
  • Standardizing memory injection logic across multiple Openclaw Skills to ensure consistent performance.

How Prompt Assemble Works

  1. The system analyzes user input to determine if historical context or memory retrieval is necessary.
  2. A minimal context is constructed, prioritizing the system prompt and the most recent dialogue messages.
  3. If required, the system performs a memory search and summarizes the results to a predefined maximum line count.
  4. A token estimation is calculated for the combined base context and the summarized memory segments.
  5. The Safety Valve checks the estimate against a conservative threshold (typically 75% of the total context window).
  6. If the budget is exceeded, the memory layer is discarded in favor of a system notice to ensure the LLM call still succeeds.

Prompt Assemble Setup

To integrate this framework into your agent, copy the implementation script and configure your model limits. This is a core component for maintaining stable Openclaw Skills.

# Copy the prompt assembler to your project
cp scripts/prompt_assemble.py ./src/agents/utils/
# Basic usage in your agent logic
from prompt_assemble import build_prompt

final_prompt = build_prompt(user_input, memory_search_fn, get_recent_dialog_fn)

Prompt Assemble Data Schema & Taxonomy

Variable Default Value Purpose
MAX_TOKENS 204,000 The hard limit of the target model context window
SAFETY_MARGIN 0.75 * MAX The threshold where memory injection is halted
MEMORY_TOP_K 3 Maximum number of memory segments to retrieve
MEMORY_SUMMARY_MAX 3 lines Maximum summarization length for each memory segment

Prompt Assemble Advanced Features

  • Two-Phase Context Construction that separates essential instructions from expendable memory.
  • Intelligent trigger detection to determine when memory retrieval is actually required.
  • Hard safety rules that prevent the truncation of user inputs or system prompts.
  • Centralized token budget management compatible with the latest high-context LLMs used in Openclaw Skills.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*