#63

Config-driven `include_tool_calls`: surface the copy/TUI rendering knob in `config.json`

Opennkumar-awopened 7mo ago

Follow-up from the threadhop copy / /threadhop:copy work (2026-04-22). That change introduces an include_tool_calls: bool parameter on indexer._extract_assistant_blocks (paired with include_tool_results: bool on _extract_user_text). The copy command passes False; the TUI and every other caller keeps the current True behavior via the parameter's default. That's the correct v1 — deterministic, unambiguous, no user-facing flag surface — but it hardcodes a rendering preference that users will reasonably want to toggle.

This issue tracks promoting that knob into ~/.config/threadhop/config.json so the same switch drives the TUI's transcript view and the copy command, with per-caller defaults preserved and user override supported.

1. What ships in the copy change (baseline)

  • include_tool_calls: bool = True on indexer._extract_assistant_blocks — True keeps current abbreviation behavior (e.g. [Read(file.py)]), False drops tool_use blocks entirely.
  • include_tool_results: bool = True on indexer._extract_user_text — same shape for toolUseResult user-role messages.
  • Caller hardcoding: the TUI (TranscriptView._parse_messages and the transcript-build path) passes True implicitly via the default; copy.py passes False explicitly.
  • No config key, no CLI flag, no user-facing surface.

2. What this issue adds

Two config keys in ~/.config/threadhop/config.json, read on load by the TUI and by copy:

{
  \"tui\": {
    \"include_tool_calls\": true
  },
  \"copy\": {
    \"include_tool_calls\": false
  }
}

Defaults stay identical to the hardcoded v1 (tui=true, copy=false). Users who want the TUI to hide tool calls set tui.include_tool_calls = false; users who want copy to preserve tool-call abbreviations set copy.include_tool_calls = true.

Nested keys rather than flat (tui_include_tool_calls) for two reasons: (a) it leaves room for a future tui.density, copy.format, etc., cluster without a prefix-war; (b) it matches how users mentally scope the toggle ("change the TUI, not copy").

migration.py already preserves unknown keys in config.json, so adding these keys is forward-compatible for users on older builds and rolling back is safe.

3. Callers intentionally left hardcoded

Not every caller should read the config. Keep these at include_tool_calls=True regardless:

  • Search indexing (indexer.parse_messages, indexer.index_session) — FTS rows need tool-call abbreviations so searches for tool names or file paths land correctly. Dropping them silently breaks search.
  • Observer / reflector (observer.observe_session, reflector.reflect_session) — these reason about decisions and todos at the turn level; abbreviated tool calls are signal, not noise. Dropping them removes evidence the model uses to extract structure.
  • Handoff (handoff.py) — parked on a dev branch per current planning, but when it returns it should continue to abbreviate, since handoff is about faithful session context, not minimal context (that's what copy is for).

The config keys are scoped specifically to the consumer-facing callers (TUI rendering, copy payload) — not the internal pipelines. Worth a one-line comment at each hardcoded call site so the decision is visible from the code.

4. Open questions

  1. Also promote include_tool_results? Paired with include_tool_calls in the indexer. copy needs it False too. Same config shape — tui.include_tool_results, copy.include_tool_results — or fold into the same key? Current bias: one key per parameter, keeps the mapping mechanical and avoids a silent coupling.

  2. CLI flag override on threadhop copy? Something like threadhop copy --include-tool-calls for the one-off case where the user wants a verbatim copy. Explicitly deferred from v1 per the copy design discussion, but worth listing here so future-us doesn't have to re-derive the ergonomics.

  3. TUI live reload? If a user edits config.json while the TUI is running, does the renderer pick up the new value on the next 5 s refresh, or only on restart? Other config knobs (theme, sidebar width) are set-and-forget today — defaulting to restart-only keeps parity.

  4. Keybinding in the TUI to toggle include_tool_calls at runtime? Natural extension — a density toggle mapped to e.g. T. Not required for this issue but should land in the same PR if the UX ergonomics demand it. Ties into the density-toggle thread in docs/UI-IMPROVEMENTS.md.

5. Action items

  • Add tui.include_tool_calls and copy.include_tool_calls (and optionally *.include_tool_results) to the ~/.config/threadhop/config.json schema with defaults true and false respectively
  • Thread the config values to the TUI transcript-build path and copy.py's indexer calls, falling back to the hardcoded default when the key is absent
  • Leave search indexing, observer, reflector, and handoff hardcoded to True — add a one-line comment at each site so the decision is grep-able
  • Document the two new keys and their effect in README.md (or INSTALL-MACOS.md, wherever the config surface is described)
  • Verify via migration.py that upgrading users without the keys silently get default behavior
  • Decide the four open questions above (results parity, CLI flag, live reload, keybinding) before cutting the implementation PR

References

  • indexer._extract_assistant_blocks, indexer._extract_user_text — where the parameters live after the copy change
  • ~/.config/threadhop/config.json and migration.py — existing config surface; preserves unknown keys
  • CLAUDE.md (Persistent Config section) — canonical list of what belongs in config.json vs sessions.db
  • copy.py (introduced alongside /threadhop:copy) — first consumer-facing caller to pass False
  • Issue #58 (turn-as-unit transcript rendering) — adjacent TUI rendering work; if both land together, the density toggle (Q4) slots cleanly into the turn composer

Activity

0

No activity yet.