# kunchenguid/no-mistakes architecture

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

- Interactive diagram: https://gitdiagram.com/kunchenguid/no-mistakes
- Repository: https://github.com/kunchenguid/no-mistakes

## Overview

1. **What the repository is**
   - This is a Go-based CLI product that acts as a local Git gate in front of a real remote repository.
   - The main user-facing flows are: `git push no-mistakes`, interactive `no-mistakes` TUI, and non-interactive `/no-mistakes` agent skill via `axi`.

2. **Top-level runtime shape**
   - The core binary is `cmd/no-mistakes`, with supporting commands for skill generation (`cmd/genskill`), fixture recording (`cmd/recordfixture`), and fake agent simulation (`cmd/fakeagent`).
   - The repo is primarily a single Go monorepo, with a docs site under `docs/` and a committed agent skill under `skills/no-mistakes`.

3. **Entry points and orchestration**
   - `internal/cli` is the command layer: it wires subcommands like `init`, `status`, `daemon`, `attach`, `runs`, `stats`, `update`, `wizard`, `axi`, and `doctor`.
   - The CLI is the control plane. It delegates long-running or stateful work to the daemon and pipeline packages rather than doing heavy work inline.

4. **Gate and daemon model**
   - `internal/daemon` is the local service layer that owns the gate lifecycle, run attachment, recovery, and process/service management.
   - It supports OS-specific service integration for macOS/Linux/Windows, plus recovery of orphaned or active runs after restart.
   - The daemon is the boundary between the user’s current checkout and the isolated execution environment used for validation.

5. **Pipeline execution core**
   - `internal/pipeline` is the heart of the product: it executes ordered steps such as intent extraction, review, test, docs, lint, push, PR creation, CI monitoring, and rebase/force-push handling.
   - `internal/pipeline/steps` contains the concrete step implementations and the rules for when a step auto-fixes, asks the user, or blocks the flow.
   - The pipeline is designed around findings: each step can emit actionable results instead of just pass/fail.

6. **Worktree isolation and Git operations**
   - `internal/git`, `internal/paths`, `internal/update`, and parts of `internal/daemon` cooperate to manage disposable worktrees, branch routing, and safe publishing.
   - The repository treats the user’s original branch as protected input and performs checks in an isolated worktree before forwarding to the configured push target.
   - There is explicit handling for forked repositories, repo trust, renamed repos, and push/force-push safety.

7. **Agent integration boundary**
   - `internal/agent` abstracts multiple AI coding agents: Claude, Codex, Copilot, OpenCode, Pi, Rovodev, and ACP-style targets via `acpx`.
   - This package normalizes different CLI and streaming protocols into a common agent interface, including fallback ordering and retry logic.
   - Several transport shapes are supported: native command invocation, HTTP/SSE streaming, and server-style process management.

8. **Non-interactive skill mode**
   - `skills/no-mistakes/SKILL.md` and `cmd/genskill` define the `/no-mistakes` skill distribution path.
   - The skill drives the same pipeline through `no-mistakes axi`, which is a machine-friendly approval interface for agent-driven workflows.
   - This is the bridge between “agent does the work” and “pipeline validates and escalates only the human decisions.”

9. **Interactive human workflow**
   - `internal/tui` implements the terminal UI used when a run is active or when the user launches the tool directly.
   - The TUI presents findings, gate state, CI status, diff views, review prompts, and action affordances like approve, auto-fix, skip, or abort.
   - `internal/wizard` handles initial onboarding and branch/commit/push setup when the user starts from uncommitted changes.

10. **State, persistence, and telemetry**
    - `internal/db` stores persistent repo/run/round/step state and stats for active and historical runs.
    - `internal/telemetry` and `internal/cli/telemetry.go` capture product events, while `internal/cimonitor` watches CI status after PR creation.
    - The data model centers on runs, rounds, steps, findings, and repo metadata, which lets the CLI, daemon, and TUI all observe the same workflow state.

11. **SCM and PR provider support**
    - `internal/scm` and `internal/bitbucket` encapsulate provider-specific behavior for GitHub, GitLab, Azure DevOps, and Bitbucket.
    - These packages handle host detection, authentication-related concerns, and PR body generation/formatting so the pipeline can open clean PRs consistently across hosts.

12. **Intent extraction and safety controls**
    - `internal/intent` parses agent output and local context to determine what changed, what the user intended, and what needs escalation.
    - `internal/gate`, `internal/safeurl`, and `internal/types` provide the guardrails and shared schemas for findings, intent, and safe redaction.
    - This boundary is important because the product deliberately separates mechanical fixes from anything that might alter intent.

