Xpersona
S

self-improving-ai

CLAWHUB · Unverified

Captures learnings about GenAI/LLM configuration, model selection, inference optimization, fine-tuning, RAG pipelines, prompt engineering, multimodal processing, and cost management. Use when: (1) Model response quality degrades after a provider update or version change, (2) Inference latency exceeds acceptable thresholds, (3) Fine-tuned model regresses on evaluation benchmarks, (4) RAG retrieval returns irrelevant or stale chunks, (5) Token costs exceed budget projections, (6) Hallucination rate increases on factual queries, (7) Context window overflows cause critical information truncation, (8) Multimodal pipeline fails on specific input types (image, audio, video, PDF), (9) A better model or configuration is discovered for a task, (10) Guardrails block valid output or miss harmful content. Skill: self-improving-ai Owner: jose-compu Summary: Captures learnings about GenAI/LLM configuration, model selection, inference optimization, fine-tuning, RAG pipelines, prompt engineering, multimodal processing, and cost management. Use when: (1) Model response quality degrades after a provider update or version change, (2) Inference latency exceeds acceptable thresholds, (3) Fine-tuned model regresses on evaluatio

62
Rank
84
Safety
1.1k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.1K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: medium.

clawhub skill install s17bzpdy0evfmqz6nx069npr3n84p7f2:self-improving-ai
  1. Setup complexity is MEDIUM. Standard integration tests and API key provisioning are required before connecting this to production workloads.
  2. 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: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-jose-compu-self-improving-ai/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

144,705 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: self-improving-ai
description: "Captures learnings about GenAI/LLM configuration, model selection, inference optimization, fine-tuning, RAG pipelines, prompt engineering, multimodal processing, and cost management. Use when: (1) Model response quality degrades after a provider update or version change, (2) Inference latency exceeds acceptable thresholds, (3) Fine-tuned model regresses on evaluation benchmarks, (4) RAG retrieval returns irrelevant or stale chunks, (5) Token costs exceed budget projections, (6) Hallucination rate increases on factual queries, (7) Context window overflows cause critical information truncation, (8) Multimodal pipeline fails on specific input types (image, audio, video, PDF), (9) A better model or configuration is discovered for a task, (10) Guardrails block valid output or miss harmful content."
---

# Self-Improving AI Skill

Log AI/LLM-specific learnings, model issues, and feature requests to markdown files for continuous improvement. Captures model selection insights, prompt optimization patterns, inference tuning, fine-tuning regressions, RAG pipeline improvements, embedding management, multimodal processing failures, evaluation findings, and guardrail adjustments. Important learnings get promoted to model selection matrices, prompt libraries, fine-tuning runbooks, RAG architecture docs, inference optimization checklists, evaluation benchmarks, or guardrail policies.

## First-Use Initialisation

Before logging anything, ensure the `.learnings/` directory and files exist in the project or workspace root. If any are missing, create them:

```bash
mkdir -p .learnings
[ -f .learnings/LEARNINGS.md ] || printf "# AI / LLM Learnings\n\nModel selection insights, prompt optimization patterns, inference tuning, fine-tuning lessons, RAG pipeline improvements, embedding management, multimodal processing, evaluation findings, and guardrail adjustments.\n\n**Categories**: model_selection | prompt_optimization | inference_latency | fine_tune_regression | context_management | modality_gap | hallucination_rate | cost_efficiency\n**Areas**: model_config | prompt_engineering | fine_tuning | rag_pipeline | inference | embeddings | multimodal | evaluation | guardrails\n\n---\n" > .learnings/LEARNINGS.md
[ -f .learnings/MODEL_ISSUES.md ] || printf "# Model Issues Log\n\nInference failures, model regressions, RAG retrieval problems, embedding drift, multimodal pipeline errors, and guardrail misfires.\n\n---\n" > .learnings/MODEL_ISSUES.md
[ -f .learnings/FEATURE_REQUESTS.md ] || printf "# Feature Requests\n\nCapabilities needed for model selection, inference optimization, fine-tuning, RAG pipelines, multimodal processing, and evaluation.\n\n---\n" > .learnings/FEATURE_REQUESTS.md
```

Never overwrite existing files. This is a no-op if `.learnings/` is already initialised.

Do not log API keys, model access tokens, customer data, or PII. Prefer redacted excerpts over raw model outputs. Mask user inputs and sensitive content i

_meta.json

{
  "ownerId": "kn78jat5kd20evgyxzp9dmryax84qap0",
  "slug": "self-improving-ai",
  "version": "1.1.1",
  "publishedAt": 1787943425443
}

references/examples.md

# Entry Examples

