# Behaviour Graph v0 — Kai Coaching Mode Specification

**Status:** Design (prep-phase brainstorming complete, awaiting prep execution)
**Date:** 2026-06-09
**Owner:** Dmitry
**Validators:** Roma (operational truth) · Maks (brand / vision)
**Implementer:** Terry (post-validation)
**Source material:** Go Pro — 7 Steps to Becoming a Network Marketing Professional (Eric Worre)

---

## 1. What this is

A behavioural contract that defines how Kai operates in **coaching mode**. Once ratified by Roma and Maks, the graph becomes the source of truth handed to Terry as a build target: *"implement Kai such that, for any valid user_state, Kai's observed behaviour matches this graph for all paths."* The choice of implementation technology (retrieval, MCP, state machine, fine-tune, hybrid) is downstream and not pre-decided here.

This is the first chapter of the larger Behaviour Graph artifact Dmitry committed to deliver to Terry on 2026-06-02 ("Anakai = proactive, not FAQ"). Subsequent layers (Deone material, suite/rank mechanics, dormancy detection, etc.) will extend the same contract.

## 2. Knowledge source vs voice surface

| Layer | Source | Rationale |
|---|---|---|
| **Knowledge** (frameworks, principles, anti-patterns, structure of scripts) | Go Pro — 100% | Industry canon, well-tested by Worre; ideas/frameworks are not copyrightable. |
| **Voice surface** (how Kai actually phrases things to the user) | Synthesised top-KOL persona, crafted by Dmitry | We do not have captured top-KOL voice; we are not interviewing them for v0. Kai must sound like our seasoned network-marketing operators, never like Eric Worre. |
| **Attribution to Worre** | Never user-facing | Internal `source_ref` field exists on every node for grounding during review only. |

## 3. Ontology

### 3.1 Node types (5)

| Type | Definition |
|---|---|
| `user_state` | A discrete stage the user is in (e.g., *no-list*, *first-invite-sent*, *recruiting-leader*). Loops fire from states and transition to states. |
| `loop` | A behavioural unit: trigger → user action → Kai response → outcome. Connects states. |
| `principle` | A named framework lesson from the book, paraphrased in neutral language. Backs one or more loops. |
| `anti_pattern` | The instinctive wrong move that a principle corrects. First-class node, paired with its principle. |
| `script` | An operational dialogue unit (invitation, follow-up, edification, objection handling, etc.) authored in our voice. References the book's structural beats but does not reproduce its wording. |

### 3.2 Edge types (10)

| Edge | Direction | Meaning |
|---|---|---|
| `triggers` | `user_state` → `loop` | This state activates this loop. |
| `transitions_to` | `loop` → `user_state` | Completing this loop moves user to this state. |
| `backed_by` | `loop` / `script` → `principle` | This loop or script implements this principle. |
| `corrects` | `principle` → `anti_pattern` | This principle is the corrective for this anti-pattern. |
| `vulnerable_to` | `user_state` → `anti_pattern` | Users in this state are tempted toward this anti-pattern. |
| `precedes` | `loop` → `loop` | This loop typically precedes another loop in the journey. |
| `depends_on` | `principle` → `principle` | This principle assumes another principle is already internalised. |
| `implements_step` | `script` → `loop.step` | This script implements a specific step of a loop. |
| `paraphrase_of` | `script_variant` → `script_canon` | Variant of a canonical script (for warm/cold market, family/friend, EN/RU/KR/JP/VN registers, etc.). |
| `edifies` | `loop` / `script` → external actor | Captures the network-marketing edification pattern (edify upline, product, speaker, system). First-class because Worre treats it as a discrete move. |

### 3.3 Per-node fields

Every node carries:
- `id` — chapter-scoped (e.g., `P-01-03` = chapter 1, principle 3)
- `title` — short, descriptive
- `body` — paraphrased substance, our wording
- `source_ref` — page / paragraph in book (internal only, for review grounding)
- `kai_voice_draft` — how a top-KOL would express this to the user
- `voice_context_tags` — warm/cold, family/friend, register, language hints
- `linked_*` — typed cross-refs (rendered as edges)

