|
| 1 | +# Session Handoff — 2026-04-03 |
| 2 | + |
| 3 | +## What Was Done |
| 4 | + |
| 5 | +### 1. Pre-commit Fix + Push |
| 6 | +- Fixed pre-push pytest hook missing `-m "not integration"` (matched CI config) |
| 7 | +- Established bundle push workflow: this machine → scp bundle → remote pulls → remote pushes to GitHub |
| 8 | + |
| 9 | +### 2. `studyctl clean` Command |
| 10 | +- **FCIS architecture** — pure logic in `_clean_logic.py` (`plan_clean()` returns `CleanResult`), thin CLI shell in `_clean.py` |
| 11 | +- Kills zombie tmux sessions (no child process + aged >60s) |
| 12 | +- Removes stale session directories, resets ended state files |
| 13 | +- `--dry-run` flag for preview, TOCTOU protection via `LOCK_FILE` |
| 14 | +- Symlink safety, graceful tmux-server-down handling |
| 15 | +- 17 new tests, zero mocks on the core logic |
| 16 | + |
| 17 | +### 3. tmux-resurrect Compatibility |
| 18 | +- **Auto-clean on startup**: `_auto_clean_zombies()` runs at top of `studyctl study` before session creation |
| 19 | +- **Documented restore hook**: `@resurrect-restore-hook` config snippet in `setup-guide.md` |
| 20 | +- **Doctor check**: detects tmux-resurrect plugin, warns if restore hook not configured |
| 21 | +- 4 new tests |
| 22 | + |
| 23 | +### 4. Study Backlog Phase 1 — CRUD + CLI |
| 24 | +- `studyctl backlog list/add/resolve` commands |
| 25 | +- Migration v16: `source` (parked|struggled|manual) + `tech_area` columns on `parked_topics` |
| 26 | +- `backlog_logic.py` — FCIS functional core with `format_backlog_list()`, `build_backlog_summary()`, `plan_auto_persist()` |
| 27 | +- Auto-persist struggled topics at session end |
| 28 | +- Inject backlog summary into agent persona at session start |
| 29 | +- 27 new tests (14 unit, 9 CLI, 4 fixture updates) |
| 30 | + |
| 31 | +### 5. Study Backlog Phase 2 — AI Prioritization + MCP |
| 32 | +- Migration v17: `priority` INTEGER column on `parked_topics` (agent-assessed importance 1-5) |
| 33 | +- `score_backlog_items()` — algorithmic scoring: 60% importance + 40% frequency |
| 34 | +- `studyctl backlog suggest` — ranked topic suggestions CLI |
| 35 | +- **4 new MCP tools**: `get_study_backlog`, `get_topic_suggestions`, `get_study_history`, `record_topic_progress` |
| 36 | +- `parking.py`: `get_topic_frequencies()`, `update_topic_priority()` |
| 37 | +- Architecture docs with PlantUML: session-db as first-class component |
| 38 | +- 13 integration tests (real DB, full pipeline, all session types) |
| 39 | +- 11 new unit/CLI tests |
| 40 | + |
| 41 | +### 6. Vendor Static Assets for Offline PWA |
| 42 | +- Vendored HTMX 2.0.4, htmx-ext-sse 2.2.2, Alpine.js 3.14.8 |
| 43 | +- Vendored OpenDyslexic font (CSS + woff2/woff files) |
| 44 | +- Service worker cache bumped to v4 with vendor assets |
| 45 | +- 10 new vendor tests |
| 46 | +- Note: Google Fonts (Inter) still CDN with system fallback |
| 47 | + |
| 48 | +### Documentation Created |
| 49 | +- `docs/mentoring/functional-core-imperative-shell.md` — comprehensive FCIS learning doc with Mermaid diagrams |
| 50 | +- `docs/architecture/study-backlog-phase1.md` — PlantUML architecture for Phase 1 |
| 51 | +- `docs/architecture/study-backlog-phase2.md` — PlantUML architecture for Phase 2 + session-db integration |
| 52 | +- 4 brainstorm docs in `docs/brainstorms/` |
| 53 | + |
| 54 | +## Test Summary |
| 55 | + |
| 56 | +| Suite | Count | |
| 57 | +|-------|-------| |
| 58 | +| CI-safe (`-m "not integration"`) | 786 passed | |
| 59 | +| Integration (real DB) | 13 passed | |
| 60 | +| **Total** | **799 tests** | |
| 61 | + |
| 62 | +Started session at 738, ended at 799 (+61 new tests). |
| 63 | + |
| 64 | +## Current State |
| 65 | + |
| 66 | +- **Branch**: `main` (in sync with origin) |
| 67 | +- **Both machines in sync**: `taylaand` + `ataylor@192.168.125.22` |
| 68 | +- **Clean working tree**: no uncommitted changes |
| 69 | +- **Schema version**: v17 |
| 70 | + |
| 71 | +## Key Patterns Established |
| 72 | + |
| 73 | +- **Functional Core, Imperative Shell (FCIS)**: `_clean_logic.py`, `backlog_logic.py` — pure logic, zero mocks in tests |
| 74 | +- **Query layer over existing data**: study backlog uses `parked_topics`, no new table (YAGNI) |
| 75 | +- **MCP tools as extensibility layer**: agent gets direct session-db read/write access |
| 76 | +- **Bundle push workflow**: git bundle → scp → remote pull → remote push to GitHub |
| 77 | + |
| 78 | +## Key Files Modified/Created |
| 79 | + |
| 80 | +| File | What | |
| 81 | +|------|------| |
| 82 | +| `cli/_clean.py` + `_clean_logic.py` | Clean command (FCIS) | |
| 83 | +| `cli/_topics.py` | Backlog CLI (list/add/resolve/suggest) | |
| 84 | +| `backlog_logic.py` | FCIS core (format, score, persist planning) | |
| 85 | +| `mcp/tools.py` | 4 new MCP tools for session-db | |
| 86 | +| `parking.py` | source, tech_area, priority, frequencies | |
| 87 | +| `tmux.py` | is_tmux_server_running, list_study_sessions, is_zombie_session | |
| 88 | +| `cli/_study.py` | auto-clean zombies, auto-persist struggled, backlog injection | |
| 89 | +| `doctor/config.py` | tmux-resurrect detection | |
| 90 | +| `web/static/vendor/` | Vendored JS/CSS/fonts | |
| 91 | +| `migrations.py` | v16 (source, tech_area) + v17 (priority) | |
| 92 | + |
| 93 | +## Known Issues / Gaps |
| 94 | + |
| 95 | +1. **Google Fonts (Inter)** still loaded from CDN — needs vendoring for true offline or system font fallback |
| 96 | +2. **Nested tmux UAT test** — untested `is_in_tmux()` → `switch_client()` path (needs tmux) |
| 97 | +3. **`--end` from outside UAT test** — `studyctl study --end` CLI path has no UAT test (needs tmux) |
| 98 | +4. **MCP tools not yet registered in agent persona** — agent needs to be told about the new tools via persona/CLAUDE.md |
| 99 | + |
| 100 | +## Next Session — Recommended Start |
| 101 | + |
| 102 | +1. **Verify CI green** on GitHub Actions |
| 103 | +2. **Parked topic warmup at session start** — partially done (backlog injection), could enhance with spaced repetition signals |
| 104 | +3. **Break suggestions at timer threshold crossings** — from `break-science.md` |
| 105 | +4. **Energy streaks** — correlate energy levels with session outcomes in `studyctl streaks` |
| 106 | +5. **Phase 3: Devices** — ttyd + LAN access (needs tmux machine) |
| 107 | + |
| 108 | +## Run Commands |
| 109 | + |
| 110 | +```bash |
| 111 | +# Full CI-safe suite |
| 112 | +uv run ruff check . && uv run ruff format --check . && uv run pytest --tb=short -m "not integration" |
| 113 | + |
| 114 | +# Integration tests (real DB) |
| 115 | +uv run pytest packages/studyctl/tests/test_session_db_integration.py -v |
| 116 | + |
| 117 | +# All new test files from this session |
| 118 | +uv run pytest packages/studyctl/tests/test_clean.py packages/studyctl/tests/test_backlog_logic.py packages/studyctl/tests/test_topics_cli.py packages/studyctl/tests/test_web_vendor.py packages/studyctl/tests/test_session_db_integration.py -v |
| 119 | + |
| 120 | +# Live test |
| 121 | +uv run studyctl study "Python Decorators" --energy 7 |
| 122 | + |
| 123 | +# Try the new commands |
| 124 | +uv run studyctl backlog list |
| 125 | +uv run studyctl backlog add "Closures" --tech Python --note "Need deeper dive" |
| 126 | +uv run studyctl backlog suggest |
| 127 | +uv run studyctl clean --dry-run |
| 128 | +uv run studyctl doctor |
| 129 | +``` |
0 commit comments