Concrete examples of well-formatted AI/LLM entries with all fields.

## Learning: Model Selection (Code Generation)

```markdown
## [LRN-20250415-001] model_selection

**Logged**: 2025-04-15T10:30:00Z
**Priority**: high
**Status**: resolved
**Area**: model_config

### Summary
Switched from GPT-4o to Claude Sonnet for code generation; 23% improvement on HumanEval, 40% cost reduction

### Details
Evaluated Claude 4 Sonnet against GPT-4o on our internal code generation benchmark (500 multi-file
edit tasks). Sonnet scored 89.2% vs GPT-4o's 72.5% on correct first-attempt edits. Sonnet is
significantly better at following complex multi-file edit instructions where changes span 3+ files
with interdependencies. GPT-4o tended to miss downstream type changes in dependent files.

Cost comparison at 1M tokens/day: GPT-4o ~$45/day vs Sonnet ~$27/day (40% reduction).

### Impact
- **Quality**: 23% improvement on HumanEval pass@1 (72.5% → 89.2%)
- **Cost**: 40% reduction in daily API spend
- **Latency**: Comparable (Sonnet P50: 1.2s, GPT-4o P50: 1.1s)

### Suggested Action
Update model selection matrix: use Claude Sonnet as default for code generation tasks.
Keep GPT-4o as fallback and for tasks requiring function calling with complex schemas.

### Metadata
- Source: benchmark_evaluation
- Model: claude-4-sonnet vs gpt-4o
- Provider: anthropic vs openai
- Modality: text
- Temperature: 0.1
- Token Usage: avg 2,400 input / 1,800 output per task
- Latency: Sonnet P50 1,200ms / GPT-4o P50 1,100ms
- Cost: Sonnet $0.027/task vs GPT-4o $0.045/task
- Tags: model-selection, code-generation, benchmark, cost-optimization
- Pattern-Key: model_selection.code_generation

---
```

## Learning: Prompt Optimization (Chain-of-Thought)

```markdown
## [LRN-20250416-001] prompt_optimization

**Logged**: 2025-04-16T14:00:00Z
**Priority**: medium
**Status**: resolved
**Area**: prompt_engineering

### Summary
Adding "Think step by step before writing code" to system prompt reduced bug rate by 35% on internal eval

### Details
Tested chain-of-thought prompting on our internal eval suite (200 coding tasks with known correct
solutions). Adding "Think step by step before writing code. Identify edge cases before
implementing." to the system prompt reduced incorrect outputs from 31% to 20% (35% relative
improvement).

Effect varies by model:
- Claude 4 Sonnet: 28% → 16% error rate (43% improvement)
- GPT-4o: 34% → 24% error rate (29% improvement)
- Llama 3.1 70B: 45% → 42% error rate (7% improvement — minimal effect)
- Mistral Large: 38% → 30% error rate (21% improvement)

The improvement is most pronounced on tasks requiring multi-step reasoning. Smaller models
(<30B parameters) show minimal benefit, likely because they lack the capacity to execute
chain-of-thought effectively.

### Suggested Action
Add chain-of-thought instruction to system prompt for all code generation tasks using
models >30B parameters. Do not apply to small/fast models as it wastes tokens without be

references/hooks-setup.md

# Hook Setup Guide

Configure automatic AI/LLM self-improvement triggers for AI coding agents.

## Overview

Hooks enable proactive AI-pattern capture by injecting reminders at key moments:
- **UserPromptSubmit**: Reminder after matching prompts to evaluate AI/model learnings
- **PostToolUse (Bash)**: Error detection when model API calls, inference, or RAG operations fail

Note: For model API calls specifically, consider using a PostToolUse matcher to detect API errors from provider SDKs (Anthropic, OpenAI, etc.).

## Claude Code Setup

### Option 1: Project-Level Configuration

Create `.claude/settings.json` in your project root:

```json
{
  "hooks": {
    "UserPromptSubmit": [
      {
        "matcher": "model|inference|prompt|rag|embed|hallucin|latency|fine-tune|guardrail",
        "hooks": [
          {
            "type": "command",
            "command": "./skills/self-improving-ai/scripts/activator.sh"
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "./skills/self-improving-ai/scripts/error-detector.sh"
          }
        ]
      }
    ]
  }
}
```

### Option 2: User-Level Configuration (discouraged)

Do **not** install this hook globally. User-level hooks persist across all repositories and sessions. Keep hooks project-scoped. The example below is shown only so you can recognize and remove it:

```json
{
  "hooks": {
    "UserPromptSubmit": [
      {
        "matcher": "model|inference|prompt|rag|embed|hallucin|latency|fine-tune|guardrail",
        "hooks": [
          {
            "type": "command",
            "command": "~/.claude/skills/self-improving-ai/scripts/activator.sh"
          }
        ]
      }
    ]
  }
}
```

### Minimal Setup (Activator Only)

For lower overhead, use only the UserPromptSubmit hook:

```json
{
  "hooks": {
    "UserPromptSubmit": [
      {
        "matcher": "model|inference|prompt|rag|embed|hallucin|latency|fine-tune|guardrail",
        "hooks": [
          {
            "type": "command",
            "command": "./skills/self-improving-ai/scripts/activator.sh"
          }
        ]
      }
    ]
  }
}
```

## Codex CLI Setup

Codex uses the same hook system. Create `.codex/settings.json`:

```json
{
  "hooks": {
    "UserPromptSubmit": [
      {
        "matcher": "model|inference|prompt|rag|embed|hallucin|latency|fine-tune|guardrail",
        "hooks": [
          {
            "type": "command",
            "command": "./skills/self-improving-ai/scripts/activator.sh"
          }
        ]
      }
    ]
  }
}
```

## GitHub Copilot Setup

Copilot doesn't support hooks. Add guidance to `.github/copilot-instructions.md`:

```markdown
## AI Self-Improvement

