Skip to content

Force a news search for trading-session questions - #36

Merged
robdevops merged 11 commits into
mainfrom
claude/compassionate-heisenberg-pz23nq
Oct 15, 2026
Merged

robdevops merged 11 commits into
mainfrom
claude/compassionate-heisenberg-pz23nq

Conversation

@robdevops

Copy link
Copy Markdown
Owner

Why

A reply to "at close" opened with "(no tool calls needed)". The string is model output, not bot code. "At close" matched no routing keyword, so the message got the no-tools prompt and the model answered from the earlier movers list in the transcript, not live data.

What

  • lib/llm/gate.py: new SESSION_WORDS (at/the/into/after close/open, pre-market, after hours, closing, opening) and is_session_question(). A match counts as a live question, so search is offered instead of the no-tools path.
  • lib/prompts.py: chat_prompt takes a session flag that adds "Search for current news before answering, and say why each stock moved. Don't reuse news or reasons from earlier messages in the transcript."
  • lib/telegram/handlers.py: session questions pass must_search, so the first round must be a search and can't be answered from memory. Search only, not Yahoo quotes.
  • Tests for the routing, the session prompt and the forced search.

Not changed

A "(no tool calls needed)"-style remark is not stripped from replies, so it stays visible when it happens.

Testing

make check on Python 3.13.5: ruff clean, 294 tests pass. Not run against a live model.

🤖 Generated with Claude Code

https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw


Generated by Claude Code

claude added 10 commits October 13, 2026 01:42
…evops fork

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw
…eplies

"at close" matched no gate keyword, so the model got the no-tools prompt and
answered from the transcript, opening with "(no tool calls needed)".

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw
@robdevops
robdevops enabled auto-merge (squash) October 15, 2026 22:33
…heisenberg-pz23nq

# Conflicts:
#	lib/telegram/handlers.py
@robdevops
robdevops merged commit ef7e81a into main Oct 15, 2026
1 check passed
robdevops added a commit that referenced this pull request Oct 18, 2026
* SQLite: synchronous=NORMAL under WAL; period_cache WITHOUT ROWID

New databases get the compact table; tools/period_cache_without_rowid.py converts an existing one.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw

* /holdingnews says when the provider is busy; Sharesight MCP from robdevops fork

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw

* Route market-session questions to tools and strip tool remarks from replies

"at close" matched no gate keyword, so the model got the no-tools prompt and
answered from the transcript, opening with "(no tool calls needed)".

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw

* Make trading-session questions fetch current prices and news

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw

* Force a search for trading-session questions

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw

* Keep market data tools beside the forced search for session questions

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw

* Revert "Keep market data tools beside the forced search for session questions"

This reverts commit 7b22d53.

* Session questions: ask for current news only, not prices

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw

* Don't strip tool remarks from replies, so they stay visible

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw

* Rename session prompt test

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw

* Don't tell the model to avoid remarks about tools

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw

* xAI: keep only the last text part of a message, and log multi-part messages

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw

* Revert session changes (built on stale feedback)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw

* xAI: log a message that has several text parts

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014k4kywyN5dAo39izUPvxbw

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants