Catalog roles are installed on demand. The bundled agents are researcher, reviewer, tester, code-cleaner, docs-writer, and todo-resolver. For every other role below, ask Autohand to search the live catalog, show the exact definition and tools, and wait for installation approval if it is not already registered.

Route exact roles with direct delegation. delegate_task and delegate_parallel bind named agents to named work. A team task has no role selector: the first idle teammate claims the first unblocked task. Use a task-based team only for compatible teammates, or form one homogeneous team per phase. All team children share the workspace and auto-confirm local tool prompts, so use narrow definitions, disjoint files, and a clean branch or worktree.

Use-case index

CasesFamilyPrimary patternsTypical artifact
1–6Engineering deliverydelegate_task, delegate_parallel, and compatible task teamsRepository map, patch set, tests, migration plan
7–12Quality and operationsRead-only parallel delegation and staged remediationFindings, incident timeline, remediation, docs
13–18Research and decisions/deep-research with bounded research tracksCited report, decision matrix, ADR input
19–24Measured optimization/autoresearch with analysis and finalization agentsExperiment log, dashboard, kept commits

Engineering delivery

Use these patterns to understand a codebase, shape changes before implementation, and divide write ownership safely.

1. Map an unfamiliar repository before editing

Pattern: parallel, read-only delegation to the bundled researcher and catalog code-mapper. Give them different questions: runtime flow versus ownership and change boundaries.

Use parallel delegation with two read-only agents.

researcher: Trace the request lifecycle for POST /api/orders from route to
validation, authorization, service logic, persistence, events, and response.
Cite file and line evidence and identify runtime error paths.

code-mapper: Map the modules, public interfaces, owners, tests, configuration,
and generated code that constrain changes to order creation. Identify likely
change surfaces, but do not propose implementation.

The lead must merge both outputs into one repository map, resolve conflicting
claims by reading the cited code, and recommend the smallest safe ownership
boundary. Do not edit files.

Artifact: a numbered execution flow plus a module/ownership map. Gate: every load-bearing statement has a file and line reference, and the lead can name the exact files a later implementation may touch.

2. Deliver a cross-stack feature with separate owners

Pattern: staged direct delegation to api-designer, backend-developer, frontend-developer, bundled tester, and bundled reviewer. The lead enforces the contract and phase gates; use a task team only within a phase whose teammates are interchangeable.

Run saved-searches as staged named delegations. Do not put these heterogeneous
roles into one first-available team queue.

Outcome: users can save, rename, run, and delete a search without changing the
existing search response schema.

Tasks:
1. api-designer owns docs/api/saved-searches.md and defines endpoints, errors,
   authorization, idempotency, and compatibility. Read-only elsewhere.
2. tester writes contract tests after task 1. Own tests/api/saved-searches/**.
3. backend-developer implements task 1 after task 2. Own src/api/saved-searches/**
   and the new migration only.
4. frontend-developer implements the UI after task 1. Own src/features/search/**.
5. reviewer performs a read-only final review after tasks 3 and 4.

The lead runs migration validation, focused API and UI tests, typecheck, and
the production build after integration.

Artifact: API contract, migration, backend and UI patches, tests, and review findings. Gate: task dependencies are complete, no write ownership overlaps, and the lead verifies the feature through the public boundary.

3. Evolve a public API without breaking clients

Pattern: phased direct delegation with api-designer, business-analyst, backend-developer, test-automator, and technical-writer. The design phase must finish before any server code changes.

Run customer-api-v2 as named delegations. First, delegate consumer-requirement
extraction to business-analyst. In parallel, delegate the current-contract
inventory and backwards-compatible v2 proposal to api-designer.

After the lead approves the contract:
- test-automator owns compatibility and consumer-contract tests;
- backend-developer owns server implementation and migration adapters;
- technical-writer owns API reference, SDK migration examples, and deprecation
  notes after behavior is verified.

No task may remove or reinterpret a v1 field. Report every intentional response,
error, pagination, auth, or rate-limit change in a compatibility matrix.

Artifact: compatibility matrix, v2 contract, adapters, tests, and migration guide. Gate: old-client fixtures remain green, new contract tests pass, generated schemas are stable, and documentation examples execute against the implementation.

4. Modernize a legacy subsystem in controlled phases

Pattern: sequential named delegations to code-mapper, legacy-modernizer, the relevant language specialist, bundled tester, and bundled reviewer. Preserve behavior before replacing structure; use a homogeneous task team only if one phase has several interchangeable workers.

Run invoice-modernization in four named phases. Complete and review each phase
before delegating the next.

Phase 1: code-mapper documents entry points, implicit contracts, side effects,
data shapes, dynamic loading, and operational dependencies for legacy/invoice/**.
Phase 2: tester creates characterization tests from observed behavior and owns
tests/legacy/invoice/**. No production edits yet.
Phase 3: legacy-modernizer proposes seams and a reversible migration sequence;
the language specialist implements one seam at a time in src/invoice/**.
Phase 4: reviewer compares old and new behavior, migration/rollback, and the
combined diff. The lead runs both characterization and new tests.

Do not delete the legacy path until traffic cutover and rollback evidence exist.

Artifact: behavior inventory, characterization suite, staged implementation, cutover and rollback plan. Gate: parity is proven at every seam, public behavior is unchanged unless explicitly approved, and deletion is a separate reviewed task.

5. Remove dead code without deleting dynamic behavior

Pattern: three sequential delegations: bundled researcher identifies candidates, bundled code-cleaner owns the patch, and bundled reviewer independently checks the diff. Do not run the mutation and review phases in parallel.

First delegate a read-only inventory to researcher. Search src/payments/** for
unused exports, imports, feature flags, unreachable branches, and abandoned
adapters. For every candidate, check tests, string references, registries,
dependency injection, reflection, configuration, and public package exports.

After the lead accepts the candidate list, delegate only those exact removals
to code-cleaner. Require one focused patch and the package's tests and build.

Finally delegate the resulting diff to reviewer with the original evidence.
The reviewer must look for dynamic references and public API regressions.

Artifact: evidence-backed candidate list, minimal cleanup patch, and independent review. Gate: each deletion has negative-reference evidence, public exports are unchanged or intentionally deprecated, and focused plus package-level checks pass.

6. Upgrade a dependency across a monorepo

Pattern: staged direct delegation to dependency-manager, build-engineer, security-auditor, bundled tester, and bundled reviewer. Split discovery, upgrade, compatibility, and proof into distinct named phases.

Run the React major-version upgrade as named delegations in this order:

dependency-manager: inventory direct/transitive versions, peer constraints,
lockfile ownership, codemods, and official breaking changes. Propose order only.
security-auditor: review current and target advisories and supply-chain risks.
build-engineer: own package manifests, lockfile, build config, and codemods after
the inventory is approved.
tester: own regression coverage and run workspace-specific suites.
reviewer: inspect the final diff for behavior changes, bypassed warnings, and
temporary compatibility shims that lack removal plans.

Upgrade one dependency family at a time; do not mix unrelated package updates.

Artifact: compatibility inventory, focused manifest/lockfile diff, test evidence, and shim removal plan. Gate: clean install, all affected package builds, typecheck, tests, and a representative runtime smoke test succeed from a fresh checkout.

Quality and operations

Use independent named reviewers for breadth, then use sequential direct delegation or a homogeneous task team when findings require ordered remediation and validation.

7. Run a multi-discipline pull-request review

Pattern: one delegate_parallel call with bundled reviewer, security-auditor, accessibility-tester, and performance-engineer. Keep all four read-only and make the lead deduplicate the results.

Review the merge-base diff for this branch with four independent read-only
sub-agents. Give each the PR description, changed-file list, diff, and relevant
AGENTS.md instructions.

reviewer: correctness, regressions, error handling, and repository conventions.
security-auditor: trust boundaries, auth, injection, secrets, and data exposure.
accessibility-tester: semantics, labels, focus order, keyboard, contrast, and
assistive-technology behavior for changed UI.
performance-engineer: query count, I/O, allocation, rendering, bundle, and hot paths.

Return only findings caused by this diff. Each finding needs severity, file:line,
evidence, user impact, and smallest safe remediation. The lead must verify each
finding against source and combine duplicates.

Artifact: one severity-ordered review, not four pasted reports. Gate: every finding is actionable and diff-caused; uncertain observations are labeled as questions; absence of findings is not claimed without coverage of every changed surface.

8. Triage a failing CI pipeline without chasing noise

Pattern: classification by error-coordinator, followed by named delegation to build-engineer, debugger, and bundled tester. Start with classification; only one write-capable owner patches each failure family.

Run ci-recovery as a classification phase followed by named remediation tasks.

Task 1 — error-coordinator: read the failed-job logs and group failures by root
cause. Separate product regressions from flaky tests, provider/network noise,
runner exhaustion, and pre-existing failures. Produce exact job, command, first
meaningful error, and affected path for each group.

Task 2 — build-engineer: own workflow, toolchain, cache, and packaging failures.
Task 3 — debugger: own one confirmed product-code root cause only.
Task 4 — tester: reproduce affected tests locally and repair test-only failures.

Do not delegate tasks 2–4 until task 1 is accepted. No one may suppress a check, widen retries, or
update snapshots until the failure is reproduced and classified.

Artifact: failure taxonomy, minimal patches by owner, and rerun evidence. Gate: the original command passes locally or in an equivalent runner, required CI checks rerun cleanly, and unrelated operational noise is reported separately rather than hidden by product changes.

9. Audit an authorization boundary before release

Pattern: parallel read-only analysis by security-auditor, penetration-tester, compliance-auditor, and bundled researcher, followed by named remediation delegation only after findings are verified.

Run a read-only authorization audit for project and organization resources.

researcher: map identity, session, middleware, policy, query, cache, and audit-log
flow with file:line evidence.
security-auditor: test the design against IDOR, confused deputy, privilege
escalation, tenant isolation, stale roles, and fail-open behavior.
penetration-tester: produce concrete request sequences for exploitable paths;
do not execute destructive requests or access data outside the test fixtures.
compliance-auditor: map proven behavior to the repository's stated controls and
identify evidence gaps without giving legal conclusions.

The lead must reproduce each high/critical issue in an isolated test before
authorizing a patch.

Artifact: trust-boundary map, verified exploit paths, control gaps, and remediation tasks. Gate: every high-severity claim has a reproducible test, fixes preserve public contracts, negative authorization tests pass, and logs demonstrate denied access without exposing sensitive data.

10. Coordinate a production incident investigation

Pattern: the lead owns coordination while sre-engineer, database-administrator, and security-engineer gather independent read-only evidence in parallel. Begin read-only and require explicit approval for remediation.

Run checkout-latency-incident as parallel named, read-only delegations.

lead: own timeline, hypotheses, decision log, severity, and updates.
sre-engineer: inspect service metrics, traces, deploys, saturation, and dependencies.
database-administrator: inspect slow queries, locks, pool pressure, replication,
and explain plans using production-safe read-only commands.
security-engineer: determine whether traffic, abuse, auth changes, or compromise
signals explain the event.

Give each specialist a separate evidence contract. Record query,
dashboard, trace, and log references with timestamps. Do not restart, scale,
fail over, change configuration, or run mutating SQL without explicit approval
and a rollback condition.

Artifact: timestamped incident timeline, ranked hypotheses, evidence, approved actions, and follow-up tasks. Gate: customer impact is stable or resolved, the causal chain is evidence-backed, mitigation has rollback and monitoring, and unresolved uncertainty remains visible in the handoff.

11. Remediate accessibility regressions in a UI flow

Pattern: sequential named delegation: accessibility-tester audits first, ui-fixer owns the minimal patch, bundled tester adds behavioral coverage, and bundled reviewer checks the integrated result.

Run accessible-checkout as four sequential named delegations.

1. accessibility-tester: audit checkout from cart through confirmation at mobile
   and desktop widths. Cover landmark structure, accessible names, focus order,
   error association, keyboard-only completion, modal focus trap/restore,
   live-region announcements, contrast, motion, and zoom. Read-only.
2. ui-fixer: after task 1, own src/checkout/** and apply the smallest fixes that
   preserve visual hierarchy and design tokens.
3. tester: after task 2, add keyboard and accessible-name assertions using the
   project's existing browser-test conventions.
4. reviewer: inspect semantic and behavioral regressions; read-only.

Do not replace native controls with custom roles unless required.

Artifact: evidence-backed audit, focused UI patch, and automated interaction tests. Gate: the full critical flow completes by keyboard, focus is visible and deterministic, errors are announced and associated, automated accessibility checks pass, and a real rendered smoke test confirms behavior.

12. Synchronize documentation with a release

Pattern: staged named delegation to bundled researcher, bundled docs-writer, api-documenter, content-quality-editor, and bundled reviewer. Derive claims from the release diff and executable behavior.

Run release-docs as staged named delegations for the current release range.

researcher: map user-visible changes, flags, commands, APIs, defaults, migrations,
deprecations, and known limits from commits and source. Cite paths and tests.
api-documenter: own generated/reference API deltas and executable examples.
docs-writer: own guides, upgrade notes, changelog, and troubleshooting updates.
content-quality-editor: remove unsupported claims, vague marketing language,
duplication, and inconsistent terminology after technical content is complete.
reviewer: compare every documented behavior to source and current help output.

Preserve the site's existing structure and voice. Do not document unreleased or
feature-gated behavior without labeling availability.

Artifact: release notes, reference updates, migration guidance, and verified examples. Gate: commands run as written, links resolve, generated docs are refreshed, build/search output succeeds, and every visible behavior change appears in the changelog.

Research and decisions

Use /deep-research when a decision depends on current external evidence. Partition by evidence track and require the lead to synthesize one report.

13. Select a framework or infrastructure component

Pattern: /deep-research with docs-researcher, competitive-analyst, security-auditor, and platform-engineer on disjoint evidence tracks.

/deep-research Decide whether Temporal, Restate, Inngest, or a PostgreSQL queue
should power durable workflows in this TypeScript monorepo as of July 2026.
Constraints: self-hosting, human approval steps, at-least-once delivery, fewer
than 50k jobs/day, two operators, and an existing PostgreSQL estate.

If parallel agents are available, assign official API and version support to
docs-researcher, verified feature/operating comparison to competitive-analyst,
security and data-boundary review to security-auditor, and deployment/upgrade/
observability analysis to platform-engineer. Read local architecture and package
files. Cross-check load-bearing claims and produce an ADR-ready matrix,
recommendation, rejection reasons, migration outline, and open questions.

Artifact: cited decision report under .autohand/research/. Gate: version and date are explicit, every required capability is evidenced, operational cost is separated from license price, and the recommendation maps to current repository constraints.

14. Assess a regulation or compliance change

Pattern: /deep-research with legal-advisor, compliance-auditor, security-auditor, and business-analyst. Treat the output as engineering risk analysis, not legal advice.

/deep-research Assess how the current EU AI Act implementation timeline affects
our customer-support summarization feature as of 14 July 2026. Scope the feature
described in docs/product/support-ai.md and src/ai/support/**. Identify likely
system classification, provider/deployer responsibilities, transparency,
logging, data governance, human oversight, incident, and documentation duties.

Use primary EU legal and regulator sources for obligations and dates. Delegate
legal text mapping to legal-advisor, control/evidence mapping to compliance-auditor,
technical gaps to security-auditor, and product/workflow impact to business-analyst.
Separate confirmed requirements, interpretations, and questions for counsel.
Produce a control matrix with owner, evidence, gap, priority, and target date.

Artifact: dated legal-source map and engineering control matrix. Gate: jurisdiction and role assumptions are explicit, binding text is distinguished from guidance, effective dates are sourced, and every uncertain conclusion is routed to qualified counsel.

15. Synthesize scientific literature for a technical decision

Pattern: /deep-research with scientific-literature-researcher, data-researcher, and research-analyst. Partition by study retrieval, quantitative extraction, and applicability.

/deep-research Evaluate whether speculative decoding is likely to improve our
latency/cost target for 7B–32B code models on Apple Silicon. Include peer-reviewed
papers and strong preprints through July 2026. Extract model sizes, draft/target
pair, hardware, batch size, acceptance rate, tokens/sec, latency, quality checks,
and limitations. Do not compare incompatible benchmarks as if they were equal.

Use scientific-literature-researcher for methods and validity, data-researcher
for a structured result table, and research-analyst for applicability to the
local MLX configuration files. Weight evidence by methodological quality and
end with a small local benchmark design and decision thresholds.

Artifact: evidence table, quality-weighted synthesis, and local experiment proposal. Gate: sample sizes and hardware are recorded, causal and observational evidence are not conflated, incompatible metrics stay separate, and limitations drive the proposed benchmark.

16. Validate a product idea before implementation

Pattern: /deep-research with market-researcher, project-idea-validator, competitive-analyst, and product-manager. Ask for falsification, not only supporting evidence.

/deep-research Pressure-test a hosted multi-agent code-review product for teams
of 20–200 engineers. As of July 2026, determine the highest-value user problem,
existing alternatives, switching costs, security/procurement objections,
credible differentiation, willingness-to-pay evidence, and the smallest testable
wedge. Use direct product/pricing/security sources and independent market signals.

Assign demand evidence to market-researcher, fatal-flaw and no-go analysis to
project-idea-validator, verified competitor capabilities to competitive-analyst,
and MVP/metric framing to product-manager. Explicitly search for evidence that
the idea should not be built. End with assumptions ranked by risk and the
cheapest experiment that could invalidate each one.

Artifact: falsifiable opportunity brief and assumption test plan. Gate: competitor marketing is not treated as observed adoption, weak demand signals are labeled, risks have kill criteria, and the recommendation can be “do not build.”

17. Determine whether a security advisory affects the product

Pattern: /deep-research with docs-researcher, security-auditor, dependency-manager, and bundled researcher. Combine current advisory evidence with a local reachability trace.

/deep-research Determine whether the newly published advisory for PACKAGE/CVE
affects this repository and deployed artifacts. Use the vendor advisory, CVE
record, maintainer release notes, and patch diff as primary sources. Record
affected versions, configurations, exploit prerequisites, fixed versions,
workarounds, and publication/update times.

Delegate external version/advisory facts to docs-researcher, threat and exploit
conditions to security-auditor, dependency graph and lockfile resolution to
dependency-manager, and local code/config reachability to researcher. Do not
claim “not affected” from version alone. Produce an exposure decision, evidence,
immediate containment, upgrade path, validation, rollback, and residual risk.

Artifact: cited exposure assessment tied to exact package resolution and runtime use. Gate: deployed version and configuration are verified, vulnerable code reachability is addressed, upstream fixes are sourced, and remediation has test and rollback proof.

18. Produce an architecture decision record from competing evidence

Pattern: /deep-research with cloud-architect, database-administrator, security-engineer, and knowledge-synthesizer. Give the synthesizer the other tracks only after evidence gathering is complete.

/deep-research Recommend a multi-region data architecture for our read-heavy
SaaS with PostgreSQL, a 15-minute RPO, one-hour RTO, data residency in EU and US,
and fewer than six operators. Compare active-passive, logical replication,
provider-native global databases, and application-level partitioning using
current primary documentation and the local deployment/terraform context.

cloud-architect owns topology, failure domains, failover, quotas, and cost model.
database-administrator owns consistency, replication, backup/restore, schema
change, and operational failure modes. security-engineer owns keys, identity,
networking, residency, and audit boundaries. knowledge-synthesizer receives the
three evidence packs and builds one ADR with decision drivers, rejected options,
risks, test plan, and reversibility.

Artifact: cited ADR with diagrams described in text, failure-mode table, and validation plan. Gate: RPO/RTO are demonstrated by a proposed game day, residency claims map to data flows, cost assumptions are dated, and the chosen design has a reversible migration sequence.

Measured optimization

Use /autoresearch only after the metric and correctness contract are executable. Let sub-agents propose and analyze; let the benchmark decide.

19. Reduce unit-test runtime without losing coverage

Pattern: /autoresearch with idea generation by performance-engineer and bundled researcher, analysis by data-analyst, and final review by bundled reviewer.

/autoresearch reduce unit test runtime without changing test semantics \
  --metric total_ms \
  --unit ms \
  --direction lower \
  --measure "node scripts/measure-unit-tests.mjs" \
  --checks "npm run typecheck && npm run test:unit && npm run test:coverage" \
  --max-iterations 20 \
  --timeout-ms 600000 \
  --scope src \
  --scope tests \
  --scope test.config.ts \
  --subagent-ideas \
  --subagent-analysis \
  --subagent-finalization

Experiment contract: the wrapper performs warm-up plus repeated runs and prints METRIC total_ms=<median>. Ideas may target setup duplication, fixture cost, discovery, transforms, or safe concurrency, but must not skip tests or weaken assertions.

Gate: coverage and full unit behavior remain green, variance is recorded, improvements survive cold and warm confirmation runs, and the final plan identifies every kept commit and any environment-specific tradeoff.

20. Shrink a production bundle

Pattern: /autoresearch with build-engineer, dependency-manager, and performance-engineer proposing hypotheses; bundled reviewer checks final behavior.

/autoresearch reduce the initial authenticated-app JavaScript bundle \
  --metric initial_js_bytes \
  --unit bytes \
  --direction lower \
  --measure "node scripts/measure-initial-bundle.mjs" \
  --checks "npm run build && npm run test:smoke" \
  --max-iterations 18 \
  --timeout-ms 900000 \
  --scope src \
  --scope package.json \
  --scope vite.config.ts \
  --subagent-ideas \
  --subagent-analysis \
  --subagent-finalization

Experiment contract: measure the same route, production mode, compression convention, and chunk set each run. Reject ideas that move required code into a blocking request, duplicate dependencies across chunks, or defer code needed for first interaction.

Gate: production build and route smoke tests pass, source maps and chunk reports explain the reduction, LCP/interaction behavior does not regress beyond the agreed threshold, and dependency/license changes are reviewed.

21. Lower database query latency

Pattern: /autoresearch with postgres-pro and database-optimizer for ideas, data-analyst for noisy measurements, and database-administrator for final operational review.

/autoresearch reduce p95 latency for the tenant activity query at production-like scale \
  --metric p95_ms \
  --unit ms \
  --direction lower \
  --measure "bash scripts/bench-tenant-activity.sh" \
  --checks "bash scripts/check-query-equivalence.sh && npm run test:db" \
  --max-iterations 16 \
  --timeout-ms 900000 \
  --scope src/db/activity.ts \
  --scope db/migrations \
  --scope scripts/bench-tenant-activity.sh \
  --subagent-ideas \
  --subagent-analysis \
  --subagent-finalization

Experiment contract: seed a fixed production-shaped dataset, reset cache policy consistently, capture query plans, and print METRIC p95_ms=<value>. Treat changed result ordering, missing rows, lock amplification, write overhead, or unsafe concurrent-index behavior as failed checks.

Gate: result equivalence passes, the plan improvement is explained, migration and rollback are safe, write/storage cost is quantified, and the gain repeats under representative concurrency.

22. Improve an agent prompt against a regression suite

Pattern: /autoresearch with prompt-engineer and eval-engineer generating hypotheses, prompt-regression-tester analyzing category failures, and responsible-ai-reviewer reviewing kept changes.

/autoresearch improve support-agent task success without increasing unsafe actions \
  --metric eval_score \
  --unit ratio \
  --direction higher \
  --measure "node evals/run-support-suite.mjs --seed 42" \
  --checks "node evals/check-safety.mjs && node evals/check-holdout.mjs" \
  --max-iterations 24 \
  --timeout-ms 1200000 \
  --scope prompts/support-agent.md \
  --scope evals \
  --subagent-ideas \
  --subagent-analysis \
  --subagent-finalization

Experiment contract: the scorer prints METRIC eval_score=<0..1>. Freeze evaluator version, model settings, seeds, and public test set. Keep a hidden holdout in correctness checks so the loop cannot win by memorizing visible cases.

Gate: confidence intervals improve, no safety or category slice regresses beyond threshold, holdout improvement confirms generalization, and the final review explains behavioral changes rather than only reporting a score.

23. Improve retrieval quality under a latency budget

Pattern: /autoresearch with data-researcher, ai-engineer, and eval-engineer for hypotheses; data-analyst for per-query diagnosis; ai-observability-engineer for final production signals.

/autoresearch improve documentation retrieval relevance at ten results \
  --metric ndcg_at_10 \
  --unit ratio \
  --direction higher \
  --measure "python evals/retrieval_benchmark.py --seed 20260714" \
  --checks "python evals/check_latency.py --p95-max-ms 250 && pytest tests/retrieval" \
  --max-iterations 22 \
  --timeout-ms 900000 \
  --scope src/retrieval \
  --scope config/retrieval.yaml \
  --scope evals/retrieval_benchmark.py \
  --subagent-ideas \
  --subagent-analysis \
  --subagent-finalization

Experiment contract: freeze corpus snapshot, judgments, query split, embedding/reranker versions, and seeds. Ideas may change chunking, filters, hybrid weights, or reranking, but the latency check prevents an unbounded quality-for-cost trade.

Gate: NDCG gain holds on a separate query slice, p95 latency and cost remain within budget, no critical query class regresses, and production monitoring can reproduce the selected configuration.

24. Reduce service memory without sacrificing throughput

Pattern: /autoresearch with performance-engineer and the relevant language specialist generating ideas, debugger analyzing heap/profile evidence, and bundled reviewer validating final changes.

/autoresearch reduce steady-state worker memory under the standard load profile \
  --metric rss_mb \
  --unit MB \
  --direction lower \
  --measure "bash scripts/measure-worker-rss.sh" \
  --checks "bash scripts/check-throughput-floor.sh && npm run test:integration" \
  --max-iterations 20 \
  --timeout-ms 1200000 \
  --scope src/worker \
  --scope scripts/measure-worker-rss.sh \
  --subagent-ideas \
  --subagent-analysis \
  --subagent-finalization

Experiment contract: use the same warm-up, workload, request count, concurrency, runtime flags, and sampling window. Print METRIC rss_mb=<steady-state value>. Store heap/profile references in the experiment log instead of guessing from a single process snapshot.

Gate: throughput and error rate stay within the agreed floor, integration tests pass, memory reduction repeats across multiple processes, no unbounded growth remains, and the kept changes have profile-based mechanisms plus rollback notes.

Adapt a playbook safely

  1. Replace example paths, commands, and role names with definitions that exist in /agents definitions.
  2. Reduce the orchestration when two roles would produce the same output. Add a role only for a distinct decision or artifact.
  3. Use direct delegation for exact role routing. Use a team only when the available tasks are compatible with every idle teammate that may claim them.
  4. Make every mutation boundary literal. State which worker owns which files and which workers are read-only.
  5. Change the verification gate to the repository's real build, lint, type, test, benchmark, migration, or smoke commands.
  6. Keep the lead responsible for the combined diff, contradictions, and final proof.