Ryan
f7e80dd80c
feat: add context optimization features for AI agents (#297)
* feat: add bd prime and setup commands for AI agent integration
This commit consolidates context optimization features for AI agents:
## New Commands
**bd prime** - AI-optimized workflow context injection
- Outputs ~1-2k tokens of workflow context
- Context-aware: adapts to MCP vs CLI mode
- MCP mode: minimal reminders (~500 tokens)
- CLI mode: full command reference (~1-2k tokens)
- Warns against TodoWrite tool and markdown TODOs
- Designed for SessionStart/PreCompact hooks
**bd setup claude** - Claude Code integration installer
- Installs hooks via JSON configuration (not file scripts)
- Supports --project for project-only installation
- Supports --check to verify installation
- Supports --remove to uninstall hooks
- Idempotent (safe to run multiple times)
- Merges with existing settings
**bd setup cursor** - Cursor IDE integration installer
- Creates .cursor/rules/beads.mdc with workflow rules
- Simplified implementation (just overwrites file)
## bd doctor Enhancements
- New: CheckClaude() verifies Claude Code integration
- Detects plugin, MCP server, and hooks installation
- Provides actionable fix suggestions
- Extracted legacy pattern detection to doctor/legacy.go
- Detects JSONL-only mode and warns about legacy issues.jsonl
## Core Improvements
- FindBeadsDir() utility for cross-platform .beads/ discovery
- Works in JSONL-only mode (no database required)
- Sorted noDbCommands alphabetically (one per line for easy diffs)
## Testing
- Unit tests for setup command hook manipulation
- Tests for idempotency, adding/removing hooks
- All tests passing
## Documentation
- cmd/bd/doctor/claude.md - Documents why beads doesn't use Claude Skills
- commands/prime.md - Slash command for bd prime
- Fixed G304 gosec warnings with nosec comments
## Token Efficiency
The bd prime approach reduces AI context usage dramatically:
- MCP mode: ~500 tokens (vs ~10.5k for full MCP tool scan)
- CLI mode: ~1-2k tokens
- 80-99% reduction in standing context overhead
* fix: resolve linting errors in setup utils and remove obsolete test
- Add error check for tmpFile.Close() in setup/utils.go to fix golangci-lint G104
- Remove TestCheckMultipleJSONLFiles test that referenced deleted checkMultipleJSONLFiles function
Fixes golangci-lint errcheck violations introduced in the bd prime/setup feature.
2025-11-12 10:48:36 -08:00
..
2025-11-12 10:48:36 -08:00
2025-11-12 10:48:36 -08:00
2025-11-09 14:58:03 -08:00
2025-11-04 00:23:25 -08:00
2025-11-08 18:16:39 -08:00
2025-11-02 10:01:38 -08:00
2025-11-02 10:38:24 -08:00
2025-11-07 22:06:50 -08:00
2025-11-09 12:55:14 -08:00
2025-11-03 22:23:36 -08:00
2025-11-03 22:23:36 -08:00
2025-11-01 11:11:20 -07:00
2025-11-12 10:37:54 -08:00
2025-11-02 15:37:57 -08:00
2025-11-04 23:12:42 -08:00
2025-11-08 03:12:11 -08:00
2025-11-05 20:39:47 -08:00
2025-11-06 20:14:34 -08:00
2025-11-05 21:04:00 -08:00
2025-11-07 21:17:24 -08:00
2025-11-05 10:26:58 -08:00
2025-11-07 18:57:43 -08:00
2025-11-07 21:29:22 -08:00
2025-11-05 20:39:47 -08:00
2025-11-02 22:17:08 -08:00
2025-11-07 18:57:43 -08:00
2025-11-01 19:20:01 -07:00
2025-11-07 18:57:43 -08:00
2025-11-10 10:22:03 -08:00
2025-11-05 20:39:47 -08:00
2025-11-09 16:16:45 -08:00
2025-11-01 21:27:09 -07:00
2025-11-06 19:41:38 -08:00
2025-11-05 20:39:47 -08:00
2025-11-02 22:17:08 -08:00
2025-11-05 20:39:47 -08:00
2025-11-05 20:39:47 -08:00
2025-11-01 23:56:03 -07:00
2025-11-07 21:17:24 -08:00
2025-11-02 18:52:44 -08:00
2025-11-08 03:10:12 -08:00
2025-11-02 18:52:44 -08:00
2025-11-08 02:20:33 -08:00
2025-11-08 02:20:33 -08:00
2025-11-02 22:34:24 -08:00
2025-11-02 08:09:58 -08:00
2025-11-08 18:16:39 -08:00
2025-11-12 10:48:36 -08:00
2025-11-12 10:48:36 -08:00
2025-11-05 19:16:50 -08:00
2025-11-01 11:11:20 -07:00
2025-11-02 18:52:44 -08:00
2025-11-05 10:26:58 -08:00
2025-11-01 20:29:13 -07:00
2025-11-07 20:07:59 -08:00
2025-11-05 14:31:41 -08:00
2025-11-07 20:07:59 -08:00
2025-11-05 20:39:47 -08:00
2025-11-09 14:53:59 -08:00
2025-11-08 01:28:19 -08:00
2025-11-09 14:58:03 -08:00
2025-11-08 11:36:05 -08:00
2025-11-09 14:53:59 -08:00
2025-11-06 13:01:44 -08:00
2025-11-08 00:00:43 -08:00
2025-11-12 10:37:32 -08:00
2025-11-08 02:28:54 -08:00
2025-11-09 14:53:59 -08:00
2025-11-05 19:04:14 -08:00
2025-11-07 15:55:19 -08:00
2025-11-05 19:04:14 -08:00
2025-11-09 14:13:48 -08:00
2025-11-09 14:13:48 -08:00
2025-11-01 22:01:41 -07:00
2025-11-05 18:10:06 -08:00
2025-11-01 20:29:13 -07:00
2025-11-02 22:34:24 -08:00
2025-11-06 20:00:08 -08:00
2025-11-08 01:32:13 -08:00
2025-11-08 13:09:42 -08:00
2025-11-12 10:48:36 -08:00
2025-11-05 13:56:12 -08:00
2025-11-06 15:38:48 -08:00
2025-11-08 13:16:53 -08:00
2025-11-06 19:23:06 -08:00
2025-11-05 18:44:02 -08:00
2025-11-02 14:31:22 -08:00
2025-11-08 18:16:39 -08:00
2025-11-09 14:53:59 -08:00
2025-11-09 14:53:59 -08:00
2025-11-02 17:10:41 -08:00
2025-11-02 20:06:05 -08:00
2025-11-12 10:48:36 -08:00
2025-11-05 13:56:12 -08:00
2025-11-06 20:00:08 -08:00
2025-11-02 11:02:58 -08:00
2025-11-02 22:34:24 -08:00
2025-11-01 23:56:03 -07:00
2025-11-04 23:12:41 -08:00
2025-10-31 19:44:43 -07:00
2025-10-31 22:39:53 -07:00
2025-11-04 11:25:36 -08:00
2025-11-12 10:48:36 -08:00
2025-11-08 18:22:28 -08:00
2025-11-05 13:56:12 -08:00
2025-11-08 02:20:33 -08:00
2025-10-31 23:03:56 -07:00
2025-11-02 21:25:40 -08:00
2025-11-06 18:49:07 -08:00
2025-11-06 18:49:07 -08:00
2025-11-09 16:16:45 -08:00
2025-11-05 18:10:06 -08:00
2025-11-02 17:09:39 -08:00
2025-11-10 10:59:46 -08:00
2025-11-03 20:31:11 -08:00
2025-11-03 20:31:11 -08:00
2025-11-03 22:01:37 -08:00
2025-11-07 21:58:22 -08:00
2025-11-04 01:10:18 -08:00
2025-10-31 19:44:43 -07:00
2025-11-08 13:09:42 -08:00
2025-11-05 17:37:53 -08:00
2025-11-08 22:59:00 -08:00
2025-11-08 18:22:28 -08:00
2025-11-05 21:04:00 -08:00