# The 7 Hard Metrics for Quality Screening in AI Berkshire: A Technical Deep Dive

> Discover the 7 hard metrics AI Berkshire uses for quality screening. Learn about ROE, debt-to-equity, operating cash flow, and more for robust AI-driven investment analysis.

- Repository: [Xbt Lin/ai-berkshire](https://github.com/xbtlin/ai-berkshire)
- Tags: deep-dive
- Published: 2026-06-27

---

**AI Berkshire's Quality-Screen skill applies seven strict quantitative filters—including ROE ≥15%, debt-to-equity ≤0.5, and positive operating cash flow—that a company must satisfy simultaneously to pass the initial screening gate.**

The AI Berkshire repository (`xbtlin/ai-berkshire`) implements a defensive investing framework inspired by Warren Buffett's selection criteria. At its core lies the `/quality-screen` command, which uses **hard-coded financial thresholds** to eliminate low-quality stocks before deeper analysis. These seven hard metrics for quality screening in AI Berkshire are defined in [`skills/quality-screen.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/quality-screen.md) and enforced by the `quality_screen()` function in [`tools/stock_screener.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/stock_screener.py).

## The Seven Hard Metrics Explained

The quality screen treats these metrics as **hard filters**, meaning failure on any single criterion results in immediate exclusion. According to the repository's reference implementation, companies must satisfy all seven conditions to proceed.

### 1. Positive Net Profit

The most fundamental requirement validates that a company is currently profitable. The filter checks that **net profit > 0**, ensuring the business generates bottom-line earnings rather than losses.

### 2. Return on Equity (ROE) ≥ 15%

This metric measures management's efficiency in converting shareholder equity into profits. The threshold of **ROE ≥ 15%** identifies companies with strong capital allocation skills and competitive moats.

### 3. Debt-to-Equity Ratio ≤ 0.5

Financial conservatism is enforced through a **debt-to-equity ≤ 0.5** limit. This low-leverage requirement reduces bankruptcy risk and ensures companies can withstand economic downturns without excessive interest burdens.

### 4. Gross Margin ≥ 30%

Pricing power and cost discipline are captured by the **gross margin ≥ 30%** threshold. High margins indicate either strong brand value or operational efficiency that protects profits during competitive pressures.

### 5. Consistent Earnings Growth (≥ 10% YoY)

Sustainability requires a **three-year average year-over-year earnings growth ≥ 10%**. This filter eliminates cyclical anomalies and one-time windfalls, focusing on companies with durable profit trajectories.

### 6. Positive Operating Cash Flow

Accounting profits must translate to actual cash. The screen requires **positive operating cash flow**, verifying that earnings are backed by real cash generation rather than accrual accounting adjustments.

### 7. Institutional Ownership ≥ 20%

Smart money validation comes from the **institutional ownership ≥ 20%** requirement. Significant holdings by professional investors suggest thorough due diligence and confidence in long-term viability.

## Implementation in the Source Code

The screening logic is implemented as a strict conjunction in [`tools/stock_screener.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/stock_screener.py). The `quality_screen()` function fetches fundamental data from [`data/fundamentals.json`](https://github.com/xbtlin/ai-berkshire/blob/main/data/fundamentals.json) and applies all seven filters simultaneously.

```python

# Example: run the quality screen on a list of tickers

from tools.stock_screener import quality_screen

tickers = ["AAPL", "MSFT", "TSLA", "BABA"]
good, bad = quality_screen(tickers)

print("Passed:", good)   # tickers that satisfied all 7 hard metrics

print("Failed:", bad)    # tickers rejected by at least one metric

```

Inside the screening function, the hard metrics are evaluated as boolean conditions that must all evaluate to **True**:

```python

# Inside tools/stock_screener.py (simplified)

def quality_screen(tickers: List[str]) -> Tuple[List[str], List[str]]:
    passed, failed = [], []
    for t in tickers:
        data = fetch_fundamentals(t)          # pulls financials from data/fundamentals.json

        if (data["net_profit"] > 0 and
            data["roe"] >= 0.15 and
            data["debt_to_equity"] <= 0.5 and
            data["gross_margin"] >= 0.30 and
            data["earnings_yoy_growth"] >= 0.10 and
            data["operating_cf"] > 0 and
            data["institutional_ownership"] >= 0.20):
            passed.append(t)
        else:
            failed.append(t)
    return passed, failed

```

## Key Files for Configuration

The quality screening system spans three critical files in the repository:

- **[`skills/quality-screen.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/quality-screen.md)** — Documents the seven hard metrics and their default thresholds for users interacting with the `/quality-screen` command.
- **[`tools/stock_screener.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/stock_screener.py)** — Contains the `quality_screen()` function that implements the filtering logic.
- **[`data/fundamentals.json`](https://github.com/xbtlin/ai-berkshire/blob/main/data/fundamentals.json)** — Stores the fundamental financial data (net profit, ROE, debt ratios, etc.) queried by the screening algorithm.

## Summary

AI Berkshire's quality screening system uses seven hard metrics to enforce strict financial discipline:

- **All seven criteria must be satisfied** for a ticker to pass the initial screen.
- **Profitability metrics** (net profit, ROE, gross margin) ensure earnings quality.
- **Financial health metrics** (debt-to-equity, operating cash flow) verify balance sheet strength.
- **Growth and validation metrics** (earnings growth, institutional ownership) confirm sustainability and professional confidence.
- **Thresholds are configurable** in [`skills/quality-screen.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/quality-screen.md), though the defaults reflect conservative Buffett-style criteria.

## Frequently Asked Questions

### What happens if a company fails just one of the seven hard metrics?

The screen operates on a **strict rejection principle**. If a company fails any single metric—such as having a debt-to-equity ratio of 0.6 or ROE of 14%—it is immediately placed in the failed list. This "hard" approach ensures only companies meeting all quality benchmarks proceed to further analysis.

### Can the threshold values for the seven metrics be customized?

Yes. While the `quality_screen()` function in [`tools/stock_screener.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/stock_screener.py) uses hardcoded defaults (ROE ≥ 0.15, debt-to-equity ≤ 0.5, etc.), these values are documented as configurable in [`skills/quality-screen.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/quality-screen.md). Users can modify these thresholds to match different risk tolerances or sector-specific requirements.

### Where does AI Berkshire source the financial data for these metrics?

The screening algorithm pulls fundamental data from [`data/fundamentals.json`](https://github.com/xbtlin/ai-berkshire/blob/main/data/fundamentals.json), which contains processed financial statements including net profit, ROE calculations, debt ratios, and ownership statistics. This centralized data store ensures the `quality_screen()` function evaluates consistent metrics across all tickers.

### How does the AI Berkshire quality screen differ from soft screening methods?

Unlike soft screens that rank or score companies on a gradient, AI Berkshire's **hard metrics** function as binary gates. As implemented in [`tools/stock_screener.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/stock_screener.py), the logic uses strict boolean comparisons (`>`, `>=`, `<=`) that result in immediate exclusion if any condition is not met, eliminating subjective judgment from the initial filtering phase.