# joetawil7/first-pass architecture

> Architecture diagram of the GitHub repository joetawil7/first-pass, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/joetawil7/first-pass
- Repository: https://github.com/joetawil7/first-pass

## Overview

first-pass is an agent-assistance plugin for safer coding changes across one or more repositories. The main workflow is setup and repository surveying, then scoped pre-mortem and implementation, followed by independent review and evidence-based completion checks. Skills carry the agent-facing practices; a CLI and Claude Code hooks maintain workspace configuration, run approved repository hooks, and report drift. The README documents additional review, bug-class, reply-style, and session capabilities. Some runtime links are supported only by the source index; unsampled implementations are not inferred beyond those references.

Main entry points: [`scripts/hooks.mjs`](https://github.com/joetawil7/first-pass/blob/main/scripts/hooks.mjs) (Claude hooks), [`scripts/lib/drift.mjs`](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/drift.mjs) (Drift check), [`scripts/cli.mjs`](https://github.com/joetawil7/first-pass/blob/main/scripts/cli.mjs) (Setup CLI), [`scripts/lib/bridge.mjs`](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/bridge.mjs) (Repo hook runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agent_work["Agent workflows"]
  node_premortem["Pre-mortem<br/>[SKILL.md]"]
  node_fix_class["Fix bug class<br/>[SKILL.md]"]
  node_review["PR review<br/>[SKILL.md]"]
  node_ship_check["Ship check<br/>[SKILL.md]"]
  node_sharpen["Sharpen scope<br/>[SKILL.md]"]
  node_hulk["Expanded scope<br/>[SKILL.md]"]
  node_habit_words["Habit words<br/>[SKILL.md]"]
end

subgraph group_setup["Workspace setup"]
  node_setup_skill["Setup skill<br/>[SKILL.md]"]
  node_cli["Setup CLI<br/>[cli.mjs]"]
  node_survey["Repo survey<br/>[survey.mjs]"]
  node_ci["CI discovery<br/>[ci.mjs]"]
  node_fingerprint["Hook fingerprint<br/>[fingerprint.mjs]"]
end

subgraph group_session["Session runtime"]
  node_hooks["Claude hooks<br/>[hooks.mjs]"]
  node_bridge["Repo hook runner<br/>[bridge.mjs]"]
  node_drift["Drift check<br/>[drift.mjs]"]
  node_state[("Session state<br/>[state.mjs]")]
  node_shell_edits["Shell edit tracking<br/>[shell-edits.mjs]"]
  node_sharpen_gate["Scope gate<br/>[sharpen-gate.mjs]"]
  node_done_check["Done evidence<br/>[done-check.mjs]"]
  node_merge["Hook result merge<br/>[merge.mjs]"]
end

subgraph group_shared["Shared runtime"]
  node_workspace["Workspace config<br/>[workspace.mjs]"]
  node_parts["Skill recipes<br/>[parts.mjs]"]
  node_jev["Finding judge<br/>[jev.mjs]"]
  node_words["Prompt analysis<br/>[words.mjs]"]
  node_instructions["Instruction checks<br/>[instructions.mjs]"]
  node_cursor_rules["Cursor rule sync<br/>[cursor-rules.mjs]"]
  node_paths["Path utilities<br/>[paths.mjs]"]
  node_repos["Repo discovery<br/>[repos.mjs]"]
end

node_user(("Engineer"))
node_claude(("Claude Code"))
node_other_agents(("Other agents"))

node_user -->|"starts setup"| node_setup_skill
node_setup_skill -->|"sets up workspace"| node_cli
node_cli -->|"surveys repos"| node_survey
node_survey -->|"reads CI"| node_ci
node_survey -->|"fingerprints hooks"| node_fingerprint
node_cli -->|"loads config"| node_workspace
node_user -->|"checks change"| node_premortem
node_user -->|"reports bug"| node_fix_class
node_user -->|"requests review"| node_review
node_review -->|"feeds completion"| node_ship_check
node_user -->|"sets task scope"| node_sharpen
node_sharpen -->|"can expand scope"| node_hulk
node_other_agents -->|"uses shared skills"| node_premortem
node_other_agents -->|"uses shared skills"| node_ship_check
node_claude -->|"sends events"| node_hooks
node_hooks -->|"finds workspace"| node_workspace
node_hooks -->|"runs repo hooks"| node_bridge
node_hooks -->|"checks drift"| node_drift
node_hooks -->|"checks scope gate"| node_sharpen_gate
node_hooks -->|"records shell edits"| node_shell_edits
node_hooks -->|"stores session state"| node_state
node_hooks -.->|"merges hook results"| node_merge
node_hooks -.->|"checks done claims"| node_done_check
node_cli -->|"loads recipes"| node_parts
node_cli -->|"judges findings"| node_jev
node_cli -->|"handles word reports"| node_words
node_drift -->|"checks hook validity"| node_bridge
node_drift -->|"checks CI changes"| node_ci
node_drift -->|"checks rule imports"| node_cursor_rules
node_drift -->|"checks instructions"| node_instructions
node_drift -->|"discovers repos"| node_repos
node_drift -->|"checks refresh need"| node_words
node_bridge -->|"validates approvals"| node_fingerprint
node_bridge -->|"resolves repo hooks"| node_workspace
node_fingerprint -->|"formats paths"| node_paths
node_workspace -->|"compares paths"| node_paths
node_instructions -->|"reads imports"| node_cursor_rules
node_words -->|"normalizes paths"| node_paths

click node_premortem "https://github.com/joetawil7/first-pass/blob/main/skills/premortem/SKILL.md"
click node_fix_class "https://github.com/joetawil7/first-pass/blob/main/skills/fix-the-class/SKILL.md"
click node_review "https://github.com/joetawil7/first-pass/blob/main/skills/review/SKILL.md"
click node_ship_check "https://github.com/joetawil7/first-pass/blob/main/skills/ship-check/SKILL.md"
click node_setup_skill "https://github.com/joetawil7/first-pass/blob/main/skills/setup-first-pass/SKILL.md"
click node_sharpen "https://github.com/joetawil7/first-pass/blob/main/skills/sharpen/SKILL.md"
click node_hulk "https://github.com/joetawil7/first-pass/blob/main/skills/hulk/SKILL.md"
click node_habit_words "https://github.com/joetawil7/first-pass/blob/main/skills/habit-words/SKILL.md"
click node_cli "https://github.com/joetawil7/first-pass/blob/main/scripts/cli.mjs"
click node_survey "https://github.com/joetawil7/first-pass/blob/main/scripts/lib/survey.mjs"
click node_ci "https://github.com/joetawil7/first-pass/blob/main/scripts/lib/ci.mjs"
click node_fingerprint "https://github.com/joetawil7/first-pass/blob/main/scripts/lib/fingerprint.mjs"
click node_workspace "https://github.com/joetawil7/first-pass/blob/main/scripts/lib/workspace.mjs"
click node_parts "https://github.com/joetawil7/first-pass/blob/main/scripts/lib/parts.mjs"
click node_hooks "https://github.com/joetawil7/first-pass/blob/main/scripts/hooks.mjs"
click node_bridge "https://github.com/joetawil7/first-pass/blob/main/scripts/lib/bridge.mjs"
click node_drift "https://github.com/joetawil7/first-pass/blob/main/scripts/lib/drift.mjs"
click node_state "https://github.com/joetawil7/first-pass/blob/main/scripts/lib/state.mjs"
click node_shell_edits "https://github.com/joetawil7/first-pass/blob/main/scripts/lib/shell-edits.mjs"
click node_sharpen_gate "https://github.com/joetawil7/first-pass/blob/main/scripts/lib/sharpen-gate.mjs"
click node_done_check "https://github.com/joetawil7/first-pass/blob/main/scripts/lib/done-check.mjs"
click node_merge "https://github.com/joetawil7/first-pass/blob/main/scripts/lib/merge.mjs"
click node_jev "https://github.com/joetawil7/first-pass/blob/main/scripts/lib/jev.mjs"
click node_words "https://github.com/joetawil7/first-pass/blob/main/scripts/lib/words.mjs"
click node_instructions "https://github.com/joetawil7/first-pass/blob/main/scripts/lib/instructions.mjs"
click node_cursor_rules "https://github.com/joetawil7/first-pass/blob/main/scripts/lib/cursor-rules.mjs"
click node_paths "https://github.com/joetawil7/first-pass/blob/main/scripts/lib/paths.mjs"
click node_repos "https://github.com/joetawil7/first-pass/blob/main/scripts/lib/repos.mjs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_premortem,node_fix_class,node_review,node_ship_check,node_sharpen,node_hulk,node_habit_words toneBlue
class node_setup_skill,node_cli,node_survey,node_ci,node_fingerprint toneAmber
class node_hooks,node_bridge,node_drift,node_state,node_shell_edits,node_sharpen_gate,node_done_check,node_merge toneMint
class node_workspace,node_parts,node_jev,node_words,node_instructions,node_cursor_rules,node_paths,node_repos toneRose
class node_user,node_claude,node_other_agents toneIndigo
```

## Components

### Agent workflows

- [Pre-mortem](https://github.com/joetawil7/first-pass/blob/main/skills/premortem/SKILL.md): `skills/premortem/SKILL.md`
- [Fix bug class](https://github.com/joetawil7/first-pass/blob/main/skills/fix-the-class/SKILL.md): `skills/fix-the-class/SKILL.md`
- [PR review](https://github.com/joetawil7/first-pass/blob/main/skills/review/SKILL.md): `skills/review/SKILL.md`
- [Ship check](https://github.com/joetawil7/first-pass/blob/main/skills/ship-check/SKILL.md): `skills/ship-check/SKILL.md`
- [Sharpen scope](https://github.com/joetawil7/first-pass/blob/main/skills/sharpen/SKILL.md): `skills/sharpen/SKILL.md`
- [Expanded scope](https://github.com/joetawil7/first-pass/blob/main/skills/hulk/SKILL.md): `skills/hulk/SKILL.md`
- [Habit words](https://github.com/joetawil7/first-pass/blob/main/skills/habit-words/SKILL.md): `skills/habit-words/SKILL.md`

### Workspace setup

- [Setup skill](https://github.com/joetawil7/first-pass/blob/main/skills/setup-first-pass/SKILL.md): `skills/setup-first-pass/SKILL.md`
- [Setup CLI](https://github.com/joetawil7/first-pass/blob/main/scripts/cli.mjs): `scripts/cli.mjs`
- [Repo survey](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/survey.mjs): `scripts/lib/survey.mjs`
- [CI discovery](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/ci.mjs): `scripts/lib/ci.mjs`
- [Hook fingerprint](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/fingerprint.mjs): `scripts/lib/fingerprint.mjs`

### Session runtime

- [Claude hooks](https://github.com/joetawil7/first-pass/blob/main/scripts/hooks.mjs): `scripts/hooks.mjs`
- [Repo hook runner](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/bridge.mjs): `scripts/lib/bridge.mjs`
- [Drift check](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/drift.mjs): `scripts/lib/drift.mjs`
- [Session state](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/state.mjs): `scripts/lib/state.mjs`
- [Shell edit tracking](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/shell-edits.mjs): `scripts/lib/shell-edits.mjs`
- [Scope gate](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/sharpen-gate.mjs): `scripts/lib/sharpen-gate.mjs`
- [Done evidence](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/done-check.mjs): `scripts/lib/done-check.mjs`
- [Hook result merge](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/merge.mjs): `scripts/lib/merge.mjs`

### Shared runtime

- [Workspace config](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/workspace.mjs): `scripts/lib/workspace.mjs`
- [Skill recipes](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/parts.mjs): `scripts/lib/parts.mjs`
- [Finding judge](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/jev.mjs): `scripts/lib/jev.mjs`
- [Prompt analysis](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/words.mjs): `scripts/lib/words.mjs`
- [Instruction checks](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/instructions.mjs): `scripts/lib/instructions.mjs`
- [Cursor rule sync](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/cursor-rules.mjs): `scripts/lib/cursor-rules.mjs`
- [Path utilities](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/paths.mjs): `scripts/lib/paths.mjs`
- [Repo discovery](https://github.com/joetawil7/first-pass/blob/main/scripts/lib/repos.mjs): `scripts/lib/repos.mjs`

### Other components

- **Engineer**
- **Claude Code**
- **Other agents**

## Connections

- Engineer → Setup skill: starts setup (evidence: `README.md`)
- Setup skill → Setup CLI: sets up workspace (evidence: `README.md`)
- Setup CLI → Repo survey: surveys repos (evidence: `scripts/cli.mjs`)
- Repo survey → CI discovery: reads CI (evidence: `scripts/lib/survey.mjs`)
- Repo survey → Hook fingerprint: fingerprints hooks (evidence: `scripts/lib/survey.mjs`)
- Setup CLI → Workspace config: loads config (evidence: `scripts/cli.mjs`)
- Engineer → Pre-mortem: checks change (evidence: `README.md`)
- Engineer → Fix bug class: reports bug (evidence: `README.md`)
- Engineer → PR review: requests review (evidence: `README.md`)
- PR review → Ship check: feeds completion (evidence: `README.md`)
- Engineer → Sharpen scope: sets task scope (evidence: `README.md`)
- Sharpen scope → Expanded scope: can expand scope (evidence: `README.md`)
- Other agents → Pre-mortem: uses shared skills (evidence: `README.md`)
- Other agents → Ship check: uses shared skills (evidence: `README.md`)
- Claude Code → Claude hooks: sends events (evidence: `scripts/hooks.mjs`)
- Claude hooks → Workspace config: finds workspace (evidence: `scripts/hooks.mjs`)
- Claude hooks → Repo hook runner: runs repo hooks (evidence: `scripts/hooks.mjs`)
- Claude hooks → Drift check: checks drift (evidence: `scripts/hooks.mjs`)
- Claude hooks → Scope gate: checks scope gate (evidence: `scripts/hooks.mjs`)
- Claude hooks → Shell edit tracking: records shell edits (evidence: `scripts/hooks.mjs`)
- Claude hooks → Session state: stores session state (evidence: `scripts/hooks.mjs`)
- Claude hooks → Hook result merge: merges hook results (evidence: `scripts/hooks.mjs`)
- Claude hooks → Done evidence: checks done claims (evidence: `scripts/hooks.mjs`)
- Setup CLI → Skill recipes: loads recipes (evidence: `scripts/cli.mjs`)
- Setup CLI → Finding judge: judges findings (evidence: `scripts/cli.mjs`)
- Setup CLI → Prompt analysis: handles word reports (evidence: `scripts/cli.mjs`)
- Drift check → Repo hook runner: checks hook validity (evidence: `scripts/lib/drift.mjs`)
- Drift check → CI discovery: checks CI changes (evidence: `scripts/lib/drift.mjs`)
- Drift check → Cursor rule sync: checks rule imports (evidence: `scripts/lib/drift.mjs`)
- Drift check → Instruction checks: checks instructions (evidence: `scripts/lib/drift.mjs`)
- Drift check → Repo discovery: discovers repos (evidence: `scripts/lib/drift.mjs`)
- Drift check → Prompt analysis: checks refresh need (evidence: `scripts/lib/drift.mjs`)
- Repo hook runner → Hook fingerprint: validates approvals (evidence: `scripts/lib/bridge.mjs`)
- Repo hook runner → Workspace config: resolves repo hooks (evidence: `scripts/lib/bridge.mjs`)
- Hook fingerprint → Path utilities: formats paths (evidence: `scripts/lib/fingerprint.mjs`)
- Workspace config → Path utilities: compares paths (evidence: `scripts/lib/workspace.mjs`)
- Instruction checks → Cursor rule sync: reads imports (evidence: `scripts/lib/instructions.mjs`)
- Prompt analysis → Path utilities: normalizes paths (evidence: `scripts/lib/words.mjs`)
