laravel/boost

Optimize tokens

Closed this issue · 6 comments

There should be the possibility to optimize tokens and therefore spend less, perhaps with a custom configuration. That would be fantastic.

Could you please explain this further?

If you want to control how much information is sent to the agents, feel free to modify the generated guidelines file to suit your needs.

Well currently it is just dumping out stuff without any filtering, and its too much even for claude max subscription.

⏺ laravel-boost - read-log-entries (MCP)(entries: 20)
  ⎿  Error: MCP tool "read-log-entries" response (147157 tokens) exceeds maximum allowed tokens (25000). Please use pagination, filtering, or
     limit parameters to reduce the response size.

⏺ laravel-boost - read-log-entries (MCP)(entries: 5)
  ⎿  Error: MCP tool "read-log-entries" response (52882 tokens) exceeds maximum allowed tokens (25000). Please use pagination, filtering, or limit
      parameters to reduce the response size.
  ⎿  Error: MCP tool "last-error" response (27740 tokens) exceeds maximum allowed tokens (25000). Please use pagination, filtering, or limit
     parameters to reduce the response size.

MCP which is designed to work with LLM should respect the LLM limits and not just dump out logs as-is.

+1 👍 Boost is a great start but it definitely needs to be more customisable.

My CLAUDE.md file (pre-Boost) worked great, about 120 lines of Markdown that fit nicely into context and kept Claude focussing on the right things. After installing Boost the file is now almost 900 lines long, and Claude noticeably pays less attention to my project-specific requirements.

I appreciate I can just edit the compiled guidelines, but this will quickly become a maintenance chore every time a package refines its prompts. More control over what gets included, or which presets to include, would be very welcome.

There are some guidelines I simply don't want included. Laravel Pint runs automatically with hooks, there's no need to tell AI about it. Other guidelines dilute attention away from what matters, like the New directives in Livewire 3 which Claude seems to enjoy inserting into completely irrelevant places.

If I want to use an agent specifically to work on frontend code, 90% of the guidelines are completely irrelevant. Perhaps we could have different instruction presets we could switch between?

Actually, Laravel Pint has no reason to be managed by AI: if we look at this aspect from a token economy perspective

Currently, it seems the only way to reduce tokens is to use /compact or /reset for a new chat.

Most of the issues will be solved by https://github.com/laravel/boost?tab=readme-ov-file#adding-custom-ai-guidelines adding the custom guidelines and override the ones which you don't need in v1.1.4.

Image

As you can see, context is mostly preserved, and you can also disable unused tools (like in this example) to save some tokens. Apart from that, it only takes about ~5% of the context.

I agree there’s room for improvement in how log entries are read, but that largely depends on the prompt and the way the application is designed. Some improvements are possible, but they seem to be outside the scope of this issue, so I’ll close this for now.

Thanks!