Skip to content

docs: lift Glama TDQS scores on the lowest-scoring tools#66

Merged
aliasunder merged 4 commits into
mainfrom
claude/vault-bootstrap-setup-kzwu2
May 27, 2026
Merged

docs: lift Glama TDQS scores on the lowest-scoring tools#66
aliasunder merged 4 commits into
mainfrom
claude/vault-bootstrap-setup-kzwu2

Conversation

@aliasunder
Copy link
Copy Markdown
Owner

@aliasunder aliasunder commented May 27, 2026

Summary

Glama scored all 23 tools (Tool Definition Quality grade: A). Six tools sat below the pack, dragged by the same dimensions — Parameters (descriptions restated the schema instead of explaining intent) and, on several, Behavior. This enriches those six descriptions with non-obvious parameter semantics, behavioral consequences, and tighter usage guidance; fixes one latent bug surfaced during the audit; and tightens the description-quality conventions + test coverage off the back of review.

Targeted tools and their weak dimensions:

Tool Score Targeted
vault_find_orphans 4.2 Parameters, Usage, Conciseness
vault_delete_note 4.4 Behavior, Completeness (Parameters left at baseline — single path)
vault_get_backlinks 4.5 Parameters, Behavior
vault_get_outgoing_links 4.5 Parameters, Behavior
vault_search_by_folder 4.6 Behavior, Completeness, Parameters
vault_update_memory 4.6 Conciseness (trimmed repetition), Behavior, Parameters

Notable additions, all verified against the data layer (not invented):

  • find_orphans: exclude_folders replaces the defaults rather than merging (a real footgun), and matches by recursive folder prefix.
  • delete_note: deletion is permanent on disk (no trash) with no server-side undo — recovery depends on the user's own backups or sync history (claim scoped to the server; not asserted as absolutely irreversible, since synced vaults retain version history). Inbound links break on delete; added an Errors: section.
  • get_backlinks/get_outgoing_links: path is exact + case-sensitive incl. .md; a non-matching path returns an empty array, not an error (now stated under Errors:); self-links and code-fence exclusion documented.
  • update_memory: additive (never overwrites; repeat calls duplicate); trimmed the triple-repeated "call list_memory_files first" that capped Conciseness.

Bug fix (same audit)

