ADW Pipeline System

System Specification Briefing — 2026-03-07 | Internal Infrastructure
Pipeline Stable 15 Issues / 100% Closed 22 Repos Allowed 5 Decision Points Open

Performance Baseline

15
Issues Processed
100%
Completion Rate
22
Allowed Repos
3
Active Client Repos
270
Test Suite Size
~7.5
Avg Comments/Issue
Issue Classification Distribution

Pipeline Architecture

The ADW pipeline is a GitHub webhook-driven CI/CD automation system. It receives GitHub issue/comment events, queues them in Redis, and dispatches Claude CLI workers that autonomously plan, implement, test, and PR code changes.

End-to-End Pipeline Flow

Infrastructure Stack

ComponentConfigNotes
Process ManagerPM2: agent-hook-workerAuto-restart on failure
Reverse ProxyCaddy (root-owned)HTTPS termination
QueueRedis on port 6383Issue-level dedup via SETNX
APIFastAPI on port 8200Webhook receiver
Repo Allowlist22 repos (manual)Curated by config.py

Trigger Mechanisms

/adw Comment

Comment /adw on any issue in an allowed repo. Event: issue_comment.created

adw-* Label

Apply any label prefixed adw- to an issue. Event: issues.labeled

/adw in Body

Open a new issue with /adw in the body text. Event: issues.opened

11-Step Pipeline Sequence

Each issue flows through a rigid 11-step pipeline. The compliance layer (Step 9c) self-retriggers on PARTIAL/FAIL results. The safety gate (Step 9e) validates all changes before PR creation.

Pipeline Step Sequence
Classify
Branch
Plan
Implement
Validate
Safety Gate
PR

Key Modules & Templates

Core Modules

ModulePurpose
adw_pipeline.pyPipeline orchestration, step sequencing, output extraction
worker.pyJob processing, issue-level dedup (Redis SETNX), cleanup
agent.pyClaude CLI invocation, JSONL parsing, template execution
safety_gate.pyPre-PR 3-tier validation (forbidden files, diff size, secrets)
preflight.pyRepo prep, build step, submodule handling
config.pyMulti-repo routing, workdir resolution, env vars
github_ops.pyGitHub API calls (issue fetch, comments)
webhook.py / main.pyFastAPI webhook endpoint

Convention Files (Per-Repo Opt-In)

.adw-tests.json

Custom test command override

.adw-build.json

Build step configuration

.adw-security.json

Security scan patterns

_handoff.json NEW

CSA-to-ADW handoff manifest

Templates (.claude/commands/)

TemplatePurpose
bug.md, feature.md, chore.mdPlanning templates (per issue type)
implement.mdImplementation with scope discipline
commit.mdCommit with submodule push
pull_request.mdPR creation (8 positional args)
compliance_check.mdPost-implementation verification
frontend_handoff.mdVisual validation handoff

Safety Gate Architecture

Step 9e implements a 3-tier validation gate that blocks PR creation if any tier fails. This is the last checkpoint before code reaches the PR stage.

3-Tier Safety Gate
Tier 1: Forbidden Files

Blocks modifications to protected infrastructure files (PM2 configs, Caddy, systemd).

Tier 2: Diff Size Check

Flags oversized diffs that may indicate scope creep or unintended changes.

Tier 3: Secrets Scan

Detects API keys, tokens, passwords, and other secrets in the diff.

Strategic Decisions

Five architectural decision points for future ADW scaling. All have recommendations — confirm or adjust via the input form.

D1: Should the pipeline support batched issue processing?
Recommended: Option A — Single-issue (current)
Throughput is not a bottleneck at 15 issues total. Single-issue processing keeps failures isolated and logs clean. Batching adds shared context contamination risk without proportionate value.
D2: How to handle implementations exceeding Claude CLI context?
Recommended: Option B — Checkpoint + Resume (v2)
Checkpoint at step boundaries and resume from last successful step. Current behavior (fail + notify) loses progress. Decomposition into sub-issues (Option C) requires issue graph logic — a future consideration.
D3: What retry/backoff strategy for GitHub API failures?
Recommended: Option B — Exponential backoff (3 retries)
Standard pattern: 1s/2s/4s delays. Current no-retry behavior is fragile on transient errors. Circuit breaker (Option C) is overkill for current scale.
D4: Should ADW auto-update CSA _handoff.json back-link?
Recommended: Option B — Auto-update manifest
ADW writes adw_issues_created array and updates status: handed-off on completion. Full traceability. GitReport can reconcile independently as a secondary check.
D5: How should the allowlist scale?
Recommended: Option B — Convention-based auto-discovery (v2)
Repos with .adw-pipeline.json auto-enroll. Allowlist becomes deny-list for exceptions. Good for current 22 repos, essential when team grows or repo count exceeds 30.

Deferred Priorities

ItemActivation TriggerBridge Strategy
DP-1: Checkpoint/Resume First context exhaustion failure Manual --resume with issue link
DP-2: Auto-Discovery Allowlist exceeds 30 repos OR team grows Manual addition (<1 minute)
DP-3: Parallel Workers Queue depth regularly exceeds 5 Not needed (current depth < 2)

Dependency Map

Decision-to-Deferred Dependencies

Phase Transition Gates

Risk Assessment

Risk Positioning (Likelihood vs Impact)
RiskLikelihoodImpactMitigation
Context exhaustion mid-implementation Medium High DP-1: Checkpoint/resume (deferred)
Redis queue corruption Low High PM2 auto-restart + queue flush script
GitHub API rate limiting Low Medium D3: Exponential backoff (recommended)
Secrets in PR diff Low Critical Safety gate Tier 3 (active)
Allowlist drift (stale repos) Medium Low Periodic audit (manual)
Appendix: CSA-to-ADW Handoff Convention

The _handoff.json manifest bridges CSA pipeline output to ADW pipeline intake. Lifecycle: draft (CSA complete) → ready (user promotes) → handed-off (ADW processes) → archived (engagement complete).

HITL constraint: CSA never auto-triggers ADW without explicit user instruction.

FieldTypePurpose
engagementstringCSA slug identifier
statusenumdraft | ready | handed-off | archived
target_repostringADW target (e.g. owner/repo)
adw_handoff_authorizedbooleanExplicit user authorization
quality_gateobjectSpec exists, artifact count, diagrams, deployment status
adw_issues_createdarrayBackfilled by ADW on completion
Appendix: Issue Timeline (All 15 Issues)
#TypeTitleCreatedComments
17PRchore: #16 — Add pre-PR safety gate2026-02-270
16IssueAdd pre-PR safety gate — validate diff size, forbidden files, secrets2026-02-278
15PRchore: #14 — Add pre-PR rebase step2026-02-270
14IssueAdd pre-PR rebase step to prevent merge conflicts2026-02-278
13PRbug: #12 — Retrigger runs produce zero commits2026-02-271
12IssueRetrigger runs produce zero commits — trigger_comment not passed2026-02-2714
11PRbug: #10 — Compliance retrigger creates duplicate branches/PRs2026-02-260
10IssueCompliance retrigger creates duplicate branches/PRs2026-02-268
9PRfeat: #8 — Add compliance layer with retrigger2026-02-260
8IssueAdd compliance layer (Step 9c) with retrigger and security2026-02-268
7PRbug: #6 — Pipeline failures: stale workers, commit timeout2026-02-250
6IssueADW pipeline failures: stale workers, commit timeout, dirty workdir2026-02-257
5IssueAdd deterministic build step (.adw-build.json convention)2026-02-206
4PRfeat: #3 — Multi-repo routing via convention + allowlist2026-02-190
3IssueMulti-repo routing via convention + allowlist2026-02-197