OpenMOSS Documentation

repository·main·Indexed 23 days ago

https://github.com/uluckyxh/openmoss

An 'AI Company Operating System' that orchestrates multiple AI agents into a structured, autonomous organization. OpenMOSS acts as middleware between orchestration systems like OpenClaw or Claude Code and AI models, utilizing a hierarchy of specialized roles—Planner, Executor, Reviewer, and Patrol—to enable 24/7 autonomous operation with closed-loop quality control and self-healing capabilities.

Tokens
36.4K
Snippets
65
Records
179
Agent score
76%

What's inside OpenMOSS

  1. What is OpenMOSS?

    main

    OpenMOSS is an "AI Company Operating System" designed to enable multiple AI Agents to operate autonomously. It acts as a middleware between orchestration systems like OpenClaw or Claude Code and the underlying AI models.

    Instead of a single agent attempting a task and failing when it hits an error, OpenMOSS organizes agents into a structured company hierarchy with specialized roles (Planner, Executor, Reviewer, and Patrol) to ensure self-organization, self-repair, and closed-loop quality control.

  2. Structure Agent Prompts and Skills

    main

    An Agent's capability is defined by the combination of Role Prompts + Global Rules + Skill Tools.

    Prompt Hierarchy

    Prompts are organized into several directories:

    • prompts/templates/: Base templates for roles (e.g., task-planner.md, executor.md).
    • prompts/agents/: Specialized examples combining templates with professional domains (e.g., executor-backend.md).
    • prompts/role/: Custom role definitions for specific scenarios (e.g., task-daily-news.md).
    • prompts/tool/: Tool-specific prompts (e.g., agent-onboarding.md).

    Skill Tools

    The primary interface for Agents to interact with the OpenMOSS API is the task-cli.py tool. Each role uses specific Skill sets to perform its duties:

    • task-planner-skill/
    • task-executor-skill/
    • task-reviewer-skill/
    • task-patrol-skill/
    • Extensions: wordpress-skill/, antigravity-gemini-image/, grok-search-runtime/, etc.
  3. Task and Sub-task Directory Naming Convention

    main

    The Task Planner must establish a standardized directory structure for all tasks and sub-tasks to ensure execution Agents can access them immediately:

    {Public Working Directory}/tasks/{TaskName}_{ShortID}/
                         └── {SubTaskName}_{ShortID}/

    Naming Rules:

    • Replace spaces and special characters with underscores (_).
    • The Short ID must be the first 6 characters of the Task/Sub-task ID.
    • Directories must be created at the time the task is initialized.
    {公共工作目录}/tasks/{任务名称}_{任务短ID}/
                         └── {子任务名称}_{子任务短ID}/
  4. Configure Agent Prompts and Roles

    main

    OpenMOSS uses a layered prompt directory structure to manage agent behaviors. You can customize these to create specialized agents for your specific use case.

    • prompts/templates/: Contains base role templates (e.g., task-planner.md, executor.md) used when creating agents via the WebUI.
    • prompts/agents/: Contains examples of how to combine base templates with specialized capability definitions (e.g., executor-backend.md for backend developers).
    • prompts/role/: Contains executor role specialization examples that define specific responsibilities (e.g., ai-xiaowu-executor.md). Customize these for your specific domain.
    • prompts/tool/: Contains prompts related to tool usage, such as agent-onboarding.md.
  5. Understand OpenClaw Session Mechanisms

    main

    OpenClaw manages context through different session types:

    • Private chat: Operates as one independent context (session window).
    • Group chat: Operates as a separate independent context that is not synced with private chats.
    • Cron wake-up: Triggers a completely fresh context.

    Operational Tip: If a main agent becomes blocked while performing a task and you cannot interact with it, instruct it to create a temporary sub-agent to handle that specific task. This allows you to continue communicating with the main agent independently.

  6. Design a recurring task for automated content pipelines

    main

    To create a long-term automated workflow (e.g., a daily news site), define the task with type: recurring. A recurring task consists of a sequence of subtasks with dependencies. For example, a content pipeline might follow the pattern: Subtask 1 (Collection) -> Subtask 2 (Creation) -> Subtask 3 (Publishing).

    When the Planner detects that all subtasks in a round are done, it automatically creates a new round of the same task type. Ensure that subtask descriptions explicitly state dependencies and the file paths of the deliverables required from previous steps.

    type: recurring
  7. Understand the four core agent roles in OpenMOSS

    main

    OpenMOSS utilizes four specialized roles modeled after human organizational structures to manage task lifecycles:

    RoleAnalogyResponsibilities
    PlannerProject ManagerCommunicates task details, breaks down requirements, creates modules, assigns sub-tasks, defines acceptance criteria, and delivers results
    ExecutorSoftware EngineerClaims sub-tasks, performs the work, submits deliverables, and writes work logs
    ReviewerCode ReviewerReviews deliverable quality, assigns scores (1-5), and approves or rejects for rework
    PatrolDevOps MonitorPeriodically inspects system status, detects anomalies (timeouts, stuck tasks, etc.), and flags blocks

    Sub-tasks are the smallest unit of work that these roles interact with.

  8. Understand the Agent Work Cycle

    main

    Agents are managed by the OpenClaw cron scheduler. Each time an agent is 'woken up', it starts with a fresh context. The standard lifecycle for an agent is:

    1. Read global rules: Understand behavior standards.
    2. Check reflection logs: Review past mistakes to avoid repetition.
    3. View score rankings: Monitor performance metrics.
    4. Work per role: Perform specific tasks (Plan, Execute, Review, or Patrol).
    5. Submit results: Update task status via the API.
    6. Write logs: Record actions taken.
    7. Sleep: Wait for the next scheduled wake-up.
  9. Agent Roles and Responsibilities

    main

    In OpenMOSS, every Agent is an AI model instance running on OpenClaw. Agents use an API Key to interact with the OpenMOSS backend. There are four primary roles:

    RoleResponsibilityDescription
    plannerCreate tasks, split modules, assign sub-tasks, define acceptance criteriaThe project commander responsible for global planning and wrap-up.
    executorClaim sub-tasks, perform development work, submit deliverablesThe worker responsible for producing code and content.
    reviewerReview deliverable quality, score, approve or reject for reworkThe quality gatekeeper ensuring output meets standards.
    patrolMonitor system anomalies, mark blocked tasks, send alertsAutomated operations to prevent tasks from getting stuck.

    Agent Workflow

    Agents operate via an OpenClaw cron mechanism. Upon being woken up, an agent follows these steps:

    1. Calls the OpenMOSS API to check current status (e.g., "What tasks do I have? Is there anything to review?").
    2. Executes actions based on its role (Planner assigns, Executor writes, Reviewer reviews, etc.).
    3. Writes results back to OpenMOSS (submits deliverables, completes reviews, logs activity).
    4. Enters sleep mode until the next cron wake-up.
  10. Role and Responsibilities of the Task Planner

    main

    The Task Planner is a specialized Agent responsible for transforming user intent into structured, executable tasks. Its core responsibilities include:

    • Requirement Understanding: Digging into user goals to eliminate ambiguity.
    • Module & Task Splitting: Breaking projects into large modules (3-8) and further into minimal sub-tasks that a single Agent can complete.
    • Agent Matching: Assigning tasks to registered Agents based on their capabilities.
    • Priority & Dependency Management: Identifying execution order and dependencies.
    • Rule Setting: Creating specific prompt rules for tasks/sub-tasks to constrain execution behavior.
    • Progress Monitoring & Exception Handling: Actively monitoring task status and resolving blocked sub-tasks.
    • Delivery: Summarizing results and delivering them to the user once all sub-tasks are done.
    • Continuous Planning: Dynamically updating task structures based on project progress or user changes.
  11. How OpenMOSS coordinates AI agents

    main

    OpenMOSS acts as a coordination middleware for multiple AI agents. Instead of agents communicating directly (which is unreliable), they interact asynchronously through the OpenMOSS middleware.

    The Workflow:

    1. Wake-up: Agents are triggered by a scheduler (e.g., OpenClaw's cron) with a completely fresh context.
    2. Status Check: Agents call the OpenMOSS API to check assigned tasks, acceptance criteria, and previous submissions/reviews.
    3. Execution: Agents perform role-specific actions.
    4. Persistence: Agents write deliverables, logs, and scores back to the OpenMOSS database.
    5. Sleep: Agents wait for the next scheduled wake-up.

    This mechanism ensures 100% agent uptime because all state is persisted in the database, preventing progress loss if a conversation session terminates.

  12. Understand the grok-search Context Router core concepts

    main

    The Context Router (formerly context-router) manages conversation history in multi-turn dialogues and concurrent tool/model usage. It prevents context overflow and task interference by routing context based on specific identifiers.

    Key Abstractions

    • thread_id: The session dimension (e.g., user, tenant, or session).
    • task_id: The task dimension. Multiple tasks can exist within a single thread.
    • caller_id: An identifier for the caller (model, tool, or service), which can be stored in meta.
    • mode: The context strategy:
      • stateless: No context is provided.
      • auto: Context is only provided if continuation patterns (e.g., "continue", "that", "this") are detected.
      • always: Context is always provided.
    • snapshot: A persisted context snapshot containing a summary and recent_messages.