Skip to content

Commit bc7e5ee

Browse files
committed
Document recursion rule for agents
1 parent 1062da4 commit bc7e5ee

3 files changed

Lines changed: 38 additions & 0 deletions

File tree

AGENT.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,13 @@ Compatibility pointer for tools that look for a singular `AGENT.md`.
2020
- Package build: `uv build`
2121
- Docs site build: `cd site && npm install && npm run build`
2222

23+
## Key Rules (short form)
24+
25+
- A7 source recursion is banned; the compiler reports direct and mutual
26+
recursion as semantic errors. Use loops, explicit stacks, or index-based
27+
worklists in examples and tests.
28+
- Keep `README.md`, `docs/SPEC.md`, `CHANGELOG.md`, `MISSING_FEATURES.md`,
29+
and `TODO.md` aligned with any user-visible change.
30+
2331
See `AGENTS.md` for the full workflow, post-change checklist, and security
2432
caveats.

AGENTS.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ backend tests, example e2e, debug + release artifacts, error-stage matrix,
2727
docs style). Run it before tagging or before reporting a task as done when
2828
changes are non-trivial.
2929

30+
## A7 Source Rules
31+
32+
- A7 source recursion is banned. Semantic validation rejects both direct and
33+
mutual recursion as compile-time errors; do not author examples, tests, or
34+
docs that rely on recursive A7 functions.
35+
- Port recursive algorithms to loops, explicit stacks, or index-based
36+
worklists (see `examples/025_linked_list.a7` and
37+
`examples/026_binary_tree.a7` for the expected style).
38+
- This rule applies to A7 source only. Compiler internals already use
39+
iterative AST traversals; keep them that way.
40+
3041
## Post-Change Checklist
3142

3243
After making major changes (new language features, bug fixes, backend
@@ -39,6 +50,10 @@ committing:
3950
4. **MISSING_FEATURES.md** — mark completed gaps or document new ones
4051
5. **TODO.md** — check off completed items or add newly discovered work
4152

53+
Keep examples and docs aligned across `README.md`, `docs/SPEC.md`,
54+
`CHANGELOG.md`, `MISSING_FEATURES.md`, and `TODO.md` — drift between them is
55+
treated as a bug.
56+
4257
## Security Caveat
4358

4459
`a7-py` is **not** a sandbox for untrusted source. The compiler emits Zig or C

CLAUDE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ the `main.py` wrapper when working from a fresh checkout.
2626
backend tests, example e2e, debug + release artifacts, error-stage matrix,
2727
docs style). Run it before reporting a non-trivial task as done.
2828

29+
## A7 Source Rules
30+
31+
- A7 source recursion is banned. Semantic validation rejects both direct and
32+
mutual recursion as compile-time errors; do not introduce examples, tests,
33+
or docs that rely on recursive A7 functions.
34+
- Prefer loops, explicit stacks, or index-based worklists when porting
35+
recursive algorithms (see `examples/025_linked_list.a7`,
36+
`examples/026_binary_tree.a7`).
37+
- This rule applies to A7 source only. Compiler internals already use
38+
iterative AST traversals; keep them that way.
39+
2940
## Post-Change Checklist
3041

3142
When language features, backends, or user-facing behavior change, update:
@@ -36,6 +47,10 @@ When language features, backends, or user-facing behavior change, update:
3647
4. `MISSING_FEATURES.md` — close or open gaps
3748
5. `TODO.md` — check off or add follow-ups
3849

50+
Keep examples and docs aligned across `README.md`, `docs/SPEC.md`,
51+
`CHANGELOG.md`, `MISSING_FEATURES.md`, and `TODO.md` — drift between them is
52+
treated as a bug.
53+
3954
## Security Caveat
4055

4156
`a7-py` is **not** a sandbox for untrusted source. The compiler emits Zig or C

0 commit comments

Comments
 (0)