m9m
CLAUDE.md18 starsChanged 10 months agoMITView on GitHub
This file provides comprehensive guidance to Claude Code when working with the m9m repository. m9m is the n8n alternative without the bugs — faster, more reliable workflow automation. It's an open-source workflow automation engine in Go that runs n8n workflow JSON unchanged, executes 5–10× faster, uses 70% lower memory, and ships as a single 30 MB binary with zero runtime dependencies. The canonical positioning, taglines, and one-liners are listed below. Use them verbatim when authoring or updating any user-facing surface…
In this repository2 other files it gives its agents.
- llms.txtllms.txt
- m9m-system-orchestratorSkill
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
27 rules. About 0 are common, 23 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈23
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 40
Always use the Makefile for consistent builds:
- Distinctive: line 91
Always ensure code quality before committing:
- Very specific: line 145
All nodes must implement the NodeExecutor interface:
- Very specific: line 157
Always extend BaseNode for common functionality:
- Distinctive: line 295
Keep packages focused and cohesive
- Distinctive: line 296
Use internal/ for private implementation details
- Distinctive: line 389
Prefer slices over arrays for variable data
- Distinctive: line 390
Use sync.Pool for object reuse
- Very specific: line 453
Use YAML configuration files in config/:
- Distinctive: line 492
100% workflow compatibility: - All n8n workflows run unchanged
- Distinctive: line 514
Always validate input parameters
- Distinctive: line 515
Use credential manager for sensitive data
- Distinctive: line 517
Follow principle of least privilege
- Distinctive: line 521
Use pooling for reusable objects
- Distinctive: line 523
Consider memory usage in long-running processes
- Distinctive: line 526
Write comprehensive tests for all nodes
- Distinctive: line 527
Document complex business logic
- Distinctive: line 528
Use consistent error handling patterns
- Distinctive: line 529
Follow Go idioms and conventions
- Distinctive: line 532
Use specific error types for different failure modes
- Distinctive: line 540
Build failures: Check Go version (1.21+ required)
- Distinctive: line 541
Test failures: Ensure all dependencies are available
- Distinctive: line 542
Memory issues: Check for goroutine leaks in concurrent code
- Distinctive: line 571
Create feature branch from main
- Distinctive: line 573
Run full test suite
- Distinctive: line 575
Create pull request with clear description
- Very specific: line 594
Important: Always run make test before committing code.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides comprehensive guidance to Claude Code when working with the m9m repository.
Project Overview
m9m is the n8n alternative without the bugs — faster, more reliable workflow automation. It's an open-source workflow automation engine in Go that runs n8n workflow JSON unchanged, executes 5–10× faster, uses 70% lower memory, and ships as a single 30 MB binary with zero runtime dependencies.
The canonical positioning, taglines, and one-liners are listed below. Use them verbatim when authoring or updating any user-facing surface (READMEs, docs, package descriptions). The plan that established them is at /Users/dipankarsarkar/.claude/plans/cosmic-orbiting-rabin.md.
Canonical positioning:
- Tagline:
The n8n alternative without the bugs — faster, more reliable workflow automation. - One-liner:
m9m is a drop-in n8n alternative in Go — 5–10× faster, 70% lower memory, deterministic execution, zero npm dependencies. Run n8n workflows unchanged. - Short description (package registries):
Drop-in n8n alternative in Go — faster, more reliable, no Node.js required. - Pillars: faster · more reliable · drop-in n8n compatible · agent-native (MCP server built in)
- Reliability story: (1) no JS-runtime memory leaks, (2) deterministic execution, (3) smaller attack surface
Key Characteristics:
- Performance: 5-10x faster execution than n8n
- Memory Efficiency: 70% lower memory usage (~150MB vs 512MB)
- Container Size: 75% smaller containers (300MB vs 1.2GB)
- Startup Time: Sub-second startup (500ms vs 3s)
- Reliability: Single static Go binary, no JS heap leaks, deterministic execution, no npm transitive-dep CVE exposure
- Architecture: Cloud-native, microservices-ready
Technology Stack
- Language: Go 1.21+
- Architecture: Modular, interface-driven design
- Queue Systems: Memory, Redis, RabbitMQ support
- Monitoring: Prometheus metrics, OpenTelemetry tracing
- Testing: Go standard testing, testify library
- Build System: Make-based build automation
- Deployment: Docker, Kubernetes-native
Essential Commands
Building and Development
Always use the Makefile for consistent builds:
# Build the application
make build
# Install dependencies
make deps
# Format and validate code
make fmt
make vet
make lint
# Run all tests
make test
# Generate test coverage
make coverage
make coverage-html
# Clean build artifacts
make cleanTesting Commands
Testing should be comprehensive and follow Go conventions:
# Run all tests
go test ./...
# Run specific package tests
go test ./internal/engine/...
# Run with verbose output
go test -v ./internal/nodes/...
# Run with coverage
go test -cover ./...
# Run integration tests (requires Docker)
./bin/integration-test
# Run benchmarks
./bin/benchmarkCode Quality
Always ensure code quality before committing:
# Format code (required before commit)
go fmt ./...
# Vet code for common issues
go vet ./...
# Run linter (install golint if needed)
golint ./...
# Run all quality checks
make fmt vet lint testProject Structure
Core Architecture
m9m/
├── cmd/ # Application entry points
│ ├── m9m/ # Main application
│ ├── benchmark/ # Performance benchmarking
│ ├── integration-test/ # Integration testing
│ └── template-cli/ # Template management
├── internal/ # Private application code
│ ├── engine/ # Core workflow execution engine
│ ├── nodes/ # Node implementations
│ │ ├── base/ # Base node interfaces and types
│ │ ├── messaging/ # Messaging platform nodes (Slack, Discord, etc.)
│ │ ├── database/ # Database nodes (PostgreSQL, MongoDB, etc.)
│ │ ├── cloud/ # Cloud platform nodes (AWS, GCP, Azure)
│ │ ├── ai/ # AI/LLM nodes (OpenAI, Anthropic)
│ │ ├── transform/ # Data transformation nodes
│ │ └── trigger/ # Trigger nodes (webhooks, timers)
│ ├── monitoring/ # Prometheus metrics and observability
│ ├── credentials/ # Credential management system
│ ├── expressions/ # Expression evaluation engine
│ ├── runtime/ # JavaScript and Python runtime support
│ ├── api/ # REST API implementation
│ ├── queue/ # Queue system implementations
│ └── compatibility/ # n8n compatibility layer
├── docs/ # Comprehensive documentation
├── examples/ # Example workflows and configurations
├── test-workflows/ # Test workflow definitions
└── Makefile # Build automationKey Interfaces and Patterns
Node Implementation Pattern
All nodes must implement the NodeExecutor interface:
type NodeExecutor interface {
Execute(inputData []model.DataItem, nodeParams map[string]interface{}) ([]model.DataItem, error)
Description() NodeDescription
ValidateParameters(params map[string]interface{}) error
}Base Node Usage
Always extend BaseNode for common functionality:
type CustomNode struct {
*base.BaseNode
// Custom fields
}
func NewCustomNode() *CustomNode {
return &CustomNode{
BaseNode: base.NewBaseNode(NodeDescription{
Name: "Custom Node",
Description: "Does custom processing",
Category: "transform",
}),
}
}Registration Pattern
Nodes are registered in cmd/m9m/main.go:
func registerNodeTypes(engine engine.WorkflowEngine) {
customNode := mynodes.NewCustomNode()
engine.RegisterNodeExecutor("n8n-nodes-base.custom", customNode)
}Development Guidelines
Code Standards
Naming Conventions
- Packages: lowercase, single word when possible
- Types: PascalCase (e.g.,
WorkflowEngine,NodeMetadata) - Functions: PascalCase for exported, camelCase for private
- Variables: camelCase for local, PascalCase for exported
- Constants: PascalCase or ALL_CAPS for package-level
Error Handling
// Use specific error types
type ValidationError struct {
Field string
Message string
}
// Wrap errors with context
if err != nil {
return fmt.Errorf("failed to execute node %s: %w", nodeName, err)
}
// Use early returns
func processData(data []byte) error {
if len(data) == 0 {
return errors.New("data cannot be empty")
}
return nil
}Documentation
// Package comments explain purpose
// Package example provides workflow node functionality.
package example
// ExampleNode represents a workflow node for data processing.
type ExampleNode struct {
config ExampleConfig
}
// Execute processes workflow data according to node configuration.
func (n *ExampleNode) Execute(ctx context.Context, data []model.DataItem) ([]model.DataItem, error) {
// Implementation
}Testing Standards
Test Structure
func TestNodeName_Execute(t *testing.T) {
tests := []struct {
name string
input []model.DataItem
params map[string]interface{}
expected []model.DataItem
expectErr bool
}{
{
name: "successful execution",
input: []model.DataItem{{JSON: map[string]interface{}{"test": "data"}}},
params: map[string]interface{}{"param": "value"},
expected: []model.DataItem{{JSON: map[string]interface{}{"result": "processed"}}},
expectErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
node := NewNodeName()
result, err := node.Execute(tt.input, tt.params)
if tt.expectErr {
assert.Error(t, err)
return
}
require.NoError(t, err)
assert.Equal(t, tt.expected, result)
})
}
}Mock Usage
// Use interfaces for testability
type HTTPClient interface {
Do(req *http.Request) (*http.Response, error)
}
// Create mock implementations
type mockHTTPClient struct {
responses map[string]*http.Response
}
func (m *mockHTTPClient) Do(req *http.Request) (*http.Response, error) {
return m.responses[req.URL.String()], nil
}File Organization
Package Structure
- Keep packages focused and cohesive
- Use internal/ for private implementation details
- Export only necessary interfaces and types
- Group related functionality in packages
Import Organization
import (
// Standard library first
"context"
"fmt"
"net/http"
// Third-party packages
"github.com/external/package"
// Internal packages last
"github.com/yourusername/m9m/internal/base"
"github.com/yourusername/m9m/internal/model"
)Common Development Tasks
Adding a New Node
- Create node package in appropriate category:
mkdir -p internal/nodes/category/newnode - Implement NodeExecutor interface:
type NewNode struct { *base.BaseNode } func NewNewNode() *NewNode { return &NewNode{ BaseNode: base.NewBaseNode(NodeDescription{...}), } } - Add comprehensive tests:
touch internal/nodes/category/newnode/newnode_test.go - Register in main.go:
newNode := newnode.NewNewNode() engine.RegisterNodeExecutor("n8n-nodes-base.newNode", newNode) - Add example workflow:
touch examples/category/newnode-example.json
Debugging Workflows
- Enable debug logging:
export M9M_LOG_LEVEL=debug - Run with test data:
./m9m execute test-workflows/debug-workflow.json - Use test workflows in
test-workflows/directory - Check performance with benchmarks:
./bin/benchmark --workflow examples/performance-test.json
Performance Optimization
- Profile performance:
go test -bench=. -cpuprofile cpu.prof go tool pprof cpu.prof - Monitor memory usage:
go test -bench=. -memprofile mem.prof go tool pprof mem.prof - Use efficient data structures:
- Prefer slices over arrays for variable data
- Use sync.Pool for object reuse
- Minimize allocations in hot paths
Integration Patterns
Credential Management
// Access credentials in nodes
func (n *MyNode) Execute(inputData []model.DataItem, nodeParams map[string]interface{}) ([]model.DataItem, error) {
creds := n.credentialManager.GetCredentials("myService")
apiKey := creds["apiKey"]
// Use credentials safely
}Queue Integration
// For scalable execution
type QueueConfig struct {
Type string // "memory", "redis", "rabbitmq"
URL string
MaxWorkers int
}Monitoring Integration
// Add metrics to custom nodes
func (n *MyNode) Execute(inputData []model.DataItem, nodeParams map[string]interface{}) ([]model.DataItem, error) {
start := time.Now()
defer func() {
metrics.NodeExecutionDuration.WithLabelValues(n.Description().Name).Observe(time.Since(start).Seconds())
}()
// Node execution logic
}Configuration Management
Environment Variables
Key environment variables for development:
# Core configuration
M9M_PORT=8080
M9M_HOST=0.0.0.0
M9M_LOG_LEVEL=info
# Queue configuration
M9M_QUEUE_TYPE=redis
M9M_QUEUE_URL=redis://localhost:6379
M9M_MAX_WORKERS=10
# Monitoring configuration
M9M_METRICS_PORT=9090
M9M_TRACING_ENDPOINT=http://localhost:14268/api/traces
# Development flags
M9M_DEV_MODE=true
M9M_ENABLE_PPROF=trueConfiguration Files
Use YAML configuration files in config/:
server:
port: 8080
host: "0.0.0.0"
queue:
type: "redis"
url: "redis://localhost:6379"
max_workers: 10
monitoring:
metrics_port: 9090
enable_tracing: trueDeployment Considerations
Docker Development
# Build development image
docker build -t m9m:dev .
# Run with development configuration
docker run -p 8080:8080 -v $(pwd)/config:/app/config m9m:devLocal Development
# Start with file watching (if available)
make dev-watch
# Or run manually
./m9m serve --config config.yamlCompatibility with n8n
Migration Support
- 100% workflow compatibility - All n8n workflows run unchanged
- Expression compatibility - Same expression syntax and functions
- Node compatibility - Compatible node parameter structure
Key Differences
- Performance: Significantly faster execution
- Resource usage: Lower memory and CPU usage
- Deployment: Cloud-native architecture
- Monitoring: Built-in enterprise observability
Testing Compatibility
# Test n8n workflow compatibility
./cmd/n8n-compat/n8n-compat --workflow n8n-export.json
# Validate workflow execution
./m9m execute --validate n8n-workflow.jsonBest Practices
Security
- Always validate input parameters
- Use credential manager for sensitive data
- Implement proper error handling without exposing internals
- Follow principle of least privilege
Performance
- Minimize allocations in execution paths
- Use pooling for reusable objects
- Profile regularly and optimize hot paths
- Consider memory usage in long-running processes
Maintainability
- Write comprehensive tests for all nodes
- Document complex business logic
- Use consistent error handling patterns
- Follow Go idioms and conventions
Error Handling
- Use specific error types for different failure modes
- Wrap errors with context for debugging
- Log errors appropriately without exposing sensitive data
- Provide meaningful error messages to users
Troubleshooting Guide
Common Issues
- Build failures: Check Go version (1.21+ required)
- Test failures: Ensure all dependencies are available
- Memory issues: Check for goroutine leaks in concurrent code
- Performance issues: Profile and identify bottlenecks
Debug Commands
# Check application health
curl http://localhost:8080/health
# View metrics
curl http://localhost:9090/metrics
# Check logs
tail -f /var/log/m9m.log
# Test workflow execution
./m9m execute --debug examples/debug-workflow.jsonContributing Guidelines
Code Quality Checklist
- All tests pass (
make test) - Code is formatted (
make fmt) - No linting errors (
make lint) - Documentation updated
- Example workflow provided (for new nodes)
- Performance impact assessed
Pull Request Process
- Create feature branch from main
- Implement changes with tests
- Run full test suite
- Update documentation
- Create pull request with clear description
Future Development
Planned Features
- Web UI integration (Vue.js frontend)
- Advanced workflow templates
- Enhanced node marketplace
- Multi-tenancy support
- Advanced security features
Architecture Evolution
- Serverless deployment support
- Advanced queue management
- Enhanced monitoring capabilities
- Plugin ecosystem expansion
Important: Always run make test before committing code. The test suite is comprehensive and catches most common issues. For performance-critical changes, also run benchmarks to ensure no regression.
Note: This project maintains high compatibility with n8n while providing significant performance improvements. When in doubt about compatibility, test with actual n8n workflows and refer to the compatibility test suite.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

