Sandbox
@bybren-llc/safe-agentic-workflow

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.

407 stars88 forksShellUpdated 1mo ago
Who it's for

Builders who want their agent team to follow the same workflow across multiple tools.

What it delivers

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

  1. 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
  2. 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

Version License Template Ready Tests DeepWiki

Agents Skills Commands Cursor Rules

Supported AI Providers
Claude Code Gemini CLI Codex CLI Cursor IDE

Template Repository - Click "Use this template" above to create your own AI agent harness. After cloning, run bash scripts/setup-template.sh to 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

  1. Run bash scripts/setup-template.sh to customize placeholders
  2. Read the Getting Started Guide for the full walkthrough
  3. Run /start-work on 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

CommandPurpose
/start-workBegin ticket with proper workflow
/pre-prValidate before pull request
/end-workComplete session cleanly
/check-workflowQuick 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

Complete Setup Guide

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:

FeatureGemini CLIClaude Code
Shell Injection!{command} - Execute shell, inject output into promptVia Bash tool only
File Injection@{file} - Inject file contents into promptsVia Read tool only
Built-in SandboxGoogle Cloud sandboxingMCP sandboxing
Model OptionsGemini 3 Flash, Gemini 3.1 Pro PreviewClaude Opus, Sonnet, Haiku
Command FormatTOMLYAML + Markdown
Namespaced Commands/workflow:start-work/start-work
Hookssettings.json hooks sectionhooks-config.json
MCP Serverssettings.json mcpServerssettings.local.json
Hook Migrationgemini hooks migrate --from-claudeN/A
Plan Mode/plan command, plan-then-executeN/A
Policy EngineYAML policies, seatbelt profilesN/A
Browser AgentBuilt-in experimental agentMCP (claude-in-chrome)
ExtensionsBundled skill/MCP/command packagesN/A
Checkpointing/restore session recoveryN/A
Audio/VideoNative 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

ActionClaude CodeGemini 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


Implementing Anthropic's Research

This harness directly implements patterns from Anthropic's engineering papers:

PaperWhat We Implement
Building Effective Agents11-agent team structure
Effective HarnessesThree-layer architecture
Agent Skills20 model-invoked skills
Skills AnnouncementSkills 2.0 frontmatter, trigger patterns
Code Execution with MCPTool 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 RoleAgentResponsibility
Business Systems AnalystBSARequirements, acceptance criteria
System ArchitectSystem ArchitectArchitecture decisions, ADRs
Product OwnerPOPM (human)Final approval on deliverables
Scrum MasterTDMCoordination, blocker escalation
Release Train EngineerRTECI/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:

ConceptStands in forDefinition
BoltThe sprintAn hours-to-days swarm with an entry gate and a hard exit. Exits on evidence, not a date.
Unit of WorkThe FeatureOne coherent outcome. A project in the tracker.
Mob ElaborationSprint planningDecompose, list unknowns, ask questions — before writing any code.
The loopThe stand-upAI 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

ResourcePurpose
Methodology guideRead this first — vocabulary, worked example, when not to use a Bolt
safe-ai-dlc skillThe method encoded for agents (Claude, Gemini, portable; Cursor as a rule)
Program templateScaffolding for a new program document
linear-sop skillProgram 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

PromptWho it is for
BUILD-PROMPT.mdEvery adopter — the generic multi-agent build prompt. Fill in your project, taxonomy, and watch-list, then run it.
SAW-VAULT-BUILD.mdThis 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
ResourcePurpose
Knowledge Vault READMEStart here — 30-second quickstart
GuideThe method, and why each rule exists
Adoption PlaybookSteps, taxonomy choice, CI gating, ticket breakdown
Obsidian GuideGraph, canvases, Bases, and the config treaty
vault-sync skillDrift 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

AgentRoleWhen to Use
BSARequirements & specsStarting any feature
System ArchitectArchitecture reviewSignificant changes
FE DeveloperFrontend implementationUI components
BE DeveloperBackend implementationAPI routes, server logic
Data EngineerDatabase & migrationsSchema changes
QASQuality assuranceTest validation
Security EngineerSecurity validationRLS, vulnerability checks
Tech WriterDocumentationGuides, technical content
DPEData provisioningTest data, seeds
RTERelease coordinationCI/CD, deployments
TDMCoordinationBlockers, escalation

See AGENTS.md for complete reference with invocation examples.


Domain Adaptation Guide

The harness patterns work beyond software engineering:

Marketing Team Example

SWE ConceptMarketing Adaptation
BSA (specs)Campaign Brief Writer
Code ReviewAsset Review
/pre-pr/pre-launch
Pattern LibraryBrand Guidelines

Research Team Example

SWE ConceptResearch Adaptation
User StoriesResearch Questions
Test CasesValidation Criteria
CI/CDPeer Review Pipeline
DocumentationLiterature 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

Repository payload38 top-level entries
  • .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 it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More harnesses

affaan-m/
ECC
affaan-m/ECCHarnesses

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

258k
ruvnet/rufloHarnesses

🌊 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

72k

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.

11k