Where Are the Core Modules Located in the no-mistakes Repository?
The core modules in the no-mistakes repository are located under the top-level internal/ directory, with sub-packages handling the CLI, daemon, pipeline orchestration, AI agents, and terminal UI.
The no-mistakes project is a Go-based developer tool organized around a central internal/ directory that contains all core application logic. Unlike repositories that scatter business logic across multiple top-level folders, this codebase consolidates its implementation into discrete, responsibility-focused packages under internal/. These modules handle everything from command-line parsing and background daemon management to AI agent adapters and SQLite persistence.
Internal Package Structure
The internal/ directory serves as the primary codebase location, containing thirteen specialized packages that implement the application's layered architecture. Each package groups related responsibilities and exposes public APIs consumed by the thin entry point in cmd/no-mistakes/main.go.
CLI and Daemon Coordination
internal/cli parses command-line flags and dispatches sub-commands (no-mistakes run, axi, etc.), coordinating with the background service. The internal/daemon package manages the long-running process, implementing singleton locks, run scheduling, and graceful shutdown logic in internal/daemon/daemon.go. The entry point daemon.RunWithOptions() initializes the database, IPC server, and lifecycle management.
Pipeline Execution and Agent Integration
internal/pipeline contains the execution engine defined in internal/pipeline/executor.go, which runs ordered steps (checkout, lint, review, test) for each branch. The internal/agent package provides adapters for AI providers (Codex, Claude, etc.) with the interface defined in internal/agent/agent.go, exposing methods like NewCodexAdapter() and Prompt() for programmatic interaction.
Infrastructure and Support Modules
internal/tui implements the interactive terminal interface in internal/tui/app.go, rendering panels and diff views. internal/ipc supplies the socket-based RPC layer that enables CLI-to-daemon communication, while internal/config handles .no-mistakes.yaml loading and validation via config.Load(). Data persistence relies on internal/db, which manages the SQLite database at <NM_HOME>/db.sqlite, and internal/git provides safe Git operations including bare-repo handling. Shared structs like Finding and Run live in internal/types, with path resolution centralized in internal/paths and telemetry in internal/telemetry.
Key Entry Points and Source Files
Understanding the following files provides immediate insight into the application's control flow:
cmd/no-mistakes/main.go– CLI entry point that creates the root command and establishes daemon connections.internal/daemon/daemon.go– Implements the daemon's main loop and singleton lock mechanism.internal/pipeline/executor.go– Core executor that orchestrates pipeline steps and manages session contexts.internal/agent/agent.go– Defines the generic Agent interface and concrete provider adapters.internal/config/config.go– Configuration loader that applies defaults and validates settings.internal/db/db.go– SQLite wrapper for persisting run metadata and findings.internal/git/git.go– Utility functions for worktree management and repository safety.internal/ipc/server.go– RPC server implementation for inter-process communication.
Interacting with Core Modules Programmatically
The core modules expose Go APIs that allow direct integration beyond CLI usage.
Running a pipeline from Go code:
package main
import (
"context"
"log"
"github.com/kunchenguid/no-mistakes/internal/pipeline"
"github.com/kunchenguid/no-mistakes/internal/config"
)
func main() {
// Load configuration (uses internal/config)
cfg, err := config.Load()
if err != nil {
log.Fatalf("config error: %v", err)
}
// Create a pipeline executor (internal/pipeline)
exec, err := pipeline.NewExecutor(cfg)
if err != nil {
log.Fatalf("executor init: %v", err)
}
// Run a single pipeline for branch "feature-xyz"
ctx := context.Background()
if err := exec.Run(ctx, "feature-xyz"); err != nil {
log.Fatalf("pipeline failed: %v", err)
}
log.Println("pipeline completed successfully")
}
Starting the daemon programmatically:
package main
import (
"log"
"github.com/kunchenguid/no-mistakes/internal/daemon"
)
func main() {
// RunWithOptions sets up the singleton lock, DB, and IPC server
if err := daemon.RunWithOptions(); err != nil {
log.Fatalf("daemon error: %v", err)
}
}
Invoking an AI agent directly:
package main
import (
"log"
"github.com/kunchenguid/no-mistakes/internal/agent"
)
func main() {
// Create a Codex adapter (internal/agent)
codex := agent.NewCodexAdapter()
prompt := "Write a Go function that adds two integers."
// Send the prompt and receive the response
resp, err := codex.Prompt(prompt)
if err != nil {
log.Fatalf("agent error: %v", err)
}
log.Printf("Codex response:\n%s", resp)
}
Summary
- The no-mistakes repository organizes all core logic under the top-level
internal/directory. - Thirteen specialized packages handle distinct concerns: CLI parsing, daemon lifecycle, pipeline execution, AI agent adapters, terminal UI, and infrastructure.
- Key entry points include
cmd/no-mistakes/main.gofor the CLI andinternal/daemon/daemon.gofor the background service. - The
internal/pipelinepackage orchestrates execution steps, whileinternal/agentprovides standardized interfaces to AI providers. - Configuration, database persistence, and Git operations reside in
internal/config,internal/db, andinternal/gitrespectively.
Frequently Asked Questions
What is the purpose of the internal/ directory in the no-mistakes repository?
The internal/ directory contains the core implementation packages that implement the application's business logic. According to Go conventions, this directory enforces that packages within it can only be imported by code inside the same module, protecting the internal APIs from external consumption while clearly delineating the core architecture from public interfaces.
How does the CLI communicate with the daemon process?
The CLI dispatches commands to the daemon through internal/ipc, which implements a socket-based RPC layer. When you execute a command like no-mistakes run, the CLI client connects to the daemon's IPC server (started in internal/daemon/daemon.go) to request pipeline execution and stream results back to the terminal.
Where are the AI agent implementations located in the codebase?
AI agent adapters reside in internal/agent, with the generic interface defined in internal/agent/agent.go. Concrete implementations for specific providers (such as Codex or Claude) are constructed using NewCodexAdapter() and similar factory functions, exposing standardized methods like Prompt() for interaction with large language models.
Which file handles the SQLite database initialization and queries?
Database operations are centralized in internal/db/db.go, which initializes the SQLite database at <NM_HOME>/db.sqlite and provides methods for persisting run metadata, findings, and lifecycle information. This package is imported by the daemon during startup via daemon.RunWithOptions().
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →