Youtube-Agent-Matrix
CLAUDE.md11 starsChanged 9 days agoMITView on GitHub
Guidance for anyone (human or agent) editing this plugin. The user-facing document is README.md; this one is about how the thing is built and how to keep it coherent. The separation is the point. Routing logic that leaks into an agent makes the agent unusable on its own. Domain knowledge that leaks into the orchestrator gets loaded on every single request. Benchmarks that leak into either one start drifting the moment the platform changes. Which layer does a change belong…
In this repository3 other files it gives its agents.
- AGENTS.mdAGENTS.md
- editorSkill
- orchestratorSkill
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
22 rules. About 0 are common, 12 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 82
5. Agent frontmatter: Every file in agents/ opens with:
- Very specific: line 98
6. Python scripts output JSON and degrade gracefully: Every script in execution/:
- Distinctive: line 110
Never printed — not in full, not masked.
- Distinctive: line 140
8. Stay generic: No person's name, no real channel, no assumed niche, no assumed market anywhere in the plugin.
- Very specific: line 150
Create agents/<agent-name>.md with name: <agent-name> matching the filename stem.
- Very specific: line 151
Write the description for routing: what it owns, then when to use it.
- Very specific: line 163
If it belongs in the production chain, update the chain diagram in both SKILL.md and README.md, and decide explicitly whether it sits …
- Distinctive: line 165
Do not add a fourth gate without a strong reason — gate count is a design budget.
- Very specific: line 172
Read templates/channel-types/_schema.md first — it defines both the five classification axes and the normalized section order every …
- Distinctive: line 184
Do not invent one to fill the template.
- Very specific: line 185
Add it to the archetype list in _schema.md and to the folder map in README.md.
- Distinctive: line 196
Update its date and source on the same line or in the section's source note.
- Distinctive: line 207
If the number no longer exists in a trustworthy form, move it to §11 *Known gaps* rather than keeping a stale value.
- Distinctive: line 210
Never let a competing figure survive in an agent, a template or another reference.
- Very specific: line 231
Write
unavailablerather than deriving: If no source gives that niche's RPM for this market, say so. - Distinctive: line 290
Same agent, same run: Never split the pair across two agents or two invocations — that is how they drift.
- Distinctive: line 292
Derived files originate nothing: Every statement traces to the source.
- Very specific: line 324
Agents decide, scripts calculate: No agent writes FCPXML, computes a frame or edits a script's output.
- Very specific: line 333
The creator's media is read-only: Never moved, renamed, copied or deleted.
- Distinctive: line 358
When a figure cannot be re-verified, downgrade its confidence tag or move it to §11 rather than leaving it looking fresh.
- Distinctive: line 360
Keep §11 *Known gaps* honest and current.
- Distinctive: line 374
Before any release, the short checklist:
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md — Maintainer Guide
Guidance for anyone (human or agent) editing this plugin. The user-facing document is
README.md; this one is about how the thing is built and how to keep it coherent.
Architecture: three layers
Layer 1 skills/orchestrator/SKILL.md
Routing, startup sequence, state, gates, delegation contract.
Holds no domain knowledge and writes no deliverable.
│ delegates with an explicit prompt
▼
Layer 2 agents/*.md
16 pre-production subagents. Each owns its deliverable — two of them
also own a derived creator-facing view of it, see below. Agents do not
call each other; the orchestrator fans them out and collects results.
(+ skills/editor/SKILL.md and its 8 editing agents — see "Editing".)
│ loads, on demand, only what it needs
▼
Layer 3 references/*.md + templates/channel-types/*.md + templates/outputs/*
Knowledge and shape. Inert: nothing here decides anything.
execution/*.py sits beside this layer as optional live data.The separation is the point. Routing logic that leaks into an agent makes the agent unusable on its own. Domain knowledge that leaks into the orchestrator gets loaded on every single request. Benchmarks that leak into either one start drifting the moment the platform changes.
Which layer does a change belong in?
| The change is… | It goes in |
| When something runs, in what order, who approves | skills/orchestrator/SKILL.md |
| How one deliverable is produced and what it must contain | agents/<agent>.md |
| A fact, a rule, a framework, a mechanic | references/<topic>.md |
| A number | references/benchmarks.md, and nowhere else |
| Archetype-specific targets and patterns | templates/channel-types/<type>.md |
| The shape of a written deliverable | templates/outputs/ |
| Talking to an API | execution/ |
Hard authoring rules
1. SKILL.md stays under 500 lines. It loads on every invocation. Anything that is not
routing, state or gates belongs in a reference file. If it is growing, something has leaked down
from Layer 3 or up from Layer 2.
2. Reference files stay under ~260 lines. They are loaded selectively and read in full when loaded. Past that, split by topic rather than letting one file become the place everything lands.
references/benchmarks.md is exempt from this limit, and it is the only exemption. Holding
every number in the system in one file is the whole point of rule 3 below — splitting it by topic
would manufacture exactly the second home for a number that rule 3 exists to prevent, and the
first time the two copies drifted the system would start quoting a stale figure with full
confidence. Its length is a consequence of the design, not a symptom of neglect. Keep it
organized by numbered section instead: agents load it by section reference, not by reading it end
to end.
3. All benchmark numbers live only in references/benchmarks.md. This is the rule the whole
system's credibility rests on. No agent, no template, no other reference restates a CTR range, a
retention target, an RPM figure, a character limit or a quota cost — they point at
benchmarks.md instead. Two files holding the same number means one of them is already wrong;
you just do not know which yet.
Grep before you commit:
grep -rniE '[0-9]+(\.[0-9]+)?\s*%|RPM|CPM' agents/ references/ templates/ \
--include='*.md' | grep -v 'references/benchmarks.md'Percentages that survive that filter should be structural (a weighting, a split, a share of a score), never platform data.
4. Kebab-case filenames throughout. hook-library.md, channel-auditor.md,
niche-authority.md. Python files stay snake_case.py — a module name has to be importable.
5. Agent frontmatter. Every file in agents/ opens with:
---
name: agent-name # MUST equal the filename stem: agents/agent-name.md
description: One sentence on what it owns, then one on when to use it. This is
what the orchestrator matches against — write it for routing, not for a
catalogue entry.
tools: Read, Write, Edit, Glob, Grep, WebSearch, WebFetch # only what it needs
model: opus # or sonnet for the lighter agents
---name mismatching the filename is the most common breakage: the orchestrator delegates by name
and the agent silently does not exist.
6. Python scripts output JSON and degrade gracefully. Every script in execution/:
- has a module docstring covering purpose, cost, credentials and usage examples;
- exposes
--helpviaargparse; - prints JSON to stdout on success (
{"ok": true, ...}) and on failure ({"ok": false, "error": {"code", "message", "fix"}}), exiting non-zero on failure; - never emits a stack trace —
install_excepthook()fromutils/youtube_auth.pyconverts anything uncaught into a JSON error object; - names the manual fallback in the error when a credential is missing, so the workflow continues without it;
- reads credentials from environment variables and the user config directory
(
~/.config/youtube-agent-matrix/) only. Never from, and never written to, the plugin folder. Never printed — not in full, not masked; - checks
utils/quota_tracker.pybefore an expensive call and records what it spent; - depends on nothing beyond the standard library plus
google-api-python-client/google-auth-oauthlib, with one exception:build_reader_doc.pyusespython-docxwhen it is present and falls back topandoc, then to leaving the Markdown in place. An optional dependency is only acceptable when its absence degrades the output rather than blocking it.
Exception — execution/edit/. Video editing cannot run on the standard library. Scripts there
may depend on ffmpeg/ffprobe and xmllint (system tools), numpy, mlx-whisper and
faster-whisper (transcription, speech detection), opencv-python-headless (face tracking), and
Node.js running a pinned hyperframes version through npx. They are listed in
execution/edit/requirements.txt and installed into a dedicated virtualenv outside the plugin
(~/.local/share/youtube-agent-matrix/edit-venv), never into the system Python, never inside the
plugin folder, and only after the creator says yes (setup_check.py lists what is missing). Everything
else above still applies: JSON on stdout, no stack traces, a module docstring, --help. "Degrade
gracefully" means here: a missing dependency stops that editing step with the exact install
command — it never affects pre-production, and no step silently falls back to a weaker method
(a fallback that exists, like CPU transcription, is announced). Library modules in that folder
(common.py, timebase.py, audio_tools.py, easing.py) have no CLI of their own.
Compile-check before committing:
python3 -m py_compile execution/*.py execution/utils/*.py execution/edit/*.py
python3 -m unittest discover -s execution/edit/tests # needs ffmpeg + numpy7. Everything is written in English. Source files, comments, docstrings, agent prompts. The creator's chosen language governs deliverables at runtime, never the repository.
8. Stay generic. No person's name, no real channel, no assumed niche, no assumed market anywhere in the plugin. Examples use placeholders. A channel-specific detail in a template is a bug — it will be wrong for every other user.
Adding a new agent
- Check it earns a slot. Does it own a deliverable no existing agent owns? Overlapping agents make routing ambiguous, and ambiguous routing is worse than a missing agent.
- Create
agents/<agent-name>.mdwithname: <agent-name>matching the filename stem. - Write the
descriptionfor routing: what it owns, then when to use it. The orchestrator reads this and nothing else when deciding. - Grant the minimum
tools. Only agents that fan out internally needAgent. Only agents that run the execution layer needBash. - Name the reference files it should load, specifically. "Load what you need" makes an agent load all fourteen.
- State its output contract: exact filename, exact sections, where it writes in
workspace/videos/<slug>/orworkspace/. - Register it in three places, or it is invisible:
- the agents table in
skills/orchestrator/SKILL.md - the routing tables in
skills/orchestrator/SKILL.md(command and/or natural language) - the agents table in
README.md
- the agents table in
- If it belongs in the production chain, update the chain diagram in both
SKILL.mdandREADME.md, and decide explicitly whether it sits before, after or inside an existing gate. Do not add a fourth gate without a strong reason — gate count is a design budget. - Cite no numbers of its own. It reads
benchmarks.md.
Adding a new channel archetype
Read templates/channel-types/_schema.md first — it defines both the five classification axes
and the normalized section order every archetype file follows. Agents read any archetype the same
way, and that only holds if the schema is followed exactly.
- Confirm it is a genuine archetype, not a niche. "Gaming" is an archetype (different traffic surface, cadence, format, monetization). "Cooking" is a niche — it is served by Tutorial or Personal Brand.
- Copy the section order from
_schema.md. Do not reorder, rename or drop sections. - Fill in what makes it different: traffic surface, viewer intent, cadence, typical length, title and hook patterns, monetization stack, production model.
- Numbers still come from
benchmarks.md. If the archetype needs a target that is not there, either add it tobenchmarks.mdwith a date and a source, or say the benchmark is unavailable. Do not invent one to fill the template. - Add it to the archetype list in
_schema.mdand to the folder map inREADME.md. - Sanity-check the classifier: describe two real-feeling channels of that type and confirm the five axes actually land on it rather than on an existing archetype.
Updating a benchmark
The value of benchmarks.md is that it is the only place a number lives. Protect that.
- Change the number in
benchmarks.mdonly. - Update its date and source on the same line or in the section's source note. A number with no date is unusable within a year.
- Set the confidence tag honestly:
Amulti-source or large-N,Bsingle credible source,Cdirectional or anecdotal. Downgrading a tag is a legitimate edit on its own. Grep the repository to make sure no second file picked the figure up:
grep -rn '<the old number>' . --include='*.md' --include='*.py'Any other file holding it is the bug — remove it there, point at
benchmarks.mdinstead.- If the number no longer exists in a trustworthy form, move it to §11 Known gaps rather than keeping a stale value. "Benchmark unavailable" is a correct answer; a stale figure presented as current is not.
- Never let a competing figure survive in an agent, a template or another reference. One number, one home.
The one legitimate exception: the per-call quota costs in execution/utils/quota_tracker.py.
Those are operational constants the code spends against, not figures the matrix cites. The
headline quota numbers agents quote still come from benchmarks.md §10.
Adding a new market
Market files live in references/markets/, one per market code, plus _index.md. Read
references/markets/_index.md before writing one — it is the schema: the frontmatter fields,
the fixed ten-section body, the workspace/config.json → markets.mix config shape, the
weighted-blending method, and the table of which agent reads which section. Agents cite section
numbers, so do not reorder or renumber sections.
The hard rules, which are not negotiable:
- Every figure carries a confidence tag and a source. Market data is volatile and mostly
C. AClabelledBis worse than no number at all. - Write
unavailablerather than deriving. If no source gives that niche's RPM for this market, say so. Multiplying the US figure and presenting the result as market data is exactly the fabrication this system exists to prevent — that is what the multiplier table is for, and it must be labelled as a multiplier. - Never restate platform mechanics. CTR bands, retention thresholds, character limits, YPP
requirements and quota costs live in
benchmarks.mdand are cited, never copied. A market file holds only what actually changes by country: economics, culture, law, rhythm. - State the review date in
last_reviewed, and date individual figures where they differ. - Written in English, like every reference. Deliverables are translated; references are not.
Then: add the market to the Available markets table in _index.md, and — if it supersedes a row
in localization-guide.md §2 — mark that row superseded rather than deleting it.
Market files decay faster than any other reference in this repo. Ad rates, sponsorship norms,
payment rails and disclosure regimes all move within a year, and a stale market file is quoted
with the same confidence as a fresh one. Re-review every market file at least yearly, and
downgrade a confidence tag or write unavailable rather than letting a figure look current when
it is not.
Localization rule
Every revenue figure in benchmarks.md is US-baseline. RPM, CPM, sponsorship rates, product
pricing — all of it is United States, English-language, long-form unless a line says otherwise.
Any agent producing a revenue figure for a non-US channel or a non-English audience must adjust it
first: through references/markets/<code>.md where that market has a file, and only otherwise
through references/localization-guide.md's directional multiplier table, saying which it used. Unadjusted US RPM applied to an emerging market
is wrong by five to twenty times, and a revenue projection wrong by that much is worse than no
projection at all.
This applies to authoring too: when adding a revenue number to benchmarks.md, label the market
it came from. If it is not US, say so on the line — otherwise the conversion is applied twice.
CTR and retention data are not regionally adjusted in this matrix. There is no reliable
non-US dataset for them; benchmarks.md §11 lists that as a known gap, and it should stay listed
rather than being filled in with guesses.
Derived creator-facing files
Two deliverables ship in two versions, and the distinction is load-bearing:
| Source of truth (agents read this) | Derived view (the creator reads this) | Owner |
script-{a|b|c}-*.md | script-recording.docx — screenplay format: scene/cut headings, speaker cues, spoken lines | script-agent, recording mode |
workspace/channel-profile.md | workspace/channel-summary.docx | channel-strategist |
research-report-agent's research-report.docx uses the same converter (execution/build_reader_doc.py)
but is not a pair: nothing downstream reads research-report.md as a source of truth, so
rules 1–3 below don't apply to it the way they apply to the two pairs above. Rules 4–6 (Word
output, graceful degradation, never clobbering a hand-edit) still do.
Rules when touching either pair:
- Only the source is ever read by an agent. Nothing in the system may depend on a derived file. If you find an agent reading one, that is the bug.
- Same agent, same run. Never split the pair across two agents or two invocations — that is how they drift.
- Derived files originate nothing. Every statement traces to the source. A fact that exists only in the derived view is a gap in the source; fill it there.
- Derived views are Word documents. The agent writes Markdown to the template, runs
execution/build_reader_doc.pyon it, and the script renders the.docxand deletes the Markdown. The templates' conventions are functional, not stylistic: in the recording script a plain paragraph is a line to say and a>line is a line to do, and the converter renders them differently so they cannot be confused on camera. The converter is the only writer of a.docx, and every document is A4 portrait with 2.54 cm margins — it rewrites the page layout after either renderer and verifies it. No agent writes docx code or sets a page size; a document in any other layout is a bug in whatever produced it. - The converter is optional, like every integration here. Without
python-docxorpandocthe conversion fails, the Markdown stays as the deliverable, and the agent passes on the install command. It also never overwrites a document the creator has annotated — it compares the file's hash against.reader-docs.jsonand writes-v2instead. script-recording.docxis generated only for the variant approved at GATE 2, never for all three. Generating three would triple the cost of the most expensive agent in the matrix for two files the creator will never open.
Adding a third pair is a real decision, not a freebie: every derived file is another thing that can fall out of sync. Do it only when asked.
Editing
/yt edit hands over to a second skill, skills/editor/SKILL.md, which runs on the main thread like
the orchestrator: it talks to the creator, holds the editing state and runs checkpoints (not gates —
the orchestrator keeps its three). It delegates one stage at a time to eight agents: footage-agent,
cut-agent, edit-style-agent, motion-plan-agent, asset-agent, motion-render-agent,
camera-agent, sound-agent. The orchestrator only routes to the editor; it does not list those
agents.
The rules that keep it coherent:
- Agents decide, scripts calculate. No agent writes FCPXML, computes a frame or edits a script's
output. All time goes through
execution/edit/timebase.py(exact fractions, no floats). - One writer per file, as everywhere: each stage owns its own folder under
workspace/videos/<slug>/edit/;edit-state.json, deliveries and returns belong to the editor. The ownership table lives inskills/editor/SKILL.md. - Craft vs taste. Craft lives in
references/editing/(constants marked "craft default, overridden by the edit profile" — they are not platform numbers, so rule 3 does not send them tobenchmarks.md). Taste lives in the creator'sworkspace/edit-profile/. A craft learning from a creator reaches this repository through a maintainer, never at runtime. - The creator's media is read-only. Never moved, renamed, copied or deleted; nothing written inside
a
.fcpbundle; deliveries versioned, never overwritten. No computer use to drive Final Cut. - Final Cut delivery is validated with
xmllint --dtdvalidagainst the DTD of the same FCPXML version, read from the installed app (never committed here — it is Apple's). Without it a delivery is reported unvalidated, never silently checked a weaker way. Layout, roles and time rules:references/editing/delivery-fcpxml.md. When Final Cut behaves differently than expected, copy what it exports; do not guess. - Tests are never weakened to make something pass.
execution/edit/tests/must pass, with the DTD (FCPXML_DTD=…) before a release. - Attribution. The workflow and craft guides are adapted from fluxo-de-edicao (MIT, Lucas Leite):
every adapted file names its source at the top, and
THIRD_PARTY_NOTICES.mdcarries the licence. Translate and adapt; never paste the original text.
Maintenance
Platform numbers decay. YouTube changes what it counts, how it counts it and what it rewards, and creator-blog figures propagate outdated numbers for years after the fact. Treat anything tagged 2024 or earlier as directional, not as a measurement — safe for framing a decision, not safe for a projection a creator will act on.
A sensible review pass:
- Re-check §1 CTR, §2 retention and §9 monetization against primary sources annually. Prefer platform documentation and official help pages over roundups.
- Re-check §10 analytics and quota limits whenever a script starts failing in a new way.
- When a figure cannot be re-verified, downgrade its confidence tag or move it to §11 rather than leaving it looking fresh.
- Keep §11 Known gaps honest and current. An accurate list of what the system does not know is worth more than a complete-looking list of half-sourced numbers, because it is what stops an agent from inventing one.
The Codex version
The plugin also ships for OpenAI Codex. The Claude Code files stay the single source of truth;
codex/build_codex.py generates everything Codex needs from them — one TOML custom agent per
agents/*.md (Claude model → Codex reasoning effort: opus → high, sonnet → medium; no Codex model
pinned), each skill with a short "Running in OpenAI Codex" preamble, commands/yt.md as a $yt skill,
and the two Codex manifests. Never edit a generated file and never bend a Claude file to suit Codex: if
Codex needs something different, the generator's preamble is where it goes. Any change to an agent, a
skill, the command or plugin.json needs a rebuild — the Codex tests fail until it is done.
Before any release, the short checklist:
python3 -m py_compile execution/*.py execution/utils/*.py execution/edit/*.py # scripts compile
FCPXML_DTD=<path> python3 -m unittest discover -s execution/edit/tests # editing tests pass
wc -l skills/orchestrator/SKILL.md skills/editor/SKILL.md # each under 500
wc -l references/editing/*.md # each around 260 or less
wc -l references/*.md # each around 260 or less;
# benchmarks.md exempt (rule 2)
grep -L 'name:' agents/*.md # every agent has frontmatter
python3 codex/build_codex.py # regenerate the Codex version
python3 -m unittest discover -s codex/tests # Codex files current and validThen confirm each agent's name still equals its filename stem, and that any agent added or
renamed appears in the orchestrator's tables (editing agents: in the editor's table) and in README.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

