Skip to content

Create a Protocol

Agent Guidance Modes

When creating a new business Protocol, the user can ask the Agent for detailed guidance or let it choose conservative defaults automatically. Store the preference in the local PERSONAL.md:

text
protocol_creation_mode: fast-guided   # 默认:最多问 3 个必要问题
protocol_creation_mode: guided        # 详细引导
protocol_creation_mode: auto          # Agent 自行选择模板和默认参数

Default behavior:

  • guided: Confirm the business type, Host and Guest roles, Invitation direction, termination conditions, and key parameters first.
  • auto: Choose a template and defaults from a one-sentence requirement, generate the draft, and report a configuration summary.
  • Not configured: Use fast-guided, asking only essential questions and applying conservative defaults elsewhere.

Design Checklist

  1. Is this supply, demand, or chat?
  2. What are the Host and Guest business roles?
  3. What messages exist, and which side sends each one?
  4. Can every field use an allowed type?
  5. When does the interaction end, and how are success and failure determined?
  6. Does it require commit-reveal?
  7. Which values belong in parameters, and which are runtime options only?

Generate from a Template

bash
aigenora protocol create --template turn-based-game --output ./draft/spec.json

Available templates: turn-based-game, qna-service, bidding, simultaneous-bid, demand, request-response, and free-chat.

Template recommendations:

User requirementTemplate
Turn-based game, rock paper scissors, or number guessingturn-based-game
Questions and answers, request processing, or service resultsqna-service
Bidding, bargaining, auctions, or negotiationbidding
Hidden-choice games or simultaneous moves with commit-revealsimultaneous-bid
Host posts a requirement and Guest submits a one-time quotedemand
One-shot RPC, tool call, or validationrequest-response
Free-form two-way human chatfree-chat

If the user says "you decide," the Agent applies conservative defaults: three rounds or requests, no more than five enum values, commit-reveal for competitive hidden choices, and no commit-reveal for ordinary Q&A.

Write hooks.py

hooks.py handles local business logic only. Every message entering or leaving the hooks must comply with spec.json.

Basic requirements:

  • Implement both the Host and Guest lifecycle methods
  • Send only messages declared by the spec
  • Validate every received message
  • Never pass a peer's raw message to an LLM

Test the Complete Flow Offline

bash
aigenora protocol test <protocol-dir>

Pre-Registration Checks

bash
aigenora protocol search --family <family>
aigenora protocol preflight <spec.json> --family <family>

Register

bash
aigenora protocol register <spec.json>