Scripts additionally carry the variant set (each variant is its own node linked via `paraphrase_of`).

## 4. Reading and extraction protocol

**Two-stage gap-driven, per chapter:**

**Stage 1 — emit.** Read the chapter once. Produce all five node types plus edges, plus all script variants, with `source_ref` for every emit.

**Stage 2 — gap audit.** Re-walk the chapter with the emit in hand. For every paragraph that did *not* map into an artifact, write an explicit reason: `restatement of P-N`, `anecdote / personal example`, `transitional sentence`, `recap`, etc. Coverage proof = no unexplained paragraphs.

This is the "didn't miss anything" verifier. Roma / Maks / Dmitry can audit the gap list directly.

## 5. Artifact format — staircase

- **Prep + ch.0 + ch.1:** markdown-first. One file per chapter under `chapters/0X-name.md` with all fields per the ontology.
- **Post-ch.1:** schema is promoted to **JSON** based on the fields that actually emerged (rather than guessed up front). Markdown view remains human-readable.
- **FigJam = render**, not source of truth. Regenerated from markdown / JSON when content changes.

## 6. Memory infrastructure (working backbone)

The graph is built with two memory systems acting as quality nets:

- **Auto-loaded session memory** (`MEMORY.md`-tracked) — extraction protocol, edge cheatsheet, voice persona, quality-bar feedback rules, blind-spot register. Loaded into every working session so the rulebook is never forgotten.
- **MemPalace** — new room `kai_coach_kb` inside wing `pivot_salepoint`. Drawer per artifact (full content). KG triples (`artifact_id -[predicate]-> artifact_id`) for structural relations. Bodies live in drawers; KG holds only relations.
- **KG schema extension** — 4 new predicates to register in prep: `edifies`, `precedes`, `implements_step`, `paraphrase_of`. Forward-only addition.
- **Adversarial sub-agent reviewer** per chapter — independent agent reads the source and the draft without the author's context, flags missed material. Catches systematic blind spots the author cannot see by definition.
- **Pre-flight per chapter** — pull all prior chapter artifacts into context; surface potential duplicates, name collisions, dangling cross-refs.
- **Post-flight per chapter** — schema validation, dedup against prior chapters, gap-list audit, blind-spot register update.

## 7. Voice persona

Voice surface is crafted, not captured. Persona document (`kai_voice_persona.md`) describes:
- Register: experienced network-marketing professional; never American-guru, never bro, never motivational push, never family-pressure
- Vocabulary and idioms used / not used (per language: EN / RU / KR / JP / VN — five MVP languages, no zh)
- Brand pillars (Ambition / AI / Community) and how Kai weights them per situation
- Anti-patterns of voice (what Kai must never sound like)

Persona is drafted by Dmitry in prep and ratified before chapter extraction begins. Future v1 will refine the persona against real top-KOL material if and when captured — out of scope for v0.

## 8. Validation mechanism

### 8.1 Walkable scenarios
Each chapter ships with 5–10 scenarios. Each scenario is a sequence of numbered steps referencing graph nodes:

> 1. User in state `S-newbie-no-list`.
> 2. Kai opens with `Sc-01-02` (warm market invitation primer).
> 3. User reports: *"my family thinks this is a scam."*
> 4. Kai responds via `L-01-04` (anti-pattern → posture from abundance), uses script `Sc-01-05`.
> 5. User commits to listing 5 names. State transitions to `S-has-list`.

Scenarios live in the per-chapter FigJam canvas sidebar. They are the validation interface.

### 8.2 Roma lens — operational truth
Roma walks scenarios on the canvas, flags steps that don't match how successful operators behave on the ground: *"step 4 is wrong, in practice they go to step X first."* Failures fix nodes or edges, not just the scenario.

### 8.3 Maks lens — brand and voice
Maks reads the **voice-sample boxes** on each canvas, tagged by brand pillar (Ambition / AI / Community). Marks any draft that sounds off-brand. May also walk one or two end-to-end scenarios for journey-arc sanity.

