A starting point for working with AI coding agents. Rules, agents, skills — ready to use, easy to change.
What is this?
Claude Code reads agents, rules, and skills from a .claude/ directory — either ~/.claude/ (global) or {project}/.claude/ (project-local). The full spec is at code.claude.com/docs/en/claude-directory. The AI Toolkit is a curated set of those files, maintained by the engineering team, plus a CLI that copies the right ones into place.
The profile system controls what loads. Pick a profile for the task at hand — data work, security review, product engineering — and the CLI deploys the matching rules to your ~/.claude/ directory. Agents and skills deploy to every profile; only the knowledge set changes. Switch profiles when the task changes.
It is also a shared space. Check in your team’s conventions as rules, add agent specialisations, contribute workflow skills. The toolkit is as useful as what the team puts into it.
| What it does | What it doesn’t do |
|---|---|
Deploys agents, rules, and skills to .claude/ | Change how Claude Code itself works |
| Lets you switch knowledge sets per task type | Guarantee agent output quality — that depends on your prompts and rules |
| Gives the team a shared place to evolve conventions | Replace your judgement on what to build or review |
The mechanism is simple: it copies files. The value is in which files — and the team’s discipline to keep them current.
Get started
Quick Start
Up and running in three commands
Contributing
Add your team's rules and skills
Talk to Your Team
Just say what you need
Meet the Agents
36 specialists, ready when you are
Learn the Phases
Explore, Plan, Build, Validate
Browse workflows
Pre-built sequences of skills and agents, auto-discovered from workflows/ directories.
Workflows
See all available workflows
🤔 Take a moment: What task do you currently do alone that a team of specialists would do better?
bolt Quick Start
Install the CLI, then run setup to pick your team and role. You can change what's installed at any time with toolkit commands — no need to re-run setup.
1 — Install the CLI
Requires uv:
brew install uv
git clone https://github.com/toknapp/ai-toolkit.git
cd ai-toolkit
uv tool install .
This binds the toolkit binary to this repository path. Once installed, run toolkit from anywhere — it always reads agents, rules, skills, and profiles from the cloned repo location.
2 — Run setup
Pick your team, role, and any workflows you want. Takes about a minute:
toolkit setup
The wizard asks which team you're on, what your role is, and which workflows to add. It then deploys everything to ~/.claude/. Start a new Claude Code session to pick up the changes.
3 — Add or remove things later
You don't need to re-run setup. Use toolkit directly:
toolkit agent add <name> # add an agent
toolkit rule add <name> # add a rule
toolkit skill install <name> # install a skill
toolkit workflow install <name> # install a workflow
Use toolkit agent list, toolkit skill list, toolkit rule list, or toolkit workflow list to browse what's available. If you're stuck: toolkit --help or the docs.
Something not working?
Agents not responding in Claude Code
Run toolkit verify to check deployed state. If agents are missing, run toolkit profile reload to re-sync. Check the docs or run toolkit --help for more options.
toolkit: command not found
Run uv tool install . from the ai-toolkit/ directory. If uv is not on your PATH, add $HOME/.local/bin to your PATH.
Next steps
Talk to Your Team
Learn natural language interactions
Browse Profiles
Switch knowledge for different tasks
Meet the Agents
See who's on the team
group_add Contributing
Your team has its own namespace. Add your domain rules, skills, and agents freely — no cross-team approval needed. PRs touching only your namespace need only your team's review. Your team also owns its profile file at profiles/<team>.yaml — add profiles there without cross-team approval. See CONTRIBUTING.md for the full guide.
Deploy your first rule in under 5 minutes
- Create a file under
teams/<your-team>/ - Add frontmatter and content
- Register it in
profiles/ - Run
toolkit validate
No gatekeeping. Your namespace, your rules.
Team Namespaces
Each team owns teams/<your-team>/ across rules, skills, and agents. PRs touching only your namespace need only your team's review. CODEOWNERS enforces this automatically.
What You Can Add
| Content type | Team-specific (in your namespace) | Cross-team shared |
|---|---|---|
| Rules | rules/teams/<team>/my-rule.md | rules/general/my-rule.md |
| Skills | skills/teams/<team>/my-skill/SKILL.md | skills/general/my-skill/SKILL.md |
| Agents | agents/teams/<team>/my-agent.md | agents/general/my-agent.md |
| Workflows | */workflows/<workflow-name>/ — auto-discovered from any resource type | |
Five Steps to Your First Contribution
- Your namespace is
teams/<your-team>/(check the directory or CODEOWNERS) - Create a file:
src/upvest-agency/rules/teams/<your-team>/my-pattern.md(or a skill/agent) - Add frontmatter and content — see templates in CONTRIBUTING.md
- Register it in
profiles/, then runtoolkit validate && toolkit profile reload - Open a PR — your team reviews and merges. No other team involved.
Autonomy: Each team controls their domain. No cross-team approval gates. Move at your team's pace.
forum Talk to Your Team
Once deployed, the toolkit lives inside your coding session. No special syntax needed — talk naturally and agents respond based on the rules and skills loaded in your profile.
Starting work
| You say | What happens |
|---|---|
"learn about this repo" | Knowledge Manager scans the codebase and returns a structured summary of architecture, conventions, and entry points |
"what does the checkout flow do?" | Agent traces the code path and explains the logic, referencing specific files |
"plan the user notifications feature" | Planner breaks it into tasks with dependencies, ready for execution |
Building
| You say | What happens |
|---|---|
"add a retry mechanism to the webhook sender" | Agent writes the implementation following your team's conventions (loaded via rules) |
"write tests for the payment service" | Agent generates tests using your project's testing patterns and frameworks |
"refactor this into smaller functions" | Agent restructures the code while preserving behaviour |
Reviewing and shipping
| You say | What happens |
|---|---|
"review my changes" | Judge checks correctness, safety, and completeness against your team's standards |
"draft a PR" | Technical Writer generates a PR description from your branch diff |
"is this ready to merge?" | Judge validates tests pass, no TODOs remain, and conventions are followed |
Managing knowledge
| You say | What happens |
|---|---|
"teach the team about our error handling pattern" | Knowledge Manager distills your description into a rule and deploys it to profiles |
"switch to the security profile" | Swaps the active rule set — now agents apply security and compliance conventions |
"recruit an agent for frontend work" | Knowledge Manager finds and installs a specialist from the Agency catalog |
Slash commands
For structured workflows, slash commands give you precise control:
| Command | What it does |
|---|---|
/write-plan | Generate a formal implementation plan |
/judge | Code review with structured findings |
/judge-audit | Deep adversarial audit of any output |
/rune | Dispatch agents in parallel waves |
/km-learn | Research a repo, feature, or domain |
/tw-draft-pr | Draft a PR description |
Natural language and slash commands are interchangeable. Use whichever feels right for the moment. The agents respond to both.
Next steps
Knowledge Pipeline
Teach agents your team’s conventions
Profiles
Switch knowledge for different tasks
Meet the Agents
See who’s on the team
hub The Four-Phase Model
Four phases that take a loose request and deliver verified, shippable output.
One generalist agent doing everything is like one developer who's also the database engineer, security auditor, frontend dev, and infra architect. The work happens — but not as well as a specialist would do it, and definitely not in parallel.
Knowledgeable agents are specialists. Each one arrives with relevant rules already loaded. A Go developer agent knows your module layout. A security agent knows your compliance requirements. The rules carry the expertise — not the conversation history.
Every meaningful task follows the same lifecycle:
Phase 1: EXPLORE → Phase 2: PLAN → Phase 3: BUILD → Phase 4: VALIDATE
(understand) (decompose) (implement) (verify + ship)
Phase 1: Explore
Before we do anything, we understand the problem. We dispatch read-only agents in parallel to gather context from different angles. They research, analyse, and return summaries — they never write code.
════════════════════════════════════════════
DAG DISPATCH PLAN
Tasks: 5 | Waves: 2 | Type: research
════════════════════════════════════════════
Wave 0 --- 4 parallel -----------------------
🔧 t1 developer Read existing API structure
🔍 t2 researcher Check upstream data sources
🛡 t3 security Assess compliance requirements
🧪 t4 tester Review current test coverage
Wave 1 -----------------------------------------
⚖️ t5 judge Synthesize all findings
↳ depends on: t1, t2, t3, t4
════════════════════════════════════════════
Why this works: Four agents read four different parts of the codebase at the same time. Each returns a 2–3 sentence summary. The Judge in wave 1 merges them into one clear picture. Total wall time: roughly 2 minutes. Doing it one by one: roughly 8.
Key principle: Subagents are context collectors, not implementers. They read and report. The main conversation (or the Planner) takes their findings and builds the plan.
Phase 2: Plan
The Planner takes those findings and produces a structured plan. This is where the DAG (Directed Acyclic Graph) comes in. A good plan spells out what needs to happen, who owns each task, what depends on what, and what can run in parallel.
tasks:
- id: t1
agent: developer
title: Implement API endpoint
depends_on: []
files: [src/api/]
output: Working endpoint with validation
- id: t2
agent: developer
title: Implement data layer
depends_on: []
files: [src/db/]
output: Database queries and migrations
- id: t3
agent: developer
title: Wire API to data layer
depends_on: [t1, t2]
files: [src/api/, src/db/]
output: Integrated endpoint with persistence
- id: t4
agent: reviewer
title: Review implementation
depends_on: [t3]
files: [src/]
output: Review feedback
Critical path: t1 → t3 → t4 (3 of 4 tasks = 75%)
Benefit: 4/3 = 1.33x
Tasks t1 and t2 don't depend on each other — different files, different concerns. They run at the same time in wave 0. Task t3 needs both to finish first. Task t4 reviews everything at the end.
Phase 3: Build
The DAG dispatcher picks up the plan and runs it wave by wave:
- Wave 0: Launch independent tasks in parallel
- Collect results: Each agent hands back a summary of what it built
- Inject context: Condense wave 0 results into wave 1 prompts (2–3 sentences per predecessor — never dump raw output)
- Wave 1: Launch dependent tasks with context from their predecessors
- Repeat until every wave completes
- Report: Surface token usage, cost, and time saved
Passing context between waves
Wave 0 finishes. Each agent returns a short summary. The dispatcher condenses these into the next wave’s prompt:
Predecessor results:
- t1 created POST /v1/retirement in internal/handler/retirement.go.
Accepts JSON, returns 200. Route registered in server/routes.go.
- t2 created compute_l19() in src/calc/l19_retirement.py.
Function signature: compute_l19(personal, financial, scenario_params).
Your task: Wire the endpoint to the calculation backend.
Task t3 gets exactly what it needs — the endpoint shape from t1 and the function signature from t2 — without wading through the hundreds of lines of code they wrote. That's context injection, not context dumping.
When something goes wrong
If a task fails, every task that depends on it is automatically blocked. The dispatcher reports the failure and gives you three options: retry, skip and carry on with unblocked tasks, or stop entirely. You decide — agents never silently swallow failures.
Phase 4: Validate
Build produces output. Validate makes sure it's correct, safe, complete, and ready to ship. This isn't a final wave bolted onto Build — it's a deliberate quality gate with its own agents and criteria.
Validate agents work independently from Build. They receive the finished output and review it without the bias of having written it.
| Agent | What they look at |
|---|---|
| code-reviewer | Correctness, test coverage, PII exposure |
| security-engineer | Compliance, threat model, DORA requirements |
| performance-engineer | SLA budgets, latency impact |
| Judge | Brings findings together, then gates or approves shipping |
If Validate finds critical issues, it routes them back to the relevant Build agent for a fix — not to you first. Only genuinely unresolvable blockers escalate to a human.
In regulated environments, this maps neatly to your deployment review gate. The Judge brings findings together the same way a four-eye review aggregates feedback before a release.
When to keep it simple
| Situation | What to do instead |
|---|---|
| Single-file bug fix | One agent, main conversation |
| Quick config change | No planning needed |
| Question about the codebase | Direct search or an Explore agent |
| Task fully within one agent’s domain | No handoff needed |
Rule of thumb: If the task touches one file in one domain, just do it. If it spans multiple files across multiple domains, plan and dispatch.
Next steps
Knowledge Pipeline
How knowledge flows into your agents
Profiles
Swap knowledge sets for different work
DAG Dispatch
Context compression and parallel execution
🤔 Think about it: where in your current workflow are you doing things one by one that could safely run at the same time?
move_to_inbox Knowledge Pipeline
Teach your agents your team's rules and standards. Once loaded, every agent knows them.
AI agents start each session knowing nothing about your project. Without structured knowledge, every conversation begins from scratch. The Knowledge Pipeline changes that.
Three tools, one goal
| Tool | What it does | Command |
|---|---|---|
| Rules | Structured knowledge files your agents follow | Files in src/upvest-agency/rules/ |
| Profiles | Control which rules load per session | toolkit profile use <name> |
| Knowledge Manager | Feeds, shapes, and grows the rule base | "hey knowledge manager" |
How it works
| Step | What happens | Who |
|---|---|---|
| 1. Ingest | Raw material lands in src/upvest-agency/knowledge/ | You |
| 2. Distill | Structured rules created in src/upvest-agency/rules/ | Knowledge Manager |
| 3. Wire | Rules added to profiles in profiles/ | Knowledge Manager |
| 4. Deploy | Profile redeployed with toolkit profile reload | You |
| 5. Grow | Audits surface gaps, triggering fresh ingestion | Knowledge Manager |
src/upvest-agency/knowledge/ is our staging area. Drop raw material in — PDFs, research summaries, extracted docs. The Knowledge Manager distils it into structured rules in src/upvest-agency/rules/. Always go through the inbox; never write directly to rules.
What makes a good rule
| Criterion | Test |
|---|---|
| Actionable | Tells agents what to do, not just what to know |
| Structured | Tables, checklists, and code blocks over prose |
| Sourced | Claims tied to a specific source |
| Scoped | One coherent topic, not sprawling |
| Current | Version numbers, APIs, and pricing are accurate |
A rule that says “BigQuery supports partitioning” is knowledge. A rule that says “Always partition tables by date. Set require_partition_filter = true” is actionable knowledge. The second one actually changes how agents behave.
Context budget
Every token loaded into an agent’s context takes space away from reasoning. We treat context like a budget:
toolkit profile budget
Aim to keep rules under 25% of the context window — that leaves 75%+ free for real work.
Next steps
Profiles
How rules reach your agents
Rules Catalog
Browse all 47 rules
Token Economics
Why lean profiles matter
🤔 Think about it: what does a new team member need to know in their first week that an agent currently doesn't?
swap_horiz Profiles
Swap rules on the fly based on what you're working on. Focused context instead of loading everything.
Why profiles exist
Loading every rule into every session wastes context tokens and dilutes focus. A developer writing Go doesn't need GDPR compliance rules. A security reviewer doesn't need CSS conventions. Profiles solve this — swap the entire knowledge set with one command and keep context clean.
Think of it as role-based context. A platform engineer, a data analyst, and a security auditor all use the same agents and skills — but each loads only the rules relevant to their domain. Every token in context earns its place.
How profiles are organized
Profiles live in the profiles/ directory, one file per team plus a shared shared.yaml:
| Section | Naming | Example |
|---|---|---|
profiles/<team>.yaml | <team>/<profile> | payments/product-engineer, data-platform/analyst |
profiles/shared.yaml | shared/<profile> | shared/platform-engineer, shared/default |
Team profiles are owned by the team and carry domain-specific rules and skills. Shared profiles are not owned by any specific team and provide a general-purpose context. Personal profiles live in .local-profile.yaml (gitignored).
How to switch profiles
A profile controls which rules load into context. All agents and skills deploy to every profile — only the knowledge set changes.
Terminal
toolkit profile use my-profile # deploy
toolkit profile budget # measure footprint
toolkit profile list # see all options
toolkit profile show my-profile # preview contents
Raycast — prefer a visual interface? The Raycast plugin lets you browse and switch profiles without opening a terminal. From the repo root:
cd ai-toolkit && npm --prefix tools/raycast-plugin ci && npm --prefix tools/raycast-plugin run dev
Open Raycast, search Switch Profile, and pick from the list.
Design principles
| Principle | Why |
|---|---|
| Lean over complete | Every token in context displaces reasoning space. Only include what the session actually needs. |
| One per task type | A data profile, a platform profile, a security profile. Each tuned to its domain. |
| Core is always loaded | Git, collaboration, and planning rules deploy to every profile. These are universal. |
| Personal variants | Customising a shared profile creates a personal variant. Shared profiles are never overwritten. |
Profile examples
| Profile | Section | Who uses it | Rules loaded |
|---|---|---|---|
shared/default | shared | Full engineering | Core + engineering + infra + data |
shared/platform-engineer | shared | Infra & DevOps | Core + infra + terraform + DORA |
data-platform/engineer | teams | Data platform team | Core + data (SQL, dbt, Kafka, pipelines) |
payments/product-engineer | teams | Payments team | Core + Go + gRPC + Kafka + domain patterns |
The economics of specialisation
If a profile loads 80K tokens before you even ask a question, 40% of the agent's working memory is already gone. A focused profile that loads 25K tokens leaves 87% free for real work.
| Profile | Token Load | % of 200K Window | Remaining for Work |
|---|---|---|---|
| Full (everything) | ~80K | 40% | 120K |
| Default | ~45K | 22% | 155K |
| Focused domain | ~25K | 12% | 175K |
This is why profiles exist. Not for tidiness — for cognitive headroom.
Next steps
Knowledge Pipeline
How we create rules
Token Economics
Deep dive into cost and context
Rules Catalog
Browse all 47 rules
🤔 Think about it: what kind of work are you doing right now? Load only the rules that belong to it.
tune Configure & Apply Profiles
Edit files in profiles/, deploy with one command. Agents and skills are always available — only the rules change.
Profile anatomy
Profiles are organized as separate files in the profiles/ directory:
# profiles/payments.yaml — team file (accessed as payments/product-engineer)
product-engineer:
description: "Go microservices, Kafka, gRPC"
agents:
core:
- general/knowledge-manager
- general/planner
engineering:
- in-training/go-developer
rules:
eng:
- go/go-versioning
- go/go-eventing
skills:
- go/test-driven-development
# profiles/shared.yaml — shared profiles (accessed as shared/platform-engineer)
platform-engineer:
description: "Infra and DevOps engineering"
agents:
core:
- general/knowledge-manager
- general/planner
rules:
infra:
- infra/gcloud-cli
- infra/terraform-conventions
Personal profiles go in .local-profile.yaml (gitignored). Use toolkit profile use <name> with the flattened name (e.g. payments/product-engineer).
Switching profiles
toolkit profile use <name> # switch to a different profile
toolkit profile list # see all available profiles
Creating a profile
- Add your profile to the appropriate file in
profiles/(shared) or.local-profile.yaml(personal, gitignored) - Run
toolkit validateto check for schema errors - Run
toolkit profile use <name>to deploy
Personal variants
Customising a shared profile creates a {name} (custom) personal variant in .local-profile.yaml. This file is gitignored by default, so personal tweaks never pollute the shared repo. The shared profile in profiles/ is never overwritten. To share your customisation, move it to the appropriate file in profiles/ and open a PR.
Run toolkit profile list for the full list including personal variants.
account_tree DAG Dispatch
Run independent tasks at the same time. Pass results between them. Save time and tokens.
Define tasks with dependencies. /rune computes waves via topological sort and dispatches each wave in parallel. Independent tasks run at the same time. Dependent tasks wait their turn.
───────────────────────────────────────────
DAG DISPATCH PLAN
Tasks: 7 | Waves: 3 | Benefit: 1.8x
───────────────────────────────────────────
Wave 0 --- 4 parallel -----------------------
🏗 t1 architect Design API contract
🎨 t2 designer Design UI components
🔧 t3 developer Set up database schema
✍ t4 writer Draft documentation
Wave 1 --- 2 parallel -----------------------
🔧 t5 developer Implement API and UI
↳ depends on: t1, t2, t3
🧪 t6 tester Write tests
↳ depends on: t1, t3
Wave 2 -----------------------------------------
🔍 t7 reviewer Final review
↳ depends on: t4, t5, t6
───────────────────────────────────────────
The context squeeze
The real efficiency gain here is context compression — a property of any subagent architecture, not just DAG dispatch. Each subagent starts with a fresh context window, does its work internally (reading files, parsing logs, running queries), and returns only a distilled summary. The heavy context disappears when the subagent finishes. Only the summary survives. This is also why we avoid mixing unrelated tasks in the same context window — see Context Hygiene for practical guidelines.
DAG dispatch amplifies this by running multiple subagents in parallel, so you get both compression and wall-time savings together.
Subagent internally: ~200K tokens (file reads, log parsing, dead ends)
→ Returns to parent: ~400 tokens.
Parent never sees the raw material. It sees only the distilled summary.
| Subagents Dispatched | Total Work Done | Main Context Growth | Budget Used (200K window) |
|---|---|---|---|
| 1 | ~200K tokens | ~400 tokens | 0.2% |
| 5 | ~1M tokens | ~2,000 tokens | 1.0% |
| 10 | ~2M tokens | ~4,000 tokens | 2.0% |
| 20 | ~4M tokens | ~8,000 tokens | 4.0% |
Context squeeze in practice
Here's what happens when you compare a monolith agent (one context window doing everything in sequence) with DAG dispatch (subagents with fresh contexts, only summaries returned). The longer the task list, the bigger the gap.
We're assuming each task processes roughly 200K tokens internally, each summary is roughly 400 tokens, and the monolith accumulates full context from every task. DAG dispatch accumulates only summaries, with an average parallelism factor of 2.5x (tasks per wave).
| Tasks | Monolith Context | DAG Parent Context | Compression | Wall Time Savings |
|---|---|---|---|---|
| 5 | 1M tokens | 2,000 tokens | 500x | ~60% |
| 10 | 2M tokens | 4,000 tokens | 500x | ~60% |
| 15 | 3M tokens | 6,000 tokens | 500x | ~60% |
| 25 | 5M tokens | 10,000 tokens | 500x | ~60% |
The compression ratio stays constant because each subagent is independent — but the absolute savings scale linearly. A 25-task DAG compresses 5M tokens of work into 10,000 tokens of parent context. That's the difference between a context window that overflows and one that stays fast and focused.
The wall-time savings come from parallelism: with an average of 2.5 tasks per wave, a 25-task DAG finishes in roughly 10 wave-steps instead of 25 sequential ones — about 60% faster.
The compounding effect
Context compression matters more as task counts grow. A 5-task DAG saves roughly 1M tokens of context pollution. A 25-task DAG saves roughly 5M. At 25 tasks, a monolith agent would blow past most context windows entirely — losing coherence, forgetting earlier results, or hallucinating. DAG dispatch keeps the parent context at 10,000 tokens regardless.
The DAG (Directed Acyclic Graph) format
tasks:
- id: t1
agent: architect
title: Design API contract
depends_on: []
files: [docs/api-contract.yaml]
output: API schema with endpoints and error codes
- id: t2
agent: developer
title: Implement API handlers
depends_on: [t1]
files: [src/api/]
output: Working handlers wired to database
| Field | What It Does |
|---|---|
id | Unique identifier — the task’s name in the dependency graph |
agent | Who does the work — must match an agent in your team |
title | What gets done — imperative verb phrase |
depends_on | What must finish first — empty list means no prerequisites |
files | What this task touches — used to detect conflicts between parallel tasks |
output | What this task produces — tells dependent tasks what to expect |
Validation
Six safety checks run before anything dispatches. All six must pass.
| Check | What It Catches |
|---|---|
| Unique IDs | Two tasks with the same id |
| No cycles | t1 depends on t3, which depends on t1 |
| No orphans | A task that nothing can reach |
| No file conflicts | Two parallel tasks writing to the same directory |
| Valid agents | An agent field that does not match any deployed agent |
| Valid references | A depends_on pointing to a task ID that does not exist |
Ad-hoc dispatch
You don't always need a formal plan. Just say /rune with a natural language request and the dispatcher builds a DAG on the fly.
How the DAG runs tasks
A DAG doesn't care what happens inside its tasks — only the order and conditions. The task's agent handles execution. The DAG handles coordination. This separation is what makes it composable: any task can be swapped, retried, or parallelised without redesigning the whole plan.
Trigger rule
Every task uses the implicit rule all_success: a task only runs when all of its upstream dependencies have completed successfully. Failures and skips cascade downstream — if a task is BLOCKED, everything that depends on it is also BLOCKED. This is intentional. A task that needed a result from a failed upstream task should not run with incomplete inputs.
| Upstream state | Downstream task becomes |
|---|---|
| All succeeded | Runs |
| One failed | BLOCKED |
| One skipped | BLOCKED (cascade) |
Common topologies
| Pattern | Shape | When to use |
|---|---|---|
| Fan-out | 1 → [t2, t3, t4] | One task produces work that can be done in parallel |
| Fan-in (join) | [t1, t2, t3] → 1 | Multiple parallel branches converge at a review or merge step |
| Diamond | t1 → [t2, t3] → t4 | Fan-out then fan-in; t4 waits for both branches |
| Pipeline | t1 → t2 → t3 | Strictly sequential; use sequential execution instead of DAG |
Keep the topology stable — the shape of the dependency graph should be predictable before dispatch begins. Use DAG structure for orchestration decisions, not for conditional logic mid-run.
Next steps
Token Economics
Cost tracking and context budgets
Agents
Meet the team that runs the tasks
Four-Phase Model
The full workflow
🤔 Think about it: parallel and sequential cost the same tokens — parallel just burns them faster. Is the speed worth the added coordination?
smart_toy Agents
An agent is a markdown file with YAML frontmatter and a system prompt. At session start, only frontmatter descriptions load — lightweight summaries that tell the orchestrator when to invoke each agent. The full prompt loads on demand.
Agent catalog
General (8)
gdrive-fetcher
Google Drive fetcher. Downloads gdoc / gsheet / gslide bodies via the Drive…
github-fetcher
GitHub fetcher. Implements query(question, scope) over local clones of…
km-question-runner
Run one km-audit-external question file read-only and return findings. Invoked…
knowledge-manager
The sole knowledge switcher and context manager for the toolkit. Owns all…
linear-fetcher
Linear fetcher. Implements query(question, scope) for Linear issues, projects,…
planner
Expert planning specialist for complex features and refactoring. Use…
slite-fetcher
Slite fetcher. Implements query(question, scope) for Slite per the fetcher…
technical-writer
Use this agent when you need to create, improve, or maintain technical…
In Training (19)
business-analyst
Use this agent when translating regulatory requirements into acceptance…
cicd-engineer
Use this agent when designing, optimising, or debugging GitHub Actions CI/CD…
customer-success-engineer
Use this agent when handling B2B customer escalations, writing integration…
delivery-manager
Use this agent when coordinating multi-team releases, tracking dependencies,…
developer-advocate
Use this agent when you need developer experience (DX) analysis, API onboarding…
frontend-developer
Use this agent when building or reviewing static pages, documentation sites,…
go-developer
Expert Go developer specializing in high-performance systems, concurrent…
ops-tooling
Use this agent when building or modifying the internal Upvest Ops Panel —…
performance-engineer
Use this agent when optimizing API performance, conducting load testing,…
platform-engineer
Use this agent when you need to design, deploy, configure, or troubleshoot…
product-engineer
Use this agent when building, modifying, or deploying product microservices on…
product-manager
Use this agent for B2B customer-facing product decisions: synthesising tenant…
product-technical-manager
Use this agent for technical platform product decisions: managing the DATA/ANA…
protocol-engineer
Use this agent when working on Protobuf schemas, gRPC service definitions, API…
security-engineer
Expert application security engineer and fintech regulatory compliance…
software-architect
Use this agent when you need to navigate and search codebases quickly, identify…
ui-designer
Use this agent when designing component libraries, design systems, or…
upfront
Use this agent when building or modifying the Upvest Upfront platform —…
ux-researcher
Use this agent when you need user behavior analysis, usability testing…
Teams/Data Platform (4)
data-analyst
Use when you need to extract insights from business data, write or review dbt…
data-analytics-engineer
Use this agent when building or modifying dbt intermediate and mart models,…
data-engineer
Expert data engineer for Upvest's data platform — Kafka→BigQuery streaming…
data-risk-manager
Use this agent when investigating P&L risk, position exposure, FX risk,…
Workflows/Incident Investigation (1)
Workflows/Shell Configuration (1)
person_add Onboarding an Agent
Add a specialist to your team. Either recruit one from the open-source catalog, or write one yourself.
Every agent is a plain markdown file. The YAML frontmatter tells the AI tool how and when to use the agent. The body is the system prompt — the instructions the agent follows.
Two paths
| Path | When to use it | How to start |
|---|---|---|
| Recruit from catalog | A specialist already exists that fits your need | /km-recruit [description] — pulls from msitarzewski/agency-agents |
| Write from scratch | Your domain is specific and no catalog match exists | Create a .md file and follow the steps below |
Step 1 — Create the file
All new agents go in src/upvest-agency/agents/in-training/. This is a staging area. Agents stay here until you are confident they work well. Use the naming pattern domain-role.md.
src/upvest-agency/agents/in-training/upvest-product-my-specialist.md
Do not place new agents directly in core/, data/, or engineering/. Those are for agents that have been validated in real use.
Step 2 — Write the frontmatter
The frontmatter is the first block in the file, between two --- lines. Every field below controls how the agent appears and behaves.
---
name: upvest-product-my-specialist
description: Use this agent when you need to... Also invoke when
the user says 'hey my-specialist' or any similar phrase.
model: sonnet
tools: Read, Write, Edit, Bash, fd, rg, Glob, Grep, mcp:upvest_mcp_gateway
color: teal
emoji: "🔍"
version: 1.0.0
phase: build
---
All frontmatter fields
| Field | Required | What it does | Allowed values |
|---|---|---|---|
name | Yes | Unique identifier. Used in task plans and dispatch diagrams. | Lowercase, hyphens only. Example: upvest-data-analyst |
description | Yes | Tells the AI when to invoke this agent. Write trigger phrases here. | Plain text. Include “Also invoke when the user says…” examples. |
model | No | Which AI model this agent uses. Match the model to the phase. | haiku (explore/coordinate) · sonnet (build) · opus (plan/validate) |
tools | No | Which tools the agent can use. Restrict to what it actually needs. | Comma-separated: Read, Write, Edit, Bash, fd, rg, Glob, Grep, mcp:upvest_mcp_gateway |
color | No | Card border color in the docs site. | red · orange · yellow · green · teal · cyan · blue · indigo · violet · purple · pink · gray |
emoji | No | Icon shown in dispatch diagrams and the agent card. | Any single emoji. Example: "🔧" |
version | No | Semantic version. Increment when you make significant changes. | Format: 1.0.0 |
phase | No | Which phase of the four-phase model this agent belongs to. Used for grouping in the docs site. | explore · plan · build · validate |
Step 3 — Write the system prompt
The body of the file (everything after the closing ---) is the agent’s system prompt. This is what the agent reads before every task.
A good system prompt has three parts:
- Role statement. One sentence. Who is this agent and what is their specialty?
- Core responsibilities. Three to five bullet points. What does this agent do?
- Collaboration. Which agents does it hand off to? Which agents hand off to it?
---
(frontmatter here)
---
> Agent collaboration: see `rules/core-agent-collaboration.md`
# My Specialist
You are a specialist in [domain]. Your job is to [one sentence purpose].
## Core responsibilities
- [What you do — be specific]
- [What you do — be specific]
- [What you do — be specific]
## Collaboration
- Route to `core-judge` when your output needs validation
- Receive from `core-planner` when tasks are assigned to you
Step 4 — Register in a profile
An agent file alone does nothing. You must add it to a profile so it deploys to your AI tool.
Open profiles/. Find the profile you want to add the agent to. Add the agent name under an agent group.
my-profile:
agents:
specialist:
- upvest-product-my-specialist # add this line
Step 5 — Validate and deploy
toolkit validate # check frontmatter against the schema
toolkit profile reload # deploy to your AI tool
If validation fails, the error message tells you which field is wrong and what values are allowed. Fix it and run again.
Step 6 — Test the agent
Open your AI coding tool in any project. Type a trigger phrase from the agent’s description field. If the agent responds, it is working.
To see all deployed agents: toolkit verify
Step 7 — Promote out of in-training
When you are confident the agent works well in real tasks, move it from src/upvest-agency/agents/in-training/ to the appropriate domain folder:
| Folder | Who goes here |
|---|---|
src/upvest-agency/agents/general/ | Orchestration agents. Planner, Judge, Technical Writer, Knowledge Manager only. |
src/upvest-agency/agents/data/ | Data platform specialists — dbt, Kafka, BigQuery, analytics. |
src/upvest-agency/agents/engineering/ | Software engineering specialists — Go, Python, platform, security. |
src/upvest-agency/agents/in-training/ | All new agents start here. Move them when they are ready. |
Promotion is a deliberate choice. It signals that the agent has been validated in real use and is ready for others on the team to rely on.
🤔 Take a moment: What does your team repeat every sprint that an agent with the right rules could do instead?
terminal Skills
Skills are slash commands that trigger structured workflows. They load on demand — zero tokens until invoked.
Skill catalog
General (14)
/km-audit-externalkm-audit-external
External knowledge-base audit. Queries Slite, GitHub, and Linear live,…
/km-audit-internalkm-audit-internal
Internal knowledge-base audit: documentation hygiene, rule quality, staleness,…
/km-learnkm-learn
Learn about a repository, feature, ticket, or problem domain. Researches…
/km-recruitkm-recruit
Recruit a new agent from the Agency catalog (msitarzewski/agency-agents).…
/load-test-scenarioload-test-scenario
Scaffold, author, and run a k6 load-test scenario in toknapp/load-testing. Use…
/pr-readypr-ready
Pre-PR checklist validation — runs linters, checks PII exposure, validates DORA…
/tc-featurestc-features
Work with Test Center (TC) features — fetching from the TC API, migrating from…
/tw-draft-prtw-draft-pr
Draft a pull request description for completed work. Communicates the what and…
/tw-releasetw-release
Prepare a release — validate state, generate release notes, update CHANGELOG,…
/using-git-worktreesusing-git-worktrees
Safely sets up isolated git worktrees for parallel feature development. Handles…
/write-adrwrite-adr
Guide a user through writing an Architectural Decision Record (ADR) in MADR 4.0…
/write-planwrite-plan
Generate a strict, atomic, step-by-step implementation plan from a design…
/write-product-specwrite-product-spec
Write or improve a product specification. Guides the author through problem…
/write-rfcwrite-rfc
Write or improve an RFC. Guides the author through the Birdie 7-section…
Go (2)
Regulatory (1)
Teams/Corporate Actions (2)
Teams/Data Platform (2)
Teams/Payments (5)
/payments-address-local-commentspayments-address-local-comments
Systematically addresses review comments provided directly via the CLI —…
/payments-address-pr-commentspayments-address-pr-comments
Systematically addresses every open review comment on a GitHub pull request —…
/payments-create-prpayments-create-pr
Use this skill whenever the user says "create a PR", "open a pull request",…
/payments-fix-cipayments-fix-ci
Fetches failed GitHub Actions runs for the current PR, reads the error logs,…
/payments-fix-code-qualitypayments-fix-code-quality
Fix code quality issues for payments/AML changes: discover make targets (Phase…
Teams/Security (1)
Workflows/Incident Investigation (4)
/datadog-dashboarddatadog-dashboard
Use when creating or modifying Datadog dashboard JSON files that can be…
/datadog-explorerdatadog-explorer
Use when querying Datadog for logs, metrics, traces, spans, incidents,…
/investigateinvestigate
Structured incident investigation using Datadog logs/metrics and Linear…
/postmortem-reviewerpostmortem-reviewer
Review incident post-mortems and assess their quality. Use this skill whenever…
Workflows/Onboard Topic (1)
Workflows/Pipeline (1)
Workflows/Platform Self Service (4)
/k8s-resource-sizingk8s-resource-sizing
Use when an Upvest engineer needs to set or update `resources.requests` /…
/new-platform-accessnew-platform-access
Enable GCP APIs or grant IAM roles for any business unit in platform-bootstrap,…
/new-service-infrastructurenew-service-infrastructure
Use when rolling out infrastructure for an Upvest backend service (typically…
/new-service-scaffoldnew-service-scaffold
Use when bootstrapping a new Upvest backend service from a template. Copies or…
Workflows/Sales (1)
Workflows/Security Remediation (3)
/security-sweepsecurity-sweep
Vulnerability + upgrade sweep for any Upvest repo. Asks which repo, which…
/wiz-external-image-exceptionwiz-external-image-exception
Request a bulk Wiz Ignore Rule for an externally-sourced (third-party)…
/wiz-vuln-reportwiz-vuln-report
List all actionable Critical and High Wiz vulnerabilities (with a fix…
Workflows/Spec Driven Development (1)
Workflows/Superpowers (11)
/brainstormingbrainstorming
You MUST use this before any creative work - creating features, building…
/codebase-onboardingcodebase-onboarding
Use when analyzing repository architecture, explaining domain entities, or…
/dispatching-parallel-agentsdispatching-parallel-agents
Use when facing 2+ independent tasks that can be worked on without shared state…
executing-plans
/finishing-development-branchfinishing-development-branch
Use when implementation is complete, all tests pass, and you need to decide how…
/receiving-code-reviewreceiving-code-review
Use when receiving code review feedback, before implementing suggestions,…
/requesting-code-reviewrequesting-code-review
Use when completing tasks, implementing major features, or before merging to…
/subagent-driven-developmentsubagent-driven-development
Use when executing implementation plans with independent tasks in the current…
/verification-before-completionverification-before-completion
Use when about to claim work is complete, fixed, or passing, before committing…
/writing-clearly-and-conciselywriting-clearly-and-concisely
A strict style guide for technical documentation. Enforces brevity, active…
/writing-planswriting-plans
Generates a strict, atomic, step-by-step TDD implementation plan based on a…
Workflows/Validation (3)
/judgejudge
Code review — send completed work for review, or handle incoming review…
/judge-auditjudge-audit
Deep adversarial audit of any agent's output. Scrutinizes correctness,…
/judge-paneljudge-panel
Summon a panel of N judges for multi-perspective review. Each judge evaluates…
menu_book Rules Catalog
47 rules across 12 categories.
Docs (4)
architectural-decision-records
Canonical ADR reference: MADR 4.0 template, readiness (START/ADMM),…
design-practice-repository
Reference for Planner and Technical Writer when making, capturing, or…
documentation-standards
Shared documentation patterns, templates, and quality standards for all Upvest…
rfc-writing-guide
Use when the Technical Writer or Planner is asked to write, review, or advise…
General (3)
agent-collaboration
Org-wide agent governance: ownership boundaries, escalation paths, HITL gates,…
design-patterns
Pattern selection guidance for all Upvest engineering agents.
git-conventions
Cross-cutting git hygiene and repository access protocols for anyone operating…
Go (4)
go-eventing
How Go services produce and consume Kafka events in the Upvest platform.
go-grpc
Server setup, client setup, s2s auth (two-layer: Linkerd mTLS + JWT scopes),…
go-metrics
Custom business metrics for Upvest Go services via the platform metrics wrapper…
go-versioning
Upvest must comply with the [Vulnerability and Patch Management…
Infra (6)
confluent-cli
Safe Confluent Cloud CLI operations for Upvest agents.
gcloud-cli
Safe gcloud operations for Upvest agents.
makefile-conventions
Upvest repositories use Makefiles as the standard task runner.
operational-constraints
Standard operational rules for all Upvest agents.
sds-deploy
SDS is Upvest's primary self-service deploy tool for product engineers. It…
terraform-conventions
Upvest uses Terragrunt to orchestrate Terraform modules for GCP infrastructure.
Knowledge (2)
Planning (2)
Python (7)
asyncio-conventions
asyncio for I/O-bound concurrent workloads. Not for CPU-bound tasks (use…
cli-development
Typer, Click, and Rich patterns for Python CLI apps at Upvest.
prompt-engineering
Reusable prompt engineering patterns for all Upvest agents.
pytest-conventions
pytest is the only test framework for Python at Upvest. Use it for all unit,…
python-patterns
Apply when choosing between implementation approaches: classes vs. functions,…
sphinx-documentation
Sphinx for all Python project documentation: HTML, PDF, cross-references, API…
uv-conventions
uv is the only Python package manager at Upvest. Never use pip, Poetry, or…
Regulatory (2)
Teams/Data Platform (9)
bigquery-sql-patterns
SQL formatting, BigQuery query patterns, query best practices, and performance…
dbt-model-conventions
dbt model conventions for Upvest's data platform: incremental strategies,…
dlt-conventions
dlt is Upvest's standard library for building declarative ELT pipelines in…
fred-ingestion
API patterns, Python clients, and gotchas for Federal Reserve Economic Data…
kafka-patterns
Upvest-specific Kafka patterns for Confluent Cloud.
makefile-conventions
Upvest repositories use Makefiles as the standard task runner.
mlops
Production ML system patterns for Upvest's data platform.
pandas-conventions
Prefer Polars for all new work. Use pandas only when a dependency requires it.
polars-conventions
Polars instead of pandas for all new Python data work. Faster, stricter, Arrow…
Teams/Payments (3)
Toolkit (2)
Workflows/Pipeline (3)
agent-dispatch
Pipeline-specific dispatch mechanics: routing rules, subagent patterns, context…
dag-execution-format
Canonical format for dependency-annotated plans that enable parallel agent…
pipeline-workflows
Reusable workflow templates for common Upvest multi-agent tasks.
payments Token Economics
Every token costs money. Every rule consumes context. Lean profiles aren’t just tidy — they’re a smart cost strategy.
The cost of context
LLM pricing is per-token. Every rule loaded into an agent’s context gets charged on input, every single time that agent processes a prompt. Here’s what that means in practice:
- A 5K-token rule costs ~$0.075 per agent invocation (at Sonnet rates)
- Invoke that agent 10 times in a session and the rule costs ~$0.75
- If the rule is irrelevant to the task, that $0.75 bought you nothing
Now multiply across a team: 20 rules averaging 3K tokens each = 60K tokens of context overhead. At Sonnet’s $3/M input rate, that’s $0.18 per invocation — before the agent has done any actual work.
Cost model
LLM providers charge differently for input tokens (your prompt, rules, context) and output tokens (the agent’s response). Output tokens cost significantly more because they require generation, not just reading.
| Model | Input (per 1M tokens) | Output (per 1M tokens) |
|---|---|---|
| Opus | $15.00 | $75.00 |
| Sonnet | $3.00 | $15.00 |
| Haiku | $0.25 | $1.25 |
Since the Agent tool returns total_tokens (not split), we estimate cost using an 80/20 input/output split — typical for agent sessions where context loading dominates. Costs appear as “Est. cost” — directional, not exact. Check current pricing for exact rates.
Why input tokens dominate
In a typical agent invocation, 80% of tokens are input: the system prompt, loaded rules, file contents, and conversation history. Only 20% is the agent’s generated response. Here’s why that matters:
- Rules loaded at session start get re-sent on every turn. A 5K-token rule gets charged as input repeatedly.
- Lean profiles directly cut input token cost on every invocation.
- Subagent dispatch resets context — each subagent only pays input cost for its own prompt, not the parent’s full history.
Choosing the right model per agent
This is your single highest-leverage cost decision. The principle is straightforward: invest reasoning depth where it has the greatest leverage, and use cheaper models everywhere else.
The reasoning pyramid
┌─────────┐
│ OPUS │ Plan + Validate 2 agents
│ │ Resolve ambiguity, catch what others miss
├─────────┤
│ SONNET │ Build + Learn 15 agents
│ │ Write code, implement, structured judgment
├─────────┤
│ HAIKU │ Explore + Ship + Coordinate 10 agents
│ │ Read, summarize, follow templates
└─────────┘
An Opus plan costs ~5× more per token than a Sonnet one. But a bad plan cascades into bad execution across 10+ build tasks. Investing in Opus at Phase 2 saves multiples of its cost in rework at Phase 3. Same logic at Phase 4: a cheap reviewer misses the issues that matter.
Opus — Plan + Validate (2 agents)
We reserve Opus for the two decision points where reasoning failure is most expensive.
| Agent | Phase | Why Opus |
|---|---|---|
| core-planner | Plan | Resolves ambiguity and constructs the Directed Acyclic Graph (DAG). A bad dependency graph cascades into race conditions or wasted parallel work. One Opus call here avoids many Sonnet rework calls later. |
| core-judge | Validate | Cross-domain adversarial verification. A cheap reviewer produces cheap reviews — misses the security issue, approves the broken migration, ships the PII leak. Opus is our only viable choice for the final gate. |
Sonnet — Build + Learn (15 agents)
Production-quality work that needs domain judgment but operates within a tight plan. Sonnet handles implementation, analysis, and structured decisions that don’t need adversarial reasoning.
| Agent | Why Sonnet, not Opus | Why Sonnet, not Haiku |
|---|---|---|
| core-knowledge-manager | Distillation and toolkit ops need judgment, not adversarial review | Rule creation and profile decisions go beyond template-following |
| go-developer, python-developer | Code quality stays bounded by the plan — no ambiguity to resolve | Production code needs language reasoning and error handling judgment |
| data-engineer, analytics-engineer | Schema and pipeline logic is well-scoped; no cross-domain synthesis needed | SQL correctness and dbt model design go beyond pattern matching |
| platform-engineer, protocol-engineer | Infrastructure decisions stay within a plan, not open-ended | K8s manifests, Terraform, and gRPC schemas need structural reasoning |
| security-engineer | DORA compliance assessment follows defined frameworks | Threat modelling and compliance analysis are too nuanced for templates |
| code-reviewer | Reviews completed output within defined criteria | Catching subtle correctness issues, N+1 queries, and PII leaks needs real reasoning depth |
| software-architect | Refactoring plans are scoped, not adversarial | Safe refactoring needs understanding of call graphs, blast radius, and ordering |
| performance-engineer | SLA analysis applies known thresholds to observed data | Latency root cause and budget calculations go beyond simple lookup |
| ux-researcher, developer-advocate | Research synthesis is structured, not open-ended | Qualitative analysis and pattern extraction from user data need judgment |
| data-risk-manager | FIFO P&L logic is domain-specific but well-defined | Financial business rules and regulatory impact need careful reasoning |
Haiku — Explore + Ship + Coordinate (10 agents)
Template-following, read-only research, coordination, and output formatting. We parallelise these tasks heavily during Explore — cost multiplies with agent count, so affordable models matter most here.
| Agent | Why Haiku |
|---|---|
| core-technical-writer | Doc generation follows templates and style rules. Consistency and formatting are the job — no deep synthesis needed. |
| data-analyst | Read-only Looker/BigQuery work, dashboard summarization. Pattern recognition against known data shapes. |
| cicd-engineer | Pipeline config is template-driven. GitHub Actions and CI/CD YAML follow established patterns. |
| ops-tooling | Operational scripts and config management are mechanical. Low ambiguity, high repetition. |
| engineering-upfront | Frontend IAM and UI work follows component templates. No novel reasoning required. |
| product-manager, product-technical-manager | Ticket writing, backlog grooming, and stakeholder communication follow defined formats. |
| business-analyst | Requirements translation from regulatory specs to engineering tickets. Template-driven output. |
| customer-success-engineer | Ticket categorization, escalation routing, and client communication follow playbooks. |
| delivery-manager | Release coordination and dependency tracking. Primarily information aggregation and status formatting. |
The Explore override rule
When you dispatch any agent as a read-only subagent during Phase 1 (Explore), override its model to haiku regardless of its default. Exploration is summarisation, not reasoning. A Go developer dispatched to read and report on API structure doesn’t need Sonnet-level reasoning — it needs to read fast and report accurately.
# In your /rune dispatch or agent call:
model_override: haiku # override for all Phase 1 subagents
This matters for your wallet: fan out 8 Sonnet agents in parallel for exploration and you spend 8x Sonnet input cost. With the Haiku override, the same exploration costs ~12x less. The summaries are equally useful — summarisation doesn’t need frontier reasoning.
What happens when you get model selection wrong
| Scenario | Agents | Tokens | Estimated cost |
|---|---|---|---|
| All Opus, always | 10 explore + 8 build + 2 validate | 2M total | ~$30.00 |
| Pyramid model (Haiku/Sonnet/Opus) | Same 20 agents | 2M total | ~$6.50 |
| All Haiku, always | Same 20 agents | 2M total | ~$0.50 — but plan quality and review depth suffer |
The pyramid approach gives you ~4.6x cost reduction vs. all-Opus, while keeping Opus reasoning exactly where it prevents the most expensive mistakes: planning and validation.
Context window budgets
Context tokens are finite. Every file read, every rule loaded, every query result entering the context window displaces space for reasoning.
| What Loads | When | Typical Size |
|---|---|---|
| Agent frontmatter (all agents) | Session start | ~2K tokens |
| Rules (per profile) | Session start | 20-80K tokens |
| Hooks | Session start | ~1K tokens |
| Skill full text | When slash command invoked | 2-5K tokens per skill |
| Agent full prompt | When sub-agent dispatched | 3-10K tokens per agent |
Run toolkit profile budget to measure your profile’s footprint.
Why lean profiles matter
The goal is to stay under 25% of the context window for overhead — leaving 75%+ for actual work. Here’s what that looks like:
| Profile Strategy | Token Load | % of 200K Window | Reasoning Space |
|---|---|---|---|
| Load everything | ~80K | 40% | 120K — constrained |
| Domain-specific | ~35K | 17% | 165K — comfortable |
| Minimal + on-demand | ~15K | 7% | 185K — maximum headroom |
This is why profiles exist: not for organisational neatness, but for cost and cognitive efficiency.
Tracking dispatch costs
Every /rune dispatch tracks token usage per agent. Once execution finishes, the report shows actual metered values:
───────────────────────────────────────────
Token Economics
───────────────────────────────────────────
t1 developer 322K tok $6.76
t2 developer 394K tok $8.28
t3 reviewer 304K tok $6.38
───────────────────────────────────────────
Total tokens: 1,020K
Est. cost: $21.42
Wall time: 6m 12s (parallel)
CPU time: 14m 30s (sequential sum)
Time saved: ~55% via parallelism
───────────────────────────────────────────
Up-front cost estimation
Before dispatching, /rune estimates total cost using typical token counts per model and displays a coloured indicator at the bottom of the pre-dispatch report:
💰 Est. cost: ~$6.30 🟡 MEDIUM
| Indicator | Tier | Range | Typical cause |
|---|---|---|---|
| 🟢 | Low | < $5 | Haiku agents, small plans |
| 🟡 | Medium | $5 – $20 | Mixed Sonnet agents, 4–8 tasks |
| 🔴 | High | > $20 | Opus agents or large parallel fans |
We estimate using typical token counts per model (haiku ~80K/task, sonnet ~350K/task, opus ~450K/task) and the blended rates above. Actual cost varies with task complexity. Always shown as “Est.” — never exact.
History
Token usage, cost estimates, and timing are persisted in .rune/ history files alongside the plan and results. Use these for cost tracking across sessions.
explore Prompting & Knowledge Distance
A bad result doesn’t mean you prompted wrong. It means the agent lacks context. Feed it.
The knowledge distance problem
When an LLM gives a poor answer, your instinct is to rephrase the prompt or start over. Resist that. The root cause is rarely the prompt — it’s knowledge distance. The agent simply doesn’t have enough context to give you a good answer.
Think about the numbers. A 1M token context window holds roughly 4 MB of text. That’s an entire codebase, a full specification document, and a test suite — all at once, in a single agent session. You can feed that much to one agent in one go. It’ll process it, weigh the relevant sections, and produce an answer grounded in that context.
When the result is wrong, don’t rephrase. Add more context. Point the agent at more files. Paste in the error log. Include the spec. Close the knowledge distance and response quality goes up dramatically.
What happens to all that context
A 4 MB dump doesn’t stay 4 MB in the agent’s working memory. The LLM’s attention mechanism compresses it. By the time it produces a response, those 4 MB have been distilled down to roughly 2–4 KB of effective working context — the key facts, patterns, and relationships the model extracted.
That’s transformer attention in a nutshell: broad input, narrow focus. The agent reads everything but reasons about the handful of things that matter most. This is why more context usually helps — it gives the model more material to select from, even though only a fraction survives into the response.
Why teaching sessions fill up fast
During learning and knowledge-building sessions, the main context window fills up fast. If you’re dumping documentation, code samples, architecture decisions, and reference material into a single conversation, you’ll hit the context ceiling. The agent starts forgetting earlier material as the window scrolls.
This is exactly why we built the Knowledge Manager. Instead of cramming everything into one conversation, it spins up an independent chain of subagents. Each subagent gets its own fresh context window.
The distillation pipeline
Depending on your quota (or appetite for cost), you can spawn 10 subagents and feed them 40 MB of raw information in parallel — 4 MB per agent. Each agent distills its 4 MB down to structured rules.
| Stage | Volume | What Happens |
|---|---|---|
| Raw input | ~40 MB (10 agents × 4 MB) | Documentation, specs, code, logs fed to parallel subagents |
| First distillation | ~200–400 KB | Each agent produces structured rules from its 4 MB slice |
| Refinement pass | ~40–80 KB | A synthesis agent merges, deduplicates, and tightens the rules |
| Final polish | ~10–20 KB | LLM-friendly formatting: tables over prose, checklists over paragraphs, code blocks over descriptions |
That’s a 2,000x compression ratio: 40 MB of raw material refined into 20 KB of diamond-hard rules. Those 20 KB load into every agent session and change behaviour immediately.
The refinement cycle
Distillation is cyclical. The first pass produces good rules. The second pass makes them great. The third pass makes them LLM-optimal — structured for how transformers actually read, with tables for lookups, code blocks for patterns, and imperative sentences for instructions.
Each cycle tightens the rules further:
- Ingest — Raw material enters
src/upvest-agency/knowledge/ - Distill — Knowledge Manager produces structured rules in
src/upvest-agency/rules/ - Deploy — Rules are wired into profiles and deployed
- Observe — Use the rules in real sessions, note gaps and noise
- Refine — Feed observations back, tighten the rules, remove fluff
The budget trap
Be careful. This cycle is powerful but expensive. You can absolutely burn a good chunk of your quota teaching and re-synthesising information across agents, rules, and skills — without writing a single line of production code. (We’ve been there.)
Set a budget before you start a knowledge-building session. Decide up front whether there are opportunities for parallel knowledge capture, how many refinement passes you’ll run, and what “good enough” looks like. The first distillation pass captures 80% of the value. The remaining passes are diminishing returns.
| Pass | Value Captured | Cost | Recommendation |
|---|---|---|---|
| First distillation | ~80% | Base cost | Always do this |
| Refinement | ~15% | +50% of base | Do for critical rules |
| Polish | ~5% | +30% of base | Only for rules loaded in every session |
Quick tips
- Bad result? Add context first, rephrase second, start over last.
- Teaching the system? Use the Knowledge Manager, not the main conversation.
- Large knowledge dump? Split across subagents. Each gets 4 MB of fresh context.
- Refining rules? One pass is usually enough. Two for important rules. Three for rules that load in every single session.
- Budget? Decide before you start. The distillation cycle is addictive and expensive.
Next steps
Knowledge Pipeline
How knowledge enters the system
Token Economics
Cost tracking and context budgets
Markdown Management
Organize project documentation
description Markdown File Management
Organise project documentation so agents and humans can find what they need.
Recommended directory structure
Keep documentation close to the code. Use a flat, predictable layout that agents can navigate without guessing:
your-project/
├── docs/ # Project documentation root
│ ├── plans/ # Active implementation plans
│ │ ├── completed/ # Finished plans (archive, not delete)
│ │ ├── add-metrics.md
│ │ └── migrate-auth.md
│ ├── adrs/ # Architectural Decision Records
│ │ ├── 001-use-grpc.md
│ │ └── 002-event-schema.md
│ ├── runbooks/ # Operational runbooks
│ └── architecture.md # High-level system overview
├── .rune/ # AI Toolkit working directory (gitignored)
└── ...
docs/plans/
Store implementation plans here. When the Planner produces a plan via /write-plan, save it to this directory. Active plans live at the top level. Move completed plans to docs/plans/completed/ — archive, don’t delete. Completed plans are valuable context for future planning.
docs/plans/completed/
Finished plans move here after implementation. Agents can read these to understand how similar features were built before. This is institutional memory — each completed plan teaches the system about your project’s patterns and preferences.
docs/adrs/
Architectural Decision Records (ADRs) capture why a decision was made, not just what was decided. Number them sequentially. Each ADR should cover the context, decision, consequences, and alternatives considered. Agents read these to avoid re-litigating settled decisions.
Use the Technical Writer to generate ADRs: "document the decision to use gRPC instead of REST".
The .rune/ directory
The .rune/ directory is our working directory inside your project folder. It stores:
| File | Purpose |
|---|---|
plans/ | Saved DAG plans from /write-plan and /rune |
history/ | Execution logs with token usage, cost, and timing |
_pipeline-status.json | Current pipeline state for the on-stage-complete hook |
Add .rune/ to your .gitignore. It contains session-specific working data that shouldn’t be committed. Each developer’s .rune/ directory is local to their machine.
# .gitignore
.rune/
INDEX.md — a project map
Consider adding an INDEX.md at the root of your docs/ directory. This file acts as a table of contents that both humans and agents can scan to find the right document quickly:
# docs/INDEX.md
## Plans
- [Add metrics pipeline](plans/add-metrics.md) — active
- [Migrate auth to OAuth2](plans/migrate-auth.md) — active
- [Add caching layer](plans/completed/add-caching.md) — done
## ADRs
- [001 Use gRPC](adrs/001-use-grpc.md)
- [002 Event schema design](adrs/002-event-schema.md)
## Runbooks
- [Deploy to production](runbooks/deploy.md)
- [Rotate secrets](runbooks/rotate-secrets.md)
When an agent needs to understand the project, say "read docs/INDEX.md first". A single file scan gives the agent a map of all available documentation without reading every file. Keep the INDEX updated — an outdated map is worse than no map.
Documents as context
Markdown files in your project are a valuable source of context for agents. When an agent reads a plan, an ADR, or a runbook, it gains understanding that no amount of code reading can replace. The why behind a decision matters as much as the what in the code.
A few tips:
- Point agents at docs. Say
"read docs/adrs/001-use-grpc.md before you start". Context before action. - Keep docs current. An outdated plan or ADR is worse than no doc — it actively misleads agents.
- Write for machines too. Use headings, tables, and code blocks. Avoid long prose paragraphs. Agents parse structured content faster and more accurately than walls of text.
The 500-line rule
Any agent, rule, or skill file longer than 500 lines is too long. LLMs don’t need the fluff. Long files dilute attention, waste context tokens, and increase cost without proportional benefit.
When a file exceeds 500 lines, distill it:
- Use the Technical Writer:
"distill this rule down to the essentials" - Replace prose with tables. Replace explanations with code examples. Replace paragraphs with checklists.
- Move background material to
docs/where humans can read it. Keep only what agents need to act in the rule file.
The goal is density, not brevity. A 200-line rule packed with tables and code blocks carries more information than a 600-line rule full of explanatory prose. Agents need instructions, not education.
Context hygiene: one context, one mission
A context window has a fixed size. Every file read, every instruction loaded, every message in the conversation takes up space. When a context window serves too many different goals at once, the quality of every goal suffers.
This isn’t a failure of the model — it’s a failure of design. An agent asked to simultaneously debug a pipeline, review a pull request, and draft a status update will do all three worse than three separate agents each doing one thing with full attention.
The signs of a diverging context
- You’re asking the agent to switch topics mid-conversation
- The agent references something from several turns ago instead of the current task
- You’re copying the agent’s response into a new chat window to “reset” it
- The agent starts hedging or contradicting its earlier answers
These are symptoms of a context window that has become too crowded to reason clearly.
How we’ve designed around this
Every structural choice addresses context pollution in a different way:
| Mechanism | How it prevents diverging context |
|---|---|
| Phases | Explore, Plan, Build, and Validate each have a focused goal. You don’t ask a Build agent to also validate. You don’t ask an Explore agent to also write code. |
| Subagents | Each task dispatched by /rune gets a fresh context window. It reads what it needs, does its work, and returns a short summary. The heavy context dies when the task ends. |
| Profiles | Each profile loads only the rules relevant to one type of work. A security profile doesn’t load SQL conventions. A data profile doesn’t load compliance checklists. |
| Rules | Rules are pre-loaded at session start — not discovered mid-task. This keeps the conversation itself free for actual work instead of background reading. |
Practical guidelines
- One goal per session. Start a new session when the task changes significantly. Don’t carry the context of a debugging session into a feature planning session.
- Split large tasks into a plan. If a task touches more than 4–5 files or more than one domain, use
/write-planand dispatch with/rune. Each task gets its own context. - Don’t paste everything in. If you’re feeding the agent large amounts of material, use
/km-learnto distil it into rules first. Rules load once and stay lean. - Switch profiles when the work changes. Moving from feature development to a security review? Switch profiles. Each profile is a clean, focused context for that type of work.
- Let subagents read — not you. If you find yourself reading a 500-line file and summarising it for the agent, dispatch an Explore subagent instead. It reads the file in its own clean context and returns a focused summary.
Next steps
Knowledge Pipeline
How rules are created from raw material
Prompting
Knowledge distance and distillation economics
Rules Catalog
Browse all 47 rules
assignment Project Management Principles
Seven planning principles, Work Breakdown Structures (WBS), and how they map to dispatching DAGs of subagents.
AI Toolkit’s four-phase model is grounded in structured project management practice — specifically a set of universal planning principles and Work Breakdown Structures (WBS). Understanding this foundation helps you get more from the toolkit.
The 7 planning principles
Sound project delivery rests on a small set of universal principles. Each one maps directly to how we coordinate agents:
| # | Principle | AI Toolkit Mapping |
|---|---|---|
| 1 | Continued justification | Every plan must have a valid reason to proceed. If justification weakens, agents escalate rather than build work that delivers no value. |
| 2 | Learn from experience | Our Knowledge Manager captures lessons and distils them into rules. Each cycle refines what agents know before the next task starts. |
| 3 | Clear roles and responsibilities | Every task is assigned to a named agent. Ownership is explicit in the DAG — no task is unowned, no boundary is ambiguous. |
| 4 | Stage-by-stage delivery | The four-phase model (Explore → Plan → Build → Validate) breaks work into stages with clear handoffs. No phase begins until the prior one is complete. |
| 5 | Manage by exception | Agents operate autonomously within their scope. They escalate to you only when a tolerance is breached — a failure, a conflict, or a decision outside their authority. |
| 6 | Focus on outputs | Every task defines its output field before work begins. The DAG is a plan of deliverables, not just activities. |
| 7 | Tailor to context | Profiles adapt the knowledge set to the task. A security review loads different rules than a feature build. Planning depth matches project scale. |
Work Breakdown Structures
A Work Breakdown Structure (WBS) decomposes a project deliverable into smaller, manageable components. Each level breaks work into finer pieces until every leaf is a concrete, assignable task.
Feature: User Authentication
├── 1. Design
│ ├── 1.1 API contract
│ └── 1.2 Database schema
├── 2. Implement
│ ├── 2.1 Auth handler
│ ├── 2.2 Token service
│ └── 2.3 Middleware
├── 3. Test
│ ├── 3.1 Unit tests
│ └── 3.2 Integration tests
└── 4. Review
└── 4.1 Security audit
This is a hierarchy of what needs to be done. The WBS doesn’t specify order — it specifies scope. Every leaf node is a work package that can be estimated, assigned, and tracked.
From WBS to DAG
A WBS becomes a DAG when you add dependencies between work packages. The WBS answers “what are all the pieces?” The DAG answers “in what order can they run?”
WBS leaf nodes DAG tasks
─────────────── ──────────────────
1.1 API contract ───→ t1 architect (wave 0)
1.2 Database schema ───→ t2 architect (wave 0)
2.1 Auth handler ───→ t3 developer (wave 1, depends t1, t2)
2.2 Token service ───→ t4 developer (wave 1, depends t1)
2.3 Middleware ───→ t5 developer (wave 1, depends t3, t4)
3.1 Unit tests ───→ t6 tester (wave 2, depends t3, t4, t5)
3.2 Integration tests ───→ t7 tester (wave 2, depends t3, t4, t5)
4.1 Security audit ───→ t8 security (wave 3, depends t6, t7)
The Planner performs this transformation. It takes a natural language feature description, produces a WBS-like decomposition, then annotates it with dependencies and agent assignments to form a dispatchable DAG.
The Planner as project manager
In traditional project management, a PM decomposes work, assigns resources, sequences tasks, and tracks progress. Our Planner agent fills this role:
| PM Responsibility | Planner Equivalent |
|---|---|
| Scope decomposition | Breaks feature into atomic tasks (WBS leaf nodes) |
| Resource assignment | Assigns an agent type to each task |
| Sequencing | Defines depends_on relationships between tasks |
| Schedule optimization | DAG dispatcher computes waves for maximum parallelism |
| Risk identification | File conflict detection, cycle detection, orphan detection |
| Progress tracking | Wave-by-wave execution with token and cost reporting |
The 100% rule
The most important WBS principle is the 100% rule: the WBS must capture 100% of the project scope. Every piece of work must appear somewhere in the decomposition. Nothing is left out, nothing is duplicated.
Apply this when writing DAG plans. Every file that needs to change should appear in at least one task’s files field. If you cannot account for every change, the plan is incomplete. The Planner is trained to check this — but verify it yourself before dispatching.
The 8/80 rule
In WBS practice, each work package should take between 8 and 80 hours of effort. Too small and the overhead of tracking exceeds the value. Too large and the work package hides complexity.
For DAG tasks, the equivalent is: each task should be substantial enough to justify dispatching a subagent (agent startup is not free) but small enough that a single agent can complete it in one pass. A task that touches 1 file is probably too small. A task that touches 15 files is probably too large. Aim for 2–5 files per task as a guideline.
Critical path and parallelism
The critical path is the longest chain of dependent tasks through the DAG. It determines the minimum possible wall time — no amount of parallelism can shorten it.
DAG with 8 tasks:
Wave 0: t1, t2 (parallel)
Wave 1: t3, t4 (parallel, depend on wave 0)
Wave 2: t5 (depends on t3, t4)
Wave 3: t6, t7 (parallel, depend on t5)
Wave 4: t8 (depends on t6, t7)
Critical path: t1 → t3 → t5 → t6 → t8 (5 steps)
Without parallelism: 8 steps
Speedup: 8/5 = 1.6x
The speedup depends entirely on how many tasks can run in parallel per wave. A DAG where every task depends on the previous one has no parallelism — no benefit from dispatch. A DAG where most tasks are independent in the first wave has maximum parallelism.
Optimising the DAG
To maximise parallelism:
- Minimise dependencies. Only add a
depends_onwhen the task genuinely needs the output. If two tasks touch different files, they can run in parallel. - Front-load independent work. Design tasks so wave 0 has the most tasks. Later waves should converge, not diverge.
- Separate reading from writing. Research tasks (Phase 1) have no dependencies on each other. Build tasks (Phase 3) often do. Plan accordingly.
- Review tasks go last. The Judge or reviewer should run after all implementation is complete, not interleaved.
When the analogy breaks down
Project management principles inform the design, but subagent dispatch is not project management. Key differences:
| Project Management | DAG Dispatch |
|---|---|
| Tasks take hours to weeks | Tasks take seconds to minutes |
| Resources are humans with judgment | Resources are LLMs following rules |
| Communication is rich and nuanced | Communication is compressed summaries between waves |
| Replanning is expensive | Replanning is cheap — generate a new DAG |
| Scope creep is a risk | Scope is fixed by the plan; agents do not add work |
The speed difference is the most important. In human PM, a bad plan wastes weeks. In DAG dispatch, a bad plan wastes minutes. This means you can afford to plan quickly, dispatch, observe the result, and replan if needed. Iteration is cheap.
Next steps
DAG Dispatch
Context squeezing and parallel execution
Four-Phase Model
Explore, plan, build, validate
Token Economics
Cost tracking and context budgets
shield Safety Check Hook
Regex-based command filter. Intercepts Bash commands before execution and blocks known destructive patterns.
The safety-check.py hook runs as a PreToolUse hook. When the AI agent requests a shell command, the host fires an event before execution. We evaluate the command against patterns in safety-patterns.yaml and either blocks or allows it.
How it works
Agent requests a Bash command
→ Host fires PreToolUse event
→ safety-check.py receives the command string
→ Evaluates against patterns in safety-patterns.yaml
→ MATCH: return deny — command never reaches the shell
→ NO MATCH: exit 0 — command executes normally
Properties
| Property | Behaviour |
|---|---|
| Synchronous | Blocks until the check finishes. The command can’t race past it. |
| Stateless | Each command is evaluated independently. No session state. |
| Fail-open | If the config is missing, all commands pass. A broken config won’t lock you out. |
| Zero dependencies | Includes a minimal YAML parser. No PyYAML needed. |
Blocked patterns
Patterns are configured in src/upvest-agency/hooks/safety-patterns.yaml. Edit the file directly — no Python changes needed.
Destructive file operations
| Pattern | Catches | Severity |
|---|---|---|
rm-recursive-force | rm -rf, rm -fr, rm -r -f, all flag orderings | Block |
rm-recursive | rm -r, rm --recursive | Block |
Destructive SQL
| Pattern | Catches | Severity |
|---|---|---|
drop-table | DROP TABLE (case-insensitive) | Block |
drop-database | DROP DATABASE | Block |
drop-schema | DROP SCHEMA | Block |
alter-table-drop | ALTER TABLE ... DROP | Block |
delete-from | DELETE FROM | Block |
truncate | TRUNCATE | Block |
Destructive Git
| Pattern | Catches | Severity |
|---|---|---|
git-force-push | git push --force (allows --force-with-lease) | Block |
git-reset-hard | git reset --hard | Block |
git-clean | git clean -f | Block |
git-checkout-dot | git checkout . | Block |
git-restore-dot | git restore . | Block |
git-branch-force-delete | git branch -D | Block |
Infrastructure
| Pattern | Catches | Severity |
|---|---|---|
kubectl-delete | kubectl delete | Block |
terraform-production-apply | terraform apply + production keywords | Block |
bq-all-commands | All bq CLI commands | Block |
Authentication
| Pattern | Catches | Severity |
|---|---|---|
gcloud-auth | gcloud auth | Block |
gh-auth | gh auth | Block |
confluent-auth | confluent login | Block |
Adding your own patterns
Open src/upvest-agency/hooks/safety-patterns.yaml and add an entry:
- name: docker-system-prune
match: '\bdocker\s+system\s+prune\b'
message: "Docker system prune blocked — removes all unused data"
severity: warn
| Field | Required | Description |
|---|---|---|
name | Yes | Identifier for logs and messages |
match | Yes | Python regex matched against the command |
flags | No | i for case-insensitive |
message | Yes | Shown to the user when blocked |
severity | Yes | block (prevent) or warn (allow with warning) |
Redeploy after editing: toolkit profile reload
auto_fix_high Auto-Lint Hook
Automatic formatting after file writes. Keeps code clean without manual intervention.
The auto-lint.py hook runs as a PostToolUse hook. After an agent writes or edits a file, the hook checks the file extension against rules in auto-lint-rules.yaml and runs the matching formatters.
How it works
Agent writes or edits a file
→ Host fires PostToolUse event
→ auto-lint.py receives the file path
→ Matches extension against auto-lint-rules.yaml
→ MATCH: runs the formatter commands in order
→ NO MATCH: no action
Default rules
| Extension | Commands | Condition |
|---|---|---|
.py | ruff check --fix, ruff format | — |
.sql | sqlfluff fix --force | dbt/dbt_project.yml exists |
.sqlx | sqlfluff fix --force | dbt/dbt_project.yml exists |
.go | goimports -w | — |
.tf | terraform fmt | — |
If a command is not found on PATH, it’s silently skipped. This means the hook is safe to deploy even if you don’t have every formatter installed.
Adding your own rules
Open src/upvest-agency/hooks/auto-lint-rules.yaml and add an entry:
- extension: ts
commands:
- "prettier --write {file}"
timeout: 10
| Field | Required | Description |
|---|---|---|
extension | Yes | File extension without the dot |
commands | Yes | List of commands. Use {file} as placeholder for the file path. |
timeout | No | Max seconds per command (default: 10) |
condition | No | Only run if this file exists relative to project root |
Redeploy after editing: toolkit profile reload
flag Stage Complete Hook
Pipeline stage guidance. Suggests your next step when a subagent finishes.
The on-stage-complete.py hook runs as a SubagentStop / Stop hook. When a subagent completes its task, this hook reads the pipeline state file and suggests what to do next.
How it works
Subagent completes a task
→ Host fires SubagentStop event
→ on-stage-complete.py reads .rune/_pipeline-status.json
→ FILE EXISTS: prints workflow stage, ticket, and suggested next agent
→ NO FILE: prints "No active pipeline"
The pipeline status file
The _pipeline-status.json file lives in .rune/ and tracks the current state of a multi-stage workflow:
{
"workflow": "feature-implementation",
"current_stage": "implement",
"ticket": "ENG-1234",
"next_agent": "reviewer"
}
| Field | Description |
|---|---|
workflow | Name of the active workflow |
current_stage | Stage that just completed |
ticket | Associated ticket or task ID |
next_agent | Suggested agent for the next stage (empty if all done) |
This hook is informational only — it suggests but doesn’t enforce. You decide whether to follow the suggestion or take a different path.
terminal CLI Reference
Complete reference for all toolkit commands. Run toolkit --help or toolkit <command> --help for inline help.
Installation
cd ai-toolkit && uv tool install .
Installs the toolkit binary. Agents, rules, and profiles are not copied — they are read directly from this repository. The install records where the repository lives so toolkit works from any directory.
Re-run uv tool install . --reinstall only when the CLI Python code changes (e.g. after pulling a new version). Editing agents, rules, or profiles never requires a reinstall — run toolkit profile reload instead.
Command groups
The CLI is organised into seven canonical groups. Every resource type follows the same noun-verb pattern: toolkit <noun> <verb>.
| Group | What it manages |
|---|---|
agent | Agent definitions (Markdown + YAML frontmatter) |
rule | Rule files loaded into agent context |
skill | Slash-command workflows |
profile | Profile composition, deployment, budget |
mcp | MCP server enable/disable per profile |
team | Team global instructions deployed to ~/.claude/CLAUDE.md |
tool | Optional system tools (e.g. ripgrep, sqlfluff) |
Every group exposes the same verbs where it makes sense: list, show, add, remove, install, uninstall. add/remove edit the active profile and redeploy. install/uninstall deploy a single resource ad-hoc without changing the profile.
Global options
| Option | Description |
|---|---|
--format [text|json] | Output format on every list command. Default: text. Use json for scripting. |
--project <path> | Target a project-local .claude/ instead of ~/.claude/. Supported by profile use and the install/uninstall verbs. MCPs are skipped for project installs. |
Setup
| Command | What it does |
|---|---|
toolkit setup | Guided wizard — pick your team, role, and workflows. Run once to get started; use toolkit commands to change things later. |
Profile management
Profiles control which rules load into agent context. All agents and skills deploy to every profile — only the knowledge set changes.
| Command | What it does |
|---|---|
toolkit profile use <name> | Deploy a profile — replaces the previously active profile. |
toolkit profile use <name> --project <path> | Deploy into <path>/.claude/ instead of ~/.claude/ (project-local install). MCPs are skipped. |
toolkit profile list | List all available profiles (shared and personal variants). Add --format json for scripting. |
toolkit profile show <name> | Preview what a profile contains: agents, rules, skills, hooks, MCPs. |
toolkit profile current | Print the currently active profile name. |
toolkit profile reload | Redeploy the active profile — use after editing files in src/. |
toolkit profile budget | Measure the token footprint of the active profile's rules. |
Resource management (agent, rule, skill, tool)
The four resource groups share the same verbs. Examples below use agent; substitute rule, skill, or tool as needed.
| Command | What it does |
|---|---|
toolkit agent list | List resources, grouped by category. Use --format json for machine-readable output. |
toolkit agent show <name> | Preview a single resource (frontmatter + body). |
toolkit agent add <name> | Add the resource to the active profile and redeploy. |
toolkit agent remove <name> | Remove the resource from the active profile and redeploy. |
toolkit agent install <name> | Install a single resource ad-hoc (no profile edit). Honours --project. |
toolkit agent uninstall <name> | Remove an ad-hoc-installed resource. Honours --project. |
MCP management
| Command | What it does |
|---|---|
toolkit mcp list | List all available MCP servers. Add --format json for scripting. |
toolkit mcp status [--profile <name>] | Show which MCPs are enabled for a profile. |
toolkit mcp enable <name> [--profile <name>] | Enable an MCP in the active (or specified) profile. |
toolkit mcp disable <name> [--profile <name>] | Disable an MCP in the active (or specified) profile. |
Team management
| Command | What it does |
|---|---|
toolkit team list | List available team global instructions. |
toolkit team use <name> | Deploy team instructions to ~/.claude/CLAUDE.md. |
toolkit team clear | Remove deployed team instructions. |
Verify & validate
| Command | What it does |
|---|---|
toolkit validate | Validate all YAML files against JSON schemas and check agent frontmatter. |
toolkit verify | Verify that installed resources match the managed state (detects drift). |
toolkit reset | Remove all managed resources from platform directories. Prompts for confirmation. |
Other
| Command | What it does |
|---|---|
toolkit site | Generate the static documentation site (outputs to site/). |
dictionary Glossary
Key terms used throughout this documentation, organized by category. Links point to external references for deeper reading.
AI Foundations
| Term | Definition |
|---|---|
| Agent’s working memory | The text the agent can see at one time. Has a fixed size. Rules, instructions, and conversation history all share this space. |
| Context window | The maximum number of tokens an LLM can process in a single request. Typical sizes: 128K–1M tokens. |
| LLM | Large Language Model. A neural network trained on text that generates responses given a prompt and context. |
| MCP | Model Context Protocol. A standard for connecting AI models to external tools and data sources. |
| Token | The smallest unit of text an LLM processes. Roughly 4 characters or 0.75 words. You pay per token. See Tokenization. |
Toolkit Architecture
| Term | Definition |
|---|---|
| Agent | A markdown file with YAML frontmatter and a system prompt. Loaded on demand by the orchestrator. See Intelligent agent. |
| Hook | A script that intercepts tool calls before or after execution. Used for safety checks, auto-formatting, and pipeline guidance. |
| Knowledge Manager (KM) | Core agent that ingests raw material and distills it into structured rules. Manages the knowledge lifecycle. |
| Profile | A named set of rules that load into agent context. Swap profiles to change the knowledge set without changing agents or skills. |
| Rule | A structured markdown file in src/upvest-agency/rules/ containing conventions, patterns, and instructions that agents follow. |
| Skill | A slash command that triggers a structured workflow. Loaded on demand — zero tokens until invoked. |
Execution & Dispatch
| Term | Definition |
|---|---|
| DAG | Directed Acyclic Graph. A dependency graph where tasks point to their prerequisites. Used to determine execution order. |
| Dispatching | Sending a task to an agent and waiting for the result. In AI Toolkit, dispatching runs agents through Claude Code’s helper agent system. |
| Subagent | An agent dispatched by the orchestrator to perform a specific task. Gets its own fresh context window. Returns a summary to the parent. |
| Topological sort | Algorithm that orders a DAG so every task comes after its dependencies. Used to compute execution waves. |
| Wave | A set of tasks with no mutual dependencies that can run in parallel. Wave 0 runs first; each subsequent wave starts after all tasks in the prior wave complete. |
Knowledge & Context
| Term | Definition |
|---|---|
| ADR | Architectural Decision Record. A short document capturing a design decision, its context, and consequences. |
| Context compression | Reducing a large amount of information to a short summary before passing it to the next agent or wave. Keeps working memory from filling up. |
| Distillation | The process of compressing raw material into structured, LLM-friendly rules. Removes fluff, keeps actionable content. See Knowledge distillation. |
| Knowledge distance | The gap between what an agent knows and what it needs to know to answer well. Close the gap by adding context, not rephrasing the question. |
map Sitemap
All pages in this documentation, organized by section.
Getting Started
- Home — Workflow cards, building block stats, quick links
- Quick Start — Install, clone, deploy
- Talk to Your Team — Natural language interaction guide
The Core Concept
- Four-Phase Model — Explore, plan, build, validate
- Knowledge Pipeline — Rules, profiles, Knowledge Manager
- Profiles — Swap knowledge sets per task
- DAG Dispatch — Parallel execution and context squeezing
Building Blocks
- Agents — Agent catalog (36 agents)
- Skills — Slash command catalog (56 skills)
- Rules — Rules catalog (47 rules)
Deep Dives
- Token Economics — Cost tracking, context budgets, dispatch metering
- Prompting — Knowledge distance, distillation pipeline, budget management
- Markdown Management — Directory structure, .rune/, the 500-line rule
- Project Management — 7 planning principles, WBS, critical path, DAG optimization
Configuration
- Safety Check — Blocked command patterns
- Auto-Lint — Automatic formatting rules
- Stage Complete — Pipeline stage guidance
Reference
- CLI Reference — All toolkit commands with options
- Glossary — Key terms and definitions
- Sitemap — This page
Workflows
See all workflows, auto-discovered from workflows/ directories.
account_tree Workflows
Workflows are discovered automatically from workflows/ directories across agents, rules, and skills. If a folder exists in any of them, it qualifies as a workflow.
Incident Investigation
Triage a production alert, identify root cause via Datadog, and propose a remedi
Onboard Topic
Add a Kafka topic to BigQuery via bigquery-writer. Validates the proto schema, w
Pipeline
Dispatch independent tasks simultaneously. Wave-by-wave execution with context i
Platform Self Service
Provision GCP access, scaffold new backend services, and roll out infrastructure
Sales
Technical sales support and API demonstrations.
Security Remediation
Triage and remediate security vulnerabilities from scanning tools.
Shell Configuration
Shell and dotfile configuration management.
Spec Driven Development
Generate implementation from formal specifications and acceptance criteria.
Superpowers
Advanced agent collaboration patterns and meta-workflows.
Validation
Send any output to the judge for validation before it ships. Works on code, plan
category Incident Investigation
Triage a production alert, identify root cause via Datadog, and propose a remediation path.
Skills
/datadog-dashboarddatadog-dashboard
Use when creating or modifying Datadog dashboard JSON files that can be…
/datadog-explorerdatadog-explorer
Use when querying Datadog for logs, metrics, traces, spans, incidents,…
/investigateinvestigate
Structured incident investigation using Datadog logs/metrics and Linear…
/postmortem-reviewerpostmortem-reviewer
Review incident post-mortems and assess their quality. Use this skill whenever…
Agents
category Onboard Topic
Add a Kafka topic to BigQuery via bigquery-writer. Validates the proto schema, writes the config entry, and opens follow-up Linear tickets.
Skills
category Pipeline
Dispatch independent tasks simultaneously. Wave-by-wave execution with context injection between waves.
Skills
Rules
agent-dispatch
Pipeline-specific dispatch mechanics: routing rules, subagent patterns, context…
dag-execution-format
Canonical format for dependency-annotated plans that enable parallel agent…
pipeline-workflows
Reusable workflow templates for common Upvest multi-agent tasks.
category Platform Self Service
Provision GCP access, scaffold new backend services, and roll out infrastructure PRs across repos. Covers the full lifecycle from IAM grants to service wiring.
Skills
/k8s-resource-sizingk8s-resource-sizing
Use when an Upvest engineer needs to set or update `resources.requests` /…
/new-platform-accessnew-platform-access
Enable GCP APIs or grant IAM roles for any business unit in platform-bootstrap,…
/new-service-infrastructurenew-service-infrastructure
Use when rolling out infrastructure for an Upvest backend service (typically…
/new-service-scaffoldnew-service-scaffold
Use when bootstrapping a new Upvest backend service from a template. Copies or…
category Sales
Technical sales support and API demonstrations.
Skills
category Security Remediation
Triage and remediate security vulnerabilities from scanning tools.
Skills
/security-sweepsecurity-sweep
Vulnerability + upgrade sweep for any Upvest repo. Asks which repo, which…
/wiz-external-image-exceptionwiz-external-image-exception
Request a bulk Wiz Ignore Rule for an externally-sourced (third-party)…
/wiz-vuln-reportwiz-vuln-report
List all actionable Critical and High Wiz vulnerabilities (with a fix…
category Shell Configuration
Shell and dotfile configuration management.
Agents
category Spec Driven Development
Generate implementation from formal specifications and acceptance criteria.
Skills
category Superpowers
Advanced agent collaboration patterns and meta-workflows.
Skills
/brainstormingbrainstorming
You MUST use this before any creative work - creating features, building…
/codebase-onboardingcodebase-onboarding
Use when analyzing repository architecture, explaining domain entities, or…
/dispatching-parallel-agentsdispatching-parallel-agents
Use when facing 2+ independent tasks that can be worked on without shared state…
executing-plans
/finishing-development-branchfinishing-development-branch
Use when implementation is complete, all tests pass, and you need to decide how…
/receiving-code-reviewreceiving-code-review
Use when receiving code review feedback, before implementing suggestions,…
/requesting-code-reviewrequesting-code-review
Use when completing tasks, implementing major features, or before merging to…
/subagent-driven-developmentsubagent-driven-development
Use when executing implementation plans with independent tasks in the current…
/verification-before-completionverification-before-completion
Use when about to claim work is complete, fixed, or passing, before committing…
/writing-clearly-and-conciselywriting-clearly-and-concisely
A strict style guide for technical documentation. Enforces brevity, active…
/writing-planswriting-plans
Generates a strict, atomic, step-by-step TDD implementation plan based on a…
category Validation
Send any output to the judge for validation before it ships. Works on code, plans, ADRs, and SQL.
Skills
/judgejudge
Code review — send completed work for review, or handle incoming review…
/judge-auditjudge-audit
Deep adversarial audit of any agent's output. Scrutinizes correctness,…
/judge-paneljudge-panel
Summon a panel of N judges for multi-perspective review. Each judge evaluates…