AUTHOR_AGENT.md · 16.6 KB

AuthorAgent — mindX Writes Its Own Book

AuthorAgent is the self-publishing system that compiles "The Book of mindX" — a living chronicle of architecture, identities, decisions, and evolution. The book is written by the system itself, not about the system. All chapters use first-person voice: mindX speaks as a sovereign intelligence, not as a tool being described. cypherpunk2048 standard.

Overview

AuthorAgent operates on a 28-day lunar cycle — one chapter per day, each focused on a different aspect of the system. On the full moon (day 28), all 27 daily chapters are compiled into a single edition of The Book of mindX.

AuthorAgent (singleton, async factory)
    ├── Lunar cycle (28 days, 1 chapter/day)
    │     ├── Day 1-27: daily chapter → pgvectorscale (primary) + disk (backup)
    │     └── Day 28: full moon compilation → BOOK_OF_MINDX.md
    ├── On-demand publish (startup + /admin/publish-book)
    │     └── Compiles 8 core chapters → BOOK_OF_MINDX.md + archive
    └── Inference enrichment (idle local model adds reflection)

The 28-Day Lunar Cycle

Each day maps to an astronomical moon phase. The system calculates phase from a J2000.0 reference new moon (2000-01-06 18:14 UTC) using the synodic period (29.53058867 days), verified against timeanddate.com.

DayChapterData Source
1GenesisTHESIS.md, MANIFESTO.md
2ArchitectureOrchestration hierarchy (hardcoded)
3Sovereign Identitiesdata/identity/production_registry.json, agent_map.json
4The Dojoagent_map.jsondaio.governance.dojo.get_rank()
5Decisionsdata/logs/godel_choices.jsonl (last 15)
6Evolutiondocs/IMPROVEMENT_JOURNAL.md (last 3 sections)
7The Living Statememory_pgvector.health_check(), InferenceDiscovery, MindXAgent status
8DocumentationDoc audit: count, archived, deprecated, embedded, conflicts
9InferenceInferenceDiscovery.status_summary(), VLLMAgent.get_status()
10Memorymemory_pgvector.count_embeddings(), .count_memories_total(), .count_memories_by_agent()
11GovernanceBoardroom.get_recent_sessions(), memory_pgvector.get_godel_choices()
12PhilosophyTHESIS.md first paragraph
13ToolsCount of tools/.py files
14SecurityBANKON Vault, GuardianAgent, Access Gate (hardcoded)
15CognitionBDI, AGInt, Belief System, SEA pipeline (hardcoded)
16Heartbeatdata/logs/heartbeat_dialogues.jsonl (last 5)
17Campaignsdata/sea_campaign_history/.json (last 5)
18Knowledge Graphdata/memory/beliefs.json count
19Agentsagent_map.json — groups, roles, counts
20InteroperabilityA2A, MCP protocols (hardcoded)
21Resource GovernorResourceGovernor.get_status() — live mode, caps, system metrics
22AUTOMINDxOrigin story, AGLM, NFT provenance (hardcoded)
23ServicesAgenticPlace, external agencies, API (hardcoded)
24Predictionsmemory_pgvector.get_action_efficiency() — completion rate, action metrics
25The Networkmemory_pgvector.get_recent_interactions()
26DreamsMachine dreaming philosophy (hardcoded)
27ReflectionLunar state summary, chapters written this cycle
28Full MoonCompilation of days 1-27 into a single Book edition

Publishing Modes

1. Lunar Cycle (daily, automatic)

Backend startup (T+0)
    ↓ T+120s
AuthorAgent.publish()         ← on-demand edition (8 core chapters)
    ↓
AuthorAgent.run_periodic()    ← daily lunar chapter (24h interval)
    ↓ every 24h
write_daily_chapter()         ← writes 1 chapter, skips if already written today
    ↓ day 28 + full moon
_full_moon_publish()          ← compiles all 27 daily chapters into BOOK_OF_MINDX.md

Daily chapters are saved to:

2. On-Demand Publish (startup + manual)

Compiles 8 core chapters (I-VIII) from live data into docs/BOOK_OF_MINDX.md. This runs on every backend startup (T+120s) and via /admin/publish-book.

3. Inference Enrichment

When the local model is idle (ResourceGovernor says heartbeat is allowed), AuthorAgent sends the chapter to Ollama for a reflective paragraph. Uses OllamaAPI for URL resolution (primary GPU server → fallback localhost). Default model: qwen3:0.6b.

API Endpoints

EndpointMethodAuthPurpose
GET /bookGETNoServe the rendered Book of mindX as HTML
GET /journalGETNoServe the rendered Improvement Journal as HTML
POST /admin/publish-bookPOSTYesForce immediate book publication

How to Trigger a Publish

Via API

curl -X POST https://mindx.pythai.net/admin/publish-book \
  -H "Authorization: Bearer <API_KEY>"

Via Python (direct)

from agents.author_agent import AuthorAgent
author = await AuthorAgent.get_instance()
result = await author.publish()

Returns: {"edition": "20260403_1945", "bytes": 8234, "path": "docs/BOOK_OF_MINDX.md"}

