agentleFS
cognizant-ai-labcognizant-ai-lab/neuro-san/AGENTS.md

neuro-san

AGENTS.md169 starsChanged 2 months agoApache-2.0View on GitHub

Rules for coding agents in neuro-san. Follow them and make sure the checks in §6 pass on the first run. - Agent networks are data-only HOCON files under neuro_san/registries/; manifest.hocon controls whether a network is served, publicly listed, and exposed via mcp — see manifest_hocon_reference.md. - CodedTools live under neuro_san/coded_tools/, resolved via AGENT_TOOL_PATH. Mirror the registry's folder layout when a tool belongs to a specific network. - No secrets in HOCON or code: read them from environment variables, or pass…

  • Commits and pushes
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 35,266 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

18 rules. About 0 are common, 7 are distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    No secrets in HOCON or code: read them from environment variables, or pass them per request via sly_data (see Client-Provided API Keys).

    line 14
  2. Very specific:

    Keep the diff focused: no unrequested refactors or reformatting of untouched files.

    line 19
  3. Distinctive:

    Update the matching reference doc in the same PR when you change documented behavior: agent_hocon_reference.md, external_agents.md, …

    line 21
  4. Very specific:

    No module-level functions, no nested functions, no lambdas: Every function is a method (or @staticmethod) on the module's class.

    line 39
  5. Very specific:

    No comprehensions: Use explicit for loops instead of list/dict/set/generator comprehensions, even when a comprehension would be shorter.

    line 42
  6. Distinctive:

    Always use type hints: Every function/method signature needs type hints for all parameters and the return type.

    line 44
  7. Very specific:

    Read dictionary values with .get(), never dict[key].

    line 48
  8. Distinctive:

    Never fail silently. Report a missing/unreadable file, malformed input, or an unknown choice with the full exception, and log enough to act …

    line 52
  9. Very specific:

    Prefer logger over print, with lazy % formatting (logger.info("Loaded %s", name)) rather than f-strings.

    line 54
  10. Very specific:

    Use accessors, not internals: do not read another class's attributes directly and do not isinstance against a concrete class — check the …

    line 56
  11. Distinctive:

    Keep all code comments brief, written in Standard Technical English.

    line 76
  12. Distinctive:

    Add code comments for every for loop.

    line 77
  13. Distinctive:

    Add type hints for every looping variable.

    line 78
  14. Very specific:

    Split by topic only past the size limit: When all the tests of SomeClass together would go over the 1000-line limit in §2, move any number …

    line 88
  15. Very specific:

    Test classes derive from unittest.TestCase, or unittest.IsolatedAsyncioTestCase when the class has async def tests.

    line 94
  16. Very specific:

    Use TestCase assert methods (assertEqual, assertIs, assertIsNone, assertIn, assertRaises, and so on), never a bare assert — they report …

    line 96
  17. Very specific:

    Run the basic suite before opening a PR: pytest -v -m "not integration and not smoke and not needs_server" -n auto.

    line 101
  18. Distinctive:

    Don't make assumptions: Before describing how something works, fixing a bug, or claiming a test passes or fails, read the relevant source …

    line 108

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

Rules for coding agents in neuro-san. Follow them and make sure the checks in §6 pass on the first run.


1. Contribution rules

  • Agent networks are data-only HOCON files under neuro_san/registries/; manifest.hocon controls whether a network is served, publicly listed, and exposed via mcp — see manifest_hocon_reference.md.
  • CodedTools live under neuro_san/coded_tools/, resolved via AGENT_TOOL_PATH. Mirror the registry's folder layout when a tool belongs to a specific network.
  • No secrets in HOCON or code: read them from environment variables, or pass them per request via sly_data (see Client-Provided API Keys). Never log or print sly_data.
  • Validate a HOCON file before opening a PR: python -m neuro_san.client.hocon_validator_cli path/to/agent.hocon --verbose (see hocon_validator_cli.md).
  • Keep the diff focused: no unrequested refactors or reformatting of untouched files. Remove debug prints, commented-out code and stray TODOs before opening a PR.
  • Update the matching reference doc in the same PR when you change documented behavior: agent_hocon_reference.md, external_agents.md, mcp_tools.md, provider_tools.md, manifest_hocon_reference.md, llm_info_hocon_reference.md, toolbox_info_hocon_reference.md, mcp_service.md, clients.md, tests.md, or test_case_hocon_reference.md. Verify every link in a document you touch.

