fix(template): blocants laptop — metabolism, scripts VPS, profil/contexts
- metabolism/README.md créé (référencé par 3 contexts) - scripts/brain-watch-vps.sh : paths /home/tetardtek → <user>, git url → <GITEA_URL> - scripts/install-brain-watch.sh : path hardcodé → <user> - scripts/kernel-isolation-check.sh : commentaire exemple → alice - profil/contexts/ : session-deploy + session-handoff supprimés (owner-specific) Vérification : grep tetardtek → ZÉRO FUITE ABSOLUE
This commit is contained in:
48
metabolism/README.md
Normal file
48
metabolism/README.md
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
---
|
||||||
|
name: metabolism
|
||||||
|
type: layer
|
||||||
|
context_tier: warm
|
||||||
|
---
|
||||||
|
|
||||||
|
# Metabolism — Couche de santé session
|
||||||
|
|
||||||
|
> Métriques de consommation cognitive par session.
|
||||||
|
> Analogue biologique : comment le brain consomme des ressources pour fonctionner.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Ce que le metabolism mesure
|
||||||
|
|
||||||
|
Par session :
|
||||||
|
- **Tokens consommés** — coût context réel
|
||||||
|
- **Pic de context** — saturation atteinte (%)
|
||||||
|
- **Agents chargés** — liste + coût estimé par agent
|
||||||
|
- **Health score** — indicateur composite de santé
|
||||||
|
- **Durée / commits / todos fermés** — productivité
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Composants
|
||||||
|
|
||||||
|
| Fichier | Rôle |
|
||||||
|
|---------|------|
|
||||||
|
| `profil/metabolism-spec.md` | Schéma complet des métriques + formules |
|
||||||
|
| `agents/metabolism-scribe.md` | Agent qui capture et persiste les métriques |
|
||||||
|
| `workspace/metabolism/` | Données par session (générées par metabolism-scribe) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Ce que le metabolism N'est PAS
|
||||||
|
|
||||||
|
- Pas la feature gate (c'est `brain-compose.yml` + `key-guardian`)
|
||||||
|
- Pas l'état des sessions actives (c'est `workspace/live-states.md`)
|
||||||
|
- Pas l'historique BSI (c'est `claims/*.yml`)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Lecture rapide
|
||||||
|
|
||||||
|
```
|
||||||
|
agents/metabolism-scribe.md → comment capturer
|
||||||
|
profil/metabolism-spec.md → schéma complet des champs
|
||||||
|
```
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
# session-deploy.yml — Contexte BHP pour sessions de déploiement
|
|
||||||
# Trigger : "brain boot mode deploy[/<project>]"
|
|
||||||
# Cible : ~25% contexte max au boot
|
|
||||||
|
|
||||||
session_type: deploy
|
|
||||||
description: "Session de déploiement — VPS, Docker, SSL, CI/CD, infra"
|
|
||||||
tier_required: pro # deploy = agents vps/ci-cd/monitoring (tous pro)
|
|
||||||
|
|
||||||
# L0 — Invariant (~5%)
|
|
||||||
L0:
|
|
||||||
- PATHS.md
|
|
||||||
- brain-compose.local.yml
|
|
||||||
- KERNEL.md
|
|
||||||
|
|
||||||
# L1 — Session type (~15%)
|
|
||||||
L1:
|
|
||||||
- agents/vps.md # VPS, Apache, Docker, SSL, vhost, certbot # tier: pro
|
|
||||||
- agents/ci-cd.md # pipelines, GitHub Actions, Gitea CI # tier: pro
|
|
||||||
- agents/monitoring.md # Kuma, alertes, logs post-déploiement # tier: pro
|
|
||||||
|
|
||||||
# L2 — Project scope (~8%) — optionnel sur projet déclaré
|
|
||||||
L2:
|
|
||||||
template: "projets/{project}.md"
|
|
||||||
extras:
|
|
||||||
- "todo/{project}.md"
|
|
||||||
fallback: null
|
|
||||||
|
|
||||||
# L3 — On demand
|
|
||||||
# Exemples : agents/security.md (audit pré-deploy), agents/mail.md (DNS/DKIM),
|
|
||||||
# agents/pm2.md, agents/migration.md, config spécifique
|
|
||||||
L3:
|
|
||||||
hint: "Charger à la demande : security pre-deploy, mail/DNS, pm2, migration schema"
|
|
||||||
|
|
||||||
# --- Règle deploy ---
|
|
||||||
# agents/security.md NOT en L1 par défaut — deploy ≠ audit sécurité.
|
|
||||||
# Charger si audit pré-déploiement explicitement demandé (→ session-audit).
|
|
||||||
# agents/monitoring.md en L1 : toujours vérifier les alertes après deploy.
|
|
||||||
|
|
||||||
# --- Métriques cibles ---
|
|
||||||
context_target:
|
|
||||||
L0: "~5%"
|
|
||||||
L1: "~12%"
|
|
||||||
L2: "~8%"
|
|
||||||
total_boot: "~25%"
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
# session-handoff.yml — Contexte BHP pour sessions HANDOFF
|
|
||||||
# Trigger : "brain boot mode HANDOFF[/<handoff-id>]"
|
|
||||||
# Cible : ~15% contexte max au boot — minimum viable pour reprendre
|
|
||||||
|
|
||||||
session_type: HANDOFF
|
|
||||||
description: "Reprise d'une session via handoff — contexte minimal + fichier handoff cible"
|
|
||||||
tier_required: free # handoff = protocole BSI de base — disponible pour tous
|
|
||||||
|
|
||||||
# L0 — Invariant (~5%)
|
|
||||||
L0:
|
|
||||||
- PATHS.md
|
|
||||||
- brain-compose.local.yml
|
|
||||||
- KERNEL.md
|
|
||||||
|
|
||||||
# L1 — Session type (~8%) — chirurgical : seulement ce qu'il faut pour reprendre
|
|
||||||
L1:
|
|
||||||
- BRAIN-INDEX.md # trouver le handoff actif
|
|
||||||
|
|
||||||
# L2 — Handoff scope (~5%) — fichier handoff si déclaré dans le signal
|
|
||||||
# Signal : "HANDOFF/<handoff-id>" → charger le fichier handoff directement
|
|
||||||
L2:
|
|
||||||
template: "handoffs/{handoff_id}.md"
|
|
||||||
extras: []
|
|
||||||
fallback:
|
|
||||||
- handoffs/LATEST.md # si pas d'ID déclaré → dernier handoff
|
|
||||||
|
|
||||||
# L3 — On demand
|
|
||||||
# Exemples : context complet projet, agents métier, focus.md
|
|
||||||
# Principe : le fichier handoff CONTIENT les pointeurs vers L3.
|
|
||||||
# La nouvelle session lit le handoff → décide elle-même quoi charger.
|
|
||||||
L3:
|
|
||||||
hint: "Lire le handoff d'abord. Il indique quoi charger en L3."
|
|
||||||
|
|
||||||
# --- Règle HANDOFF ---
|
|
||||||
# Le handoff est la source de vérité pour la reprise.
|
|
||||||
# Ne pas charger focus.md, metabolism, agents au boot — le handoff décide.
|
|
||||||
# Après lecture du handoff → promouvoir le contexte nécessaire en L2 implicite.
|
|
||||||
# Le claim ouvert doit référencer le handoff : parent_satellite ou story_angle.
|
|
||||||
|
|
||||||
# --- Format handoff attendu ---
|
|
||||||
# handoffs/<id>.md doit contenir :
|
|
||||||
# - Contexte de la session précédente (état, décisions, bloquants)
|
|
||||||
# - Fichiers à charger (L3 → L2 pour cette session)
|
|
||||||
# - Todos ouverts prioritaires
|
|
||||||
# - Signal de session recommandé pour la suite
|
|
||||||
|
|
||||||
# --- Métriques cibles ---
|
|
||||||
context_target:
|
|
||||||
L0: "~5%"
|
|
||||||
L1: "~5%"
|
|
||||||
L2: "~5%"
|
|
||||||
total_boot: "~15%"
|
|
||||||
@@ -4,10 +4,10 @@
|
|||||||
# Détecte les changements dans BRAIN-INDEX.md → notifie via Telegram
|
# Détecte les changements dans BRAIN-INDEX.md → notifie via Telegram
|
||||||
#
|
#
|
||||||
# Setup VPS (une seule fois) :
|
# Setup VPS (une seule fois) :
|
||||||
# 1. Copier ce script sur le VPS : scp brain-watch-vps.sh root@VPS:/home/tetardtek/brain-watch/
|
# 1. Copier ce script sur le VPS : scp brain-watch-vps.sh root@<VPS_IP>:/home/<user>/brain-watch/
|
||||||
# 2. Copier brain-notify.sh aussi
|
# 2. Copier brain-notify.sh aussi
|
||||||
# 3. Cloner le brain : git clone git@git.tetardtek.com:Tetardtek/brain.git /home/tetardtek/brain-watch/brain
|
# 3. Cloner le brain : git clone git@<GITEA_URL>:<USERNAME>/brain.git /home/<user>/brain-watch/brain
|
||||||
# 4. Copier MYSECRETS sur le VPS : scp MYSECRETS root@VPS:/home/tetardtek/brain-watch/
|
# 4. Copier MYSECRETS sur le VPS : scp MYSECRETS root@<VPS_IP>:/home/<user>/brain-watch/
|
||||||
# 5. Installer le service systemd : install-brain-watch-vps.sh
|
# 5. Installer le service systemd : install-brain-watch-vps.sh
|
||||||
# 6. systemctl start brain-watch && systemctl enable brain-watch
|
# 6. systemctl start brain-watch && systemctl enable brain-watch
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ fi
|
|||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Domaine pour le webhook (ex: bot.tetardtek.com) :"
|
echo "Domaine pour le webhook (ex: bot.<OWNER_DOMAIN>) :"
|
||||||
echo -n "→ "
|
echo -n "→ "
|
||||||
read -r BOT_DOMAIN
|
read -r BOT_DOMAIN
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ After=network.target
|
|||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=root
|
User=root
|
||||||
ExecStart=/home/tetardtek/brain-watch/brain-watch-vps.sh
|
ExecStart=/home/<user>/brain-watch/brain-watch-vps.sh
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=10
|
RestartSec=10
|
||||||
StandardOutput=journal
|
StandardOutput=journal
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ ERROR_PATTERNS=(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Patterns de chemin absolu — exclusions pour les placeholders templates
|
# Patterns de chemin absolu — exclusions pour les placeholders templates
|
||||||
ABSOLUTE_PATH_PATTERN="/home/[a-z]" # /home/tetardtek — chemin réel, pas /home/<user>
|
ABSOLUTE_PATH_PATTERN="/home/[a-z]" # ex: /home/alice — chemin réel, pas /home/<user>
|
||||||
ABSOLUTE_PATH_EXCLUDE="<" # Exclure les lignes avec placeholder (<user>, <PATHS...)
|
ABSOLUTE_PATH_EXCLUDE="<" # Exclure les lignes avec placeholder (<user>, <PATHS...)
|
||||||
|
|
||||||
# --- Patterns WARN : références documentaires — OK si contexte architecture ---
|
# --- Patterns WARN : références documentaires — OK si contexte architecture ---
|
||||||
@@ -59,7 +59,7 @@ for pattern in "${ERROR_PATTERNS[@]}"; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# --- Scan ERROR — chemins absolus réels (ex: /home/tetardtek/, pas /home/<user>/) ---
|
# --- Scan ERROR — chemins absolus réels (ex: /home/<user>/, pas /home/<user>/) ---
|
||||||
while IFS= read -r -d '' file; do
|
while IFS= read -r -d '' file; do
|
||||||
# Cherche /home/[a-z] et exclut les lignes avec placeholder <
|
# Cherche /home/[a-z] et exclut les lignes avec placeholder <
|
||||||
matches=$(grep -n "$ABSOLUTE_PATH_PATTERN" "$file" 2>/dev/null \
|
matches=$(grep -n "$ABSOLUTE_PATH_PATTERN" "$file" 2>/dev/null \
|
||||||
|
|||||||
Reference in New Issue
Block a user