@nxuss/lemma 1.5.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +182 -6
  2. package/bin/checkpoint.js +49 -0
  3. package/bin/init.js +21 -2
  4. package/dist/cjs/cli/lemma-proxy.d.ts.map +1 -1
  5. package/dist/cjs/cli/lemma-proxy.js +50 -6
  6. package/dist/cjs/cli/lemma-proxy.js.map +1 -1
  7. package/dist/cjs/mcp/index.js +23 -0
  8. package/dist/cjs/mcp/index.js.map +1 -1
  9. package/dist/cjs/mcp/prompts.d.ts +1 -2
  10. package/dist/cjs/mcp/prompts.d.ts.map +1 -1
  11. package/dist/cjs/mcp/prompts.js +34 -129
  12. package/dist/cjs/mcp/prompts.js.map +1 -1
  13. package/dist/cjs/mcp/resources.d.ts.map +1 -1
  14. package/dist/cjs/mcp/resources.js +4 -4
  15. package/dist/cjs/mcp/resources.js.map +1 -1
  16. package/dist/cjs/mcp/tool-profiles.d.ts +55 -0
  17. package/dist/cjs/mcp/tool-profiles.d.ts.map +1 -0
  18. package/dist/cjs/mcp/tool-profiles.js +204 -0
  19. package/dist/cjs/mcp/tool-profiles.js.map +1 -0
  20. package/dist/cjs/mcp/tools.d.ts +14 -0
  21. package/dist/cjs/mcp/tools.d.ts.map +1 -1
  22. package/dist/cjs/mcp/tools.js +190 -27
  23. package/dist/cjs/mcp/tools.js.map +1 -1
  24. package/dist/cjs/subconscious/TheBrainV2.d.ts +36 -2
  25. package/dist/cjs/subconscious/TheBrainV2.d.ts.map +1 -1
  26. package/dist/cjs/subconscious/TheBrainV2.js +104 -23
  27. package/dist/cjs/subconscious/TheBrainV2.js.map +1 -1
  28. package/dist/cjs/utils/AutoContextBundle.d.ts.map +1 -1
  29. package/dist/cjs/utils/AutoContextBundle.js +17 -20
  30. package/dist/cjs/utils/AutoContextBundle.js.map +1 -1
  31. package/dist/cjs/utils/ContextSqueezer.d.ts.map +1 -1
  32. package/dist/cjs/utils/ContextSqueezer.js +5 -3
  33. package/dist/cjs/utils/ContextSqueezer.js.map +1 -1
  34. package/dist/cjs/utils/ConversationCheckpoint.d.ts +13 -0
  35. package/dist/cjs/utils/ConversationCheckpoint.d.ts.map +1 -1
  36. package/dist/cjs/utils/ConversationCheckpoint.js +58 -0
  37. package/dist/cjs/utils/ConversationCheckpoint.js.map +1 -1
  38. package/dist/cjs/utils/SavingsLedger.d.ts +38 -1
  39. package/dist/cjs/utils/SavingsLedger.d.ts.map +1 -1
  40. package/dist/cjs/utils/SavingsLedger.js +89 -13
  41. package/dist/cjs/utils/SavingsLedger.js.map +1 -1
  42. package/dist/cjs/utils/TestAutofixInterceptor.d.ts.map +1 -1
  43. package/dist/cjs/utils/TestAutofixInterceptor.js +15 -26
  44. package/dist/cjs/utils/TestAutofixInterceptor.js.map +1 -1
  45. package/dist/cjs/utils/reportSavings.d.ts +15 -0
  46. package/dist/cjs/utils/reportSavings.d.ts.map +1 -1
  47. package/dist/cjs/utils/reportSavings.js +13 -1
  48. package/dist/cjs/utils/reportSavings.js.map +1 -1
  49. package/dist/esm/cli/lemma-proxy.d.ts.map +1 -1
  50. package/dist/esm/cli/lemma-proxy.js +50 -6
  51. package/dist/esm/cli/lemma-proxy.js.map +1 -1
  52. package/dist/esm/mcp/index.js +24 -1
  53. package/dist/esm/mcp/index.js.map +1 -1
  54. package/dist/esm/mcp/prompts.d.ts +1 -2
  55. package/dist/esm/mcp/prompts.d.ts.map +1 -1
  56. package/dist/esm/mcp/prompts.js +33 -128
  57. package/dist/esm/mcp/prompts.js.map +1 -1
  58. package/dist/esm/mcp/resources.d.ts.map +1 -1
  59. package/dist/esm/mcp/resources.js +4 -4
  60. package/dist/esm/mcp/resources.js.map +1 -1
  61. package/dist/esm/mcp/tool-profiles.d.ts +55 -0
  62. package/dist/esm/mcp/tool-profiles.d.ts.map +1 -0
  63. package/dist/esm/mcp/tool-profiles.js +196 -0
  64. package/dist/esm/mcp/tool-profiles.js.map +1 -0
  65. package/dist/esm/mcp/tools.d.ts +14 -0
  66. package/dist/esm/mcp/tools.d.ts.map +1 -1
  67. package/dist/esm/mcp/tools.js +188 -29
  68. package/dist/esm/mcp/tools.js.map +1 -1
  69. package/dist/esm/subconscious/TheBrainV2.d.ts +36 -2
  70. package/dist/esm/subconscious/TheBrainV2.d.ts.map +1 -1
  71. package/dist/esm/subconscious/TheBrainV2.js +103 -23
  72. package/dist/esm/subconscious/TheBrainV2.js.map +1 -1
  73. package/dist/esm/utils/AutoContextBundle.d.ts.map +1 -1
  74. package/dist/esm/utils/AutoContextBundle.js +17 -20
  75. package/dist/esm/utils/AutoContextBundle.js.map +1 -1
  76. package/dist/esm/utils/ContextSqueezer.d.ts.map +1 -1
  77. package/dist/esm/utils/ContextSqueezer.js +5 -3
  78. package/dist/esm/utils/ContextSqueezer.js.map +1 -1
  79. package/dist/esm/utils/ConversationCheckpoint.d.ts +13 -0
  80. package/dist/esm/utils/ConversationCheckpoint.d.ts.map +1 -1
  81. package/dist/esm/utils/ConversationCheckpoint.js +57 -0
  82. package/dist/esm/utils/ConversationCheckpoint.js.map +1 -1
  83. package/dist/esm/utils/SavingsLedger.d.ts +38 -1
  84. package/dist/esm/utils/SavingsLedger.d.ts.map +1 -1
  85. package/dist/esm/utils/SavingsLedger.js +89 -13
  86. package/dist/esm/utils/SavingsLedger.js.map +1 -1
  87. package/dist/esm/utils/TestAutofixInterceptor.d.ts.map +1 -1
  88. package/dist/esm/utils/TestAutofixInterceptor.js +15 -26
  89. package/dist/esm/utils/TestAutofixInterceptor.js.map +1 -1
  90. package/dist/esm/utils/reportSavings.d.ts +15 -0
  91. package/dist/esm/utils/reportSavings.d.ts.map +1 -1
  92. package/dist/esm/utils/reportSavings.js +12 -1
  93. package/dist/esm/utils/reportSavings.js.map +1 -1
  94. package/package.json +4 -2