2. Code style

  • One module, one class. Each .py file defines exactly one class (a handful of pre-existing exceptions are not precedent). Split helper logic into a separate module rather than adding a second class to an existing file. This should also mean that there should be no module comments - they should be really be the class's docstring.
  • No module over 1000 lines. That is pylint's too-many-lines limit, and CI checks it for source and tests alike. When a module would go over it, refactor instead of disabling the check: move whole concerns of the class, such as validation or formatting, into classes of their own, each in its own module. Tests split by topic (§3).
  • No module-level functions, no nested functions, no lambdas. Every function is a method (or @staticmethod) on the module's class. If a method needs a helper, make it another method on the same class; bind arguments with functools.partial on a method or @staticmethod where a lambda would otherwise have been used.
  • No comprehensions. Use explicit for loops instead of list/dict/set/generator comprehensions, even when a comprehension would be shorter.
  • Always use type hints. Every function/method signature needs type hints for all parameters and the return type; annotate a variable assignment too when the type isn't obvious from the right-hand side.
  • snake_case for functions, methods, variables, parameters and attributes; PascalCase for classes; UPPER_CASE for constants. Comment the reason if an external API forces camelCase.
  • Read dictionary values with .get(), never dict[key]; plain subscript is fine for assignment (config["key"] = value).
  • Catch the specific exceptions that can be handled at that level. Pylint flags a broad except Exception (W0718); where one is genuinely needed, add # pylint: disable=broad-exception-caught and state why in a comment.
  • Never fail silently. Report a missing/unreadable file, malformed input, or an unknown choice with the full exception, and log enough to act on.
  • Prefer logger over print, with lazy % formatting (logger.info("Loaded %s", name)) rather than f-strings.
  • Use accessors, not internals: do not read another class's attributes directly and do not isinstance against a concrete class — check the interface, or add an interface method that answers the question.
  • Docstrings on every class, function and method. A class docstring explains its purpose and responsibilities. A function/method docstring covers what it does, its parameters, its return value, and any exception it raises, in this exact format:

    """
    <summary of what the method does>
    
    :param <name>: <description>
    :param <name>: <description>
    :return: <description>
    """

    One :param line per parameter, in order, using its exact name. Omit :return: only when the method returns None. Add :raises <ExceptionType>: <description> after :return: if the method can raise something worth documenting. Write docstrings and comments in present tense: what the code or test does today, not its history (no "used to ...", "Previously ...").

  • Keep all code comments brief, written in Standard Technical English.
  • Add code comments for every for loop.
  • Add type hints for every looping variable.
  • Mark overridden methods with @override (from typing_extensions import override). Comment the non-obvious: threading/lifecycle behavior and the reason behind a design decision — not what a line already says.

3. Testing

  • One test module per class, named after it. Tests for some_module.py (class SomeClass) live in test_some_module.py as the single class TestSomeClass, mirroring the source path under tests/. Every tests/ directory that holds test modules needs an __init__.py, or the CI pylint gate silently skips it — see tests.md.
  • Split by topic only past the size limit. When all the tests of SomeClass together would go over the 1000-line limit in §2, move any number of whole topics (one method or behavior each) to test_some_module_<topic>.py, each with the single class TestSomeClass<Topic> (for example test_some_module_timeout.py with TestSomeClassTimeout), and keep the rest in test_some_module.py. Share helpers through a helper class of their own, since importing or subclassing TestSomeClass makes pytest run its tests again. When all the tests fit under the limit, use one module.
  • Test classes derive from unittest.TestCase, or unittest.IsolatedAsyncioTestCase when the class has async def tests. IsolatedAsyncioTestCase runs its own async tests, so do not add @pytest.mark.asyncio.
  • Use TestCase assert methods (assertEqual, assertIs, assertIsNone, assertIn, assertRaises, and so on), never a bare assert — they report both operands on failure.
  • The Code style rules in §2 apply to tests too: helpers are methods or @staticmethods, never module-level or nested functions, and never lambdas — bind a mock side_effect with functools.partial on a @staticmethod instead.
  • Run the basic suite before opening a PR: pytest -v -m "not integration and not smoke and not needs_server" -n auto. Narrow to one test with pytest -v path/to/test_file.py::TestClassName::test_method_name. Full marker/command reference: tests.md.

4. Investigation rules

  • Don't make assumptions. Before describing how something works, fixing a bug, or claiming a test passes or fails, read the relevant source or run the test. Never guess from naming conventions or memory of similar code.
  • Always cite a reference when reporting. A factual claim about the codebase ("this function does X", "this bug is caused by Y") needs the file path and line number(s) backing it. A test result needs the actual command run and its output, not a summary from assumption.

5. Git workflow

  • Branch off main with a short, descriptive branch name; never commit directly to main.
  • Never git add, git commit or git push unless explicitly told to. Finishing a change, fixing a bug, or completing a feature is not implicit permission. Leave changes unstaged so the reviewer can inspect them first.

6. Checks before opening the PR

python -m neuro_san.client.hocon_validator_cli path/to/agent.hocon --verbose   # HOCON structure, no LLM calls
flake8 neuro_san record_playback_llm_server tests                             # style, line length 120
build_scripts/run_pylint.sh                                                   # pylint --rcfile=.pylintrc

export AGENT_TOOL_PATH="./neuro_san/coded_tools"
export PYTHONPATH="${PYTHONPATH:+$PYTHONPATH:}."
pytest -v -m "not integration and not smoke and not needs_server" -n auto     # basic unit tests

Notes:

  • Line length is 120 for both Python (flake8/pylint) and Markdown.
  • To include the needs_server tests, start a server first (python -m neuro_san.service.main_loop.server_main_loop) and drop and not needs_server. build_scripts/server_start.sh does this in CI, but its apt-get step only works inside the CI container.
  • build_scripts/run_markdownlint.sh (pymarkdown --config ./.pymarkdownlint.yaml scan) only scans ./docs and ./README.md. Any other Markdown file, this one included, needs pymarkdown --config ./.pymarkdownlint.yaml scan <path> run by hand.
  • build_scripts/run_shellcheck.sh runs shellcheck on every *.sh file it finds, skipping paths that contain leaf-common.
  • Tests marked integration or smoke need extra environment variables and are not run on every push — see tests.md for the full breakdown.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.