contextflow

module
v0.1.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2026 License: MIT

README ΒΆ

ContextFlow 🧠

Shell history that understands your workflows, not just your commands.

CI Go Report Card Go version Release


Every developer has typed history | grep in desperation. You know a command exists somewhere β€” you just can't find the sequence around it. What else did you run? In what directory? For which project?

ContextFlow remembers the workflow, not just the command.


Features

  • πŸ” Fuzzy search TUI β€” beautiful Ctrl+R replacement with project context
  • 🧠 Workflow detection β€” auto-groups related commands by git repo + session
  • πŸ” Replay β€” step through any past workflow interactively
  • πŸ“€ Export β€” workflows as .sh scripts or Markdown runbooks
  • πŸ“Š Stats β€” most-used commands, busiest repos, session analytics
  • πŸ“₯ Import β€” bring in your existing ~/.bash_history / ~/.zsh_history
  • πŸ”’ Secret filtering β€” tokens, passwords, and API keys are never recorded
  • πŸ“ Project-aware β€” history linked to git repos, not just directories
  • πŸ’Ύ Local-first β€” everything in ~/.contextflow/history.db (SQLite), nothing uploaded

Install

One-liner (Linux & macOS):

curl -fsSL https://raw.githubusercontent.com/Luv-Goel/contextflow/main/scripts/install.sh | bash

go install (recommended):

go install github.com/Luv-Goel/contextflow/cmd/cf@latest

Homebrew:

brew install Luv-Goel/tap/contextflow

Build from source:

git clone https://github.com/Luv-Goel/contextflow
cd contextflow
go build -o ~/bin/cf ./cmd/cf

Setup

Add to your shell config and restart:

# bash β€” add to ~/.bashrc
eval "$(cf init bash)"

# zsh β€” add to ~/.zshrc
eval "$(cf init zsh)"

# fish β€” add to ~/.config/fish/config.fish
cf init fish | source

Then press Ctrl+R to search, or run cf workflows to explore.

Import your existing history:

cf import   # auto-detects ~/.bash_history and ~/.zsh_history

Usage

# Search (Ctrl+R replacement β€” fuzzy TUI)
cf search
cf search "docker"

# Browse auto-detected workflows
cf workflows

# Step through a workflow interactively
cf replay 42

# Preview without executing
cf replay 42 --dry-run

# Export as shell script
cf export 42 > setup.sh

# Export as Markdown runbook
cf export 42 --format md > RUNBOOK.md

# Give a workflow a name
cf tag 42 "my docker setup"

# Usage statistics
cf stats

# Delete a workflow
cf delete 42

# Import existing shell history
cf import
cf import ~/.zsh_history

How Workflow Detection Works

ContextFlow automatically groups commands into workflows when they are:

  1. Recorded in the same terminal session
  2. Within 30 minutes of each other
  3. In the same git repository or directory

So if you ran docker build, docker run, docker ps, and curl localhost:8080 in one session β€” that's a workflow. Name it "docker-setup" and replay it any time.

No manual tagging required. Just work normally.


Privacy & Security

  • All data stored in ~/.contextflow/history.db β€” never leaves your machine
  • Secret filtering β€” commands matching patterns for passwords, tokens, API keys, and credentials are recorded as [redacted] automatically
  • No telemetry, no analytics, no accounts, no network calls

Why Not Atuin?

Feature Atuin ContextFlow
Fuzzy search TUI βœ… βœ…
Cross-machine sync βœ… β€” (planned)
E2E encrypted sync βœ… β€”
Workflow detection ❌ βœ…
Workflow replay ❌ βœ…
Export as script/runbook ❌ βœ…
Git repo awareness ❌ βœ…
Secret filtering ❌ βœ…
Usage stats partial βœ…
History import βœ… βœ…
Single binary βœ… βœ…
Local-first βœ… βœ…

They're complementary. Atuin is best for sync + search across machines. ContextFlow is best for understanding and replaying what you actually did. Use both β€” Atuin import is in v0.2.


Roadmap

  • v0.1 β€” Shell hooks (bash/zsh/fish), fuzzy search TUI, workflow detection, replay, export, stats, import, secret filtering
  • v0.2 β€” Atuin import, cf share (Gist export), improved workflow naming, Fish history import
  • v0.3 β€” Natural language search, team snippet library, VS Code extension

Contributing

PRs and issues are welcome! See CONTRIBUTING.md.

git clone https://github.com/Luv-Goel/contextflow
cd contextflow
go test ./...

License

MIT Β© Luv-Goel


Built with Bubble Tea πŸ§‹ Β· Powered by SQLite Β· Zero cloud dependencies


Commands Reference

Command Description
cf version Show ContextFlow version
cf init Output shell hook configuration
cf search [query] Search command history (fuzzy TUI)
cf workflows Browse auto-detected workflows
cf replay <id> Replay a workflow interactively
cf export <id> Export workflow as script or runbook
cf stats Show usage statistics
cf story Generate narrative summary of your work
cf tag <id> <name> Give a workflow a custom name
cf delete <id> Delete a workflow
cf import [file] Import existing shell history
cf hook Output shell integration script
cf record Record a command (internal use)
cf uninstall Remove ContextFlow completely
cf install Quick install instructions
cf atuin Import from Atuin
cf share Share workflow to Gist
Options
  • cf search -p β€” Plain text output (no TUI)
  • cf search -n 100 β€” Limit results to 100
  • cf export <id> -f md β€” Export as Markdown runbook
  • cf replay --dry-run β€” Preview without executing

Directories ΒΆ

Path Synopsis
cmd
cf command
ContextFlow CLI β€” Shell history that understands your workflows.
ContextFlow CLI β€” Shell history that understands your workflows.
internal
db
tui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL