Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion PROJECT_STATUS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# starboard — PROJECT STATUS

Last updated: 2026-08-13
Last updated: 2026-08-17

## Why/What

Expand Down Expand Up @@ -72,6 +72,21 @@ provenance. The workflow is free and has no billing or entitlement gate.

## Timeline

- **2026-08-17 (need-driven project intelligence implemented locally)** —
Added the deterministic need-driven recommendation pipeline: D1 schema for
capability cards, project fingerprints, needs, candidate pools, draft
reports, reviewed reports, and external review requests (migration
`0004_need_driven_intelligence.sql`); rule-based need extraction with
fingerprint caching; per-need full-catalog retrieval using Vectorize, FTS,
and structured lanes with hard bounds; five-bucket candidate classification
with confidence and provenance; draft report persistence with incremental
reruns and cached candidate pools; a provider-neutral external review
ingestion contract with idempotency; and API endpoints for reading reports,
running the pipeline, and ingesting reviews. Starboard contains no Devin
credentials and never requires Devin to serve recommendations. Tests,
typecheck, lint, docs check, and the Cloudflare build pass. Production
activation awaits normal review and push.

- **2026-08-15 (scheduled seed failures are visible)** — The weekly seed is the
only cron-driven workflow, and a failed run previously left no signal outside
Actions history. Scheduled runs now reconcile one open tracking issue labelled
Expand Down Expand Up @@ -274,6 +289,24 @@ provenance. The workflow is free and has no billing or entitlement gate.
recommendations that explain language, topic, metadata, and tool matches;
sparse context is labeled as broad discovery.

### Need-driven project intelligence
- Extracts 5–10 evidence-backed needs per project from metadata, tools, AI
metadata, and topics; returns fewer when evidence is insufficient. Needs are
cached by project fingerprint and reused when the fingerprint is unchanged.
- Searches the full eligible catalog independently per need using Vectorize,
FTS, and structured lanes with hard candidate bounds. Candidate pools are
cached by normalized need signature for cross-project reuse.
- Classifies each candidate into one of five buckets (adopt/integrate,
reference implementation, architectural pattern, competing product,
unsuitable/negative example) with confidence, evidence, and provenance.
- Persists deterministic draft reports grouped by need with version, catalog
generation, and incremental rerun support. Degraded runs preserve the latest
successful report.
- Exposes a provider-neutral external review ingestion contract so Fleet
automation can submit one bounded Devin review per changed project.
Starboard contains no Devin credentials and never requires Devin to serve
recommendations. Read endpoints never trigger external-agent spend.

### Discovery and intelligence surfaces
- Public Discover page and `/api/discover` for the seeded popular repository
corpus; relevance search fuses bounded semantic and lexical candidates and
Expand Down
22 changes: 22 additions & 0 deletions docs/architecture/data-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,25 @@ candidate lane, then fuse it with full-catalog lexical and structured lanes.
Deterministic visible evidence remains the final ranker so every reason can be
explained. When semantic retrieval is unavailable, lexical and structured lanes
remain usable; an all-lanes-empty state becomes an explicit broad fallback.

## Need-driven project intelligence

```text
connected project
→ fingerprint (metadata, tools, AI metadata, topics)
→ need extraction (5–10 evidence-backed needs, cached by fingerprint)
→ per-need retrieval (Vectorize + FTS + structured, cached by signature)
→ candidate classification (5 buckets, confidence, provenance)
→ draft report persistence (versioned, incremental reruns)
→ optional external review ingestion (provider-neutral, idempotent)
```

The need-driven pipeline extends project recommendations from a flat ranked
list to a need-grouped intelligence report. Each need is searched
independently across the full eligible catalog. Candidate pools are cached by
normalized need signature for cross-project reuse. Draft reports are
versioned with `is_latest` flags; degraded runs preserve the latest successful
report. External review ingestion is provider-neutral — Fleet automation owns
Devin credentials and session lifecycle, Starboard only ingests structured
results. See
[need-driven-intelligence.md](need-driven-intelligence.md) for details.
88 changes: 88 additions & 0 deletions docs/architecture/need-driven-intelligence.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Need-Driven Project Intelligence

Starboard's need-driven intelligence pipeline extracts evidence-backed needs
from a connected project, searches the eligible repository catalog
independently for each need, classifies candidates, and produces a structured
report. An optional external reviewer (e.g., Devin) can validate and refine
the report through a provider-neutral ingestion contract.

## Pipeline stages

```text
Connected project
→ fingerprint (README, manifests, tools, AI metadata, topics)
→ need extraction (5–10 evidence-backed needs, fewer when insufficient)
→ per-need retrieval (Vectorize + FTS + structured, cached by signature)
→ candidate classification (5 buckets with confidence and provenance)
→ draft report persistence (versioned, incremental reruns)
→ optional external review ingestion (provider-neutral, idempotent)
```

## Key design decisions

