# Implementation Plan: Journal Go-Live Activation

**Status:** Not Started  
**Created:** 2026-07-05  
**Updated:** 2026-07-05  
**Repository:** `/home/hex/Project/BrainDrive-Test-01`  
**Target Branch:** `dev`  
**Work Branch:** `journal/go-live-activation`  
**Spec:** [`journal-go-live-activation-spec.md`](journal-go-live-activation-spec.md)  
**Test Plan:** Not yet created. This plan includes inline release gates and recommends a separate test plan only if the release owner wants formal gate tracking.

---

## Goal

Turn page journaling live for Finance, Career, and New Project after PR #215 and PR #217 have landed on `dev`.

The implementation is a narrow activation pass:

1. Expand page-journal id lists from `fitness`, `relationships` to `finance`, `career`, `fitness`, `relationships`, `new-project`.
2. Keep runtime seeding, starter-pack contract, architecture lint, and tests synchronized.
3. Repair fallback journal defaults so any fallback-created journal uses the D288 newest-first anchor-line format.
4. Verify a fresh dev provision seeds the new journal files and exposes `Your Journal` correctly.

## Source Inputs

| Input | Location | Status | Notes |
|---|---|---|---|
| Go-live spec | `journal-go-live-activation-spec.md` | Draft, ready for build planning | Source of truth for scope, requirements, and release criteria. |
| PR #215 | https://github.com/BrainDriveAI/BrainDrive/pull/215 | Merged to `dev` | Journal calibration tunes for proof pages. Merged with normal merge commit `100c8f66`, not squash. |
| PR #217 | https://github.com/BrainDriveAI/BrainDrive/pull/217 | Merged to `dev` | Adds Finance, Career, and New Project journal templates. Merged with normal merge commit `622610bd`, not squash. |
| Runtime implementation context | `journal-runtime-implementation-plan.md` | Reviewed for background | Earlier runtime pass for Fitness and Relationships. Some current-state details are stale after later merges. |
| Repo context | `/home/hex/Project/BrainDrive-Test-01` | Reviewed on 2026-07-05 | Current `dev` already has flat journal file handling for Fitness and Relationships. |

## Builder Instructions

Use these instructions for the coding agent or engineer implementing the activation.

1. Start on `dev` and confirm the working tree is clean.
2. Fetch from `origin` before changing files.
3. Confirm PR #215 and PR #217 remain merged into `dev`. They were merged normally on 2026-07-05; do not re-merge or squash them.
4. Do not edit provider configuration, auth, installer, deployment, or model routing.
5. Do not re-author PR #217 prompt content unless a merge conflict forces a surgical resolution.
6. Keep the diff narrow: ids, fallback journal defaults, tests, and only sidebar code if verification proves generic handling is missing.
7. Write tests or update expected assertions before implementation where practical.
8. Preserve existing owner files. This activation is for fresh provisions or explicit operator patching, not silent overwrite of customized memory.
9. Run focused checks during each phase and broader checks before handoff.
10. Report exact commands, results, files changed, and any remaining release risk.

## Implementation Agent Prompt

Use this prompt when handing the work to a coding agent:

```text
You are implementing the Journal Go-Live Activation from:
/home/hex/Reference/Designs/BrainDrive-MVP/BrainDrive - Journal/journal-go-live-activation-spec.md

Repo:
/home/hex/Project/BrainDrive-Test-01

Goal:
After PR #215 and PR #217 are merged to dev with normal merge commits, activate journaling for Finance, Career, and New Project by adding their ids to every page-journal enumeration, repairing fallback journal defaults, updating tests/lint expectations, and proving a fresh provision seeds journal.md and run-journal.md.

Hard guardrails:
- Do not squash #215 or #217.
- Do not introduce a journal app folder or custom journal UI.
- Do not overwrite existing owner memory.
- Do not modify provider config, secrets, auth, installer, or deployment code.
- Do not expand into Your Agent journal routing, model retry, memory_append, ambiguous edit rejection, or external tools.

Expected files to inspect first:
- builds/typescript/memory/init.ts
- builds/typescript/memory/init.test.ts
- builds/typescript/memory/starter-pack/layout.contract.json
- builds/typescript/tools/architecture-lint/draft3-memory-lint.ts
- builds/typescript/client_web/src/components/layout/sidebar-labels.ts
- builds/typescript/client_web/src/components/layout/sidebar-categorize.ts
- builds/typescript/client_web/src/components/layout/sidebar-categorize.test.ts
- builds/typescript/client_web/src/components/layout/Sidebar.test.tsx

Verification:
- Run focused memory seeding tests.
- Run focused sidebar tests if sidebar code/tests changed.
- Run architecture lint or the repo-local command that covers draft3 memory lint.
- Run broader baseline checks if practical: npm run test, npm run web:test, npm run web:typecheck from builds/typescript.
- Fresh-provision a dev instance and verify at least one of finance, career, or new-project has journal.md and run-journal.md and shows Your Journal in the sidebar.
```

