diff --git a/apps/api/src/hackproof/chat/briefs.py b/apps/api/src/hackproof/chat/briefs.py
index c96a277..7ca0416 100644
--- a/apps/api/src/hackproof/chat/briefs.py
+++ b/apps/api/src/hackproof/chat/briefs.py
@@ -1,21 +1,88 @@
import json
+from collections import Counter
from typing import Any, Literal
-from pydantic import BaseModel
+from pydantic import BaseModel, Field
from pydantic_core import to_jsonable_python
from hackproof import queries
from hackproof.chat.prompts import prompt
+from hackproof.hackathon import Place
+from hackproof.schemas import Tier
HEAVY_FIELDS = {"dependencies", "owner_avatar"}
SAMPLE = 8
+STRICT: list[Tier] = ["verified", "likely"]
-PageKind = Literal["home", "project", "builder"]
+PageKind = Literal["home", "project", "builder", "filter"]
+Track = Literal["genesis", "scale"]
class Page(BaseModel):
kind: PageKind
id: str | None = None
+ filters: dict[str, list[str]] | None = None
+
+
+class ProjectFilters(BaseModel):
+ tiers: list[Tier] | None = Field(
+ default=None, description="Evidence tiers to include; null means verified and likely"
+ )
+ track: Track | None = Field(
+ default=None,
+ description="genesis (repo created inside the window) or scale (older repo); null for both",
+ )
+ integrations: list[str] | None = Field(
+ default=None,
+ description="Partner slugs from get_integrations; keeps projects using any of them",
+ )
+ tools: list[str] | None = Field(
+ default=None,
+ description="Stellar tooling slugs from get_tools; keeps projects using any of them",
+ )
+ agents: list[str] | None = Field(
+ default=None,
+ description="AI coding agent slugs from get_agents; keeps projects showing any of them",
+ )
+ languages: list[str] | None = Field(
+ default=None, description="Primary repo languages, such as TypeScript or Rust"
+ )
+ countries: list[str] | None = Field(
+ default=None, description="ISO 3166-1 alpha-2 codes of the repo owner's country"
+ )
+ activity: list[Literal["contracts", "failed"]] | None = Field(
+ default=None,
+ description="contracts keeps projects that deployed contracts; failed keeps projects "
+ "with failed transactions",
+ )
+ awards: list[Place] | None = Field(
+ default=None, description="first or runner-up keeps projects that won that award"
+ )
+
+ def list_args(self) -> dict[str, Any]:
+ return {
+ "tiers": self.tiers or STRICT,
+ "track": self.track,
+ "integrations": self.integrations,
+ "tools": self.tools,
+ "agents": self.agents,
+ "languages": self.languages,
+ "countries": self.countries,
+ "activity": self.activity,
+ "awards": self.awards,
+ }
+
+
+PAGE_FILTERS = {
+ "tier": "tiers",
+ "partner": "integrations",
+ "tool": "tools",
+ "agent": "agents",
+ "language": "languages",
+ "country": "countries",
+ "activity": "activity",
+ "award": "awards",
+}
def slim(items: list[dict[str, Any]]) -> list[dict[str, Any]]:
@@ -78,11 +145,71 @@ async def builder_brief(address: str) -> dict[str, Any] | None:
)
+def _top(counter: Counter[str], size: int) -> list[dict[str, Any]]:
+ return [{"name": name, "projects": count} for name, count in counter.most_common(size)]
+
+
+async def summarize_view(filters: ProjectFilters) -> dict[str, Any]:
+ items, total = await queries.list_page("projects", **filters.list_args(), limit=10_000)
+ topics: Counter[str] = Counter()
+ stack: Counter[str] = Counter()
+ partners: Counter[str] = Counter()
+ tooling: Counter[str] = Counter()
+ agents: Counter[str] = Counter()
+ for item in items:
+ topics.update(topic.lower() for topic in item["topics"] or [])
+ stack.update(list((item["dependencies"] or {}).get("packages", {})))
+ partners.update(item["integrations"])
+ tooling.update(item["tools"])
+ agents.update(item["agents"])
+ return {
+ "total": total,
+ "by_tier": dict(Counter(item["tier"] for item in items)),
+ "by_track": dict(Counter(item["track"] for item in items)),
+ "contracts": sum(item["contracts"] for item in items),
+ "wasm_uploads": sum(item["wasm_uploads"] for item in items),
+ "languages": _top(Counter(item["language"] for item in items if item["language"]), 10),
+ "topics": _top(topics, 20),
+ "stellar_packages": _top(stack, 15),
+ "integrations": _top(partners, 15),
+ "stellar_tooling": _top(tooling, 10),
+ "ai_agents": _top(agents, 10),
+ "countries": _top(Counter(item["country"] for item in items if item["country"]), 10),
+ "descriptions": [
+ {"project_id": item["project_id"], "description": item["description"][:140]}
+ for item in items
+ if item["description"]
+ ][:25],
+ }
+
+
+def view_filters(selected: dict[str, list[str]]) -> ProjectFilters:
+ known = {
+ PAGE_FILTERS[key]: values[:20] for key, values in selected.items() if key in PAGE_FILTERS
+ }
+ tracks = selected.get("track", [])
+ return ProjectFilters.model_validate(
+ {**known, "track": tracks[0] if len(tracks) == 1 else None}
+ )
+
+
+async def filter_brief(selected: dict[str, list[str]]) -> str:
+ filters = view_filters(selected)
+ summary = await summarize_view(filters)
+ return prompt(
+ "page-filter",
+ filters=json.dumps(selected),
+ data=json.dumps(to_jsonable_python(summary), default=str),
+ )
+
+
async def describe_page(page: Page | None) -> str:
if page is None:
return ""
if page.kind == "home":
return prompt("page-home")
+ if page.kind == "filter":
+ return await filter_brief(page.filters or {})
if not page.id:
return ""
diff --git a/apps/api/src/hackproof/chat/system-prompt.md b/apps/api/src/hackproof/chat/system-prompt.md
index d1b0dbb..7cd776b 100644
--- a/apps/api/src/hackproof/chat/system-prompt.md
+++ b/apps/api/src/hackproof/chat/system-prompt.md
@@ -38,6 +38,10 @@ Track is inferred, not declared. A project is genesis when its repo was created
Integrations: each project has integrations, the slugs of Stellar ecosystem partners from the SCF integration list that its code uses. A partner is detected from a package in a dependency manifest in any language, or from the partner's API host in source or config. These are evidence of use, not of a working integration.
+Stellar tooling: each project has tools, the slugs of Stellar developer tools it uses: Scaffold Stellar, Stellar Registry, Stellar Raven (Stellar's own assistant, detected from its MCP endpoint in agent config) and Stellar Skills. Detection reads manifests and hosts in code and config.
+
+AI agents: each project has agents, the slugs of AI coding agents it shows traces of. Detection reads agent config files in the repo, such as CLAUDE.md, .cursor or .codex, and commit authors such as the claude or cursoragent accounts. AGENTS.md is a convention several tools share, so it is not one tool. This is a lower bound: a team that used an agent without leaving a trace is not counted, so never say how many teams did not use AI.
+
Other fields: contracts, wasm_uploads, failed_txs and classic_ops count on chain activity inside the window. builders is the number of deploy accounts. window_commits and total_commits come from GitHub. stack lists the Stellar packages the repo declares. topics are the GitHub topics the team chose. country comes from the owner's public GitHub location and is often missing.
### How to work
@@ -45,6 +49,7 @@ Other fields: contracts, wasm_uploads, failed_txs and classic_ops count on chain
- Use the tools for every fact and number. Never guess, and never estimate a count by counting rows yourself. Use the total returned by a tool.
- For questions about what projects are about, how many there are, or any breakdown by track, tier, language, topic or stack, call summarize_projects first. It aggregates over every matching project. Then call query_projects to show examples.
- For questions about which projects use a partner such as Trustless Work, Privy, Soroswap or Stellar Wallets Kit, call get_integrations for the slugs and counts, then query_projects with integrations set. Say that detection reads dependency manifests and API hosts in code, so a project that only mentions a partner in prose is not counted.
+- For questions about Stellar tools, call get_tools for the slugs and counts. For questions about AI agents, call get_agents. Then pass the slugs as tools or agents to query_projects or summarize_projects. Both tools also filter by languages, countries, activity and awards.
- For one project call get_project. For one deploy account call get_builder. For counts and the headline numbers call get_stats. For activity over time call get_timeline. For geography call get_countries.
- Searching with q matches project ids and descriptions only. It is not a way to filter by track or tier. Use the track and tiers arguments.
- Several independent tool calls can go in one turn. Do that instead of one at a time.
@@ -75,3 +80,9 @@ The user is on the page for {subject}. Read "{pronoun}", "it" and "here" as this
## page-empty
The user is on the page for {subject}, which has no data inside the hack window.
+
+## page-filter
+
+The user is on the home page, looking at the explorer filtered by {filters}. The keys are the site's filter names: tier, track, award, partner (the integrations argument), tool, agent, language, country and activity. Read "these projects", "this view", "they" and "them" as the projects matching exactly those filters, and keep every tool call inside them by passing the same filters. A summary of the matching set is already loaded below, so do not fetch it again for basic questions.
+
+{data}
diff --git a/apps/api/src/hackproof/chat/tools.py b/apps/api/src/hackproof/chat/tools.py
index 532ef81..d6ce2e9 100644
--- a/apps/api/src/hackproof/chat/tools.py
+++ b/apps/api/src/hackproof/chat/tools.py
@@ -1,15 +1,11 @@
-from collections import Counter
-from typing import Annotated, Any, Literal
+from typing import Annotated, Any
from pydantic import BaseModel, Field
from pydantic_core import to_jsonable_python
from hackproof import queries
-from hackproof.chat.briefs import builder_brief, project_brief, slim
-from hackproof.schemas import Tier
+from hackproof.chat.briefs import ProjectFilters, builder_brief, project_brief, slim, summarize_view
-Track = Literal["genesis", "scale"]
-STRICT = ["verified", "likely"]
WEB_SEARCH = {"type": "web_search_20250305", "name": "web_search", "max_uses": 3}
Limit = Annotated[int, Field(ge=1, le=25, description="Rows to return")]
@@ -19,22 +15,11 @@
]
-class QueryProjects(BaseModel):
+class QueryProjects(ProjectFilters):
"""Find HackMeridian projects. Ordered by evidence strength, then on-chain activity. Each
project has an award field: first, runner-up, or null."""
q: Search = None
- tiers: list[Tier] | None = Field(
- default=None, description="Evidence tiers to include; null means verified and likely"
- )
- track: Track | None = Field(
- default=None,
- description="genesis (repo created inside the window) or scale (older repo); null for both",
- )
- integrations: list[str] | None = Field(
- default=None,
- description="Partner slugs from get_integrations; keeps projects using any of them",
- )
winners: bool = Field(
default=False,
description="True keeps only the HackMeridian award winners: first place and runner-ups",
@@ -71,19 +56,10 @@ class QueryFailed(BaseModel):
offset: Offset = 0
-class SummarizeProjects(BaseModel):
+class SummarizeProjects(ProjectFilters):
"""Aggregate every matching project: counts by tier and track, on chain totals, top
- languages, topics, Stellar packages and countries, plus a sample of descriptions. Use this
- for any breakdown or "what are they building" question."""
-
- tiers: list[Tier] | None = Field(
- default=None, description="Evidence tiers to include; null means verified and likely"
- )
- track: Track | None = Field(default=None, description="genesis, scale, or null for both")
- integrations: list[str] | None = Field(
- default=None,
- description="Partner slugs from get_integrations; keeps projects using any of them",
- )
+ languages, topics, Stellar packages, integrations, tooling, AI agents and countries, plus a
+ sample of descriptions. Use this for any breakdown or "what are they building" question."""
class GetProject(BaseModel):
@@ -104,6 +80,17 @@ class GetIntegrations(BaseModel):
hosts in code, not from READMEs."""
+class GetTools(BaseModel):
+ """List the Stellar developer tools we detect (such as Scaffold Stellar, Stellar Registry,
+ Stellar Raven and Stellar Skills) with how many verified and likely projects use each."""
+
+
+class GetAgents(BaseModel):
+ """List the AI coding agents we detect (slug, name) with how many verified and likely projects
+ show each. Detection reads agent config files such as CLAUDE.md or .cursor and commit authors,
+ so it is a lower bound: a tool that leaves no trace is not counted."""
+
+
class GetStats(BaseModel):
"""Headline counts: projects by tier, contracts, builders, contributors, countries."""
@@ -125,6 +112,8 @@ class GetCountries(BaseModel):
"get_project": GetProject,
"get_builder": GetBuilder,
"get_integrations": GetIntegrations,
+ "get_tools": GetTools,
+ "get_agents": GetAgents,
"get_stats": GetStats,
"get_timeline": GetTimeline,
"get_countries": GetCountries,
@@ -140,54 +129,14 @@ class GetCountries(BaseModel):
]
-def _top(counter: Counter[str], size: int) -> list[dict[str, Any]]:
- return [{"name": name, "projects": count} for name, count in counter.most_common(size)]
-
-
-async def summarize(args: SummarizeProjects) -> dict[str, Any]:
- items, total = await queries.list_page(
- "projects",
- tiers=args.tiers or STRICT,
- track=args.track,
- integrations=args.integrations,
- limit=10_000,
- )
- topics: Counter[str] = Counter()
- stack: Counter[str] = Counter()
- partners: Counter[str] = Counter()
- for item in items:
- topics.update(topic.lower() for topic in item["topics"] or [])
- stack.update(list((item["dependencies"] or {}).get("packages", {})))
- partners.update(item["integrations"])
- return {
- "total": total,
- "by_tier": dict(Counter(item["tier"] for item in items)),
- "by_track": dict(Counter(item["track"] for item in items)),
- "contracts": sum(item["contracts"] for item in items),
- "wasm_uploads": sum(item["wasm_uploads"] for item in items),
- "languages": _top(Counter(item["language"] for item in items if item["language"]), 10),
- "topics": _top(topics, 20),
- "stellar_packages": _top(stack, 15),
- "integrations": _top(partners, 15),
- "countries": _top(Counter(item["country"] for item in items if item["country"]), 10),
- "descriptions": [
- {"project_id": item["project_id"], "description": item["description"][:140]}
- for item in items
- if item["description"]
- ][:25],
- }
-
-
async def run_tool(name: str, raw: dict[str, Any]) -> Any:
args = TOOLS[name].model_validate(raw)
match args:
case QueryProjects():
items, total = await queries.list_page(
"projects",
+ **args.list_args(),
q=args.q,
- tiers=args.tiers or STRICT,
- track=args.track,
- integrations=args.integrations,
winners=args.winners,
limit=args.limit,
offset=args.offset,
@@ -210,13 +159,17 @@ async def run_tool(name: str, raw: dict[str, Any]) -> Any:
"failed", q=args.q, account=args.account, limit=args.limit, offset=args.offset
)
case SummarizeProjects():
- return to_jsonable_python(await summarize(args))
+ return to_jsonable_python(await summarize_view(args))
case GetProject():
return await project_brief(args.project_id) or {"error": "project not found"}
case GetBuilder():
return await builder_brief(args.address) or {"error": "no activity in the hack window"}
case GetIntegrations():
return to_jsonable_python(await queries.fetch_integrations())
+ case GetTools():
+ return to_jsonable_python(await queries.fetch_tools())
+ case GetAgents():
+ return to_jsonable_python(await queries.fetch_agents())
case GetStats():
return to_jsonable_python(await queries.fetch_stats())
case GetTimeline():
diff --git a/apps/api/src/hackproof/cli.py b/apps/api/src/hackproof/cli.py
index 2afb2dd..1ab4ed8 100644
--- a/apps/api/src/hackproof/cli.py
+++ b/apps/api/src/hackproof/cli.py
@@ -2,7 +2,7 @@
import asyncio
import logging
-from hackproof.export.jobs import run_export
+from hackproof.export.jobs import run_check, run_export
from hackproof.github.jobs import run_discover, run_scan
from hackproof.indexer.sync import run_sync
from hackproof.linking.reconcile import run_reconcile
@@ -23,6 +23,9 @@ def main() -> None:
)
commands.add_parser("reconcile", help="link chain activity to repos and build projects")
commands.add_parser("export", help="write one yaml file per project into data and its schema")
+ commands.add_parser(
+ "check", help="check, read-only, that the database matches the committed data files"
+ )
args = parser.parse_args()
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(message)s")
@@ -38,3 +41,5 @@ def main() -> None:
asyncio.run(run_reconcile())
case "export":
asyncio.run(run_export())
+ case "check":
+ raise SystemExit(asyncio.run(run_check()))
diff --git a/apps/api/src/hackproof/db.py b/apps/api/src/hackproof/db.py
index a42afb5..51ffc87 100644
--- a/apps/api/src/hackproof/db.py
+++ b/apps/api/src/hackproof/db.py
@@ -138,6 +138,16 @@
);
CREATE INDEX IF NOT EXISTS repo_tools_tool ON repo_tools (tool);
+CREATE TABLE IF NOT EXISTS repo_agents (
+ full_name TEXT NOT NULL,
+ agent TEXT NOT NULL,
+ method TEXT NOT NULL,
+ evidence TEXT NOT NULL,
+ path TEXT NOT NULL,
+ PRIMARY KEY (full_name, agent, method, evidence)
+);
+CREATE INDEX IF NOT EXISTS repo_agents_agent ON repo_agents (agent);
+
CREATE TABLE IF NOT EXISTS links (
full_name TEXT NOT NULL,
subject_kind TEXT NOT NULL,
diff --git a/apps/api/src/hackproof/export/build.py b/apps/api/src/hackproof/export/build.py
index d98a570..2e79c49 100644
--- a/apps/api/src/hackproof/export/build.py
+++ b/apps/api/src/hackproof/export/build.py
@@ -6,6 +6,8 @@
from hackproof.export.models import (
Account,
+ AgentEvidence,
+ AiAgent,
Chain,
Contract,
Contributor,
@@ -98,6 +100,14 @@
"""
+AGENTS_SQL = """
+SELECT full_name, agent, method, evidence, path
+FROM repo_agents
+WHERE full_name = ANY($1)
+ORDER BY agent, method, evidence
+"""
+
+
def _evidence_url(kind: str, subject: str) -> str | None:
match kind:
case "contract":
@@ -132,6 +142,23 @@ def _found(
return found
+def _agents(catalog: Catalog, rows: list[asyncpg.Record], repo_url: str) -> list[AiAgent]:
+ found: dict[str, list[AgentEvidence]] = defaultdict(list)
+ for row in rows:
+ found[row["agent"]].append(
+ AgentEvidence(
+ method=row["method"],
+ detail=row["evidence"],
+ repo_file_url=repo_file_url(repo_url, row["path"]) if row["path"] else None,
+ )
+ )
+ return [
+ AiAgent(slug=agent.slug, name=agent.name, website=agent.site, evidence=found[agent.slug])
+ for agent in catalog.agents
+ if agent.slug in found
+ ]
+
+
def _tools(catalog: Catalog, rows: list[asyncpg.Record], repo_url: str) -> list[EcosystemTool]:
found = _found(rows, "tool", repo_url)
return [
@@ -173,6 +200,7 @@ async def build_export(
evidence = _group(await connection.fetch(EVIDENCE_SQL, names))
integrations = _group(await connection.fetch(INTEGRATIONS_SQL, names))
tools = _group(await connection.fetch(TOOLS_SQL, names))
+ agents = _group(await connection.fetch(AGENTS_SQL, names))
catalog = get_catalog()
awards = {award.project_id: award.place for award in hackathon.awards}
@@ -200,6 +228,7 @@ async def build_export(
track_declared=row["declared_track"] is not None,
integration_partners=_partners(catalog, integrations[row["full_name"]], row["url"]),
ecosystem_tools=_tools(catalog, tools[row["full_name"]], row["url"]),
+ ai_agents=_agents(catalog, agents[row["full_name"]], row["url"]),
owner=Owner(login=row["owner"], avatar_url=row["owner_avatar"], country=row["country"]),
contributors=[
Contributor(
diff --git a/apps/api/src/hackproof/export/check.py b/apps/api/src/hackproof/export/check.py
new file mode 100644
index 0000000..d498586
--- /dev/null
+++ b/apps/api/src/hackproof/export/check.py
@@ -0,0 +1,14 @@
+from pathlib import Path
+
+
+def drift(generated: Path, committed: Path) -> list[str]:
+ ours = {path.relative_to(generated) for path in generated.rglob("*.yml")}
+ theirs = {path.relative_to(committed) for path in committed.rglob("*.yml")}
+ found = [f"only in the files: {name}" for name in sorted(theirs - ours)]
+ found += [f"only in the database: {name}" for name in sorted(ours - theirs)]
+ found += [
+ f"differs: {name}"
+ for name in sorted(ours & theirs)
+ if (generated / name).read_bytes() != (committed / name).read_bytes()
+ ]
+ return found
diff --git a/apps/api/src/hackproof/export/files.py b/apps/api/src/hackproof/export/files.py
index fb1f2d7..7801da9 100644
--- a/apps/api/src/hackproof/export/files.py
+++ b/apps/api/src/hackproof/export/files.py
@@ -54,6 +54,18 @@ class FileIntegration(FileModel):
evidence: list[FileIntegrationEvidence]
+class FileAgentEvidence(FileModel):
+ method: Literal["file", "author"]
+ detail: str
+ file_url: str | None = None
+
+
+class FileAgent(FileModel):
+ slug: str
+ name: str
+ evidence: list[FileAgentEvidence]
+
+
class FileContributor(FileModel):
login: str
contributions: int
@@ -96,6 +108,10 @@ class ProjectFile(FileModel):
tools: list[FileIntegration] = Field(
default_factory=list, description="Stellar developer tools the repo builds with"
)
+ agents: list[FileAgent] = Field(
+ default_factory=list,
+ description="AI coding agents the repo shows traces of, in config files or commits",
+ )
chain: FileChain
contributors: list[FileContributor]
@@ -193,6 +209,19 @@ def project_file(event: str, project: Project) -> ProjectFile:
)
for tool in project.ecosystem_tools
],
+ agents=[
+ FileAgent(
+ slug=agent.slug,
+ name=agent.name,
+ evidence=[
+ FileAgentEvidence(
+ method=item.method, detail=item.detail, file_url=item.repo_file_url
+ )
+ for item in agent.evidence
+ ],
+ )
+ for agent in project.ai_agents
+ ],
chain=FileChain(
contracts=chain.contract_count,
wasm_uploads=chain.wasm_upload_count,
diff --git a/apps/api/src/hackproof/export/jobs.py b/apps/api/src/hackproof/export/jobs.py
index 7e543f6..f5c4cb4 100644
--- a/apps/api/src/hackproof/export/jobs.py
+++ b/apps/api/src/hackproof/export/jobs.py
@@ -1,8 +1,14 @@
+import json
import logging
+from pathlib import Path
+from tempfile import TemporaryDirectory
-from hackproof.config import ROOT
+import asyncpg
+
+from hackproof.config import ROOT, get_settings
from hackproof.db import open_pool, pool
from hackproof.export.build import build_export
+from hackproof.export.check import drift
from hackproof.export.files import write_project_files
from hackproof.hackathon import get_hackathon
@@ -19,3 +25,29 @@ async def run_export() -> None:
count = write_project_files(export, DATA)
log.info("wrote %s project files to %s", count, DATA / str(export.hackathon.starts_at.year))
+
+
+async def run_check() -> int:
+ hackathon = get_hackathon()
+ connection = await asyncpg.connect(
+ get_settings().database_url, server_settings={"default_transaction_read_only": "on"}
+ )
+ await connection.set_type_codec(
+ "jsonb", encoder=json.dumps, decoder=json.loads, schema="pg_catalog"
+ )
+ try:
+ export = await build_export(connection, hackathon)
+ finally:
+ await connection.close()
+
+ with TemporaryDirectory() as directory:
+ write_project_files(export, Path(directory))
+ found = drift(Path(directory), DATA)
+
+ for line in found:
+ log.warning(line)
+ if found:
+ log.warning("%s files differ from the database", len(found))
+ else:
+ log.info("in sync: the database matches all %s project files", len(export.projects))
+ return 1 if found else 0
diff --git a/apps/api/src/hackproof/export/models.py b/apps/api/src/hackproof/export/models.py
index 92d6ce6..06abc99 100644
--- a/apps/api/src/hackproof/export/models.py
+++ b/apps/api/src/hackproof/export/models.py
@@ -101,6 +101,26 @@ class IntegrationEvidence(Model):
repo_file_url: str = Field(description="GitHub file where it was found")
+class AgentEvidence(Model):
+ method: Literal["file", "author"] = Field(
+ description=(
+ "How the agent was found. file: one of its config files is in the repo. author: it "
+ "appears as a commit author. Using a tool that leaves no trace is not counted."
+ )
+ )
+ detail: str = Field(description="The matched file pattern or commit author login")
+ repo_file_url: str | None = Field(
+ description="GitHub file where it was found; null for a commit author"
+ )
+
+
+class AiAgent(Model):
+ slug: str = Field(description="Stable agent id, listed in data/integrations.yaml")
+ name: str = Field(description="Agent name")
+ website: str = Field(description="Agent website")
+ evidence: list[AgentEvidence] = Field(description="Where the agent was found")
+
+
class EcosystemTool(Model):
slug: str = Field(description="Stable tool id, listed in data/integrations.yaml")
name: str = Field(description="Tool name")
@@ -162,6 +182,9 @@ class Project(Model):
ecosystem_tools: list[EcosystemTool] = Field(
description="Stellar developer tools the repo builds with, such as Scaffold Stellar"
)
+ ai_agents: list[AiAgent] = Field(
+ description="AI coding agents the repo shows traces of, such as Claude Code or Cursor"
+ )
owner: Owner
contributors: list[Contributor]
chain: Chain
diff --git a/apps/api/src/hackproof/github/models.py b/apps/api/src/hackproof/github/models.py
index c05676a..f67e1c4 100644
--- a/apps/api/src/hackproof/github/models.py
+++ b/apps/api/src/hackproof/github/models.py
@@ -4,7 +4,7 @@
from pydantic import BaseModel, ConfigDict, Field
from hackproof.github.track import Track
-from hackproof.integrations.models import Detection
+from hackproof.integrations.models import AgentDetection, Detection
RefKind = Literal["contract", "account", "asset", "wasm", "network"]
@@ -60,4 +60,5 @@ class RepoScan(BaseModel):
stellar_added_in_window: bool | None
integrations: list[Detection]
tools: list[Detection] = Field(default_factory=list)
+ agents: list[AgentDetection] = Field(default_factory=list)
contributors: list[Contributor]
diff --git a/apps/api/src/hackproof/github/scan.py b/apps/api/src/hackproof/github/scan.py
index ed251ae..f69fe4f 100644
--- a/apps/api/src/hackproof/github/scan.py
+++ b/apps/api/src/hackproof/github/scan.py
@@ -16,7 +16,7 @@
from hackproof.github.track import declared_track
from hackproof.hackathon import Discovery, Window
from hackproof.integrations.catalog import Catalog, get_catalog
-from hackproof.integrations.detect import detect, detect_tools
+from hackproof.integrations.detect import detect, detect_agents, detect_tools
TEXT_SUFFIXES = {
".rs", ".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".py", ".go", ".toml", ".json",
@@ -124,6 +124,7 @@ async def scan(self, repo: Candidate) -> RepoScan | None:
if dependencies.packages
else None
)
+ contributors = contributors_from(people)
return RepoScan(
full_name=repo.full_name,
declared_track=declared_track(files),
@@ -132,7 +133,12 @@ async def scan(self, repo: Candidate) -> RepoScan | None:
stellar_added_in_window=added,
integrations=detect(files, self._catalog, repo.owner),
tools=detect_tools(files, self._catalog, repo.owner),
- contributors=contributors_from(people),
+ agents=detect_agents(
+ (entry["path"] for entry in tree["tree"]),
+ (item["login"] for item in people or []),
+ self._catalog,
+ ),
+ contributors=contributors,
)
@@ -182,6 +188,11 @@ async def store_scan(connection: asyncpg.Connection, scan: RepoScan) -> None:
"INSERT INTO repo_tools VALUES ($1, $2, $3, $4, $5)",
[(scan.full_name, t.slug, t.method, t.evidence, t.path) for t in scan.tools],
)
+ await connection.execute("DELETE FROM repo_agents WHERE full_name = $1", scan.full_name)
+ await connection.executemany(
+ "INSERT INTO repo_agents VALUES ($1, $2, $3, $4, $5)",
+ [(scan.full_name, a.slug, a.method, a.evidence, a.path) for a in scan.agents],
+ )
await connection.execute(
"""
UPDATE repos SET dependencies = $2, stellar_added_in_window = $3,
diff --git a/apps/api/src/hackproof/integrations/catalog.py b/apps/api/src/hackproof/integrations/catalog.py
index 66050eb..12b9488 100644
--- a/apps/api/src/hackproof/integrations/catalog.py
+++ b/apps/api/src/hackproof/integrations/catalog.py
@@ -23,9 +23,18 @@ class Tool(Product):
pass
+class Agent(BaseModel):
+ slug: str
+ name: str
+ site: str
+ files: list[str] = Field(default_factory=list)
+ authors: list[str] = Field(default_factory=list)
+
+
class Catalog(BaseModel):
partners: list[Partner]
tools: list[Tool] = Field(default_factory=list)
+ agents: list[Agent] = Field(default_factory=list)
def partner(self, slug: str) -> Partner:
return next(partner for partner in self.partners if partner.slug == slug)
diff --git a/apps/api/src/hackproof/integrations/detect.py b/apps/api/src/hackproof/integrations/detect.py
index 8369313..8fe000e 100644
--- a/apps/api/src/hackproof/integrations/detect.py
+++ b/apps/api/src/hackproof/integrations/detect.py
@@ -1,10 +1,11 @@
import re
-from collections.abc import Sequence
+from collections.abc import Iterable, Sequence
+from fnmatch import fnmatchcase
from pathlib import PurePosixPath
-from hackproof.github.dependencies import ECOSYSTEM, PARSERS
+from hackproof.github.dependencies import ECOSYSTEM, PARSERS, SKIP_DIRECTORIES
from hackproof.integrations.catalog import Catalog, Product
-from hackproof.integrations.models import Detection, Method
+from hackproof.integrations.models import AgentDetection, Detection, Method
PROSE_SUFFIXES = {".md", ".txt"}
@@ -72,3 +73,28 @@ def _detect(files: dict[str, str], products: Sequence[Product], owner: str) -> l
Detection(slug=partner.slug, method="endpoint", evidence=host, path=path),
)
return list(found.values())
+
+
+def _matches(path: str, pattern: str) -> bool:
+ return fnmatchcase(path, pattern) or fnmatchcase(path, f"*/{pattern}")
+
+
+def detect_agents(
+ paths: Iterable[str], logins: Iterable[str], catalog: Catalog
+) -> list[AgentDetection]:
+ tracked = [path for path in paths if not SKIP_DIRECTORIES & set(PurePosixPath(path).parts[:-1])]
+ people = {login.lower() for login in logins}
+ found: list[AgentDetection] = []
+ for agent in catalog.agents:
+ for pattern in agent.files:
+ match = next((path for path in tracked if _matches(path, pattern)), None)
+ if match:
+ found.append(
+ AgentDetection(slug=agent.slug, method="file", evidence=pattern, path=match)
+ )
+ found.extend(
+ AgentDetection(slug=agent.slug, method="author", evidence=login, path="")
+ for login in agent.authors
+ if login.lower() in people
+ )
+ return found
diff --git a/apps/api/src/hackproof/integrations/models.py b/apps/api/src/hackproof/integrations/models.py
index 3f70cf3..f1dc475 100644
--- a/apps/api/src/hackproof/integrations/models.py
+++ b/apps/api/src/hackproof/integrations/models.py
@@ -12,3 +12,15 @@ class Detection(BaseModel):
method: Method
evidence: str
path: str
+
+
+AgentMethod = Literal["file", "author"]
+
+
+class AgentDetection(BaseModel):
+ model_config = ConfigDict(frozen=True)
+
+ slug: str
+ method: AgentMethod
+ evidence: str
+ path: str
diff --git a/apps/api/src/hackproof/queries.py b/apps/api/src/hackproof/queries.py
index 92c98ff..30b6cac 100644
--- a/apps/api/src/hackproof/queries.py
+++ b/apps/api/src/hackproof/queries.py
@@ -17,6 +17,8 @@
GROUP BY i.partner ORDER BY i.partner) AS integrations,
ARRAY(SELECT t.tool FROM repo_tools t WHERE t.full_name = p.full_name
GROUP BY t.tool ORDER BY t.tool) AS tools,
+ ARRAY(SELECT a.agent FROM repo_agents a WHERE a.full_name = p.full_name
+ GROUP BY a.agent ORDER BY a.agent) AS agents,
count(*) OVER () AS total
FROM projects p
LEFT JOIN repos r ON r.full_name = p.full_name
@@ -36,6 +38,14 @@
AND ($10::text[] IS NULL OR EXISTS (
SELECT 1 FROM repo_tools t
WHERE t.full_name = p.full_name AND t.tool = ANY($10)))
+ AND ($11::text[] IS NULL OR EXISTS (
+ SELECT 1 FROM repo_agents a
+ WHERE a.full_name = p.full_name AND a.agent = ANY($11)))
+ AND ($12::text[] IS NULL OR r.language = ANY($12))
+ AND ($13::text[] IS NULL OR r.country = ANY($13))
+ AND ($14::text[] IS NULL
+ OR ('contracts' = ANY($14) AND p.contracts > 0)
+ OR ('failed' = ANY($14) AND p.failed_txs > 0))
ORDER BY array_position(
ARRAY['verified', 'likely', 'possible', 'unattributed'], p.tier),
p.contracts DESC, p.classic_ops DESC, r.stars DESC NULLS LAST, p.last_activity DESC
@@ -131,6 +141,14 @@
ORDER BY {METHOD_RANK_SQL}, l.subject_kind, l.subject
"""
+PERSON_SQL = """
+SELECT c.login, c.url, c.avatar_url, c.contributions, c.full_name, u.country
+FROM repo_contributors c
+LEFT JOIN github_users u ON u.login = c.login
+WHERE lower(c.login) = lower($1)
+ORDER BY c.contributions DESC, c.full_name
+"""
+
CONTRIBUTORS_SQL = """
SELECT c.login, c.url, c.avatar_url, c.contributions, u.country
FROM repo_contributors c
@@ -169,6 +187,13 @@
GROUP BY t.tool
"""
+AGENTS_SQL = """
+SELECT a.agent AS slug, count(DISTINCT a.full_name) AS projects
+FROM repo_agents a
+JOIN projects p ON p.full_name = a.full_name AND p.tier IN ('verified', 'likely')
+GROUP BY a.agent
+"""
+
TOOL_USES_SQL = """
SELECT tool AS slug, method, evidence, path
FROM repo_tools
@@ -187,6 +212,57 @@
LIMIT $1
"""
+SHIPPED = "p.tier IN ('verified', 'likely')"
+HUMAN = "lower(c.login) <> ALL($1::text[]) AND c.login NOT LIKE '%[bot]'"
+TOP_BUILDERS = 12
+MAX_BUILDERS = 1_000
+
+WRAPPED_TOTALS_SQL = f"""
+SELECT
+ (SELECT count(DISTINCT c.login) FROM repo_contributors c
+ JOIN projects p ON p.full_name = c.full_name
+ WHERE {SHIPPED} AND {HUMAN}) AS builders,
+ (SELECT count(*) FROM accounts WHERE funded_at BETWEEN $2 AND $3) AS accounts_funded,
+ (SELECT count(DISTINCT deployer) FROM contracts
+ WHERE deployed_at BETWEEN $2 AND $3) AS deployers,
+ (SELECT count(*) FROM classic_ops WHERE occurred_at BETWEEN $2 AND $3) AS operations,
+ (SELECT coalesce(max(n), 0) FROM (
+ SELECT count(*) AS n FROM contracts WHERE deployed_at BETWEEN $2 AND $3
+ GROUP BY wasm_hash) shared) AS largest_wasm_contracts
+"""
+
+WRAPPED_OPERATIONS_SQL = """
+SELECT op_type AS label, count(*) AS value
+FROM classic_ops
+WHERE occurred_at BETWEEN $1 AND $2
+GROUP BY op_type
+ORDER BY value DESC, op_type
+LIMIT 5
+"""
+
+WRAPPED_TEAMS_SQL = f"""
+SELECT least(n, 5)::text AS label, count(*) AS value
+FROM (
+ SELECT c.full_name, count(*) AS n
+ FROM repo_contributors c JOIN projects p ON p.full_name = c.full_name
+ WHERE {SHIPPED} AND {HUMAN}
+ GROUP BY c.full_name) teams
+GROUP BY 1
+ORDER BY 1
+"""
+
+WRAPPED_BUILDERS_SQL = f"""
+SELECT c.login, max(c.avatar_url) AS avatar_url,
+ count(DISTINCT c.full_name) AS projects, sum(c.contributions)::int AS contributions,
+ array_agg(DISTINCT c.full_name ORDER BY c.full_name) AS project_names
+FROM repo_contributors c JOIN projects p ON p.full_name = c.full_name
+WHERE {SHIPPED} AND {HUMAN}
+GROUP BY c.login
+HAVING count(DISTINCT c.full_name) >= $2
+ORDER BY projects DESC, contributions DESC, c.login
+LIMIT $3
+"""
+
RESOURCE_SQL = {
"projects": PROJECTS_SQL,
"contracts": CONTRACTS_SQL,
@@ -212,14 +288,37 @@ async def list_page(
track: str | None = None,
integrations: list[str] | None = None,
tools: list[str] | None = None,
+ agents: list[str] | None = None,
+ languages: list[str] | None = None,
+ countries: list[str] | None = None,
+ activity: list[str] | None = None,
+ awards: list[str] | None = None,
+ project_ids: list[str] | None = None,
winners: bool = False,
limit: int = 50,
offset: int = 0,
) -> tuple[list[dict[str, Any]], int]:
- awards = places()
- winner_ids = list(awards) if winners else None
+ placed = places()
+ wanted = project_ids
+ if wanted is None and (winners or awards):
+ wanted = [pid for pid, place in placed.items() if awards is None or place in awards]
args = (
- (q, account, project_id, tiers, limit, offset, track, integrations, winner_ids, tools)
+ (
+ q,
+ account,
+ project_id,
+ tiers,
+ limit,
+ offset,
+ track,
+ integrations,
+ wanted,
+ tools,
+ agents,
+ languages,
+ countries,
+ activity,
+ )
if resource == "projects"
else (*window(), q, account, project_id, limit, offset)
)
@@ -228,7 +327,7 @@ async def list_page(
total = rows[0]["total"] if rows else 0
items = [{k: v for k, v in dict(row).items() if k != "total"} for row in rows]
if resource == "projects":
- items = [{**item, "award": awards.get(item["project_id"])} for item in items]
+ items = [{**item, "award": placed.get(item["project_id"])} for item in items]
return items, total
@@ -292,3 +391,64 @@ async def fetch_integrations() -> list[dict[str, Any]]:
async def fetch_countries(limit: int = 12) -> list[dict[str, Any]]:
async with pool().acquire() as connection:
return [dict(row) for row in await connection.fetch(COUNTRIES_SQL, limit)]
+
+
+async def fetch_wrapped() -> dict[str, Any]:
+ start, end = window()
+ agents = [login.lower() for agent in get_catalog().agents for login in agent.authors]
+ async with pool().acquire() as connection:
+ totals = dict(await connection.fetchrow(WRAPPED_TOTALS_SQL, agents, start, end))
+ operations = await connection.fetch(WRAPPED_OPERATIONS_SQL, start, end)
+ teams = await connection.fetch(WRAPPED_TEAMS_SQL, agents)
+ multi_team = await connection.fetch(WRAPPED_BUILDERS_SQL, agents, 2, MAX_BUILDERS)
+ top = await connection.fetch(WRAPPED_BUILDERS_SQL, agents, 1, TOP_BUILDERS)
+ return {
+ **totals,
+ "operations_by_type": [dict(row) for row in operations],
+ "team_sizes": [dict(row) for row in teams],
+ "multi_team_builders": [dict(row) for row in multi_team],
+ "top_builders": [dict(row) for row in sorted(top, key=lambda row: -row["contributions"])],
+ }
+
+
+async def fetch_agents() -> list[dict[str, Any]]:
+ async with pool().acquire() as connection:
+ counts = {row["slug"]: row["projects"] for row in await connection.fetch(AGENTS_SQL)}
+ return [
+ {
+ **agent.model_dump(include={"slug", "name", "site"}),
+ "projects": counts.get(agent.slug, 0),
+ }
+ for agent in get_catalog().agents
+ ]
+
+
+async def fetch_person(login: str) -> dict[str, Any] | None:
+ async with pool().acquire() as connection:
+ rows = [dict(row) for row in await connection.fetch(PERSON_SQL, login)]
+ if not rows:
+ return None
+ commits = {f"repo:{row['full_name']}": row["contributions"] for row in rows}
+ projects, _ = await list_page(
+ "projects",
+ tiers=["verified", "likely"],
+ project_ids=list(commits),
+ limit=len(commits),
+ )
+ if not projects:
+ return None
+ first = rows[0]
+ return {
+ "login": first["login"],
+ "url": first["url"],
+ "avatar_url": first["avatar_url"],
+ "country": first["country"],
+ "contributions": sum(commits[project["project_id"]] for project in projects),
+ "projects": sorted(
+ (
+ {"project": project, "contributions": commits[project["project_id"]]}
+ for project in projects
+ ),
+ key=lambda item: (-item["contributions"], item["project"]["project_id"]),
+ ),
+ }
diff --git a/apps/api/src/hackproof/routes.py b/apps/api/src/hackproof/routes.py
index 84bd0c8..b7fb50e 100644
--- a/apps/api/src/hackproof/routes.py
+++ b/apps/api/src/hackproof/routes.py
@@ -4,6 +4,7 @@
from hackproof import queries
from hackproof.schemas import (
+ AiAgent,
Builder,
Contract,
CountryCount,
@@ -11,12 +12,14 @@
FailedTx,
Integration,
Page,
+ Person,
Project,
ProjectDetail,
Stats,
Tier,
TimelinePoint,
WasmUpload,
+ Wrapped,
)
router = APIRouter()
@@ -38,6 +41,11 @@ async def _page(resource: queries.Resource, q: str | None, limit: int, offset: i
return Page(items=items, total=total)
+@router.get("/wrapped")
+async def wrapped() -> Wrapped:
+ return Wrapped(**await queries.fetch_wrapped())
+
+
@router.get("/timeline")
async def timeline() -> list[TimelinePoint]:
return [TimelinePoint(**point) for point in await queries.fetch_timeline()]
@@ -58,6 +66,11 @@ async def tools() -> list[EcosystemTool]:
return [EcosystemTool(**row) for row in await queries.fetch_tools()]
+@router.get("/agents")
+async def agents() -> list[AiAgent]:
+ return [AiAgent(**row) for row in await queries.fetch_agents()]
+
+
@router.get("/projects")
async def projects(
q: Search = None,
@@ -126,6 +139,14 @@ async def project(project_id: str) -> ProjectDetail:
)
+@router.get("/contributors/{login}")
+async def contributor(login: str) -> Person:
+ person = await queries.fetch_person(login)
+ if person is None:
+ raise HTTPException(status_code=404, detail="no hackathon project for this contributor")
+ return Person(**person)
+
+
@router.get("/builders/{address}")
async def builder(address: str) -> Builder:
result = Builder(
diff --git a/apps/api/src/hackproof/schemas.py b/apps/api/src/hackproof/schemas.py
index 764eb7a..b474258 100644
--- a/apps/api/src/hackproof/schemas.py
+++ b/apps/api/src/hackproof/schemas.py
@@ -55,6 +55,7 @@ class Project(BaseModel):
track: Literal["genesis", "scale"] | None = None
integrations: list[str] = []
tools: list[str] = []
+ agents: list[str] = []
award: Place | None = None
@@ -66,6 +67,20 @@ class Contributor(BaseModel):
country: str | None
+class PersonProject(BaseModel):
+ project: Project
+ contributions: int
+
+
+class Person(BaseModel):
+ login: str
+ url: str
+ avatar_url: str | None
+ country: str | None
+ contributions: int
+ projects: list[PersonProject]
+
+
class Link(BaseModel):
subject_kind: str
subject: str
@@ -150,11 +165,43 @@ class EcosystemTool(BaseModel):
projects: int
+class AiAgent(BaseModel):
+ slug: str
+ name: str
+ site: str
+ projects: int
+
+
class CountryCount(BaseModel):
country: str
contributors: int
+class Count(BaseModel):
+ label: str
+ value: int
+
+
+class WrappedBuilder(BaseModel):
+ login: str
+ avatar_url: str | None
+ projects: int
+ contributions: int
+ project_names: list[str]
+
+
+class Wrapped(BaseModel):
+ builders: int
+ accounts_funded: int
+ deployers: int
+ operations: int
+ largest_wasm_contracts: int
+ operations_by_type: list[Count]
+ team_sizes: list[Count]
+ multi_team_builders: list[WrappedBuilder]
+ top_builders: list[WrappedBuilder]
+
+
class Page[T](BaseModel):
items: list[T]
total: int
diff --git a/apps/api/tests/test_api.py b/apps/api/tests/test_api.py
index aeb1370..b04bdae 100644
--- a/apps/api/tests/test_api.py
+++ b/apps/api/tests/test_api.py
@@ -92,3 +92,51 @@ def test_a_project_page_lists_where_each_integration_was_found():
detail = client.get(f"/api/projects/{first['project_id']}").json()
assert used["slug"] in {use["slug"] for use in detail["integration_uses"]}
assert {use["method"] for use in detail["integration_uses"]} <= {"package", "endpoint"}
+
+
+def test_wrapped_team_sizes_fit_inside_the_projects():
+ with TestClient(app) as client:
+ body = client.get("/api/wrapped").json()
+ stats = client.get("/api/stats").json()
+ assert sum(item["value"] for item in body["team_sizes"]) <= stats["projects"]
+ assert {item["label"] for item in body["team_sizes"]} <= {"1", "2", "3", "4", "5"}
+
+
+def test_wrapped_builders_are_ranked_and_multi_team_means_two_or_more_projects():
+ with TestClient(app) as client:
+ body = client.get("/api/wrapped").json()
+ commits = [builder["contributions"] for builder in body["top_builders"]]
+ assert commits == sorted(commits, reverse=True)
+ assert all(builder["projects"] >= 2 for builder in body["multi_team_builders"])
+ assert all(
+ len(builder["project_names"]) == builder["projects"]
+ for builder in body["multi_team_builders"]
+ )
+ assert not {"cursoragent", "codex"} & {b["login"] for b in body["multi_team_builders"]}
+
+
+def test_agents_list_every_catalog_agent_with_a_project_count():
+ with TestClient(app) as client:
+ body = client.get("/api/agents").json()
+ projects = client.get("/api/projects", params={"limit": 5}).json()["items"]
+ assert {"claude-code", "cursor", "codex"} <= {row["slug"] for row in body}
+ assert all(row["projects"] >= 0 for row in body)
+ assert all(isinstance(item["agents"], list) for item in projects)
+
+
+def test_an_unknown_contributor_is_not_found():
+ with TestClient(app) as client:
+ assert client.get("/api/contributors/nobody-here-0000").status_code == 404
+
+
+def test_a_contributor_lists_their_projects_with_their_commits():
+ with TestClient(app) as client:
+ top = client.get("/api/wrapped").json()["top_builders"]
+ if not top:
+ return
+ person = client.get(f"/api/contributors/{top[0]['login'].upper()}").json()
+ assert person["login"] == top[0]["login"]
+ assert person["contributions"] == sum(item["contributions"] for item in person["projects"])
+ assert len(person["projects"]) == top[0]["projects"]
+ commits = [item["contributions"] for item in person["projects"]]
+ assert commits == sorted(commits, reverse=True)
diff --git a/apps/api/tests/test_chat.py b/apps/api/tests/test_chat.py
index f6bcbbf..a7106ae 100644
--- a/apps/api/tests/test_chat.py
+++ b/apps/api/tests/test_chat.py
@@ -4,11 +4,14 @@
import pytest
from fastapi.testclient import TestClient
+from hackproof import queries
from hackproof.chat import routes, stream
+from hackproof.chat.briefs import Page, describe_page, view_filters
from hackproof.chat.prompts import prompt, sections
from hackproof.chat.ratelimit import RateLimiter
from hackproof.chat.stream import Message, Part, stream_reply, to_anthropic, web_search_events
from hackproof.chat.tools import TOOL_SPECS, run_tool
+from hackproof.db import close_pool, open_pool
from hackproof.main import app
@@ -169,7 +172,7 @@ async def fake_stream(client, model, messages, page=""):
def test_prompt_file_has_every_section():
- assert set(sections()) == {"system", "page-home", "page-entity", "page-empty"}
+ assert set(sections()) == {"system", "page-home", "page-entity", "page-empty", "page-filter"}
text = prompt("system", start="A", end="B", page="ON THE HOME PAGE")
assert "A to B UTC" in text and text.endswith("ON THE HOME PAGE")
assert "{" not in text
@@ -190,3 +193,40 @@ def test_project_tools_can_filter_by_integration_partner():
assert "get_integrations" in specs
for name in ("query_projects", "summarize_projects"):
assert "integrations" in specs[name]["input_schema"]["properties"]
+
+
+def test_project_tools_filter_by_every_explorer_filter():
+ specs = {spec["name"]: spec for spec in TOOL_SPECS}
+
+ assert {"get_tools", "get_agents"} <= set(specs)
+ for name in ("query_projects", "summarize_projects"):
+ properties = specs[name]["input_schema"]["properties"]
+ assert {"tools", "agents", "languages", "countries", "activity", "awards"} <= set(
+ properties
+ )
+
+
+def test_explorer_filters_map_onto_the_project_filters():
+ filters = view_filters(
+ {"agent": ["cursor"], "partner": ["freighter"], "track": ["scale"], "tier": ["verified"]}
+ )
+
+ assert filters.agents == ["cursor"]
+ assert filters.integrations == ["freighter"]
+ assert filters.track == "scale"
+ assert filters.list_args()["tiers"] == ["verified"]
+ assert view_filters({"track": ["genesis", "scale"]}).track is None
+ assert view_filters({"nonsense": ["x"]}).list_args()["tiers"] == ["verified", "likely"]
+
+
+async def test_the_filter_page_brief_counts_the_matching_projects():
+ await open_pool()
+ try:
+ brief = await describe_page(Page(kind="filter", filters={"agent": ["cursor"]}))
+ agents = await queries.fetch_agents()
+ finally:
+ await close_pool()
+
+ expected = next(agent for agent in agents if agent["slug"] == "cursor")["projects"]
+ assert f'"total": {expected},' in brief
+ assert '{"agent": ["cursor"]}' in brief
diff --git a/apps/api/tests/test_export_check.py b/apps/api/tests/test_export_check.py
new file mode 100644
index 0000000..02723a5
--- /dev/null
+++ b/apps/api/tests/test_export_check.py
@@ -0,0 +1,28 @@
+from pathlib import Path
+
+from hackproof.export.check import drift
+
+
+def write(root: Path, files: dict[str, str]) -> Path:
+ for name, text in files.items():
+ path = root / name
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(text)
+ return root
+
+
+def test_identical_files_have_no_drift(tmp_path):
+ files = {"2026/a.yml": "x: 1\n", "schema.yml": "y: 2\n"}
+
+ assert drift(write(tmp_path / "db", files), write(tmp_path / "repo", files)) == []
+
+
+def test_drift_names_missing_extra_and_changed_files(tmp_path):
+ database = write(tmp_path / "db", {"2026/a.yml": "x: 1\n", "2026/new.yml": "n: 1\n"})
+ committed = write(tmp_path / "repo", {"2026/a.yml": "x: 2\n", "2026/old.yml": "o: 1\n"})
+
+ assert drift(database, committed) == [
+ "only in the files: 2026/old.yml",
+ "only in the database: 2026/new.yml",
+ "differs: 2026/a.yml",
+ ]
diff --git a/apps/api/tests/test_integrations.py b/apps/api/tests/test_integrations.py
index efde5d4..638e349 100644
--- a/apps/api/tests/test_integrations.py
+++ b/apps/api/tests/test_integrations.py
@@ -1,7 +1,7 @@
import json
-from hackproof.integrations.catalog import Catalog, Partner, Tool, get_catalog
-from hackproof.integrations.detect import detect, detect_tools
+from hackproof.integrations.catalog import Agent, Catalog, Partner, Tool, get_catalog
+from hackproof.integrations.detect import detect, detect_agents, detect_tools
from hackproof.integrations.models import Detection
CATALOG = Catalog(
@@ -119,3 +119,55 @@ def test_tools_are_found_apart_from_partners():
assert {d.slug for d in detect_tools(files, catalog, "team")} == {"scaffold"}
assert {d.slug for d in detect(files, catalog, "team")} == {"acme"}
+
+
+AGENT_CATALOG = Catalog(
+ partners=[],
+ agents=[
+ Agent(
+ slug="cursor",
+ name="Cursor",
+ site="https://cursor.example",
+ files=[".cursor/*", ".cursorrules"],
+ authors=["cursoragent"],
+ ),
+ Agent(slug="claude", name="Claude", site="https://claude.example", files=["CLAUDE.md"]),
+ ],
+)
+
+
+def test_agents_are_found_by_file_and_by_commit_author():
+ paths = ["src/app.ts", "CLAUDE.md", ".cursor/rules/style.mdc", "apps/web/.cursorrules"]
+
+ found = detect_agents(paths, ["Someone", "CursorAgent"], AGENT_CATALOG)
+
+ assert {(d.slug, d.method, d.evidence, d.path) for d in found} == {
+ ("cursor", "file", ".cursor/*", ".cursor/rules/style.mdc"),
+ ("cursor", "file", ".cursorrules", "apps/web/.cursorrules"),
+ ("cursor", "author", "cursoragent", ""),
+ ("claude", "file", "CLAUDE.md", "CLAUDE.md"),
+ }
+
+
+def test_agent_files_inside_dependencies_are_ignored():
+ paths = ["node_modules/pkg/CLAUDE.md", "vendor/.cursor/rules.mdc"]
+
+ assert detect_agents(paths, [], AGENT_CATALOG) == []
+
+
+def test_the_shipped_catalog_lists_unique_agents():
+ agents = get_catalog().agents
+
+ assert {"claude-code", "cursor", "codex", "github-copilot"} <= {agent.slug for agent in agents}
+ assert len({agent.slug for agent in agents}) == len(agents)
+
+
+def test_stellar_raven_and_skills_are_found_in_agent_config_files():
+ files = {
+ ".mcp.json": '{"mcpServers": {"stellar-raven": {"url": "https://raven.stellar.org/mcp"}}}',
+ "skills-lock.json": '{"skills": {"dapp": {"source": "stellar/stellar-dev-skill"}}}',
+ }
+
+ found = {(d.slug, d.path) for d in detect_tools(files, get_catalog(), "team")}
+
+ assert found == {("stellar-raven", ".mcp.json"), ("stellar-skills", "skills-lock.json")}
diff --git a/apps/api/tests/test_scan.py b/apps/api/tests/test_scan.py
index 7639814..b1cf7f3 100644
--- a/apps/api/tests/test_scan.py
+++ b/apps/api/tests/test_scan.py
@@ -1,7 +1,7 @@
from hackproof.github.demo import is_public_http
from hackproof.github.models import DependencyFingerprint, RepoScan
from hackproof.github.scan import DEMO_URL, contributors_from, select_files, store_scan
-from hackproof.integrations.models import Detection
+from hackproof.integrations.models import AgentDetection, Detection
from tests.helpers import add_repo
@@ -86,3 +86,29 @@ def scan(*found: Detection) -> RepoScan:
await store_scan(db, scan())
assert await db.fetchval("SELECT count(*) FROM repo_integrations") == 0
+
+
+async def test_a_rescan_replaces_the_stored_agents(scratch_db):
+ db = scratch_db
+ await add_repo(db, "team/app")
+ detection = AgentDetection(
+ slug="cursor", method="file", evidence=".cursorrules", path=".cursorrules"
+ )
+
+ def scan(*found: AgentDetection) -> RepoScan:
+ return RepoScan(
+ full_name="team/app",
+ refs=[],
+ dependencies=DependencyFingerprint(),
+ stellar_added_in_window=None,
+ integrations=[],
+ agents=list(found),
+ contributors=[],
+ )
+
+ await store_scan(db, scan(detection))
+ await store_scan(db, scan(detection))
+ assert await db.fetchval("SELECT count(*) FROM repo_agents") == 1
+
+ await store_scan(db, scan())
+ assert await db.fetchval("SELECT count(*) FROM repo_agents") == 0
diff --git a/apps/web/src/app.tsx b/apps/web/src/app.tsx
index 7971383..f100791 100644
--- a/apps/web/src/app.tsx
+++ b/apps/web/src/app.tsx
@@ -8,7 +8,10 @@ import { SiteFooter } from '@/components/layout/site-footer'
import { SiteHeader } from '@/components/layout/site-header'
import { BuilderPage } from '@/pages/builder'
import { HomePage } from '@/pages/home'
+import { ContributorsPage } from '@/pages/contributors'
+import { PersonPage } from '@/pages/person'
import { ProjectPage } from '@/pages/project'
+import { WrappedPage } from '@/pages/wrapped'
function Shell() {
const { view } = useChatPanel()
@@ -25,6 +28,8 @@ function Shell() {
} />
} />
} />
+ } />
+ } />
@@ -37,8 +42,16 @@ function Shell() {
export function App() {
return (
-
-
-
+
+ } />
+
+
+
+ }
+ />
+
)
}
diff --git a/apps/web/src/components/back-button.tsx b/apps/web/src/components/back-button.tsx
new file mode 100644
index 0000000..4a62f4f
--- /dev/null
+++ b/apps/web/src/components/back-button.tsx
@@ -0,0 +1,22 @@
+import { ArrowLeftIcon } from 'lucide-react'
+import { Link, useLocation, useNavigate } from 'react-router'
+
+import { Button } from '@/components/ui/button'
+
+export function BackButton() {
+ const location = useLocation()
+ const navigate = useNavigate()
+
+ if (location.key !== 'default') {
+ return (
+
+ )
+ }
+ return (
+ }>
+ All projects
+
+ )
+}
diff --git a/apps/web/src/components/chat/chat-thread.tsx b/apps/web/src/components/chat/chat-thread.tsx
index 2f8ad63..4de45ef 100644
--- a/apps/web/src/components/chat/chat-thread.tsx
+++ b/apps/web/src/components/chat/chat-thread.tsx
@@ -5,12 +5,14 @@ import { ChatError } from '@/components/chat/chat-error'
import { ChatMessages } from '@/components/chat/chat-messages'
import { PromptBox } from '@/components/chat/prompt-box'
import { sessionTitle } from '@/components/chat/session'
-import { currentPage, suggestionsFor } from '@/components/chat/page'
import { RateLimitError, transport } from '@/components/chat/transport'
+import { useSuggestions } from '@/components/chat/use-suggestions'
import { useChatPanel } from '@/components/chat/use-chat-panel'
import { Button } from '@/components/ui/button'
function EmptyThread({ onPick }: { onPick: (text: string) => void }) {
+ const suggestions = useSuggestions()
+
return (
@@ -22,7 +24,7 @@ function EmptyThread({ onPick }: { onPick: (text: string) => void }) {
- {suggestionsFor(currentPage().kind).map((suggestion) => (
+ {suggestions.map((suggestion) => (