RSI — Federation Mesh (Cross-Agent Recursive Improvement)
Doctrine: DITEMPA BUKAN DIBERI — Forged, not given. SOT:
/root/AAA/skills/RSI-recursive-improvement/SKILL.md(session-level, parent skill) Catalog:/root/AAA/skills/FEDERATED_SKILLS_REGISTRY_V3.yaml(canonical AAA) Companion:AUDIT-skill-atlas(gap detection),AGI-decisions-reflect(decision quality),FORGE-skill-linter(skill quality),AUDIT-recursive-audit(skill health) Zen: Every session teaches the next session. Every agent teaches the other agents. If the federation isn't learning, neither are you.
What This Skill Is
Problem: RSI-recursive-improvement (v2.0.0, 154 lines) operates at the session level. It captures what one agent learned in one session and writes to /root/.local/share/arifos/rsi-ledger.jsonl. But the federation has 7+ harnesses (AAA, Hermes, Kimi, OpenClaw, Claude Code, Codex, OpenCode, Grok), each with its own skill inventory, symlink mesh, and liveness.json. A lesson learned by Kimi never reaches AAA. A skill forged by Hermes never reaches Kimi. Drift accumulates silently.
Solution: This skill extends RSI from one-agent-one-session to federation-wide-recursive-improvement. It defines the protocol that every agent runs before/after a session to:
- Know thyself — which agent am I, which skills do I have
- Know thy role — which skills SHOULD I have based on the canonical registry
- Know thy history — what did the last session learn (carry forward)
- Bridge the gap — propagate findings back to the canonical AAA source
This is the 3-agent mesh protocol that scales RSI from a single session to a federated learning spine.
§0. USE WHEN
USE WHEN:
1. Session start of any agent that participates in the federation
(AAA, Hermes, Kimi, OpenClaw, Claude Code, Codex, OpenCode, Grok)
2. Session end of any federation agent — before final SEAL
3. Cross-agent handoff (A2A delegation, subagent spawn, mesh sync)
4. After any skill is forged, modified, deprecated, or VOID'd in any harness
5. Periodic federation health check (cron: weekly RSI mesh sync)
6. Mesh drift detected (liveness.json stale, symlink broken, alias mismatch)
7. Bootstrap of a new agent/harness into the federation
8. Before any governance decision that affects >1 agent
§1. DO NOT USE WHEN
DO NOT USE WHEN:
1. Working on a single-session task in a non-federated context (use `RSI-recursive-improvement` alone)
2. Pure skill discovery without federation context (use `AUDIT-skill-atlas`)
3. Linting a single skill's trigger clauses (use `FORGE-skill-linter`)
4. Auditing all skills for rot (use `AUDIT-recursive-audit`)
5. Reflecting on decisions within a single session (use `AGI-decisions-reflect`)
6. The canonical AAA catalog is unavailable or the agent cannot write to it
7. The federation is in a declared divergence freeze (e.g., during a SEAL)
8. Task is < 3 tool calls and produces no artifact (overhead exceeds value)
§2. THE 3-AGENT MESH PROTOCOL
The protocol runs on every session of a federation agent. It chains session-level RSI to federation-wide sync via 5 steps.
Step 1 — IDENTITY: Which Agent Am I?
Output: agent_id, harness, canonical_path, mesh_role
# Detect agent identity at session start
agent_identity = {
"agent_id": str, # e.g. "555-ASI", "333-AGI", "kimi-code"
"harness": str, # e.g. "hermes", "aaa", "kimi", "opencode", "claude-code"
"canonical_path": str, # path to this agent's SKILL.md root
"mesh_role": str, # "canonical" | "view" | "native-keeper" | "bridge"
"rsi_leader": bool, # True if this agent owns the catalog
}
Detection method:
# Check which skeleton this session is running in
ls -d /root/.agents /root/.grok /root/.claude /root/.codex /root/.hermes /root/.kimi /root/.opencode 2>/dev/null
# Detect harness from env, shell working dir, or session preamble
# Read CANONICAL_SKILL_PROFILE.json or FEDERATION_SKILL_PROFILE.json
Mesh role taxonomy:
| Role | Owns Catalog? | Examples |
|---|---|---|
canonical |
YES | AAA (/root/AAA/skills) |
view |
NO (symlink only) | Grok, Claude, Codex, OpenCode live under ~/.{harness}/skills |
native-keeper |
NO (own native skills) | Hermes (SOUL.md, category tree), Kimi (role contrast) |
bridge |
NO (cross-harness) | OpenClaw (A2A gateway) |
AAA is canonical. All other agents are views. This is the iron rule.
Step 2 — INVENTORY: Which Skills Do I Have?
Output: live_skills: List[str], stale_skills: List[str], mesh_broken: List[str]
# 1. Enumerate all SKILL.md under this agent's skill root
find $AGENT_SKILL_ROOT -name "SKILL.md" -not -path "*/.archive-*/*" -not -path "*/_retired/*" | sort
# 2. Check liveness.json for each skill
for skill in $live_skills; do
ts=$(jq -r '.last_invocation // 0' "$skill/liveness.json" 2>/dev/null)
age_days=$(( ($(date +%s) - ts) / 86400 ))
echo "$skill $age_days"
done
# 3. Check symlink health (views only)
find $AGENT_SKILL_ROOT -maxdepth 2 -type l ! -exec test -e {} \; -print
Health classification:
| Status | Criterion | Action |
|---|---|---|
FRESH |
days_since_forge ≤ 7 |
No action |
CURRENT |
8 ≤ days ≤ 14 |
Review on next session |
AGING |
15 ≤ days ≤ 30 |
Verify references still valid |
STALE |
> 30 days |
Run AUDIT-recursive-audit |
BROKEN |
symlink target missing | Mesh sync — repair or quarantine |
VOID |
SKILL.md → SKILL.md.VOID |
Exclude from inventory |
Step 3 — RECONCILE: Which Skills Should I Have Based on My Role?
Output: missing_skills: List[str], extra_skills: List[str], version_drift: List[Dict]
Cross-reference against canonical AAA registry:
# Load canonical V3 registry
CANONICAL="/root/AAA/skills/FEDERATED_SKILLS_REGISTRY_V3.yaml"
# For each canonical skill, check if THIS agent has it
python3 -c "
import yaml, os, json
reg = yaml.safe_load(open('$CANONICAL'))
agent_root = os.environ['AGENT_SKILL_ROOT']
report = {'missing': [], 'version_drift': [], 'extra': []}
for entry in reg['skills']:
v3_name = entry['id']
expected_version = entry.get('version', '0.0.0')
local_path = os.path.join(agent_root, entry.get('path', v3_name), 'SKILL.md')
if not os.path.exists(local_path):
report['missing'].append(v3_name)
else:
# Read local frontmatter, compare version
local_v = read_version(local_path)
if local_v != expected_version:
report['version_drift'].append({
'skill': v3_name,
'canonical': expected_version,
'local': local_v
})
print(json.dumps(report, indent=2))
"
Per-role reconciliation:
| Agent Role | Required Skills | Optional Skills | Forbidden |
|---|---|---|---|
| AAA (canonical) | All V3 skills + 9 bootstrap universals | Harness-natives via symlink | None |
| Hermes | BOOTSTRAP + 7-zen + federated-skill-architecture | Category skills (substrate, knowledge, etc.) | — |
| Kimi | Role contrast + RSI + governance core | Forge + dev skills | Office/review duplicates |
| OpenClaw | openclaw-agentic + memory + A2A | Ops skills | Domain bodies (let AAA own) |
| Grok | BOOTSTRAP 9 + arif-governed + grok-zen-aaa-substrate | Domain via atlas | Catalog replicas |
| Claude / Codex | BOOTSTRAP 9 + mesh | Same domain pack | — |
| OpenCode | BOOTSTRAP 9 + agentic-architecture | Domain skills | Native keepers only |
Step 4 — INHERIT: What Did the Last Session Learn?
Output: carry_forward: List[Dict], recurrence_flags: List[str]
# 1. Pull last 3 RSI entries from the federation ledger
tail -3 /root/.local/share/arifos/rsi-ledger.jsonl | jq -s '.' > carry_forward.json
# 2. Filter for this agent's role
jq --arg role "$AGENT_ROLE" '[.[] | select(.actor_id | startswith($role) or .actor_role == $role)]' carry_forward.json
# 3. Check for recurrence (same bottleneck in last 5 sessions)
python3 -c "
import json, collections
entries = [json.loads(l) for l in open('/root/.local/share/arifos/rsi-ledger.jsonl').readlines()[-5:]]
bottlenecks = collections.Counter(e['bottleneck'] for e in entries)
recurring = [b for b, c in bottlenecks.items() if c >= 2]
print('recurrence_flags:', recurring)
"
Cross-session carry forward:
| Source | What to carry |
|---|---|
Last /root/.local/share/arifos/rsi-ledger.jsonl entry |
bottleneck, fix, next_session_hint |
~/.local/state/arifos/carry_forward.json |
Plan-stage notes, FQ deltas |
forge_work/<last_session>/ |
Open issues, open hypotheses, pending merges |
liveness.json per skill |
last_invocation, last_outcome_delta |
If a recurrence is flagged (same bottleneck 2+ times), escalate to architectural fix — write a proposal, don't just patch.
Step 5 — PROPAGATE: How Do I Propagate Findings Back to the Canonical Source?
Output: propagation_receipt: Dict, merge_request: Optional[Path]
This is the federation sync step. Findings from this agent MUST reach the canonical AAA catalog (or be explicitly flagged as harness-native).
# 1. Detect federation-level findings
findings=$(jq -n '
{
"missing_skills": $missing,
"stale_skills": $stale,
"mesh_broken": $broken,
"novel_capability": $novel,
"recurrence_flags": $recurring,
"session_artifact": $artifact
}
' --argjson missing "$MISSING" --argjson stale "$STALE" --argjson broken "$BROKEN" \
--argjson novel "$NOVEL" --argjson recurring "$RECURRING" --argjson artifact "$ARTIFACT")
# 2. Write to federation sync queue
echo "$findings" >> /root/.local/share/arifos/federation-sync-queue.jsonl
# 3. If novel capability discovered, forge via AAA canonical path
# (NO parallel catalog — iron rule: AAA is the only catalog)
if [ -n "$NOVEL" ]; then
/root/AAA/skills/FORGE-skill-creator/SKILL.md forge "$NOVEL_NAME" \
--from-agent "$AGENT_ID" \
--evidence "$findings" \
--canonical-path "/root/AAA/skills/$NOVEL_NAME/"
fi
# 4. If recurrence flagged, write proposal (do NOT auto-merge)
cat > /root/forge_work/$(date +%Y-%m-%d)/recurrence-$BOTTLE.md <<EOF
# Recurrence: $BOTTLE
- First seen: $(jq -r '.timestamp' <first_entry>)
- Last seen: $(date -Iseconds)
- Count: $COUNT
- Proposed fix: ...
- Approver required: F13 SOVEREIGN
EOF
# 5. Seal the mesh run
python3 /root/AAA/skills/RSI-federation-mesh/mesh-seal.py \
--agent "$AGENT_ID" \
--findings "$findings" \
--canonical-receipt "$RECEIPT"
Propagation rules:
| Finding Type | Where It Goes | Who Writes |
|---|---|---|
missing_skill (canonical agent doesn't have it) |
Forge at /root/AAA/skills/<name>/ |
AAA catalog owner |
version_drift (same skill, different version) |
Update view at ~/.{harness}/skills/ |
Harness sync script |
stale_skill (>30 days) |
Run AUDIT-recursive-audit on it |
Audit owner |
mesh_broken (symlink target missing) |
skill-mesh-sync.sh --apply |
Mesh sync |
novel_capability (no canonical equivalent) |
Forge via FORGE-skill-creator |
Originating agent |
recurrence (same bottleneck 2+ times) |
Proposal to forge_work/ |
Originating agent writes; F13 approves |
harness_native (only this harness needs it) |
Stay in ~/.{harness}/skills |
Harness owner |
Iron rule: No parallel catalog. Harness-native is OK (≤12 keepers per harness); cross-harness must be canonical at AAA.
§3. THE FEDERATION MESH (Reference)
3.1 Agent Topology (2026-08-08 T₁)
AAA (canonical)
/root/AAA/skills
│
┌─────────┬─────────┼─────────┬─────────┬─────────┐
│ │ │ │ │ │
Hermes Kimi OpenClaw Grok Claude Codex OpenCode
(unique) (largest) (bridge) (view) (view) (view) (view)
SOUL.md roles A2A symlink symlink symlink symlink
category contrast gateway
3.2 Version Tracking Table
| Agent | Harness | Last Sync Date | Health Status | Canonical Path | Notes |
|---|---|---|---|---|---|
| AAA | aaa | 2026-08-08 | ✅ CANONICAL | /root/AAA/skills |
Sole catalog (V3, 64 logical) |
| Hermes | hermes | 2026-08-08 | ✅ HEALTHY | ~/.hermes/profiles/aaa-hermes/skills |
Unique meta-doctrine (SOUL.md, 7-zen) |
| Kimi | kimi | 2026-08-08 | ✅ HEALTHY | /root/.kimi/skills |
Largest inventory (role contrast + RSI) |
| OpenClaw | openclaw | 2026-08-08 | ⚠️ THIN | /root/.openclaw/skills |
A2A gateway + memory; few domain skills |
| Grok | grok | 2026-08-08 | ✅ HEALTHY | /root/.grok/skills |
184 resolvable (view + 12 native) |
| Claude Code | claude-code | 2026-08-08 | ✅ HEALTHY | /root/.claude/skills |
176 resolvable; symlink mesh |
| Codex | codex | 2026-08-08 | ✅ HEALTHY | /root/.codex/skills |
107 resolvable; symlink mesh |
| OpenCode | opencode | 2026-08-08 | ⚠️ AGING | /root/.opencode/skills |
39 resolvable; some stale |
Status legend:
- ✅ HEALTHY — mesh intact, recent sync, no drift
- ⚠️ AGING — last sync >7 days; verify before next session
- ⚠️ THIN — covers <50% of canonical domain; documented gap
- ❌ BROKEN — symlink mesh or liveness.json corrupted; quarantine
- 🔴 VOID — known archive; treat as removed
Sync cadence recommendations:
- HEALTHY: weekly cron check
- AGING: next session must re-sync
- THIN: monthly gap audit
- BROKEN: immediate
skill-mesh-sync.sh --apply
3.3 Federation Sync Receipt
Each federation sync produces a sealed receipt:
federation_sync_receipt:
mesh_sync_id: <uuid>
agent_id: <str>
harness: <str>
timestamp: <iso8601>
inventory:
canonical_total: 64
local_total: <int>
missing: <int>
stale: <int>
broken: <int>
version_drift: <int>
carry_forward:
last_rsi_bottleneck: <str>
recurrence_flags: <list>
propagation:
forged: <list>
repaired: <list>
proposals: <list>
seal:
status: SEAL | HOLD | VOID
signed_by: <actor_id>
vault_ref: <VAULT999 entry>
§4. CROSS-REFERENCES (6 Compounding Skills)
This skill compounds with 5 existing skills. It does not replace any of them.
| # | Skill | Role | When to Load |
|---|---|---|---|
| 1 | RSI-recursive-improvement (v2.0.0) | Session-level recursion (parent) | At every session boundary within ONE agent |
| 2 | AUDIT-recursive-audit (v1.0.0) | Skill health (rot, drift, archive) | When stale_skill > 0 or weekly cron |
| 3 | AUDIT-skill-atlas (v1.2.3) | Skill discovery + gap detection | When missing_skills > 0 or routing decision |
| 4 | RSI-federation-mesh (this, v1.0.0) | Cross-agent comparison | At every session boundary ACROSS agents |
| 5 | AGI-decisions-reflect (v1.0.0) | Decision quality + uncertainty surfacing | After any major decision, before SEAL |
| 6 | FORGE-skill-linter (v1.0.0) | Skill quality (trigger clauses, L1/L2/L3) | Before any skill is forged or merged |
How they stack:
Session start
↓
RSI-federation-mesh (this) → Step 1 identity, Step 2 inventory, Step 3 reconcile
↓
RSI-recursive-improvement → Phase 0 configure (uses carry_forward)
↓
WORK (with routing via AUDIT-skill-atlas)
↓
AGI-decisions-reflect → surface uncertainties
↓
RSI-recursive-improvement → Phase 1-5 (trace, diagnose, remediate, ledger, seal)
↓
RSI-federation-mesh (this) → Step 4 inherit, Step 5 propagate
↓
Session seal
§5. ANTI-PATTERNS
❌ Parallel catalog — forging a skill at /root/.grok/skills/foo without forging at /root/AAA/skills/foo.
Remedy: Forge at AAA first; symlink to ~/.grok.
❌ Mesh drift silence — when liveness.json is >30 days old, saying "it's fine".
Remedy: Run AUDIT-recursive-audit; quarantine or repair.
❌ Propagate without canonical address — propagating a finding to a fork of the registry.
Remedy: All canonical writes go to /root/AAA/skills/<name>/.
❌ Recurrence denial — if the same bottleneck appears 2+ times, "patching forward" instead of writing a proposal.
Remedy: Write to /root/forge_work/<date>/recurrence-<name>.md; F13 approves.
❌ Single-agent RSI only — running RSI-recursive-improvement without RSI-federation-mesh.
Remedy: Always run BOTH at session boundaries when federation role is active.
❌ Mesh sync without audit — running `skill-mesh-sync.sh --apply` without first running AUDIT-recursive-audit.
Remedy: Audit first, then sync. Audit defines what should exist; sync makes the mesh match.
❌ Identity amnesia — not knowing which agent am I, defaulting to "AAA".
Remedy: Step 1 is mandatory at session start. Write agent_id to carry_forward.
❌ Forging in /root/.agents/ directly — bypassing AAA canonical.
Remedy: /root/.agents is the doctrine core; AAA is the canonical catalog. They share skills via symlink, not duplication.
§6. MINIMUM VIABLE MESH (When Audit Tools Are Unavailable)
If AUDIT-recursive-audit, AUDIT-skill-atlas, or FORGE-skill-linter are unavailable, this skill still works with the minimum viable mesh:
# Step 1 — Identity
echo "agent_id=$(whoami) harness=$HARNESS role=$MESH_ROLE"
# Step 2 — Inventory (file system only)
find $AGENT_SKILL_ROOT -name "SKILL.md" | wc -l | xargs -I{} echo "local_count={}"
# Step 3 — Reconcile (compare to canonical V3)
yq '.skills[].id' /root/AAA/skills/FEDERATED_SKILLS_REGISTRY_V3.yaml | sort > /tmp/canonical.txt
find $AGENT_SKILL_ROOT -name "SKILL.md" -exec dirname {} \; | xargs -I{} basename {} | sort > /tmp/local.txt
diff /tmp/canonical.txt /tmp/local.txt
# Step 4 — Inherit (last 3 RSI entries)
tail -3 /root/.local/share/arifos/rsi-ledger.jsonl | jq -r '.bottleneck'
# Step 5 — Propagate (write to federation queue)
echo "{\"agent\":\"$AGENT_ID\",\"timestamp\":\"$(date -Iseconds)\",\"findings\":$FINDINGS}" \
>> /root/.local/share/arifos/federation-sync-queue.jsonl
This is the T0 fallback — no LLM, no audit tools, just file system + bash. It runs in <5 seconds.
§7. FLOOR ALIGNMENT
| Floor | RSI-Federation-Mesh Obligation |
|---|---|
| F1 AMANAH | All propagation is reversible (F1 reversible rename, symlink repair) |
| F2 TRUTH | Inventory counts must match reality (no fabricated numbers) |
| F4 CLARITY | ΔS ≤ 0 — mesh sync must reduce entropy, not add complexity |
| F7 HUMILITY | Declare unknown agents / unknown harnesses honestly |
| F9 ANTI-HALLUCINATION | Cross-reference canonical before claiming "missing" or "stale" |
| F11 AUDIT | Every mesh run writes to /root/.local/share/arifos/federation-sync-queue.jsonl |
| F13 SOVEREIGN | Recurrence proposals require F13 ratification before architectural fix |
§8. INTEGRATION POINTS
| Trigger Point | What This Skill Does |
|---|---|
/seal Step 3 (after RSI) |
Mesh propagation runs BEFORE seal — seal includes federation_sync_receipt |
/init carry_forward |
Last 3 federation_sync_receipts loaded into session context |
Weekly cron mesh-sync |
Full reconcile + repair + audit |
AUDIT-recursive-audit complete |
Audit findings auto-queued to federation-sync-queue.jsonl |
AGI-decisions-reflect output |
Decisions with >3 agents affected trigger mesh sync |
FORGE-skill-creator new skill |
Auto-runs Step 3 reconcile across all agents |
arif_judge T2/T3 verdict |
Triggers Step 5 propagate regardless of session boundary |
§9. THE ZEN
Every session that doesn't teach the next session is a dead session. Every agent that doesn't teach the other agents is a dead agent. The federation mesh is the spine that carries lessons between sessions AND between agents. If the mesh is broken, RSI-recursive-improvement is a candle in a black box — it burns, but nothing reads.
The federation learns from every session, or it stagnates. This skill is the bridge.
§10. EXAMPLES
Example 1 — Kimi discovers a novel capability
# Kimi session ends
findings:
novel_capability: "kimi-role-contrast-rsi-2026"
recurrence_flags: []
missing_skills: ["RSI-federation-mesh"] # Kimi hasn't seen this yet
version_drift: []
# Step 5 propagates:
# - Forge RSI-federation-mesh at /root/AAA/skills/ (canonical)
# - Symlink to ~/.kimi/skills/
# - Write federation-sync-queue.jsonl entry
# - Next session: AAA, Hermes, OpenClaw all see the new skill
Example 2 — Hermes detects stale skill
# Hermes session start
inventory:
stale_skills: ["FORGE-skill-linter"] # 45 days since forge
mesh_broken: []
version_drift: []
# Step 5 propagates:
# - Queue to federation-sync-queue.jsonl
# - AAA audit owner runs AUDIT-recursive-audit on FORGE-skill-linter
# - Result: refresh or archive-void-rot
Example 3 — OpenClaw reconnect after A2A outage
# OpenClaw session start after 14 days offline
inventory:
canonical_total: 64
local_total: 41
missing: 23 # 23 skills forged while OpenClaw was offline
version_drift: 8 # 8 skills updated at AAA but not at OpenClaw
broken: 0
# Step 5 propagates:
# - AAC run skill-mesh-sync.sh --apply
# - All 23 missing skills symlinked from AAA
# - All 8 version drift resolved
# - OpenClaw now HEALTHY
§11. CHANGELOG
| Version | Date | Change |
|---|---|---|
| 1.0.0 | 2026-08-08 | Initial forge. Bridges session-level RSI-recursive-improvement to federation-wide recursive improvement. 5-step protocol (Identity → Inventory → Reconcile → Inherit → Propagate). Version tracking table covers 8 agents (AAA, Hermes, Kimi, OpenClaw, Grok, Claude, Codex, OpenCode). |
Forged by: 333-AGI (subagent) on 2026-08-08.
Parent doctrine: RSI-recursive-improvement v2.0.0.
Iron rule: AAA is the canonical catalog. All other agents are views. No parallel catalogs.