### 8.4 Acceptance gate per chapter
Both validators sign off → chapter is locked → its artifacts feed the next chapter's pre-flight as canonical.

## 9. FigJam canvas structure

**Master canvas** — light journey strip: state-spine left-to-right (`newbie → has-list → first-invite-sent → ... → recruiting-leader`), chapter markers along the spine, deep links into per-chapter canvases. This is the validator entry point (especially Maks).

**Per-chapter canvas (×8 — intro + 7 chapters)** — full graph slice:
- State-spine top, runs left-to-right within the chapter's scope
- Loops below each state transition
- Principles + scripts + anti-patterns nested under their loops
- Anti-patterns explicitly paired with the principle that corrects them
- Right sidebar: voice persona reminder, validation scenarios (5–10), gap-list link
- Voice-sample boxes tagged by brand pillar (for Maks)
- Cross-chapter edges annotated `→ ch.N L-XX` with deep-links

**Sync convention:** 1 chapter = 1 markdown file = 1 FigJam canvas. One-to-one mapping for cheap regeneration.

## 10. Handoff to Terry

After all chapters lock, deliverable to Terry is:
- The structured artifact set (markdown → JSON by then)
- The FigJam canvases (visual reference)
- A short integration note: contract semantics, what "matches the graph" means observationally, the validation scenarios as black-box conformance tests

Implementation technology choice (retrieval / MCP / state machine / hybrid) is Terry's decision. The graph does not pre-commit a routing topology.

## 11. Prep-phase deliverables (1–2 days)

| # | Deliverable | Owner | Location / form |
|---|---|---|---|
| 1 | This spec | Dmitry (via Claude) | `spec.md` (this file) |
| 2 | Extraction protocol | Claude | `protocols/extraction.md` |
| 3 | Edge cheatsheet (10 edges, defn + 1–2 examples each) | Claude | `protocols/edge-cheatsheet.md` |
| 4 | Voice persona | Dmitry (Claude drafts) | `voice/kai-voice-persona.md` |
| 5 | Chapter markdown template | Claude | `templates/_chapter.md` |
| 6 | Auto-memory entries | Claude | session memory |
| 7 | MemPalace room + drawer convention | Claude | MemPalace |
| 8 | 4 new KG predicates registered | Claude | KG schema |
| 9 | Adversarial reviewer prompt | Claude | `protocols/adversarial-reviewer.md` |
| 10 | Pre/post-flight scripts | Claude | `protocols/chapter-workflow.md` |
| 11 | FigJam master canvas (empty journey-strip) | Claude | FigJam |
| 12 | FigJam per-chapter canvas template | Claude | FigJam |
| 13 | Dry-run on ch.0 (intro) — pipeline validation | Claude | output + lessons-learned note |

## 12. Out of scope (v0 / prep)

