--- type: ANA asset_id: ANA-EL-MarkKashef-FableBehaviorCloning-v01 version: v01 status: Active owner: Victor Heredia sherpa_owner: Jay fecha_creacion: 2026-06-07 intellbank: IB-EL-EmpowerLabs subbank: PB-EL-Project-Bank/PB-EL-IALab proposito: Extract the algorithm Mark Kashef shares for cloning Fable's working behavior into any model by mining JSONL session logs, and assess its value for EmpowerLabs (SherpaX, BrainOS, Brain Codes) fuente: Video transcript (primary) · "Make Any Model Think Like Fable in 10 Minutes" · Mark Kashef (@Mark_Kashef), YouTube · self-contained method, no external claims to verify modo: APRENDIZAJE + INNOVACIÓN idioma: EN (requested by Victor) tags: [analisis, mark-kashef, behavior-cloning, jsonl, claude-code, sherpax, brain-codes, playbook] --- # Analysis — Mark Kashef · "Behavior Cloning from Session Logs" ## Executive report · 2026-06-07 · Modes: LEARNING + INNOVATION ## One-paragraph analysis The technique is small but the principle is large: **your agent session logs are training data for behavior, not just history.** Kashef mines Claude Code / Codex JSONL files — which silently tag every turn with the model that produced it — extracts only the behavioral signal (prompts, plans, tool-call order, read/edit/test ratios), measures one model's "working rhythm" against another's in hard numbers, and distills the delta into a playbook file that gets injected into any model via CLAUDE.md, a skill, or a session-start hook. For EmpowerLabs this is directly transferable: it's an empirical, measurable way to capture *how an operator works* — the exact gap between a documented Brain Code (what someone says) and observed behavior ([V] markers). It can sharpen SherpaX by cloning the best operators' tool-use discipline, and it's a concrete method for the "observed behavior" layers of the v02 Brain Code anatomy. **Source context:** Mark Kashef walks through how to make Opus/Codex/open-source models behave more like the (now-gone) "Fable 5" by analyzing local session logs. Self-contained procedure; ships a free kit + open-source Fable dataset on Hugging Face for those without their own history. --- ## THE ALGORITHM (verbatim procedure, generalized) > Goal: capture the *behavioral delta* between a reference model/operator and your current one, then inject it as a reusable playbook. ``` STEP 0 — LOCATE THE RAW DATA Agent conversations live as JSONL files on disk (Claude Code, Codex). Each file is bloated with tool calls + metadata, but every turn is tagged with the model that produced it (message.model artifact). STEP 1 — MEASURE THE BLAST RADIUS Prompt: "How many JSONL files do we have across all sessions?" → Get the total universe (Kashef: ~3,000 files). Only a fraction will be the reference model — you need the count to scope the filter. STEP 2 — STRIP THE BLOAT (build a reusable script) Prompt: "The bloat in these files is tool results, full file contents, and command output echoed back into context. Write me a small Python script that takes a session file and strips it to a clean transcript: keep timestamps, which model it was, what I asked for, what the assistant responded — optionally the tool calls in order." → Test on ONE file first to confirm the format. Redact personal data. STEP 3 — BUILD THE CORPUS (filter by model) Prompt: "Every conversation has a message.model artifact. Pull every turn that came from [REFERENCE MODEL, exact name] out of my whole history into one combined corpus — with the surrounding context." → One playbook of every session run on the reference model. STEP 4 — MEASURE BEHAVIOR IN REAL NUMBERS Prompt: "Give me the behavioral patterns as real measured numbers, not impressions." → volume of messages, tool-use breakdown, order of work, the model's 'working rhythm' (bash chaining, read→edit→test flow). STEP 5 — SIDE-BY-SIDE DIFF AGAINST YOUR MODEL Prompt: "Run the exact same behavioral read against [YOUR MODEL] and put the two side by side. Show the distance between rhythm, tool-call cadence, action sequences, and ratios like reads-before-edits and tests-after-edits." → Quantified gap (e.g., Opus takes more turns, acts before thinking). STEP 6 — DISTILL INTO A PLAYBOOK FILE Prompt: "Distill your core findings of how [YOUR MODEL] could act more like [REFERENCE] into a playbook file (.md)." STEP 7 — INJECT IT (pick one) • Reference the file by tag mid-session • Add a session-start HOOK that always injects it into context • Turn it into a SKILL • Paste the lines into CLAUDE.md (auto-injected every session) ``` **Key insight / limits:** you cannot clone capability — that lives in the model weights. You CAN clone *behavioral discipline*: planning before acting, tool-call cadence, read/edit/test ratios. Eliciting a weaker model to plan longer won't match the reference, but yields markedly stronger execution. --- ## 1. Why this matters for Victor — Strategist · Architect · CEO | # | Conclusion | |---|-----------| | 1 | **Session logs are an untapped EmpowerLabs asset.** Every SherpaX/Claude Code session we've run is latent behavioral training data we're currently throwing away. | | 2 | **This closes the Brain Code [D]→[V] gap empirically.** Brain Codes document what an operator *says*; this measures what they *do* — tool cadence, work rhythm, decision sequences — in numbers, not impressions. | | 3 | **It's a SherpaX sharpening loop.** Clone the working rhythm of our best operators (or best model runs) into a playbook every SherpaX injects at session start. | | 4 | **Model-agnostic and cheap.** The playbook is a portable .md — it upgrades closed and open-source models alike. Reinforces the model-agnostic principle (IDE-007 / Build-2026 learnings). | ## 2. Ideas to incorporate | # | Idea | Destination | |---|------|-------------| | 1 | **Behavioral-mining pipeline**: scripts that strip our JSONL logs to clean transcripts + measure tool/rhythm metrics per model/operator | BrainOS · IALab | | 2 | **Observed-behavior layer for Brain Codes**: feed measured rhythm into Capa B/D ([V] markers) of the v02 anatomy — evidence, not inference | Brain Code Production Room | | 3 | **SherpaX behavior playbook + session-start hook**: distilled best-practice rhythm auto-injected into every SherpaX session | SherpaX | | 4 | **"Golden session" corpus**: tag and mine our highest-quality sessions as the reference model to clone across the team | BrainOS · WORX | ## Concepts to master (LEARNING mode) | Concept | What it is | Why it matters for EL | |---------|-----------|----------------------| | **JSONL session logs** | Local files where Claude Code/Codex store every turn, tool call and metadata | Our own logs are mineable behavioral data — currently ignored | | **message.model tagging** | Each turn records which exact model produced it | Lets us filter and compare behavior by model or session quality | | **Behavioral cloning vs capability** | Copying *how* a model works (rhythm, cadence) vs *what* it can do (weights) | Sets realistic expectations — we can transfer discipline, not raw IQ | | **Working rhythm / tool cadence** | Measurable order of actions: reads-before-edits, tests-after-edits, bash chaining | The quantifiable signature of a good operator — core to SherpaX quality | | **Context injection: hook / skill / CLAUDE.md** | Three ways to load a playbook automatically into a session | Our delivery mechanisms for any distilled behavior playbook | | **Behavior playbook file** | Distilled .md of how a weaker model should act more like a reference | The portable, model-agnostic artifact this whole method produces | --- ## 4. Implementation implications | # | Action | What it takes | Effort | Impact | |---|--------|---------------|--------|--------| | 1 | Run the algorithm on our own logs (pilot) | Locate our JSONL store, run steps 1-6 on a sample, inspect output | 🟢 1 session | Proves the method on EL data; first behavioral metrics | | 2 | Build reusable strip + metrics scripts | Generalize the pilot scripts; park in BrainOS/IALab | 🟡 Low-med | Repeatable pipeline for any future mining | | 3 | SherpaX behavior playbook + hook | Distill a "golden rhythm" playbook, wire a session-start hook | 🟡 Med | Every SherpaX session inherits best-practice discipline | | 4 | Wire into Brain Code v02 [V] layers | Feed measured rhythm into Capa B/D of the anatomy | 🟡 Med | Brain Codes gain empirical behavior evidence, higher readiness | **Suggested sequence:** pilot (1) this week → scripts (2) → then choose between SherpaX hook (3) and Brain Code integration (4) based on triage. --- ## NEXT | NEXT | Owner | Axis | |------|-------|------| | Pilot the algorithm on EmpowerLabs' own session logs | @Victor + Jay | BrainOS/IALab | | Triage ideas IDE-027 to IDE-030 in weekly sync | @Victor | Innovation | | Grab Kashef's free kit + open-source Fable dataset (Hugging Face) for reference | @Jay | IALab | --- ## CHANGELOG | Date | Version | Change | By | |------|---------|--------|-----| | 2026-06-07 | v01 | Initial analysis (EN). 4th ANA- run. Algorithm extracted verbatim + generalized. Modes: LEARNING + INNOVATION | Jay |