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
In this repository11 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/architecture-constraints.mdcCursor rule
- .cursor/rules/engine-internals.mdcCursor rule
- .cursor/rules/testing-conventions.mdcCursor rule
- escalationSkill
- generalSkill
- im-adapterSkill
- kb-guideSkill
- message-pushSkill
- multi-botSkill
- task-managerSkill
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
- Very specific: line 8
When modifying code under src/, the following constraints must not be violated.
- Distinctive: line 41
Do not introduce global locks.
- Very specific: line 50
Run pnpm run test to ensure all unit tests pass.
- Very specific: line 51
Run pnpm run build to ensure TypeScript compiles.
≈ “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.
Files
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
- 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.
- 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.
- Don't put CLI logic in the core library —
cli.tsis a thin shell; it only parses arguments and formats output. All business logic must live inindex.ts/workspace.ts/engine.ts/session.ts/server.ts. - Don't declare Skills in config — The
skills/directory is the single source of truth.golem.yamlonly configures engine, name, and infrastructure settings. - 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
Assistantinterface (index.ts) must be verified acrossserver.ts,gateway.ts, andcli.ts. - Any change to the
AgentEngineinterface (engine.ts) must remain compatible with all engines (Cursor, Claude Code, OpenCode, Codex). StreamEventtype changes must verify compatibility withserver.tsSSE output,cli.tsevent handling, andgateway.tsIM message assembly.
File Responsibility Boundaries
| File | Responsibility | Should Not Contain |
index.ts | Public API, concurrency locks, orchestration of workspace/engine/session | Engine implementation details, HTTP logic |
engine.ts | Engine interface, all engine implementations, stream-json parsing, Skill injection | Session management, config loading |
workspace.ts | golem.yaml read/write, skills scanning, AGENTS.md generation | Engine invocation, session management |
session.ts | Session persistence (indexed by sessionKey) | Any other logic |
server.ts | HTTP service, SSE, auth | Engine implementation details |
gateway.ts | HTTP API + IM channel orchestration | Engine implementation details |
cli.ts | Argument parsing, call core API, format output | Business logic |
cli-utils.ts | CLI formatting helpers (tool display, truncation) | Business logic |
Concurrency Model
chat()calls with the samesessionKeymust 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:
- Add dedicated tests for the new functionality — passing existing tests is not enough.
- Run
pnpm run testto ensure all unit tests pass. - Run
pnpm run buildto 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 --verboseis required for intermediate stream events- Auth:
claude auth loginorANTHROPIC_API_KEYenv 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-outputsummary 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_KEYenv var (also setsOPENAI_API_KEYfor compatibility) --skip-git-repo-checkis required (GolemBot uses temp dirs)
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
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.