After encountering AI/model issues, consider logging to `.learnings/`:
- Model quality drops, latency spikes, inference failures → MODEL_ISSUES.md
- Model selection insights, prompt patterns, hallucinations → LEARNINGS.md

references/openclaw-integration.md

# OpenClaw Integration

Complete setup and usage guide for integrating the self-improving-ai skill with OpenClaw.

## Overview

OpenClaw uses workspace-based prompt injection combined with event-driven hooks. Context is injected from workspace files at session start, and hooks can trigger on lifecycle events.

## Workspace Structure

```
~/.openclaw/
├── workspace/                   # Working directory
│   ├── AGENTS.md               # Multi-agent coordination, model routing
│   ├── SOUL.md                 # Model behavior guidelines, personality
│   ├── TOOLS.md                # Model/tool configuration, parameters
│   ├── MEMORY.md               # Long-term memory (main session only)
│   └── memory/                 # Daily memory files
│       └── YYYY-MM-DD.md
├── skills/                      # Installed skills
│   └── self-improving-ai/
│       └── SKILL.md
└── hooks/                       # Custom hooks
    └── self-improving-ai/
        ├── HOOK.md
        └── handler.ts
```

## Quick Setup

### 1. Install the Skill

```bash
clawdhub install self-improving-ai
```

Or copy manually:

```bash
cp -r self-improving-ai ~/.openclaw/skills/
```

### 2. Install the Hook (Optional)

```bash
cp -r hooks/openclaw ~/.openclaw/hooks/self-improving-ai
openclaw hooks enable self-improving-ai
```

### 3. Create Learning Files

```bash
mkdir -p ~/.openclaw/workspace/.learnings
```

## Promotion Targets (AI-Specific)

When AI/model learnings prove broadly applicable, promote them to workspace files:

| Learning Type | Promote To | Example |
|---------------|------------|---------|
| Model behavior patterns | `SOUL.md` | "Claude 4 tends to over-qualify, use direct prompting" |
| Model selection and routing | `AGENTS.md` | "Use fast model for triage, capable model for code gen" |
| Model/tool configuration | `TOOLS.md` | "Set temperature 0.1 for code, 0.7 for creative" |
| Model selection insights | Model selection matrix | "Sonnet for code gen, Opus for complex reasoning" |
| Prompt patterns | Prompt library | "Chain-of-thought improves code quality by 35%" |
| Fine-tuning lessons | Fine-tuning runbook | "Always include replay data to prevent forgetting" |
| RAG improvements | RAG architecture doc | "Chunk by content type, not fixed token size" |
| Inference optimizations | Performance tuning guide | "Cache system prompts, batch similar requests" |
| Evaluation findings | Benchmark suite docs | "HumanEval + internal eval for code gen models" |
| Guardrail tuning | Guardrail policy doc | "Lower toxicity threshold for customer-facing" |

### Promotion Decision Tree

```
Is it about which model to use?
├── Yes → Model selection matrix
└── No → Is it about how to prompt?
    ├── Yes → Prompt library
    └── No → Is it about model behavior/personality?
        ├── Yes → SOUL.md
        └── No → Is it about model workflow/routing?
            ├── Yes → AGENTS.md
            └── No → Is it about model configuration?
                ├── Yes → TOOLS.md
               

Sponsored

Ads related to self-improving-ai and adjacent AI workflows.