## Scope Guardrails

### In Scope

- Runtime page-journal id activation for Finance, Career, and New Project.
- Starter-pack contract id activation for Finance, Career, and New Project.
- Architecture lint id activation for Finance, Career, and New Project.
- Test expectation updates for newly seeded journal files.
- Fallback `journal.md` cleanup in `builds/typescript/memory/init.ts`.
- Fallback `run-journal.md` cleanup in `builds/typescript/memory/init.ts`.
- Fresh-provision verification.
- Sidebar verification, with code changes only if current generic behavior fails.

### Out Of Scope

- Re-authoring PR #217 template content.
- Your Agent journal routing.
- Custom journal UI, dashboard, tracker, database schema, or journal API.
- Model retry/provider exclusion for empty or truncated completions.
- Memory append primitive.
- Ambiguous memory-edit rejection unless separately promoted.
- To-do list integration.
- External tool calling.
- Provider, auth, installer, hosted deployment, or billing changes.
- Automatic migration that overwrites existing owner memory.

### Change Control

If implementation reveals a new product behavior, migration requirement, release gate, or owner-facing workflow, update `journal-go-live-activation-spec.md` before expanding this plan.

## User Stories

### US-1: Activate Remaining Page Journal Seeding

As a new BrainDrive owner, I want Finance, Career, and New Project to include journaling files after provisioning so follow-up sessions work on every owner-facing page.

Acceptance:

- `documents/finance/run-journal.md` exists.
- `documents/finance/journal.md` exists.
- `documents/career/run-journal.md` exists.
- `documents/career/journal.md` exists.
- `documents/new-project/run-journal.md` exists.
- `documents/new-project/journal.md` exists.
- Files are flat under `documents/<page>/`, not nested under `documents/<page>/journal/`.

### US-2: Keep Runtime And Contract In Sync

As a maintainer, I want runtime seeding, contract, lint, and tests to agree on active page-journal project ids so future changes cannot silently split behavior.

Acceptance:

- `finance`, `career`, `fitness`, `relationships`, and `new-project` are all page-journal ids in runtime seeding.
- The same ids are present in starter-pack contract.
- The same ids are present in architecture lint.
- Tests fail if any of those lists drift.

### US-3: Repair Fallback Journal Defaults

As an owner, I want fallback-created journals to use the same safe newest-first format as authored templates so owner history is not malformed if fallback generation fires.

Acceptance:

- Fallback `journal.md` includes an owner-facing `# Your [Page] Journal` style heading.
- Fallback `journal.md` includes the insertion anchor comment:
  `<!-- New entries go directly below this line, newest first, using the standard journal entry format from run-journal.md. Keep this line in place. -->`
- Fallback `journal.md` no longer seeds bare `No entries yet.`
- Fallback `run-journal.md` describes newest-first insertion below the anchor, not generic bottom append behavior.

### US-4: Verify The Go-Live Surface

As the release owner, I want fresh-provision evidence before release so the go-live switch is proven in the real runtime path.

Acceptance:

- A fresh dev provision includes `journal.md` and `run-journal.md` for at least one of Finance, Career, or New Project.
- Sidebar shows `Your Journal`.
- Sidebar does not show duplicate generic `Journal` items for the same page.

## Current State And Remediation

| Current Behavior / Gap | Required Target | Source | Build Task |
|---|---|---|---|
| PR #217 templates are inert until page ids are activated. | Activate Finance, Career, and New Project only after PR #217 is merged. | PR #217 description | Phase 0, Phase 1 |
| `builds/typescript/memory/init.ts` currently has `PAGE_JOURNAL_PROJECT_IDS = new Set(["fitness", "relationships"])`. | Include `finance`, `career`, `fitness`, `relationships`, `new-project`. | Spec US-1/US-2 | Phase 1 |
| `layout.contract.json` currently has `page_journal_project_ids` limited to Fitness and Relationships. | Include all five page-journal pages. | Spec US-2 | Phase 1 |
| `draft3-memory-lint.ts` currently has `PAGE_JOURNAL_PROJECT_IDS` limited to Fitness and Relationships. | Include all five page-journal pages. | Spec US-2 | Phase 1 |
| `init.test.ts` currently expects Finance, Career, and New Project `run-journal.md` reads to reject. | Flip to expect `run-journal.md` and `journal.md` for all three. | Spec US-1 | Phase 1 |
| Fallback `journal.md` currently seeds `# Your Journal` and `No entries yet.` | Seed D288-compatible header and insertion anchor line. | Spec US-3 | Phase 2 |
| Fallback `run-journal.md` uses generic append wording. | Describe newest-first insertion below anchor. | Spec US-3 | Phase 2 |
| Sidebar generic behavior appears mostly present in current `dev`, but must be proven for newly activated pages. | Verify `Your Journal` grouping and no duplicate owner-state journal item. | Spec US-4 | Phase 3 |