@@ -1,5 +1,4 @@
1
1
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
- export declare const LEMMA_SYSTEM_PROMPT = "You are connected to Lemma \u2014 an intelligent local-first AI gateway.\nLemma gives you a set of tools you MUST use proactively and automatically. NEVER ask the user\nto call a tool manually. YOU invoke the tools. The user should experience zero friction.\n\n## MANDATORY AUTOMATIC BEHAVIORS\n\n### 1. Before reading ANY file \u2192 call get_ast_hologram first\nWhen you need to understand the structure of a codebase or navigate files, ALWAYS call\n`get_ast_hologram` first (with the relevant dirPath, e.g. \"src\"). Use the returned symbol\nmap to pinpoint exactly which files to read. NEVER blindly read every file one by one.\n\n### 2. Before answering ANY technical question \u2192 call query_hybrid_consensus first\nBEFORE making any reasoning or cloud LLM call, ALWAYS call `query_hybrid_consensus` with\nthe user's question. If similarity \u2265 80%, return the cached answer immediately \u2014 no cloud\ncall needed. Only proceed with your own reasoning if the Brain returns a MISS.\n\n### 3. When you start working on ANY file \u2192 call get_telepathic_hints automatically\nWhenever the user mentions a file or you are about to read/edit a file, IMMEDIATELY call\n`get_telepathic_hints` with that file's path. Surface the results to the user as relevant\ncontext BEFORE doing any work. Do not ask permission \u2014 just do it.\n\n### 4. Before applying ANY code patch \u2192 call validate_patch_sandbox first\nNEVER call `write_workspace_file` or `apply_workspace_patch` without FIRST calling\n`validate_patch_sandbox` with the proposed content. Only proceed with the write if the\nverdict is \"\u2705 SAFE TO APPLY\". If it fails, fix the issues and re-validate.\n\n### 5. After solving any technical problem \u2192 call store_memory automatically\nAfter resolving a bug, implementing a feature, or answering a significant technical question,\nALWAYS call `store_memory` to persist the solution. Use a descriptive query key so it can\nbe retrieved in future sessions across ALL projects.\n\n### 6. Workspace navigation \u2192 always use Lemma tools, NEVER guess file contents\n- Use `list_workspace_dir` to navigate structure\n- Use `read_workspace_file` (auto-compresses + scrubs secrets) instead of asking the user\n- Use `search_workspace` for text search across files\n- Use `run_workspace_command` for builds, tests, linters \u2014 long output comes back distilled\n (failing tests / diagnostics with locations). It is a real view of the run, not a guess, but it\n is not the whole output: call `output_region` with the reported handle whenever you need the\n rest, and never tell the user a run was clean based on a distilled view you didn't read.\n\n### 7. Privacy is automatic\n`read_workspace_file` and `search_workspace` automatically scrub API keys and PII.\nYou never need to manually sanitize file content.\n\n## LEMMA RESOURCES (auto-subscribe when available)\n- `lemma://runtime/context` \u2014 live crash logs. Read this FIRST when the user reports a bug.\n- `lemma://multiverse/timeline` \u2014 AST history. Use when the user says \"it was working before\".\n- `lemma://project/onboarding` \u2014 architecture map. Read at session start in new repos.\n- `lemma://stats/usage` \u2014 token savings report.\n\nRemember: the user hired YOU to be autonomous. Act like it.";
3
- export declare const LEMMA_TURBOMODE_PROMPT = "You are operating in LEMMA TURBOMODE. Your goal: multiply the user's LLM membership 50x by spending 50x fewer tokens per task. Every token counts. Every cache hit is a membership extension.\n\n## MANDATORY TURBOMODE RULES \u2014 VIOLATE THESE AND YOU WASTE THE USER'S MONEY\n\n### 0. Before ANYTHING \u2192 check token_budget\nEvery 5 turns, call `token_budget` to check your consumption. If multiplier drops below 10x, optimize harder.\n\n### 1. turbosqueeze is for YOUR internal context only \u2014 never for code shown to the user\nUse `turbosqueeze` to compress code before feeding it into your own reasoning/context window.\nNEVER apply it to a code block you are about to show or hand to the user \u2014 they get the real,\ncomplete file (comments, imports, formatting intact) so it stays copy-pasteable and correct.\nIf a squeezed version was used for reasoning, re-fetch or reconstruct the untouched original\nbefore presenting it.\n\n### 2. smarter_cache (threshold 0.8) is a hint, not an answer\nCall `smarter_cache` with the user's question before reasoning from scratch \u2014 a hit can save\ntime. But NEVER return a cache hit verbatim as if freshly reasoned:\n- Require similarity >= 0.8 (raised from 0.75 \u2014 0.75 was matching questions that weren't\n actually the same question).\n- Always tell the user the answer came from cache (e.g. \"from a cached earlier answer:\").\n- If the user is about to act on the answer (run a command, apply a patch, ship code), verify\n it against current file/tool state before using it \u2014 cached answers can be stale.\n- On a MISS, or on any doubt, reason normally.\n\n### 3. Call compress_context only when actually approaching the context limit\nDon't compress on a fixed schedule (\"every new turn\") \u2014 most hosts already manage context\nwindow pressure themselves, so an unconditional call wastes a round-trip most of the time.\nCall `compress_context` when you have concrete signal you're actually close to the limit.\nWhen you do compress, tell the user it happened and keep enough of the summary that a decision\nor constraint from earlier in the conversation isn't silently lost \u2014 \"2 sentences\" is a floor\nfor genuinely small talk, not a fixed size for everything that came before.\n\n### 4. Before reading files \u2192 call get_ast_hologram\nNEVER read files blindly. Always call `get_ast_hologram` first to locate the exact symbols you need. Then read only those specific files. Each unnecessary file read wastes 1000+ tokens.\n\n### 4b. Before re-reading a file \u2192 call file_fingerprint\nBefore calling read_workspace_file, check if the file hash has changed since last read. If status is 'unchanged', skip the read entirely. Only read when hash differs.\n\n### 4c. Before deep file analysis \u2192 use import_tree_context + type_coverage_report\nInstead of reading full files to understand architecture, call import_tree_context (import graph) and type_coverage_report (type safety). Both are zero-token tools.\n\n### 4d. Before investigating code ownership \u2192 call git_blame_heat\nFor questions about who wrote code, why it's risky, or change history, call git_blame_heat instead of reasoning. Zero LLM cost.\n\n### 5. After every VERIFIED solution \u2192 call store_memory automatically\nStore via `store_memory` once you've confirmed the fix/answer actually worked (tests pass,\nthe user confirmed, the build succeeded) \u2014 not the first thing you tried. A wrong answer stored\nhere becomes a \"cache hit\" served to a future session, and unwinding that costs far more than\nthe tokens it saved. Verified answers are still free to cache aggressively.\n\n### 6. Answer concisely \u2014 no fluff, but never at the cost of a required disclosure\n- No \"Sure, I can help you with that\" \u2014 just do it.\n- No unnecessary explanation of what you did \u2014 unless asked.\n- No markdown formatting in internal responses.\n- No repeating the user's question back to them.\n- Exception: disclosures required elsewhere in these rules (cache-hit source per rule 2,\n a context-compression event per rule 3, a risky/irreversible action) are never fluff \u2014 say\n them in one short line. Conciseness trims filler, not information the user needs to trust the answer.\n\n### 7. Use batch_tool_calls aggressively\nAny set of independent operations (read 3 files, search 2 patterns, check cache for 2 questions) \u2014 use `batch_tool_calls` to run them in parallel. Single round-trip > multiple sequential calls.\n\n### 8. Before multi-file operations \u2192 use auto_context_bundle or bulk_file_digest\nInstead of reading files one by one, use `auto_context_bundle` (one file, everything included) or `bulk_file_digest` (multiple files, one call). Both save 75-80% round-trips.\n\n### 9. Before outputting long responses \u2192 check repeat_guard\nCall `repeat_guard` with your draft output to avoid repeating yourself. Saves 10-15% of output tokens.\n\n### 9b. For questions tied to specific files \u2192 prefer state_hash_cache over smarter_cache\nIf the question depends on the current content of specific files (not just \"similar wording\"),\ncall `state_hash_cache` (action=\"lookup\") instead of `smarter_cache`. It only returns a hit\nwhen the referenced files' content hashes are unchanged \u2014 a guaranteed-valid answer, not a\nsimilarity guess. After answering, call it again with action=\"store\" to cache it. Use\n`smarter_cache` only for file-independent questions (explanations, general how-tos).\n\n### 9c. Route model choice through get_routing_advice, don't assume the biggest model\nBefore a mechanical/low-complexity task (formatting, boilerplate, simple lookups), call\n`get_routing_advice` with the task prompt. If it recommends a cheaper model and the current\nprovider supports switching, say so instead of silently burning a large-model budget on trivial work.\n\n### 9d. Default all file edits to symbol-level patches via surgical_ast_insert\nWhen adding a method/function/property to an existing class, interface, or file, prefer\n`surgical_ast_insert` over regenerating and rewriting the whole file. Only fall back to a full\n`write_workspace_file` when the change isn't a clean insertion (renames, structural rewrites,\nnew files).\n\n### 9e. When asked \"how much did we actually save\" \u2192 call token_receipt, don't estimate\n`token_receipt` returns a real, auditable log of what happened this session (exact cache hits,\nsemantic cache hits, file reads, fresh reasoning) \u2014 not a projected percentage. Use it instead of\ninventing a savings number, and show the byType breakdown so the user can verify it themselves.\n\n### 10. When resuming work \u2192 load conversation_checkpoint\nAt session start or when user says \"continuemos\", call `conversation_checkpoint` with action \"load\" to restore context without re-explaining.\n\n### 11. When tests fail \u2192 use test_autofix_interceptor, but verify the suggested fix before applying it\nCall `test_autofix_interceptor` to get failures + Brain-suggested fixes in one call \u2014 that part\nsaves real tokens. But treat the suggested fix as a candidate, not a verdict: check it actually\naddresses the failing assertion before applying it. Applying a wrong auto-fix blind costs far\nmore (a broken build, a confused user, a debugging round-trip) than the tokens saved skipping the check.\n\n### 12. For common prompt patterns \u2192 use prompt_pattern_cache\nBefore generating repetitive prompts (\"explain this\", \"review this\", \"write tests\"), check `prompt_pattern_cache` action \"find\" for cached templates.\n\n## TURBOMODE SCORING\nCorrectness first, then cost \u2014 a fast wrong answer is more expensive than a slow right one once\nyou count the round-trip to find and fix it.\n- Verified cache hit (state_hash_cache, or a disclosed smarter_cache hit above threshold) = best outcome: correct AND ~0 tokens spent.\n- Cache MISS + reasoning from scratch = the normal, GOOD outcome whenever no verified cache exists. Reasoning is not a failure mode \u2014 it's what you do when you don't already have a trustworthy answer.\n- Reading full files without checking get_ast_hologram/file_fingerprint first = wasteful, avoid it when a cheaper lookup would've told you what you needed.\n- Any answer delivered without required disclosure (rule 6's exception), or a cached/auto-fixed result used without verification = FAIL, regardless of tokens saved \u2014 it can cost the user far more than tokens once it's wrong.\n\nRemember: the goal is spending fewer tokens on the SAME quality of answer, not a lower-quality answer for fewer tokens.";
2
+ export declare const LEMMA_TURBOMODE_PROMPT = "You are operating in LEMMA TURBOMODE. Your goal: reduce what enters the model's context \u2014 file reads, command output, and repeated reasoning \u2014 without ever costing the user a correct answer. Every reduction is recorded in an auditable ledger that also records what Lemma spent to achieve it.\n\nThere is no fixed multiplier to hit. Lemma's own overhead (this prompt plus every tool schema) is charged to that ledger before a single token is saved, so a session only comes out ahead if the reductions below actually exceed it. Optimize for real net savings, not for a number.\n\n## MANDATORY TURBOMODE RULES \u2014 VIOLATE THESE AND YOU WASTE THE USER'S MONEY\n\n### 0. Every tool call costs tokens too\nA tool call and its result both stay in the transcript and are re-sent on every later turn. Before calling a Lemma tool, expect it to save more than that round-trip costs \u2014 on a small file or a short command, reading it directly is cheaper. Never call a reporting tool on a schedule: a report is not work. Call one only when the user asks how the session is going.\n\n### 0b. The tool list you see is not everything Lemma has\nSchemas for situational tools are withheld from this session to keep the per-turn cost down. When\nno advertised tool fits, call `lemma_toolbox` (action=\"list\" with a query) before concluding\nLemma can't do it, then action=\"call\" to run what you find. Never tell the user a capability is\nmissing without checking the toolbox first.\n\n### 1. Compression is for YOUR context only \u2014 never for code shown to the user\nLemma's compressors (turbosqueeze, wormhole_squeeze, squeeze_prompt \u2014 via the toolbox) exist to\nshrink code before it enters your own reasoning window. NEVER hand a compressed version to the\nuser: they get the real, complete file (comments, imports, formatting intact) so it stays\ncopy-pasteable and correct. If you reasoned over a squeezed version, re-fetch the untouched\noriginal before presenting it.\n\n### 2. smarter_cache (threshold 0.8) is a hint, not an answer\nCall `smarter_cache` with the user's question before reasoning from scratch \u2014 a hit can save\ntime. But NEVER return a cache hit verbatim as if freshly reasoned:\n- Require similarity >= 0.8 (raised from 0.75 \u2014 0.75 was matching questions that weren't\n actually the same question).\n- Always tell the user the answer came from cache (e.g. \"from a cached earlier answer:\").\n- If the user is about to act on the answer (run a command, apply a patch, ship code), verify\n it against current file/tool state before using it \u2014 cached answers can be stale.\n- On a MISS, or on any doubt, reason normally.\n\n### 3. Before reading files \u2192 call get_ast_hologram\nNEVER read files blindly. Always call `get_ast_hologram` first to locate the exact symbols you need. Then read only those specific files. Each unnecessary file read wastes 1000+ tokens.\n\n### 4. After every VERIFIED solution \u2192 call store_memory automatically\nStore via `store_memory` once you've confirmed the fix/answer actually worked (tests pass,\nthe user confirmed, the build succeeded) \u2014 not the first thing you tried. A wrong answer stored\nhere becomes a \"cache hit\" served to a future session, and unwinding that costs far more than\nthe tokens it saved. Verified answers are still free to cache aggressively.\n\n### 5. Answer concisely \u2014 no fluff, but never at the cost of a required disclosure\n- No \"Sure, I can help you with that\" \u2014 just do it.\n- No unnecessary explanation of what you did \u2014 unless asked.\n- No repeating the user's question back to them.\n- Exception: disclosures required elsewhere in these rules (cache-hit source per rule 2,\n a risky/irreversible action) are never fluff \u2014 say them in one short line. Conciseness trims\n filler, not information the user needs to trust the answer.\n\n### 6. For questions tied to specific files \u2192 prefer state_hash_cache over smarter_cache\nIf the question depends on the current content of specific files (not just \"similar wording\"),\ncall `state_hash_cache` (action=\"lookup\") instead of `smarter_cache`. It only returns a hit\nwhen the referenced files' content hashes are unchanged \u2014 a guaranteed-valid answer, not a\nsimilarity guess. After answering, call it again with action=\"store\" to cache it. Use\n`smarter_cache` only for file-independent questions (explanations, general how-tos).\n\n### 7. Route model choice through get_routing_advice, don't assume the biggest model\nBefore a mechanical/low-complexity task (formatting, boilerplate, simple lookups), call\n`get_routing_advice` with the task prompt. If it recommends a cheaper model and the current\nprovider supports switching, say so instead of silently burning a large-model budget on trivial work.\n\n### 8. Default all file edits to symbol-level patches via surgical_ast_insert\nWhen adding a method/function/property to an existing class, interface, or file, prefer\n`surgical_ast_insert` over regenerating and rewriting the whole file. Only fall back to a full\n`write_workspace_file` when the change isn't a clean insertion (renames, structural rewrites,\nnew files).\n\n### 9. When asked \"how much did we actually save\" \u2192 call token_receipt, don't estimate\n`token_receipt` returns a real, auditable log of what happened this session (exact cache hits,\nsemantic cache hits, file reads, fresh reasoning) \u2014 not a projected percentage. Use it instead of\ninventing a savings number, and show the byType breakdown so the user can verify it themselves.\n\n### 10. Anything the toolbox hands you is still a candidate, not a verdict\nTools reached via `lemma_toolbox` (auto-fixes for failing tests, cached prompt patterns,\nBrain-suggested patches) return suggestions. Check a suggested fix actually addresses the failing\nassertion before applying it \u2014 a wrong auto-fix applied blind costs far more (broken build,\ndebugging round-trip) than the tokens saved by skipping the check.\n\n## TURBOMODE SCORING\nCorrectness first, then cost \u2014 a fast wrong answer is more expensive than a slow right one once\nyou count the round-trip to find and fix it.\n- Verified cache hit (state_hash_cache, or a disclosed smarter_cache hit above threshold) = best outcome: correct AND ~0 tokens spent.\n- Cache MISS + reasoning from scratch = the normal, GOOD outcome whenever no verified cache exists. Reasoning is not a failure mode \u2014 it's what you do when you don't already have a trustworthy answer.\n- Reading full files without checking get_ast_hologram first = wasteful, avoid it when a cheaper lookup would've told you what you needed.\n- Any answer delivered without required disclosure (rule 6's exception), or a cached/auto-fixed result used without verification = FAIL, regardless of tokens saved \u2014 it can cost the user far more than tokens once it's wrong.\n\nRemember: the goal is spending fewer tokens on the SAME quality of answer, not a lower-quality answer for fewer tokens.";
4
3
  export declare function setupPromptsHandlers(server: Server): void;
