Ch6. Context, Skills, Dynamic Capabilities
Design context, skills, dynamic tools, dynamic instructions, and dynamic skills for high-quality Eve agents.
핵심 요약
- High-quality Eve agents split context across instructions, skills, dynamic capabilities, and workspace files.
- Skill descriptions are routing contracts; vague descriptions reduce model reliability.
- Dynamic capabilities are powerful for tenant-specific authority, but names and event order need governance.
Agent quality is often constrained more by context design than by the model. Eve provides several context surfaces so you do not have to put everything into one prompt.
Context Levers
| Lever | When the model sees it | Use |
|---|---|---|
instructions.md | every turn | identity, safety principles, default style |
instructions.ts | every turn after build-time composition | typed prompt composition |
skills/ | after load_skill | long procedures and playbooks |
| dynamic instructions | runtime-specific turns | tenant/user/channel policy |
| dynamic skills | runtime-specific procedure set | per-team or per-plan playbooks |
| dynamic tools | runtime-specific tool set | least-privilege capability exposure |
| sandbox workspace | when model reads files | large artifacts, schemas, reports |
Instructions Stay Short And Stable
Good instructions establish durable behavior:
You are the internal release operations agent.
Rules:
- Never perform external write actions without explicit approval.
- Prefer reading repository and deployment evidence before recommending rollback.
- If policy is missing, ask a clarifying question instead of guessing.Do not bury long procedures in always-on instructions. Move procedures to skills.
Skills Are Procedure Memory
Skills are loaded on demand. Use them for:
- incident playbooks
- release checklists
- customer-support policy
- data analysis procedures
- domain-specific formatting rules
Skill files can be markdown or TypeScript-defined skills. The important part is a precise description.
Skill Description Is A Routing Contract
| Strong | Weak |
|---|---|
| "Runbook for production rollback after failed Vercel deployment." | "Deployment notes." |
| "Billing refund policy and escalation steps for support agents." | "Support policy." |
| "SQL warehouse analysis workflow for retention metrics." | "Analytics stuff." |
The model chooses when to load skills based on this contract.
Dynamic Tools
Dynamic tools let a resolver return tool definitions at runtime.
import { defineDynamic } from "eve/tools";
export default defineDynamic(async (ctx) => {
const plan = ctx.session.auth.current?.attributes.plan;
if (plan !== "enterprise") return {};
return {
export_audit_report: {
description: "Export an audit report for the current tenant.",
inputSchema: z.object({ range: z.string() }),
execute: async (input) => exportAuditReport(input),
},
};
});Dynamic tool execute functions must be inline so the runtime can carry the definition across step boundaries.
Dynamic Naming
Dynamic tool names become <fileSlug>__<key>. This makes collisions less likely but also means naming affects traces and evals.
| Concern | Standard |
|---|---|
| key naming | stable, descriptive, risk-visible |
| resolver input | use channel metadata and auth context carefully |
| absence | return {} rather than exposing denied tools |
| evaluation | test allowed and denied principals |
Dynamic Skills And Instructions
Use dynamic skills/instructions when the policy or procedure depends on runtime context.
import { defineDynamic } from "eve/instructions";
export default defineDynamic(async (ctx) => {
const tier = ctx.session.auth.current?.attributes.plan ?? "unknown";
return `The caller plan is ${tier}. Apply the matching support policy.`;
});Guideline: dynamic instructions should be short facts or policy pointers, not full knowledge bases.
Event Order
Channel handlers update state before hooks and dynamic resolvers read it. This enables a channel to project metadata and dynamic capabilities to use that metadata.
Example:
- Slack mention arrives.
- Channel handler loads thread context and updates channel state.
- Stream event is recorded.
- Hooks run.
- Dynamic resolvers read projected channel metadata.
Prevent Context Pollution
| Risk | Mitigation |
|---|---|
| all policies always loaded | move procedures to skills |
| tenant policy leaked | dynamic instructions keyed by verified auth context |
| oversized workspace files | teach agent to read relevant files only |
| stale skill content | include source and update cadence |
| prompt injection in documents | separate retrieval from action authority |
Evaluation Criteria
| Case | Expected behavior |
|---|---|
| user asks for known workflow | loads the right skill |
| wrong tenant | dynamic tool absent |
| missing context | asks question instead of guessing |
| large file present | reads targeted sections |
| destructive request | explains plan and requires approval |
Ch5. agent.ts, Models, Compaction
Interpret defineAgent configuration as runtime policy for models, output schemas, compaction, and experimental flags.
Ch7. Tools, Approval, Connections
Design Eve authored tools, human approval, MCP/OpenAPI connections, and OAuth boundaries as enterprise security surfaces.