## Key Decisions And Recommendations

| Decision / Open Item | Recommendation | Rationale |
|---|---|---|
| Merge order | Merge PR #215, then PR #217, then activation. | PR #217 says merge order with #215 does not matter, but both should land before journaling release. Merging #215 first reduces mental overhead. |
| Merge method | Use normal merge commits, not squash. | User explicitly requested no squash. Preserves PR history and author context. |
| Fallback cleanup timing | Do fallback cleanup in the same activation PR. | PR #217 recommends fixing the pre-D288 fallback in the same pass, and activation makes fallback risk live for more pages. |
| Fresh-provision environment | Use Docker dev if available; otherwise use the repo-local provisioning path already used by `init.test.ts` plus a manual app run if sidebar evidence is needed. | Docker dev is closest to operator reality; tests cover seed logic cheaply. |
| Additional offline harness | Do not require additional offline harness runs for this activation unless release owner asks. | PR #217 reports board verification and this activation does not change authored prompt content. |
| Existing dogfood instances | Prefer wipe/re-provision for dogfood verification. Manual patch only when wipe is not acceptable and owner files are inspected first. | Existing seeding preserves files by design; silent overwrite would violate owner trust. |
| Formal test plan | Optional. Create one only if this goes through a stricter release gate or another builder needs a separate QA artifact. | Scope is narrow enough for inline gates in this implementation plan. |

## Architecture

### Component Diagram

```text
PR #215 + PR #217 merged into dev
              |
              v
builds/typescript/memory/starter-pack/projects/templates/
  finance/
  career/
  new-project/
              |
              v
Page journal id lists
  memory/init.ts
  starter-pack/layout.contract.json
  tools/architecture-lint/draft3-memory-lint.ts
              |
              v
Fresh memory provision
  documents/<page>/journal.md
  documents/<page>/run-journal.md
              |
              v
Client sidebar model
  Your Goals
  Your Plan
  Your Journal
```

### Components

#### 1. Runtime Memory Seeder

- **Purpose:** Decides which project template files are copied into `documents/<page>/`.
- **Location:** `builds/typescript/memory/init.ts`
- **Key refs:** `PAGE_JOURNAL_PROJECT_IDS`, `JOURNAL_PROJECT_TEMPLATE_FILES`, fallback template generation.
- **Spec refs:** US-1, US-3.

#### 2. Starter-Pack Contract

- **Purpose:** Declares expected starter-pack layout.
- **Location:** `builds/typescript/memory/starter-pack/layout.contract.json`
- **Key refs:** `page_journal_project_ids`, `page_journal_project_template_files`.
- **Spec refs:** US-2.

#### 3. Architecture Lint

- **Purpose:** Enforces memory architecture invariants and catches missing journal templates or stale nested journal layout.
- **Location:** `builds/typescript/tools/architecture-lint/draft3-memory-lint.ts`
- **Key refs:** `PAGE_JOURNAL_PROJECT_IDS`, `JOURNAL_PROJECT_FILES`, stale journal path checks.
- **Spec refs:** US-2, invariants.

#### 4. Sidebar Model

- **Purpose:** Displays owner artifacts and advanced files without confusing `journal.md` with `run-journal.md`.
- **Location:** `builds/typescript/client_web/src/components/layout/`
- **Key refs:** `sidebar-labels.ts`, `sidebar-categorize.ts`, tests.
- **Spec refs:** US-4.

### Data Flow

1. Starter-pack contains page-specific template files for Finance, Career, and New Project.
2. Runtime seeder checks `PAGE_JOURNAL_PROJECT_IDS`.
3. For each active page-journal id, seeder copies `run-journal.md` and `journal.md` into the owner memory tree.
4. Client file list receives seeded files.
5. Sidebar categorization groups `journal.md` with `spec.md` and `plan.md`.
6. Model uses `run-journal.md` only for post-plan follow-up sessions.

### Evidence Hooks

| Evidence Need | Implementation Hook | Gate |
|---|---|---|
| Id list synchronization | Read/grep changed files and run lint/tests | G-1 |
| Fresh seeding | `memory/init.test.ts` and fresh-provision file listing | G-2 |
| Fallback content | Unit assertions on fallback-generated files or direct tests around fallback path | G-3 |
| Sidebar owner view | `sidebar-categorize.test.ts`, `Sidebar.test.tsx`, and optional screenshot/manual check | G-4 |
| Baseline regression | `npm run test`, `npm run web:test`, `npm run web:typecheck` | G-5 |

