The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
SAFe agent workflow harness for Claude Code and peers
SAW is a template harness for coordinated AI agent work. It packages roles, commands, skills, hooks, and sync scripts so builders can run the same workflow across Claude Code, Codex, Cursor, and Gemini CLI.
Builders who want their agent team to follow the same workflow across multiple tools.
You can run agent-led work with clearer roles, consistent checks, and reusable team process.
What it does
Three-layer architecture
Organizes the harness into hooks, commands, and skills so different kinds of automation stay separate.
Multi-provider support
Includes setup for Claude Code, Codex CLI, Gemini CLI, and Cursor so the same workflow can move across tools.
SAFe agent roles
Defines 11 agent profiles mapped to SAFe-style responsibilities like architecture, QA, release, and coordination.
Slash command workflows
Ships commands such as `/start-work`, `/pre-pr`, `/end-work`, and `/check-workflow` for repeatable sessions.
Knowledge vault
Adds an evidence-verified knowledge base with drift detection and validation scripts.
Dark factory mode
Provides persistent autonomous agent team patterns using tmux on remote servers.
Harness sync scripts
Includes scripts to initialize a manifest and sync updates without overwriting protected customizations.
Pattern and template library
Bundles workflow patterns, specs templates, program templates, and reusable project documents.
How to get it
- 1Run
# Copy rules to your project cp -r .cursor/ /your-project/.cursor/ # Open in Cursor cursor /your-project # Rules activate automatically based on file context # Use @rule-name to invoke agent roles manually
- 2Run
# Prove the tooling works before you trust it node knowledge-vault/scripts/validate-vault.mjs --vault knowledge-vault/templates/starter-bundle
README
SAW — SAFe Agentic Workflow
AI Agent Harness for Multi-Agent Team Workflows
A Production-Tested Three-Layer Architecture for Coordinated AI Teams
Template Repository - Click "Use this template" above to create your own AI agent harness. After cloning, run
bash scripts/setup-template.shto customize for your project. See TEMPLATE_SETUP.md for details.
What This Is
A production-tested AI agent harness for teams that want structured AI workflows.
Multi-provider support: Works with Claude Code (Anthropic), Gemini CLI (Google), Codex CLI (OpenAI), and Cursor IDE (Anysphere).
Built on SAFe methodology (Scaled Agile Framework), adapted for AI agent teams. Works for any team with repeatable processes: Software, Marketing, Research, Legal, Operations.
Includes:
- 20 Model-Invoked Skills - Domain expertise that loads automatically (Skills 2.0 frontmatter)
- 24 Slash Commands - Workflow automation for common tasks
- 11 SAFe Agent Profiles - Specialized roles with clear boundaries
- Three-Layer Architecture - Hooks → Commands → Skills
- Agent Teams - Multi-agent orchestration with SAFe quality gates (experimental)
- Dark Factory - Persistent autonomous agent teams via tmux on remote servers (guide)
- Knowledge Vault - Evidence-verified knowledge base with a drift-detecting validator (guide)
Origin: 5 months production use, 169 issues, 2,193 commits. Implements patterns from 6 Anthropic engineering papers and SAFe methodology.
Quick Start (30 seconds)
Claude Code (Anthropic)
# Copy harness to your project
cp -r .claude/ /your-project/.claude/
# Customize placeholders across all provider files ({{TICKET_PREFIX}}, {{PROJECT_NAME}},
# and the rest) in one pass:
bash scripts/setup-template.sh
# Start working
/start-work TICKET-123
Gemini CLI (Google)
# Copy harness to your project
cp -r .gemini/ /your-project/.gemini/
# Install Gemini CLI (if needed)
npm install -g @google/gemini-cli
# Authenticate
export GEMINI_API_KEY="your-api-key"
# Start working
/workflow:start-work TICKET-123
Codex CLI (OpenAI)
# Copy harness to your project
cp -r .codex/ /your-project/.codex/
cp -r .agents/ /your-project/.agents/
# Install Codex CLI (if needed)
npm install -g @openai/codex
# Authenticate
export OPENAI_API_KEY="your-api-key"
# Start working (natural language, no slash commands)
codex
Cursor IDE (Anysphere)
# Copy rules to your project
cp -r .cursor/ /your-project/.cursor/
# Open in Cursor
cursor /your-project
# Rules activate automatically based on file context
# Use @rule-name to invoke agent roles manually
That's it. Your AI assistant now has your team's workflow patterns built in.
Keeping Your Harness Updated
Already using the harness and a new version is out? You have two paths:
Automated (multi-domain, manifest-based):
# Initialize sync metadata (first time only)
./scripts/sync-claude-harness.sh init
./scripts/sync-claude-harness.sh manifest init --yes
# Preview and apply (syncs all domains in your manifest's sync_scope)
./scripts/sync-claude-harness.sh sync --version v2.11.1 --dry-run
./scripts/sync-claude-harness.sh sync --version v2.11.1
# Sync specific domains only
./scripts/sync-claude-harness.sh sync --version v2.11.1 --scope .claude,.gemini
Manual (full release, all providers):
git remote add harness https://github.com/bybren-llc/safe-agentic-workflow.git
git fetch harness main --tags
git diff v2.10.0..v2.11.1 --stat # See what changed
git checkout harness/main -- .codex/agents/ # Cherry-pick what you need
bash scripts/sync-claude-harness.sh --dry-run # Preview, then drop --dry-run to apply
The sync script protects your customizations via a manifest (required since v2.10.0). It won't overwrite files you've marked as protected. See the Harness Sync Guide for the full reference and Upgrade Guide for rollback options.
The Three-Layer Architecture
┌──────────────────────────────────────────────────────────────────────┐
│ Claude Code Harness │
├──────────────────────────────────────────────────────────────────────┤
│ LAYER 1: HOOKS │ Automatic guardrails (format checks, blockers) │
│ LAYER 2: COMMANDS │ User-invoked workflows (/start-work, /pre-pr) │
│ LAYER 3: SKILLS │ Model-invoked expertise (pattern discovery) │
└──────────────────────────────────────────────────────────────────────┘
Philosophy: Process as service, not control. Everything exists to reduce cognitive load on already-solved problems.
Choose Your Path
For Practitioners - I want to use this today
Getting Started
- Run
bash scripts/setup-template.shto customize placeholders - Read the Getting Started Guide for the full walkthrough
- Run
/start-workon your first ticket
Adopting into an existing repo? See the Workspace Adoption Guide. Upgrading from a previous version? See Keeping the Harness Updated. Syncing your fork with upstream? See the Harness Sync Guide. Planning a multi-issue program? See the SAFe x AI-DLC Methodology. Building a knowledge base? See the Knowledge Vault.
Key Commands
| Command | Purpose |
|---|---|
/start-work | Begin ticket with proper workflow |
/pre-pr | Validate before pull request |
/end-work | Complete session cleanly |
/check-workflow | Quick status check |
Full Command Reference
Workflow (8): /start-work, /pre-pr, /release, /end-work, /check-workflow, /update-docs, /retro, /sync-linear
Local Operations (3): /local-sync, /local-deploy, /quick-fix
Remote Operations (5): /remote-status, /remote-deploy, /remote-health, /remote-logs, /remote-rollback
For Researchers - I want to understand the methodology
Research Foundation
This harness implements patterns from 6 Anthropic engineering papers (see below).
See docs/whitepapers/ for methodology deep-dives and comparative analysis.
For Leaders - I want to understand adoption
Adoption Requirements
- At least one supported AI tool: Claude Code, Gemini CLI, Codex CLI, or Cursor IDE
- Git repository
- Team buy-in for structured workflows
Why Teams Choose SAW
- Structured autonomy: AI agents work within clear boundaries and quality gates
- Evidence-based delivery: Every deliverable requires verifiable evidence, not "trust me"
- Stop-the-line authority: Any agent can halt work for quality or security concerns
- Multi-provider flexibility: Same workflow across Claude Code, Gemini CLI, Codex CLI, and Cursor IDE
Known Limitations
- Claude Code has the deepest integration; Gemini CLI, Codex CLI, and Cursor IDE support is newer
- Non-SWE domain adaptations (marketing, research) are documented but not yet validated in production
Gemini CLI Integration
Why Gemini CLI? - Unique capabilities and when to use it
Gemini CLI Unique Features
Gemini CLI offers capabilities that complement Claude Code:
| Feature | Gemini CLI | Claude Code |
|---|---|---|
| Shell Injection | !{command} - Execute shell, inject output into prompt | Via Bash tool only |
| File Injection | @{file} - Inject file contents into prompts | Via Read tool only |
| Built-in Sandbox | Google Cloud sandboxing | MCP sandboxing |
| Model Options | Gemini 3 Flash, Gemini 3.1 Pro Preview | Claude Opus, Sonnet, Haiku |
| Command Format | TOML | YAML + Markdown |
| Namespaced Commands | /workflow:start-work | /start-work |
| Hooks | settings.json hooks section | hooks-config.json |
| MCP Servers | settings.json mcpServers | settings.local.json |
| Hook Migration | gemini hooks migrate --from-claude | N/A |
| Plan Mode | /plan command, plan-then-execute | N/A |
| Policy Engine | YAML policies, seatbelt profiles | N/A |
| Browser Agent | Built-in experimental agent | MCP (claude-in-chrome) |
| Extensions | Bundled skill/MCP/command packages | N/A |
| Checkpointing | /restore session recovery | N/A |
| Audio/Video | Native multimodal (Gemini 3+) | N/A |
When to Use Gemini CLI
Choose Gemini CLI when you need:
- Shell command output directly in prompts (
!{git log --oneline -5}) - File contents injected into context (
@{package.json}) - Plan mode for complex multi-step tasks (
/plan) - Audio/video transcription and analysis (Gemini 3+ multimodal)
- Policy engine for fine-grained tool control
- Google Cloud integration and Gemini model family access
Choose Claude Code when you need:
- Agent subprocesses with tool restrictions
- Claude model family access
- Production-tested workflow (5+ months validated)
Gemini CLI Quick Reference
# Installation
npm install -g @google/gemini-cli
# Authentication (choose one)
export GEMINI_API_KEY="your-api-key"
# or
gcloud auth application-default login
# Start Gemini CLI
gemini
# List available commands
/help
# List available skills
/skills
Command Syntax Differences
| Action | Claude Code | Gemini CLI |
|---|---|---|
| Start work | /start-work {{TICKET_PREFIX}}-123 | /workflow:start-work {{TICKET_PREFIX}}-123 |
| Pre-PR check | /pre-pr | /workflow:pre-pr |
| Local sync | /local-sync | /local:sync |
| Remote deploy | /remote-deploy | /remote:deploy |
| Search patterns | /search-pattern "pattern" | /search-pattern "pattern" |
Gemini CLI Documentation
- Official Docs: geminicli.com
- Installation: geminicli.com/docs/get-started/installation/
- Authentication: geminicli.com/docs/get-started/authentication/
- Custom Commands: geminicli.com/docs/cli/custom-commands/
- Skills: geminicli.com/docs/cli/skills/
Implementing Anthropic's Research
This harness directly implements patterns from Anthropic's engineering papers:
| Paper | What We Implement |
|---|---|
| Building Effective Agents | 11-agent team structure |
| Effective Harnesses | Three-layer architecture |
| Agent Skills | 20 model-invoked skills |
| Skills Announcement | Skills 2.0 frontmatter, trigger patterns |
| Code Execution with MCP | Tool restrictions per role |
"The best harness is one you forget exists." — Agent Perspective
SAFe Foundation
For Agile Practitioners - Deep dive into SAFe integration
This harness maps SAFe roles to AI agents:
| SAFe Role | Agent | Responsibility |
|---|---|---|
| Business Systems Analyst | BSA | Requirements, acceptance criteria |
| System Architect | System Architect | Architecture decisions, ADRs |
| Product Owner | POPM (human) | Final approval on deliverables |
| Scrum Master | TDM | Coordination, blocker escalation |
| Release Train Engineer | RTE | CI/CD, release coordination |
SAFe Concepts Implemented
- Epic → Feature → Story → Enabler hierarchy in specs
- Sprint cycles with velocity tracking (or Bolts — see below)
- Evidence-based delivery with Linear integration
- Specs-driven workflow - BSA plans, developers execute
Program Cadence: SAFe x AI-DLC
SAFe gives this harness its structure. But SAFe's cadence assumes human squads on week-long sprints, and agent teams do not move at that speed — a team of specialized agents can elaborate, build, and verify a unit of work in hours.
So the harness also ships the SAFe x AI-DLC fusion: SAFe keeps the hierarchy, WSJF, role boundaries, and Definition of Done; AWS's AI-Driven Development Life Cycle supplies the cadence and the human checkpoint. In a program that adopts the fusion, the Bolt takes the sprint's place. Adoption is per-program; the standard sprint path stays valid.
Inside such a program, each concept below stands in for its SAFe counterpart:
| Concept | Stands in for | Definition |
|---|---|---|
| Bolt | The sprint | An hours-to-days swarm with an entry gate and a hard exit. Exits on evidence, not a date. |
| Unit of Work | The Feature | One coherent outcome. A project in the tracker. |
| Mob Elaboration | Sprint planning | Decompose, list unknowns, ask questions — before writing any code. |
| The loop | The stand-up | AI plans → AI asks → human validates business context → AI executes. |
The human validation step is not optional. Agents own the build; humans own the judgment — secrets, security policy, branch protection, risk thresholds, and signing the Definition of Done always route to a human with options and a recommendation.
Using It
| Resource | Purpose |
|---|---|
| Methodology guide | Read this first — vocabulary, worked example, when not to use a Bolt |
safe-ai-dlc skill | The method encoded for agents (Claude, Gemini, portable; Cursor as a rule) |
| Program template | Scaffolding for a new program document |
linear-sop skill | Program structure: initiative → project → milestone → issue |
Use it when work spans many issues and needs cadence — turning an audit, epic, or initiative into
an executable program. For a single ticket, the standard safe-workflow path is correct. And if the
problem space is still unclear, run a spike instead: forcing an ambiguous epic into one Bolt just
relocates the ambiguity into the code.
Knowledge Vault
Agent teams need a shared map of the system, and a map nobody can prove is current will quietly
become wrong. The knowledge-vault/ subsystem is an evidence-verified knowledge base: every
concept records the commit its claims were checked against, so staleness is something you
compute, not something you feel.
Built on Open Knowledge Format v0.1 (Google, Apache-2.0), which gives portability. This harness adds the rigor layer that gives trust: a strict frontmatter contract, a zero-dependency validator, an anti-hallucination link rule, and a drift mechanism.
In the project this method came from, an independent architecture audit called the vault "the single strongest KT asset in the repo" and told new developers to trust it over the project's own canonical context file — because the vault's claims were verified against a SHA and the canonical file's had silently drifted.
Run It
| Prompt | Who it is for |
|---|---|
| BUILD-PROMPT.md | Every adopter — the generic multi-agent build prompt. Fill in your project, taxonomy, and watch-list, then run it. |
| SAW-VAULT-BUILD.md | This repo's maintainers — pre-scoped to {{PROJECT_SHORT}} and runnable as-is, with a ready-to-file ticket breakdown. |
# Prove the tooling works before you trust it
node knowledge-vault/scripts/validate-vault.mjs --vault knowledge-vault/templates/starter-bundle
| Resource | Purpose |
|---|---|
| Knowledge Vault README | Start here — 30-second quickstart |
| Guide | The method, and why each rule exists |
| Adoption Playbook | Steps, taxonomy choice, CI gating, ticket breakdown |
| Obsidian Guide | Graph, canvases, Bases, and the config treaty |
vault-sync skill | Drift detection and repair (Claude, Gemini, portable; Cursor as a rule) |
The reading layer
Because an OKF bundle is a directory of plain markdown, Obsidian opens it with no conversion
step, and that is where the vault stops feeling like a docs folder: a graph view of the
concept graph (colour-grouped by directory, with orphans deliberately visible because an orphan is
a defect), canvases for relationships a linear document cannot show, and Bases saved
queries including a drift dashboard listing every concept whose verified_against has fallen
behind. knowledge-vault/templates/obsidian/ ships the app, graph and core-plugin config; the
canvases and Bases views ship inside the vault itself. Bases needs Obsidian 1.9+.
Obsidian is not required: no community plugins are needed, and the vault degrades to plain markdown in any editor. But the graph, canvases and dashboard are a large part of what you get.
The 11-Agent Team
| Agent | Role | When to Use |
|---|---|---|
| BSA | Requirements & specs | Starting any feature |
| System Architect | Architecture review | Significant changes |
| FE Developer | Frontend implementation | UI components |
| BE Developer | Backend implementation | API routes, server logic |
| Data Engineer | Database & migrations | Schema changes |
| QAS | Quality assurance | Test validation |
| Security Engineer | Security validation | RLS, vulnerability checks |
| Tech Writer | Documentation | Guides, technical content |
| DPE | Data provisioning | Test data, seeds |
| RTE | Release coordination | CI/CD, deployments |
| TDM | Coordination | Blockers, escalation |
See AGENTS.md for complete reference with invocation examples.
Domain Adaptation Guide
The harness patterns work beyond software engineering:
Marketing Team Example
| SWE Concept | Marketing Adaptation |
|---|---|
| BSA (specs) | Campaign Brief Writer |
| Code Review | Asset Review |
/pre-pr | /pre-launch |
| Pattern Library | Brand Guidelines |
Research Team Example
| SWE Concept | Research Adaptation |
|---|---|
| User Stories | Research Questions |
| Test Cases | Validation Criteria |
| CI/CD | Peer Review Pipeline |
| Documentation | Literature Notes |
What Makes This Different
Round Table Philosophy
Human and AI input have equal weight. No hierarchy, just expertise.
Stop-the-Line Authority
Any agent can halt work for architectural or security concerns.
Pattern Discovery Protocol
"Search First, Reuse Always, Create Only When Necessary"
Evidence-Based Delivery
All work requires verifiable evidence. No "trust me, it works."
vNext Workflow Contract (v1.4)
Note from the Author: It became apparent early on that some of the autonomy and alignment we'd lost in our original harness was not going to work. This re-introduces strong solo and larger orchestration hats with selection criteria. Gates for QAS cover all scenarios.
Complete Agent Flow
┌─────────────────────────────────────────────────────────────────────────────────────────┐
│ SAFe AGENTIC WORKFLOW - vNext │
└─────────────────────────────────────────────────────────────────────────────────────────┘
┌──────────────┐
│ USER/POPM │
│ Creates │
│ Linear │
│ Tic
Files in the repo
- .agents
- .claude
- .codex
- .cursor
- .gemini
- .github
- agent_providers
- dark-factory
- docs
- examples
- knowledge-vault
- linting_configs
- patterns
- patterns_library
- project_workflow
- scripts
- specs_templates
- templates
- tests
- .env.template
- .geminiignore
- .gitignore
- .harness-manifest.schema.json
- .harness-manifest.yml
- .markdownlint.json
- .nvmrc
- AGENTS.md
- CITATION.bib
- CITATION.cff
- CLAUDE.md
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- HARNESS_CHANGELOG.yml
- LICENSE
- NOTICE
- README.md
- SECURITY.md
- TEMPLATE_SETUP.md
Discussion (0)
Ask about usage, or say what you built with itSign in to join the discussion.
No comments yet. Be the first to say what this is good for.
More harnesses
from vibe coding to agentic engineering - practice makes claude perfect
🌊 The original agent meta-harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
Practical patterns, starters & CLI tools for loop engineering with AI coding agents. Design systems that prompt and orchestrate agents (inspired by Addy Osmani and Boris Cherny). Includes loop-audit, loop-init, loop-cost.
Git. Ship. Done - Core

The most RAM efficient harness