# Phase 3 Execution Plan

> **Flow:** `Cowork -> ActionTrail -> NoteLett -> MindLyst`
> **Status:** Implemented baseline
> **Owner:** `Codex`
> **Purpose:** Standardize the audited artifact flow where Cowork audit exports become ActionTrail trail reports, then readable NoteLett notes, then MindLyst insight memories.

---

## 1. Scope

Phase 3 proves that a Cowork execution can create durable downstream value without requiring a live Rust/Tauri integration in the same implementation window.

Baseline seam:

1. Cowork exports structured audit JSON.
2. ActionTrail imports that export into a canonical `trail-report` artifact.
3. NoteLett imports the latest `trail-report` into a readable markdown note.
4. MindLyst imports the latest audit note into an `insight` memory proposal.

This phase intentionally treats Cowork's existing audit export as the producer contract. It does not require new desktop runtime plumbing.

The producer contract now includes Cowork-emitted canonical `event_id` values so ActionTrail lineage can anchor the `trail-report` artifact to a real upstream audit event when one is present.

---

## 2. Repos In Scope

- `oss/learning_ai_claw-cowork`
- `learning_ai_trails`
- `learning_ai_notes`
- `learning_multimodal_memory_agents`
- `learning_ai_common_plat`

---

## 3. Implementation Decisions

- Reuse generic ecosystem events:
  - `artifact.created`
  - `artifact.linked`
  - `memory.entry.created`
- Add a canonical `trail-report` payload to the shared artifact schema.
- Keep ActionTrail's Phase 3 seam as a pure module so it can be tested without booting the backend.
- Reuse the existing NoteLett and MindLyst import pattern from Phase 1.
- Preserve causal lineage across all persisted latest-event indexes.

---

## 4. Code Surfaces

### `learning_ai_common_plat`

- `packages/events/src/ecosystem.ts`
- `packages/events/src/ecosystem.test.ts`

### `learning_ai_trails`

- `backend/src/lib/ecosystem-phase3.ts`
- `backend/src/lib/ecosystem-phase3.test.ts`

### `learning_ai_notes`

- `backend/src/lib/ecosystem-phase3.ts`
- `backend/src/lib/ecosystem-phase3.test.ts`

### `learning_multimodal_memory_agents`

- `mindlyst-native/web/src/lib/ecosystem-phase3.ts`
- `mindlyst-native/web/src/lib/ecosystem-phase3.test.ts`

---

## 5. Verification Commands

- `cd learning_ai_common_plat/packages/events && pnpm exec vitest run src/ecosystem.test.ts`
- `cd learning_ai_trails && node --experimental-strip-types --test backend/src/lib/ecosystem-phase3.test.ts`
- `cd learning_ai_notes && node --experimental-strip-types --test backend/src/lib/ecosystem-phase3.test.ts`
- `cd learning_multimodal_memory_agents/mindlyst-native/web && node --experimental-strip-types --test src/lib/ecosystem-phase3.test.ts`

---

## 6. Manual Walkthrough Evidence

Walkthrough root:

- `/tmp/bytelyst-phase3-walkthrough.myuu1z`

Observed causal chain:

- `evt_trail_created_b40197d5302e`
- `evt_note_created_abc1ad821974`
- `evt_note_linked_9fd9a2b03363`
- `evt_memory_8103b59fb40c`

Observed artifact chain:

- `art_trail_5af2de023e77`
- `art_note_2146a3d0cd11`
- `art_memory_11f691d1b201`

Observed semantics:

- Cowork audit export produced `4` audited actions and `2` safety signals.
- ActionTrail created a `trail-report` artifact with shared correlation ID `corr_e735382a77d6`.
- NoteLett created a markdown audit note linked back to the `trail-report`.
- MindLyst created an `insight` memory with source artifact IDs for both the note and the trail report.

---

## 7. Done Criteria

- [x] shared contract accepts `trail-report` artifacts
- [x] ActionTrail can persist a canonical `trail-report` artifact and latest created-event index
- [x] NoteLett can persist a canonical note artifact derived from the latest `trail-report`
- [x] MindLyst can persist a canonical `insight` memory derived from the latest audit note
- [x] all focused module tests pass
- [x] one manual walkthrough proves the end-to-end causal chain
- [ ] repo-local runtime route wiring exists for all three products

The remaining unchecked item is explicitly deferred. Phase 3 baseline is still considered complete because the artifact seam is implemented and verified.

---

## 8. Commits

- `e6b58b7` shared Phase 3 contract support for `trail-report`
- `e294cf5` ActionTrail `trail-report` producer seam
- `4af86b4` NoteLett audited note import seam
- `43819f1` MindLyst audited memory import seam
- `a253de1` normalized Phase 3 ActionTrail event trace semantics
- `7ee2151` wired the NoteLett Phase 3 import through a live backend route
- `5a7f80d` wired the MindLyst Phase 3 audited note import through the memory API
- `3963f63` Cowork now emits canonical audit `event_id` values from Rust and includes them in desktop audit export payloads
- `37e9a3c` ActionTrail now preserves Cowork canonical audit event IDs in `trail-report` provenance and `artifact.created` trace causation
