---
description: "Window 1: Phase 0 scaffolding + Manus cleanup (RUN FIRST — other windows depend on this)"
---

# Window 1: Phase 0 Scaffolding + Manus Cleanup

> **MUST complete before starting Window 2 or Window 3.**
> **Scope:** Root files, `shared/`, `vite.config.ts`, config files. Do NOT create `backend/` or `mobile/`.
> **Reference:** `docs/ECOSYSTEM_ADAPTATION_ROADMAP.md` Sections 4 (Phase 0), 5, and 6.

## Context

This repo (`learning_ai_efforise`) is a Vite + React 19 SPA built by Manus.computer. It needs ecosystem scaffolding before any feature work. The product is **EffoRise** — an identity-based habit tracker. Product ID: `efforise`, backend port: 4020, web port: 3080.

## Step 1: Create Product Identity

Create `shared/product.json` following the ecosystem pattern. Use NoteLett (`../learning_ai_notes/shared/product.json`) or ActionTrail (`../learning_ai_trails/shared/product.json`) as reference. Key fields:

```json
{
  "productId": "efforise",
  "productName": "EffoRise",
  "displayName": "EffoRise",
  "description": "Identity-based habit tracker — rise with efforts",
  "domain": "efforise.app",
  "version": "0.1.0",
  "ports": {
    "backend": 4020,
    "web": 3080
  },
  "bundleIds": {
    "ios": "com.saravana.efforise",
    "android": "com.saravana.efforise"
  },
  "platforms": ["web", "mobile"],
  "tokenPrefix": "--er-",
  "ecosystem": "bytelyst"
}
```

## Step 2: Create Agent Config Files (single-source-of-truth pattern)

Hand-write `AGENTS.md` only. All other agent files are generated by the
canonical script. Legacy files (`CLAUDE.md`, `.cursorrules`, `.windsurfrules`,
`.clinerules`) are **deprecated** and must NOT be created — they used to
duplicate AGENTS.md content and drifted.

1. `AGENTS.md` — AI agent onboarding guide (customize for efforise: Vite SPA + Fastify backend, productId efforise, port 4020, --er-* tokens). Copy structure from `../learning_ai_notes/AGENTS.md` or `../learning_ai_trails/AGENTS.md`.
2. Add this repo to `../learning_ai_common_plat/.windsurf/workflows/repos.txt` if not already present.
3. Run `bash ../learning_ai_common_plat/scripts/update-agent-docs.sh`. This will:
   - Prepend the canonical-behavior-pointer block to `AGENTS.md`
   - Generate `.editorconfig`, `.aider.conf.yml`, `.github/copilot-instructions.md`
   - Verify no legacy files exist (deletes them if present)
4. Verify with `bash ../learning_ai_common_plat/scripts/check-agent-docs-drift.sh`.

## Step 3: Create Root Config Files

1. Add `.nvmrc` with content `22`
2. Update `packageManager` in `package.json` to `"pnpm@10.6.5"`
3. Add `.npmrc` — copy from `../learning_ai_notes/.npmrc` (Gitea registry config)
4. Add `.npmrc.docker` — copy from `../learning_ai_notes/.npmrc.docker`
5. Add `pnpm-workspace.yaml`:
   ```yaml
   packages:
     - backend
   ```
6. Add `.husky/pre-commit` and `.husky/pre-push` — copy from `../learning_ai_notes/.husky/`
7. Add `scripts/secret-scan-repo.sh` and `scripts/secret-scan-staged.sh` — copy from `../learning_ai_notes/scripts/`
8. Add `.dockerignore` — copy from `../learning_ai_notes/.dockerignore`
9. Add `eslint.config.js` at root — ESLint 9 flat config

## Step 4: Manus Artifact Cleanup

### 4a. Clean `vite.config.ts`
- Remove `vite-plugin-manus-runtime` plugin
- Remove `vite-plugin-manus-debug-collector` plugin + all LOG_DIR code
- Remove `@builder.io/vite-plugin-jsx-loc` plugin
- Replace `allowedHosts: [".manuspre.computer", ...]` with `allowedHosts: ["localhost"]`

### 4b. Delete Manus Files
- Delete `client/src/components/ManusDialog.tsx`
- Delete `client/src/components/Map.tsx` (Google Maps boilerplate, 156 lines)
- Delete `client/public/__manus__/` directory (contains `debug-collector.js`)
- Delete `client/public/images/` (empty dir, referenced `identity-tree.png` never existed)
- Delete `report.txt` (root — Manus project report)
- Delete `server/` directory entirely (Express static server — replaced by backend/ in Phase 1)
- Delete `shared/const.ts` (Manus OAuth constants — `COOKIE_NAME`, `ONE_YEAR_MS`)
- Delete `patches/wouter@3.7.1.patch` (evaluate first — remove if not critical)

### 4c. Clean `client/index.html`
- Remove `VITE_ANALYTICS_ENDPOINT` / `VITE_ANALYTICS_WEBSITE_ID` script references

### 4d. Dependency Cleanup in `package.json`
- **Downgrade** `zod` from `^4.1.12` → `^3.24.2` (CRITICAL — Zod 4 breaks @bytelyst/* integration)
- **Upgrade** `typescript` from `5.6.3` → `^5.7.3`
- **Remove:** `streamdown`, `cmdk`, `add` (devDep), `@types/google.maps` (devDep), `next-themes`
- **Remove:** `express`, `@types/express` (server/ is deleted)
- **Remove** Manus vite plugins from devDeps: `vite-plugin-manus-runtime`, `@builder.io/vite-plugin-jsx-loc`

### 4e. Move Files
- Move `ideas.md` → `docs/ideas.md`

## Step 5: Create README.md

Write a proper README.md with:
- Product name + description
- Tech stack (Vite + React 19 SPA, Fastify 5 backend planned)
- Setup instructions (`pnpm install`, `pnpm dev`)
- Port assignments (backend: 4020, web: 3080)
- Link to `docs/ECOSYSTEM_ADAPTATION_ROADMAP.md`

## Step 6: Verify

- Run `pnpm install` to verify lock file generates cleanly
- Run `pnpm dev` to verify the Vite SPA still works after cleanup
- Commit: `chore(scaffold): Phase 0 product identity + ecosystem scaffolding`
- Commit: `chore(cleanup): remove Manus artifacts and fix dependencies`

## Done Signal

When complete, tell the user: **"Window 1 complete. You can now start Window 2 (backend) and Window 3 (web) in parallel."**
