# How the Hiring Agent Classifies Open Source vs. Self-Projects: Repository Detection Logic

> Learn how the Hiring Agent classifies open source vs self projects by detecting GitHub repository visibility logic in github.py. Understand repo detection and contribution counting.

- Repository: [HackerRank/hiring-agent](https://github.com/interviewstreet/hiring-agent)
- Tags: internals
- Published: 2026-06-28

---

**The Hiring Agent distinguishes open-source contributions from self-projects by inspecting GitHub repository visibility in [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py), where public repositories increment the open-source counter and private or missing repositories increment the self-project tally.**

The interviewstreet/hiring-agent repository automates candidate screening by parsing project portfolios and categorizing each entry. When analyzing submissions, the system applies a binary classification algorithm that separates collaborative open-source work from personal self-projects based on repository metadata and accessibility.

## Classification Logic in github.py

The core classification engine resides in [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py), specifically around line 291, where the agent aggregates the two categories and reports the counts:

```python

# github.py (≈ line 291)

📊 Project classification: {open_source_count} open source, {self_project_count} self projects

```

### Repository Visibility as the Primary Signal

The agent determines project category by evaluating GitHub URL accessibility. **Public repositories** automatically qualify as open-source contributions, while **private repositories** or entries without GitHub URLs fall into the self-project category. The implementation queries the GitHub API or inspects URL patterns to verify visibility status before incrementing the respective counters.

### License Detection (Secondary Validation)

When a repository is public, the agent optionally scans for a `LICENSE` file or recognized open-source license identifiers. While visibility remains the primary criterion, the presence of a standard license reinforces the open-source classification in the internal tally.

## How Self-Projects Are Identified

The Hiring Agent applies specific rules to flag self-projects:

- **Missing GitHub URLs**: Projects submitted without repository links (descriptions only or personal websites) automatically classify as self-projects.
- **Private Repository Access**: Entries with GitHub URLs that resolve to private or inaccessible repositories increment the `self_project_count`.
- **No License File**: While not definitive, the absence of licensing metadata in conjunction with private visibility confirms the self-project designation.

## Code Implementation and Examples

The classification logic is encapsulated in the `ProjectClassifier` class within [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py). Below is a practical implementation demonstrating how to invoke the categorization logic:

```python
from hiring_agent.github import ProjectClassifier

# Example list of projects supplied by a candidate

projects = [
    {"name": "FastAPI-Demo", "repo_url": "https://github.com/alice/fastapi-demo"},
    {"name": "Internal Dashboard", "repo_url": None},
]

classifier = ProjectClassifier()
open_src, self_proj = classifier.categorise(projects)

print(f"Open-source: {open_src}, Self-projects: {self_proj}")

# Output: Open-source: 1, Self-projects: 1

```

### Accessing Raw Classification Counts

To inspect the classification results directly, reference the internal counters updated by `ProjectClassifier`. These values populate the summary log line at line 291 in [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py), displaying the final `open_source_count` and `self_project_count` to reviewers.

## Integration with Output Reporting

After classification, the counts are formatted for display. The [`prompt.py`](https://github.com/interviewstreet/hiring-agent/blob/main/prompt.py) module constructs the final user-facing message that incorporates the classification line, presenting the open-source versus self-project breakdown in the agent's output summary.

## Summary

- The Hiring Agent in `interviewstreet/hiring-agent` classifies projects by checking GitHub repository visibility in [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py).
- **Public repositories** are categorized as open-source; **private or missing repositories** are labeled as self-projects.
- Classification counts (`open_source_count` and `self_project_count`) are tallied around line 291 and displayed via the logging mechanism.
- The `ProjectClassifier` class provides the programmatic interface for categorizing project lists.
- Output formatting occurs in [`prompt.py`](https://github.com/interviewstreet/hiring-agent/blob/main/prompt.py), which renders the final classification summary for reviewers.

## Frequently Asked Questions

### How does the Hiring Agent determine if a project is open source?

The agent checks whether the candidate provided a public GitHub repository URL. If the repository is accessible and public, it increments the `open_source_count`. Private repositories or entries without GitHub links are classified as self-projects and increment the `self_project_count` instead.

### What qualifies as a self-project in the Hiring Agent system?

Any project entry without a GitHub URL, or with a URL pointing to a private or inaccessible repository, is automatically classified as a self-project. This category also includes personal projects hosted on private infrastructure or submitted as plain text descriptions without repository links.

### Where is the classification logic implemented in the codebase?

The core classification algorithm resides in [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py) around line 291, within the `ProjectClassifier` class. This module handles repository validation, visibility checks, and maintains the running counters for both project types according to the interviewstreet/hiring-agent source code.

### Does the Hiring Agent check for open-source licenses when classifying projects?

The agent optionally inspects public repositories for `LICENSE` files or recognized license identifiers. While repository visibility remains the primary classification criterion, the presence of a standard open-source license reinforces the open-source categorization in the internal tally.