Teach your AI coding agent to build a spatiotemporal survey index for stock assessment — for any species, on your own machine.
index-template is a knowledge pack that turns a general coding agent (Claude Code, Codex, Cursor, Gemini CLI, Mistral, …) into a competent assistant for building sdmTMB (Anderson et al., 2025) survey indices from IMR bottom-trawl data, reproducing the method of Vihtakari et al. (2026, ICES Journal of Marine Science).
Tell your agent which species you want an index for, and it will:
- Ask you a short, structured questionnaire and confirm a plan.
- Scaffold a new project folder with a standard structure (
docs/,data/,R/,memory/,logs/,review/). - Compile the data from the IMR Biotic database (and, optionally, legacy SPD files), applying the filtering that makes catches quantitative.
- Fit, validate, and report an sdmTMB index, using helpers from sdmTMBexperiments and maps from ggOceanMaps.
It is not a trained model. Your data never leaves your machine and never enters any model's weights. The agent simply reads this repo while it helps you. See Privacy.
index-template sits on top of BAIT (the Biotic AI Toolkit). BAIT handles Biotic data access, the database, privacy, maps, and life-history; index-template adds the sdmTMB index-building layer. If BAIT is not installed yet, install it first:
install https://github.com/DeepWaterIMR/BAIT
This repo is public and contains instructions only — never data:
- No data and no private paths are ever committed here. Real data and paths live only in the project folder the agent generates for you, where
data/,logs/, andreview/are git-ignored. - The Biotic database lives outside any repo (BAIT default:
~/IMR_biotic_BES_database/). - During setup, turn off model training / data retention for your agent once — BAIT walks you through it and records the onboarding.
- Install BAIT (if you haven't):
install https://github.com/DeepWaterIMR/BAIT. - Install index-template:
The agent runs
install https://github.com/DeepWaterIMR/index-templateindex-install: a privacy check → cloning index-template → installing the skills globally → verifying BAIT and the R packages (sdmTMB,sdmTMBexperiments,ggOceanMaps). - Start a species index:
The agent runs the questionnaire, plans, scaffolds a project, and drives the four-step workflow.
Let's make a biomass index for snabeluer (beaked redfish) using all bottom trawl data collected during surveys, using index-template.
| Step | Skill |
|---|---|
| Scaffold a project (questionnaire + plan) | index-new-project |
| 1. Compile & report the data | index-compile-data |
| 2. Fit the first feasible model | index-fit-model |
| 3. Validate / select the model | index-validate-model |
| 4. Final report + extensions | index-final-report |
Each step's document lives in project-template/docs/ and is index-template's own, evolving implementation — improve it directly as the routine matures. knowledge/workflow.md points to the (IMR-internal) background material the method was originally distilled from, if you want the history.
Long renders are compiled with index-render in a screen session with a log in logs/.
AGENTS.md/CLAUDE.md— the agent contract.skills/— theindex-*skills (installed globally).knowledge/— the shared source of truth (method, data filtering, sdmTMB, helpers, packages, project structure, rendering).project-template/— the skeleton copied into each new project.scaffold.R— stamps a project fromconfig.yaml.examples/redfish/— a worked example.
This repo is designed to create a survey index template. It speeds up the data and model compilation, but does not create ready indices for assessment. It provides a place to start, not a final deliverable. Expert judgment is required for the final assessment.
Anderson, S.C., Ward, E.J., English, P.A., Barnett, L.A.K., & Thorson, J.T. (2025). sdmTMB: An R Package for Fast, Flexible, and User-Friendly Generalized Linear Mixed Effects Models with Spatial and Spatiotemporal Random Fields. Journal of Statistical Software, 115(2), 1–46. doi:10.18637/jss.v115.i02.
Vihtakari, M., Aune, M., Assmann, K.M., Howell, D., Hallfredsson, E.H., & Ward, E.J. (2026). Demersal distribution and fisheries independent trends of beaked and golden redfish in the Barents and Norwegian Seas. ICES Journal of Marine Science, 83(2), fsag009. doi:10.1093/icesjms/fsag009.