- **Deterministic first.** Starboard always produces a draft report without
any external reviewer. Devin is optional, not required.
- **Per-need retrieval.** Each need generates focused search intents and
queries the full eligible catalog independently. Agents never receive all
12k repository records.
- **Reusable capability cards.** One evidence-backed card per catalog
repository, refreshed only when the source fingerprint changes.
- **Cached candidate pools.** Projects with similar needs reuse retrieval
work via normalized need signatures.
- **Incremental reruns.** A run is skipped when the project fingerprint, need
map, and catalog generation are unchanged.
- **Failure-safe.** Degraded runs preserve the latest successful report.
External review failure or budget exhaustion never replaces the draft.
- **No Devin credentials in Starboard.** Fleet automation owns Devin
credentials, session creation, polling, and spend limits. Starboard only
ingests structured review results.

## Classification buckets

| Bucket | Meaning |
|--------|---------|
| `adopt_or_integrate` | Suitable to use now |
| `reference_implementation` | Study and borrow patterns |
| `architectural_pattern` | Learn from design choices |
| `competing_product_to_monitor` | Monitor, not adopt |
| `unsuitable_negative_example` | Explicitly exclude with rationale |

## API endpoints

- `GET /api/projects/[slug]/intelligence` — read persisted draft and reviewed
reports. Pass `?run=1` to trigger a deterministic pipeline run if no report
exists. Never triggers external-agent spend.
- `POST /api/internal/project-intelligence/run` — operator-only pipeline run
for a specific project. Requires `AI_GATEWAY_API_KEY` bearer token.
- `POST /api/internal/external-reviews/ingest` — operator-only review result
ingestion. Idempotent via idempotency key. Requires `AI_GATEWAY_API_KEY`.

## Database tables

Migration `0004_need_driven_intelligence.sql` adds:

- `repo_capability_cards` — reusable evidence-backed repository summaries
- `project_fingerprints` — stable project input fingerprints
- `project_needs` — extracted needs with signatures and search intents
- `need_candidate_pools` — cached candidate lists by need signature
- `project_draft_reports` — deterministic draft reports (versioned, latest flag)
- `external_review_requests` — idempotent review request tracking
- `project_reviewed_reports` — final reviewed reports (latest flag)

## Bounds and safety

- Max 10 needs per project, fewer when evidence is insufficient
- Max 80 semantic candidates, 200 lexical, 120 structured per need
- Max 8 candidates per need, 50 total across all needs
- One bounded external review session per changed project
- All external-repository operations are read-only
- No production credentials or private data sent to external reviewers

## Source

- `src/lib/need-driven-intelligence.ts` — pipeline implementation
- `src/__tests__/need-driven-intelligence.test.ts` — unit tests
- `scripts/fleet-project-intelligence.ts` — offline Fleet report generator
- `src/app/api/projects/[slug]/intelligence/route.ts` — read API
- `src/app/api/internal/project-intelligence/run/route.ts` — operator run API
- `src/app/api/internal/external-reviews/ingest/route.ts` — review ingestion API
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ docs/
architecture/
overview.md # Next.js + OpenNext + D1 + Vectorize shape
data-flow.md # sync, search, recommendation lifecycles
need-driven-intelligence.md # need-driven project intelligence pipeline
decisions/ # ADRs (one file per decision)
index.md
0001-deploy-vercel-to-cloudflare-workers.md
Expand Down
21 changes: 21 additions & 0 deletions docs/product/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,27 @@ reasons, see [../architecture/decisions/](../architecture/decisions/).
- Recommendation views, inspections, and useful/not-useful feedback emit only
categorical buckets; repository identity and query text are excluded.

## Need-driven project intelligence

- Extracts 5–10 evidence-backed needs per project, returning fewer when
evidence is insufficient. Needs are cached by project fingerprint and reused
when the fingerprint is unchanged.
- Searches the full eligible catalog independently per need using Vectorize,
FTS, and structured lanes with hard candidate bounds. Candidate pools are
cached by normalized need signature for cross-project reuse.
- Classifies each candidate into one of five buckets: adopt/integrate,
reference implementation, architectural pattern, competing product, or
unsuitable/negative example — with confidence, evidence, and provenance.
- Persists deterministic draft reports grouped by need with version, catalog
generation, and incremental rerun support. Degraded runs preserve the latest
successful report.
- Exposes a provider-neutral external review ingestion contract so Fleet
automation can submit one bounded Devin review per changed project.
Starboard contains no Devin credentials and never requires Devin to serve
recommendations.
- See [../architecture/need-driven-intelligence.md](../architecture/need-driven-intelligence.md)
for the pipeline design, API endpoints, and database schema.

## Public discovery and tool intelligence

- Discover is public and supports hybrid semantic-plus-lexical relevance
Expand Down
53 changes: 27 additions & 26 deletions openspec/changes/need-driven-project-recommendations/tasks.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
## 1. Schema and capability cards