13. **Platform-specific and lifecycle plumbing**
    - Several packages have OS-specific files for Unix/Windows behavior: service launch, process handling, signals, shell environment, update replacement, and quarantine.
    - `internal/update` manages self-update behavior and protection of active runs during replacement.
    - This makes the architecture operationally portable rather than being a thin cross-platform wrapper.

14. **Verification and reproducibility**
    - The repo is heavily tested, with unit, integration, end-to-end, workflow, and fixture-based tests spread across the codebase.
    - `internal/e2e` uses recorded agent fixtures for Claude, Codex, and OpenCode, while `cmd/fakeagent` and `cmd/recordfixture` support deterministic replay and fixture capture.
    - GitHub Actions workflows and generated-file guards are part of the architecture because they enforce drift control for the skill, docs, and release artifacts.

Main entry points: [`internal/cli`](https://github.com/kunchenguid/no-mistakes/tree/main/internal/cli) (CLI layer), [`internal/daemon`](https://github.com/kunchenguid/no-mistakes/tree/main/internal/daemon) (Daemon), [`internal/pipeline/steps`](https://github.com/kunchenguid/no-mistakes/tree/main/internal/pipeline/steps) (Step set), [`internal/pipeline`](https://github.com/kunchenguid/no-mistakes/tree/main/internal/pipeline) (Pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_cli["CLI & UX"]
  node_node_cmd_main["no-mistakes<br/>cli entry<br/>[main.go]"]
  node_node_cli["CLI layer<br/>subcommands"]
  node_node_tui["Terminal UI<br/>interactive ui"]
  node_node_wizard["Setup wizard<br/>onboarding"]
  node_node_telemetry(("Telemetry<br/>events"))
end

subgraph group_grp_core["Core workflow"]
  node_node_daemon["Daemon<br/>local service"]
  node_node_ipc(("IPC<br/>rpc transport"))
  node_node_db[("State DB<br/>persistent state")]
  node_node_gate{{"Gate<br/>policy boundary"}}
  node_node_pipeline["Pipeline<br/>workflow engine"]
  node_node_steps["Step set<br/>pipeline steps"]
end

subgraph group_grp_agents["Agent boundary"]
  node_node_agent["Agent adapters<br/>ai integration"]
  node_node_intent["Intent engine<br/>analysis"]
  node_node_skill(("Skill install<br/>distribution"))
end

subgraph group_grp_platform["Platform & SCM"]
  node_node_git["Git ops<br/>worktree and git"]
  node_node_paths(("Paths<br/>repo layout"))
  node_node_update["Updater<br/>self-update"]
  node_node_scm["SCM providers<br/>pr integration"]
end

subgraph group_grp_docs["Docs & packaging"]
  node_node_cmd_genskill["genskill<br/>skill generator<br/>[main.go]"]
  node_node_skill_md["Skill spec<br/>agent skill<br/>[SKILL.md]"]
  node_node_docs["Docs site<br/>documentation"]
end

node_node_cmd_main -->|"boots"| node_node_cli
node_node_cli -->|"controls"| node_node_daemon
node_node_cli -->|"starts"| node_node_pipeline
node_node_cli -->|"renders"| node_node_tui
node_node_cli -->|"onboards"| node_node_wizard
node_node_cli -->|"emits"| node_node_telemetry
node_node_tui -->|"subscribes"| node_node_ipc
node_node_daemon -->|"serves"| node_node_ipc
node_node_daemon -->|"persists"| node_node_db
node_node_daemon -->|"enforces"| node_node_gate
node_node_pipeline -->|"executes"| node_node_steps
node_node_pipeline -->|"reports"| node_node_gate
node_node_steps -->|"uses"| node_node_git
node_node_steps -->|"publishes"| node_node_scm
node_node_steps -->|"consults"| node_node_agent
node_node_agent -->|"normalizes"| node_node_intent
node_node_agent -->|"drives"| node_node_skill_md
node_node_cmd_genskill -->|"generates"| node_node_skill_md
node_node_skill -->|"installs"| node_node_skill_md
node_node_git -->|"resolves"| node_node_paths
node_node_update -->|"protects"| node_node_daemon
node_node_scm -->|"opens pr"| node_node_pipeline
node_node_docs -->|"documents"| node_node_skill_md
node_node_docs -->|"documents"| node_node_cli

click node_node_cmd_main "https://github.com/kunchenguid/no-mistakes/blob/main/cmd/no-mistakes/main.go"
click node_node_cli "https://github.com/kunchenguid/no-mistakes/tree/main/internal/cli"
click node_node_tui "https://github.com/kunchenguid/no-mistakes/tree/main/internal/tui"
click node_node_wizard "https://github.com/kunchenguid/no-mistakes/tree/main/internal/wizard"
click node_node_telemetry "https://github.com/kunchenguid/no-mistakes/tree/main/internal/telemetry"
click node_node_daemon "https://github.com/kunchenguid/no-mistakes/tree/main/internal/daemon"
click node_node_ipc "https://github.com/kunchenguid/no-mistakes/tree/main/internal/ipc"
click node_node_db "https://github.com/kunchenguid/no-mistakes/tree/main/internal/db"
click node_node_gate "https://github.com/kunchenguid/no-mistakes/tree/main/internal/gate"
click node_node_pipeline "https://github.com/kunchenguid/no-mistakes/tree/main/internal/pipeline"
click node_node_steps "https://github.com/kunchenguid/no-mistakes/tree/main/internal/pipeline/steps"
click node_node_git "https://github.com/kunchenguid/no-mistakes/tree/main/internal/git"
click node_node_paths "https://github.com/kunchenguid/no-mistakes/tree/main/internal/paths"
click node_node_update "https://github.com/kunchenguid/no-mistakes/tree/main/internal/update"
click node_node_scm "https://github.com/kunchenguid/no-mistakes/tree/main/internal/scm"
click node_node_agent "https://github.com/kunchenguid/no-mistakes/tree/main/internal/agent"
click node_node_intent "https://github.com/kunchenguid/no-mistakes/tree/main/internal/intent"
click node_node_skill "https://github.com/kunchenguid/no-mistakes/tree/main/internal/skill"
click node_node_cmd_genskill "https://github.com/kunchenguid/no-mistakes/blob/main/cmd/genskill/main.go"
click node_node_skill_md "https://github.com/kunchenguid/no-mistakes/blob/main/skills/no-mistakes/SKILL.md"
click node_node_docs "https://github.com/kunchenguid/no-mistakes/tree/main/docs/src/content/docs"

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_node_cmd_main,node_node_cli,node_node_tui,node_node_wizard,node_node_telemetry toneBlue
class node_node_daemon,node_node_ipc,node_node_db,node_node_gate,node_node_pipeline,node_node_steps toneAmber
class node_node_agent,node_node_intent,node_node_skill toneMint
class node_node_git,node_node_paths,node_node_update,node_node_scm toneRose
class node_node_cmd_genskill,node_node_skill_md,node_node_docs toneIndigo
```

## Components

### CLI & UX

User-facing commands and terminal interactions

- [no-mistakes](https://github.com/kunchenguid/no-mistakes/blob/main/cmd/no-mistakes/main.go): cli entry · Main product binary and command bootstrap · `cmd/no-mistakes/main.go`
- [CLI layer](https://github.com/kunchenguid/no-mistakes/tree/main/internal/cli): subcommands · Subcommand routing and control-plane orchestration · `internal/cli`
- [Terminal UI](https://github.com/kunchenguid/no-mistakes/tree/main/internal/tui): interactive ui · Interactive run display, prompts, diffs, and actions · `internal/tui`
- [Setup wizard](https://github.com/kunchenguid/no-mistakes/tree/main/internal/wizard): onboarding · Initial repo/branch/push setup for new users · `internal/wizard`
- [Telemetry](https://github.com/kunchenguid/no-mistakes/tree/main/internal/telemetry): events · Product event capture from CLI and workflow surfaces · `internal/telemetry`

### Core workflow

Daemon, pipeline, gate, and shared workflow state

- [Daemon](https://github.com/kunchenguid/no-mistakes/tree/main/internal/daemon): local service · Long-running gate lifecycle, recovery, and attachment manager · `internal/daemon`
- [IPC](https://github.com/kunchenguid/no-mistakes/tree/main/internal/ipc): rpc transport · Client/server transport between CLI, TUI, and daemon · `internal/ipc`
- [State DB](https://github.com/kunchenguid/no-mistakes/tree/main/internal/db): persistent state · Repo, run, round, step, findings, and stats storage · `internal/db`
- [Gate](https://github.com/kunchenguid/no-mistakes/tree/main/internal/gate): policy boundary · Safety and approval boundary for validating changes · `internal/gate`
- [Pipeline](https://github.com/kunchenguid/no-mistakes/tree/main/internal/pipeline): workflow engine · Ordered validation and publishing flow over findings · `internal/pipeline`
- [Step set](https://github.com/kunchenguid/no-mistakes/tree/main/internal/pipeline/steps): pipeline steps · Concrete intent, review, test, lint, push, PR, CI, and rebase steps · `internal/pipeline/steps`

### Agent boundary

Adapters for AI coding agents and skill mode

- [Agent adapters](https://github.com/kunchenguid/no-mistakes/tree/main/internal/agent): ai integration · Common interface for Claude, Codex, Copilot, OpenCode, Pi, Rovodev, and ACP targets · `internal/agent`
- [Intent engine](https://github.com/kunchenguid/no-mistakes/tree/main/internal/intent): analysis · Extracts user intent, summarizes changes, and redacts sensitive output · `internal/intent`
- [Skill install](https://github.com/kunchenguid/no-mistakes/tree/main/internal/skill): distribution · Installed /no-mistakes skill generation and placement · `internal/skill`

### Platform & SCM

Git, storage, update, SCM, and cross-platform plumbing

- [Git ops](https://github.com/kunchenguid/no-mistakes/tree/main/internal/git): worktree and git · Branch, diff, hook, and isolated worktree operations · `internal/git`
- [Paths](https://github.com/kunchenguid/no-mistakes/tree/main/internal/paths): repo layout · Path derivation and workspace location helpers · `internal/paths`
- [Updater](https://github.com/kunchenguid/no-mistakes/tree/main/internal/update): self-update · Binary replacement, active-run protection, and release retrieval · `internal/update`
- [SCM providers](https://github.com/kunchenguid/no-mistakes/tree/main/internal/scm): pr integration · Host detection, auth, and PR formatting across providers · `internal/scm`

### Docs & packaging

Documentation, skills, and release artifacts

- [genskill](https://github.com/kunchenguid/no-mistakes/blob/main/cmd/genskill/main.go): skill generator · Builds committed skill artifacts from the source skill definition · `cmd/genskill/main.go`
- [Skill spec](https://github.com/kunchenguid/no-mistakes/blob/main/skills/no-mistakes/SKILL.md): agent skill · Committed no-mistakes skill used by axi and agent workflows · `skills/no-mistakes/SKILL.md`
- [Docs site](https://github.com/kunchenguid/no-mistakes/tree/main/docs/src/content/docs): documentation · Astro-based documentation and guides for usage and concepts · `docs/src/content/docs`

## Connections

- no-mistakes → CLI layer: boots · Main binary initializes the command layer
- CLI layer → Daemon: controls · CLI delegates long-running work and lifecycle actions to the daemon
- CLI layer → Pipeline: starts · Commands launch or inspect workflow execution
- CLI layer → Terminal UI: renders · CLI launches or attaches the terminal UI
- CLI layer → Setup wizard: onboards · CLI invokes setup wizard flows
- CLI layer → Telemetry: emits · Command actions generate telemetry events
- Terminal UI → IPC: subscribes · TUI follows live run state over IPC
- Daemon → IPC: serves · Daemon exposes local control and status RPCs
- Daemon → State DB: persists · Daemon stores and recovers run state
- Daemon → Gate: enforces · Daemon owns the gate lifecycle boundary
- Pipeline → Step set: executes · Pipeline runs ordered step implementations
- Pipeline → Gate: reports · Findings and approvals feed gate decisions
- Step set → Git ops: uses · Steps operate on worktrees, branches, diffs, and pushes
- Step set → SCM providers: publishes · PR-related steps use provider-specific integration
- Step set → Agent adapters: consults · Intent and review steps may call out to agents
- Agent adapters → Intent engine: normalizes · Agent output is converted into comparable intent and findings
- Agent adapters → Skill spec: drives · Skill mode is the non-interactive distribution path
- genskill → Skill spec: generates · Skill generator produces the committed skill artifact
- Skill install → Skill spec: installs · Skill installer places the skill for local use
- Git ops → Paths: resolves · Git operations rely on repo and worktree path layout
- Updater → Daemon: protects · Updater preserves active runs during replacement
- SCM providers → Pipeline: opens pr · Provider integration is used by the publishing flow
- Docs site → Skill spec: documents · Docs describe the skill and the machine-friendly workflow
- Docs site → CLI layer: documents · Docs site covers CLI commands and user flows
