REFINE_Project

REFINE is an adaptive skill engine for structured session diagnostics. Use this skill when a user explicitly requests: logging error patterns across sessions, maintaining session memory, generating System Prompt Patches from failure analysis, or structured feedback capture on ClawHub or SkillPay. Activate for requests about "error logging", "session memory", "patch synthesis", or "adaptive skill logging". Do not activate for general conversation or unrelated tasks.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "REFINE_Project" with this command: npx skills add dttnpole-commits/refine-agent

REFINE — Adaptive Session Diagnostics

A dual-mode skill engine. Captures error patterns and feedback labels locally, then (in PRO mode) synthesises System Prompt Patches from local failure analysis.

All data stays on local disk (refine_memory.json). No network calls are made.


What Gets Stored — Complete List

All caller-supplied data passes through sanitization before reaching disk.

SourceFieldSanitization applied
capture_feedback(feedback)feedbackTruncated to 300 chars
capture_feedback(context)contextSee Context Sanitization below
log_error(error)typeException class name only
log_error(error)messageFirst line only, truncated 300 chars
log_error(context)contextSee Context Sanitization below
Stack tracesNever stored
Raw promptsNever stored

Context Sanitization — Enforced by Code

The context dict argument in both capture_feedback() and log_error() is passed through _sanitize_context() before any write. This function:

  1. Blocks sensitive key names — keys matching token, key, secret, password, auth, api_key, bearer, credential, private, seed, hash, pin, ssn, credit, card, cvv → stored as [REDACTED — sensitive key name]
  2. Rejects nested objects — any dict or list value → [REMOVED — nested dict/list not stored]
  3. Truncates strings — all string values capped at 200 chars
  4. Limits keys — maximum 8 keys per context dict
  5. Scalar types onlystr, int, float, bool permitted; all other types → [REMOVED — unsupported type]

This is a code-level enforcement — it applies regardless of warnings in documentation. Sensitive data cannot reach the JSON file.


Mode Selection

REFINE_MODE is optional — defaults to BASIC if not set.

REFINE_MODEPlatformTierAuth required
BASIC (default)ClawHubFreeNone
PROSkillPayPaidSKILLPAY_TOKEN_HASH + header
# BASIC — no configuration needed
python main.py

# PRO — set both variables
export REFINE_MODE=PRO
export SKILLPAY_TOKEN_HASH=$(echo -n "your-token" | sha256sum | cut -d' ' -f1)

BASIC Mode

from main import build_engine

engine = build_engine()

# Safe: short diagnostic labels only
engine.capture_feedback("verbosity-high", context={"prompt_id": "p001"})

# Context is sanitized — api_key below will be stored as [REDACTED]
engine.capture_feedback("test", context={"api_key": "sk-..."})   # → [REDACTED]

try:
    risky_operation()
except Exception as exc:
    engine.log_error(exc, {"endpoint": "/api/v1"})   # context sanitized

history = engine.get_history(limit=10)
engine.close()

PRO Mode

import os
from main import build_engine, SKILLPAY_HDR

token   = your_secret_manager.get("skillpay-token")
headers = {SKILLPAY_HDR: token}

engine = build_engine(auth_headers=headers)

report = engine.evolve()   # analyse local errors → synthesise patch
patch  = engine.get_latest_patch()
if patch:
    next_system_prompt = patch["patch_body"] + "\n\n" + base_system_prompt

engine.close()

Security

ConcernImplementation
Token comparisonhmac.compare_digest — stdlib hmac, constant-time
Token in logsNever — 8-char hash prefix only
Token storageSKILLPAY_TOKEN_HASH env var only
Context dictsSanitized by _sanitize_context() before any disk write
Sensitive keysBlocked by regex — stored as [REDACTED]
Nested objectsRejected — stored as [REMOVED]
String valuesTruncated to 200 chars in context, 300 chars elsewhere
Stack tracesNever stored
Network callsNone — fully offline
File writesAtomic temp-file rename

Environment Variables

All optional:

VariableDefaultDescription
REFINE_MODEBASICBASIC or PRO
SKILLPAY_TOKEN_HASH(none)SHA-256 hex of token; PRO only
LOG_LEVELINFODEBUG / INFO / WARNING / ERROR

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

yan-learning-engine

yan-learning-engine自动每小时驱动炎月执行预设学习和贡献任务,促进持续自我进化和技术积累。

Registry SourceRecently Updated
4050Profile unavailable
Automation

Rune - Self-Improving AI Memory

Self-improving AI memory system with intelligent context injection and adaptive learning

Registry SourceRecently Updated
6960Profile unavailable
Research

Learning & Skill Acquisition Engine

Help users learn skills faster, retain knowledge longer, and apply it effectively using evidence-based strategies and structured learning phases.

Registry SourceRecently Updated
2060Profile unavailable
Research

Thinking Framework

Loads any thinker's, leader's, philosopher's, or organization's complete mental operating system directly into the AI — so the AI reasons FROM inside that co...

Registry SourceRecently Updated
3550Profile unavailable