beans
CLAUDE.md951 starsChanged 10 months agoApache-2.0View on GitHub
Beans is an agentic-first issue tracker. Issues ("beans") live as markdown files in a .beans/ directory inside a project repo. The system has three interfaces: The Beans UI is the primary development focus. It includes a backlog board, per-bean agent chat (spawning Claude Code processes), git worktree management, file change diffs, and terminal sessions. Key packages:
We split this CLAUDE.md into the rules it gives an agent
16 rules. About 0 are common, 7 are distinctive, and 9 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.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Use conventional commit messages ("feat", "fix", "chore", etc.) when making commits.
- Distinctive: line 16
When making commits, provide a meaningful commit message.
- Distinctive: line 20
When we're working in a PR branch, make separate commits, and update the PR description to reflect the changes made.
- Very specific: line 38
When making changes to the GraphQL schema (internal/graph/schema.graphqls), run mise codegen to regenerate both backend (generated.go) and …
- Very specific: line 39
When adding or changing frontend GraphQL operations (queries, mutations, subscriptions), update frontend/src/lib/graphql/operations.graphql …
- Very specific: line 40
All CLI commands that interact with beans should internally use GraphQL queries/mutations against the local server.
- Very specific: line 50
When a mutation removes or clears state (e.g., deleting a session), the subscription resolver must still send an explicit "empty" payload …
- Distinctive: line 59
When a PR merges and the bean file lands on main, the main watcher picks it up and the dirty flag clears.
- Very specific: line 69
Use the idea tag for ideas and proposals.
- Distinctive: line 73
Always write or update tests for the changes you make.
- Very specific: line 77
Run all tests: mise test
- Very specific: line 78
Run specific package: go test ./internal/bean/
- Distinctive: line 79
Use table-driven tests following Go conventions
- Distinctive: line 83
Write or update Playwright e2e tests for any web UI changes.
- Very specific: line 84
Run e2e tests: mise test:e2e
- Very specific: line 90
When testing read-only functionality, feel free to use this project's own .beans/ directory.
≈ “Common” is an estimate: at least 1 in 5 of the 25,680 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
What we're building
Beans is an agentic-first issue tracker. Issues ("beans") live as markdown files in a .beans/ directory inside a project repo. The system has three interfaces:
- CLI (
beansbinary) — create, list, update, and query beans from the terminal - Terminal TUI — Bubbletea-based interactive interface
- Beans UI (
beans serve) — SvelteKit SPA served by an embedded Go HTTP server, communicating via GraphQL (queries, mutations, subscriptions over WebSocket)
The Beans UI is the primary development focus. It includes a backlog board, per-bean agent chat (spawning Claude Code processes), git worktree management, file change diffs, and terminal sessions.
Commits
- Use conventional commit messages ("feat", "fix", "chore", etc.) when making commits.
- Include the relevant bean ID(s) in the commit message (please follow conventional commit conventions, e.g.
Refs: bean-xxxx). - Mark commits as "breaking" using the
!notation when applicable (e.g.,feat!: ...). - When making commits, provide a meaningful commit message. The description should be a concise bullet point list of changes made.
Pull Requests
- When we're working in a PR branch, make separate commits, and update the PR description to reflect the changes made.
- Include the relevant bean ID(s) in the PR title (please follow conventional commit conventions, e.g.
Refs: bean-xxxx).
Project Structure
Key packages:
pkg/bean/— Bean data model, parsing, sorting, validation (no I/O)pkg/beancore/— Core engine: disk I/O, file watching, search indexing, worktree watchinginternal/graph/— GraphQL schema and resolvers (the API layer for both Beans UI and CLI)internal/agent/— Agent session manager: spawns Claude Code processes, parses JSONL output, pub/sub for real-time updatesinternal/worktree/— Git worktree lifecycle managementinternal/terminal/— PTY session management for embedded terminalsinternal/commands/— CLI command implementations (Cobra)frontend/— SvelteKit SPA (embedded into the Go binary via//go:embed)
GraphQL
- When making changes to the GraphQL schema (
internal/graph/schema.graphqls), runmise codegento regenerate both backend (generated.go) and frontend (frontend/src/lib/graphql/generated.ts) types. - When adding or changing frontend GraphQL operations (queries, mutations, subscriptions), update
frontend/src/lib/graphql/operations.graphqland runmise codegen. Do NOT use inlinegqlstrings — all operations must go through codegen for type safety. - All CLI commands that interact with beans should internally use GraphQL queries/mutations against the local server.
- Subscriptions use WebSocket transport. The
beanChangedsubscription supportsincludeInitial: trueto send a full snapshot on connect, avoiding race conditions between initial load and live updates.
Build
mise buildto build a./beansexecutable- The frontend is built and embedded into the Go binary at compile time
GraphQL Subscriptions
- When a mutation removes or clears state (e.g., deleting a session), the subscription resolver must still send an explicit "empty" payload to the frontend. Never skip
nilresults withcontinue— the frontend needs to know the state changed.
Worktree State Architecture
- Git worktrees are created outside the main repo, in
~/.beans/worktrees/<project-name>/. This avoids nested repo confusion and accidental tool/search interference. The location is configurable viaworktree.pathin.beans.yml. beans-serveholds runtime state as the authoritative view of all beans. It initializes from main repo disk, then merges in changes from worktrees and the GraphQL API.- The CLI in a worktree uses the worktree's local
.beans/directory — it does NOT redirect to the main repo. This means worktree agents' bean changes travel with their PR. beans-servewatches active worktrees'.beans/dirs and merges file changes into runtime state as "dirty" (not persisted to main disk).- The
startWorkmutation usesWithPersist(false)— status changes are runtime-only until the PR merges. - When a PR merges and the bean file lands on main, the main watcher picks it up and the dirty flag clears.
- Each worktree has a metadata file (
<id>.meta.json) stored as a sibling in the worktree root directory (e.g.~/.beans/worktrees/<project>/<id>.meta.json). This file persists per-worktree state that must survive server restarts: name, description, allocated port, and last-active timestamp. Useworktree.Manager.SavePort/GetPortetc. to read and write fields — don't access the file directly.
Agent Architecture
- The central (main workspace) agent session uses ID
__central__(defined asCentralSessionIDininternal/graph/resolver.goandMAIN_WORKSPACE_IDinfrontend/src/lib/worktrees.svelte.ts). These must stay in sync — the backend uses this ID to determine work directory and system prompt. - Worktree agent sessions use the worktree ID as their session ID.
Extra rules for our own beans/issues
- Use the
ideatag for ideas and proposals.
Testing
- Always write or update tests for the changes you make.
Unit Tests
- Run all tests:
mise test - Run specific package:
go test ./internal/bean/ - Use table-driven tests following Go conventions
E2E Tests
- Write or update Playwright e2e tests for any web UI changes.
- Run e2e tests:
mise test:e2e - See
frontend/e2e/for fixtures, page objects, and specs.
Manual CLI Testing
mise beanswill compile and run the beans CLI. Use it instead of building and running./beansmanually.- When testing read-only functionality, feel free to use this project's own
.beans/directory. But for anything that modifies data, create a separate test project directory. All commands support the--beans-pathflag to specify a custom path.
In this repositoryOne other file it gives its agents.
- bubbleteaSkill
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.

