Skip to content

Show what tools and memory take of the context; warn when Ollama's window is too small - #422

Merged
currentbits merged 2 commits into
masterfrom
coder/show-how-much-of-the-context-tools-and-m-63c372
Nov 6, 2026
Merged

currentbits merged 2 commits into
masterfrom
coder/show-how-much-of-the-context-tools-and-m-63c372

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Closes #211.

What you see

  • mimir doctor and the bot page (under What it can do): "tools offered: 24, about 3.7k tokens; standing memory about 0.4k tokens".
  • A warning above ~8k tool tokens, naming the three biggest tool servers.
  • For an Ollama bot: a warning when its window is smaller than tools + memory + ~4k for instructions and the conversation, e.g. "Ollama is set to 4096 tokens for qwen3; Mimir's tools and memory take about 5.1k of that… Start Ollama with OLLAMA_CONTEXT_LENGTH=16384".

How

  • The window comes from /api/ps (the size the model is loaded with), else the model's own num_ctx (/api/show). When neither says, there's no warning: Ollama picks its default from GPU memory (4k / 32k / 256k), so a guess would nag people with big GPUs.
  • routine_create's description: 2,851 → 1,667 characters. The rare options (watch, keep, for, until, followup) are now explained in one line each.
  • New test: the built-in tool definitions stay under 28,000 characters (26,433 now; master's new Mac, command and file_export tools took it past the 24,000 the issue suggested).

Not done

  • Per-request num_ctx through Ollama's own /api/chat. Only if the warning isn't enough.
  • Not tried against a live Ollama; the /api/ps field name (context_length) is from Ollama's docs.

Checks: cargo test -p mimir-core --lib (326 passed), clippy clean, tsc clean.

🤖 Generated with Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T16:36:54.182865Z fad4042 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fad4042135

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/mimir-core/src/doctor.rs Resolved
Solenta and others added 2 commits November 6, 2026 18:50
…ndow is too small (#211)

- mimir doctor and the bot page: tools offered, about how many tokens, and standing memory.
  Warn above ~8k tool tokens, naming the biggest tool servers.
- Ollama bots: read the window from /api/ps (loaded) or the model's num_ctx, and warn
  when tools + memory leave too little for the conversation.
- routine_create's description: 2,851 -> 1,667 characters.
- A test keeps the built-in tools' definitions under 28,000 characters (26,433 now).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… gets

Only this bot's memories (not ones kept for another bot), plus the household's when the chat is in one, as lib.rs builds the prompt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@currentbits
currentbits force-pushed the coder/show-how-much-of-the-context-tools-and-m-63c372 branch from 2d19bbc to 05e0aff Compare November 6, 2026 17:51
@currentbits
currentbits merged commit 9ec2084 into master Nov 6, 2026
8 of 9 checks passed
@currentbits
currentbits deleted the coder/show-how-much-of-the-context-tools-and-m-63c372 branch November 6, 2026 19:25
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.

Show how much of the context tools and memory take, and warn when a local model's window is too small

1 participant