agentleFS
pigweed-projectpigweed-project/pigweed/pw_ide/AGENTS.md

pigweed / pw_ide

AGENTS.md561 starsChanged 16 days agoApache-2.0View on GitHub

This document provides foundational principles and technical requirements for AI agents contributing to pw_ide. This document extends the top-level AGENTS.md guidance with additional instructions more specific to the files contained under this subdirectory.

The file

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

10 rules. About 0 are common, 4 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Pure Functions: Prefer extracting logic into pure functions with no side effects to simplify reasoning and testing.

    line 17
  2. Distinctive:

    No Unverified Changes: All new features, refactors, and bug fixes must include automated tests.

    line 21
  3. Very specific:

    Python: Use unittest with pyfakefs for robust filesystem mocking.

    line 26
  4. Very specific:

    Starlark: Use unittest.make for all Starlark logic verification.

    line 27
  5. Very specific:

    Use Path Objects: Use pathlib.Path exclusively for path operations.

    line 32
  6. Very specific:

    Avoid os.path and string-based path manipulation.

    line 33
  7. Very specific:

    Maintain Type Integrity: Keep paths as Path objects throughout the application logic.

    line 34
  8. Distinctive:

    Portability: Ensure paths in generated project files are relative to the workspace root, not absolute.

    line 37
  9. Distinctive:

    $O(1)$ Lookups: Use dictionaries for mapping and filtering to avoid nested loops ($O(M \times N)$).

    line 56
  10. Very specific:

    Explicit Copies: Use dict() to create shallow copies of dictionaries to prevent shared state bugs.

    line 60

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 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

Pigweed IDE (pw_ide) Engineering Guidelines

This document provides foundational principles and technical requirements for AI agents contributing to pw_ide. This document extends the top-level AGENTS.md guidance with additional instructions more specific to the files contained under this subdirectory.

Core Principles

1. Single Responsibility & Conciseness

  • Decompose Logic: Each function, class, or Bazel rule must have one clear responsibility. Decompose complex logic into small, reusable, and focused helper functions.
  • Explicit over Clever: Prioritize readability and explicit intent over "magic" behavior. Use descriptive naming that explains what data represents, rather than its type.
  • Pure Functions: Prefer extracting logic into pure functions with no side effects to simplify reasoning and testing.

2. Mandatory & Focused Testing

  • No Unverified Changes: All new features, refactors, and bug fixes must include automated tests.
  • Granular Tests: Each test case should verify a single, specific behavior. Use descriptive names that clearly state the test's intent.
  • Tools:
    • Python: Use unittest with pyfakefs for robust filesystem mocking.
    • Starlark: Use unittest.make for all Starlark logic verification.

Python Guidelines

1. Path Manipulation with pathlib

  • Use Path Objects: Use pathlib.Path exclusively for path operations. Avoid os.path and string-based path manipulation.
  • Maintain Type Integrity: Keep paths as Path objects throughout the application logic. Convert to strings only at serialization boundaries or when required by external APIs.
  • Portability: Ensure paths in generated project files are relative to the workspace root, not absolute.

2. Pattern Matching with re

  • Prefer Regex for Complexity: For all but the simplest string checks, use the re package. Regular expressions yield faster and more concise code for complex pattern matching.

3. Error Handling

  • Exceptions Over Return Codes: Raise descriptive exceptions to handle errors. Avoid returning None or error codes, which clutter the "happy path" and are easily ignored.

Bazel & Starlark Guidelines

1. Performance & Efficiency

  • Minimize Depset Conversions: Converting a depset to a list (via .to_list()) is an $O(N)$ operation. Perform this conversion exactly once if needed, and never inside a loop.
  • $O(1)$ Lookups: Use dictionaries for mapping and filtering to avoid nested loops ($O(M \times N)$).

2. Safety & Correctness

  • Explicit Copies: Use dict() to create shallow copies of dictionaries to prevent shared state bugs.
  • No Recursion: Starlark does not support recursion; use iterative stacks or queues for graph traversal.
  • Explicit Aspect Traversal: Be specific in attr_aspects when writing aspects; avoid the ["*"] wildcard to prevent issues with internal Bazel dependencies.

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.