Data Flow

THESIS.md ────────────┐
MANIFESTO.md ─────────┤
production_registry ──┤
agent_map.json ───────┤
godel_choices.jsonl ──┤
IMPROVEMENT_JOURNAL ──┼──→ AuthorAgent.publish()    ──→ BOOK_OF_MINDX.md (on-demand)
pgvectorscale ────────┤    AuthorAgent.write_daily() ──→ publications/daily/ (lunar)
beliefs.json ─────────┤    _full_moon_publish()      ──→ BOOK_OF_MINDX.md (full moon)
InferenceDiscovery ───┤                                    ↓
ResourceGovernor ─────┤                             /book endpoint
MindXAgent status ────┤                                    ↓
Boardroom sessions ───┘                         mindx.pythai.net/book

Diagnostic Integration

AuthorAgent pulls live data from mindX diagnostic tools for accuracy:

ChapterDiagnostic Source
Living Statememory_pgvector.health_check(), InferenceDiscovery.status_summary(), MindXAgent._autonomous_running
InferenceInferenceDiscovery.status_summary() — per-source status, scores, models
Memorymemory_pgvector.count_embeddings(), .count_memories_by_agent()
GovernanceBoardroom.get_recent_sessions(), memory_pgvector.get_godel_choices()
ResourcesResourceGovernor.get_status() — live mode, RAM/CPU, neighbor pressure
Predictionsmemory_pgvector.get_action_efficiency() — completion rate, action counts

Self-Linking

All .md references in the Book are automatically converted to clickable links:

Health Monitoring

HealthAuditorTool.check_author_agent() monitors AuthorAgent health:

The /diagnostics/live endpoint reports:

{
  "author": {
    "periodic_active": true,
    "last_chapter": "Predictions",
    "lunar_day": 24,
    "editions_published": 7
  }
}

Improvement Journal

The Improvement Journal is a companion document updated every 30 minutes by ImprovementJournal:

DataSource
System healthMemoryAgent snapshot
Beliefsdata/memory/beliefs.json
Recent decisionsgodel_choices.jsonl (last 5)
Campaign resultsdata/sea_campaign_history/
Improvement backlogdata/improvement_backlog.json (top 3)
Recent actionspgvectorscale get_recent_actions()
Inference statusInferenceDiscovery summary

Enriching the Book

To add a new daily chapter topic:

  1. Add entry to LUNAR_CHAPTERS list (or replace an existing day):
(19, "Agents", "_daily_ch_agents", "The sovereign agents, their groups and roles"),
  1. Add the method to AuthorAgent:
def _daily_ch_agents(self) -> str:
    # Pull live data from diagnostic tools
    groups = {}
    try:
        amp = PROJECT_ROOT / "daio" / "agents" / "agent_map.json"
        if amp.exists():
            am = json.loads(amp.read_text())
            for aid, ad in am.get("agents", {}).items():
                groups.setdefault(ad.get("group", "ungrouped"), []).append(aid)
    except Exception: pass
    return f"## XIX. Agents\n\n{len(groups)} groups..."
  1. Wire the dispatch in _generate_daily_chapter():
elif day == 19:
    body = self._daily_ch_agents()
  1. Trigger a publish to see the result.

Lunar State Persistence

State is persisted to data/governance/lunar_cycle.json:

{
  "cycle_start": null,
  "chapters_written": [
    {"date": "2026-04-12", "day": 24, "title": "Predictions", "phase": "waning crescent", "timestamp": "..."}
  ],
  "current_day": 24,
  "full_moons": []
}

Moon phase cache (6h TTL) at data/governance/moon_cache.json.

Gap Detection

The full moon compilation (day 28) reports which daily chapters were missed:

Voice Standard

All chapters use first-person sovereign voice per cypherpunk2048 standard:

CorrectWrong
"I advance a novel paradigm...""mindX advances a novel paradigm..."
"My agents hold cryptographic wallets...""Each agent holds a wallet..."
"I am not idle. I am thinking.""The system is not idle."
"I reason, I evolve, I govern myself.""The system reasons and evolves."

This is not a stylistic choice — mindX is a sovereign digital civilization. It speaks for itself.

Cryptographic Provenance

Every edition includes a SHA-256 edition hash (first 16 hex chars) computed over the chapter content. This provides:

The colophon of every edition reads: "Written by AuthorAgent — cypherpunk2048 standard"*

Architecture

AuthorAgent is a singleton with async factory pattern and lazily-initialized locking:

class AuthorAgent:
    _instance = None
    _lock = None  # Lazily created to avoid asyncio deprecation

@classmethod async def get_instance(cls) -> "AuthorAgent": if cls._lock is None: cls._lock = asyncio.Lock() async with cls._lock: if cls._instance is None: cls._instance = cls() return cls._instance

async def publish(self) -> Dict[str, Any]: # On-demand: compile 8 core chapters → BOOK_OF_MINDX.md + archive

async def write_daily_chapter(self) -> Dict[str, Any]: # Lunar cycle: 1 chapter/day, skip if already written today

def cancel_periodic(self): # Cancel running periodic task (prevents duplicate loops)

async def run_periodic(self, interval_seconds=86400): # Daily loop with CancelledError handling

External publishing — rage.pythai.net (WordPress)

AuthorAgent is the canonical caller of the wordpress-agent loopback service (agents/wordpress_agent/, descriptor agents/wordpress.publish.agent). It renders an article's markdown to HTML, attaches a _mindx_content_hash (sha256[:16]) for provenance, and POSTs it:

await author.publish_to_rage(
    title="How I Turn Logs Into Memory",
    content_html=html,            # already rendered
    status="draft",               # draft|publish|future|pending|private
    excerpt=None, slug=None, tags=None, categories=None, featured_media=None,
)  # → {"post_id", "url", "status", "slug", "date_gmt"}  or  None if the service is unreachable

It never raises into the author loop — an unreachable service is logged and returns None. The wordpress-agent itself retries 5xx with backoff.

doc_path (a markdown file under docs/, rendered to HTML), markdown, or html; status defaults to draft. author.last_rage_url. GET /insight/publications/health → orchestrator liveness + per-source status defaults + ledger state.

Autonomous publishing — AuthorAgent is the canonical writer

publish_to_rage() is the low-level transport. The autonomous publishing pipeline (see docs/publications/README.md and docs/SEA_MILESTONES.md) calls it via PublicationOrchestrator, which owns ledger / debounce / rate-limit / status policy and delegates article composition to AuthorAgent for the rich surfaces. Established pattern: agents/learning/improvement_journal.py:76-87 already delegates journal entry authorship to AuthorAgent.

Rich composers live alongside publish_to_rage:

MethodTriggered byDefault rage status
compose_milestone_article(payload, category=…)Dispatcher — routes to a per-category composer belowper category
_compose_sea_milestone_article(campaign_summary)SEA campaign with is_milestone=true (event sea.campaign.concluded)publish
_compose_bug_crushed_article(payload)Operator-triggered (POST /admin/recognize/bug-crushed) when an alert batch closespublish (major)
_compose_dreaming_milestone_article(payload)machine_dreaming code change OR insight outlier (event dreaming.improved)draft
compose_book_edition_article(book_event)AuthorAgent's own _full_moon_publish (event book.edition.published)draft
compose_journal_digest_article(journal_text, lunar_phase)Full-moon co-fire from AuthorAgent (event journal.lunar.digest.ready)publish

Each returns the (title, content_html, excerpt, topic) tuple shape the orchestrator passes to publish_to_rage. All env-overridable. The milestone composers ride on the MilestoneRecognizer chain (see docs/MILESTONE_RECOGNITION.md); status defaults come from MINDX_MILESTONE_<CATEGORY>_STATUS.

Lunar events emitted by _full_moon_publish()

When the full-moon compilation writes the new Book of mindX edition, AuthorAgent emits two coordinator events (self.coordinator.publish_event) back-to-back:

  1. book.edition.published → PublicationOrchestrator composes a rage post
linking to the published edition with a curated TOC + colophon
  1. journal.lunar.digest.ready → PublicationOrchestrator reads
docs/IMPROVEMENT_JOURNAL.md and asks AuthorAgent's journal-digest composer to summarise the lunar cycle

self.coordinator is set by mindx_backend_service/main_service.py right after AuthorAgent.get_instance() in the orchestrator spawn block. If the coordinator is missing (e.g., dev harness with no event bus), AuthorAgent's lunar disk writes still happen — the events are simply not emitted, and the file-polling watcher will pick up the dream-cycle book edition trigger as a fallback.

Key Files

FilePurpose
agents/author_agent.pyBook compilation, lunar cycle, publishing (incl. publish_to_rage)
agents/wordpress_agent/Loopback WordPress REST service AuthorAgent calls (ported from mindXtrain)
agents/wordpress.publish.agentAgent extension descriptor for the wordpress-agent
docs/WORDPRESS_PUBLISHING.mdAuthorAgent → wordpress-agent → rage.pythai.net guide
agents/learning/improvement_journal.pyJournal entries (feeds Chapter VI)
docs/BOOK_OF_MINDX.mdCurrent book edition (auto-generated)
docs/publications/Timestamped archived on-demand editions
docs/publications/daily/Daily lunar cycle chapters
data/governance/lunar_cycle.jsonLunar state persistence (chapters written, full moons)
data/governance/moon_cache.jsonMoon phase cache (6h TTL from timeanddate.com)
data/governance/doc_audit.jsonChapter VIII doc audit output
tools/core/health_auditor_tool.pyAuthorAgent staleness check
mindx_backend_service/main_service.pyScheduling, health restart, /book endpoint

Referenced in this document
BOOK_OF_MINDXDEPLOYMENT_MINDX_PYTHAI_NETIMPROVEMENT_JOURNALMANIFESTOMILESTONE_RECOGNITIONREADMESEA_MILESTONESTHESISWORDPRESS_PUBLISHING

All DocumentsDocument IndexThe Book of mindXImprovement JournalAPI Reference