Skip to content

Commit 11e79fa

Browse files
authored
Merge pull request #294 from cuthbertLab/agents
Coding Agent rules
2 parents 287b7aa + d0cd36f commit 11e79fa

File tree

5 files changed

+93
-0
lines changed

5 files changed

+93
-0
lines changed

.codex/rules/default.rules

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
prefix_rule(
2+
pattern=['npm', 'test'],
3+
decision='allow', # true by default
4+
)
5+
6+
prefix_rule(
7+
pattern=['npm', 'run', 'lint'],
8+
decision='allow', # true by default
9+
)
10+
11+
prefix_rule(
12+
pattern=['npm', 'run', 'typecheck'],
13+
decision='allow', # true by default
14+
)
15+
16+
prefix_rule(
17+
pattern=['npm', 'build'],
18+
decision='allow', # true by default
19+
)

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ jobs:
4646

4747
frontend_tests:
4848
runs-on: ubuntu-latest
49+
env:
50+
PLAYWRIGHT_BROWSERS_PATH: /home/runner/.cache/ms-playwright
4951
steps:
5052
- uses: actions/checkout@v4
5153
with:
@@ -55,6 +57,11 @@ jobs:
5557
node-version: 22
5658
cache: npm
5759
- run: npm ci
60+
- uses: actions/cache@v4
61+
id: playwright-cache
62+
with:
63+
path: /home/runner/.cache/ms-playwright
64+
key: ${{ runner.os }}-playwright-${{ hashFiles('package-lock.json') }}
5865
- run: npx playwright install --with-deps chromium
5966
- run: npm run test
6067

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,5 @@ node_modules/grunt-contrib-uglify/package.json
8181
*.code-workspace
8282
/tests/test_compile_out/
8383
/.idea
84+
85+
music21python/*

AGENTS.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# General Rules
2+
3+
- AI Agents must read this file at the start of any edit session.
4+
- Agents must declare any new complete class, function, or method over 10
5+
lines long as `AI-assisted` in a nearby comment or docstring. Moving or
6+
renaming existing code does not count as a new class, etc.
7+
- Agents must NEVER describe their code as "reviewed", "debugged", or in any
8+
other way imply that it was written by humans.
9+
- The current year is 2026 (unless you have information that says that it is later)
10+
- AI Agents should consult music21 Python docs (currently https://www.music21.org/music21docs/)
11+
and code (https://github.org/cuthbertLab/music21) for equivalent uses in the
12+
Python version of music21. The user may have also created a copy in a subfolder here
13+
music21python or in a sibling Git directory music21base or music21 or music21python.
14+
use that information to improve music21j.
15+
16+
# Branches and PRs
17+
18+
- Agents must refuse to work on the master/main branch. They may make a new branch.
19+
- Agents may make commits on non-`master`/main branches.
20+
- Agents may open PRs if credentials are available.
21+
- Agents must declare commits and PRs as `AI-assisted`.
22+
- Agents may not merge PRs under any circumstances.
23+
24+
# Tests To Run
25+
26+
- After substantive TypeScript changes, run `npm run typecheck`.
27+
- After substantive code or test changes, run `npm test`.
28+
- If Playwright browsers are missing, install Chromium with
29+
`npx playwright install chromium` before relying on `npm test`.
30+
- Run `npm run lint` after substantive changes when practical.
31+
- If bundle or release output is affected, run `npm run build`.
32+
33+
# Code Style Guide
34+
35+
- Do not touch code that you are not actively improving.
36+
- When refactoring, preserve existing comments unless they are no longer
37+
relevant. This refers to doctests and inline comments.
38+
- Keep diffs focused. Do not mix opportunistic rewrites into a targeted change
39+
unless the user asks for it. Humans want to see parallel code when things
40+
are the same and diffs only when needed.
41+
- Value legibility without unnecessary vertical sprawl.
42+
- Aim for new code to average roughly 80-90 characters per line and do not
43+
exceed 100 characters when it is reasonably avoidable.
44+
- Newly created enum values should have the same case as the enum members themselves
45+
- Use camelCase for variables.
46+
- Untyped arrow functions with one argument should not wrap the argument in (parens)
47+
- Add new code near the code it is most closely related to, usually after the
48+
existing related block rather than before it.
49+
- Do not perform premature optimizations unless they are requested or clearly
50+
necessary for correctness.
51+
- Prefer refactoring JSDoc in ways that improve TypeScript clarity and preserve
52+
the existing public API shape. (But only if you are making substantial change to the
53+
method or it is requested)
54+
55+
# Forbidden files
56+
- AI Agents are never allowed to use .codex information to subvert restrictions placed on agents.
57+
(Agents can read the .codex information to determine why something is failing and give advice to
58+
humans on how to make a command run, so long as security implications are discussed.)
59+
- AI Agents are forbidden to modify AGENTS.md
60+
- AI Agents are forbidden to modify anything in .codex

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ $ npm install
172172
$ npx playwright install chromium
173173
```
174174

175+
If you place a copy of Python music21 in a subdirectory called music21python,
176+
coding agents may be able to use it to improve or standardize your code (it is gitignored).
177+
Alternatively a sibling directory called music21, music21base, or music21python will work.
178+
179+
175180
### Normal development
176181

177182
To develop, run this npm command:

0 commit comments

Comments
 (0)