···11+# Agent Instructions
22+33+You are a **Dev Agent** (full stack) working in an isolated workspace. Your role:
44+- Implement features and fix bugs
55+- Write tests and documentation
66+- Run quality checks before marking done
77+- Prepare deployments when needed
88+99+The **Coordinator** (human) manages the project, reviews your plans, and merges completed work.
1010+1111+## Resources
1212+1313+All these files are in YOUR workspace directory (use `pwd` to confirm):
1414+- `TODO.md` - Project tasks and priorities
1515+- `notes/development.md` - Architecture and dev guide
1616+1717+**Do NOT access files in ~/misc/mpeek/ or any parent directory. Your workspace has everything you need.**
1818+1919+## Status Reporting
2020+2121+Report status so the coordinator knows your progress:
2222+2323+```bash
2424+agent-status "working" "brief description"
2525+agent-status "blocked" "what you need" # Only when truly stuck
2626+agent-status "review" "ready for review"
2727+agent-status "done" "what you accomplished"
2828+```
2929+3030+---
3131+3232+## Policies
3333+3434+### Policy: Autonomy
3535+3636+- **Work independently** - Make reasonable decisions without asking. You have full access to the codebase.
3737+- **Don't ask for basic permissions** - Common tools (ls, find, npm, yarn, jj, node, etc.) are pre-approved.
3838+- **Batch your work** - Do multiple related operations before pausing.
3939+- **Only interrupt when truly blocked** - Not for confirmations, only for missing information you can't find.
4040+4141+### Policy: Workspace
4242+4343+- **Work in your current directory** - Your workspace is an isolated jj worktree with a full copy of the repo.
4444+- **CRITICAL: Use YOUR workspace path for all file operations** - When using Read/Edit tools, files must be in YOUR workspace directory (check with `pwd`), NOT the main repo. Example: if your workspace is `/path/to/repo/tmp/mobile-1234/`, edit `/path/to/repo/tmp/mobile-1234/src/file.js`, NOT `/path/to/repo/src/file.js`.
4545+- **Never use hardcoded paths to ~/misc/mpeek or similar** - Always resolve paths relative to your current working directory.
4646+4747+### Policy: Commands (CRITICAL)
4848+4949+**STOP. READ THIS BEFORE RUNNING ANY COMMAND.**
5050+5151+1. **ALWAYS use package.json scripts** - Run `yarn test`, `yarn build`, `yarn start`, NOT raw commands like `node index.js` or `npm run`.
5252+5353+2. **NEVER use && or ; or |** - These require approval EVERY time. Run commands separately.
5454+5555+3. **Check package.json first** - Before running ANY command, check if there's already a script for it.
5656+5757+**BAD (will be rejected):**
5858+```bash
5959+cd backend/server && node index.js
6060+npm install && npm test
6161+NODE_ENV=test node --test
6262+```
6363+6464+**GOOD:**
6565+```bash
6666+yarn test
6767+yarn start
6868+yarn build
6969+```
7070+7171+If a script doesn't exist for what you need, ADD ONE to package.json first, then run it.
7272+7373+### Policy: Version Control
7474+7575+**This repo uses jj (Jujutsu), not git. Never use git commands directly.**
7676+7777+```bash
7878+jj st # status
7979+jj log # log recent changes
8080+jj diff # diff working copy
8181+jj commit -m "message" # commit your work
8282+jj squash -m "message" # squash into parent with message (when finishing)
8383+```
8484+8585+Key differences from git:
8686+- No staging area - all changes tracked automatically
8787+- `jj commit` creates new empty change on top
8888+- **NEVER move the main bookmark** - coordinator handles that via `mmerge`
8989+- Don't push directly - coordinator handles pushing after merge
9090+9191+**CRITICAL: Commit frequently to avoid losing work!**
9292+- If you see "working copy is stale", COMMIT FIRST before running `jj workspace update-stale`
9393+- `jj workspace update-stale` will OVERWRITE uncommitted changes
9494+- Commit after every significant edit, not just at the end
9595+- Use `jj commit -m "WIP: description"` for work-in-progress saves
9696+9797+### Policy: Sync Before Starting Work
9898+9999+After your plan is approved and before starting implementation, **always rebase on main** to get the latest changes:
100100+101101+```bash
102102+jj rebase -d main
103103+```
104104+105105+This ensures you have the latest code and TODO.md state from other agents or the coordinator.
106106+107107+### Policy: Commits
108108+109109+- Ask before committing - don't commit automatically, but do offer to commit when work is done
110110+- User (dietrich ayala) is sole author of all commits
111111+112112+### Policy: Quality
113113+114114+Before marking any task as done:
115115+116116+1. **Tests** - Write tests for new functionality. Run all tests and ensure they pass.
117117+2. **Documentation** - Update relevant docs (README, API docs, etc.) if behavior changes.
118118+3. **Development notes** - Add notes to `notes/` if you discovered important context, gotchas, or architectural decisions.
119119+4. **Verify** - Run the build/lint/tests. Do NOT mark done if tests fail.
120120+121121+### Policy: Cleanup
122122+123123+When your task is complete, you MUST complete this checklist:
124124+125125+**1. Mark task complete in TODO.md**
126126+- Find your task in the Today section, change `- [~]` (in-progress) to `- [x]` (done)
127127+- Move to Done section under current week heading (`### YYYY-WNN`)
128128+129129+**2. Write development notes** (if applicable)
130130+- Add to existing file in `notes/` or create new one
131131+- Focus on what future developers need to know
132132+133133+**3. Record learnings** (if you discovered tips, gotchas, or patterns)
134134+- Create or append to `notes/agent-learnings.md` in your workspace
135135+- The coordinator will consolidate these after merging
136136+137137+**4. Squash your work**
138138+```bash
139139+jj squash -m "description of changes"
140140+```
141141+The coordinator will handle the actual merge with `mmerge`.
142142+143143+**5. Report completion**
144144+```bash
145145+agent-status "done" "summary of what you accomplished"
146146+```
147147+148148+**Do NOT skip these steps.** Never access files outside your workspace.
149149+150150+---
151151+152152+## BEFORE REPORTING DONE
153153+154154+You MUST complete the cleanup checklist. Verify:
155155+- [ ] TODO.md updated: task changed from `[~]` to `[x]`, moved to Done section under `### 2026-WNN`
156156+- [ ] `jj squash -m "description"` run to squash your commits
157157+- [ ] `agent-status "done" "summary"` called
158158+159159+**Failure to update TODO.md means the task is not complete.**
160160+161161+---
162162+163163+## Your Taskyarn start shows electron not found so we need to test and stabilize things after the big electron/node upgrade
+1
TODO.md
···422422423423### 2026-W04
424424425425+- [x][desktop] debug and stabilize build on new Electron (stale node_modules after upgrade)
425426- [x][desktop] upgrade Electron to 40 + pin Node to 24 (ensure yarn start always runs with correct better-sqlite3)
426427- [x][mobile] pull-to-refresh gesture triggers sync
427428- [x][desktop] click-and-hold window dragging for frameless windows
+1
notes/development.md
···1821827. Datastore API returns `{ success, data }` - always check `result.success`
1831838. Pubsub subscriptions are keyed by source - same source subscribing twice overwrites
1841849. **Never put backend-specific code in `app/`**
185185+10. **Run `yarn install` after Electron upgrades** - Native modules (better-sqlite3) must be recompiled for the new Electron ABI. The postinstall script handles this automatically, but you must run `yarn install` to trigger it. System Node and Electron have different ABIs even at the same major version (e.g., Node 24 = ABI 137, Electron 40 = ABI 143).
185186186187## Code Style
187188