vault_search_by_folder documented "sorted by most recently modified" but its SQL omitted ORDER BY, returning results in arbitrary order. Added ORDER BY mtime DESC to match every sibling metadata tool, with a test asserting the ordering. (Declined CodeRabbit's path ASC tie-breaker here — recentNotes and findOrphans also sort by bare mtime DESC; a tie-breaker should be applied uniformly in a separate change, not piecemeal.)

Review follow-ups (conventions + tests)

  • Errors: sections, where relevant. Added the empty-result-is-not-an-error contract to search_by_folder, get_backlinks, get_outgoing_links, find_orphans; delete_note carries its real errors. update_memory is intentionally left without one (auto-creates; no failure/no-match contract — a boilerplate "Errors: none" would just cost tokens).
  • AGENTS.md reconciled so the guideline no longer contradicts the code: Errors: is required where a tool has failure modes or a no-match/empty-result contract worth clarifying, optional for tools that can't meaningfully fail.
  • New test: tool-definitions.test.ts now asserts every tool description includes a Returns: section (alongside the existing Example: / When to use checks) so a future tool can't omit it.

Scope

Description text + one-line SQL sort fix + a doc-convention update + two tests. No tool behavior changes beyond the folder-search ordering.

Test plan

  • npm run build — clean
  • npm run lint — clean
  • npm test499 passing (incl. searchByFolder ordering test + Returns: section test)
  • Downstream: scores update only after this merges, the live server redeploys, and Glama re-syncs (directional gains expected — LLM grader).

https://claude.ai/code/session_01KnvnMoDuU6QkYrCna54CqT


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Folder search now returns items ordered by most-recently-modified for improved discovery.
  • Documentation

    • Expanded vault tool docs and style guidance to clarify folder-search semantics, deletion behavior, memory update rules, backlink/outgoing-link specifics, orphan-finding options, and required tool description sections.
  • Tests

    • Added tests verifying folder-search ordering and that tool descriptions include a "Returns:" section.

[[Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/aliasunder/vault-cortex/pull/66?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

📝 Walkthrough

Walkthrough

This PR adds modification-time-based result ordering to folder searches and expands documentation across several vault tools to clarify semantics around deletion permanence, memory updates, link handling, and folder matching behavior.

Changes

Search Ordering and Tool Documentation Updates

Layer / File(s) Summary
Folder search result ordering
src/vault-mcp/search/search-index.ts, src/vault-mcp/search/__tests__/search-index.test.ts, src/vault-mcp/tool-definitions.ts
searchByFolder SQL query adds ORDER BY mtime DESC to return results sorted by modification time descending. New test verifies deterministic path ordering across nested and top-level notes. Tool description clarifies folder prefix matching, recursive vs. top-level listing defaults, and empty/nonexistent folder behavior.
Comprehensive tool documentation updates
src/vault-mcp/tool-definitions.ts, AGENTS.md
Documentation for vault_delete_note, vault_update_memory, vault_get_backlinks, vault_get_outgoing_links, and vault_find_orphans are rewritten to specify permanent deletion semantics, additive-only memory behavior, wikilink vs. markdown link capture, code-block ignoring, self-link inclusion, exact path requirements, and folder prefix/recursion matching details. Agent tool-description conventions now require explicit Example:, When to use:, Returns:, conditional Errors:, and Obsidian syntax: for write tools.

🎯 2 (Simple) | ⏱️ ~8 minutes

🐰 A search that sorts with care,
By time when notes were changed,
And docs now crystal-clear declare
Each vault tool's ways arranged.
Thump-thump 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title claims to lift TDQS scores on lowest-scoring tools, but the changeset shows documentation updates and one SQL ordering fix across six tools, not a focused change that justifies the 'docs:' prefix. Revise the title to accurately reflect the full scope: consider 'refactor: improve tool documentation and fix search ordering' or 'docs: enhance tool descriptions and fix vault_search_by_folder ordering', since the PR includes a SQL fix alongside documentation updates.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/vault-bootstrap-setup-kzwu2

Comment @coderabbitai help to get the list of available commands and usage tips.

claude added 2 commits May 27, 2026 15:28
Add parameter-semantics, behavior, and usage detail to the six
lowest-scoring tools (find_orphans, delete_note, get_backlinks,
get_outgoing_links, search_by_folder, update_memory) so descriptions
explain non-obvious intent beyond the schema.

https://claude.ai/code/session_01KnvnMoDuU6QkYrCna54CqT
The query omitted ORDER BY, so results came back in arbitrary order
despite the tool documenting "sorted by most recently modified." Add
ORDER BY mtime DESC to match sibling metadata tools.

https://claude.ai/code/session_01KnvnMoDuU6QkYrCna54CqT
@aliasunder aliasunder force-pushed the claude/vault-bootstrap-setup-kzwu2 branch from 3a0c0eb to 6f3c871 Compare May 27, 2026 15:28
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/vault-mcp/search/search-index.ts`:
- Around line 637-638: The SQL ORDER BY clause currently uses only "ORDER BY
mtime DESC" which yields non-deterministic ordering for rows with equal mtime;
update the query in src/vault-mcp/search/search-index.ts to add a deterministic
secondary sort key (e.g., change the ORDER BY to "ORDER BY mtime DESC, path
ASC") so results are stable when mtime ties occur (the clause near the LIMIT ?
should be adjusted accordingly).

In `@src/vault-mcp/tool-definitions.ts`:
- Around line 698-710: The vault_search_by_folder tool description is missing an
explicit "Errors:" section; update its description string to include an Errors:
paragraph (e.g., "Errors: returns empty array for empty/nonexistent folders;
other failures will throw an error with remediation guidance such as checking
folder path and permissions.") and do the same for the other updated tool
descriptions in this file (the neighboring tools referenced in the review
ranges), ensuring each description includes "Errors:" with a short remediation
note while keeping existing Example:, When to use:, Obsidian syntax: (for write
tools), and Returns: sections intact; search for the vault_search_by_folder
entry name to locate the block and mirror the Errors: pattern into the other
affected tool description constants.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 102ce834-37f9-426f-b93c-262800b9d6c2

📥 Commits

Reviewing files that changed from the base of the PR and between fa07e2e and 3a0c0eb.

📒 Files selected for processing (4)
  • README.md
  • src/vault-mcp/search/__tests__/search-index.test.ts
  • src/vault-mcp/search/search-index.ts
  • src/vault-mcp/tool-definitions.ts

Comment thread src/vault-mcp/search/search-index.ts
Comment thread src/vault-mcp/tool-definitions.ts Outdated
Soften vault_delete_note's deletion claim — the server has no undo, but
recovery may be possible via backups/sync history, so drop the absolute
"irreversible / cannot be recovered" wording. Add concise Errors sections
clarifying the empty-result-is-not-an-error contract on the link/folder/orphan
query tools, and reconcile the AGENTS.md Errors convention to match (required
only where a tool can fail or has a no-match contract worth stating).

https://claude.ai/code/session_01KnvnMoDuU6QkYrCna54CqT
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AGENTS.md`:
- Around line 178-183: Test coverage is missing an assertion for the mandatory
"Returns:" section in tool descriptions; update the unit test in
src/vault-mcp/__tests__/tool-definitions.test.ts (the test that iterates over
toolDescriptions / the relevant it block) to assert that each tool description
string includes "Returns:" (similar to the existing checks for "Example:" and
"When to use:"), and ensure the check runs for all tools (including write tools
alongside the existing "Obsidian syntax:" assertion) so any tool missing
"Returns:" will fail the test.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f056d26c-5b03-4a0c-ade8-526eaec88f69

📥 Commits

Reviewing files that changed from the base of the PR and between 6f3c871 and c8bb2ce.

📒 Files selected for processing (2)
  • AGENTS.md
  • src/vault-mcp/tool-definitions.ts
✅ Files skipped from review due to trivial changes (1)
  • src/vault-mcp/tool-definitions.ts

Comment thread AGENTS.md
AGENTS.md mandates a Returns: section on every MCP tool description, but the
suite only enforced Example: and When to use. Add the matching assertion so a
future tool can't omit Returns.

https://claude.ai/code/session_01KnvnMoDuU6QkYrCna54CqT
@aliasunder aliasunder changed the title Lift Glama TDQS scores on the six lowest-scoring tools Lift Glama TDQS scores on the six lowest-scoring tools (+ folder-sort fix, Errors/Returns conventions) May 27, 2026
@aliasunder aliasunder changed the title Lift Glama TDQS scores on the six lowest-scoring tools (+ folder-sort fix, Errors/Returns conventions) docs: lift Glama TDQS scores on the lowest-scoring tools May 27, 2026
@aliasunder aliasunder merged commit 2726e5a into main May 27, 2026
6 checks passed
@aliasunder aliasunder deleted the claude/vault-bootstrap-setup-kzwu2 branch May 27, 2026 19:48
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.

2 participants