> For the complete documentation index, see [llms.txt](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/docs/adr/0001-extension-platform-foundation.md).

# 0001. Extension Platform Foundation

**Status:** Accepted **Date:** 2026-05-15

## Context

Phase 02 added Trend Finder as a modular feature inside the dashboard foundation that is now AI OS. The project needed extension boundaries for client views, sidebar navigation, runtime data, setup/settings visibility, and script-side source collection without allowing remote code execution or mixing local operator telemetry with public trend evidence.

The phase also needed a first source adapter path while keeping source terms, rate limits, retention, and privacy requirements explicit before additional public source adapters are implemented.

## Options Considered

1. Static, compile-time extension registry with environment-based enablement. This keeps imports explicit, lets TypeScript check extension contracts, and avoids dynamic code loading while still allowing Trend Finder to appear as a separate module.
2. Dynamic plugin loading from local or remote packages. This would make the platform more flexible, but would introduce package trust, dependency, sandboxing, version compatibility, and remote-code risks that are out of scope for the current product.
3. Standalone Trend Finder application outside the inherited dashboard shell. This would reduce coupling to the AI OS host, but would discard the existing route shell, setup surfaces, local data flow, and reusable UI patterns that Phase 02 was designed to reuse.

## Decision

Use a static, disabled-first extension platform.

* Client extensions are declared through typed contracts in `src/extensions/types.ts` and registered in `src/extensions/registry.ts`.
* Browser enablement is controlled by `VITE_CLAUDE_OS_ENABLED_EXTENSIONS`. With no enabled extensions, extension sidebar navigation contributes nothing.
* Extension views render through static host routes at `/extensions`, `/extensions/$extensionId`, and `/extensions/$extensionId/$viewId`.
* Extension view failures are contained by `ExtensionErrorBoundary`.
* Runtime extension output lives under `LiveData.extensions` and is read by `useExtensionData()`, keeping extension data isolated from existing dashboard telemetry.
* Script-side collectors are registered statically in `scripts/extensions/registry.ts` and run through `scripts/lib/extensions/runner.ts`.
* The collector runner enforces disabled, missing-env, timeout, payload-size, warning, and thrown-error guard paths per extension.
* Source adapters must have compliance documentation before implementation. Hacker News is implemented; Reddit, GitHub, YouTube, and Product Hunt are documented as planned sources only.

## Maintenance Note

This ADR records the Phase 02 foundation decision and source status at the time it was accepted. Current Trend Finder source availability, compliance status, and runtime behavior are maintained in [`docs/extensions/trend-finder/sources.md`](/ai-os-and-trend-finder-docs/docs/extensions/trend-finder/sources.md) and [`docs/extensions/trend-finder/pipeline.md`](/ai-os-and-trend-finder-docs/docs/extensions/trend-finder/pipeline.md). Update those current-behavior docs instead of rewriting this decision record.

## Consequences

This decision keeps Phase 02 small, testable, and compatible with the existing application. The extension platform can host Trend Finder without changing existing routes when it is disabled, and collector failures cannot break the base aggregation run.

The trade-off is that adding an extension requires a code change and rebuild. That is acceptable for this repository because extension authorship is local and trusted. If the project later needs third-party extensions, a future ADR must revisit package trust, dependency isolation, capability enforcement, signature verification, and user-controlled install flows.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/docs/adr/0001-extension-platform-foundation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
