|
| 1 | +# AGENTS – Guidelines for Automated Assistants |
| 2 | + |
| 3 | +This file provides repo‑wide guidance for automated coding assistants working in |
| 4 | +`catalyst-libs`. |
| 5 | +It applies to the entire repository unless a more specific |
| 6 | +`AGENTS.md` exists in a subdirectory. |
| 7 | + |
| 8 | +## General Principles |
| 9 | + |
| 10 | +* Make **small, targeted changes** that directly address the user’s request. |
| 11 | +* Prefer **clarity and correctness** over cleverness; do not refactor broadly |
| 12 | + unless explicitly asked. |
| 13 | +* Keep existing project structure, naming, and file layout intact unless there |
| 14 | + is a strong reason to change it. |
| 15 | +* When in doubt about intent (spec vs implementation vs docs), **ask the user** |
| 16 | + rather than guessing. |
| 17 | + |
| 18 | +## Documentation & Specs |
| 19 | + |
| 20 | +* For architecture/spec docs under `docs/src/architecture` that have a matching |
| 21 | + Jinja source under `specs/generators/pages`, treat the **Jinja template as the |
| 22 | + source of truth**. |
| 23 | + * Example: if both |
| 24 | + `specs/generators/pages/signed_doc/voting_process/foo.md.jinja` and |
| 25 | + `docs/src/architecture/08_concepts/signed_doc/voting_process/foo.md` |
| 26 | + exist, edit the `.md.jinja` file, not the generated `.md`. |
| 27 | +* Follow existing Markdown style: |
| 28 | + * Respect the “one sentence per line” convention where it is used. |
| 29 | + * Keep headings, link styles, and admonitions consistent with nearby text. |
| 30 | +* When adding terminology that is likely to trigger the spell checker, add it |
| 31 | + to `.config/dictionaries/project.dic` in **sorted order**. |
| 32 | +* If the user asks for validation, suggest or run (with their consent): |
| 33 | + * `just check-markdown` |
| 34 | + * `just check-spelling` |
| 35 | + |
| 36 | +## Python (spec generators and tooling) |
| 37 | + |
| 38 | +* Python code lives primarily under `specs/generators` and is linted/formatted |
| 39 | + with `ruff` (see `ruff.toml`). |
| 40 | +* Conform to the existing style: |
| 41 | + * Use double quotes for strings. |
| 42 | + * Keep line length within the configured limit. |
| 43 | + * Do not introduce new global `ignore` rules in `ruff.toml` unless the user |
| 44 | + requests it. |
| 45 | +* Where sensible, keep functions small and focused; avoid introducing new |
| 46 | + dependencies without discussing with the user. |
| 47 | +* When the user wants checks run, prefer: |
| 48 | + * `just format-python-code` |
| 49 | + * `just lint-python` |
| 50 | + |
| 51 | +## Rust Workspace |
| 52 | + |
| 53 | +* The Rust workspace is in `rust/`. |
| 54 | + Follow the existing module layout and |
| 55 | + crate boundaries; do not split or merge crates without explicit direction. |
| 56 | +* Match the existing style and patterns: |
| 57 | + * Use `cargo fmt` / the configured `fmtfix` and lint commands indirectly |
| 58 | + via `rust/Justfile` where possible. |
| 59 | + * Avoid adding new crates to the workspace unless clearly justified. |
| 60 | +* For validation, and only when the user is ready for longer commands, suggest |
| 61 | + or run: |
| 62 | + * `cd rust && just code-format` |
| 63 | + * `cd rust && just code-lint` |
| 64 | + * `cd rust && just pre-push` (heavier, CI‑like checks) |
| 65 | + |
| 66 | +## CUE/CDDL Specs and Generated JSON |
| 67 | + |
| 68 | +* Specification source is primarily in `specs/definitions` (CUE, CDDL, etc.). |
| 69 | + Treat these as **normative** and make changes carefully and incrementally. |
| 70 | +* Where both a CUE definition and a JSON spec exist (e.g. `specs/signed_doc.json`), |
| 71 | + assume the JSON is **generated** from the CUE/source definitions. |
| 72 | + * Prefer editing the source definitions and let the project’s existing |
| 73 | + tooling regenerate derived artifacts. |
| 74 | + * Do not hand‑edit large generated JSON files unless explicitly instructed. |
| 75 | + |
| 76 | +## Earthly, Just, and CI |
| 77 | + |
| 78 | +* This repo uses Earthly (`Earthfile`s) and `just` for repeatable workflows. |
| 79 | +* Respect the intended execution context: |
| 80 | + * Targets or functions marked as `LOCALLY` are meant to run on the host, not |
| 81 | + inside container builds. |
| 82 | + * Do not try to retrofit such targets into containerized steps without a |
| 83 | + clear reason and user confirmation. |
| 84 | +* When adding new Earthly targets or Just recipes, mirror the style of |
| 85 | + existing ones and keep names short and descriptive. |
| 86 | + |
| 87 | +## Things to Avoid |
| 88 | + |
| 89 | +* Do not: |
| 90 | + * Change licensing files, `CODE_OF_CONDUCT.md`, or security policies. |
| 91 | + * Introduce breaking API changes (in Rust or Python) without calling that |
| 92 | + out explicitly to the user. |
| 93 | + * Mass‑reformat the entire repo; limit formatting to files you touch. |
| 94 | +* Avoid speculative “cleanup” in areas unrelated to the user’s request, even |
| 95 | + if you notice possible improvements; mention them in your summary instead. |
0 commit comments