Skip to content

Commit d001a91

Browse files
committed
feat(search): implement actual file search in search_docs tool
Replace the previous template-based response (which only returned instructions on where to search) with a real streaming grep engine that returns file path, line number, and matched content — just like ripgrep. Key decisions: - Pure Node.js streaming regex grep as primary search (no binary deps, cross-platform, supports full JS/ripgrep regex: auth|login, \s+\w+, etc.) - MiniSearch (already a transitive dep) as optional pre-filter/ranker to limit candidate files on large docsets before line-level grep - OR syntax satisfied by native RegExp — no extra tooling needed - context_lines defaults to 0 (was 2); exposed as optional MCP param so callers can request 1–3 lines of surrounding context when needed Changes: - packages/core/src/search/searcher.ts — new core search engine (buildFileIndex, searchDocset, formatSearchResult) - packages/core/src/types.ts — SearchMatch, SearchDocsResult, SearchOptions types - packages/core/src/index.ts — export new search symbols - packages/mcp-server/src/server.ts — replace template processing with actual search; add context_lines param to search_docs tool schema - packages/core/src/__tests__/searcher.test.ts — 25 new unit tests - packages/mcp-server/src/__tests__/web-sources.test.ts — update 3 tests for new grep-style content[0].text response shape - test/e2e/mcp-protocol-compliance.test.ts — update 4 stale E2E tests that asserted old structuredContent/instructions response shape - docs/adr/001-search-engine-for-search-docs-tool.md — Nygard ADR with weighted Pugh matrix comparing ripgrep wrapper vs MiniSearch hybrid vs Node.js streaming grep (Option C wins, score +21 vs baseline)
1 parent 2111109 commit d001a91

16 files changed

Lines changed: 1634 additions & 172 deletions