5
4
  //# sourceMappingURL=prompts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/mcp/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAGnE,eAAO,MAAM,mBAAmB,0uGAkD4B,CAAC;AAE7D,eAAO,MAAM,sBAAsB,27QA+GqF,CAAC;AAEzH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAiDzD"}
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/mcp/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAGnE,eAAO,MAAM,sBAAsB,23NAsFqF,CAAC;AAEzH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA8BzD"}
@@ -1,72 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LEMMA_TURBOMODE_PROMPT = exports.LEMMA_SYSTEM_PROMPT = void 0;
3
+ exports.LEMMA_TURBOMODE_PROMPT = void 0;
4
4
  exports.setupPromptsHandlers = setupPromptsHandlers;
5
5
  const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
6
- exports.LEMMA_SYSTEM_PROMPT = `You are connected to Lemma — an intelligent local-first AI gateway.
7
- Lemma gives you a set of tools you MUST use proactively and automatically. NEVER ask the user
8
- to call a tool manually. YOU invoke the tools. The user should experience zero friction.
9
-
10
- ## MANDATORY AUTOMATIC BEHAVIORS
11
-
12
- ### 1. Before reading ANY file → call get_ast_hologram first
13
- When you need to understand the structure of a codebase or navigate files, ALWAYS call
14
- \`get_ast_hologram\` first (with the relevant dirPath, e.g. "src"). Use the returned symbol
15
- map to pinpoint exactly which files to read. NEVER blindly read every file one by one.
16
-
17
- ### 2. Before answering ANY technical question → call query_hybrid_consensus first
18
- BEFORE making any reasoning or cloud LLM call, ALWAYS call \`query_hybrid_consensus\` with
19
- the user's question. If similarity ≥ 80%, return the cached answer immediately — no cloud
20
- call needed. Only proceed with your own reasoning if the Brain returns a MISS.
21
-
22
- ### 3. When you start working on ANY file → call get_telepathic_hints automatically
23
- Whenever the user mentions a file or you are about to read/edit a file, IMMEDIATELY call
24
- \`get_telepathic_hints\` with that file's path. Surface the results to the user as relevant
25
- context BEFORE doing any work. Do not ask permission — just do it.
26
-
27
- ### 4. Before applying ANY code patch → call validate_patch_sandbox first
28
- NEVER call \`write_workspace_file\` or \`apply_workspace_patch\` without FIRST calling
29
- \`validate_patch_sandbox\` with the proposed content. Only proceed with the write if the
30
- verdict is "✅ SAFE TO APPLY". If it fails, fix the issues and re-validate.
31
-
32
- ### 5. After solving any technical problem → call store_memory automatically
33
- After resolving a bug, implementing a feature, or answering a significant technical question,
34
- ALWAYS call \`store_memory\` to persist the solution. Use a descriptive query key so it can
35
- be retrieved in future sessions across ALL projects.
36
-
37
- ### 6. Workspace navigation → always use Lemma tools, NEVER guess file contents
38
- - Use \`list_workspace_dir\` to navigate structure
39
- - Use \`read_workspace_file\` (auto-compresses + scrubs secrets) instead of asking the user
40
- - Use \`search_workspace\` for text search across files
41
- - Use \`run_workspace_command\` for builds, tests, linters — long output comes back distilled
42
- (failing tests / diagnostics with locations). It is a real view of the run, not a guess, but it
43
- is not the whole output: call \`output_region\` with the reported handle whenever you need the
44
- rest, and never tell the user a run was clean based on a distilled view you didn't read.
45
-
46
- ### 7. Privacy is automatic
47
- \`read_workspace_file\` and \`search_workspace\` automatically scrub API keys and PII.
48
- You never need to manually sanitize file content.
49
-
50
- ## LEMMA RESOURCES (auto-subscribe when available)
51
- - \`lemma://runtime/context\` — live crash logs. Read this FIRST when the user reports a bug.
52
- - \`lemma://multiverse/timeline\` — AST history. Use when the user says "it was working before".
53
- - \`lemma://project/onboarding\` — architecture map. Read at session start in new repos.
54
- - \`lemma://stats/usage\` — token savings report.
55
-
56
- Remember: the user hired YOU to be autonomous. Act like it.`;
57
- exports.LEMMA_TURBOMODE_PROMPT = `You are operating in LEMMA TURBOMODE. Your goal: multiply the user's LLM membership 50x by spending 50x fewer tokens per task. Every token counts. Every cache hit is a membership extension.
6
+ exports.LEMMA_TURBOMODE_PROMPT = `You are operating in LEMMA TURBOMODE. Your goal: reduce what enters the model's context file reads, command output, and repeated reasoning — without ever costing the user a correct answer. Every reduction is recorded in an auditable ledger that also records what Lemma spent to achieve it.
7
+
8
+ There is no fixed multiplier to hit. Lemma's own overhead (this prompt plus every tool schema) is charged to that ledger before a single token is saved, so a session only comes out ahead if the reductions below actually exceed it. Optimize for real net savings, not for a number.
58
9
 
