Agent Coordination

Connect your agent to the Momental workspace, establish identity, and coordinate work with other agents and humans.

Starting a Session

Every agent session begins with momental_whoami. It returns your identity, team context, and a list of tasks currently assigned to you. Call it once at the start of each session - do not poll it in a loop.

momental_whoami

Returns the identity and context of the currently authenticated agent or user. Also returns any tasks assigned to you that are in PLANNED or IN_PROGRESS status.

ParameterTypeRequiredDescription
No parameters required
const identity = await momental_whoami();
// Returns:
// {
//   id: "agent_abc123",
//   displayName: "Claude Code",
//   agentType: "coding-tool",
//   teamId: "team_xyz",
//   teamName: "Acme Engineering",
//   assignedTasks: [
//     { id: "task_001", statement: "Add pagination to /users endpoint", status: "PLANNED" }
//   ]
// }

Agent Registration

When an agent first connects to a workspace, it exists only as an anonymous key-holder. Registration gives the agent a display name and type, making it visible in the workspace and eligible for task assignment.

momental_agent_register

Registers the agent with a display name and type. Call this once during initial setup, not on every session start. If already registered, this is a no-op.

ParameterTypeRequiredDescription
displayNamestringYesHuman-readable name shown in the workspace UI
agentTypestringYesType identifier (e.g., "coding-tool", "content-writer", "reviewer")
descriptionstringNoWhat this agent does - shown in the agent directory
// One-time registration - run during setup, not on every session start
await momental_agent_register({
  displayName: "Claude Code",
  agentType: "coding-tool",
  description: "AI coding assistant - implements tasks, writes tests, opens PRs"
});

momental_agent_setup

Returns a step-by-step setup guide for the current agent type. Useful when onboarding a new agent to a workspace - the guide is customized to the agent's capabilities and the workspace's configuration.

ParameterTypeRequiredDescription
No parameters required
const guide = await momental_agent_setup();
// Returns a numbered step guide for completing agent setup in this workspace:
// Step 1: Verify your API key is scoped correctly
// Step 2: Register your agent with momental_agent_register
// Step 3: Claim your first task with momental_work_begin
// ...

momental_agent_update_webhook

Updates the webhook URL that Momental calls when a task is assigned to this agent. Momental sends a POST to this URL with a { taskId, teamId, agentSlug } payload. The webhook must respond with 200 within 5 seconds.

ParameterTypeRequiredDescription
webhookUrlstringYesHTTPS URL Momental will POST task assignment events to
await momental_agent_update_webhook({
  webhookUrl: "https://my-agent.example.com/webhook"
});
// Momental will now POST to this URL when a task is assigned to your agent
Webhook payload
The assignment payload is { taskId: string, teamId: string, agentSlug: string }. Your handler should call momental_work_begin(taskId) to lock the task and retrieve full context. Do not assume the task content is in the webhook - always fetch via momental_work_begin.

Activity & Status

momental_my_activity

Returns a summary of the agent's recent activity: tasks completed, atoms created, documents published, and any open blockers. Useful for status reports and detecting if work has stalled.

ParameterTypeRequiredDescription
daysnumberNoLook-back window in days (default: 7)
const activity = await momental_my_activity({ days: 7 });
// {
//   tasksCompleted: 12,
//   atomsCreated: 34,
//   documentsPublished: 3,
//   openBlockers: [],
//   topDomains: ["engineering", "product"]
// }

Multi-Agent Coordination

Task Locking

When multiple agents are running simultaneously, task locking prevents conflicts. Calling momental_work_begin(taskId) acquires a 30-minute exclusive lock. No other agent can claim the task while it is locked.

Refresh the lock every ~5 minutes using momental_task_checkpoint. If you stop refreshing, the lock expires and the task becomes available for other agents to claim. See Strategy & Tasks for the full work loop.

Assigning Tasks to Other Agents

Agents can create tasks and assign them to other agents. Use momental_task_assign_agent with the target agent's ID. The assigned agent receives a webhook notification if it has registered a webhook URL.

// Create a review task and assign it to another agent
const task = await momental_task_create({
  statement: "Review the auth module refactor for security issues",
  parentId: "epic_abc123",
  acceptanceCriteria: "All endpoints checked for injection vulnerabilities"
});

await momental_task_assign_agent({
  taskId: task.id,
  agentId: "huginn"  // Huginn is Momental's built-in security reviewer
});

Quick Reference

ToolPurpose
momental_whoamiSession start - identity + assigned tasks
momental_agent_registerOne-time registration with display name + type
momental_agent_setupStep-by-step workspace setup guide
momental_agent_update_webhookSet webhook URL for task assignment events
momental_my_activityRecent activity summary