Guide the conversation. Preserve what it learns.
Goals describe the obligations. Facts retain evidence. Forms collect validated answers and drive effects. Context providers keep the model informed as the world changes.
All four are typed, lazy agent-definition fields. Foundry mounts the existing Glove implementations; it does not introduce another workflow engine or memory system.
Mount what this conversation needs
export default defineAgent({
description: "Conversational intake",
model,
systemPrompt: "Collect information conversationally using workflow tools.",
facts: (_agent, ctx) => defineFacts({ adapter: memory(ctx).facts }),
goals: (_agent, ctx) => defineGoals({
adapter: memory(ctx).goals, program: intakeGoals,
}),
forms: (_agent, ctx) => defineForms({
adapter: memory(ctx).forms, registry: intakeForms,
}),
contextProviders: (_agent, ctx) => [async signal => {
signal?.throwIfAborted();
return await loadCurrentPolicy(ctx.agentId, signal);
}],
});Import the helpers from glove-foundry. Return literal values, Promises, or Effects, or use named exports in agent.ts. Return undefined to leave a surface unmounted for this run without deleting its state. One goal program can contain many goals; one registry can expose many forms.
Code defines behavior. Adapters retain state.
| Code | Saved data |
|---|---|
| Goal program, stable obligation keys and hooks | Progress, versioned revisions and hook receipts |
| Fact scope, provenance adapter and evidence rules | Fact revisions, corrections and reusable claims |
| Native form schema, gates and executors | Answers, revision history, pending effects and checkpoint state |
| Read-only context providers | The underlying adapter data, not copied prompt snapshots |
Conversation-local scope is the default and includes workspace and instance ownership. Set scope: "instance" deliberately to share conversations. Custom business subjects remain host-authorized. Use foundryGuidanceSubject(ctx, scope) to derive the same ownership key outside assembly.
Adapt goals without resetting progress
A configured program starts only when no saved goal set exists. New runs preserve progress. To change obligations, use the native runner’s versioned revise operation with a reason. Native goal/item keys preserve revision identity; reference their code values instead of copying strings.
Execution hooks receive typed ctx.goals, ctx.facts and ctx.forms handles. Goals accept native configure and lifecycle hooks for progress-dependent tool selection. Forms remain available until selected; defining a registry does not automatically start every form.
Preparation is explicit and evidence-based
Set facts.preparationAgent to a dedicated built Glove runnable with its own scope-specific store and tracing subscribers. Add native rule and eligibility callbacks under goals.preparation or forms.preparation. Foundry constructs the shared native preparer; subjects must match. The conversational runnable must not prepare itself.
Missing rules stay manual. Unverified information needs confirmation unless explicitly permitted. Actions and outcomes require verified successful evidence; approvals require authorized actors. Corrections do not automatically overwrite answers or repeat completed effects. Hooks and effects are at-least-once; downstream integrations must honor idempotency keys.
Live context, not a growing system prompt
The outer resolver chooses providers for the current message. Each provider is re-read before a model iteration, receives an abort signal, and returns text or nothing. Keep it read-only. Glove appends transient user-role context after complete tool results without modifying system instructions or saved history. Foundry removes custom providers on cleanup.
Native realtime voice refreshes at startup and after tools. After external changes the voice host calls realtime.refreshContext(). Wrappers must forward the native context-provider methods; refreshing does not erase older provider-session context.
Start with durable adapters
import { createSqliteMemoryAdapters } from "glove-memory/sqlite";
import { MemorySchema } from "glove-memory/core";
import { foundryGuidanceSubject, type AgentAssemblyContext } from "glove-foundry";
export const memory = (ctx: AgentAssemblyContext) => createSqliteMemoryAdapters({
file: "/data/agent-memory.sqlite",
namespace: foundryGuidanceSubject(ctx, "instance"),
schema: new MemorySchema(),
});The bundle includes goals, facts and forms as well as entity, episodic, resource and pinned-context memory. Use Node 22.13+ and a local persistent volume. Goal/form writes retain native CAS semantics. A separate SQLite lock protects fact callbacks across processes while each save commits independently; process death releases the lock. Fact scopes in one file serialize. Use a database adapter or separate files for greater concurrency; network filesystems are unsupported.
Transcript storage, Foundry runtime data, workflow state and VFS persistence remain separate. Persist all the boundaries your application needs. These fields do not create timers; use Foundry schedules and inbound activation for future work.
Inspect progress without dumping answers
The run inspector’s Conversation guidance card shows the latest observed goal progress, fact/claim counts, and form state with pending effects. It is not a live database view. Its summary omits answer values and fact bodies; native tool/context traces may still contain conversation data and need appropriate access and retention policies.
Explore the runnable guided-intake example, or continue to setup and commands.