This project uses bd (beads) for issue tracking. Run bd onboard to get started.
bd ready # Find available work
bd show <id> # View issue details
bd update <id> --status in_progress # Claim work
bd close <id> # Complete work
bd sync # Sync with gitM-x eval-defun ; Evaluate changed function (after edit)
M-x eval-region ; Evaluate selected region
M-x load-file ; Reload entire file
M-x ert t ; Run all ERT tests# Run specific test file
M-x ert t /Users/gdanov/work/playground/emacs-gravity/test/claude-gravity-test.el
# Run specific test by name
M-x ert t cg-test-user-prompt-advances-turnnpm install # Install all workspace dependencies (first time)
make test # Run all tests (elisp + bridge + server)
make test-bridge # Bridge tests only
make test-server # Server tests only
make build-server # Build gravity-server → dist/gravity-server.mjs
make sync-cache # Sync dist to plugin marketplace cache (REQUIRED after changes)Naming Conventions:
- Prefix public functions/variables with
claude-gravity-orcg-(internal) - Use kebab-case:
claude-gravity-session-get - Internal helpers use underscores:
claude-gravity--internal-func - Use double-hyphen for internal definitions
- Face names:
claude-gravity-face-name-face
Formatting:
- Use 2 spaces for indentation, no tabs
- Max line length: ~80-100 characters
- Use
(require 'module)at top,(provide 'module-name)at bottom - Place
;;; Code:marker after docstring header
Types & Data:
- Use
defcustomwith:typedeclarations for user-tweakable variables - Use
plist-get/plist-putfor session data - Use hash tables for indexed lookups:
(gethash key hash-table)
Error Handling:
- Use
condition-casefor graceful error recovery - Log errors with
claude-gravity--log - Return sensible defaults on error rather than throwing
Critical Patterns:
;; Use push + nreverse instead of append in loops (O(n) vs O(n²))
(let ((result nil))
(dolist (item items)
(push (process item) result))
(nreverse result))
;; Defer interactive calls from process filters
(run-at-time 0 nil #'completing-read "Choose: " '("a" "b"))Important Notes:
- Use
lexical-binding: tat top of all.elfiles - Never use
appendin loops - Use
magit-insert-sectionmacros as-is — don't refactor them
Naming & Formatting:
- Kebab-case files:
extract-transcript.ts - PascalCase types/interfaces, camelCase functions
- Max line length: 100 characters
- Explicit return types for exported functions
Types:
- Strict TypeScript (
strict: truein tsconfig.json) - Avoid
any— useunknownwith type guards
Error Handling:
- Always return valid JSON to stdout, even on errors
- Log to
/tmp/emacs-bridge.log(bridge) or stderr (gravity-server)
emacs-gravity/
├── claude-gravity.el ; Thin loader
├── claude-gravity-core.el ; Utilities, logging, tlist
├── claude-gravity-faces.el ; Faces and fringe bitmaps
├── claude-gravity-session.el ; Session state CRUD
├── claude-gravity-discovery.el ; Plugin/skill/MCP capability discovery
├── claude-gravity-state.el ; Session state helpers, inbox, tool/agent lookup
├── claude-gravity-text.el ; Text rendering
├── claude-gravity-diff.el ; Inline diffs, tool/plan display
├── claude-gravity-render.el ; UI section rendering
├── claude-gravity-ui.el ; Buffers, keymaps, transient menu
├── claude-gravity-plan-review.el ; Plan review buffer and feedback
├── claude-gravity-client.el ; Terminal socket client to gravity-server
├── claude-gravity-actions.el ; Permission/question action buffers
├── claude-gravity-tmux.el ; Tmux session management
├── claude-gravity-debug.el ; Debug helpers
├── packages/
│ ├── shared/ ; Shared types (Session, Patch, messages)
│ ├── emacs-bridge/ ; Claude Code plugin (one-shot shim)
│ │ ├── src/index.ts
│ │ └── hooks/ ; Shell scripts + _ensure-server
│ ├── gravity-server/ ; Stateful backend (state, enrichment, protocol)
│ │ ├── src/gravity-server.ts
│ │ └── test/
│ └── gravity-menubar/ ; macOS menu bar app (Swift)
│ ├── GravityMenuBar/ ; SwiftUI app, monitor, models
│ └── Package.swift
├── Makefile
└── test/
└── claude-gravity-test.el ; ERT tests
When ending a work session, you MUST complete ALL steps below. Work is NOT complete until git push succeeds.
MANDATORY WORKFLOW:
- File issues for remaining work - Create issues for anything that needs follow-up
- Run quality gates (if code changed) - Tests, linters, builds
- Update issue status - Close finished work, update in-progress items
- PUSH TO REMOTE - This is MANDATORY:
git pull --rebase bd sync git push git status # MUST show "up to date with origin" - Clean up - Clear stashes, prune remote branches
- Verify - All changes committed AND pushed
- Hand off - Provide context for next session
CRITICAL RULES:
- Work is NOT complete until
git pushsucceeds - NEVER stop before pushing - that leaves work stranded locally
- NEVER say "ready to push when you are" - YOU must push
- If push fails, resolve and retry until it succeeds
Use 'bd' for task tracking
IMPORTANT: This project uses bd (beads) for ALL issue tracking. Do NOT use markdown TODOs, task lists, or other tracking methods.
- Dependency-aware: Track blockers and relationships between issues
- Git-friendly: Dolt-powered version control with native sync
- Agent-optimized: JSON output, ready work detection, discovered-from links
- Prevents duplicate tracking systems and confusion
Check for ready work:
bd ready --jsonCreate new issues:
bd create "Issue title" --description="Detailed context" -t bug|feature|task -p 0-4 --json
bd create "Issue title" --description="What this issue is about" -p 1 --deps discovered-from:bd-123 --jsonClaim and update:
bd update <id> --claim --json
bd update bd-42 --priority 1 --jsonComplete work:
bd close bd-42 --reason "Completed" --jsonbug- Something brokenfeature- New functionalitytask- Work item (tests, docs, refactoring)epic- Large feature with subtaskschore- Maintenance (dependencies, tooling)
0- Critical (security, data loss, broken builds)1- High (major features, important bugs)2- Medium (default, nice-to-have)3- Low (polish, optimization)4- Backlog (future ideas)
- Check ready work:
bd readyshows unblocked issues - Claim your task atomically:
bd update <id> --claim - Work on it: Implement, test, document
- Discover new work? Create linked issue:
bd create "Found bug" --description="Details about what was found" -p 1 --deps discovered-from:<parent-id>
- Complete:
bd close <id> --reason "Done"
bd automatically syncs via Dolt:
- Each write auto-commits to Dolt history
- Use
bd dolt push/bd dolt pullfor remote sync - No manual export/import needed!
- ✅ Use bd for ALL task tracking
- ✅ Always use
--jsonflag for programmatic use - ✅ Link discovered work with
discovered-fromdependencies - ✅ Check
bd readybefore asking "what should I work on?" - ❌ Do NOT create markdown TODO lists
- ❌ Do NOT use external issue trackers
- ❌ Do NOT duplicate tracking systems
For more details, see README.md and docs/QUICKSTART.md.
When ending a work session, you MUST complete ALL steps below. Work is NOT complete until git push succeeds.
MANDATORY WORKFLOW:
- File issues for remaining work - Create issues for anything that needs follow-up
- Run quality gates (if code changed) - Tests, linters, builds
- Update issue status - Close finished work, update in-progress items
- PUSH TO REMOTE - This is MANDATORY:
git pull --rebase bd dolt push git push git status # MUST show "up to date with origin" - Clean up - Clear stashes, prune remote branches
- Verify - All changes committed AND pushed
- Hand off - Provide context for next session
CRITICAL RULES:
- Work is NOT complete until
git pushsucceeds - NEVER stop before pushing - that leaves work stranded locally
- NEVER say "ready to push when you are" - YOU must push
- If push fails, resolve and retry until it succeeds