agentleFS
0xranx0xranx/golembot/CLAUDE.md

golembot

CLAUDE.md326 starsChanged 9 months agoMITView on GitHub

This file is the Claude Code equivalent of .cursor/rules/*.mdc. It is auto-loaded at conversation start and provides project-level constraints. When modifying code under src/, the following constraints must not be violated. Any substantive change to source files under src/ must: Location: src/__tests__/<module>.test.ts Mock Engine Pattern — Unit tests do not call the real Agent. Replace with a mock engine: Inject via vi.mock('../engine.js', ...), returning mock engine from createEngine.

  • Reads credentials

The file

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

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

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

    When modifying code under src/, the following constraints must not be violated.

    line 8
  2. Distinctive:

    Do not introduce global locks.

    line 41
  3. Very specific:

    Run pnpm run test to ensure all unit tests pass.

    line 50
  4. Very specific:

    Run pnpm run build to ensure TypeScript compiles.

    line 51

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

GolemBot — Project Conventions for Claude Code

This file is the Claude Code equivalent of .cursor/rules/*.mdc. It is auto-loaded at conversation start and provides project-level constraints.

Architecture Hard Constraints

When modifying code under src/, the following constraints must not be violated.

Things You Must Never Do

  1. Don't do what the Agent should do — GolemBot does not manage context window, dispatch tools, reason, or set session TTL. All "intelligent" behavior is delegated to the underlying Coding Agent.
  2. Don't add new core concepts — The framework has only two concepts: assistant directory + Skill. Do not introduce Tool, Blueprint, Registry, Pipeline, or other abstractions.
  3. Don't put CLI logic in the core library — cli.ts is a thin shell; it only parses arguments and formats output. All business logic must live in index.ts / workspace.ts / engine.ts / session.ts / server.ts.
  4. Don't declare Skills in config — The skills/ directory is the single source of truth. golem.yaml only configures engine, name, and infrastructure settings.
  5. Process invocation is engine-owned — All engines use child_process.spawn. Do not assume invocation style outside the engine.

Interface Change Rules

  • Any signature change to the Assistant interface (index.ts) must be verified across server.ts, gateway.ts, and cli.ts.
  • Any change to the AgentEngine interface (engine.ts) must remain compatible with all engines (Cursor, Claude Code, OpenCode, Codex).
  • StreamEvent type changes must verify compatibility with server.ts SSE output, cli.ts event handling, and gateway.ts IM message assembly.

File Responsibility Boundaries

FileResponsibilityShould Not Contain
index.tsPublic API, concurrency locks, orchestration of workspace/engine/sessionEngine implementation details, HTTP logic
engine.tsEngine interface, all engine implementations, stream-json parsing, Skill injectionSession management, config loading
workspace.tsgolem.yaml read/write, skills scanning, AGENTS.md generationEngine invocation, session management
session.tsSession persistence (indexed by sessionKey)Any other logic
server.tsHTTP service, SSE, authEngine implementation details
gateway.tsHTTP API + IM channel orchestrationEngine implementation details
cli.tsArgument parsing, call core API, format outputBusiness logic
cli-utils.tsCLI formatting helpers (tool display, truncation)Business logic

Concurrency Model

  • chat() calls with the same sessionKey must be serialized (KeyedMutex).
  • Different sessionKeys can run in parallel.
  • Do not introduce global locks.

Testing Conventions

Feature Changes Must Be Verified

Any substantive change to source files under src/ must:

  1. Add dedicated tests for the new functionality — passing existing tests is not enough.
  2. Run pnpm run test to ensure all unit tests pass.
  3. Run pnpm run build to ensure TypeScript compiles.

Unit Tests (vitest)

Location: src/__tests__/<module>.test.ts

Mock Engine Pattern — Unit tests do not call the real Agent. Replace with a mock engine:

async function* mockInvoke(prompt, opts): AsyncIterable<StreamEvent> {
  yield { type: 'text', content: 'mock response' };
  yield { type: 'done', sessionId: 'mock-session-123' };
}

Inject via vi.mock('../engine.js', ...), returning mock engine from createEngine.

Running

pnpm run build        # TypeScript compile
pnpm run test         # Unit tests (vitest)

Engine Implementation Notes

Claude Code

  • Binary: ~/.local/bin/claude
  • Flags: -p <prompt> --output-format stream-json --verbose --dangerously-skip-permissions
  • --verbose is required for intermediate stream events
  • Auth: claude auth login or ANTHROPIC_API_KEY env var

Cursor

  • Binary: ~/.local/bin/agent
  • Flags: --output-format stream-json --stream-partial-output --force --trust --sandbox disabled --approve-mcps
  • Uses segmentAccum dedup for --stream-partial-output summary events

OpenCode

  • Binary: opencode (on PATH)
  • Flags: run <prompt> --format json
  • step_finish events are accumulated; single done event emitted on process close

Codex

  • Binary: codex (npm: @openai/codex)
  • Flags: exec --json --full-auto --skip-git-repo-check [--model X] <prompt>
  • Resume: exec resume --json --full-auto --skip-git-repo-check [--model X] <thread_id> <prompt>
  • Auth: CODEX_API_KEY env var (also sets OPENAI_API_KEY for compatibility)
  • --skip-git-repo-check is required (GolemBot uses temp dirs)

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.