.beads/README.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Beads - AI-Native Issue Tracking
2+
3+
Welcome to Beads! This repository uses **Beads** for issue tracking - a modern, AI-native tool designed to live directly in your codebase alongside your code.
4+
5+
## What is Beads?
6+
7+
Beads is issue tracking that lives in your repo, making it perfect for AI coding agents and developers who want their issues close to their code. No web UI required - everything works through the CLI and integrates seamlessly with git.
8+
9+
**Learn more:** [github.com/steveyegge/beads](https://github.com/steveyegge/beads)
10+
11+
## Quick Start
12+
13+
### Essential Commands
14+
15+
```bash
16+
# Create new issues
17+
bd create "Add user authentication"
18+
19+
# View all issues
20+
bd list
21+
22+
# View issue details
23+
bd show <issue-id>
24+
25+
# Update issue status
26+
bd update <issue-id> --status in_progress
27+
bd update <issue-id> --status done
28+
29+
# Sync with git remote
30+
bd sync
31+
```
32+
33+
### Working with Issues
34+
35+
Issues in Beads are:
36+
37+
- **Git-native**: Stored in `.beads/issues.jsonl` and synced like code
38+
- **AI-friendly**: CLI-first design works perfectly with AI coding agents
39+
- **Branch-aware**: Issues can follow your branch workflow
40+
- **Always in sync**: Auto-syncs with your commits
41+
42+
## Why Beads?
43+
44+
**AI-Native Design**
45+
46+
- Built specifically for AI-assisted development workflows
47+
- CLI-first interface works seamlessly with AI coding agents
48+
- No context switching to web UIs
49+
50+
🚀 **Developer Focused**
51+
52+
- Issues live in your repo, right next to your code
53+
- Works offline, syncs when you push
54+
- Fast, lightweight, and stays out of your way
55+
56+
🔧 **Git Integration**
57+
58+
- Automatic sync with git commits
59+
- Branch-aware issue tracking
60+
- Intelligent JSONL merge resolution
61+
62+
## Get Started with Beads
63+
64+
Try Beads in your own projects:
65+
66+
```bash
67+
# Install Beads
68+
curl -sSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash
69+
70+
# Initialize in your repo
71+
bd init
72+
73+
# Create your first issue
74+
bd create "Try out Beads"
75+
```
76+
77+
## Learn More
78+
79+
- **Documentation**: [github.com/steveyegge/beads/docs](https://github.com/steveyegge/beads/tree/main/docs)
80+
- **Quick Start Guide**: Run `bd quickstart`
81+
- **Examples**: [github.com/steveyegge/beads/examples](https://github.com/steveyegge/beads/tree/main/examples)
82+
83+
---
84+
85+
_Beads: Issue tracking that moves at the speed of thought_

.beads/config.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Beads Configuration File
2+
# This file configures default behavior for all bd commands in this repository
3+
# All settings can also be set via environment variables (BD_* prefix)
4+
# or overridden with command-line flags
5+
6+
# Issue prefix for this repository (used by bd init)
7+
# If not set, bd init will auto-detect from directory name
8+
# Example: issue-prefix: "myproject" creates issues like "myproject-1", "myproject-2", etc.
9+
issue-prefix: "agentic-knowledge"
10+
11+
# Use no-db mode: load from JSONL, no SQLite, write back after each command
12+
# When true, bd will use .beads/issues.jsonl as the source of truth
13+
# instead of SQLite database
14+
no-db: true # JSONL-only mode, no SQLite database
15+
16+
# Disable daemon for RPC communication (forces direct database access)
17+
# no-daemon: false
18+
19+
# Disable auto-flush of database to JSONL after mutations
20+
# no-auto-flush: false
21+
22+
# Disable auto-import from JSONL when it's newer than database
23+
# no-auto-import: false
24+
25+
# Enable JSON output by default
26+
# json: false
27+
28+
# Default actor for audit trails (overridden by BD_ACTOR or --actor)
29+
# actor: ""
30+
31+
# Path to database (overridden by BEADS_DB or --db)
32+
# db: ""
33+
34+
# Auto-start daemon if not running (can also use BEADS_AUTO_START_DAEMON)
35+
# auto-start-daemon: true
36+
37+
# Debounce interval for auto-flush (can also use BEADS_FLUSH_DEBOUNCE)
38+
# flush-debounce: "5s"
39+
40+
# Git branch for beads commits (bd sync will commit to this branch)
41+
# IMPORTANT: Set this for team projects so all clones use the same sync branch.
42+
# This setting persists across clones (unlike database config which is gitignored).
43+
# Can also use BEADS_SYNC_BRANCH env var for local override.
44+
# If not set, bd sync will require you to run 'bd config set sync.branch <branch>'.
45+
# sync-branch: "beads-sync"
46+
47+
# Multi-repo configuration (experimental - bd-307)
48+
# Allows hydrating from multiple repositories and routing writes to the correct JSONL
49+
# repos:
50+
# primary: "." # Primary repo (where this database lives)
51+
# additional: # Additional repos to hydrate from (read-only)
52+
# - ~/beads-planning # Personal planning repo
53+
# - ~/work-planning # Work planning repo
54+
55+
# Integration settings (access with 'bd config get/set')
56+
# These are stored in the database, not in this file:
57+
# - jira.url
58+
# - jira.project
59+
# - linear.url
60+
# - linear.api-key
61+
# - github.org
62+
# - github.repo

.beads/interactions.jsonl

Whitespace-only changes.

.beads/issues.jsonl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{"id":"agentic-knowledge-1","title":"agentic-knowledge: epcc (development-plan-actually-search.md)","description":"Responsible vibe engineering session using epcc workflow for agentic-knowledge","status":"open","priority":2,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-10T09:55:15.223205+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-10T09:55:15.223205+01:00"}
2+
{"id":"agentic-knowledge-1.1","title":"Explore","description":"Research the codebase to understand existing patterns and gather context about the problem space. - If uncertain about conventions or rules, ask the user about them - Read relevant files and documentation - If exists: Understand and document requirements there - Otherwise: Document requirements in your task management system Focus on understanding without writing code yet. Document your findings and create tasks as needed.","status":"open","priority":3,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-10T09:55:15.37274+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-10T09:55:15.37274+01:00","dependencies":[{"issue_id":"agentic-knowledge-1.1","depends_on_id":"agentic-knowledge-1","type":"parent-child","created_at":"0001-01-01T00:00:00Z"}]}
3+
{"id":"agentic-knowledge-1.2","title":"Plan","description":"Create a detailed implementation strategy based on your exploration: - If exists: Base your strategy on requirements from it - Otherwise: Use existing task context Break down the work into specific, actionable tasks. Consider edge cases, dependencies, and potential challenges. - If architectural changes needed and exists: Document in - Otherwise: Create tasks to track architectural decisions - If exists: Adhere to the design in it - Otherwise: Elaborate design options and present them to the user Document the planning work thoroughly and create implementation tasks as part of the code phase as needed.","status":"open","priority":3,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-10T09:55:15.524416+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-10T09:55:15.524416+01:00","dependencies":[{"issue_id":"agentic-knowledge-1.2","depends_on_id":"agentic-knowledge-1","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"agentic-knowledge-1.2","depends_on_id":"agentic-knowledge-1.1","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]}
4+
{"id":"agentic-knowledge-1.3","title":"Code","description":"Follow your plan to build the solution: - If exists: Follow the design from it - Otherwise: Elaborate design options and present them to the user - If exists: Build according to the architecture from it - Otherwise: Elaborate architectural options and present them to the user - If exists: Ensure requirements from it are met - Otherwise: Ensure existing requirements are met based on your task context Write clean, well-structured code with proper error handling. Prevent regression by building, linting, and executing existing tests. Stay flexible and adapt the plan as you learn more during implementation. Update task progress and create new tasks as needed.","status":"open","priority":3,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-10T09:55:15.67957+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-10T09:55:15.67957+01:00","dependencies":[{"issue_id":"agentic-knowledge-1.3","depends_on_id":"agentic-knowledge-1","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"agentic-knowledge-1.3","depends_on_id":"agentic-knowledge-1.2","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]}
5+
{"id":"agentic-knowledge-1.4","title":"Commit","description":"Ensure code quality and documentation accuracy through systematic cleanup and review. **STEP 1: Code Cleanup** Systematically clean up development artifacts: 1. **Remove Debug Output**: Search for and remove all temporary debug output statements used during development. Look for language-specific debug output methods (console logging, print statements, debug output functions). Remove any debugging statements that were added for development purposes. 2. **Review TODO/FIXME Comments**: - Address each TODO/FIXME comment by either implementing the solution or documenting why it's deferred - Remove completed TODOs - Convert remaining TODOs to proper issue tracking if needed 3. **Remove Debugging Code Blocks**: - Remove temporary debugging code, test code blocks, and commented-out code - Clean up any experimental code that's no longer needed - Ensure proper error handling replaces temporary debug logging **STEP 2: Documentation Review** Review and update documentation to reflect final implementation: 1. **Update Long-Term Memory Documents**: Based on what was actually implemented: - If exists: Update it if requirements changed during development - If exists: Update it if architectural impacts were identified - If exists: Update it if design details were refined or changed - Otherwise: Document any changes in the plan file 2. **Compare Against Implementation**: Review documentation against actual implemented functionality 3. **Update Changed Sections**: Only modify documentation sections that have functional changes 4. **Remove Development Progress**: Remove references to development iterations, progress notes, and temporary decisions 5. **Focus on Final State**: Ensure documentation describes the final implemented state, not the development process 6. **Ask User to Review Document Updates** **STEP 3: Final Validation** - Run existing tests to ensure cleanup didn't break functionality - Verify documentation accuracy with a final review - Ensure code is ready for production/delivery Update task progress and mark completed work as you finalize the feature.","status":"open","priority":3,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-10T09:55:15.837066+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-10T09:55:15.837066+01:00","dependencies":[{"issue_id":"agentic-knowledge-1.4","depends_on_id":"agentic-knowledge-1","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"agentic-knowledge-1.4","depends_on_id":"agentic-knowledge-1.3","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]}

.beads/last-touched

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
agentic-knowledge-1.4

.beads/metadata.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"database": "beads.db",
3+
"jsonl_export": "issues.jsonl"
4+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"conversationId": "agentic-knowledge-actually-search-p423k1",
3+
"projectPath": "/Users/oliverjaegle/projects/privat/mcp-server/agentic-knowledge",
4+
"epicId": "agentic-knowledge-1",
5+
"phaseTasks": [
6+
{
7+
"phaseId": "explore",
8+
"phaseName": "Explore",
9+
"taskId": "agentic-knowledge-1.1"
10+
},
11+
{
12+
"phaseId": "plan",
13+
"phaseName": "Plan",
14+
"taskId": "agentic-knowledge-1.2"
15+
},
16+
{
17+
"phaseId": "code",
18+
"phaseName": "Code",
19+
"taskId": "agentic-knowledge-1.3"
20+
},
21+
{
22+
"phaseId": "commit",
23+
"phaseName": "Commit",
24+
"taskId": "agentic-knowledge-1.4"
25+
}
26+
],
27+
"createdAt": "2026-03-10T08:55:16.192Z",
28+
"updatedAt": "2026-03-10T08:55:16.192Z"
29+
}

0 commit comments

Comments
 (0)