Skip to content

Spec: GitFactory-Managed Agentic Orchestration

  • ID: 037-gitfactory-orchestration
  • Status: shipped
  • Owner: @bamr87
  • Created: 2026-08-17
  • Roadmap Epic: constitution §11 continuous evolution — automate the agentic half of the loop
  • Constitution Compliance: confirmed against docs/constitution.md

1. Problem & Motivation

The AO-SDLC's deterministic half is automated (evolve.yml appends audit findings weekly), but its agentic half is manual: the tracking issue asks a human to "run /evolve". This spec adopts GitFactory (the sibling gitorio repo) as the build/management tool for that agentic half: governed agent lines defined as blueprints, compiled to workflows with computed least-privilege grants, loop guards, and default-OFF kill switches.

2. Origin & Background

  • Backlog items claimed: BL-20260817-06 (moved to ## Claimed, annotated claimed-by:specs/037-gitfactory-orchestration).
  • Cross-repo origin: gitorio specs/002-law-ai-factory (the generator side); this spec is the law-ai side of the same change.

3. Goals

  • G1: Three governed agent lines exist as generated artifacts under .factory/ + .github/workflows/factory--*.yml, never hand-edited.
  • G2: Every line is default-OFF; arming is an explicit human variable flip.

4. Non-Goals

  • NG1: Replacing ci.yml, evolve.yml, nightly-tests.yml, or the claude.yml mention handler.
  • NG2: Arming any line in this change.

5. User Stories

  • As the maintainer, I want the weekly audit's "next step" executed by a rate-limited agent that ends in one reviewable PR, so that the backlog drains without babysitting.

6. Functional Requirements

  • FR-1: factory--evolve-pilot.yml — weekly cron + plan-first manual → EVOLVE_PILOT_ENABLED gate → rate limit 1/day → Claude agent (prompt .factory/prompts/evolve-pilot.md) → opens one PR; no merge capability.
  • FR-2: factory--backlog-triage.yml — monthly cron + manual → BACKLOG_TRIAGE_ENABLED gate → agent applying the backlog-triager verdicts append-only → one reconciliation PR.
  • FR-3: factory--issue-concierge.yml — on issues: opened → ISSUE_CONCIERGE_ENABLED gate → agent → existing-labels-only labeling + ONE marker-deduped comment; bot-guarded.
  • FR-4: All three carry the ⚙ GENERATED BY GITFACTORY header + blueprint hash; the blueprints are the source of truth.

7. Non-Functional Requirements

  • NFR-SEC-1: Grants are compiler-derived ceilings: pilot/triage get file tools + git verbs + gh pr create and NO gh pr merge; concierge gets issue comment/label verbs only.
  • NFR-HITL-1: Human-in-the-loop preserved everywhere: default-OFF switches, PR-only outputs, and prompts embedding the constitution's stop conditions (licensing / data sources / model swaps / destructive migrations / HITL gates ⇒ surface, never guess).
  • NFR-AUDIT-1: Runs are ordinary Actions runs (auditable); comments carry the <!-- factory-concierge --> marker for dedup and attribution.

8. Data Model Impact

None — no Neo4j/Postgres/vector changes; the lines touch repo files and issues only.

9. API Surface

None — no FastAPI/Django routes change.

10. Agent / Crew Impact

No agents_runtime crew changes. Three operational agents (Claude Code via anthropics/claude-code-action@v1, the sanctioned surface per AGENTS.md § Development Orchestration) run under existing repo secrets (CLAUDE_CODE_OAUTH_TOKEN first, ANTHROPIC_API_KEY fallback — the claude.yml house expression).

11. LegalBench Impact

  • Tasks affected: none (no product-runtime model path changes).
  • Expected delta: 0 pp.

12. Acceptance Criteria

  • AC-1: All three workflows contain their vars.*_ENABLED gate and the generated header + hash.
  • AC-2: The concierge workflow contains the actor-based bot guard (github.event.sender.type != 'Bot').
  • AC-3: No factory workflow grants gh pr merge.
  • AC-4: python3 scripts/spec_validator.py and python3 scripts/backlog_lint.py pass with this spec + BL entry in place.

13. Out of Scope / Follow-ups

  • A scoped verification grant so factory agents can run the two stdlib validators in-line (today CI on the PR is the arbiter) — mirrored to BACKLOG.
  • Modeling the deterministic evolve.yml audit itself as a compiled factory line.