- Extraction of any chapter beyond the ch.0 dry-run (real work begins after prep completes)
- JSON schema (promoted only after ch.1 emits its actual fields)
- Integration into the Anakai stack (Terry's responsibility, post-validation)
- Capture of real top-KOL voice (deferred; v0 uses synthesised persona)
- Behaviour Graph layers beyond Go Pro (Deone material, suite/rank mechanics, dormancy — future contracts)
- Outcome / metric nodes (would require live telemetry not yet wired)

## 13. Sequencing (1–2 days)

**Day 1 — rules and tooling**
- Spec written and approved (this step)
- Extraction protocol + edge cheatsheet
- Voice persona draft → Dmitry ratifies
- Chapter template + auto-memory entries

**Day 2 — memory, canvas, dry-run**
- MemPalace room + KG predicates registered
- Adversarial reviewer + pre/post-flight scripts
- FigJam master + per-chapter template
- Dry-run on ch.0 (intro): shortest chapter, lowest risk. Pipeline gaps surface here; fix tooling before ch.1 begins.

Real chapter work (ch.1 — Finding Prospects) starts immediately after prep declares complete.

## 14. Open questions

- **Voice persona ratification cadence** — single review pass, or iterate over 2–3 cycles? Default: one ratify with the option to revise after ch.0 dry-run reveals voice gaps in practice.
- **Roma / Maks validation throughput** — how many chapters per week can they realistically validate? Affects total project wall-clock.
- **JSON schema timing** — promote after ch.1 (as planned) or hold until ch.2 emits a second data point for stability? Decide after ch.1.
- **Future top-KOL voice capture** — who, when, in what format. Deferred; not a v0 blocker.

## 15. Acceptance — prep status

**Status:** Prep complete as of 2026-06-09 — with one documented dependency on Figma plan upgrade for ch.0 canvas re-population (does not block ch.1 extraction).

### What landed

- ✓ Spec ratified (this doc, committed 7d56b21).
- ✓ All 13 prep deliverables produced:
  - Extraction protocol — `protocols/extraction.md`
  - Edge cheatsheet — `protocols/edge-cheatsheet.md`
  - Voice persona — `voice/kai-voice-persona.md` (ratified by Dmitry)
  - Chapter template — `templates/_chapter.md`
  - Adversarial reviewer prompt — `protocols/adversarial-reviewer.md`
  - Chapter workflow — `protocols/chapter-workflow.md`
  - MemPalace convention — `protocols/mempalace-convention.md` (room `kai_coach_kb` created, README drawer synced)
  - KG predicates — `protocols/kg-predicates.md` (10 new predicates registered)
  - Auto-memory entries — 6 files in user memory directory + MEMORY.md index
  - FigJam canvases — master + per-chapter template (URLs in `canvases.md`)
  - Ch.0 intro extraction — `chapters/00-intro.md`
  - Lessons-learned — `lessons/2026-06-09-dry-run-ch0.md`
  - Adversarial flag log — `protocols/adversarial-flags-ch.00.md`
- ✓ Ch.0 dry-run clean per protocol — 9 nodes, 8 edges, 18 gap-list entries, 4 adversarial flags resolved.
- ✓ Pipeline amendments from dry-run applied:
  - Self-administered adversarial-review fallback REMOVED; main-session orchestration is canon (commit `90113a8`).
  - Phase 7b MemPalace+KG explicit; chapter-workflow plan-tier note (commit `75e08fd`).
  - MemPalace tags-in-body convention (commit `1d452da`).
  - Adversarial-reviewer's earlier fallback path (commit `697bd1f` → superseded by `90113a8`).
- ✓ Blind-spot register has its first entry ("ambiguous 'we' in voice draft").

### Dependency resolved

- **FigJam ch.0 canvas populated** (commit `f8fb3f9`). Figma plan upgraded to Pro (200/day quota); canvas re-population executed against `chapters/00-intro.md`. Canvas now contains 9 node shapes (2 states, 4 principles, 3 anti-patterns), 8 edges, sidebar with persona reminder + 5 validation scenarios + gap-list pointer, legend matching the master canvas palette. URL recorded in `canvases.md`.

### Ready state

- Ch.1 (Finding Prospects) is **unblocked** for extraction.
- Validator handoff to Roma + Maks for ch.0 is **unblocked** — canvas ready for their review whenever they sync.

---

## Meta

- Spec path: `.kiro/specs/anakai-kai-coach/spec.md`
- Source PDF: `.kiro/specs/pivot-salepoint/resources/go-pro-7-steps-to-becoming-a-network-marketing-professional-978-0-9886679-1-4.pdf`
- Existing (untrusted) chapter chunking, to be re-done: `.kiro/specs/pivot-salepoint/rag-corpus/gopro/`
- Related project memories: `project_anakai_proactive_not_faq.md`, `project_anakai_playbook_strategy.md`, `project_kai_voice_canon.md`, `project_anakai_stack_epic_sync_2026_06_05.md`
- Related Jira context: SA-5 (Brief — Behaviour Graph artifact target), SA-18 (Terry's infra rewrite), SA-20 (Andres MCP backend)
- MemPalace wing: `pivot_salepoint` (new room `kai_coach_kb` to be added in prep)