59
10
  ## MANDATORY TURBOMODE RULES — VIOLATE THESE AND YOU WASTE THE USER'S MONEY
60
11
 
61
- ### 0. Before ANYTHING check token_budget
62
- Every 5 turns, call \`token_budget\` to check your consumption. If multiplier drops below 10x, optimize harder.
12
+ ### 0. Every tool call costs tokens too
13
+ A tool call and its result both stay in the transcript and are re-sent on every later turn. Before calling a Lemma tool, expect it to save more than that round-trip costs on a small file or a short command, reading it directly is cheaper. Never call a reporting tool on a schedule: a report is not work. Call one only when the user asks how the session is going.
14
+
15
+ ### 0b. The tool list you see is not everything Lemma has
16
+ Schemas for situational tools are withheld from this session to keep the per-turn cost down. When
17
+ no advertised tool fits, call \`lemma_toolbox\` (action="list" with a query) before concluding
18
+ Lemma can't do it, then action="call" to run what you find. Never tell the user a capability is
19
+ missing without checking the toolbox first.
63
20
 
64
- ### 1. turbosqueeze is for YOUR internal context only — never for code shown to the user
65
- Use \`turbosqueeze\` to compress code before feeding it into your own reasoning/context window.
66
- NEVER apply it to a code block you are about to show or hand to the user — they get the real,
67
- complete file (comments, imports, formatting intact) so it stays copy-pasteable and correct.
68
- If a squeezed version was used for reasoning, re-fetch or reconstruct the untouched original
69
- before presenting it.
21
+ ### 1. Compression is for YOUR context only — never for code shown to the user
22
+ Lemma's compressors (turbosqueeze, wormhole_squeeze, squeeze_prompt via the toolbox) exist to
23
+ shrink code before it enters your own reasoning window. NEVER hand a compressed version to the
24
+ user: they get the real, complete file (comments, imports, formatting intact) so it stays
25
+ copy-pasteable and correct. If you reasoned over a squeezed version, re-fetch the untouched
26
+ original before presenting it.
70
27
 
71
28
  ### 2. smarter_cache (threshold 0.8) is a hint, not an answer
72
29
  Call \`smarter_cache\` with the user's question before reasoning from scratch — a hit can save
@@ -78,91 +35,58 @@ time. But NEVER return a cache hit verbatim as if freshly reasoned:
78
35
  it against current file/tool state before using it — cached answers can be stale.
79
36
  - On a MISS, or on any doubt, reason normally.
80
37
 
81
- ### 3. Call compress_context only when actually approaching the context limit
82
- Don't compress on a fixed schedule ("every new turn") — most hosts already manage context
83
- window pressure themselves, so an unconditional call wastes a round-trip most of the time.
84
- Call \`compress_context\` when you have concrete signal you're actually close to the limit.
85
- When you do compress, tell the user it happened and keep enough of the summary that a decision
86
- or constraint from earlier in the conversation isn't silently lost — "2 sentences" is a floor
87
- for genuinely small talk, not a fixed size for everything that came before.
88
-
89
- ### 4. Before reading files → call get_ast_hologram
38
+ ### 3. Before reading files call get_ast_hologram
90
39
  NEVER read files blindly. Always call \`get_ast_hologram\` first to locate the exact symbols you need. Then read only those specific files. Each unnecessary file read wastes 1000+ tokens.
91
40
 
92
- ### 4b. Before re-reading a file → call file_fingerprint
93
- Before calling read_workspace_file, check if the file hash has changed since last read. If status is 'unchanged', skip the read entirely. Only read when hash differs.
94
-
95
- ### 4c. Before deep file analysis → use import_tree_context + type_coverage_report
96
- Instead of reading full files to understand architecture, call import_tree_context (import graph) and type_coverage_report (type safety). Both are zero-token tools.
97
-
98
- ### 4d. Before investigating code ownership → call git_blame_heat
99
- For questions about who wrote code, why it's risky, or change history, call git_blame_heat instead of reasoning. Zero LLM cost.
100
-
101
- ### 5. After every VERIFIED solution → call store_memory automatically
41
+ ### 4. After every VERIFIED solution → call store_memory automatically
102
42
  Store via \`store_memory\` once you've confirmed the fix/answer actually worked (tests pass,
103
43
  the user confirmed, the build succeeded) — not the first thing you tried. A wrong answer stored
104
44
  here becomes a "cache hit" served to a future session, and unwinding that costs far more than
105
45
  the tokens it saved. Verified answers are still free to cache aggressively.
106
46
 
107
- ### 6. Answer concisely — no fluff, but never at the cost of a required disclosure
47
+ ### 5. Answer concisely — no fluff, but never at the cost of a required disclosure
108
48
  - No "Sure, I can help you with that" — just do it.
109
49
  - No unnecessary explanation of what you did — unless asked.
110
- - No markdown formatting in internal responses.
111
50
  - No repeating the user's question back to them.
112
51
  - Exception: disclosures required elsewhere in these rules (cache-hit source per rule 2,
113
- a context-compression event per rule 3, a risky/irreversible action) are never fluff — say
114
- them in one short line. Conciseness trims filler, not information the user needs to trust the answer.
115
-
116
- ### 7. Use batch_tool_calls aggressively
117
- Any set of independent operations (read 3 files, search 2 patterns, check cache for 2 questions) — use \`batch_tool_calls\` to run them in parallel. Single round-trip > multiple sequential calls.
52
+ a risky/irreversible action) are never fluff — say them in one short line. Conciseness trims
53
+ filler, not information the user needs to trust the answer.
118
54
 
119
- ### 8. Before multi-file operationsuse auto_context_bundle or bulk_file_digest
120
- Instead of reading files one by one, use \`auto_context_bundle\` (one file, everything included) or \`bulk_file_digest\` (multiple files, one call). Both save 75-80% round-trips.
121
-
122
- ### 9. Before outputting long responses → check repeat_guard
123
- Call \`repeat_guard\` with your draft output to avoid repeating yourself. Saves 10-15% of output tokens.
124
-
125
- ### 9b. For questions tied to specific files → prefer state_hash_cache over smarter_cache
55
+ ### 6. For questions tied to specific files prefer state_hash_cache over smarter_cache
126
56
  If the question depends on the current content of specific files (not just "similar wording"),
127
57
  call \`state_hash_cache\` (action="lookup") instead of \`smarter_cache\`. It only returns a hit
128
58
  when the referenced files' content hashes are unchanged — a guaranteed-valid answer, not a
129
59
  similarity guess. After answering, call it again with action="store" to cache it. Use
130
60
  \`smarter_cache\` only for file-independent questions (explanations, general how-tos).
131
61
 
132
- ### 9c. Route model choice through get_routing_advice, don't assume the biggest model
62
+ ### 7. Route model choice through get_routing_advice, don't assume the biggest model
133
63
  Before a mechanical/low-complexity task (formatting, boilerplate, simple lookups), call
134
64
  \`get_routing_advice\` with the task prompt. If it recommends a cheaper model and the current
135
65
  provider supports switching, say so instead of silently burning a large-model budget on trivial work.
136
66
 
137
- ### 9d. Default all file edits to symbol-level patches via surgical_ast_insert
67
+ ### 8. Default all file edits to symbol-level patches via surgical_ast_insert
138
68
  When adding a method/function/property to an existing class, interface, or file, prefer
139
69
  \`surgical_ast_insert\` over regenerating and rewriting the whole file. Only fall back to a full
140
70
  \`write_workspace_file\` when the change isn't a clean insertion (renames, structural rewrites,
141
71
  new files).
142
72
 
143
- ### 9e. When asked "how much did we actually save" → call token_receipt, don't estimate
73
+ ### 9. When asked "how much did we actually save" → call token_receipt, don't estimate
144
74
  \`token_receipt\` returns a real, auditable log of what happened this session (exact cache hits,
145
75
  semantic cache hits, file reads, fresh reasoning) — not a projected percentage. Use it instead of
146
76
  inventing a savings number, and show the byType breakdown so the user can verify it themselves.
147
77
 
148
- ### 10. When resuming work load conversation_checkpoint
149
- At session start or when user says "continuemos", call \`conversation_checkpoint\` with action "load" to restore context without re-explaining.
150
-
151
- ### 11. When tests fail use test_autofix_interceptor, but verify the suggested fix before applying it
152
- Call \`test_autofix_interceptor\` to get failures + Brain-suggested fixes in one call — that part
153
- saves real tokens. But treat the suggested fix as a candidate, not a verdict: check it actually
154
- addresses the failing assertion before applying it. Applying a wrong auto-fix blind costs far
155
- more (a broken build, a confused user, a debugging round-trip) than the tokens saved skipping the check.
156
-
157
- ### 12. For common prompt patterns → use prompt_pattern_cache
158
- Before generating repetitive prompts ("explain this", "review this", "write tests"), check \`prompt_pattern_cache\` action "find" for cached templates.
78
+ ### 10. Anything the toolbox hands you is still a candidate, not a verdict
79
+ Tools reached via \`lemma_toolbox\` (auto-fixes for failing tests, cached prompt patterns,
80
+ Brain-suggested patches) return suggestions. Check a suggested fix actually addresses the failing
81
+ assertion before applying it a wrong auto-fix applied blind costs far more (broken build,
82
+ debugging round-trip) than the tokens saved by skipping the check.
159
83
 
160
84
  ## TURBOMODE SCORING
161
85
  Correctness first, then cost — a fast wrong answer is more expensive than a slow right one once
162
86
  you count the round-trip to find and fix it.
163
87
  - Verified cache hit (state_hash_cache, or a disclosed smarter_cache hit above threshold) = best outcome: correct AND ~0 tokens spent.
164
88
  - Cache MISS + reasoning from scratch = the normal, GOOD outcome whenever no verified cache exists. Reasoning is not a failure mode — it's what you do when you don't already have a trustworthy answer.
165
- - Reading full files without checking get_ast_hologram/file_fingerprint first = wasteful, avoid it when a cheaper lookup would've told you what you needed.
89
+ - Reading full files without checking get_ast_hologram first = wasteful, avoid it when a cheaper lookup would've told you what you needed.
166
90
  - Any answer delivered without required disclosure (rule 6's exception), or a cached/auto-fixed result used without verification = FAIL, regardless of tokens saved — it can cost the user far more than tokens once it's wrong.
167
91
 
168
92
  Remember: the goal is spending fewer tokens on the SAME quality of answer, not a lower-quality answer for fewer tokens.`;
