# Agent Rig — Multi-Provider AI Software Engineering Harness — Complete AI & LLM Reference Corpus (`llms-full.txt`) - Repository: https://github.com/mohan-n-swamy/agent-rig-public - Web Discovery URL: https://mohan-n-swamy.github.io/repos/agent-rig-public/ - License: MIT - Keywords: ai-agents, agent-harness, claude-code, devops, git-hooks, multi-agent, context-engineering, developer-tools, dotfiles, open-source --- ## File: `AI-README.md` — AI-README.md --- 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. 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. 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 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. 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 `. 3. Add your own project hooks and scheduled checks to `mechanisms.json` and validate with `python3 bin/mechanism-audit.py`. - 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` --- ## File: `.env.example` — Environment Contract (.env.example) ```ini AGENT_BOARD_DIR=~/.local/share/agent-board AGENT_HOST_LABEL=workstation AGENT_HARNESS_LABEL=claude-code ALLOWED_GITHUB_OWNER=your-github-username ``` --- ## File: `AGENTS.md` — AGENTS.md # AGENTS.md — Agent Rig — Multi-Provider AI Software Engineering Harness Read this file first before modifying `agent-rig-public`. ## Purpose 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. ## Commands ```bash python3 bin/mechanism-audit.py --manifest mechanisms.example.json bash wrong-hub-preventer/test/run.sh pytest -q tests/ ``` ## Module Map - `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 ## Invariants 1. Keep all organization names, credentials, domains, and thresholds in `.env` or external config files. Never hardcode company names, host IPs, or secrets in source files. 2. Deterministic business logic belongs in code and lookup tables, not inside LLM prompts. 3. Update `docs/HLD.md`, `docs/LLD.md`, and `.env.example` in the same commit whenever an interface or environment variable changes. 4. Run the repository smoke check and secret scan before opening a pull request. --- ## File: `docs/PRD.md` — Product Requirements Document (docs/PRD.md) # Product Requirements Document — Agent Rig — Multi-Provider AI Software Engineering Harness 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. ## 1. Problem 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. ## 2. Users and Jobs-to-be-Done | Persona | Job-to-be-Done | |---|---| | Multi-Provider AI Engineer | Share one canonical `AGENTS.md` and pre-commit gate across Claude Code, Codex, Grok, Cursor, and Antigravity. | | Consultant / Dual-Account Developer | Physically block pushing work-account commits to a personal GitHub remote (`wrong-hub-preventer`). | | Multi-Agent / Multi-Host Operator | Coordinate laptop and Linux worker agents through an append-only, `flock`-safe `BOARD.md` status log. | ## 3. Core 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`). ## 4. Configurable Inputs Adopters configure the system for their own organization without editing core application logic: | Variable | Default / Example | Purpose | |---|---|---| | `AGENT_BOARD_DIR` | `~/.local/share/agent-board` | Directory storing BOARD.md and its flock lockfile | | `AGENT_HOST_LABEL` | `workstation` | Machine identifier stamped on board lines | | `AGENT_HARNESS_LABEL` | `claude-code` | Agent harness label stamped on board lines | | `ALLOWED_GITHUB_OWNER` | `your-github-username` | Default GitHub user/org written into .allowed-remotes | ## 5. Phasing and Stability Exit Criteria 1. **Phase 1 (Local Synthetic Run):** Clone the repository, copy `.env.example` to `.env`, and run the quickstart commands against synthetic seed data. Exit criterion: smoke checks pass with zero external credentials. 2. **Phase 2 (Read-Only Shadow Wiring):** Connect read-only credentials or webhook listeners in shadow/dry-run mode. Exit criterion: 100 consecutive events or queries reconcile cleanly against source records. 3. **Phase 3 (Production Cutover):** Enable live writes, alerts, or routing behind bounded retry and idempotency guards. ## 6. Non-Goals - Shipping organization-specific business rules hardcoded in application source. - Storing credentials, personal customer records, or tenant URLs inside version control. - Replacing deterministic validation or arithmetic with unconstrained model prompts. --- ## File: `docs/PR-FAQ.md` — Working-Backwards PR-FAQ (docs/PR-FAQ.md) # Working-Backwards PR-FAQ — Agent Rig — Multi-Provider AI Software Engineering Harness **Release Summary:** `agent-rig-public` gives engineering and operations teams a self-hosted, open-source implementation of Agent Rig — Multi-Provider AI Software Engineering Harness that configures via `.env` and runs on standard infrastructure in minutes. ## Press Release Operations and engineering teams often rebuild the same internal workflows behind closed doors or pay per-seat SaaS markups for rigid tools that cannot match their field reality. `agent-rig-public` open-sources a battle-tested implementation of Agent Rig — Multi-Provider AI Software Engineering Harness, stripped of all single-company assumptions and packaged with clear adapter boundaries, synthetic demo data, and machine-readable agent documentation. Any team can fork `agent-rig-public`, supply their own `.env` inputs and taxonomy config, and deploy locally or in production with Docker, Python, or Node. AI coding assistants such as Claude Code, Codex, and Cursor can read `AI-README.md` and `llms.txt` to wire custom ERP, CRM, or warehouse adapters in a single session. ## External Adopter FAQ **Q1: How long does it take to run locally after cloning?** Under five minutes. Copy `.env.example` to `.env` and run the quickstart commands in `README.md`. Synthetic fixtures let you inspect the workflow before connecting live credentials. **Q2: Do I need to rewrite source files to use my own company name, channels, or rules?** No. Organization names, endpoints, thresholds, and credentials sit in `.env` and declarative config files. External system specifics live behind narrow adapter modules documented in `docs/LLD.md`. **Q3: What license governs this repository?** MIT License. You can fork, modify, self-host, and use it commercially without restriction. ## Internal Engineering & Security FAQ **Q4: How do we prevent tenant or employer data from ever entering a public fork?** The repository starts from a clean git history, excludes raw exports and binary dumps, validates every commit through `gitleaks`, and ships only synthetic fixtures. **Q5: What happens when an upstream API or model provider is slow or unavailable?** Inbound webhooks persist raw payloads before processing, outbound writes carry idempotency keys with bounded exponential backoff, and model-backed paths fail open to deterministic rules or explicit human queues. --- ## File: `docs/HLD.md` — High-Level Design (docs/HLD.md) # High-Level Design (HLD) — Agent Rig — Multi-Provider AI Software Engineering Harness 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. ## 1. System Topology ```mermaid flowchart LR Core["core/AGENTS.template.md"] --> Harnesses["Claude Code · Codex · Grok · Cursor"] Commit["git commit"] --> PreCommit["golden-rules/doctrine-check.sh --staged"] Push["git push"] --> PrePush["wrong-hub-preventer/hooks/pre-push"] Agents["Laptop + Server Agents"] -->|"flock append"| Board["board/BOARD.md"] Audit["bin/mechanism-audit.py"] -->|"verifies V14 loop"| Mechanisms["mechanisms.example.json"] ``` ## 2. Architectural Decisions and Rejected Alternatives | Decision | Why It Holds | Rejected Alternative | |---|---|---| | Symlinked `pre-push` + `.allowed-remotes` fail-closed | Missing `.allowed-remotes` blocks the push rather than silently allowing cross-account leaks, and hook updates propagate everywhere. | Per-repo copied hook scripts that drift | | `doctrine-check.sh --staged` scans staged diff only | Blocks new violations without firing on legacy debt in untouched files, preventing `--no-verify` bypass habits. | Whole-repo lint inside pre-commit | | Append-only flat file + `flock` for multi-agent coordination | Zero daemon, zero database, SSH-friendly, and inspectable with `tail -n 20`. | Heavyweight Redis/Postgres coordination broker | ## 3. Data Flow and Failure Boundaries 1. **Configuration Boundary:** Startup validates `.env` variables and declarative config schemas before accepting traffic or running scheduled jobs. 2. **Adapter Boundary:** External services (databases, chat channels, HRMS, warehouses, or LLM providers) sit behind explicit adapter modules so failures stay isolated and testable with local mocks. 3. **Observability and Audit:** State transitions and job executions emit structured logs and deterministic status records rather than mutating state silently. ## 4. Scaling Notes - **1x to 10x load:** Single-node Docker Compose or process supervisor handles standard team workloads with indexed database queries and bounded worker concurrency. - **First bottleneck at 10x+:** High-frequency webhook or batch ingestion queues; mitigate by separating the stateless HTTP receiver from background worker processes sharing Redis or PostgreSQL locks. --- ## File: `docs/LLD.md` — Low-Level Design & Runbook (docs/LLD.md) # Low-Level Design (LLD) & Operations Runbook — Agent Rig — Multi-Provider AI Software Engineering Harness This document defines the module responsibilities, environment contract, and operational procedures for `agent-rig-public`. ## 1. Module and File Inventory | Path | Responsibility | |---|---| | `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 | ## 2. Environment Variable Contract | Variable | Default / Example | Required | Description | |---|---|---|---| | `AGENT_BOARD_DIR` | `~/.local/share/agent-board` | Yes | Directory storing BOARD.md and its flock lockfile | | `AGENT_HOST_LABEL` | `workstation` | Yes | Machine identifier stamped on board lines | | `AGENT_HARNESS_LABEL` | `claude-code` | Yes | Agent harness label stamped on board lines | | `ALLOWED_GITHUB_OWNER` | `your-github-username` | Yes | Default GitHub user/org written into .allowed-remotes | ## 3. Extension Recipe 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 `. 3. Add your own project hooks and scheduled checks to `mechanisms.json` and validate with `python3 bin/mechanism-audit.py`. ## 4. Operations Runbook ### 1. Install git pre-push firewall into all repos under ~/work ```bash wrong-hub-preventer/bin/install --all ~/work ``` ### 2. Wire staged doctrine check into global git pre-commit ```bash git config --global core.hooksPath ~/.config/git/hooks # chain golden-rules/doctrine-check.sh --staged ``` ### 3. Post status to shared multi-agent board ```bash ./board/board-post.sh my-repo start "Beginning feature slice" ``` --- ## File: `docs/RESEARCH-2026.md` — 2026 Research & Landscape Notes (docs/RESEARCH-2026.md) # 2026 Multi-Agent Engineering Harness Research & Design Notes In 2026, teams running Claude Code, OpenAI Codex, Cursor, Grok, and background VPS agents simultaneously face **instruction bloat**, **cross-account git push accidents**, and **unwired Markdown rules** (where an audit of 213 prose rules found only 5 actually executed at a trigger). `agent-rig-public` packages the four structural fixes: 1. **One `<150-line` `AGENTS.md` Core + Ratchet:** Every line must trace to a real failure; lines made redundant by stronger models are stripped (`harness-stripping`). 2. **Fail-Closed Git Account Firewall (`wrong-hub-preventer`):** Symlinked `pre-push` hook requiring an explicit `.allowed-remotes` owner manifest per repository. 3. **Staged-Only Doctrine Gate (`doctrine-check.sh --staged`):** Blocks new technical debt (float currency, word-typed status columns, unescaped `innerHTML`, hardcoded keys) on staged lines without false-blocking legacy files. 4. **V14 Closed-Loop Mechanism Audit (`bin/mechanism-audit.py`):** Verifies every declared rule has a tool, live trigger adoption, failure inspection, and retirement cadence.