THIS REPOSITORY IS WORK IN PROGRESS SO THERE ARE THINGS THAT DON'T WORK OR ARE BROKEN. THE CLI MIGHT BEHAVE WEIRDLY AND IDK WHAT. IF YOU FEEL THERE IS SOMETHING MISSING OR BROKEN FEEL FREE TO RAISE A REQUEST. ALSO IF YOU FEEL SOMETHING CAN BE IMPROVED FEEL FREE TO CONTRIBUTE.
A hackable AI agent with workflow-based plugins
Hackflow is an extensible AI agent platform where workflows are plugins. Think of it as Vim for AI agents - minimal core, maximum customization.
- π Plugin Architecture: Workflows are plugins that can be downloaded and shared
- π‘οΈ Safety First: Built-in security guards prevent dangerous operations
- π― MCP Native: Leverages Model Context Protocol for tool integrations
- πΎ Stateful: Persistent storage with SQLite (swappable backends)
- π€ Interactive: Support for both static and dynamic prompts
- π€ AI-Powered: Optional AI features for smart workflows (Claude, OpenAI)
- π Hackable: Every component is an interface - swap implementations easily
npm install -g hackflowOr run from source:
git clone https://github.com/yourusername/hackflow.git
cd hackflow
npm install
npm run build
npm linkhackflow init# Simple hello world
hackflow run examples/hello-world.yaml --var name=Alice
# Git commit workflow
hackflow run examples/git-commit-workflow.yaml
# Create a PR
hackflow run examples/create-pr-workflow.yaml --var pr_title="Add new feature"
# Dry run mode (simulate without executing)
hackflow run examples/git-commit-workflow.yaml --dry-run
# Use mock MCP servers (for development)
hackflow run examples/git-commit-workflow.yaml --mock-mcp
# AI-powered workflows (requires ANTHROPIC_API_KEY)
export ANTHROPIC_API_KEY=your_key
hackflow run examples/ai-commit-message.yamlNote: Hackflow uses real MCP servers by default. If no configuration is found, it gracefully falls back to mock servers.
To use real Git/GitHub/GitLab: See docs/OFFICIAL_MCP_SERVERS.md for setup instructions.
Hackflow includes AI capabilities powered by Claude:
steps:
# Dynamic prompts - AI interprets natural language
- action: prompt.ask
params:
message: "Describe your changes"
dynamic: true # AI interprets the response
output: description
# Generate text with AI
- action: ai.generate
params:
prompt: "Write a commit message for: {{description}}"
output: commit_msgSee AI Features Documentation for details.
## π Creating Workflows
Workflows are defined in YAML with a simple, intuitive structure:
```yaml
name: my-workflow
description: What this workflow does
version: 1.0.0
# Required MCP servers
mcps_required:
- git
- github
# Configuration schema
config_schema:
repo_name:
type: string
required: true
auto_push:
type: boolean
default: false
# Steps to execute
steps:
- action: git.status
description: Check git status
output: status
- action: prompt.ask
description: Ask user for input
params:
message: "Enter commit message"
output: commit_msg
- action: git.commit
description: Commit changes
params:
message: "{{commit_msg}}"
output: commit_result
- action: log.info
params:
message: "Committed: {{commit_result.sha}}"
Use {{variable}} syntax to reference variables:
- action: log.info
params:
message: "Hello {{name}}!"Use if to conditionally execute steps:
- action: git.push
if: "{{auto_push}} == true"
params:
remote: originAsk users for input during workflow execution:
- action: prompt.ask
params:
message: "Enter your name"
dynamic: true # Let AI interpret the response
output: user_name
- action: prompt.confirm
params:
message: "Are you sure?"
output: confirmed
- action: prompt.select
params:
message: "Choose an option"
options:
- Option 1
- Option 2
output: selectionHackflow is built with clean interfaces for maximum hackability:
βββββββββββββββββββββββββββββββββββββββββββ
β Workflow Definition β
β (YAML/JSON/TS - stored in git repos) β
ββββββββββββββββ¬βββββββββββββββββββββββββββ
β
β
βββββββββββββββββββββββββββββββββββββββββββ
β Hackflow Agent β
β - Workflow executor β
β - MCP client β
β - State manager β
β - Security guard β
ββββββββββββββββ¬βββββββββββββββββββββββββββ
β
ββββββββββΌβββββββββ
β β β
ββββββββ ββββββββ ββββββββ
β MCP β β MCP β β MCP β
β Git β β GH β β FS β
ββββββββ ββββββββ ββββββββ
Every major component is an interface:
- Storage: SQLite (default), Cloudflare Durable Objects, or custom
- MCP Client: Built-in or bring your own
- Security: Configurable rules and guards
- Prompts: CLI (default) or custom UI
Hackflow takes security seriously:
- β Path Validation: Operations restricted to allowed directories
- β Protected Paths: System directories are off-limits
- β Confirmation Prompts: Dangerous operations require user approval
- β Rate Limiting: Prevent runaway operations
- β Dry Run Mode: Test workflows without side effects
These operations always require confirmation:
- File deletion
- Git push to main/master
- Bulk API operations
- Code execution
# Run a workflow
hackflow run <workflow> [options]
--var key=value Set workflow variables
--dry-run Simulate without executing
--verbose Show detailed output
# List recent executions
hackflow list
--workflow <name> Filter by workflow
--limit <n> Number of results
# Show execution details
hackflow show <execution-id>
# Clean up old executions
hackflow cleanup
--days <n> Remove executions older than N days
# Initialize Hackflow
hackflow init- β Core workflow executor
- β SQLite storage
- β Security guards
- β CLI interface
- β Basic MCP integration
- β Example workflows
- Workflow registry (install from GitHub)
- Real MCP protocol integration
- AI model integration (for dynamic prompts)
- Workflow testing framework
- Cloudflare Durable Objects backend
- Webhook support for long-running workflows
- Workflow composition (call workflows from workflows)
- Event-driven workflow triggers
- Web UI for workflow management
- Workflow marketplace
- Team collaboration features
- Enterprise security features
# Install dependencies
npm install
# Build
npm run build
# Run in dev mode
npm run dev -- run examples/hello-world.yaml --var name=Dev
# Format code
npm run formatHackflow is designed to be hackable! Here's how to extend it:
Implement the IStorageAdapter interface:
import { IStorageAdapter } from "./types";
export class MyStorageAdapter implements IStorageAdapter {
async initialize() {
/* ... */
}
async saveExecution(exec) {
/* ... */
}
// ... implement other methods
}Custom actions can be added via MCP servers or as built-in actions in the executor.
Workflows are just YAML files! Create, test, and share them via GitHub.
MIT
- Model Context Protocol (MCP) for tool integration standards
- Temporal for workflow orchestration inspiration
- Vim β€οΈ for the philosophy of hackability
Built with β€οΈ for developers who love to hack