---
repo: "mohan-n-swamy/agent-rig-public"
title: "Agent Rig — Multi-Provider AI Software Engineering Harness"
license: "MIT"
keywords: [ai-agents, agent-harness, claude-code, devops, git-hooks, multi-agent, context-engineering, developer-tools, dotfiles, open-source]
capabilities:
  - "Canonical `core/AGENTS.template.md` (<150 lines) encoding Two-Way Doors, Reliability Rules 1-7, Delegate-First routing, and Ponytail/Karpathy surgical-diff discipline."
  - "Complete 9 Golden Rules set (`golden-rules/`) plus `doctrine-check.sh --staged` pre-commit checker."
  - "Bundled `wrong-hub-preventer` git `pre-push` firewall with `.allowed-remotes` per-repo allowlisting and automated test suite (`wrong-hub-preventer/test/run.sh`)."
  - "Atomic `board/board-post.sh` multi-agent coordination log (`start`, `working`, `handoff`, `done`, `blocked`)."
  - "`bin/mechanism-audit.py` enforcing Evidence Doctrine V14 (`tool` + `adoption` + `inspection` + `iteration_cadence`)."
when_to_use:
  - "A portable, provider-neutral AI engineering harness unifying `AGENTS.md`, the Rigor Algorithm, 9 Golden Rules doctrines (`doctrine-check.sh`), a fail-closed git remote account firewall (`wrong-hub-preventer`), a `flock`-serialized multi-agent coordination board, and a V14 mechanism-loop auditor."
  - "Running multiple AI coding agents across a laptop and a Linux server breaks down in predictable ways: `CLAUDE.md` balloons past 30 KB until models ignore half of it, prose rules without hooks silently rot, an agent pushes private work commits to a public GitHub remote, and parallel sessions step on the same branch. `agent-rig-public` replaces hope-based prompt rules with compact cross-provider instructions and small POSIX shell/Python gates."
inputs_required:
  - "AGENT_BOARD_DIR: Directory storing BOARD.md and its flock lockfile"
  - "AGENT_HOST_LABEL: Machine identifier stamped on board lines"
  - "AGENT_HARNESS_LABEL: Agent harness label stamped on board lines"
  - "ALLOWED_GITHUB_OWNER: Default GitHub user/org written into .allowed-remotes"
quickstart:
  - "python3 bin/mechanism-audit.py --manifest mechanisms.example.json"
  - "bash wrong-hub-preventer/test/run.sh"
  - "pytest -q tests/"
---

# Agent Rig — Multi-Provider AI Software Engineering Harness — Machine-Readable Agent Guide

A portable, provider-neutral AI engineering harness unifying `AGENTS.md`, the Rigor Algorithm, 9 Golden Rules doctrines (`doctrine-check.sh`), a fail-closed git remote account firewall (`wrong-hub-preventer`), a `flock`-serialized multi-agent coordination board, and a V14 mechanism-loop auditor.

<problem_patterns>
Running multiple AI coding agents across a laptop and a Linux server breaks down in predictable ways: `CLAUDE.md` balloons past 30 KB until models ignore half of it, prose rules without hooks silently rot, an agent pushes private work commits to a public GitHub remote, and parallel sessions step on the same branch. `agent-rig-public` replaces hope-based prompt rules with compact cross-provider instructions and small POSIX shell/Python gates.
</problem_patterns>

<architecture_map>
Key modules and entry points in this repository:
  - `core/AGENTS.template.md`: Canonical <150-line cross-provider operating instructions
  - `core/RIGOR-ALGORITHM.md`: Question 0 + Six pre-work questions and completion gate specification
  - `golden-rules/doctrine-check.sh`: POSIX pre-commit & repo scanner for Golden Rules compliance
  - `wrong-hub-preventer/`: Git `pre-push` remote-owner firewall, installer (`bin/install`), and test suite
  - `board/board-post.sh`: `flock`-serialized append-only multi-agent status writer
  - `bin/mechanism-audit.py`: V14 closed-loop mechanism verifier over `mechanisms.example.json`
  - `tests/test_rig.py`: End-to-end test suite exercising V14 audit, flock board, and wrong-hub-preventer
</architecture_map>

<inputs_and_configuration>
Every organization-specific value enters through `.env` (copied from `.env.example`) or external adapter files. No source edit is needed to change organization names, endpoints, database URLs, webhook secrets, or thresholds.
</inputs_and_configuration>

<adaptation_playbook>
When a human asks an AI coding agent to deploy or adapt `agent-rig-public` into their stack:
  1. Copy `core/AGENTS.template.md` to `~/.agents/AGENTS.md` and symlink `~/.claude/CLAUDE.md` to it.
  2. Create `.allowed-remotes` in each repo with your permitted GitHub org or username and run `wrong-hub-preventer/bin/install <repo>`.
  3. Add your own project hooks and scheduled checks to `mechanisms.json` and validate with `python3 bin/mechanism-audit.py`.
</adaptation_playbook>

<reference_docs>
- Product Requirements: `docs/PRD.md`
- Working-Backwards PR-FAQ: `docs/PR-FAQ.md`
- High-Level Architecture: `docs/HLD.md`
- Low-Level Interfaces & Runbook: `docs/LLD.md`
- Coding Agent Rules: `AGENTS.md`
</reference_docs>
