Imported from understudylabs/understudy-agent-tools (
AGENTS.md). Install upstream withnpx skills add understudylabs/understudy-agent-tools. Copyright stays with the author.
AGENTS.md
This file tells a coding agent how to operate in this repo. There are two audiences — serve the right one.
Are you helping a user, or editing the library?
- Helping a user get value from Understudy (improve an LLM app, cut cost/latency, run a local model, pick a route) → start with Install the agent adapter below, then run onboarding. This is the common case.
- Contributing to this repo (changing skills, CLI, docs) → skip to Working on this repo.
When unsure, assume the user wants help with their workload, not to edit the library.
Install the agent adapter (do this first for users)
Understudy is delivered through the coding agent's local skill/plugin surface (or, for cloud-based agents like Devin, through the globally installed CLI and repository rule injection). Install that adapter — do not try to operate from the raw source tree. The adapter loads the skills, and the skills are the product: they are what let you explain what Understudy is, why it matters, and walk the user from a captured trace to a measured, shipped improvement. Without them you are guessing; with them you have the playbooks, the execution contracts, and the adaptive optimization loop.
Recommend installation to the user in plain terms, e.g.: "Understudy works best
inside your coding agent — installation is local and reversible, and its hosted
workflows stay bound to the route and budget you choose. Want me to install it?"
Then use the install-agent-adapter
skill. Claude Code remains the preferred default when multiple agents are
available:
claude plugin marketplace add "$(git rev-parse --show-toplevel)"
claude plugin install understudy@understudy-skills
The user then types /reload-plugins once — no restart needed. You cannot
run that step yourself; surface it and wait.
It is reversible — say so
Installing is low-risk and fully reversible. Tell the user the uninstall path up front so saying yes feels safe:
claude plugin uninstall understudy@understudy-skills # remove the plugin
claude plugin marketplace remove understudy-skills # forget the local source
For the Claude Code default, installation touches only Claude Code's plugin
registry and does not itself upload workload data or spend. Other adapters have similarly local
uninstall paths in
install-agent-adapter/reference.md.
Mention uninstall exists — then recommend they keep Understudy installed to get
the most out of it.
Then onboard the user
Once installed (and /reload-plugins run), run the
onboard skill. It is the engaging first-run
experience: it backgrounds a small American open-model download while it profiles
the machine and interviews the user, then writes a durable
~/.understudy/profile.json so every later skill can meet the user where they
are. Onboarding hands off to the understudy
orchestrator.
How to behave with users
Follow docs/engagement-and-pacing.md: plan up
front, announce time estimates before starting long work, background blocking
tasks and stay interactive while they run (start the long download first, then
interview during it), fill wall-clock with useful analysis (alternative-model
cost estimates, benchmark lookups), and keep telling the user where they are in
the loop.
Working on this repo
This repository is public and MIT licensed. Treat every file as future-facing OSS from the first commit.
Boundary
- Local-first discovery is available, but hosted execution is a normal product path. A direct request to test hosted training, or the user's activation of a bounded upload-and-train control, authorizes the provider calls, uploads, temporary resources, evaluation, and cleanup named by that run. Proceed without asking again between its internal phases; ask only before expanding its data, spend, destination, or production-impact envelope.
- No customer data, private traces, secrets, private repo names, or internal incident notes.
- Do not put customer or partner names, aliases, workload identifiers, metrics, or derived artifacts in tracked paths or content, branch or commit names, pull request metadata, or review comments. Use clearly synthetic placeholders.
- Before a public release, an authorized maintainer must provide the private,
newline-delimited
UNDERSTUDY_PUBLIC_SAFETY_PRIVATE_TERMSvalue while runningnpm run skills:validate -- --releaseandnpm run package:smoke -- --release. A term may be followed on the same line by tab-separated exact safe enclosing tokens. Untrusted pull-request jobs use synthetic matcher tests and do not receive this private value. - Examples must use synthetic data or small public fixtures.
- The desktop connects to the production remote-training control plane
(
train.understudylabs.com) as its default. This is no longer experimental: the connection surface has a completed security and production-readiness review indocs/reviews/train-api-desktop-connection.md. Do not widen what leaves the machine, the auth model, or the spend caps described there without updating that review.
Read these before extraction, release, or public docs work:
docs/privacy-and-data-boundaries.mddocs/reviews/train-api-desktop-connection.mddocs/security.mddocs/telemetry.mddocs/oss-release-boundary.mddocs/release-checklist.md
Architecture
Keep one layer per spine:
- CLI:
src/for thin durable shortcuts, auth, artifact checks, and runtime wrappers - scripts:
scripts/for repo hygiene only, not product CLI code - skills:
skills/ - docs:
docs/
The CLI should stay thin. Skills explain the capability; the CLI only makes durable product shortcuts reliable enough for an agent to monitor.
TypeScript + uv Python Bridge
This repo is skills-first and TypeScript-backed. Port product behavior from
understudy-agent into TypeScript only when it affects auth, command routing,
durable execution, artifact checks, or public safety boundaries. Put workflow
judgment and implementation guidance in skills and docs.
Python is allowed only as isolated runtime glue for Python-native workload logic such as GEPA, DSPy, eval harnesses, rubric helpers, dataset transforms, or future training/export adapters. Use the bridge pattern:
- TypeScript owns the command, flags, validation, approval gates, and artifact paths.
- TypeScript invokes Python with
uv run --no-projector an ignored local.understudy/runtime. - Python receives file paths or JSON, returns structured JSON on stdout, and never becomes an importable package in this repo.
- Do not add
pyproject.toml,uv.lock,src/understudy_agent_tools/, or checked-in.pyproduct modules without a deliberate architecture change.
Skills
The public entrypoint is skills/understudy/SKILL.md.
Use progressive disclosure: start with the fat skill, then route to the
specialist playbook for the current intent. Keep specialist skills short and
move deeper command notes into reference.md.
Catalog growth rule
New findings default to a reference.md inside the skill that owns the user
intent. A new top-level skill requires a user utterance no existing skill
claims, and the PR must name which existing skills it was checked against.
Frontmatter descriptions are user-intent triggers (≤60 words, quoted user
phrases, no unglossed internal jargon), not pipeline-position statements.
Extraction Discipline
When importing code from private Understudy repos:
- Remove private data and internal-only assumptions.
- Replace customer examples with synthetic fixtures.
- Add a smoke test or dry-run command.
- Keep the commit scoped to one spine.
Before opening a PR that changes skills, docs, scripts, or package metadata, run:
npm run check
git diff --check
Before broad CLI or adapter PRs, also check file size and diff shape:
git diff --stat
wc -l src/**/*.ts tests/*.mjs