Cross-Provider Portability — One Harness, Many Agents

Lesson 7 · Safe Agentic Workflows · ~10 minutes

You're using Kiro, Claude Code, and Codex. Tomorrow you might add Gemini CLI or open a file in Cursor. The three-layer architecture (Hooks → Commands → Skills) doesn't belong to any single tool — it's a pattern that maps across all of them.

This lesson shows how the SAW harness implements the same workflow patterns for four different AI coding tools — and how you can make your own harness portable.

The Portability Problem

Every AI coding agent has the same three concepts:

  1. Hooks — automatic guardrails that fire on events
  2. Commands — user-invoked workflow steps
  3. Skills — domain expertise the model loads contextually

But they all use different config formats, different directory conventions, and different invocation syntax. If you build your workflow for one tool, switching costs you a rewrite — unless you design for portability from the start.

The SAW harness solves this by maintaining parallel provider directories with the same logical content adapted to each tool's native format. Your workflows stay the same; only the encoding changes.

How SAW Maps the Three Layers Across Providers

Claude Code

.claude/

Gemini CLI

.gemini/

Codex CLI

.codex/

Cursor IDE

.cursor/rules/

The Full Comparison

Aspect Claude Code Gemini CLI Codex CLI Cursor IDE
Config Format JSON + Markdown JSON + TOML TOML YAML frontmatter + Markdown (.mdc)
Hooks hooks-config.json settings.jsonhooks key config.toml → approval policy Glob-matched rules (always-apply)
Commands /start-work /workflow:start-work Natural language prompt @rule-name
Skills Location .claude/skills/*/SKILL.md .gemini/skills/*/SKILL.md .agents/skills/*.md .cursor/rules/10-*.mdc
Skill Activation Skills 2.0 frontmatter triggers Frontmatter triggers Agent discovers on context Glob pattern in YAML frontmatter
Hook Migration N/A (primary format) gemini hooks migrate --from-claude Manual translation Manual translation

Command Syntax Differences

The same workflow action has different invocation syntax per provider:

Action Claude Code Gemini CLI Codex CLI
Start work on ticket /start-work PROJ-123 /workflow:start-work PROJ-123 "Start work on PROJ-123"
Pre-PR validation /pre-pr /workflow:pre-pr "Run pre-PR checks"
Local sync /local-sync /local:sync "Sync local environment"
Remote deploy /remote-deploy /remote:deploy "Deploy to remote"

Gemini CLI uses namespaced commands (/namespace:command) while Claude Code uses flat names (/command). Codex doesn't have slash commands at all — you describe what you want in natural language and it discovers the right skill.

The Shared .agents/skills/ Directory

Cross-Provider Skills

SAW maintains a shared .agents/skills/ directory at the repository root. This is the canonical source for skills that work across providers. Codex reads it directly; other providers have their own copies adapted to their format.

This is where your core domain expertise lives — API patterns, workflow logic, safe coding guidelines — in a format any agent can consume.

The directory contains 18 skills covering patterns like:

Each provider-specific directory (.claude/skills/, .gemini/skills/) adapts these for its native format. The shared directory is the source of truth.

Hook Mechanisms Compared

Claude Code: hooks-config.json

Declarative JSON. Hooks fire on lifecycle events (PreToolUse, PostToolUse, etc.) and can block actions.

{
  "hooks": {
    "PreCommit": [
      {
        "command": "bash scripts/pre-commit-check.sh",
        "blocking": true
      }
    ]
  }
}

Gemini CLI: settings.json hooks section

Similar lifecycle model but lives inside the broader settings file alongside model config and MCP servers.

{
  "hooks": {
    "pre_commit": {
      "command": "bash scripts/pre-commit-check.sh",
      "blocking": true
    }
  },
  "model": "gemini-3-flash",
  "mcpServers": { ... }
}

Gemini also offers a dedicated migration command: gemini hooks migrate --from-claude to translate Claude's hooks-config.json into its own format.

Codex CLI: config.toml approval policy

Codex takes a different approach. Instead of event-based hooks, it uses an approval policy that controls what the agent can do without asking:

[approval]
# "suggest" = always ask, "auto-edit" = allow file edits, "full-auto" = allow everything
mode = "auto-edit"

[sandbox]
enabled = true
network = false

The sandbox and approval modes serve the same purpose as hooks — constraining agent behavior — but expressed as a policy rather than event listeners.

Cursor IDE: Glob-Activated Rules

Cursor uses .mdc files with YAML frontmatter that activates rules based on file patterns:

---
description: Enforce commit message format
globs: ["**/*.ts", "**/*.tsx"]
alwaysApply: true
---

# Git Commit Rules
All commits must reference a ticket number...

Rules numbered 00-02 are "always apply" (equivalent to hooks). Higher numbers activate contextually.

Migration Path: Adding Claude Code to Your Kiro Harness

Your ~/Developer/agent-workflow/ is currently Kiro-only. Adding Claude Code support means creating a .claude/ directory alongside your existing .kiro/. Here's what that looks like:

~/Developer/agent-workflow/ ├── .kiro/ │ └── steering/ │ ├── your-existing-rules.md │ └── ... ├── .claude/ │ ├── hooks-config.json ← translate your Kiro hooks │ ├── commands/ │ │ ├── start-work.md ← encode your workflow │ │ ├── pre-pr.md │ │ └── end-work.md │ └── skills/ │ └── your-domain/SKILL.md ← port your steering files ├── .agents/ │ └── skills/ │ └── shared-patterns.md ← cross-provider skills └── src/

The migration steps:

  1. Map your steering files to skills. Kiro steering files (always-included markdown with frontmatter) become Claude Code skills with Skills 2.0 frontmatter triggers.
  2. Create hooks-config.json. Any constraints in your Kiro setup that should be enforced (not just suggested) become hooks.
  3. Encode repeatable workflows as commands. Any multi-step process you find yourself explaining to Kiro repeatedly becomes a .claude/commands/*.md file.
  4. Extract shared skills to .agents/skills/. Skills that aren't provider-specific go in the shared directory so Codex (and future tools) can discover them too.
Start small

You don't need to port everything at once. Start with your most-used workflow (probably /start-work) and one skill. Expand as you use Claude Code more.

Key Takeaways

Check Your Understanding

Where do Gemini CLI custom commands live?
Correct — Gemini CLI uses TOML-formatted command files in .gemini/commands/. The settings.json handles hooks and model config, while GEMINI.md is the system prompt.
Gemini CLI commands live in .gemini/commands/*.toml. They use TOML format (unlike Claude Code's Markdown commands). The settings.json holds hooks and config, not commands.
What is the .agents/skills/ directory for?
Right — .agents/skills/ is the canonical cross-provider source of truth for domain expertise. Codex reads it directly; other providers maintain adapted copies in their own directories.
The .agents/skills/ directory is the shared, cross-provider skills source. It holds domain expertise in a format any tool can consume. Codex reads it natively; Claude Code has its own copy in .claude/skills/.
Which provider uses .mdc files with YAML frontmatter for its rules and skills?
Exactly — Cursor uses .mdc files in .cursor/rules/ with YAML frontmatter that specifies glob patterns for activation. It's a unique format not shared by the other providers.
Cursor IDE uses .mdc files (Markdown with YAML frontmatter) in .cursor/rules/. Claude uses plain Markdown, Gemini uses TOML for commands and JSON for settings, and Codex uses TOML config.

What's Next

You now understand how to structure your agent harness for portability across providers. The next lesson covers harness sync and versioning — how to keep your local harness up-to-date with upstream changes without losing your customizations.

Primary Source

SAW — SAFe Agentic Workflow (GitHub) — the multi-provider reference implementation. Pay attention to the Repository Structure section and the parallel .claude/, .gemini/, .codex/, .cursor/ directories.

Questions? Ask me about porting specific Kiro steering files to Claude Code skills, Gemini command syntax, or how to set up the shared skills directory for your project.
← Back Next →