Skip to content

Latest commit

 

History

History
329 lines (279 loc) · 16.3 KB

AGENTS.md

File metadata and controls

329 lines (279 loc) · 16.3 KB

Guidelines for AI assistants: Function Reference

Rules for any AI assistant (Claude, Copilot, Codex, ...) that writes or edits this site. They are the same for all aimms help sites, plus the rules for this site at the end; where the two differ, the rules for this site win. CLAUDE.md points here.

This site

  • Function Reference, published at https://documentation.aimms.com/functionreference/
  • Audience: aimms developers looking up one function, procedure, predefined identifier or suffix.
  • Built with Sphinx 8 and sphinx-aimms-theme (the aimms help look). Dependencies in pyproject.toml, installed with uv.

Before you change anything

  • Plan first, then edit. Before changing any file, work out which files change and where exactly (file, section, after which heading), show that plan to the person you work for, and wait for an explicit yes ("approve", "go ahead"). This applies to every change, however small. If, while writing, another file turns out to need a change, stop and ask again for that file.
  • Change only what is in the approved plan. Do not reformat or "improve" other pages.
  • Do not commit, push or open a merge request unless asked. Leave changes for review.
  • Do not change conf.py, pyproject.toml, .gitlab-ci.yml or the home page (index.rst) unless asked.
  • Run the lint and build before you say you are done (see What the pipeline checks, and Build). The pipeline builds with -W: a warning fails it.
  • Document what the reader sees and does, never implementation details (source files, function names, internal events). Option names, menu items and messages must match the software exactly: never invent them. When the ticket or request is unclear about behaviour, ask instead of guessing.

Writing

  • aimms is always lowercase in running text, headings, captions, link text and descriptions: "aimms", "the aimms IDE", "aimms Cloud", "aimms PRO", "an aimms project".
    • Keep the exact spelling where it is literal: code, identifiers (AimmsXLLibrary), file and folder names, URLs, menu items and messages exactly as the software shows them, and quoted error messages.
    • Product names keep their own spelling: SENSAI, SC Navigator, WebUI, aimmspy, pyaimms.
    • When you edit a page, fix the spelling of aimms in the text you touch. Do not rewrite whole pages only for this unless asked.
  • Plain and short. Short sentences, active voice, "you" for the reader. One idea per paragraph. Explain the goal before the steps.
  • Sentence case for headings: "Create a scenario", not "Create A Scenario".
  • Page titles: 60 characters at most (spaces included), so the title fits on one line in the page header, in the menu, in the browser tab and in search results. Say what the reader does or gets, and leave out what the breadcrumb already says: "Migrate the PRO server to a new machine", not "Migrate aimms PRO On-Premise Server to Another Machine". Section headings inside a page: 50 characters at most.
  • No em dashes (—). Use a comma, a colon, parentheses or two sentences.
  • No filler: no "simply", "just", "easily", "please note that".
  • Anything you click or choose in the software (menus, menu paths, buttons, tabs, options) with :menuselection:, with > between the steps of a path: :menuselection:File > Library Manager, :menuselection:Save. Not bold, not quotes: the theme shows it as a small label.
  • Code style (double backquotes) for file names, identifiers, values and annotations (MainExecution, 2025-01-31); keys as :kbd:Ctrl+S. Bold only for real emphasis, italic sparingly.
  • New behaviour is version-gated: "Starting with aimms 25.6, ..." (or the product version: "Starting with WebUI 26.3, ...").
  • American English spelling. Correct words the spell checker does not know go in spelling_wordlist.txt, one per line.

Page metadata (every page)

Every page starts with its title and then a meta block:

Create a scenario
=================

.. meta::
   :description: Create a scenario in SC Navigator, copy its input data and choose which steps of the workflow to run.
   :keywords: scenario, create scenario, copy scenario, scenario input data, workflow steps
  • Every page has a meta block with both fields, the home page and section index pages included.
  • description: one sentence of 120 to 160 characters (160 is the hard maximum, spaces included; search engines cut longer text) that says what the reader can do or learn on this page. Plain text, no markup, no "This page...", not a copy of the title. The theme shows it under the title, and search engines show it in their results.
  • keywords: 5 to 10 comma-separated terms (never more than 10) people would search for: the main topic, its synonyms, the aimms names of the things involved, and the words a customer would use.
  • New pages always get both. When you edit a page that has no meta block, add one.
  • To list the pages that miss one: uv run python -m sphinx_aimms_theme.lint --report.

RST formatting

  • Headings: underline only, at least as long as the title. New pages use this order:

    Title
    =====
    
    Section
    -------
    
    Subsection
    ~~~~~~~~~~
    
    Level 4
    ^^^^^^^
    
    Level 5
    """""""

    In an existing page, keep the markers that page already uses.

  • File names: lowercase with hyphens (create-scenario.rst), never spaces, for pages, images and downloads alike. File names are case sensitive on Linux (the pipeline) even when Windows builds pass. A space inside a path in a directive (images/page diff.png) is dropped by Sphinx, so the reference quietly points to another file name.

  • Links: :doc: to pages in this repo, :ref: to labels (survives title changes), the intersphinx roles or full URLs for the other aimms sites, and aimms functions with :aimms:func: (other aimms objects with their :aimms:...: role or :any:). Names that are not documented on the aimms sites (a procedure of the article's example, a library like DEX) get a ! so they are shown but not linked: :aimms:procedure:`!pr_Solve`. Names defined in the same page with .. aimms:procedure:: link without it. Not plain HTML links like `text <page.html#anchor>`_ to pages of this site: the build cannot check those, so they break without anyone noticing. Existing HTML links may stay until the page is edited.

  • Code: .. code-block:: aimms for aimms code (the theme highlights it), python, json, xml and so on for the rest. Keep examples small and complete.

  • Images: .. image:: or .. figure:: with :alt: text, in the images/ folder next to the page, named <page-slug>-<what>.<png|gif> in lowercase with hyphens. Screenshots of the product as it looks now. When a picture is still to be made, add the directive with the planned file name and tell the person you work for what to capture. A purely decorative image (a logo next to a title that names the same thing) gets an empty :alt:, so screen readers skip it; without :alt: they read the file path.

  • Videos: the only place for raw HTML. Use the build path _images/:

    .. raw:: html
    
       <video style="width:100%; height:auto;" controls>
          <source src="_images/<page-slug>-<what>.mp4" type="video/mp4">
       </video>
  • Admonitions: .. note:: for extra detail and edge cases, .. important:: for compatibility limits, experimental features and performance warnings, .. tip:: and .. warning:: when they fit. Lowercase directive, blank line after it, content indented. Only when the reader must not miss it; at most a few per page.

  • Toctrees: every .. toctree:: has :maxdepth: 1, so a section page lists only its direct children (the menu on the left shows the deeper levels). The hidden toctree in index.rst also has :titlesonly:. Entries are file names without .rst, lowercase with hyphens, no spaces. Options and entries use the same indentation, with a blank line between them: an entry indented deeper than :maxdepth: is read with a leading space and the page is not found. Every page is in exactly one toctree.

  • A toctree goes before the first section heading of the page. The menu leaves out the sub pages of a toctree inside a section. If a section should list the pages, give the toctree :hidden: at the top and link the pages in the section with :doc:.

  • PDFs: to show a PDF inside a page use .. aimms-pdf:: <url> (options :title: and :height:); it adds "Open in a new tab" and "Download PDF". For a plain link use :download: or a normal link.

  • Tables: .. list-table:: for anything with more than plain text in the cells.

  • No other raw HTML and no inline styles: the theme does the look.

  • Do not add "Help & feedback" blocks, Previous/Next links, support menus or "Last updated" lines: the theme adds what is needed.

Home page and quick searches

  • index.rst follows the home page pattern of the theme (sphinx-aimms-theme/docs/home-page-example.rst): three colored path cards, topic cards, and the hidden toctree that is the site menu.
  • The quick searches under the home search are home_search_suggestions in site_config(...) in conf.py. Now: Card, Element, StringToElement, CurrentToString, GMP, Dialog. They should be what people look for most; change them only when asked.

Section icons

The big sections have an icon next to their title and on their home page card. The icons are part of the theme (black and lime on light backgrounds, white on the blue header); this repo only says which icon goes with which page, in section_icons of site_config(...) in conf.py:

    section_icons={
        'cloud/index': 'cloud',      # docname (or the full URL of a card that links to another site): icon
    },

Icons of this site now:

Page Icon
elementary-computational-operations/index calc
algorithmic-capabilities/index bars
model-handling/index tree
data-management/index database
user-interface-related-functions/index dialog
development-support/index bug
system-interaction/index terminal
predefined-identifiers/index tag
suffices/index suffix
deprecated/index deprecated

A new big section: pick the icon that fits from the list below and add one line to section_icons. Use an icon only once per site when you can.

No icon fits: do not draw one in this repo and do not use images or emoji. New icons are made in the theme repo (sphinx-aimms-theme, AGENTS.md, "Section icons") and released with the theme; ask the person you work for to request one.

All icons in the theme:

Name Shows
appendix lines with a block (appendices, reference lists)
bars bar chart (algorithms, solvers, capabilities)
blocks four blocks (widgets, components)
book open book (user's guide, manuals)
books books (libraries)
box box with lid (examples, apps)
braces { } (sets, declarations)
bug bug (debugging, development support)
calc + - x = (computations)
cap graduation cap (courses, learning)
check check in a circle (best practices)
clock clock (recent, time)
cloud cloud (aimms Cloud, publishing)
code </> (language, code)
database cylinder (data, cases, databases)
deprecated box with x (deprecated)
dialog window with button (user interface, dialogs)
download arrow into a tray (downloads, installers)
exchange two arrows (data exchange, integration, data communication)
flow block to block (procedures, flow)
folder folder (files, folders)
function f (functions, function reference)
grid four dots (miscellaneous)
history clock with arrow (software evolution, versions)
hourglass hourglass (product lifecycle, deprecation dates)
ide window with panels (the aimms IDE)
info i in a circle (basics, introduction)
key key (licensing, license server)
layers layers (platform, page structure)
palette palette (styling, theming)
plus block with plus (advanced, extras)
preface closed book with ribbon (preface)
python two blocks with eyes (Python)
release lines with a sparkle (release notes)
server server stack (PRO, on-premise)
shield shield (security)
sigma sum sign (modeling, math)
sparkle sparkle (SENSAI, AI)
sparse scattered blocks (sparse execution)
start flag (getting started, preliminaries)
suffix block with small block (suffixes)
table table (tables)
tag tag (predefined identifiers, labels)
target target (optimization, solvers)
terminal terminal (system interaction, command line)
toolbox toolbox (toolkit)
tree tree of blocks (model tree, model handling)
webui browser with widgets (WebUI, app development)

What the pipeline checks

The docs_lint job runs the rules of this file that a machine can check, and fails the MR on problems in what the branch changed. Run it yourself before you push:

uv run python -m sphinx_aimms_theme.lint --base origin/master --fix

(origin/main or origin/develop where that is the target branch.)

  • A new file must pass every rule: name, meta, title, heading order, images (alt text, in images/, not too large, actually used), no em dash, lowercase aimms.
  • A page you changed must pass the page rules: meta block, title of 60 characters at most, toctrees with :maxdepth: 1. If the page has no meta block, add one.
  • A line you changed must pass the line rules: image alt text and folder, no em dash, no capital AIMMS in the text, no raw HTML (except videos), no HTML links to pages of the site.
  • The shared setup must never change here: conf.py holds only site_config(...), pyproject.toml lists only sphinx-aimms-theme, there is no _templates/ or _static/, AGENTS.md matches the theme and the docs jobs are in .gitlab-ci.yml. Anything that should change for a site is changed in sphinx-aimms-theme, for all sites at once.
  • Old problems in lines and pages you did not touch are listed as debt and never block.
  • --fix repairs what is mechanical (toctrees). The problems also show on the lines of the MR diff (Code Quality), each with the fix.
  • On MRs, Claude may add one comment with what the lint cannot check (clarity, structure, tone). It is advice and never blocks; act on it where it is right.

Build

uv sync
uv run sphinx-build -W --keep-going -b html . _build/html
uv run sphinx-build -W --keep-going -b spelling . _build/spelling
uv run sphinx-build -W --keep-going -b linkcheck . _build/linkcheck
  • The spell checker needs the native enchant library (Linux: apt install libenchant-2-2, macOS: brew install enchant, Windows: usually works as is).
  • The theme builds the search index (Pagefind) at the end of the HTML build. Open _build/html through a local web server (python -m http.server -d _build/html) to try the search; it does not work from file://.
  • Warnings of type aimms.config come from the theme's check of conf.py (anything besides site_config(...), missing quick searches, wrong Sphinx version). Fix the cause; do not silence them.
  • Never edit _build/.

Function Reference specifics

  • One page per function, starting with the aimms domain directive and its label:

    .. aimms:function:: Card(Identifier, Suffix)
    
    .. _Card:
    
    Card
    ====

    Then: what it does, the syntax in a code-block:: aimms, the arguments, the return value, an example, and "See also".

  • Link to functions with :aimms:func: (they show up in "Used on this page").

  • The meta description of a function page is one sentence on what the function does.

  • The PDF (uv run make latexpdf) is built from the same pages: no raw HTML, no sphinx-design cards outside the home page.

  • One tree: this manual is part of documentation.aimms.com (parent_site in conf.py). Its sidebar shows the documentation menu with this manual open in it, and Documentation comes first in the breadcrumbs. Keep parent_site; do not add a link back to the documentation home in the toctree.