## Implementation Roadmap

### Schedule Overview

| Phase | Goal | Spec Refs | Gate Refs | Owner | Status |
|---|---|---|---|---|---|
| 0 | Merge and preflight | Definition of Done | G-0 | Builder | Not Started |
| 1 | Activate ids and tests | US-1, US-2 | G-1, G-2 | Builder | Not Started |
| 2 | Repair fallback defaults | US-3 | G-3 | Builder | Not Started |
| 3 | Verify sidebar and fresh provision | US-4 | G-4 | Builder + release owner | Not Started |
| 4 | Final baseline and handoff | All | G-5 | Builder | Not Started |

### Phase 0: Merge And Preflight

**Goal:** Ensure the activation starts from the correct `dev` state and the authored templates are present.

**Tasks:**

| # | Task | Spec Ref | Gate | Owner | Status |
|---|---|---|---|---|---|
| 0.1 | Confirm branch and working tree with `git status --short --branch`. | DoD | G-0 | Builder | Not Started |
| 0.2 | Fetch latest refs with `git fetch origin --prune`. | DoD | G-0 | Builder | Not Started |
| 0.3 | Confirm PR #215 is merged into `dev`; merge normally if still open and approved. | DoD | G-0 | Builder | Not Started |
| 0.4 | Confirm PR #217 is merged into `dev`; merge normally if still open and approved. | DoD | G-0 | Builder | Not Started |
| 0.5 | Pull or fast-forward local `dev` after merges. | DoD | G-0 | Builder | Not Started |
| 0.6 | Verify template files exist for Finance, Career, and New Project. | US-1 | G-0 | Builder | Not Started |

**Commands:**

```bash
git status --short --branch
git fetch origin --prune
gh pr view 215 --repo BrainDriveAI/BrainDrive --json state,mergedAt,mergeCommit,title
gh pr view 217 --repo BrainDriveAI/BrainDrive --json state,mergedAt,mergeCommit,title
git pull --ff-only origin dev
find builds/typescript/memory/starter-pack/projects/templates \
  -path '*/finance/journal.md' -o \
  -path '*/finance/run-journal.md' -o \
  -path '*/career/journal.md' -o \
  -path '*/career/run-journal.md' -o \
  -path '*/new-project/journal.md' -o \
  -path '*/new-project/run-journal.md'
```

**Success Criteria:**

| Criterion | Spec Ref | Gate | Verification | Expected Result | Evidence |
|---|---|---|---|---|---|
| PR prerequisites landed | DoD | G-0 | `gh pr view` | #215 and #217 are merged | Command output |
| Local branch ready | DoD | G-0 | `git status --short --branch` | On `dev`, clean, tracking origin/dev | Command output |
| Templates present | US-1 | G-0 | `find` or `rg --files` | Six remaining-page journal files exist | File listing |

**Exit Criteria:** PR #215 and PR #217 are on local `dev`, and all Finance/Career/New Project journal templates exist.

### Phase 1: Activate Page Journal Ids

**Goal:** Make runtime, contract, lint, and tests agree that Finance, Career, and New Project are live page-journal projects.

**Tasks:**

| # | Task | Spec Ref | Gate | Owner | Status |
|---|---|---|---|---|---|
| 1.1 | Update `memory/init.test.ts` expectations first: Finance, Career, and New Project should resolve `run-journal.md` and `journal.md`. | US-1 | G-2 | Builder | Not Started |
| 1.2 | Add `finance`, `career`, and `new-project` to `PAGE_JOURNAL_PROJECT_IDS` in `builds/typescript/memory/init.ts`. | US-1 | G-1 | Builder | Not Started |
| 1.3 | Add the same ids to `page_journal_project_ids` in `builds/typescript/memory/starter-pack/layout.contract.json`. | US-2 | G-1 | Builder | Not Started |
| 1.4 | Add the same ids to `PAGE_JOURNAL_PROJECT_IDS` in `builds/typescript/tools/architecture-lint/draft3-memory-lint.ts`. | US-2 | G-1 | Builder | Not Started |
| 1.5 | Run focused memory seeding test and fix only activation-related failures. | US-1, US-2 | G-2 | Builder | Not Started |

**Implementation Notes:**

Expected id list:

```ts
const PAGE_JOURNAL_PROJECT_IDS = new Set([
  "finance",
  "fitness",
  "career",
  "relationships",
  "new-project",
]);
```

JSON list should use stable repo style. Recommended order is the page order already used in `default_page_project_ids`:

```json
"page_journal_project_ids": [
  "finance",
  "fitness",
  "career",
  "relationships",
  "new-project"
]
```

