--- name: reference-doot-marine-codemap description: "Code map for locating the \"Marine\" project (Marine Cert Prep task chain) in doot's DB and Go source" metadata: node_type: memory type: reference originSessionId: 119bd1a5-fb32-4222-9695-fcbe2c8fd63b --- The user's "marine project" is a **doot task chain** named "Marine Cert Prep" — NOT a separate repo. It lives entirely inside the [[project_doot_prod]] `doot` app's data and code. ## Identifiers - `project_id = 410a417491154b18ee3ff9cb` (row in `projects` table, name "Marine Cert Prep", color `#8B5CF6`) - `chain_id = 4ad4ec5d4b133658fb3e0ac0` (row in `task_chains` table, status `active`), also cached at `/tmp/marine_chain_id.txt` - 16 sequential `native_tasks` rows (`chain_position` 0-15) with `chain_id` set to the above — a linear WIP-1 study plan for the NMEA Marine Electrical Installer (MEI) certification, covering ABYC E-11 standards, DC electrical calcs, an FCC Amateur Radio General exam, and a hands-on audit log. ## DB access - Production DB: `/site/doot.terst.org/data/dashboard.db` (SQLite, owned by `www-data`). WAL files sit alongside it; there's also a `.bak-` snapshot from the last migration. - No `sqlite3` CLI installed on this box — query via `python3 -c "import sqlite3; ..."` instead. - Relevant tables: `projects`, `task_chains`, `native_tasks` (has `chain_id`/`chain_position`/`chain_unlocked` columns, added in `migrations/026_task_chains.sql`). - Schema source of truth: `/workspace/doot/migrations/026_task_chains.sql` (chains) and `020_native_tasks.sql` (base table). ## Go code (repo: `/workspace/doot`) - Store layer: `internal/store/chains.go` — `CreateChain`, `GetChain(id)`, `GetChains()`, `GetChainTasks(chainID)`, `SetChainStatus(id, status)`, `advanceChain` (unlock-next-on-complete logic). - Task completion hook that advances chains: `CompleteNativeTask` in `internal/store/native_tasks.go` (returns `ErrChainTaskLocked` if you try to complete a locked step). - Web handlers: `internal/handlers/chains_web.go` — `BuildChainSummaries`, `HandleChainDetailView`, `HandleChainPause/Resume/Abandon`. - Routes (`cmd/dashboard/main.go` ~L330-414): web `GET/POST /chains/{id}[/pause|resume|abandon]`; widget API `POST /api/widget/chains`, `GET /api/widget/chains/{id}`, `POST /api/widget/chains/{id}/{pause,resume,abandon}`. - Agent Context API (external read/write access, bearer-token gated): `internal/handlers/agent.go` — `HandleAgentContext` (GET `/agent/context`), task write/complete endpoints. Auth flow: `POST /agent/auth/request` → browser approval → `GET /agent/auth/poll`. ## How to apply When the user says "my marine project," resolve it to `project_id 410a417491154b18ee3ff9cb` / `chain_id 4ad4ec5d4b133658fb3e0ac0` and go straight to the DB/code above rather than searching for a "marine" repo or directory — there isn't one. [[feedback_deploy_classifier]] and [[feedback_pull_before_build]] still apply if any change here touches the live doot deploy.