Commit Graph
83 Commits
Author SHA1 Message Date
mathias 0af2991d79 merge: captions-first YouTube VideoSource (Worker C, agent/youtube-source)
CI / Lint / Test / Vet (push) Successful in 12s
CI / Build & Import (push) Failing after 0s
CI / Mirror to GitHub (push) Has been skipped
2026-06-02 17:22:51 +02:00
mathias 6446b91609 merge: llm copy + Summarizer adapter (Worker B, agent/llm-summarizer) 2026-06-02 17:22:29 +02:00
mathiasandClaude Opus 4.8 39e8756e77 docs(homelab): note YouTube secret-ref is parameterized + captions.download owner-only caveat
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 17:06:40 +02:00
mathiasandClaude Opus 4.8 9a7ba3a346 feat(adapters): add captions-first YouTube VideoSource
Implements ports.VideoSource against the YouTube Data API v3:
ListSubscriptions (paginated), NewVideos (recent per channel), and
captions-first FetchTranscript — an absent caption track yields
domain.SourceNone (not an error) per ADR-007, with no audio download
or speech-to-text.

OAuth is written fresh on golang.org/x/oauth2 (ADR-006, distinct from
ingestion's inbound MCP auth); the Google token endpoint is inlined to
avoid the heavy x/oauth2/google dep. The per-connection refresh token is
resolved through the SecretStore port from an opaque TokenSecretRef and
is never stored on the adapter or logged.

Unit-tested against an httptest server + fake SecretStore (no live
googleapis egress): subscriptions list/pagination, new-video detection,
captions present -> Source set, captions absent -> SourceNone no error,
and secret-ref resolution failure surfacing as an error.

oauth2 pinned to v0.30.0 to keep the go directive at 1.23.x (koala
runner), not the v0.36 line that requires a newer toolchain.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 17:06:40 +02:00
mathiasandClaude Opus 4.8 6da9d61e63 feat(adapters): add Summarizer backed by local-first llm routing
Implement ports.Summarizer in internal/adapters/summarizer. It routes through a
local Primary endpoint first and an optional BYO Fallback, owning the routing
itself (not delegating to llm.Router) so it can record AIProvider, AIModel, and
FallbackUsed on domain.Summary. Prompt asks for JSON {summary, highlights,
takeaways}; the parser tolerates thinking-model fences/reasoning and rejects an
empty summary.

The summarizer is the single egress point for content toward an AI model, so it
enforces the local-first guarantee from ai_routing.feature: with no BYO
configured (nil fallback) there is no external endpoint, so content reaches the
local stack and nowhere else. Tests assert all four scenarios via a fake client.

Model alias is config (TAPIR_SUMMARIZER_MODEL, host/name) — not hardcoded;
docs/homelab-integration.md notes it stays `confirm` and that thinking models
need an explicit max_tokens or they return empty content.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 17:04:29 +02:00
mathiasandClaude Opus 4.8 0aeb3aa99e feat(adapters): copy stdlib llm package (Client + Router) per ADR-004
Copy hyperguild/ingestion/internal/llm into internal/adapters/llm and own it.
Tapir owes that repo nothing at the dependency level — no module dep added.
Router gives the local-Primary -> BYO-Fallback path needed for ai_routing.feature.

Copied tests rewritten from testify to stdlib testing to keep go.mod
dependency-free (repo has zero deps; acceptance tests are stdlib too).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 17:01:56 +02:00
mathiasandClaude Opus 4.8 bb47f54a41 docs(homelab): pin verified LiteLLM endpoint (NodePort 30401, not 31234)
CI / Lint / Test / Vet (push) Successful in 4s
CI / Build & Import (push) Failing after 0s
CI / Mirror to GitHub (push) Has been skipped
Conductor verified against the live koala k3s cluster before launching the
adapter workers: LiteLLM is in ns ai-stack, ClusterIP 10.43.159.89:4000,
off-cluster NodePort 30401. The doc's 31234 was actually llama-swap. Also
flag that sk-local-123 now 401s — use LITELLM_MASTER_KEY from the vault.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 16:58:07 +02:00
mathiasandClaude Opus 4.8 6421a1334a feat(usecase): add subscription-driven watch loop with per-video dedup
CI / Lint / Test / Vet (push) Successful in 2s
CI / Build & Import (push) Failing after 1s
CI / Mirror to GitHub (push) Has been skipped
ProcessNewVideos walks a user's subscriptions and processes each newly
seen video. Two remaining .feature scenarios are now covered: a channel
the user is not subscribed to is never surfaced (so never processed), and
a video already processed in this engine's lifetime is not summarized
twice. Dedup is in-memory and per-user; durable cross-restart dedup stays
the store's concern (no new port), per docs/data-model.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 16:25:52 +02:00
mathiasandClaude Opus 4.8 b4aa096ac3 feat(usecase): implement ProcessNewVideo core path
CI / Lint / Test / Vet (push) Successful in 3s
CI / Build & Import (push) Failing after 1s
CI / Mirror to GitHub (push) Has been skipped
Resolve transcript -> summarize -> deliver, or skip when no usable
transcript. Sinks fail independently: a failing sink does not abort the
others and successful deliveries are kept; per-sink errors are returned
joined. Makes the two scaffolded acceptance scenarios GREEN.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 16:24:18 +02:00
mathiasandClaude Opus 4.8 a234be7817 fix(taskfile): quote fmt-check cmd so YAML doesn't parse inner colon as a map
CI / Lint / Test / Vet (push) Failing after 5s
CI / Build & Import (push) Has been skipped
CI / Mirror to GitHub (push) Has been skipped
go-task 3.51.1 read the unquoted scalar 'echo "gofmt: files..."' as a
key:value mapping, failing every task with 'invalid keys in command' and
blocking the whole quality gate (not just the acceptance suite). Wrap the
command in an explicit double-quoted YAML scalar.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 15:31:15 +02:00
mathias b211cd08f2 docs: add build + runtime network egress requirements
CI / Lint / Test / Vet (push) Failing after 2s
CI / Build & Import (push) Has been skipped
CI / Mirror to GitHub (push) Has been skipped
Lists the egress the build assumes (Go module proxy, toolchain download,
raw.githubusercontent for golangci-lint, github for non-proxied modules) and the
runtime assumes (LiteLLM gateway, brain-mcp, YouTube/Vimeo APIs, per-user BYO-AI
hosts only on opt-in), so a locked-down koala act_runner or dev env knows what to
allow or which GOPROXY to set. Notes the claude.ai sandbox allowlist is separate
and unrelated.
2026-06-02 11:40:50 +00:00
mathias ff1fa982be docs: add skills wiring and current-build-state to CLAUDE.md
CI / Lint / Test / Vet (push) Failing after 2s
CI / Build & Import (push) Has been skipped
CI / Mirror to GitHub (push) Has been skipped
Tells an agent to wire skills via `task skills` (gitignored symlinks, never
committed) and which skills matter for Tapir; documents the scaffolded-and-RED
state with the first build task spelled out; flags the unverified setup items
(Go version, brain-mcp URL, secret-ref naming, model alias) to resolve against
the live cluster.
2026-06-02 11:07:30 +00:00
mathias 70e6f77fc8 chore: add .gitignore
CI / Lint / Test / Vet (push) Failing after 6s
CI / Build & Import (push) Has been skipped
CI / Mirror to GitHub (push) Has been skipped
Excludes build artifacts and the .claude/skills symlink (wired by the skills
installer, never committed — matches the mathias/skills convention) and local
env files.
2026-06-02 11:06:13 +00:00
mathias c7250fc493 ci: add Gitea Actions workflow (gitea-ci skill conventions)
CI / Lint / Test / Vet (push) Has been cancelled
CI / Mirror to GitHub (push) Has been cancelled
CI / Build & Import (push) Has been cancelled
check -> build -> mirror, self-hosted runner, buildah to localhost:5000, k3s
smoke test. Follows the gitea-ci skill template and its act_runner gotchas
(secrets inlined in run:, no heredocs). check will be RED until the engine is
implemented (acceptance suite). Deploy job omitted until k3s manifests exist in
infra. GH_DEPLOY_KEY secret must be set before mirror succeeds.
2026-06-02 11:06:09 +00:00
mathias 5c5b10f46b chore: add Taskfile with the check quality gate
Defines `task check` (fmt-check + vet + lint + test) — the gate ADR-009 and CI
both invoke. Also `task skills` to wire the engineering skills library via the
canonical installer (symlinks, gitignored). lint no-ops locally when
golangci-lint is absent; CI installs it.
2026-06-02 11:05:48 +00:00
mathias 26e37fbbb3 feat: add cmd/tapir entrypoint stub
Minimal main that identifies the binary (gives the CI smoke test something to
grep). HTTP server, watcher, adapter wiring, and config come with the build.
2026-06-02 11:05:37 +00:00
mathias 0064e34841 test: add acceptance tests for summarize-new-video (RED)
Executable translation of docs/use-cases/summarize_new_video.feature: captioned
video is summarized and delivered to the store sink; no-transcript video is
skipped with reason "no transcript" and no delivery. Drives the engine through
fake adapters (no live YouTube/brain). Intentionally RED until the engine is
implemented — this is the swarm's target.
2026-06-02 11:05:32 +00:00
mathias 6fd31e197c feat: add use-case engine scaffold (RED)
Engine wires the ports and exposes ProcessNewVideo, the core use case. Returns
ErrNotImplemented on purpose so the acceptance suite fails RED — implementing it
to make those tests pass is the first build task. Depends only on ports + domain
(dependencies point inward).
2026-06-02 11:05:12 +00:00
mathias c26e29ac4d feat: add ports (VideoSource, Summarizer, Sink, SecretStore)
The hexagonal interfaces the engine depends on. Keeps the engine provider- and
sink-agnostic: YouTube/Vimeo implement VideoSource, the AI router implements
Summarizer, store/brain implement Sink, ESO implements SecretStore. This is what
makes standalone-vs-homelab a wiring choice (ADR-003).
2026-06-02 11:05:01 +00:00
mathias 31251a41c3 feat: add domain entities (Clean Architecture core)
Pure domain types matching docs/data-model.md: User, Subscription, Video,
Transcript, Summary, plus Provider and TranscriptSource enums. Stdlib-only,
no outward dependencies — the innermost layer. Video carries user_id per the
per-user-isolation decision (no global dedup).
2026-06-02 11:04:48 +00:00
mathias 9268c99f5e chore: add go.mod (module gitea.d-ma.be/mathias/tapir)
Go module root for Tapir. Go 1.23 — confirm against the koala act_runner
toolchain; bump to match the estate (ingestion uses 1.26.1) if the runner has it.
2026-06-02 11:04:35 +00:00
mathias bc79167dfe docs: record rejected alternatives in DECISIONS.md
Adds a consolidated table of approaches considered and deliberately not taken
(Python, Supabase, living in the monolith, shared-lib lift, filesystem brain
package, reusing inbound oauth, global dedup table, Whisper-in-core, SaaS-now,
swarm-delegating the spike), each mapped to the ADR that settles it. Prevents a
later session from re-proposing settled rejections as fresh ideas.
2026-06-02 10:38:41 +00:00
mathias 32e06843f1 docs: add homelab integration facts reference
Pins the concrete endpoints/conventions Tapir depends on so independent sessions
don't rediscover them: LiteLLM gateway (http://koala:4000/v1/, sk-local-123, host/name
alias format), BYO fallback, brain-mcp HTTP sink, Dex identity, ESO+1Password secrets,
hosts, and Flux GitOps deploy location. Verified facts recorded as such; unconfirmed
items (brain-mcp URL, exact secret-ref naming, post-relocation LiteLLM location,
summarization model alias) explicitly flagged 'confirm' rather than invented.
2026-06-02 10:37:55 +00:00
mathias deb8523d75 docs: add CLAUDE.md agent operating instructions
Operational context for independent agent sessions: orientation order, TBD +
conventional-commit workflow, the three "looks reusable but isn't" traps (llm is
copied not imported, brain sink is HTTP not filesystem, OAuth is fresh), the
settled decisions not to reopen, the Clean Architecture/BDD stance, and a
provenance trail back to the S5 spike and the llm source. Distills the operating
knowledge surfaced during the 2026-06-02 planning+grill session.
2026-06-02 10:37:22 +00:00
mathias 367c28f0e9 docs: expand README as repo orientation and guardrail index
Points anyone (or any agent) landing cold at the vision, decisions, architecture,
data model, and BDD feature specs; states the Clean Architecture / TDD-BDD / TBD
approach and the homelab conventions reused. Notes the repo is pre-code and the
docs are the version-controlled design intent.
2026-06-02 10:33:22 +00:00
mathias 9848156cb3 docs(bdd): add account-connection feature
Gherkin spec for connecting YouTube/Vimeo accounts and configuring optional
per-provider BYO AI credentials: connections sync subscriptions, tokens/keys are
stored only as secret references (never in the clear), revocation stops watching
but preserves history. Encodes the secrets-by-reference and data-isolation
guardrails (ADR-002, ADR-006, data-model).
2026-06-02 10:32:48 +00:00
mathias 5c99c49a50 docs(bdd): add AI-routing feature (local-first, BYO fallback)
Gherkin spec for the routing guardrail: local produces the summary by default;
on local failure, fall back only to a user-configured BYO provider; with no BYO,
queue for retry and never send content to a third-party model. Encodes the
local-first/user-owned principle (VISION) as executable behavior.
2026-06-02 10:32:37 +00:00
mathias 0b124a648b docs(bdd): add summarize-new-video feature
Gherkin spec for the core use case: captioned video is summarized and delivered;
no-transcript video is recorded as skipped; unsubscribed channels are ignored;
already-summarized videos are not reprocessed. These scenarios seed the use-case
test suite (Clean Architecture core tested through fake adapters).
2026-06-02 10:32:27 +00:00
mathias 4456d25651 docs: add data model (Stage 0 / Stage 1 scope)
Per-user-isolated entities (no global cross-tenant video table per the S5/grill
correction), secrets stored by reference only (ESO/1Password, never the token),
brain delivery modelled as a sink_delivery row rather than brain-specific tables.
fallback_used recorded per summary as the Stage 0 quality signal. Future C dedup
and sharding explicitly out of scope.
2026-06-02 10:32:14 +00:00
mathias af38999ee2 docs: add C4 architecture + sequence diagrams (Mermaid)
Context and container diagrams, sequence diagrams for the core summarize-new-video
use case and the local-first/BYO AI routing fallback, and the Clean Architecture
layering. Ports & adapters keep the engine provider- and sink-agnostic, making
standalone-vs-homelab a wiring choice (ADR-003), not two codebases.
2026-06-02 10:31:37 +00:00
mathias 7090fb1e40 docs: add architecture decision records (ADR-001..009)
Records the decisions from the S5 spike and the Full Grill as append-only ADRs:
Go not Python; no Supabase; standalone-first with brain as one sink; copy the
llm package; brain sink via HTTP brain-mcp; fresh outbound OAuth; captions-first
with STT deferred; Future C deferred behind the Stage 0 gate; trunk-based dev.
2026-06-02 10:31:00 +00:00
mathias d1a0b49fa9 docs: add product vision and staged definition of success
The top-level guardrail for Tapir: the problem, the product, the principles
(local-first, standalone-first, attention-as-scarce-resource, data isolation),
who it's for (now / Future B / deferred Future C), and a staged, falsifiable
definition of success with Stage 0 ("useful to me") as the gate.
2026-06-02 10:30:15 +00:00
mathias 36fe5ba1b7 Initial commit 2026-06-02 10:29:39 +00:00