- [ ] 1.1 Add D1 migrations for `repo_capability_cards`, `project_fingerprints`,
- [x] 1.1 Add D1 migrations for `repo_capability_cards`, `project_fingerprints`,
`project_needs`, `need_candidate_pools`, `project_draft_reports`,
`project_reviewed_reports`, and `external_review_requests`.
- [ ] 1.2 Implement capability-card generation from repo metadata, AI metadata,
- [x] 1.2 Implement capability-card generation from repo metadata, AI metadata,
and tool evidence with source-fingerprint invalidation.
- [ ] 1.3 Add unit tests for fingerprint hashing and cache invalidation.
- [x] 1.3 Add unit tests for fingerprint hashing and cache invalidation.

## 2. Project fingerprint and need extraction

- [ ] 2.1 Implement project fingerprinting from README, manifests, detected
- [x] 2.1 Implement project fingerprinting from README, manifests, detected
tools, and public roadmap signals.
- [ ] 2.2 Implement need extraction with stable ids, priority, constraints,
- [x] 2.2 Implement need extraction with stable ids, priority, constraints,
evidence, and normalized signatures.
- [ ] 2.3 Cache need maps and reuse them when the fingerprint is unchanged.
- [ ] 2.4 Add tests for need extraction, merging, and unsupported-need rejection.
- [x] 2.3 Cache need maps and reuse them when the fingerprint is unchanged.
- [x] 2.4 Add tests for need extraction, merging, and unsupported-need rejection.

## 3. Per-need retrieval and classification

- [ ] 3.1 Generate focused semantic and lexical search intents per need.
- [ ] 3.2 Run full-catalog retrieval per need using existing Vectorize, FTS, and
- [x] 3.1 Generate focused semantic and lexical search intents per need.
- [x] 3.2 Run full-catalog retrieval per need using existing Vectorize, FTS, and
structured lanes with hard bounds.
- [ ] 3.3 Deduplicate candidates across needs, apply compatibility/evidence/
- [x] 3.3 Deduplicate candidates across needs, apply compatibility/evidence/
maintenance/diversity scoring, and retain evidence paths.
- [ ] 3.4 Classify candidates into the five buckets with confidence and
- [x] 3.4 Classify candidates into the five buckets with confidence and
provenance.
- [ ] 3.5 Add tests for retrieval, deduplication, scoring, and classification.
- [x] 3.5 Add tests for retrieval, deduplication, scoring, and classification.

## 4. Draft report persistence and incremental reruns

- [ ] 4.1 Persist deterministic draft reports grouped by need with version,
- [x] 4.1 Persist deterministic draft reports grouped by need with version,
catalog generation, and provenance.
- [ ] 4.2 Implement incremental rerun logic: skip unchanged fingerprints, need
- [x] 4.2 Implement incremental rerun logic: skip unchanged fingerprints, need
maps, and candidate pools.
- [ ] 4.3 Evaluate newly cataloged repositories against persisted need signatures
- [x] 4.3 Evaluate newly cataloged repositories against persisted need signatures
and thresholds without rebuilding all reports.
- [ ] 4.4 Add tests for idempotency, cache reuse, and incremental evaluation.
- [x] 4.4 Add tests for idempotency, cache reuse, and incremental evaluation.

## 5. External review contract

- [ ] 5.1 Define a provider-neutral external-review request/result schema.
- [ ] 5.2 Add an authenticated internal ingestion endpoint for reviewed reports.
- [ ] 5.3 Ensure Devin credentials and session code live outside Starboard.
- [ ] 5.4 Add tests for schema validation, idempotency keys, and rejected/invalid
- [x] 5.1 Define a provider-neutral external-review request/result schema.
- [x] 5.2 Add an authenticated internal ingestion endpoint for reviewed reports.
- [x] 5.3 Ensure Devin credentials and session code live outside Starboard.
- [x] 5.4 Add tests for schema validation, idempotency keys, and rejected/invalid
results.

## 6. Fleet project intelligence script and report
Expand All @@ -57,12 +57,13 @@

## 7. Documentation and verification

- [ ] 7.1 Update product, architecture, and operations docs with the new model and
- [x] 7.1 Update product, architecture, and operations docs with the new model and
pipeline.
- [ ] 7.2 Run lint, typecheck, tests, docs check, and Cloudflare build.
- Lint: passed (`pnpm check`, 1 pre-existing suppression warning)
- Typecheck: passed (`pnpm typecheck`)
- Complexity baseline: bumped to 37 violations and passing
- Docs check and Cloudflare build: not yet run
- [x] 7.2 Run lint, typecheck, tests, docs check, and Cloudflare build.
- Lint: passed (1 pre-existing suppression warning)
- Typecheck: passed
- Tests: 249 passed across 47 files
- Docs check: 57 files, no broken links
- Cloudflare build: passed
- [ ] 7.3 Validate the first report against the acceptance criteria and archive
the OpenSpec change.
Loading
Loading