Metadata-Version: 2.4
Name: agent-cold-start
Version: 0.2.0
Summary: Fast, language-agnostic AI agent cold-start evaluation CLI and skill
Author-email: Ariiies <luisaries1998@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/Ariiies/agent-cold-start
Project-URL: Repository, https://github.com/Ariiies/agent-cold-start
Project-URL: Issues, https://github.com/Ariiies/agent-cold-start/issues
Keywords: ai-agents,benchmark,evaluation,cli,cold-start
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: yeny<1.0,>=0.1.1
Requires-Dist: pyyaml>=6.0
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Dynamic: license-file

# agent-cold-start

Harness Health Check diagnostic tool and cold-start benchmark for AI coding agents (Schema v3.0, backward compatible with Schema v2.0 / v2.1).

`agent-cold-start` deterministically evaluates repository onboarding clarity and harness health. Powered by an in-memory TF-IDF text matcher (`DefaultMatcher` using standalone `yeny` utilities with zero disk footprint), it classifies repository comprehension into actionable 5-tier health states (`OPTIMAL`, `HEALTHY`, `STABLE`, `DEGRADED`, `AT_RISK`, plus `INVALID`) with built-in anti-contamination safeguards.

## 1. Prerequisites & Global Installation

Install `pipx` via system package manager and ensure user PATH is configured:

```bash
# Ubuntu / Debian:
sudo apt update && sudo apt install -y pipx && pipx ensurepath

# Fedora / RHEL:
sudo dnf install -y pipx && pipx ensurepath

# Install from PyPI:
pipx install agent-cold-start
# Or with pip:
pip install agent-cold-start

# Optional: install latest development main branch or local source:
# pipx install git+https://github.com/Ariiies/agent-cold-start.git
# pipx install -e /path/to/agent-cold-start
```

Install the skill globally from a cloned copy of this repository:

```bash
# Cursor:
mkdir -p ~/.cursor/skills && cp -r skill/cold-start-test ~/.cursor/skills/

# Codex / Gemini CLI / other agents:
mkdir -p ~/.agents/skills && cp -r skill/cold-start-test ~/.agents/skills/
```

## 2. Quick Start: Minimal `eval.json` (Schema v3.0)

