Skip to content

docs(skill): teach the lean search_code workflow #2169

Description

@artur-firsttouch

Problem

The installed codebase-memory skill routes text searches to search_code, but it does not explain how to use the lean output controls now available on main. In practice, agents can respond to broad results by raising limit or combining mode: "full" with a high limit, producing unnecessarily large MCP responses. Literal alternation such as foo|bar is also easy to send without regex: true.

The current release, v0.10.8, does not expose the newer controls. Current main already implements the server-side pieces: max_output_tokens, independent ranked/raw/directory pagination, bounded source and raw-line expansion, semantic truncation metadata, and the literal-pipe warning. This proposal does not change the MCP API or handler behavior.

Proposal

Add a concise Code Search Workflow section to the installer-owned embedded codebase-memory skill in src/cli/cli.c:

  1. Use search_graph(semantic_query=[...]) for broad natural-language discovery.
  2. Use search_graph for known or partial symbols.
  3. Use search_code for exact identifiers, literals, errors, and settings.
  4. Start with compact or files, result_limit: 10, and max_output_tokens: 3200.
  5. Narrow with path_filter and file_pattern before paging via returned offsets.
  6. Treat omissions as a narrowing signal rather than immediately raising limits.
  7. Reserve full for one to three expected hits and bound source_max_lines.
  8. Require regex: true for patterns such as foo|bar.
  9. Explicitly call out full + high limit as an anti-pattern.

Keep the always-loaded agent instructions unchanged so detailed usage guidance costs context only when the skill is loaded. Extend cli_skill_files_content to contract-test the key guidance.

Non-goals

  • No MCP schema or behavior changes.
  • No new include_tests or generated-file controls. Existing scoped search, ignore rules, and test-result ranking remain unchanged.
  • No default changes or compatibility impact.

Would this focused skill-guidance change be acceptable?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    editor/integrationEditor compatibility and CLI integrationparsing/qualityGraph extraction bugs, false positives, missing edges

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions