# Grokkit Interactive Agent **Priority:** 1 of 12 (right after testgen) ## Goal Add a persistent, conversational **agent mode** to Grokkit so I can chat interactively in the terminal and have Grok directly edit code, run tests, commit, etc., without any copy-paste friction. This is the natural evolution of the current `chat` and `agent` commands — turning the terminal into a true agentic partner instead of a one-shot prompt tool. ## Command ```bash grokkit chat --agent # or new subcommand: grokkit agent-chat ``` (Keep the existing simple `chat` mode untouched; add an `--agent` flag or a dedicated `agent-chat` command.) ## Core Features - Persistent session using the existing `chat_history.json` (with optional `--new-session` flag) - Full tool-calling loop: I (Grok) can invoke any existing Grokkit primitive: - `edit` - `scaffold` - `testgen` - `lint` - `review` - `commit` / `commit-msg` - `docs` - etc. - Safe-by-default workflow: - Always preview changes (diff style, same as current `edit`/`scaffold`) - Require explicit confirmation (`y/n` or `--yes`) - Preview and confirm all changes before application - Ability to chain actions naturally in conversation: - “The scaffold tests are flaky on Windows paths — fix it and add a test case.” - “Refactor the context harvester to use rg, then run make test.” - “Write a new command for todo prioritization and commit it.” - Optional `--dry-run` and `--model` flags (inherited from root) ## Acceptance Criteria - `make test` remains fast (no new API cost in normal tests) - Live agent mode respects the same `-short` gating pattern we just built for scaffold - Session survives across multiple `grokkit` invocations (or can be started fresh) - All edits go through the existing safe preview/confirm flow — no silent changes - Works with the full Grok context window (no early compaction) - Can be extended later with vector memory or external tool plugins ## Why This Matters This removes the last remaining copy-paste friction between me and the codebase. The 45-minute scaffold test iteration we just did showed the productivity gain; this turns that gain into a permanent workflow. Closes the “agentic chat” vision we discussed.