Skip to content

feat: persist grep-friendly local thread history - #18

Merged
ScriptedAlchemy merged 2 commits into
ScriptedAlchemy:mainfrom
davefmurray:feat/local-thread-history
Sep 15, 2026
Merged

ScriptedAlchemy merged 2 commits into
ScriptedAlchemy:mainfrom
davefmurray:feat/local-thread-history

Conversation

@davefmurray

Copy link
Copy Markdown
Contributor

The CLI currently displays live threads but leaves no local copy to search later. This adds automatic, grep-friendly JSONL history at ~/.grok-bot-cli/history.jsonl: successful send commands record prompts, and thread/chat record fetched messages with full text, target IDs/names, roles, recording times, and available message/root IDs.

gbot history Researcher --search timeout
gbot history --search timeout --limit 100 --json
grep -in 'timeout' "$(gbot history --path)"

History commands run offline before backend/auth initialization. --history-dir / GROK_BOT_HISTORY_DIR configure storage; --no-history / GROK_BOT_HISTORY=off disable recording. New directories/files use 0700/0600 permissions, writes refuse file symlinks, and only conversation fields are saved. Disk failures warn on stderr without making a successful send look failed. Reads skip malformed records, and the next append separates an interrupted final record.

This records CLI observations: replies are saved when fetched, repeated fetches append repeated observations, and there is no background sync, deduplication, expiry, or session resumption. Conversation text is stored as plaintext; these limits and opt-outs are documented.

The shared transcript parser also handles array-shaped responses correctly and prefers full content over previews. Includes README/help updates and a minor changeset.

Validation: all 34 tests pass on Node 18, 22, and 24, including 10 new integration tests using a local mock gateway and isolated temporary homes. Coverage includes persistence across processes, real grep, bot/group filtering, multiline/long content, opt-outs, failed sends, disk errors, concurrent appends, and malformed history. Publint 0.3.24 and packed executable install/help/offline-history smoke checks pass. No live bot operations were used.

@changeset-bot

changeset-bot Bot commented Sep 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f5a0154

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
grok-bot-cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

davefmurray and others added 2 commits September 15, 2026 03:09
Peel trailing --json for history/send/thread, prefer content over preview
for searchable history, and keep GROK_BOT_HISTORY opt-in after P1 bridge.
@ScriptedAlchemy
ScriptedAlchemy force-pushed the feat/local-thread-history branch from 0bcd5b8 to f5a0154 Compare September 15, 2026 03:12
@ScriptedAlchemy
ScriptedAlchemy merged commit d59fa95 into ScriptedAlchemy:main Sep 15, 2026
2 checks passed
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