# breaktroughf1/lockward architecture

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

- Interactive diagram: https://gitdiagram.com/breaktroughf1/lockward
- Repository: https://github.com/breaktroughf1/lockward

## Overview

Lockward is an offline lockfile and policy gate for AI-agent assets. Users initialize policy, discover and pin assets, then verify changes; they can review diffs, approve selected changes, scan an untrusted repository, or export an AI-BOM. The CLI delegates core operations to the engine, which coordinates discovery, lockfile comparison, policy evaluation, and reporting. Agent-specific adapters and optional external-scanner SARIF imports extend discovery and findings. Source excerpts show the principal orchestration, but not every command implementation or report format’s wiring.

Main entry points: [`internal/adapter`](https://github.com/Breaktroughf1/lockward/tree/main/internal/adapter) (Agent adapters), [`internal/engine/engine.go`](https://github.com/Breaktroughf1/lockward/blob/main/internal/engine/engine.go) (Scope engine), [`internal/repo/repo.go`](https://github.com/Breaktroughf1/lockward/blob/main/internal/repo/repo.go) (Untrusted repo scan), [`internal/discover/discover.go`](https://github.com/Breaktroughf1/lockward/blob/main/internal/discover/discover.go) (Agent discovery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and workflows"]
  node_cli["Lockward CLI<br/>[main.go]"]
  node_commands["Command workflows<br/>[commands.go]"]
  node_engine["Scope engine<br/>[engine.go]"]
  node_repo["Untrusted repo scan<br/>[repo.go]"]
end

subgraph group_discovery["Asset discovery"]
  node_assets["Asset model<br/>[asset.go]"]
  node_discovery["Agent discovery<br/>[discover.go]"]
  node_adapters["Agent adapters"]
  node_claude["Claude Code adapter<br/>[claudecode.go]"]
  node_codex["Codex adapter<br/>[codex.go]"]
  node_copilot["Copilot adapter<br/>[copilot.go]"]
  node_cursor["Cursor adapter<br/>[cursor.go]"]
  node_gemini["Gemini CLI adapter<br/>[geminicli.go]"]
  node_generic["Generic adapter<br/>[generic.go]"]
  node_windsurf["Windsurf adapter<br/>[windsurf.go]"]
end

subgraph group_controls["Lock and policy"]
  node_lockfile[("Lockfile I/O<br/>[lock.go]")]
  node_policy["Policy evaluation<br/>[rules.go]"]
  node_policyconfig["Policy configuration<br/>[config.go]"]
end

subgraph group_analysis["Review and reports"]
  node_diff["Drift and prose diff<br/>[diff.go]"]
  node_scanner["Scanner SARIF import<br/>[scanner.go]"]
  node_textscan["Text inspection<br/>[textscan.go]"]
  node_reports["Reports and AI-BOM"]
end

subgraph group_distribution["Launchers"]
  node_npm["npm launcher<br/>[lockward.js]"]
  node_installer["Verified binary installer<br/>[install.js]"]
end

node_user(("Engineer or CI"))
node_release["Release archive"]

node_user -->|"runs commands"| node_cli
node_cli -->|"dispatches"| node_commands
node_commands -->|"runs operations"| node_engine
node_commands -->|"scans repositories"| node_repo
node_engine -->|"discovers assets"| node_discovery
node_engine -->|"reads and writes"| node_lockfile
node_engine -->|"evaluates rules"| node_policy
node_engine -->|"imports findings"| node_scanner
node_engine -->|"produces output"| node_reports
node_repo -->|"discovers assets"| node_discovery
node_repo -->|"checks policy"| node_policy
node_repo -->|"loads SARIF"| node_scanner
node_discovery -->|"runs adapters"| node_adapters
node_discovery -->|"builds entries"| node_assets
node_adapters -.->|"implements"| node_claude
node_adapters -.->|"implements"| node_codex
node_adapters -.->|"implements"| node_copilot
node_adapters -.->|"implements"| node_cursor
node_adapters -.->|"implements"| node_gemini
node_adapters -.->|"implements"| node_generic
node_adapters -.->|"implements"| node_windsurf
node_policy -->|"scans text"| node_textscan
node_npm -->|"loads installer"| node_installer
node_installer -->|"downloads archive"| node_release

click node_cli "https://github.com/Breaktroughf1/lockward/blob/main/cmd/lockward/main.go"
click node_commands "https://github.com/Breaktroughf1/lockward/blob/main/cmd/lockward/commands.go"
click node_engine "https://github.com/Breaktroughf1/lockward/blob/main/internal/engine/engine.go"
click node_repo "https://github.com/Breaktroughf1/lockward/blob/main/internal/repo/repo.go"
click node_assets "https://github.com/Breaktroughf1/lockward/blob/main/internal/asset/asset.go"
click node_discovery "https://github.com/Breaktroughf1/lockward/blob/main/internal/discover/discover.go"
click node_adapters "https://github.com/Breaktroughf1/lockward/tree/main/internal/adapter"
click node_claude "https://github.com/Breaktroughf1/lockward/blob/main/internal/adapter/claudecode/claudecode.go"
click node_codex "https://github.com/Breaktroughf1/lockward/blob/main/internal/adapter/codex/codex.go"
click node_copilot "https://github.com/Breaktroughf1/lockward/blob/main/internal/adapter/copilot/copilot.go"
click node_cursor "https://github.com/Breaktroughf1/lockward/blob/main/internal/adapter/cursor/cursor.go"
click node_gemini "https://github.com/Breaktroughf1/lockward/blob/main/internal/adapter/geminicli/geminicli.go"
click node_generic "https://github.com/Breaktroughf1/lockward/blob/main/internal/adapter/generic/generic.go"
click node_windsurf "https://github.com/Breaktroughf1/lockward/blob/main/internal/adapter/windsurf/windsurf.go"
click node_lockfile "https://github.com/Breaktroughf1/lockward/blob/main/internal/lock/lock.go"
click node_policy "https://github.com/Breaktroughf1/lockward/blob/main/internal/policy/rules.go"
click node_policyconfig "https://github.com/Breaktroughf1/lockward/blob/main/internal/policy/config.go"
click node_diff "https://github.com/Breaktroughf1/lockward/blob/main/internal/engine/diff.go"
click node_scanner "https://github.com/Breaktroughf1/lockward/blob/main/internal/scanner/scanner.go"
click node_textscan "https://github.com/Breaktroughf1/lockward/blob/main/internal/textscan/textscan.go"
click node_reports "https://github.com/Breaktroughf1/lockward/tree/main/internal/report"
click node_npm "https://github.com/Breaktroughf1/lockward/blob/main/packaging/npm/bin/lockward.js"
click node_installer "https://github.com/Breaktroughf1/lockward/blob/main/packaging/npm/lib/install.js"

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_cli,node_commands,node_engine,node_repo toneBlue
class node_assets,node_discovery,node_adapters,node_claude,node_codex,node_copilot,node_cursor,node_gemini,node_generic,node_windsurf toneAmber
class node_lockfile,node_policy,node_policyconfig toneMint
class node_diff,node_scanner,node_textscan,node_reports toneRose
class node_npm,node_installer,node_user,node_release toneIndigo
```

## Components

### CLI and workflows

- [Lockward CLI](https://github.com/Breaktroughf1/lockward/blob/main/cmd/lockward/main.go): `cmd/lockward/main.go`
- [Command workflows](https://github.com/Breaktroughf1/lockward/blob/main/cmd/lockward/commands.go): `cmd/lockward/commands.go`
- [Scope engine](https://github.com/Breaktroughf1/lockward/blob/main/internal/engine/engine.go): `internal/engine/engine.go`
- [Untrusted repo scan](https://github.com/Breaktroughf1/lockward/blob/main/internal/repo/repo.go): `internal/repo/repo.go`

### Asset discovery

- [Asset model](https://github.com/Breaktroughf1/lockward/blob/main/internal/asset/asset.go): `internal/asset/asset.go`
- [Agent discovery](https://github.com/Breaktroughf1/lockward/blob/main/internal/discover/discover.go): `internal/discover/discover.go`
- [Agent adapters](https://github.com/Breaktroughf1/lockward/tree/main/internal/adapter): `internal/adapter`
- [Claude Code adapter](https://github.com/Breaktroughf1/lockward/blob/main/internal/adapter/claudecode/claudecode.go): `internal/adapter/claudecode/claudecode.go`
- [Codex adapter](https://github.com/Breaktroughf1/lockward/blob/main/internal/adapter/codex/codex.go): `internal/adapter/codex/codex.go`
- [Copilot adapter](https://github.com/Breaktroughf1/lockward/blob/main/internal/adapter/copilot/copilot.go): `internal/adapter/copilot/copilot.go`
- [Cursor adapter](https://github.com/Breaktroughf1/lockward/blob/main/internal/adapter/cursor/cursor.go): `internal/adapter/cursor/cursor.go`
- [Gemini CLI adapter](https://github.com/Breaktroughf1/lockward/blob/main/internal/adapter/geminicli/geminicli.go): `internal/adapter/geminicli/geminicli.go`
- [Generic adapter](https://github.com/Breaktroughf1/lockward/blob/main/internal/adapter/generic/generic.go): `internal/adapter/generic/generic.go`
- [Windsurf adapter](https://github.com/Breaktroughf1/lockward/blob/main/internal/adapter/windsurf/windsurf.go): `internal/adapter/windsurf/windsurf.go`

### Lock and policy

- [Lockfile I/O](https://github.com/Breaktroughf1/lockward/blob/main/internal/lock/lock.go): `internal/lock/lock.go`
- [Policy evaluation](https://github.com/Breaktroughf1/lockward/blob/main/internal/policy/rules.go): `internal/policy/rules.go`
- [Policy configuration](https://github.com/Breaktroughf1/lockward/blob/main/internal/policy/config.go): `internal/policy/config.go`

### Review and reports

- [Drift and prose diff](https://github.com/Breaktroughf1/lockward/blob/main/internal/engine/diff.go): `internal/engine/diff.go`
- [Scanner SARIF import](https://github.com/Breaktroughf1/lockward/blob/main/internal/scanner/scanner.go): `internal/scanner/scanner.go`
- [Text inspection](https://github.com/Breaktroughf1/lockward/blob/main/internal/textscan/textscan.go): `internal/textscan/textscan.go`
- [Reports and AI-BOM](https://github.com/Breaktroughf1/lockward/tree/main/internal/report): `internal/report`

### Launchers

- [npm launcher](https://github.com/Breaktroughf1/lockward/blob/main/packaging/npm/bin/lockward.js): `packaging/npm/bin/lockward.js`
- [Verified binary installer](https://github.com/Breaktroughf1/lockward/blob/main/packaging/npm/lib/install.js): `packaging/npm/lib/install.js`

### Other components

- **Engineer or CI**
- **Release archive**

## Connections

- Engineer or CI → Lockward CLI: runs commands (evidence: `README.md`)
- Lockward CLI → Command workflows: dispatches (evidence: `cmd/lockward/main.go`)
- Command workflows → Scope engine: runs operations (evidence: `cmd/lockward/commands.go`)
- Command workflows → Untrusted repo scan: scans repositories (evidence: `cmd/lockward/commands.go`)
- Scope engine → Agent discovery: discovers assets (evidence: `internal/engine/engine.go`)
- Scope engine → Lockfile I/O: reads and writes (evidence: `internal/engine/engine.go`)
- Scope engine → Policy evaluation: evaluates rules (evidence: `internal/engine/engine.go`)
- Scope engine → Scanner SARIF import: imports findings (evidence: `internal/engine/engine.go`)
- Scope engine → Reports and AI-BOM: produces output (evidence: `internal/engine/engine.go`)
- Untrusted repo scan → Agent discovery: discovers assets (evidence: `internal/repo/repo.go`)
- Untrusted repo scan → Policy evaluation: checks policy (evidence: `internal/repo/repo.go`)
- Untrusted repo scan → Scanner SARIF import: loads SARIF (evidence: `internal/repo/repo.go`)
- Agent discovery → Agent adapters: runs adapters (evidence: `internal/discover/discover.go`)
- Agent discovery → Asset model: builds entries (evidence: `internal/discover/discover.go`)
- Agent adapters → Claude Code adapter: implements (evidence: `internal/adapter/claudecode/claudecode.go`)
- Agent adapters → Codex adapter: implements (evidence: `internal/adapter/codex/codex.go`)
- Agent adapters → Copilot adapter: implements (evidence: `internal/adapter/copilot/copilot.go`)
- Agent adapters → Cursor adapter: implements (evidence: `internal/adapter/cursor/cursor.go`)
- Agent adapters → Gemini CLI adapter: implements (evidence: `internal/adapter/geminicli/geminicli.go`)
- Agent adapters → Generic adapter: implements (evidence: `internal/adapter/generic/generic.go`)
- Agent adapters → Windsurf adapter: implements (evidence: `internal/adapter/windsurf/windsurf.go`)
- Policy evaluation → Text inspection: scans text (evidence: `internal/policy/rules.go`)
- npm launcher → Verified binary installer: loads installer (evidence: `packaging/npm/bin/lockward.js`)
- Verified binary installer → Release archive: downloads archive (evidence: `packaging/npm/lib/install.js`)
