agentleFS
shep-aishep-ai/shep/src/CLAUDE.md

shep / src

CLAUDE.md262 starsChanged 8 months agoMITView on GitHub

All code under src/ MUST work correctly on Windows, macOS, and Linux. This is not optional. - NEVER assume forward slashes (/) as path separators. Use path.join(), path.resolve(), or path.normalize() for constructing paths. - ALWAYS normalize paths to forward slashes before storing in the database, comparing, or hashing. Windows APIs and dialogs return backslash paths (C:\Users\...), while git and many Node.js APIs use forward slashes. - NEVER use hardcoded path separators in string operations. Use path.sep or normalize first. -…

The file

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

12 rules. About 0 are common, 2 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

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

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

    All code under src/ MUST work correctly on Windows, macOS, and Linux.

    line 3
  2. Very specific:

    NEVER: use hardcoded path separators in string operations.

    line 11
  3. Very specific:

    When comparing paths, normalize both sides: p.replace(/\\/g, '/').

    line 12
  4. Very specific:

    When storing paths in SQLite, normalize to forward slashes on write — see domain/shared/repository-path.ts.

    line 13
  5. Very specific:

    NEVER: use shell: true with spawn() unless absolutely necessary — it causes argument escaping issues on Windows (DEP0190) and mangles …

    line 20
  6. Very specific:

    Use windowsHide: true on Windows to prevent blank console windows from flashing.

    line 21
  7. Very specific:

    Always explicitly set stdio: ['pipe', 'pipe', 'pipe'] when the parent process may disconnect (detached workers, daemon processes).

    line 22
  8. Very specific:

    Do not assume \n — use os.EOL when writing platform-specific output, or normalize with .replace(/\r\n/g, '\n') when parsing.

    line 28
  9. Very specific:

    Use os.tmpdir() and fs.mkdtempSync() — never hardcode /tmp or C:\Temp.

    line 32
  10. Distinctive:

    If a feature genuinely cannot work on a specific platform:

    line 49
  11. Very specific:

    All tests MUST pass on all platforms.

    line 58
  12. Distinctive:

    When computing path-dependent hashes in tests, normalize the input path first.

    line 60

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.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
CLAUDE.md

Cross-Platform Development Rules (STRICT)

All code under src/ MUST work correctly on Windows, macOS, and Linux. This is not optional.

Mandatory Requirements

Path Handling

  • NEVER assume forward slashes (/) as path separators. Use path.join(), path.resolve(), or path.normalize() for constructing paths.
  • ALWAYS normalize paths to forward slashes before storing in the database, comparing, or hashing. Windows APIs and dialogs return backslash paths (C:\Users\...), while git and many Node.js APIs use forward slashes.
  • NEVER use hardcoded path separators in string operations. Use path.sep or normalize first.
  • When comparing paths, normalize both sides: p.replace(/\\/g, '/').
  • When storing paths in SQLite, normalize to forward slashes on write — see domain/shared/repository-path.ts. Do NOT wrap a path column in REPLACE(column, '\', '/') in a query: any function around a column makes its index unusable, which is what turned findByBranch into a full table scan.

Process Spawning

  • NEVER use shell: true with spawn() unless absolutely necessary — it causes argument escaping issues on Windows (DEP0190) and mangles prompts with special characters.
  • Use windowsHide: true on Windows to prevent blank console windows from flashing.
  • Always explicitly set stdio: ['pipe', 'pipe', 'pipe'] when the parent process may disconnect (detached workers, daemon processes).
  • Native executables (.exe) on Windows are found by spawn() on PATH without shell: true.

Line Endings

  • Configure git config core.autocrlf false in CI and test setup to prevent phantom modifications.
  • Do not assume \n — use os.EOL when writing platform-specific output, or normalize with .replace(/\r\n/g, '\n') when parsing.

Temporary Directories

  • Use os.tmpdir() and fs.mkdtempSync() — never hardcode /tmp or C:\Temp.

Process Management

  • process.kill(pid, 0) works on all platforms for checking if a process is alive.
  • pkill does not exist on Windows. Use platform-specific process termination or tree-kill utilities.
  • Exit codes differ: Windows uses unsigned 32-bit codes (e.g., 0xC0000005 = access violation). Check for both Unix and Windows exit code conventions.

File System

  • Windows paths are case-insensitive. Use .toLowerCase() when comparing paths on Windows.
  • Windows has a 260-character path limit by default. Keep paths short, especially in nested worktrees.
  • Windows may use 8.3 short paths (e.g., RUNNER~1). Use fs.realpathSync() to resolve to actual paths.
  • File locks are more aggressive on Windows — a file open for reading may block deletion.

When Cross-Platform Is Not Feasible

If a feature genuinely cannot work on a specific platform:

  1. Detect the platform using process.platform ('win32', 'darwin', 'linux').
  2. Provide a clear error message explaining the limitation and suggesting alternatives.
  3. Never silently fail — always warn or error if a platform-specific feature is unavailable.
  4. Document the limitation in the relevant tool/service JSON metadata (see openDirectory field patterns in tool installer JSONs).

Testing

  • All tests MUST pass on all platforms. CI runs on both ubuntu-latest and windows-latest.
  • In test assertions, normalize paths before comparing: tempRepo.replace(/\\/g, '/').
  • When computing path-dependent hashes in tests, normalize the input path first.

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.