Skip to content

GH-30: debug runmode — doctor subcommand and live diagnostics - #33

Merged
blainemotsinger merged 33 commits into
mainfrom
GH-30
Sep 29, 2026
Merged

blainemotsinger merged 33 commits into
mainfrom
GH-30

Conversation

@blainemotsinger

@blainemotsinger blainemotsinger commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds a debug runmode for knowledge-mcp (design + plan: ./tmp/docs/ session docs):

  • knowledge-mcp debug — one-shot startup diagnosis reusing the real startup path (projects.BuildWithStore → search.Location → lazy index open). Three report sections (Resolution, Startup trail with a watchdog-bounded index self-query, Environment) followed by ok/warn/fail findings; exit 1 iff any fail. Distinct fail index.locked vs fail index.open; --no-index-on-startup blocked queries warn instead of fail; zero-entry stores are healthy/fresh.
  • Live diagnostics — --debug / --log-file <path> (implies --debug) log startup phases and tool calls to stderr with sanitized arguments (entry bodies never written; sizes only). ok= derives from both err and res.IsError.
  • Hook diagnostics — KNM_DEBUG=1 enables the same logging for the Grep/Glob hook-augment plugin hook.
  • Shared startup path — index-location logic moved to search.Location (character-identical move + tests) so the doctor cannot drift from server behavior.
  • Docs + indexer — README ### Debugging section, knowledge-file example corrected to the project:/version:/entries: wrapper form; knowledge.Load failures now warn (missing optional category files stay silent).

Default behavior is unchanged (no flags ⇒ no new output); no new dependencies.

Test plan

  • go build ./... / gofmt -l . / go vet ./... clean
  • go test ./... — 9/9 packages (includes warm-index race regression under -race)
  • KNM_BIN=./knowledge-mcp prove evals/t/ — 175/175
  • make eval-mock — 18/18
  • Manual smoke: knowledge-mcp debug --root ... renders three sections, exit 0; KNM_DEBUG=1 hook-augment logs hook.skip

Task-scoped reviews passed for all 6 plan tasks plus fix rounds; final whole-branch review (b63a5f9..a55ede2) passed after one fix round (7ed72ae).

closes #30

@blainemotsinger
blainemotsinger merged commit 0f1a76a into main Sep 29, 2026
2 checks passed
@blainemotsinger
blainemotsinger deleted the GH-30 branch September 29, 2026 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add corpus tests

1 participant