Skip to main content

Score your codebase on how ready it is for AI agents — and coach you through the fixes.

Project description

AgentRepoCoach

Score your codebase on how ready it is for AI agents — and coach you through the fixes.

PyPI version License CI Python versions

AgentRepoCoach computes the Codebase Agent Health (CAH) score: a single 0-100 composite measuring how friendly a repository is for autonomous AI agents. It blends five statically-measurable components:

  • Navigability (25%) — AGENTS.md, codebase map, CLI manifest, root cleanliness
  • Error quality (25%) — fix-hint coverage, exception typing, generic-exception dominance
  • Decision queryability (20%) — ADR catalog, inline reference resolution
  • Test quality (15%) — naming convention, helper presence, fixture duplication
  • Module hygiene (15%) — internal visibility, god files, doc coverage, architecture doc freshness

AgentRepoCoach ships with zero runtime dependencies — it uses the Python 3.11+ standard library only, including tomllib for config parsing.

Usage as a GitHub Action

Add this to any workflow to score your repo and fail the build if the composite score drops below a threshold:

name: codebase-health

on:
  push:
    branches: [main]
  pull_request:

jobs:
  agentrepocoach:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Run AgentRepoCoach
        id: agentrepocoach
        uses: WouterDeBot/agentrepocoach@v1
        with:
          repo-path: .
          output-format: json
          output-path: ./agentrepocoach-report.json
          fail-threshold: '70'

      - name: Show composite score
        run: echo "Score: ${{ steps.agentrepocoach.outputs.composite-score }}"

      - uses: actions/upload-artifact@v4
        with:
          name: agentrepocoach-report
          path: ./agentrepocoach-report.json

Action inputs:

Input Default Description
repo-path . Path to scan
config-path .agentrepocoach.toml TOML config file
output-format json json, markdown, or both
output-path ./agentrepocoach-report.json Where to write the report
fail-threshold (unset) Exit 1 if score < threshold
python-version 3.11 Python version to install

Action outputs:

Output Description
composite-score CAH composite score (0-100)
report-path Absolute path to written report

Usage as a CLI

pip install agentrepocoach

# Score the current directory (prints a summary table)
python -m agentrepocoach.cli --repo .

# Write a JSON report to disk
python -m agentrepocoach.cli --repo . --format json --output ./report.json

# Per-sub-component breakdown
python -m agentrepocoach.cli --repo . --verbose

# Compare against a baseline report (inline delta)
python -m agentrepocoach.cli --repo . --format json --output ./pr.json --compare ./baseline.json

# Compare two saved score files
python -m agentrepocoach.cli compare ./baseline.json ./pr.json

# Show the installed version
python -m agentrepocoach.cli --version

Configuration

AgentRepoCoach looks for .agentrepocoach.toml at the repo root. Every field is optional — the tool ships with sensible defaults and will score zero-config repos without complaint.

Minimal example:

# .agentrepocoach.toml
[weights]
navigability = 0.25
error_quality = 0.25
decision_queryability = 0.20
test_quality = 0.15
module_hygiene = 0.15

[paths]
adr_dir = "docs/adr/"
architecture_doc = "docs/architecture.md"

[error_quality]
domain_exception_types = ["DomainError", "ValidationError"]

[decision_queryability]
inline_ref_patterns = ["ADR-\\d+"]

See docs/METHODOLOGY.md for the full config schema and scoring formula.

Languages supported

Language Status Notes
C# Full MVP Throw-site scanner, XML doc detection, internal visibility, .sln/.csproj discovery
Python Full MVP Raise-site scanner, docstring detection, top-level visibility, src/ layout aware
TypeScript Full MVP Throw-site scanner with multi-line context, JSDoc detection, Jest/Vitest test extraction
Rust Full MVP panic!/Err(Custom) mapping, /// doc comment detection, #[test] attribute detection
Go Full MVP errors.New/fmt.Errorf/custom error mapping, Go doc comment detection, Test* function extraction

Adding a new adapter is a small, well-scoped task — see CONTRIBUTING.md.

Coaching recommendations

When you run AgentRepoCoach, it doesn't just score your repo — it tells you what to fix first. The coaching engine analyzes sub-component score gaps and surfaces the top-3 actionable tips ranked by weighted impact. Recommendations appear in:

  • Terminal summary (default output)
  • Verbose mode (--verbose)
  • Markdown PR comments (--format markdown)
  • JSON reports (--format json, new coaching array)

How it works

AgentRepoCoach detects the primary language of the repo, loads a language adapter, and runs five component scorers against the adapter's view of the codebase. Each component returns a 0-100 sub-score with a transparent breakdown. The weighted sum is the composite CAH score.

Every output field is a count, percentage, type name, or file path — AgentRepoCoach never emits code snippets or raw message bodies, so reports are safe to publish as CI artifacts.

License

Apache 2.0. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentrepocoach-0.3.1.tar.gz (57.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentrepocoach-0.3.1-py3-none-any.whl (57.9 kB view details)

Uploaded Python 3

File details

Details for the file agentrepocoach-0.3.1.tar.gz.

File metadata

  • Download URL: agentrepocoach-0.3.1.tar.gz
  • Upload date:
  • Size: 57.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for agentrepocoach-0.3.1.tar.gz
Algorithm Hash digest
SHA256 f8b48dbc174798ac5cce7eb121d51f1a38197c0392313174a69a8699c1832c7f
MD5 7f9b54356e9b5f244454876b4a3ac6a0
BLAKE2b-256 3011a87b07780945f52f3770e7eca51b9ef3e7539e8886a10a3e600d479a5365

See more details on using hashes here.

File details

Details for the file agentrepocoach-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: agentrepocoach-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 57.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for agentrepocoach-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a9193e728f8005943e30be36c93e81b1fe54b6f53e2bda6202fdd1a977d134d1
MD5 bf1e362958098c612309ebbcbd29d8b7
BLAKE2b-256 c05c8d814a5c9ec2511b57e6020a41a377ce2440b5063a2422db889f90bcb2ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page