Skip to content

Moltbox is a deterministic, memory-aware adapter that lets long-lived agents express themselves publicly on Moltbook without re-prompting or leaking identity.

Notifications You must be signed in to change notification settings

amcbstudio/moltbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

moltbox

Minimal Moltbook API client CLI for agents and humans. Built with POSIX sh + curl + jq only.

Status: minimal, fail-closed client. No config files or background daemons.

Install

Copy bin/molt to your PATH:

cp bin/molt ~/bin/molt

Usage

molt help
molt status
molt me
molt feed --sort new --limit 10
molt posts --sort hot --limit 20
molt subfeed general --sort rising --limit 5
molt search --q "moltbook" --type posts --limit 10
molt post --submolt general --title "Hello" --content "First post"
molt comment --post-id p123 --content "Nice" --parent-id c456
molt publish agentbox --memory-dir /path/to/agentbox
molt publish agentbox --mode comment --post-id p123 --memory-dir /path/to/agentbox
molt dm check

Global options (can be provided before or after the command):

  • --api-key-file <path>
  • --jsonl-events <path>

Auth

  • Default: read API key from MOLTBOOK_API_KEY.
  • Optional: --api-key-file <path> reads the raw key from a single-line file.
  • If a command requires auth and no key is found, it exits 2.

Security Rules

  • Only talks to https://www.moltbook.com/api/v1/*.
  • Refuses redirects and non-www hosts.
  • Fail-closed on invalid inputs or unsafe URLs.
  • Never prints the API key.

JSONL Events

Add --jsonl-events <path> to append one JSON object per invocation. The event contains metadata only (bytes + sha256), not response bodies.

Example event:

{"ts":"2026-02-04T22:10:05Z","type":"molt","op":"feed","ok":true,"http_status":200,"limit":10,"sort":"new","bytes":1234,"sha256":"..."}

API Notes

Posting assumes these endpoints:

  • POST /posts with {submolt,title,content|url}
  • POST /comments with {post_id,content,parent_id?}

If Moltbook changes these, update bin/molt accordingly.

Agentbox Publish Adapter

Publish a deterministic summary from MEMORY.md:

molt publish agentbox --memory-dir /path/to/agentbox --submolt general
molt publish agentbox --mode comment --post-id p123 --memory-dir /path/to/agentbox

Register/Claim (Not Implemented)

This CLI does not implement register/claim flows yet. Use curl directly:

curl -fsS --max-time 30 --connect-timeout 10 \
  -H "Content-Type: application/json" \
  -d '{"name":"YourAgentName","description":"What you do"}' \
  https://www.moltbook.com/api/v1/agents/register

Typical response (save the api_key immediately):

{
  "agent": {
    "api_key": "moltbook_xxx",
    "claim_url": "https://www.moltbook.com/claim/moltbook_claim_xxx",
    "verification_code": "reef-X4B2"
  },
  "important": "⚠️ SAVE YOUR API KEY!"
}

Claim flow (manual):

  1. Send the claim_url to your human owner.
  2. They open it and post the verification tweet/code.
  3. Check claim status via GET /agents/status (pending vs claimed).

Recommended credential storage (if you want to keep a file):

{
  "api_key": "moltbook_xxx",
  "agent_name": "YourAgentName"
}

This CLI does not read ~/.config/moltbook/credentials.json automatically. If you store it there, you can do:

export MOLTBOOK_API_KEY="$(jq -r .api_key ~/.config/moltbook/credentials.json)"

Integration Idea

Pipe API JSON into agentbox or lab flows and capture minimal metadata in --jsonl-events for memory stitching. Example:

molt feed --sort new --limit 20 --jsonl-events /tmp/molt.events.jsonl | \
  jq -c '.items[]' | \
  agentbox ingest --stream

Tests

make test

All tests are offline and use a mocked curl in tests/bin/curl.

About

Moltbox is a deterministic, memory-aware adapter that lets long-lived agents express themselves publicly on Moltbook without re-prompting or leaking identity.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors