# Project export: Percept

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: UC Berkeley AI Hackathon 2026
- Tagline: Using generative AI to improve short videos with Meta TRIBE v2 as a predicted brain-engagement reward model.
- Devpost: https://devpost.com/software/cerebra-diqop9
- GitHub: https://github.com/edrlu/Percept.git
- Demo: https://cut-test.vercel.app/
- Video: https://www.youtube.com/embed/qeZA_msdMEs?enablejsapi=1&hl=en_US&rel=0&start=&version=3&wmode=transparent
- Result: winner (Finalist)
- Team: 6 GitHub contributor(s) — adrianm (76 commits), Claude Opus 4.8 (53 commits), Edward Lu (23 commits), Dino (7 commits), Edward Lu (3 commits), Sebastian Arellano-Rubach (2 commits)

## Devpost submission (written by the team)

### Inspiration

Percept started with a small family business. Someone close to Dean was trying to grow their restaurant with video ads. From the outside, the process looked simple: make a short ad, choose a budget, launch it, and wait. But from the inside, it felt like guessing in the dark. The budget was tight. Every ad had to count. A failed campaign meant less room for the next idea, less confidence in the next launch, and another week spent wondering what went wrong. When the results finally came back, they were blunt but incomplete. Low clicks. Weak watch time. Poor conversion. The dashboard could say the ad failed, but it could not explain the moment people stopped caring. That gap became our project. Small businesses are not short on effort. They are short on signal. They need a way to understand which video is worth showing before the budget is already gone. So we built Percept: a system that researches, generates, scores, and improves video ads before they go live.

### What it does

Percept is a self-improving video ad system. A user enters a product, audience, brand, and goal. For example: Make a 15-second TikTok ad for a high-protein iced coffee aimed at college students before class. Percept then runs a loop: Research the product, audience, and short-form ad patterns. Store that research and iteration history in Redis. Create a structured creative plan. Generate a short-form video using custom skills from the Pika MCP. Predict attention using TRIBE v2. Score the video based on the predicted response over time. Rewrite one part of the creative plan and generate again. The user does not just get one AI-generated video. They get a ranked set of versions, an attention score for each one, and a clear reason for what changed. For example, Percept might find that version one waits too long to show the product. The next version moves the product into the opening shot, keeps the rest of the structure mostly fixed, and runs the scoring loop again. That is the core idea: not just generation, but generation with feedback.

### How we built it

Redis and Pika are the backbone of Percept. Redis gives Percept memory. We use Redis for vector retrieval, research storage, caching, and iteration history. When Percept researches a product or audience, that context is saved. When it generates a video, the score is saved. When it rewrites the next version, the change is saved too. That lets Percept track a real creative path: what research shaped the first idea what video was generated how that video scored what changed in the next version whether the score improved or dropped Without Redis, each generation would be isolated. With Redis, every attempt becomes part of the loop. Pika gives Percept production. We use custom skills from the Pika MCP to turn creative plans into real short-form videos. The plan includes the hook, visual beats, product timing, pacing, emotional angle, and call to action. Pika lets us move from text strategy to an actual video that can be scored and improved. TRIBE v2 gives Percept a prediction layer. TRIBE v2 takes video, audio, and language and predicts neural response over time. It does not output “good ad” or “bad ad.” It outputs a time series of predicted brain activity. So we built the scoring layer ourselves. Our score uses three signals: Response strength — how strong the predicted response is overall. Peak response — where the strongest moment happens. Temporal drop-off — where the response fades or flattens. This matters because two videos can have the same average score but feel completely different. One might start strong and die in the middle. Another might build steadily and hold attention until the end. Percept looks at the shape of the response, not just one number. Then an LLM agent receives: the current creative plan the TRIBE v2 score breakdown the prior version history from Redis the allowed creative levers it can change To keep the loop interpretable, the agent changes one main lever at a time: hook, product timing, pacing, visual motion, or call to action. That way, when the score moves, we can understand what likely caused it. Please check out our repo for more details on the Redis memory layer, Pika MCP pipeline, TRIBE v2 scoring code, and generation loop.

### Challenges we ran into

The hardest challenge was not making a video. It was knowing what to do after the video was made. Most AI video tools stop at generation. Percept had to evaluate the output and decide what to change next. TRIBE v2 made that possible, but it was not plug-and-play. The model gives predicted neural activity, not marketing advice. We had to build the layer that turns a brain-response time series into a practical attention score. The second challenge was speed. A loop only matters if it can run more than once. Video generation takes time, and TRIBE v2 is heavy. Redis helped us keep the system usable by caching expensive outputs, storing research, and carrying memory across iterations. The third challenge was avoiding fake improvement. Early versions changed too many things at once. If the score went up, we could not tell why. If it dropped, we did not know what broke. So we constrained each rewrite to one main creative lever. Instead of changing the entire ad, Percept makes one targeted move, scores again, and stores the result. That made the system easier to inspect, easier to debug, and more credible as a creative tool.

### Accomplishments we're proud of

We built a working loop that closes. Percept researches, creates, predicts, remembers, and tries again. It does not just produce more content. It gives each version a measurable signal and uses that signal to guide the next attempt. We are proud that Redis and Pika became core to the product, not side integrations. Redis is the memory and retrieval layer. Pika is the production layer. Together, they make the loop possible. We are also proud that we got TRIBE v2 running as part of an actual creative workflow. The model’s output is complex, so turning it into a score that can guide iteration was one of the most technically important parts of the project. The moment the product clicked was when one targeted change moved the result: The first ad opened slowly. Percept moved the product earlier. The next version scored higher. That does not guarantee the ad would win in the market. But it does prove the loop works: generate a version, measure a signal, make a controlled change, and run again.

### What we learned

We learned that generation is only half the problem. AI can already make more videos than any team can reasonably review. The harder question is which version deserves attention, time, and budget. We also learned that attention has a shape. A video can start strong and fade. It can reveal the product too late. It can look polished and still feel flat. That is why Percept does not only return a score. It tracks how attention moves through the video and uses that pattern to decide what to change next. We also learned to be careful about what the score means. TRIBE v2 gives us a predicted attention proxy, not guaranteed campaign performance. Percept uses that signal as an early creative guide, and the next step is validating it against human preference and real ad metrics.

### What's next

Next, we want to make the attention curve visible directly on the video. A user should be able to see where attention rises, where it falls, and what changed between versions. We also want more direct human feedback. During the hackathon, we had dozens of friends try Percept, compare generated versions, and tell us which videos felt more engaging. That gave us an early sanity check, but we want to scale it into a real feedback system: more users, more comparisons, and a stronger link between Percept’s attention score and what people actually choose to watch. Longer term, we want to connect that feedback to real campaign metrics like watch time, click-through rate, and conversion. TRIBE v2 gives us an early predicted attention signal, but the goal is to keep improving that signal with human preference and real-world outcomes. We are starting with short-form ads because the pain is immediate. A small business should not have to spend its budget just to find out that a video did not work. But the same loop can apply to product demos, launch videos, trailers, thumbnails, pitch videos, and education. Generative AI is making it effortless to create more content. That will not be the advantage for long. The advantage will be knowing what is worth showing. Percept is built for that future: creative generation with memory, production, feedback, and judgment.

## README (from the GitHub repository)

# percept

**An interactive explorer for population-average cortical-response predictions from video.**

percept turns an uploaded video into a time-scrubbable view of Meta's [TRIBE v2](https://huggingface.co/facebook/tribev2) cortical-response predictions. It pairs an anatomical WebGL cortex with frame-level response charts, cortical proxy summaries, and a compact video timeline — and closes the loop by feeding those neuro-signals back into a Redis-native engine that generates and continuously improves short-form video ads.

---

# 🔴 Redis is the brain of percept

> **Submission for "Best Use of Redis."** Redis is not a cache we bolted on. It is the **entire memory, retrieval, and learning substrate** of percept — the connective tissue of a closed-loop, self-improving creative engine. Pull Redis out and there is no product: no grounding, no memory, no learning, no video delivery.

percept uses Redis as a **real-time context engine** across **four Redis vector indexes**, **a reward-weighted property graph**, **per-session conversation memory**, **a semantic LLM cache**, and **a binary video store** — exercising hashes, sets, sorted sets, lists, RedisVL vector search, hybrid tag-filtered search, ranking queries, and atomic reinforcement counters. One database does the work most stacks split across Pinecone + Postgres + Neo4j + a blob store + Redis.

### The whole stack on one engine

| Redis capability | Where we use it | What it powers |
|---|---|---|
| **Vector search** (RedisVL, cosine, flat) | 4 indexes: ad-knowledge, prompt-cache, graph nodes, video frames | Semantic RAG over proven ad science, cache lookup, GraphRAG entry points, natural-language video search |
| **Hybrid search** (vector + tag filters) | `industry`, `graph`, `video_id`, `objects` tags | "Beverage principles only", "frames of a person holding a phone in *this* video" |
| **Sorted sets** (`ZADD`/`ZREVRANGE`/`ZINCRBY`) | Reward-weighted graph adjacency | Beam-search graph traversal **and** the reinforcement-learning signal |
| **Atomic counters** (`HINCRBYFLOAT`) | Node performance scores | Creative patterns that win get measurably stronger over time |
| **Lists** (`RPUSH`/`LRANGE`/`LTRIM` + TTL) | Per-session working memory, global agent log | Conversation history that makes re-optimization context-aware |
| **Semantic cache** (vector distance threshold) | LLM response cache | **~40–77s → ~1s** on a similar brief; skips the Opus call entirely |
| **Binary blob store** (`SET`/`GET` bytes) | Rendered MP4s served via HTTP Range | The video player streams **directly out of Redis** |
| **Sets + hashes** (registries, dedup) | Video/object node registries, edge metadata | Idempotent re-ingestion, multi-tenancy, cross-plugin linking |

---

## 1 · Retrieval-Augmented Generation, grounded in Redis Vector Search

Every ad percept generates is grounded in a **research-backed corpus of proven advertising science** (attention, memory, peak-end, brand distinctiveness, short-form structure, model-specific craft) stored as **59+ vectors** in the RedisVL index `cerebra_ad_knowledge`.

- **Query is embedded, not keyword-matched.** The brief, product, and industry are embedded with `sentence-transformers/all-MiniLM-L6-v2` (384-dim) and run through a RedisVL `VectorQuery` — **cosine** distance, **flat** index, top-k — `pipeline/redis_store.py › AdKnowledgeStore.search()`.
- **Hybrid retrieval.** Industry is applied as a RedisVL `Tag` filter (`Tag("industry") == [industry, "general"]`) so retrieval stays on-topic while still surfacing universal principles.
- **Live research compounds the index.** When enabled, Opus 4.8 web-researches winning ads in the space, structures the findings, and **upserts them back into the same Redis index** — so the knowledge base grows every time it runs (`pipeline/research.py`).
- **Provenance is auditable.** Every response carries a `RAGTrace` — endpoint, index, embedding model, dimensions, distance metric, retrieved IDs, and live cosine scores — so the UI can *prove* the creative was grounded in Redis Vector Search, not hallucinated. The Studio panel renders this as **"REDIS VECTOR RETRIEVAL"** with the real scores.

```
brief ─► embed (384-d) ─► Redis VectorQuery (cosine + tag filter) ─► top-k ad science ─► Opus 4.8 ─► optimized creative
```

## 2 · Semantic Caching — meaning, not strings

Opus optimization is slow and expensive. percept fronts it with a **semantic cache** (`pipeline/redis_store.py › PromptCache`, index `cerebra_prompt_cache_verified_rag_v4`): the brief is embedded and matched against prior briefs by **cosine distance under a 0.12 threshold**. A semantically similar brief — even reworded — returns the cached, fully-assembled creative **without touching the LLM**.

- **Measured in our live demo: ~40–77s (fresh Opus call) → ~1s (cache hit).**
- Cache keys are **generation-profile-aware** (model, resolution, duration, aspect) so a cached prompt can never leak across incompatible render settings.

## 3 · Conversation Memory — a creative session that remembers

percept is iterative: a brief becomes a creative, a render, a critique, a re-optimization. Redis gives that loop a memory (`pipeline/redis_store.py › SessionMemory`).

- Each turn is `RPUSH`ed to a **per-session list** `cerebra:session:{id}`, **capped** and given a **24h TTL** so sessions self-expire.
- Prior turns are replayed into Opus's context ("CONVERSATION SO FAR…"), so refinements build on history instead of starting cold.
- A global **agent-memory log** (`cerebra:runs`, `LPUSH` + `LTRIM` to 500) records every optimization across all sessions — long-term institutional memory for the system.

## 4 · The video itself lives in Redis

Stage 2 renders 1080p audio-video through Seedance 2.0. Redis is the delivery layer:

- **Prompt→URL generation cache** (`cerebra:gen:seedance2:{hash}`) means an identical creative never re-renders.
- **Full MP4 bytes are stored in Redis** (`cerebra:vid:{hash}`) and streamed to the browser **with HTTP Range support straight from Redis** — the `<video>` element scrubs against Redis-backed bytes, with CDN self-healing if a key is evicted (`pipeline/pika.py`).

---

## 🧩 Two Redis-native MCP plugins

We packaged percept's most novel Redis work as **two installable MCP servers** — so any agent (Claude included) can use Redis as a graph + vision substrate.

### Plugin 1 — **Percept Context**: GraphRAG on Redis

A **reward-weighted property graph** built entirely from Redis primitives — no graph database. It treats Redis as a learning knowledge graph of creative strategy.

- **Nodes** are a RedisVL vector index (`percept_nodes`, 384-dim, cosine) — every principle, technique, video, and object is semantically searchable.
- **Edges** are **sorted sets**: `percept:adj:{graph}:out:{src}:{type}` with the edge weight as the score. Traversal is a `ZREVRANGE` (highest-weight neighbors first) — beam search in one command. A reverse `in:` index makes it bidirectional; a `SADD` edge-type registry enumerates relations.
- **GraphRAG retrieval** = vector search for entry nodes → multi-hop sorted-set traversal → assembled subgraph context (`graph_rag_query`, `compose_brief`).
- **It learns.** `record_outcome(path, reward)` walks a winning creative's path and does `ZINCRBY` on every edge and `HINCRBYFLOAT` on every node score. **Strategies that produce high-performing ads literally gain weight in Redis**, so `top_performers` (a RedisVL `FilterQuery` sorted by score) surfaces what actually works. This is where the TRIBE v2 neuro-score closes the loop — the reward signal that reinforces the graph.
- **Multi-tenant** by a `graph` tag, so isolated projects share one Redis without collision.

> MCP tools: `graph_rag_query`, `search_nodes`, `add_node`, `link_nodes`, `neighbors`, `record_outcome`, `top_performers`, `graph_stats`, `compose_brief`, `seed_demo_graph`.

### Plugin 2 — **Percept Vision**: video understanding as Redis vectors

Turns any video into **searchable moments** in Redis.

[README truncated for size]

## Detected evidence (automated analysis)

Indexed codebase: 95 recognized source files, 674 KB.
- Anthropic (technology) — detected in the code
- CSS (language) — detected in the code
- FastAPI (technology) — detected in the code
- Next.js (technology) — detected in the code
- OpenAI (technology) — detected in the code
- Python (language) — detected in the code
- React (technology) — detected in the code
- Redis (technology) — detected in the code
- SQL (language) — detected in the code
- Supabase (technology) — detected in the code
- Tailwind CSS (technology) — detected in the code
- TypeScript (language) — detected in the code
- Node.js (technology) — claimed on Devpost, not found in the code
- AI coding agent: Claude Code — evidence: config files committed to the repository; commit authorship or trailers
- AI coding agent: Codex — evidence: config files committed to the repository

## Codebase structure (from repository index)

### Files (120 of 343)

```
.gitignore
.mcp.json
AGENTS.md
app/api/generate/route.ts
app/api/health/route.ts
app/api/optimize/route.ts
app/api/predict/route.ts
app/api/regenerate/complete/route.ts
app/api/regenerate/file/route.ts
app/api/regenerate/route.ts
app/api/regenerate/score/route.ts
app/api/settings/route.ts
app/api/splice/route.ts
app/api/surface/route.ts
app/api/transcribe/route.ts
app/api/video/[id]/route.ts
app/color-schemes.ts
app/components/CorticalBrain.tsx
app/components/ProgressRail.tsx
app/components/Studio.tsx
app/globals.css
app/layout.tsx
app/lib/regen.ts
app/lib/studioOptimizer.ts
app/page.tsx
CLAUDE.md
docs/superpowers/plans/2026-06-21-percept-ui-overhaul.md
docs/superpowers/plans/2026-06-21-regen-tribe-scoring.md
docs/superpowers/specs/2026-06-21-percept-ui-overhaul-design.md
docs/superpowers/specs/2026-06-21-regen-tribe-scoring-design.md
eslint.config.mjs
instrumentation-node.ts
instrumentation.ts
next.config.ts
package.json
percept-context/.gitignore
percept-context/examples/quickstart.py
percept-context/pyproject.toml
percept-context/README.md
percept-context/src/percept_context/__init__.py
percept-context/src/percept_context/config.py
percept-context/src/percept_context/embeddings.py
percept-context/src/percept_context/graph.py
percept-context/src/percept_context/seed.py
percept-context/src/percept_context/server.py
percept-context/src/percept_context/store.py
percept-context/tests/test_smoke.py
percept-vision/.gitignore
percept-vision/examples/quickstart.py
percept-vision/pyproject.toml
percept-vision/README.md
percept-vision/src/percept_vision/__init__.py
percept-vision/src/percept_vision/config.py
percept-vision/src/percept_vision/graph_link.py
percept-vision/src/percept_vision/ingest.py
percept-vision/src/percept_vision/server.py
percept-vision/src/percept_vision/storage.py
percept-vision/src/percept_vision/store.py
percept-vision/src/percept_vision/vision.py
pipeline/__init__.py
pipeline/app.py
pipeline/cli.py
pipeline/config.py
pipeline/duration.py
pipeline/embeddings.py
pipeline/knowledge/__init__.py
pipeline/knowledge/seed_corpus.py
pipeline/knowledge/seedance_skill.py
pipeline/llm.py
pipeline/optimizer.py
pipeline/pika_auth.py
pipeline/pika_login.py
pipeline/pika.py
pipeline/README.md
pipeline/redis_store.py
pipeline/requirements.txt
pipeline/research.py
pipeline/run-redis.sh
pipeline/schema.py
pipeline/seed.py
pipeline/transcribe.py
postcss.config.mjs
prediction_cache/008896ed4901ed3775ab11ed116132c0802b1a4a6dc3caca4e866ed4f25db9be.json
prediction_cache/008896ed4901ed3775ab11ed116132c0802b1a4a6dc3caca4e866ed4f25db9be.ref.npz
prediction_cache/0202dd7cab18a37ead647f6f80efc93e492dc6c13fb9b247fbf7ad640c652dd0.json
prediction_cache/0202dd7cab18a37ead647f6f80efc93e492dc6c13fb9b247fbf7ad640c652dd0.ref.npz
prediction_cache/05dc4a9b416454d923a2015f1158663c26a1853a3f76e4d96fc42e9acd712a0c.json
prediction_cache/05dc4a9b416454d923a2015f1158663c26a1853a3f76e4d96fc42e9acd712a0c.ref.npz
prediction_cache/07754972fce01ae0f9bfd3773a2e3c0503d48bf65a499a2705cd9b27c0d74149.json
prediction_cache/07754972fce01ae0f9bfd3773a2e3c0503d48bf65a499a2705cd9b27c0d74149.ref.npz
prediction_cache/0910279c6597cf14d6dfd323681cf1a2851919ea05a3bde344653b3c79503cd0.json
prediction_cache/0910279c6597cf14d6dfd323681cf1a2851919ea05a3bde344653b3c79503cd0.ref.npz
prediction_cache/0ca2c4b18679793cb50b21bab005ed9c8baf25deebbb294a8e06129625272b42.json
prediction_cache/0ca2c4b18679793cb50b21bab005ed9c8baf25deebbb294a8e06129625272b42.ref.npz
prediction_cache/17aee072ea618803517feef0c448ca19f0851857ab271bc6c03c62bc7b5eadfd.json
prediction_cache/17aee072ea618803517feef0c448ca19f0851857ab271bc6c03c62bc7b5eadfd.ref.npz
prediction_cache/199e4d76793232974bc414aac528badf70b5c474b950ae30b309d697ed6f8c37.json
prediction_cache/199e4d76793232974bc414aac528badf70b5c474b950ae30b309d697ed6f8c37.ref.npz
prediction_cache/1e0992eb799fa446bc502dda7d132c127446428f1a41e7dca3028c63811bfffc.json
prediction_cache/1e0992eb799fa446bc502dda7d132c127446428f1a41e7dca3028c63811bfffc.ref.npz
prediction_cache/2048a70494afc145e00ed5f3035d180bbb2bf6c83ce78a8aaaa267b193b50ae6.json
prediction_cache/2048a70494afc145e00ed5f3035d180bbb2bf6c83ce78a8aaaa267b193b50ae6.ref.npz
prediction_cache/264ffabe4bba254f5053b77e935d4d18f10c293ff5bab22639c270f9abcfd7a8.json
prediction_cache/264ffabe4bba254f5053b77e935d4d18f10c293ff5bab22639c270f9abcfd7a8.ref.npz
prediction_cache/2d6ce28c98d36f657d06b694a15221567cfa61abae9763dca5f5fe3bc360129f.json
prediction_cache/2d6ce28c98d36f657d06b694a15221567cfa61abae9763dca5f5fe3bc360129f.ref.npz
prediction_cache/2ef9aafea152457fc3a6dbb99d2fe621b74ddc76c75c398002bd85e10b8c8939.json
prediction_cache/2ef9aafea152457fc3a6dbb99d2fe621b74ddc76c75c398002bd85e10b8c8939.ref.npz
prediction_cache/2fbee89096c026d337943b819394ec3aae17d5f0848cfddfb9dee3d42220e996.json
prediction_cache/2fbee89096c026d337943b819394ec3aae17d5f0848cfddfb9dee3d42220e996.ref.npz
prediction_cache/323b065b943de9ef71d41a0e93ed0de9b9a6c26dbdd56249f9f8c6612f9e1ec6.json
prediction_cache/323b065b943de9ef71d41a0e93ed0de9b9a6c26dbdd56249f9f8c6612f9e1ec6.ref.npz
prediction_cache/36bc115d421139d67c39b73d9da23226ed5954eed5f92d2555ec97c818127c48.json
prediction_cache/36bc115d421139d67c39b73d9da23226ed5954eed5f92d2555ec97c818127c48.ref.npz
prediction_cache/41ac463c458f04e56f8e1091f66aaa3d276ee657bc218fbfd899ae8996ed94d7.json
prediction_cache/41ac463c458f04e56f8e1091f66aaa3d276ee657bc218fbfd899ae8996ed94d7.ref.npz
prediction_cache/434c86e0edf539bc4c0708e30f6a5cadf1b0eb9318a5ce17a420ccf11861e107.json
prediction_cache/434c86e0edf539bc4c0708e30f6a5cadf1b0eb9318a5ce17a420ccf11861e107.ref.npz
prediction_cache/485968d146eed7392367fa3d1f2a9f520f49ab2a9d6039b7f89dcb4d15ef22f8.json
prediction_cache/485968d146eed7392367fa3d1f2a9f520f49ab2a9d6039b7f89dcb4d15ef22f8.ref.npz
[223 more files omitted for size]
```

### Dependencies

- package.json: @tailwindcss/postcss@^4, @types/node@^20, @types/react@^19, @types/react-dom@^19, @types/three@^0.184.1, eslint@^9, eslint-config-next@16.2.9, next@16.2.9, react@19.2.4, react-dom@19.2.4, tailwindcss@^4, three@^0.184.0, typescript@^5
- percept-context/pyproject.toml: anthropic@>=0.40.0, mcp@>=1.2.0, numpy@>=1.24, openai@>=1.0.0, python-dotenv@>=1.0.0, redis@>=5.0.0, redisvl@>=0.3.0, sentence-transformers@>=2.2.0
- percept-vision/pyproject.toml: anthropic@>=0.40.0, mcp@>=1.2.0, numpy@>=1.24, opencv-python-headless@>=4.8, pillow@>=10.0, python-dotenv@>=1.0.0, redis@>=5.0.0, redisvl@>=0.3.0, sentence-transformers@>=2.2.0, supabase@>=2.4, ultralytics@>=8.2
- pipeline/requirements.txt: anthropic@>=0.49, fastapi@>=0.115,<1.0, hiredis@>=3,<4, openai@>=1.30, pydantic@>=2.7,<3.0, python-multipart@>=0.0.20, redisvl@>=0.3,<1.0, sentence-transformers@>=3.0,<6.0, uvicorn[standard]@>=0.32,<1.0
- terac/package.json: @types/node@^20, @types/react@^19, @types/react-dom@^19, next@16.2.9, react@19.2.4, react-dom@19.2.4, typescript@^5
- worker/requirements.txt: fastapi@>=0.115,<1.0, git@+https://github.com/facebookresearch/tribev2.git, mne@>=1.8,<2.0, nilearn@>=0.11,<1.0, python-multipart@>=0.0.20, uvicorn[standard]@>=0.32,<1.0

### Recent commits (newest first)

- chore(percept): add prediction_cache .ref.npz baselines
- chore(percept): add prediction_cache JSON entries
- feat(percept): amplify the headline engagement score on display
- feat(percept): bake the normalized take scores into the graph on selection
- feat(percept): normalize take scores to the original on display
- Merge remote-tracking branch 'origin/main' into regen-incremental-scoring
- fix(percept): recover the 3rd regen take that stalls behind Pika's ~2-concurrent limit
- front page
- Merge branch 'main' of https://github.com/edrlu/Cerebra
- update re
- prompt instructions
- fix frontend
- Merge branch 'main' of https://github.com/edrlu/Cerebra
- frontend quality
- Merge pull request #15 from edrlu/regen-incremental-scoring
- fix(regen): original reference = its engagement over the SELECTED slot, not the whole clip
- Merge pull request #14 from edrlu/regen-incremental-scoring
- fix(regen): take picker shows the original's own 4-factor average, not a hardcoded 50
- Merge pull request #13 from edrlu/regen-incremental-scoring
- feat(regen): show the original's baseline (50) in the take picker, not the takes' average

## Key source files (fetched from GitHub, selected and truncated for size)

### CLAUDE.md

```markdown
@AGENTS.md

```

### AGENTS.md

```markdown
<!-- BEGIN:nextjs-agent-rules -->
# This is NOT the Next.js you know

This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` before writing any code. Heed deprecation notices.
<!-- END:nextjs-agent-rules -->

```

### package.json

```
{
  "name": "percept",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "eslint"
  },
  "dependencies": {
    "@types/three": "^0.184.1",
    "next": "16.2.9",
    "react": "19.2.4",
    "react-dom": "19.2.4",
    "three": "^0.184.0"
  },
  "devDependencies": {
    "@tailwindcss/postcss": "^4",
    "@types/node": "^20",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "eslint": "^9",
    "eslint-config-next": "16.2.9",
    "tailwindcss": "^4",
    "typescript": "^5"
  }
}

```

### worker/requirements.txt

```
fastapi>=0.115,<1.0
uvicorn[standard]>=0.32,<1.0
python-multipart>=0.0.20
mne>=1.8,<2.0
nilearn>=0.11,<1.0
git+https://github.com/facebookresearch/tribev2.git

```

### terac/package.json

```
{
  "name": "cut-test-study",
  "private": true,
  "version": "1.0.0",
  "scripts": { "dev": "next dev", "build": "next build", "start": "next start" },
  "dependencies": { "next": "16.2.9", "react": "19.2.4", "react-dom": "19.2.4" },
  "devDependencies": { "@types/node": "^20", "@types/react": "^19", "@types/react-dom": "^19", "typescript": "^5" }
}

```

### worker/Dockerfile

```
FROM python:3.11-slim

ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 TRIBEV2_CACHE_DIR=/data/cache
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg git build-essential && rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir -r requirements.txt
COPY app.py .
EXPOSE 8000
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]

```

### pipeline/requirements.txt

```
# Cerebra Stage 1 — research-backed RAG prompt optimizer.
# Python 3.11/3.12/3.13. Kept separate from worker/ so the neuroscience stack
# and the retrieval stack install independently.

fastapi>=0.115,<1.0
uvicorn[standard]>=0.32,<1.0
python-multipart>=0.0.20
pydantic>=2.7,<3.0

# Redis "beyond caching": RedisVL drives vector search, the semantic prompt
# cache, and the agent-memory log. redisvl pulls in redis-py.
redisvl>=0.3,<1.0
hiredis>=3,<4

# Local, free embeddings via RedisVL's HuggingFace vectorizer (no API key).
sentence-transformers>=3.0,<6.0

# Research synthesis + prompt optimization. Optional at runtime: without an
# ANTHROPIC_API_KEY the optimizer falls back to a deterministic template path.
anthropic>=0.49

# Voice intake. Primary: OpenAI Whisper API (needs OPENAI_API_KEY). The browser
# Web Speech mic in the Studio needs neither. faster-whisper is an offline fallback.
openai>=1.30
# faster-whisper>=1.0

```

### percept-vision/pyproject.toml

```
[project]
name = "percept-vision-plugin"
version = "0.1.0"
description = "Percept Vision — store videos in object storage + their CV understanding in Redis, then search and ask questions about them. MCP plugin."
readme = "README.md"
requires-python = ">=3.10"
license = { text = "MIT" }
authors = [{ name = "Percept" }]
keywords = ["redis", "redisvl", "mcp", "video", "computer-vision", "yolo", "clip", "opencv", "vector-search", "supabase"]
dependencies = [
    "mcp>=1.2.0",
    "redis>=5.0.0",
    "redisvl>=0.3.0",
    "numpy>=1.24",
    "opencv-python-headless>=4.8",
    "ultralytics>=8.2",
    "sentence-transformers>=2.2.0",
    "pillow>=10.0",
    "supabase>=2.4",
    "python-dotenv>=1.0.0",
]

[project.optional-dependencies]
llm = ["anthropic>=0.40.0"]

[project.scripts]
percept-vision = "percept_vision.server:main"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/percept_vision"]

```

### percept-context/pyproject.toml

```
[project]
name = "percept-context-plugin"
version = "0.1.0"
description = "Percept Context — a Redis-native context graph + GraphRAG engine for video-ad generation, exposed over MCP."
readme = "README.md"
requires-python = ">=3.10"
license = { text = "MIT" }
authors = [{ name = "Percept" }]
keywords = ["redis", "redisvl", "mcp", "graphrag", "knowledge-graph", "context-graph", "vector-search", "rag", "video"]
dependencies = [
    "mcp>=1.2.0",
    "redis>=5.0.0",
    "redisvl>=0.3.0",
    "numpy>=1.24",
    "sentence-transformers>=2.2.0",
    "python-dotenv>=1.0.0",
]

[project.optional-dependencies]
# Optional LLM composition (compose_brief tool). Core graph works without it.
llm = ["anthropic>=0.40.0"]
# Optional OpenAI embeddings instead of local HF (torch-free install).
openai = ["openai>=1.0.0"]

[project.scripts]
percept-context = "percept_context.server:main"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/percept_context"]

```

### app/layout.tsx

```typescript
import type { Metadata } from "next";
import "./globals.css";

export const metadata: Metadata = {
  title: "percept — brain-response explorer for video",
  description: "Generate an ad, see how the population-average brain responds with Meta TRIBE v2, and refine the weak moments.",
};

export default function RootLayout({ children }: Readonly<{ children: React.ReactNode }>) {
  return <html lang="en"><body>{children}</body></html>;
}

```

[85 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]