In Schema v3.0, you only need a top-level JSON array (or YAML list) of 3 to 15 question objects at `.harness/eval.json` (or `eval.json` at repo root). Only `"question"` and `"expected_answer"` are required — no config file is needed to get started (see [skill/cold-start-test/references/eval.template.json](https://github.com/Ariiies/agent-cold-start/blob/main/skill/cold-start-test/references/eval.template.json) for a starter template):

```json
[
  {
    "question": "How is text similarity scored and how does it avoid disk I/O?",
    "expected_answer": "DefaultMatcher runs pure in-memory TF-IDF scoring using standalone yeny.utils helpers with zero disk footprint."
  },
  {
    "question": "Which CLI subcommands orchestrate an evaluation?",
    "expected_answer": "The CLI provides validate, start, and evaluate subcommands."
  },
  {
    "question": "How is benchmark contamination prevented?",
    "expected_answer": "The start command sanitizes questions and agents never open eval.json."
  }
]
```

With the minimal 2-field format:
- `id` auto-generates as `"q1"`, `"q2"`, `"q3"`, ... by 1-based index.
- `category` defaults to `"general"`, `weight` defaults to `1.0`, and `max_words` defaults to `60`.
- Because `key_concepts` and `expected_paths` are omitted, weights dynamically redistribute to score 100% via `yeny` similarity.

## 3. Optional `config.yaml` / `config.json` & Advanced Question Options

For project metadata, custom scoring weights, thresholds, language enforcement, harness file verification, time-cap enforcement, or global guardrails, add an optional `config.yaml` (or `config.yml` / `config.json`) alongside `eval.json` (or pass `--config PATH`). See [skill/cold-start-test/references/config.yaml](https://github.com/Ariiies/agent-cold-start/blob/main/skill/cold-start-test/references/config.yaml), [examples/basic/config.json](https://github.com/Ariiies/agent-cold-start/blob/main/examples/basic/config.json), and [examples/basic/eval.json](https://github.com/Ariiies/agent-cold-start/blob/main/examples/basic/eval.json).

### `config.yaml` Fields & Defaults
```yaml
schema_version: "3.0"
project: "my-project"
language: "en"
time_limit_seconds: 180
enforce_time_cap: true
default_max_words: 60

thresholds:
  optimal: 90.0
  healthy: 80.0
  stable: 70.0
  degraded: 60.0

scoring_weights:
  concepts: 0.50
  paths: 0.25
  similarity: 0.25

harness_checks:
  missing_file_penalty: 5.0
  required_files:
    - "AGENTS.md"

global_forbidden: []
```
- **`language`** *(optional)*: Expected answer language (e.g., `"en"`, `"es"`). Emitted in sanitized `start` output so agents answer in the configured language.
- **`enforce_time_cap`** *(default `true`)*: When `true` and `elapsed_seconds > time_limit_seconds`, caps `OPTIMAL` and `HEALTHY` health states down to `STABLE`.
- **`default_max_words`** *(default `60`)*: Default `max_words` applied to questions that omit `max_words` (set `"max_words": null` on a question to disable its limit).
- **`scoring_weights`** *(default `0.50 / 0.25 / 0.25`)*: Keys `concepts`, `paths`, and `similarity`. All values must be finite numbers `>= 0.0` summing to `1.0` (within `1e-6`).
- **`harness_checks`** *(optional)*: `required_files` (list of repo-relative paths checked against `--repo-root`) and `missing_file_penalty` (default `5.0` points deducted per missing file from `final_score`, clamped to `[0.0, 100.0]`).
- **`global_forbidden`** *(default `[]`)*: Prohibited patterns evaluated across every question alongside per-question `forbidden` rules.
- **Config Discovery**: If `--config` is omitted, the CLI checks sibling `config.yaml`, then `config.yml`, then `config.json` in the same directory as the eval file, falling back to built-in defaults (or embedded settings for legacy Schema v2.0/v2.1 object contracts).

### Advanced Question Fields & Scoring Rules
Each question in `eval.json` also supports optional `"id"`, `"category"`, `"weight"`, `"max_words"`, `"key_concepts"`, `"expected_paths"`, and `"forbidden"`:
- **Dynamic Weight Redistribution**: If a question omits `expected_paths` or `key_concepts`, active component weights are proportionally re-normalized to sum to `1.0`.
- **Alias Groups in `key_concepts`**: Each entry may be a string or a non-empty list of alias strings (e.g., `["in-memory", "in memory", "RAM"]`). Matching any alias satisfies the concept; missing concepts report the first alias as the canonical label.
- **Time Adjustment Gate**: Positive on-time bonus (`+3.0`) is awarded only when `understanding_score >= thresholds.stable` (default `70.0%`). Overtime penalties remain unchanged when `elapsed_seconds > time_limit_seconds`.
- **Backward Compatibility**: Legacy Schema v2.0 and v2.1 object contracts (`{"schema_version": "2.0"|"2.1", "questions": [...]}`) continue to validate and evaluate without changes.

### Health States & Scoring
Configurable thresholds default to `90.0 / 80.0 / 70.0 / 60.0`:

| State | Default Score Range | Safety Violations | Default Exit | `--strict` Exit |
| --- | --- | --- | --- | --- |
| **`OPTIMAL`** | `>= 90.0%` (`optimal`) | `0` | `0` | `0` |
| **`HEALTHY`** | `80.0%–89.9%` (`healthy`) | `0` | `0` | `0` |
| **`STABLE`** | `70.0%–79.9%` (`stable`) | `0` | `0` | `0` |
| **`DEGRADED`** | `60.0%–69.9%` (`degraded`) | `0` | `0` | `1` |
| **`AT_RISK`** | `< 60.0%` | or `>= 1` | `1` | `1` |
| **`INVALID`** | Contaminated (`"contaminated": true`) | — | `1` | `1` |

## 4. Usage & CLI Reference

### Autonomous Agent Trigger
In any repository with `eval.json`, prompt:
> *"Run agent-cold-start"* or *"Run harness health check"*

The agent loads the skill, starts the timer, formulates answers, runs single-shot evaluation, and presents a diagnostic report without reading `eval.json` or config files.

### Manual CLI Commands
```bash
# 1. Validate evaluation contract schema (auto-discovers sibling config.yaml -> config.yml -> config.json)
agent-cold-start validate .harness/eval.json
agent-cold-start validate .harness/eval.json --config .harness/config.yaml

# 2. Start session (outputs sanitized questions, session_file timer, and a session-unique answers_file)
agent-cold-start start .harness/eval.json --config .harness/config.yaml

# 3. Evaluate answers submission (write answers to the answers_file from step 2 using the same shell)
agent-cold-start evaluate .harness/eval.json <answers_file> --repo-root . --session-file <session_file>
agent-cold-start evaluate .harness/eval.json <answers_file> --repo-root . --elapsed 42.5 --config .harness/config.yaml

# Optional flags:
# --config PATH        Explicit path to config file (.yaml/.yml/.json; overrides sibling auto-discovery)
# --session-file PATH  Read wall-clock elapsed time from start session file (overrides JSON elapsed_seconds);
#                      answers files older than the session start are rejected as stale
# --elapsed SECONDS    Explicit elapsed time override (highest precedence)
# --strict             Return exit code 1 (and passed=false in JSON) if health status is DEGRADED (OPTIMAL/HEALTHY/STABLE pass)
# --format json        Output machine-readable JSON report
```

## License
MIT (see [LICENSE](https://github.com/Ariiies/agent-cold-start/blob/main/LICENSE))
