aPhysics

AGENTS.md

Instructions for AI coding agents working in this repository. Read this whole file before you change anything.

1. About the project

This is a physics engine for Remotion and three.js animations. It bakes in cloth movement, crash behaviour, and other physics so that animations look natural instead of static.

Clang and Bazel were chosen on purpose: Bazel is fast and has good clang support, and clang is newer than gcc. Do not suggest switching.

2. Working rules

Understand first

Before you edit anything:

  1. Find the code that is related to the task and read it.
  2. For each function you will touch, read what it does, what calls it, what it calls, and what data it uses.
  3. Check the surrounding code, tests, and docs for the same feature.
  4. Only then decide what to change.

Do not edit code you have not read. Do not edit code to see what happens.

Plan first

Before any change, write a short plan and show it to the user:

Start work only after the plan is clear. If the user changes the plan, update it.

Ask questions

If you are unsure how something should be implemented, or what should not be implemented, ask the user. Do not guess. Ask before you write code, not after.

Take your time

Speed is not a goal. A small, correct, well-understood change is better than a fast change you cannot explain. If you find that you do not fully understand the area you are changing, stop and read more.

3. Build, run, and verify

The code must build and run on any supported machine, not only the user’s.

Before you report a change as finished, run the Bazel build and the Bazel tests, and report the exact commands you ran and what they printed. If you could not run something, say so.

You cannot prove that the code works on every machine. Only claim support for the platforms that were actually tested, and name them.

4. Definition of done

Passing tests are not proof that the feature is correct.

5. Dependencies

6. Read the docs before using any tool

Before you use or write code for any tool, library, compiler flag, or Bazel rule:

  1. Search the web for its current official documentation.
  2. Read the page for the exact version this project uses.
  3. Confirm that the command, flag, or function exists and does what you think.

Do not rely on memory. Tools change between versions, especially clang 23 and Bazel 9. If the docs and your memory disagree, trust the docs.

Check any command before you run it. If you are not sure a command is correct and safe, do not run it. Ask the user.

7. Code

8. Comments and logs

Comments:

Logs and messages:

9. Documentation

Docs must be true, short, and up to date.

10. Agent skills for this project

When you write a skill or instruction file that tells an agent how to use this project or one of its tools:

11. License headers

Every source file must have the Apache 2.0 license header. Add it with the addlicense command. Check the tool’s current documentation first to get the right flags, then run it on new files.

Do not write the header by hand, and do not remove it from existing files.

Do not change the copyright line unless explicitly authorized.

12. Before you finish

Go through this list and report it to the user:

13. Other files to read before Execution