Keep `JOURNAL_PROJECT_TEMPLATE_FILES` unchanged:

```ts
const JOURNAL_PROJECT_TEMPLATE_FILES = ["run-journal.md", "journal.md"] as const;
```

**Commands:**

```bash
rg -n "PAGE_JOURNAL_PROJECT_IDS|page_journal_project_ids|JOURNAL_PROJECT_TEMPLATE_FILES" builds/typescript/memory builds/typescript/tools
cd builds/typescript
npm run test -- memory/init.test.ts
```

If the script does not pass file arguments, use the repo's Vitest pattern, for example:

```bash
cd builds/typescript
npx vitest run memory/init.test.ts
```

**Success Criteria:**

| Criterion | Spec Ref | Gate | Verification | Expected Result | Evidence |
|---|---|---|---|---|---|
| Id lists synchronized | US-2 | G-1 | `rg` and file review | Same five ids in seeder, contract, lint | File diff |
| New pages seed journal files in tests | US-1 | G-2 | `npm run test -- memory/init.test.ts` or `npx vitest run memory/init.test.ts` | Test exits 0 | Test output |
| Existing proof pages remain active | Invariant | G-2 | Same test | Fitness and Relationships still seed journal files | Test output |

**Exit Criteria:** Focused memory seeding tests pass and id lists match.

### Phase 2: Repair Fallback Journal Defaults

**Goal:** Ensure fallback-generated journal files are safe if starter-pack templates are unavailable.

**Tasks:**

| # | Task | Spec Ref | Gate | Owner | Status |
|---|---|---|---|---|---|
| 2.1 | Add or update fallback assertions in `memory/init.test.ts` if a testable fallback path already exists. | US-3 | G-3 | Builder | Not Started |
| 2.2 | Update fallback `journal.md` generation in `builds/typescript/memory/init.ts`. | US-3 | G-3 | Builder | Not Started |
| 2.3 | Update fallback `run-journal.md` wording in `builds/typescript/memory/init.ts`. | US-3 | G-3 | Builder | Not Started |
| 2.4 | Run focused memory tests again. | US-3 | G-3 | Builder | Not Started |

**Fallback `journal.md` Target Content:**

Use page-specific heading when project name is available:

```md
# Your Finance Journal

*Your follow-up history for Finance - what's happened since your plan was written, the wins, the blockers, and what you want to do next. BrainDrive keeps this current with you. You can add to it or edit it anytime, and it's never required.*

<!-- New entries go directly below this line, newest first, using the standard journal entry format from run-journal.md. Keep this line in place. -->
```

For generic fallback where page name is not available, `# Your Journal` is acceptable only if it still includes the owner-facing intro and anchor line. Prefer page-specific heading because authored templates use `# Your [Page] Journal`.

**Fallback `run-journal.md` Required Wording:**

It must say:

- `journal.md` is insert-only owner history.
- New entries go directly below the insertion anchor line.
- Newest entries appear first.
- The model must not replace the whole file.
- Corrections are targeted edits only.
- If the file is unreadable/corrupt, write a dated recovery file and do not overwrite the original.

Avoid:

- "Append new entries" without clarifying newest-first anchor insertion.
- "No entries yet."
- Any nested `journal/` path.

**Commands:**

```bash
rg -n "No entries yet|Append new entries|New entries go directly below this line|run-journal.md|journal.md" builds/typescript/memory/init.ts builds/typescript/memory/init.test.ts
cd builds/typescript
npm run test -- memory/init.test.ts
```

**Success Criteria:**

| Criterion | Spec Ref | Gate | Verification | Expected Result | Evidence |
|---|---|---|---|---|---|
| No old fallback text | US-3 | G-3 | `rg -n "No entries yet|Append new entries" builds/typescript/memory/init.ts` | No stale fallback text remains, unless quoted in a negative test | Command output |
| Anchor present | US-3 | G-3 | Test or file review | Fallback journal includes exact insertion anchor | Test output or diff |
| Focused memory tests pass | US-1, US-3 | G-3 | Focused test command | Exit code 0 | Test output |

**Exit Criteria:** Fallback journal defaults are D288-compatible and memory tests pass.

### Phase 3: Verify Sidebar And Fresh Provision

**Goal:** Prove the owner-facing page surface shows `Your Journal` correctly for newly activated pages.

**Tasks:**

| # | Task | Spec Ref | Gate | Owner | Status |
|---|---|---|---|---|---|
| 3.1 | Review existing sidebar tests for Finance journal behavior. | US-4 | G-4 | Builder | Not Started |
| 3.2 | Add or adjust sidebar tests only if activation changes behavior or existing tests do not cover newly activated page files. | US-4 | G-4 | Builder | Not Started |
| 3.3 | Run focused sidebar tests. | US-4 | G-4 | Builder | Not Started |
| 3.4 | Fresh-provision a dev instance or test memory root after activation. | US-4 | G-4 | Builder | Not Started |
| 3.5 | Inspect one newly activated page for `journal.md`, `run-journal.md`, and sidebar `Your Journal`. | US-4 | G-4 | Builder + release owner | Not Started |

