Skip to content

Commit c583da0

Browse files
cliffhallclaude
andcommitted
docs(sequentialthinking): state the thought box's limits exactly
The row cap counts thought-text rows only (a long branchId's header rows are not capped), so there is no absolute size guarantee; and the tool result never carries the thought text, which the server keeps whole in its history. README, changeset and the MAX_BOX_ROWS comment now say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
1 parent 43d93af commit c583da0

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎.changeset/sequentialthinking-5433-bounded-thought-box.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"@modelcontextprotocol/server-sequential-thinking": patch
33
---
44

5-
Bound the thought box logged to stderr. Since the multi-line box, every row was padded to the thought's longest line, so a thought with one long line and many short ones logged their product: a 60 KB thought wrote 400 million characters and could exhaust the server's memory. The box is now at most 100 characters wide (longer lines wrap) and at most 1000 rows tall (it then says how many lines it left out), about 107 KB at most. The stored thought and the tool result are unchanged.
5+
Bound the thought box logged to stderr. Since the multi-line box, every row was padded to the thought's longest line, so a thought with one long line and many short ones logged their product: a 60 KB thought wrote 400 million characters and could exhaust the server's memory. The box is now at most 100 characters wide (longer lines, and a long branch ID in the header, wrap) and draws at most 1000 rows of thought text (it then says how many lines it left out), so the log no longer grows with the thought's line count times its longest line. The thought kept in the server's history and the tool result are unchanged.

‎src/sequentialthinking/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ On Windows, use `cmd /c` to launch `npx`:
134134

135135
To disable logging of thought information set env var: `DISABLE_THOUGHT_LOGGING` to `true`.
136136

137-
Each thought is logged to stderr as a box, one row per line of the thought. The box is at most 100 characters wide, with longer lines wrapped, and draws at most 1000 rows; past that it ends with a row saying how many lines it left out. Only the log is shortened: the thought itself is stored and returned whole.
137+
Each thought is logged to stderr as a box, one row per line of the thought. The box is at most 100 characters wide, with longer lines (and a long branch ID in the header) wrapped, and draws at most 1000 rows of thought text; past that it ends with a row saying how many lines it left out. Only the log is shortened: the server keeps the whole thought in its history, and the tool result is unchanged.
138138

139139
To bound memory use, the server retains at most `MAX_THOUGHT_HISTORY` thoughts per connection (a positive integer; default `1000`). Past the cap the oldest thought is dropped, from its branch too, so `thoughtHistoryLength` in the result stops at the cap and a branch whose thoughts have all been dropped is no longer listed in `branches`.
140140

‎src/sequentialthinking/lib.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ export const MAX_BOX_TEXT_WIDTH = 100;
2525
* The most rows of thought text a box draws (#5433). Each row is padded to
2626
* the box's width, so a thought of many short lines would still log about a
2727
* hundred times its own size; past this many rows the box ends with one row
28-
* saying how many lines it left out. Only stderr is cut: the stored thought
29-
* and the tool result are whole.
28+
* saying how many lines it left out. Header rows (a long branchId) are not
29+
* counted. Only stderr is cut: the thought kept in thoughtHistory is whole,
30+
* and the tool result, which carries no thought text, is unchanged.
3031
*/
3132
export const MAX_BOX_ROWS = 1000;
3233

0 commit comments

Comments
 (0)