flowstate is a terminal-first code editor with AI-assisted explain, fix, refactor, and build-error workflows. AI suggestions are shown in a scratch buffer first, and code changes move into a reviewable patch preview before you apply them.
cmake -S . -B build
cmake --build buildRun the test suite:
ctest --test-dir build --output-on-failureBasic usage:
./build/flowstate <file>Choose an AI provider:
./build/flowstate <file> --no-ai
./build/flowstate <file> --ai openai
./build/flowstate <file> --ai codexAI is disabled by default. You can also pass --ai with no value to keep AI disabled for
the session.
Attach a build command so Ctrl+T and :build work:
./build/flowstate src/main.cpp --build "cmake --build build"You can also set the default provider with:
export FLOWSTATE_AI_MODE=codex- Open a file.
- Move the cursor with the arrow keys,
Home,End,PageUp, andPageDown. - Hold
Shiftwhile moving with the arrow keys,Home, orEndto select text. - Press
Ctrl+Eto explain the current line or selection. - Press
Ctrl+Rto ask for a fix patch. - Review the AI scratch buffer or patch preview.
| Shortcut | Action |
|---|---|
Ctrl+S |
Save the current file |
Ctrl+Q |
Quit. If the file is dirty, press it twice |
Ctrl+/ |
Toggle line comments for the selected lines or current line |
| Mouse wheel | Scroll the active buffer |
Shift+Arrow |
Extend the current selection by character or line |
Shift+Home / Shift+End |
Extend the current selection to the start or end of the line |
Tab |
Insert spaces to the next 4-space indentation stop |
Ctrl+C |
Copy the current selection, or the current line if nothing is selected |
Ctrl+X |
Cut the current selection, or the current line if nothing is selected |
Ctrl+V |
Paste the internal editor clipboard at the cursor, or replace the current selection |
Ctrl+Z |
Undo the last file change |
Ctrl+Y |
Redo the last undone file change |
Ctrl+F |
Open the find prompt for the current file |
Ctrl+O |
Open the file picker |
Ctrl+E |
Explain the current line or selection |
Ctrl+R |
Generate a fix patch |
Ctrl+T |
Run the configured build command |
Esc |
Leave AI scratch, patch preview, or build output and return to the file buffer |
Alt+E |
Reopen the AI scratch buffer |
Alt+P |
Reopen patch preview if a patch is ready |
Alt+A |
Accept the current hunk in patch preview |
Alt+R |
Reject the current hunk in patch preview |
Alt+C |
Enter command mode |
Alt+D |
Toggle previous-line peek when the cursor is on a blue or red Git gutter marker |
Alt+I |
Request IntelliSense completions for supported code files |
Notes:
- Only one AI request runs at a time.
- Pressing
Escwhile AI is still running sends you back to the file buffer and leaves the request running in the background. Entercopies the current line indentation.Backspaceinside leading indentation moves back one 4-space indentation stop.- In the file picker, type to filter, use arrow keys to select, press
Enterto open, orEscto cancel. - Cut, copy, and paste currently use an internal flowstate clipboard rather than the system clipboard.
flowstate can request C/C++/header completions from clangd, Python completions from the project pyright dependency, JavaScript/TypeScript completions from the project TypeScript language-server dependencies, Go completions from gopls, and Rust completions and diagnostics from rust-analyzer.
Requirements:
clangdmust be installed and available onPATH, orFLOWSTATE_CLANGD_PATHmust point to it.- Python IntelliSense needs
npm installto install the projectpyrightdependency.FLOWSTATE_PYTHON_LSP_PATHcan point to another Python language server binary. - JavaScript and TypeScript IntelliSense needs
npm installto installtypescript-language-serverandtypescript.FLOWSTATE_TYPESCRIPT_LSP_PATHcan point to another TypeScript language-server binary. - Go IntelliSense needs
goplsonPATH, in a standard Go bin directory such as~/go/bin, orFLOWSTATE_GO_LSP_PATHpointing to it. - Rust IntelliSense needs
rust-analyzeronPATH, orFLOWSTATE_RUST_LSP_PATHpointing to it. - Project-aware completions work best when CMake writes
compile_commands.json. --cpp-standard <standard>orFLOWSTATE_CPP_STANDARD=<standard>sets clangd fallback parsing for C++ files without compile commands.
Completions open automatically while typing supported identifiers and after ., plus C++ -> and C++/Rust ::. Alt+I can still request completions manually. Use arrow keys to select, Enter or Tab to accept, and Esc to cancel.
Press Alt+C to open command mode, type a command, then press Enter.
| Command | Action |
|---|---|
:open <file> |
Open another file. If it does not exist, flowstate starts with an empty buffer for that path |
:write |
Save the current file |
:quit |
Quit. If the file is dirty, run it twice |
:build |
Run the configured build command |
:find <text> |
Find text in the current file, wrapping from the cursor |
:goto <line> |
Jump to a 1-based line number |
| `:enable-ai <openai | codex>` |
:ai explain |
Explain the current line or selection |
:ai fix |
Generate a fix patch |
:ai refactor |
Generate a refactor patch |
:ai error |
Explain the latest build failure |
:patch accept |
Accept the current patch hunk |
:patch reject |
Reject the current patch hunk |
:patch accept-all |
Accept all pending hunks |
:patch reject-all |
Reject all pending hunks |
Press Esc in command mode to cancel it.
Inline AI explanations include a follow-up input area. Move into the explanation with the
arrow keys, type a question, and press Enter to send it.
The AI scratch buffer is where streamed AI output appears first.
- While AI is thinking, the top line shows the request label and a rotating spinner.
- For explain and error requests, the final text stays in the scratch buffer.
- For fix and refactor requests, flowstate attempts to extract a unified diff when the response completes.
If AI returns a valid patch for the current file, flowstate switches to patch preview.
- Use
Alt+AandAlt+Rto accept or reject the current hunk. - Use
:patch accept-allor:patch reject-allfor bulk actions. - After applying or rejecting hunks, the preview refreshes automatically.
Build output opens in its own buffer after Ctrl+T or :build.
- If no build command was configured, the build output explains that directly.
:ai erroruses the latest captured build output.
AI is disabled by default. Use --ai openai, --ai codex, FLOWSTATE_AI_MODE, or
:enable-ai <openai|codex> to enable AI for a session. Use --no-ai to start with AI
off even when you normally enable a provider.
Required:
export FLOWSTATE_OPENAI_API_KEY=...Optional:
export FLOWSTATE_OPENAI_MODEL=gpt-4.1-mini
export FLOWSTATE_OPENAI_BASE_URL=https://api.openai.com/v1/responsesRun:
./build/flowstate <file> --ai openaiflowstate’s Codex mode uses a persistent local codex app-server session.
Requirements:
codexmust be installed and available onPATH- your Codex CLI must already be authenticated
Optional:
export FLOWSTATE_CODEX_MODEL=...
export FLOWSTATE_CODEX_PROFILE=...Run:
./build/flowstate <file> --ai codexThe status bar shows:
- current buffer name
- detected language
- save state
- active AI provider
- active view
- cursor line and column
- AI request state such as
CONNECTING,STREAMING,PARSING PATCH,FAILED, orCOMPLETE
Inside a Git worktree, flowstate marks changes since the last commit in the line-number gutter:
- Green dashed bar: added lines
- Blue dashed bar: modified lines
- Red triangle: deleted lines, anchored where the deletion occurred
Clean files render the normal solid gutter separator.
Put the cursor on a blue modified line or red triangle line and press Alt+D to show or hide the previous lines inline. Git peeks are visual only; they are not part of the editable file buffer.
- Use
Shift+Arrow, thenCtrl+Ewhen you want AI to focus on a specific region. - Use
Ctrl+Tbefore:ai errorso flowstate has fresh build output to analyze. - If a patch is ready but you are back in the file buffer, press
Alt+P. - If an AI request finishes while you are back in the file buffer, press
Alt+Eto reopen the scratch buffer.