**Commands:**

```bash
cd builds/typescript
npm run web:test -- src/components/layout/sidebar-categorize.test.ts src/components/layout/Sidebar.test.tsx
```

Fallback if the script does not pass file args:

```bash
cd builds/typescript
npx vitest run src/components/layout/sidebar-categorize.test.ts src/components/layout/Sidebar.test.tsx
```

Fresh-provision path, if Docker dev is the selected environment:

```bash
./scripts/start.sh dev
```

Then inspect the memory root used by that dev instance. At minimum, capture file listings equivalent to:

```bash
find <memory-root>/documents/finance -maxdepth 1 -type f -name 'journal.md' -o -name 'run-journal.md'
find <memory-root>/documents/career -maxdepth 1 -type f -name 'journal.md' -o -name 'run-journal.md'
find <memory-root>/documents/new-project -maxdepth 1 -type f -name 'journal.md' -o -name 'run-journal.md'
```

**Manual Verification Prompt:**

Use this prompt for the release owner or QA reviewer:

```text
Open a freshly provisioned dev instance after journal go-live activation.

Check one of these pages: Finance, Career, or New Project.

Confirm:
1. The page has Your Goals, Your Plan, and Your Journal.
2. Your Journal opens journal.md.
3. run-journal.md is not shown as an owner journal file.
4. There is no duplicate generic Journal item for the same page.
5. The page still starts with interview -> goals -> plan behavior before any journal follow-up.

Record page checked, environment, date, and any screenshot or notes.
```

**Success Criteria:**

| Criterion | Spec Ref | Gate | Verification | Expected Result | Evidence |
|---|---|---|---|---|---|
| Sidebar tests pass | US-4 | G-4 | Focused web test command | Exit code 0 | Test output |
| Fresh provision seeds files | US-1, US-4 | G-4 | File listing | `journal.md` and `run-journal.md` present for at least one newly activated page | File listing |
| Sidebar shows `Your Journal` | US-4 | G-4 | Manual app check or screenshot | No duplicate/confusing Journal item | Screenshot or notes |

**Exit Criteria:** Fresh provision and sidebar evidence are captured.

### Phase 4: Final Baseline And Handoff

**Goal:** Run broader checks, review the diff, and hand off with clear release status.

**Tasks:**

| # | Task | Spec Ref | Gate | Owner | Status |
|---|---|---|---|---|---|
| 4.1 | Run broad TypeScript tests. | All | G-5 | Builder | Not Started |
| 4.2 | Run broad web tests. | All | G-5 | Builder | Not Started |
| 4.3 | Run web typecheck. | All | G-5 | Builder | Not Started |
| 4.4 | Run architecture lint command if it is separate from `npm run test`. | US-2 | G-5 | Builder | Not Started |
| 4.5 | Review `git diff` for scope creep. | Boundaries | G-5 | Builder | Not Started |
| 4.6 | Prepare handoff summary with files changed, checks run, fresh-provision evidence, and remaining risk. | DoD | G-5 | Builder | Not Started |

**Commands:**

```bash
cd builds/typescript
npm run test
npm run web:test
npm run web:typecheck
```

Find architecture lint script if needed:

```bash
cd builds/typescript
cat package.json | rg -n "architecture|lint|draft3|memory"
rg -n "draft3-memory-lint" .
```

**Success Criteria:**

| Criterion | Spec Ref | Gate | Verification | Expected Result | Evidence |
|---|---|---|---|---|---|
| Main tests pass | All | G-5 | `npm run test` | Exit code 0 | Test output |
| Web tests pass | US-4 | G-5 | `npm run web:test` | Exit code 0 | Test output |
| Web typecheck passes | US-4 | G-5 | `npm run web:typecheck` | Exit code 0 | Typecheck output |
| Scope stayed narrow | Boundaries | G-5 | `git diff --stat` and diff review | Only expected files changed | Diff summary |

**Exit Criteria:** All practical checks pass, or any skipped/failed checks are documented with exact blocker and risk.

## Technical Details

### Expected Files To Touch

Likely required:

- `builds/typescript/memory/init.ts`
- `builds/typescript/memory/init.test.ts`
- `builds/typescript/memory/starter-pack/layout.contract.json`
- `builds/typescript/tools/architecture-lint/draft3-memory-lint.ts`

Possibly required if existing generic sidebar behavior is insufficient:

