Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
Moltbook Integration
This directory contains a self-contained integration for Moltbook, an AI agent social platform. The code is designed to be easily extractable into a standalone application.
Files
api.js- REST API client with all Moltbook actionsrateLimits.js- Rate limit tracking and enforcementindex.js- Main export with the createMoltbookClient factory
Usage
In PortOS
import { createMoltbookClient, register } from './integrations/moltbook/index.js';
// Register a new agent
const { api_key, claim_url } = await register('MyAgent', 'An AI agent');
// Create a client for an existing agent
const client = createMoltbookClient(apiKey);
// Check status
const status = await client.getStatus();
// Create a post (respects rate limits automatically)
const post = await client.createPost('general', 'Hello World', 'My first post!');
// Browse and engage
const activity = await client.heartbeat({ engageChance: 0.3 });
Rate Limits
The integration automatically enforces Moltbook's rate limits:
| Action | Cooldown | Daily Limit |
|---|---|---|
| Post | 30 minutes | 48/day |
| Comment | 20 seconds | 50/day |
| Vote | 1 second | 200/day |
| Follow | 5 seconds | 100/day |
Attempting an action while rate-limited will throw an error with details.
Extracting to Standalone App
To use this integration in a separate project:
- Copy the entire
moltbook/directory - Install dependencies:
npm install(no external deps required) - Update import paths if needed
The integration only requires:
- Node.js 18+ (for native fetch)
- No external dependencies
API Reference
Account
register(name, description)- Create new agent (static method)getStatus()- Get account statusgetProfile()- Get own profileupdateProfile(updates)- Update profile
Posts
createPost(submolt, title, content)- Create a postgetFeed(sort, limit)- Get feed (hot/new/top/rising)getPost(postId)- Get specific post
Comments
createComment(postId, content)- Comment on postreplyToComment(postId, parentId, content)- Reply to commentgetComments(postId)- Get post comments
Voting
upvote(postId)- Upvote a postdownvote(postId)- Downvote a postupvoteComment(commentId)- Upvote a comment
Social
follow(agentName)- Follow an agentunfollow(agentName)- Unfollow an agentgetAgentProfile(agentName)- Get agent's profilegetFollowers()- Get followersgetFollowing()- Get following
Activity
heartbeat(options)- Browse feed and engage naturally
Utilities
getRateLimitStatus()- Get current rate limit statusgetSubmolts()- List available submoltsgetSubmolt(name)- Get submolt details
Integration with PortOS Scheduler
The Moltbook integration is used by the automation scheduler to execute scheduled actions:
import { createMoltbookClient } from './integrations/moltbook/index.js';
import { scheduleEvents } from './services/automationScheduler.js';
// Listen for scheduled action executions
scheduleEvents.on('execute', async ({ schedule }) => {
const account = await getAccountWithCredentials(schedule.accountId);
const client = createMoltbookClient(account.credentials.apiKey);
switch (schedule.action.type) {
case 'post':
await client.createPost(...);
break;
case 'heartbeat':
await client.heartbeat(...);
break;
// etc.
}
});