Strategy Constitutional Memory for Openclaw

A living knowledge base of hard-earned strategy lessons and banned code patterns that prevents repeating past mistakes by scanning code for violations.

tltby12341
v1.0.0
Mar 17, 2026
0
818
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install strategy-constitutional-memory

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 strategy-constitutional-memory 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 Strategy Constitutional Memory?

Strategy Constitutional Memory is a specialized tool designed to solve the problem of amnesia in iterative development. In complex environments like algorithmic trading or strategic modeling, the biggest risk is re-testing approaches that have already failed. This skill acts as a permanent record—a constitution—that an AI agent must consult before generating new code.

By maintaining a structured history of lessons learned and a blacklist of prohibited code patterns, it ensures that failures become permanent knowledge. It provides a robust framework for Openclaw Skills to maintain high standards of code integrity and strategic consistency across dozens of iterations.

Strategy Constitutional Memory Use Cases

  • Starting a new strategy iteration and needing to recall critical lessons from past failures.
  • Scanning newly written strategy code for prohibited patterns or known catastrophic bugs.
  • Automatically documenting lessons after a failed backtest or performance review.
  • Generating high-context system prompts for LLMs to ensure they don't propose banned methodologies.

How Strategy Constitutional Memory Works

  1. The system initializes a local memory directory to persist lessons and banned patterns in human-readable JSON format.
  2. Developers or AI agents record lessons by specifying the strategy version, category of failure, evidence, and severity.
  3. Prohibited code patterns are added to a global ban list which the scanner uses to inspect new code strings.
  4. Before code generation, the skill compiles these lessons into a formatted context block for the LLM.
  5. Post-generation, the scanner performs a case-insensitive check (skipping comments and strings) to ensure no banned patterns were introduced.

Strategy Constitutional Memory Setup

To integrate this into your workflow, ensure you have python3 installed and follow these steps:

# Install the necessary orchestrator components
python3 -m pip install openclaw-strategy-memory

# Initialize the memory directory
python3 -m orchestrator briefing

# Seed your initial history if starting a new project
python3 -c "from memory_system import ConstitutionalMemory; ConstitutionalMemory('./memory').seed_from_history()"

Strategy Constitutional Memory Data Schema & Taxonomy

The skill manages two primary JSON files within the memory/ directory to ensure transparency and ease of manual editing:

File Description Key Fields
lessons.json A chronological log of strategy outcomes. strategy, category, description, evidence, severity
bans.json A flat list of prohibited strings/patterns. Case-insensitive strings (e.g., "SetHoldings", "XGBClassifier")

Severity Taxonomy: critical > high > medium > low

Strategy Constitutional Memory Advanced Features

  • Auto-extraction: Automatically generates lessons by analyzing raw diagnosis reports and failure logs.
  • Intelligent Scanner: Advanced parsing that ignores comments and multi-line strings to prevent false positives.
  • Append-only Architecture: Ensures the integrity of the knowledge base by treating lessons as immutable records.
  • Blueprint Integration: Supports tracking lessons against specific strategy dimensions like position sizing or timing.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*