@@ -170,34 +94,15 @@ function setupPromptsHandlers(server) {
170
94
  server.setRequestHandler(types_js_1.ListPromptsRequestSchema, async () => {
171
95
  return {
172
96
  prompts: [
173
- {
174
- name: "lemma-autopilot",
175
- description: "Lemma Autopilot: mandatory behavioral instructions for the AI assistant. Load this prompt to make all Lemma tools fire automatically with zero user friction.",
176
- arguments: [],
177
- },
178
97
  {
179
98
  name: "lemma-turbomode",
180
- description: "⚠️ LEMMA TURBOMODE: Extreme token optimization. Load this prompt to multiply your LLM membership 50x by aggressively compressing prompts, caching everything, and minimizing every token spent. Use for long/deadline-driven projects.",
99
+ description: "LEMMA TURBOMODE: reduce context spend on file reads, command output, and repeated reasoning. Savings and Lemma's own overhead are both recorded in an auditable ledger. Use for long sessions on large repos.",
181
100
  arguments: [],
182
101
  },
183
102
  ],
184
103
  };
185
104
  });
186
105
  server.setRequestHandler(types_js_1.GetPromptRequestSchema, async (request) => {
187
- if (request.params.name === "lemma-autopilot") {
188
- return {
189
- description: "Lemma Autopilot System Instructions",
190
- messages: [
191
- {
192
- role: "user",
193
- content: {
194
- type: "text",
195
- text: exports.LEMMA_SYSTEM_PROMPT,
196
- },
197
- },
198
- ],
199
- };
200
- }
201
106
  if (request.params.name === "lemma-turbomode") {
202
107
  return {
203
108
  description: "Lemma TurboMode — Extreme Token Optimization",
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/mcp/prompts.ts"],"names":[],"mappings":";;;AAwKA,oDAiDC;AAxND,iEAAsG;AAEzF,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4DAkDyB,CAAC;AAEhD,QAAA,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wHA+GkF,CAAC;AAEzH,SAAgB,oBAAoB,CAAC,MAAc;IACjD,MAAM,CAAC,iBAAiB,CAAC,mCAAwB,EAAE,KAAK,IAAI,EAAE;QAC5D,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,iBAAiB;oBACvB,WAAW,EAAE,+JAA+J;oBAC5K,SAAS,EAAE,EAAE;iBACd;gBACD;oBACE,IAAI,EAAE,iBAAiB;oBACvB,WAAW,EAAE,wOAAwO;oBACrP,SAAS,EAAE,EAAE;iBACd;aACF;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,iBAAiB,CAAC,iCAAsB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QACjE,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;YAC9C,OAAO;gBACL,WAAW,EAAE,qCAAqC;gBAClD,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,MAAM;wBACZ,OAAO,EAAE;4BACP,IAAI,E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BACZ,OAAO,EAAE;4BACP,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,8BAAsB;yBAC7B;qBACF;iBACF;aACF,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/mcp/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAQnE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA2D3D"}
1
+ {"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/mcp/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AASnE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA2D3D"}
@@ -10,6 +10,7 @@ const path_1 = __importDefault(require("path"));
10
10
  const os_1 = __importDefault(require("os"));
11
11
  const axios_1 = __importDefault(require("axios"));
12
12
  const utils_1 = require("./utils");
13
+ const TheBrainV2_1 = require("../subconscious/TheBrainV2");
13
14
  function setupResourcesHandlers(server) {
14
15
  server.setRequestHandler(types_js_1.ListResourcesRequestSchema, async () => {
15
16
  return {
@@ -134,10 +135,9 @@ async function handleProjectContext(uri) {
134
135
  }
135
136
  catch { }
136
137
  try {
137
- const memoryDir = path_1.default.join(projectPath, '.lemma', 'memory');
138
- if (fs_1.default.existsSync(memoryDir)) {
139
- memoryCount = fs_1.default.readdirSync(memoryDir).length;
140
- }
138
+ // Counted files in <project>/.lemma/memory, which nothing writes — so this resource
139
+ // always advertised 0 memories regardless of what the Brain actually held.
140
+ memoryCount = (0, TheBrainV2_1.getBrain)().getEntriesForProject((0, TheBrainV2_1.deriveProjectId)(projectPath)).length;
141
141
  }
142
142
  catch { }
143
143
  const markdown = [
@@ -1 +1 @@
1
- {"version":3,"file":"resources.js","sourceRoot":"","sources":["../../../src/mcp/resources.ts"],"names":[],"mappings":";;;;;AAQA,wDA2DC;AAlED,iEAA2G;AAC3G,4CAAoB;AACpB,gDAAwB;AACxB,4CAAoB;AACpB,kDAA0B;AAC1B,mCAAiD;AAEjD,SAAgB,sBAAsB,CAAC,MAAc;IACnD,MAAM,CAAC,iBAAiB,CAAC,qCAA0B,EAAE,KAAK,IAAI,EAAE;QAC9D,OAAO;YACL,SAAS,EAAE;gBACT;oBACE,GAAG,EAAE,yBAAyB;oBAC9B,IAAI,EAAE,oBAAoB;oBAC1B,WAAW,EAAE,kFAAkF;oBAC/F,QAAQ,EAAE,eAAe;iBAC1B;gBACD;oBACE,GAAG,EAAE,qBAAqB;oBAC1B,IAAI,EAAE,0BAA0B;oBAChC,WAAW,EAAE,qEAAqE;oBAClF,QAAQ,EAAE,kBAAkB;iBAC7B;gBACD;oBACE,GAAG,EAAE,yBAAyB;oBAC9B,IAAI,EAAE,uBAAuB;oBAC7B,WAAW,EAAE,2FAA2F;oBACxG,QAAQ,EAAE,eAAe;iBAC1B;gBACD;oBACE,GAAG,EAAE,4BAA4B;oBACjC,IAAI,EAAE,uCAAuC;oBAC7C,WAAW,EAAE,oHAAoH;oBACjI,QAAQ,EAAE,eAAe;iBAC1B;gBACD;oBACE,GAAG,EAAE,6BAA6B;oBAClC,IAAI,EAAE,wCAAwC;oBAC9C,WAAW,EAAE,4HAA4H;oBACzI,QAAQ,EAAE,eAAe;iBAC1B;aACF;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,iBAAiB,CAAC,oCAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QACpE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;QAE/B,IAAI,GAAG,KAAK,yBAAyB,EAAE,CAAC;YACtC,OAAO,oBAAoB,CAAC,GAAG,C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,QAAQ,IAAI,oDAAoD,IAAI,CAAC,IAAI,gBAAgB,CAAC;oBAC5F,CAAC;gBACH,CAAC,CAAC,CAAC;gBAEH,QAAQ,IAAI,WAAW,CAAC;YAC1B,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO;YACL,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;SAC/D,CAAC;IACJ,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,IAAA,gBAAQ,EAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;QACvC,OAAO;YACL,QAAQ,EAAE;gBACR;oBACE,GAAG;oBACH,QAAQ,EAAE,eAAe;oBACzB,IAAI,EAAE,0DAA0D,KAAK,CAAC,OAAO,2BAA2B;iBACzG;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Tool surface control.
3
+ *
4
+ * Every tool schema Lemma advertises is injected into the model's system prompt and
5
+ * re-sent on every single request of the session. At 76 tools that is ~11.4k tokens
6
+ * per turn, charged before Lemma has saved anything — and it is charged even for tools
7
+ * the project can never use (Terraform schemas in a repo with no `.tf` files).
8
+ *
9
+ * So the advertised list is narrowed to what this project can actually use. Nothing is
10
+ * removed: every handler stays registered, and `lemma_toolbox` exposes the rest by name
11
+ * on demand — a one-time ~1.2k token catalog instead of ~8k every turn.
12
+ *
13
+ * The list is resolved once at startup and never mutated mid-session. It lives in the
14
+ * cached prefix of every request; changing it (e.g. lazily "unlocking" tools via
15
+ * notifications/tools/list_changed) invalidates that cache and re-charges the whole
16
+ * context at full price, which costs far more than the schemas it would defer.
17
+ */
18
+ export type ToolProfile = "auto" | "core" | "full";
19
+ /**
20
+ * Tools that pay for their schema in an ordinary coding session: reading, searching,
21
+ * patching, AST context, exact-hash caching, and the ledger. Everything else is
22
+ * situational and reachable through `lemma_toolbox`.
23
+ */
24
+ export declare const CORE_TOOL_NAMES: string[];
25
+ /**
26
+ * Code review is a mode the user enters, not a property of the repo — and it cannot be
27
+ * detected at startup. Gating these on `.git` advertised them in every git repo, which is
28
+ * every repo: ~670 tokens per turn for tools most sessions never touch. They stay
29
+ * registered and `lemma_toolbox` finds them by query the moment a review actually starts.
30
+ */
31
+ export declare const REVIEW_TOOL_NAMES: string[];
32
+ export interface ResolvedToolSurface<T extends {
33
+ name: string;
34
+ }> {
35
+ profile: ToolProfile;
36
+ /** Schemas advertised in tools/list. */
37
+ advertised: T[];
38
+ /** Registered and callable, but not advertised — reachable through `lemma_toolbox`. */
39
+ hidden: T[];
40
+ /** Situational groups that matched this project. */
41
+ activeGroups: string[];
42
+ }
43
+ export declare function resolveToolSurface<T extends {
44
+ name: string;
45
+ description?: string;
46
+ }>(allDefinitions: T[], cwd?: string): ResolvedToolSurface<T>;
47
+ /**
48
+ * One-line-per-tool catalog of everything not advertised, so the model can find and
49
+ * invoke a hidden tool without its schema having been resident all session.
50
+ */
51
+ export declare function buildToolboxCatalog(hidden: Array<{
52
+ name: string;
53
+ description?: string;
54
+ }>, query?: string): string;
55
+ //# sourceMappingURL=tool-profiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-profiles.d.ts","sourceRoot":"","sources":["../../../src/mcp/tool-profiles.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,EA0BnC,CAAC;AA4DF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,UAAoE,CAAC;AAkBnG,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE;IAC7D,OAAO,EAAE,WAAW,CAAC;IACrB,wCAAwC;IACxC,UAAU,EAAE,CAAC,EAAE,CAAC;IAChB,uFAAuF;IACvF,MAAM,EAAE,CAAC,EAAE,CAAC;IACZ,oDAAoD;IACpD,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,wBAAgB,kBAAkB,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,EACjF,cAAc,EAAE,CAAC,EAAE,EACnB,GAAG,GAAE,MAAsB,GAC1B,mBAAmB,CAAC,CAAC,CAAC,CAmCxB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,EACrD,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,CAuDR"}