AI Collector
Track tool-agnostic AI coding assistant usage across your organization. Collects agent instruction files, plans directories, and AI authorship annotations. Part of the unified ai.* namespace.
ai to your lunar-config.yml:uses: github://earthly/lunar-lib/collectors/ai@v1.0.5
What This Integration Collects
This integration includes 3 collectors that gather metadata from your systems.
instruction-files
Discovers the vendor-neutral AGENTS.md instruction file across the repository. Records each file's path, line count, byte size, markdown section headings, and symlink status. Tool-specific instruction files (CLAUDE.md, CODEX.md, GEMINI.md) are discovered by their respective tool collectors.
plans-dir
Checks whether a dedicated plans directory exists for AI agent task planning. Tries candidate paths in order (first match wins). Records the directory path and file count.
ai-authorship
Collects AI authorship annotation data from commits. Supports the Git AI standard (refs/notes/ai) for line-level tracking and git trailers (AI-model, AI-tokens) as a lightweight fallback. Records annotation coverage across commits in scope.
How Collectors Fit into Lunar
Lunar watches your code and CI/CD systems to collect SDLC data from config files, test results, IaC, deployment configurations, security scans, and more.
Collectors are the automatic data-gathering layer. They extract structured metadata from your repositories and pipelines, feeding it into Lunar's centralized database where guardrails evaluate it to enforce your engineering standards.
Learn How Lunar Works →Example Collected Data
This collector writes structured metadata to the Component JSON. Here's an example of the data it produces:
{
"ai": {
"instructions": {
"root": {
"exists": true,
"filename": "AGENTS.md",
"lines": 85,
"bytes": 3200,
"sections": ["Project Overview", "Architecture", "Build Commands", "Testing"]
},
"all": [
{
"path": "AGENTS.md",
"dir": ".",
"filename": "AGENTS.md",
"lines": 85,
"bytes": 3200,
"sections": ["Project Overview", "Architecture", "Build Commands", "Testing"],
"is_symlink": false,
"symlink_target": null
}
],
"count": 1,
"total_bytes": 3200,
"source": { "tool": "find", "integration": "code" }
},
"plans_dir": {
"exists": true,
"path": ".agents/plans",
"file_count": 3
},
"authorship": {
"provider": "git-ai",
"total_commits": 12,
"annotated_commits": 8,
"git_ai": {
"notes_ref_exists": true,
"commits_with_notes": 8
}
}
}
}
Configuration
Configure this collector in your lunar-config.yml.
Inputs
| Input | Required | Default | Description |
|---|---|---|---|
md_find_command
|
Optional |
find . \( -type f -o -type l \) -name AGENTS.md -not -path '*/node_modules/*' -not -path '*/.git/*'
|
Command to find AGENTS.md instruction files (must output one file path per line) |
plans_dir_paths
|
Optional |
.agents/plans,.ai/plans
|
Comma-separated list of candidate paths for the plans directory (first match wins) |
annotation_prefix
|
Optional |
AI-
|
Prefix for git trailer-based AI annotations |
default_branch_window
|
Optional |
50
|
Number of recent commits to scan on the default branch |
Documentation
View on GitHubAI Collector
Collect tool-agnostic AI coding assistant usage data from repositories.
Overview
This collector tracks tool-agnostic AI coding assistant usage across your repositories. It discovers the vendor-neutral AGENTS.md instruction file, checks for dedicated planning directories, and collects AI authorship annotations from commits. Tool-specific instruction files (CLAUDE.md, CODEX.md, GEMINI.md) are discovered by their respective tool collectors.
This is the tool-agnostic portion of the ai.* namespace. Tool-specific collectors (claude, coderabbit, codex, gemini) handle detection of individual tools.
Collected Data
This collector writes to the following Component JSON paths:
| Path | Type | Description |
|---|---|---|
.ai.instructions |
object | Agent instruction files: root file info, all files with sections/symlink status, per-directory grouping, total byte count |
.ai.plans_dir |
object | Plans directory existence, path, and file count |
.ai.authorship |
object | AI authorship annotation coverage across commits (Git AI notes or git trailers) |
Collectors
This integration provides the following collectors (use include to select a subset):
| Collector | Hook | Description |
|---|---|---|
instruction-files |
code |
Discovers AGENTS.md files with metadata and symlink status |
plans-dir |
code |
Checks for a dedicated AI plans directory |
ai-authorship |
code |
Collects AI authorship annotations from commits via Git AI standard or git trailers |
Installation
Add to your lunar-config.yml:
collectors:
- uses: github://earthly/lunar-lib/collectors/ai@main
on: ["domain:your-domain"]
# with:
# md_find_command: "find . -type f -name AGENTS.md"
# plans_dir_paths: ".agents/plans,.ai/plans"
# annotation_prefix: "AI-"
# default_branch_window: "50"
Open Source
This collector is open source and available on GitHub. Contribute improvements, report issues, or fork it for your own use.
Common Use Cases
Explore guardrails that use data from AI Collector.
Ready to Automate Your Standards?
See how Lunar can turn your AGENTS.md, engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 100+ built-in guardrails.