Contributing¶
BDPD welcomes contributions. This page covers the conventions and process for adding code, experiments, and documentation.
Branching Strategy¶
| Branch | Purpose |
|---|---|
main |
Stable, deployable (docs website deploys from main) |
| Feature branches | feature/<name> or fix/<name> |
Workflow:
1. Create a branch from main
2. Make changes, run lints, verify
3. Open a merge request on GitLab
4. After review, merge to main
Code Style¶
Python¶
Configured in pyproject.toml. Enforced by ruff:
Rules enabled: E (pycodestyle), F (pyflakes), I (isort), W (warnings), UP (pyupgrade). Line length: 100 (E501 ignored).
JavaScript¶
Enforced by ESLint:
The platform uses ES modules ("type": "module"). All imports use
import/export syntax.
Pre-Commit Checks¶
Before pushing or opening a merge request:
# Python lint
ruff check shared/ agents/ experiments/ tools/
# JavaScript lint
npx eslint platform/*.js
# Docs build
mkdocs build --strict
If you're adding new Python entry points, ensure they start with:
How to Add...¶
...a New Built-in Agent Strategy¶
- Create a class in
agents/built-in.jsextendingBaseAgent - Implement
decide(obs)returning a harvest number - Register in
STRATEGY_REGISTRY - Add documentation in
docs/platform/agents.md
...a New Experiment Sweep¶
- Create a JSON definition file in
experiments/definitions/ - Format:
{ "name": "...", "sweep": { ... }, "runs": 30, "config": { ... } } - Run with
python experiments/sweep.py --definition <path> - Document in
docs/experiments/platform_sweeps.mdorsupplement_sweeps.md
...a New Card Archetype¶
- Add 20 card definitions to
cards/cards_v03.jsonfollowing the existing schema (id,name,deck,type,count,effects, etc.) - Add faction colours to
tools/card_generator/templates/faction_config.json - Run
generate_cards.pyto verify card images render correctly - Document in
docs/cards/archetypes.md
...a New Perturbation Type¶
- Add the type name to
PERTURBATION_TYPESinplatform/perturbation.js - Add a
casein theapplyPerturbation()function - The payload is type-specific — follow the existing pattern for
before/after state tracking in the
changesobject - Document in
docs/platform/perturbations.md
...a New Documentation Page¶
- Create the
.mdfile underdocs/ - Add it to the
navsection inmkdocs.yml - Preview:
mkdocs serve(starts a local server atlocalhost:8000)
Paper conventions (Quarto books)¶
The four-paper series in docs/publications/paper_0{0,1,2,3}/ is
rendered with Quarto. A few hard-won rules:
- No non-ASCII Unicode outside math mode in
.qmdfiles. Use$\equiv$/$k_2$/$\Delta$/$\times$instead of literal≡/k₂/Δ/×. Headings must stay in plain text — math mode in a heading breaks Pandoc cross-reference labels and silently removes the heading from the TOC. - No math inline in pipe-table cells. Pandoc does not process
$...$inside pipe-table cells; the dollar signs render literally in PDF. Either drop math from the cell or move the math outside the table and reword the cell to plain text. - Render HTML and PDF together. Use
./scripts/render_publications.sh --which paper_NN(the default, no--pdf-only/--html-only). Both outputs are linked from the docs site and we keep them in sync. - Bib hygiene. Only cite works for which a PDF lives in
docs/library/<bibkey>.pdf(or atxts/<bibkey>.txtextract). A bare bib entry is not enough — claims must be verifiable. The preflight inrender_publications.shflags unsourced citations.
Re-aggregating partial runs¶
If a sweep crashes mid-way and you have seed_*/comparison.json files
on disk but no aggregate.json, use the standalone reaggregator in
scripts/reaggregate_*.mjs rather than re-running the API-hitting
pilot. The reducer matches the in-pilot one and reads from disk
without touching the LLM.
Repository Policies¶
- No secrets. Never commit API keys, tokens, or credentials. Use environment variables.
- No large binaries. Card art is CC0 and hosted alongside the code; keep images under 1 MB where possible.
- Licence compliance. New code inherits AGPL-3.0. New documentation inherits CC BY 4.0. Card art must be CC0-compatible.
- Versioning. Never hardcode version numbers. Use
bdpd_version.pywhich reads from git tags.