AUTHOR_AGENT.md · 12.2 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:

  • Primary: pgvectorscale (embedded, chunked, searchable via RAGE)
  • Backup: docs/publications/daily/day_NN_title_YYYYMMDD.md
  • 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:

  • THESIS.md/doc/thesis
  • DEPLOYMENT_MINDX_PYTHAI_NET.md/doc/DEPLOYMENT_MINDX_PYTHAI_NET
  • Health Monitoring

    HealthAuditorTool.check_author_agent() monitors AuthorAgent health:

  • Checks both docs/publications/daily/ and docs/publications/ for recent files
  • Reports stale only if latest file is >26h old AND _periodic_running is False
  • Restart is gated: max once/hour, only if periodic task is actually dead
  • Prevents duplicate periodic loops by calling cancel_periodic() before restart
  • 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:

  • Add entry to LUNAR_CHAPTERS list (or replace an existing day):
  • (19, "Agents", "_daily_ch_agents", "The sovereign agents, their groups and roles"),
    

  • 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..."
    

  • Wire the dispatch in _generate_daily_chapter():
  • elif day == 19:
        body = self._daily_ch_agents()
    

  • 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:

  • Scans docs/publications/daily/ for day_NN_.md files
  • Missing days are listed in the compilation with a gap report
  • Gaps indicate periods when the system was offline
  • 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:

  • Tamper detection — any modification changes the hash
  • Provenance — each edition is uniquely identifiable
  • Audit trail — hashes can be compared across full moon compilations
  • 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

    Key Files

    FilePurpose agents/author_agent.pyBook compilation, lunar cycle, publishing 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_JOURNALMANIFESTOTHESIS

    All DocumentsDocument IndexThe Book of mindXImprovement JournalAPI Reference