AGENTS.md — AdsCalculator.xyz

Context Loading Protocol (MANDATORY)

When working on a task, load context in this order:

  1. Read wiki/INDEX.md — find the relevant section (Calculators, Blog, Infrastructure, CSS)
  2. Read wiki/graph.json — find the feature node, follow edges to files
  3. Read ONLY targeted files identified by graph edges — never read full wiki monolith
  4. Read wiki/adscalculator-xyz.md only for strategy/roadmap questions

Example: "fix the ROAS calculator"

INDEX.md → Simple Calculators → ROAS row → JS, HTML, schema
graph.json → node "roas" → edges:
  - simple-main-js (implements — shared with CPC, CPM, CTR, Revenue!)
  - roas-html (renders)
  - roas-schema (has_schema)
  - cpc, cpm, ctr, roi-ltv (related_to)
  - campaign-funnel, email-marketing, mmo (related_to from other side)
→ read_file(js/simple-main.js)  # targeted, not monolith
⚠️ BUG WARNING: simple-main.js is shared by 5 calculators — a bug here breaks all 5

Example: "write a blog post about CPA vs ROAS"

INDEX.md → Blog table → "CPA vs ROAS" → related calcs: [[roas]], [[cpc]]
INDEX.md → Calculators → ROAS + CPC rows → schemas, JS
graph.json → node "roas" → has_schema → roas-schema
              node "cpc" → has_schema → cpc-schema
wiki/content-strategy.md → editorial guidelines

What NOT to do

Updating the Graph

When you add, remove, or rename a file:

  1. Update wiki/graph.json — add/remove node + edges
  2. Update wiki/INDEX.md — add/remove row in the relevant table
  3. Commit both together with the code change

Project Conventions

Known Quirks

Tool Issue Workaround
patch Escape-drift on HTML with quotes Use write_file instead
python Not found on PATH Use node for scripts
sharp Must use local node_modules node convert-images.js
simple-main.js Shared by 5 calculators Bug here = 5 calculators break
CSS @import Unreliable on Cloudflare Pages Concatenate at build time

File Patterns

Type Location Example
Calculator HTML <name>.html (root) roas-calculator.html
Calculator JS (simple) js/simple-main.js shared for ROAS/CPC/CPM/CTR/Revenue
Calculator JS (complex) js/<name>-main.js js/ecom-profit-main.js
Schema _includes/schemas/<name>.njk schemas/roas-calculator.njk
Test tests/<name>.test.js tests/calculations.test.js
Blog post blog/<slug>/index.md blog/roas-vs-roi/index.md
CSS module style/<name>.css style/simple-calc.css
Layout _includes/layout.html base layout