Skip to content

DeepWaterIMR/index-template

Repository files navigation

📈 index-template — Build sdmTMB survey indices with AI agents

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:

  1. Ask you a short, structured questionnaire and confirm a plan.
  2. Scaffold a new project folder with a standard structure (docs/, data/, R/, memory/, logs/, review/).
  3. Compile the data from the IMR Biotic database (and, optionally, legacy SPD files), applying the filtering that makes catches quantitative.
  4. 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.

🧰 Built on BAIT

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

🔒 Privacy first

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/, and review/ 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.

🚀 Quickstart

  1. Install BAIT (if you haven't): install https://github.com/DeepWaterIMR/BAIT.
  2. Install index-template:
    install https://github.com/DeepWaterIMR/index-template
    
    The agent runs index-install: a privacy check → cloning index-template → installing the skills globally → verifying BAIT and the R packages (sdmTMB, sdmTMBexperiments, ggOceanMaps).
  3. Start a species index:
    Let's make a biomass index for snabeluer (beaked redfish) using all bottom trawl data
    collected during surveys, using index-template.
    
    The agent runs the questionnaire, plans, scaffolds a project, and drives the four-step workflow.

🗺️ The four-step workflow

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/.

📚 What's in this repo

🚨 You are still in charge

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.

📖 References

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.

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages