diff --git a/.agents/decisions.yaml b/.agents/decisions.yaml index 6de1086..46e9621 100644 --- a/.agents/decisions.yaml +++ b/.agents/decisions.yaml @@ -25,4 +25,14 @@ entries: escapeQueryString escapes syntax-active characters (context-aware for +/- and &&/||); mid-word hyphens like test-stability stay intact. Decision documented so future search work does not re-introduce raw QueryStringQuery usage. source: user-requested robustness fix, 2026-09-08 - date: "2026-09-08" \ No newline at end of file + date: "2026-09-08" + - id: dec-004 + summary: Background indexing with --no-index-on-startup for large stores + detail: |- + Synchronous indexing on startup blocked server readiness for large knowledge stores. + Changed to background goroutine (go idx.IndexAll(resolver)) with ready channel for query synchronization. + Added --no-index-on-startup flag to skip indexing entirely; useful when startup delay is unacceptable. + Queries block on ready channel until indexing completes; stale data remains available if index has data. + readyOnce (sync.Once) prevents double-close panic when NewIndex already closed ready channel. + source: GH-25 background indexing, 2026-09-20 + date: "2026-09-20" \ No newline at end of file diff --git a/.agents/subsystems.yaml b/.agents/subsystems.yaml index cbde413..a259917 100644 --- a/.agents/subsystems.yaml +++ b/.agents/subsystems.yaml @@ -32,4 +32,14 @@ entries: update_knowledge validates supersedes references an existing ID in the same category and rejects no-op updates. Rules surface as a constraints section in list_knowledge output, above regular entries. source: code review, 2026-09-08 - date: "2026-09-08" \ No newline at end of file + date: "2026-09-08" + - id: sub-004 + summary: Background indexing with --no-index-on-startup flag + detail: |- + IndexAll runs as a goroutine (go idx.IndexAll(resolver)) when --no-index-on-startup is false (default). + When --no-index-on-startup is true, indexing is skipped entirely; server starts with stale or empty index. + Queries block on ready channel until indexing completes; ready channel closes when IndexAll finishes or if index has stale data. + readyOnce (sync.Once) prevents double-close panic if NewIndex already closed ready channel. + Useful for large knowledge stores where startup indexing would delay server readiness. + source: GH-25 background indexing, 2026-09-20 + date: "2026-09-20" \ No newline at end of file diff --git a/README.md b/README.md index 6893f61..e222681 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,13 @@ General notes: - Multi-entry configurations store the search index under `$XDG_STATE_HOME/knowledge-mcp/` (default `~/.local/state/knowledge-mcp/`). Single-flag configurations keep the index inside their own `.agents/` — unless `--store` is set, in which case the index lives at `/.index`. - `--index ` overrides the index location in all modes. +### Startup Options + +`--no-index-on-startup` skips background indexing on startup. The server starts +immediately with stale or empty index data; queries block until indexing completes +if no stale data is available. Useful for large knowledge stores where startup +indexing would delay server readiness. + ## MCP Tools | Tool | Description |