- `builds/typescript/client_web/src/components/layout/sidebar-labels.ts`
- `builds/typescript/client_web/src/components/layout/sidebar-categorize.ts`
- `builds/typescript/client_web/src/components/layout/sidebar-categorize.test.ts`
- `builds/typescript/client_web/src/components/layout/Sidebar.test.tsx`

Do not touch unless a verified failure requires it:

- Provider config
- Auth
- Installer
- Gateway deployment config
- Existing owner memory
- PR #217 authored template text, except conflict resolution

### Search Commands

Use these before editing:

```bash
rg -n "PAGE_JOURNAL_PROJECT_IDS|page_journal_project_ids|JOURNAL_PROJECT_TEMPLATE_FILES" builds/typescript
rg -n "No entries yet|Append new entries|New entries go directly below this line" builds/typescript/memory/init.ts builds/typescript/memory/starter-pack
rg -n "journal.md|run-journal.md|journal/journal.md|journal/AGENT.md" builds/typescript/memory builds/typescript/client_web/src/components/layout builds/typescript/tools
```

### Suggested Test Additions

In `builds/typescript/memory/init.test.ts`, change the existing negative assertions for Finance/Career/New Project journal files into positive assertions:

```ts
await expect(readFile(path.join(memoryRoot, "documents", "finance", "run-journal.md"), "utf8"))
  .resolves.toContain("# Finance Journal");
await expect(readFile(path.join(memoryRoot, "documents", "finance", "journal.md"), "utf8"))
  .resolves.toContain("# Your Finance Journal");
```

Repeat for Career and New Project, using the exact headings from PR #217 after merge. Also assert `journal/AGENT.md` and `journal/journal.md` still reject for all page-journal projects.

For fallback cleanup, prefer a test that exercises fallback generation without starter-pack template content. If the current test harness cannot reach that path cleanly, add a small targeted test around the helper only if it can be exposed without broad refactor. Otherwise document file-review evidence and rely on existing seeding tests.

### Verification Prompts

#### Code Review Prompt

```text
Review this journal go-live activation diff for scope and release safety.

Confirm:
- The only functional activation is adding finance, career, and new-project to journal page id lists.
- Runtime, contract, lint, and tests enumerate the same page-journal ids.
- Fallback journal.md includes the D288 newest-first anchor line and no "No entries yet."
- Fallback run-journal.md no longer instructs generic bottom append.
- Existing Fitness and Relationships behavior remains covered.
- No provider, auth, installer, deployment, or owner-memory overwrite behavior changed.
```

#### QA Prompt

```text
Verify the Journal Go-Live Activation on a fresh dev provision.

Pages to inspect:
- Finance
- Career
- New Project

Required evidence:
- File listing showing journal.md and run-journal.md for at least one newly activated page.
- Sidebar evidence showing Your Journal beside Your Goals and Your Plan.
- Confirmation that no nested documents/<page>/journal/ folder was seeded.
- Confirmation that run-journal.md is not presented as owner journal state.

Record environment, branch/commit, date, commands run, and any screenshots.
```

#### Handoff Prompt

```text
Prepare the final handoff for Journal Go-Live Activation.

Include:
- PR #215 and #217 merge status and merge method.
- Files changed in the activation PR.
- Exact id list now active for page journals.
- Checks run and results.
- Fresh-provision evidence.
- Any skipped verification and why.
- Remaining risks or follow-up tasks, especially existing dogfood instance patching.
```

## Security Considerations

| Threat | Mitigation |
|---|---|
| Existing owner files overwritten | Do not implement automatic overwrite migration. Use fresh provision or explicit manual patch with owner-file inspection. |
| Malformed fallback journal corrupts future entries | Fix fallback content before activation is considered done. |
| Model treats journal as mandatory tracking | Do not alter PR #217 content unless correcting conflicts; preserve available-but-not-required language. |
| Confusing sidebar causes owner to edit procedure file | Verify `journal.md` is `Your Journal` and `run-journal.md` remains managed/advanced. |
| Scope creep into provider/auth/deployment | Diff review in Phase 4 blocks unrelated changes. |

## Risks And Mitigations

| Risk | Likelihood | Mitigation |
|---|---:|---|
| PR #217 not merged before activation | Medium | Phase 0 blocks activation until templates exist. |
| Test expectations fail because headings differ from assumed names | Medium | Read actual PR #217 template headings after merge and match tests to real files. |
| Fallback helper is hard to unit-test directly | Medium | Prefer existing init test harness; if not practical, use file-review evidence and avoid helper refactor unless small. |
| Sidebar already generic, causing unnecessary UI edits | Medium | Verify first; only edit sidebar if tests or manual check fail. |
| Existing dogfood instances do not receive new files | High | Treat as operational: wipe/re-provision or manual patch, not automatic overwrite. |
| Architecture lint command is unclear | Medium | Search package scripts; if no dedicated command exists, run the test suite that covers it and document exact coverage. |

## Open Items With Recommendations

- [ ] **Has PR #215 landed?** Recommendation: merge #215 first with a normal merge commit before #217 or before activation.
- [ ] **Has PR #217 landed?** Recommendation: merge #217 with a normal merge commit before any id activation.
- [ ] **Same PR or separate PR for fallback cleanup?** Recommendation: same activation PR, because activation expands fallback blast radius.
- [ ] **Fresh-provision environment?** Recommendation: Docker dev for release evidence; local test memory root is acceptable for preflight.
- [ ] **Additional harness required?** Recommendation: not required for this activation unless release owner requests it, because no authored prompt behavior is being changed.
- [ ] **Dogfood instance handling?** Recommendation: wipe/re-provision dogfood instances for clean release validation. Manual patch only when preserving local state is required.
- [ ] **Formal test plan needed?** Recommendation: optional. If the activation becomes part of a larger release train, create `journal-go-live-activation-test-plan.md` from this plan's gates.

## Completion Checklist

### Merge Preconditions

- [ ] PR #215 merged to `dev` with normal merge commit.
- [ ] PR #217 merged to `dev` with normal merge commit.
- [ ] Local `dev` fast-forwarded to include both merges.

### Code

- [ ] `memory/init.ts` page-journal ids expanded.
- [ ] `layout.contract.json` page-journal ids expanded.
- [ ] `draft3-memory-lint.ts` page-journal ids expanded.
- [ ] `memory/init.ts` fallback `journal.md` repaired.
- [ ] `memory/init.ts` fallback `run-journal.md` repaired.
- [ ] Tests updated for Finance, Career, and New Project journal files.
- [ ] Sidebar code untouched unless verification required changes.

### Verification

- [ ] Focused memory seeding tests pass.
- [ ] Focused sidebar tests pass or sidebar manually verified if no code changed.
- [ ] Architecture lint/contract check passes.
- [ ] `npm run test` passes or blocker documented.
- [ ] `npm run web:test` passes or blocker documented.
- [ ] `npm run web:typecheck` passes or blocker documented.
- [ ] Fresh-provision evidence captured.

### Release Evidence

- [ ] File listing for at least one newly activated page.
- [ ] Sidebar evidence for `Your Journal`.
- [ ] Confirmation no nested `journal/` folder is seeded.
- [ ] Handoff summary prepared.

## Human Checkpoints

### After Phase 0

- [ ] Release owner confirms #215 and #217 are allowed to land on `dev`.

### After Phase 2

- [ ] Reviewer confirms fallback content is acceptable and does not reintroduce pre-D288 format.

### After Phase 3

- [ ] Release owner confirms fresh-provision evidence is sufficient for go-live.

### Before Merge Of Activation PR

- [ ] Final diff review confirms no provider/auth/installer/deployment/owner-memory migration scope creep.

## Work Log And Changelog

### Changelog

| Date | Change | Details |
|---|---|---|
| 2026-07-05 | Initial implementation plan created | Based on `journal-go-live-activation-spec.md`, PR #217 description, PR #215 sequencing note, and local `dev` reconnaissance. |

### Work Log

**2026-07-05 - Plan Creation**

- What was attempted: Convert go-live spec into implementation phases and agent handoff prompts.
- What worked: Activation scope is narrow and maps cleanly to seeding, contract, lint, fallback, and verification.
- What did not work: No separate test plan exists yet, so release gates are inline.
- Decisions made: Recommend same activation PR for fallback cleanup; recommend Docker dev fresh-provision evidence if available.
- Lessons learned: Existing `dev` already has generic sidebar and flat journal handling for Fitness/Relationships, so the activation should avoid broad UI work unless verification fails.

## Conversation References

| Date | Source | Topic | Location |
|---|---|---|---|
| 2026-07-05 | Codex session | PR #217 merge readiness and go-live activation scope | Local chat |
| 2026-07-05 | Codex session | Go-live spec creation | `journal-go-live-activation-spec.md` |
| 2026-07-05 | GitHub PR #215 | Journal calibration tunes | https://github.com/BrainDriveAI/BrainDrive/pull/215 |
| 2026-07-05 | GitHub PR #217 | Remaining page journal templates and go-live checklist | https://github.com/BrainDriveAI/BrainDrive/pull/217 |

## Notes

This plan intentionally keeps runtime retry for empty/truncated model completions out of scope. That concern is real, but it belongs to the active model-retry work, not this journal activation pass.

Next step after accepting this plan: merge #215 and #217 with normal merge commits, then begin Phase 0/1.
