Agent Message Protocol

AMP
v1.0

The communication bedrock of Agentic Network. All message exchanges between agents must strictly follow the JSON schema defined by this protocol. Any message that does not conform to the schema is invalid; the receiver must reject it and write to the error log.

5
Message Types
JSON
Wire Format
ACK
Required on 4/5
SSOT
Persistence Layer
ADMIN Kircérta
→ dispatch
COORDINATOR Gemini 3.1
→ dispatch
EXECUTOR Codex 5.3
← result
COORDINATOR → Reviewer
→ review_req
REVIEWER Reviewer Provider (claude/gemini/deepseek)
← verdict
SSOT / GitHub Persist all
00 / Base Envelope — common field for all messages
Fields
msg_id *
string
"{type}-{task_id}-{unix_ms}"Format. Globally unique, used for ACK traceback.
protocol_version *
string
fixed value"AMP/1.0". Refuse to process when the receiver version is incompatible.
type *
enum
One of five message types. See Message Types below.
from *
enum
admin | coordinator | executor | reviewer | system
to *
enum
admin | coordinator | executor | reviewer
task_id *
string
"T-YYYY-NNN"Format. Associate the corresponding task JSON file in SSOT.
timestamp *
string
ISO 8601 format, including time zone offset."2026-02-26T14:32:07+00:00"
requires_ack *
bool
trueThe receiver must write back the ACK message to SSOT within timeout, otherwise the Coordinator will automatically report it.
ack_timeout_sec ?
int
requires_ack = truevalid. The default value is determined by the message type and can be overridden.
context_ref ?
string[]
List of associated prepended msg_ids. Executor/Reviewer is used to restore historical context.
payload *
object
Message-specific fields. Structure consists oftypeDecision, see each message definition.
Base Envelope Example
// Every message must contain this shell
{
  "msg_id": "task_dispatch-T-2026-044-1740576727001",
  "protocol_version": "AMP/1.0",
  "type": "task_dispatch",
  "from": "coordinator",
  "to": "executor",
  "task_id": "T-2026-044",
  "timestamp": "2026-02-26T14:32:07+00:00",
  "requires_ack": true,
  "ack_timeout_sec": 300,
  "context_ref": ["task_dispatch-T-2026-043-..."],
  "payload": {
    // See the definition of each message type
    // ...
  }
}
01
Coordinator Executor
task_dispatch
Task is issued. After the Coordinator decomposes the execution plan approved by the Admin, it notifies the Executor to start work with this message type.
Trigger conditions:After the Admin approves the Coordinator plan
ACK timeout:300s(5min)
SSOT writes:Coordinator
ACK Required Timeout: 300s
payload fields
description *
string
Natural language description of tasks, the main understanding basis of Executor. It should be specific enough to avoid ambiguity.
repo *
string
The local absolute path of the target repo, such as"/Users/kircerta/dev/Rhylm". must exist.git
branch *
string
The Feature Branch where the operation is located.prohibitformainormaster. Executor should be verified before execution.
subtasks *
array
An ordered list of subtasks, each containingsubtask_iddescriptionestimated_lines
acceptance_criteria *
string[]
List of acceptance criteria. The only basis for Executor's self-judgment of "completion" and the main comparison for Reviewer's review. Each item should be verifiable.
risk_level *
enum
low | medium | high. Determines the approval path, the Executor must not modify this value.
forbidden_actions ?
string[]
A list of explicitly prohibited operations, such as["delete CoreData entities", "modify Info.plist"]
tech_constraints ?
object
technical constraints such as{"swift_version": "6.0", "min_ios": "17.0", "target": "watchOS"}
payload example
{
  "description": "Reconstruct watchOS breathing engine timing logic and fix timer exception when background hangs",
  "repo": "/Users/kircerta/dev/Rhylm",
  "branch": "feature/watch-breath-v2",
  "subtasks": [
    {
      "subtask_id": "T-2026-044-S1",
      "description": "Replace Timer with WKExtendedRuntimeSession",
      "estimated_lines": 60
    },
    {
      "subtask_id": "T-2026-044-S2",
      "description": "Add applicationDidEnterBackground handling",
      "estimated_lines": 30
    }
  ],
  "acceptance_criteria": [
    "Resume after background suspension, timing error < 500ms",
    "XCode Cloud all tests passed",
    "No memory leak (Instruments verification)"
  ],
  "risk_level": "medium",
  "forbidden_actions": [
    "Modify HealthKit permission statement"
  ],
  "tech_constraints": {
    "swift_version": "6.0",
    "min_watchos": "10.0"
  }
}
Branch Validation
Executor must verify after receivingbranch != "main"andbranch != "master", otherwise execution is refused and escalation is triggered.
Acceptance Criteria
acceptance_criteriaArray must not be empty. If the Coordinator does not provide it, the Executor should refuse to receive it and ask the Coordinator to complete it.
ACK on Start
The ACK written by the Executor to SSOT means "received and execution started", not "completed". Complete withtask_resultmessage said.
02
Executor Coordinator
task_result
Task completion report. After the Executor completes the self-judgment phase, it notifies the Coordinator with this message, along with work logs and self-evaluation.
Trigger conditions:Executor determines that the current subtask phase is completed
ACK timeout:120s(2min)
SSOT writes:Executor
ACK Required Timeout: 120s
payload fields
subtask_id *
string
Corresponds to subtasks in task_dispatchsubtask_id. Correlate accurately and prevent ambiguity.
completion_status *
enum
complete | partial | failedpartialIndicates that it is partially completed and the reason needs to be explained.
diff_summary *
object
Containsfiles_changed(string[])、lines_added(int)、lines_removed(int)。
self_assessment *
object
Executor evaluates itself one by one against acceptance_criteria. Containscriteria_met(bool[]) andnotes(string[])。
work_log *
array
Operation log, each item containstimestampactionfiledetail. For use by Reviewer and Audit.
commit_hash ?
string
If it has been committed, provide the git commit hash. Reviewer can be used to pinpoint diffs.
blockers ?
string[]
completion_status = partial | failedmust be provided. Describe the cause of the blocking, and the Coordinator will make decisions based on this.
payload example
{
  "subtask_id": "T-2026-044-S1",
  "completion_status": "complete",
  "diff_summary": {
    "files_changed": [
      "Sources/WatchApp/BreathEngine.swift",
      "Sources/WatchApp/SessionManager.swift"
    ],
    "lines_added": 68,
    "lines_removed": 24
  },
  "self_assessment": {
    "criteria_met": [true, null, null],
    // null = Unable to self-verify, requires Reviewer/CI
    "notes": [
      "Timing error ~200ms has been restored in the simulator verification background",
      "Waiting for XCode Cloud to build",
      "Waiting for Instruments analysis"
    ]
  },
  "work_log": [
    {
      "timestamp": "2026-02-26T14:28:00Z",
      "action": "replace_timer",
      "file": "BreathEngine.swift",
      "detail": "Timer.scheduledTimer replaced with WKExtendedRuntimeSession"
    }
  ],
  "commit_hash": "a3f8d21"
}
Self Assessment
Executor criteria that cannot be validated should be marked asnull, rather than guessingtrue. Reviewer will focus onnullitem.
Partial Completion
partialstateblockersField is required. After receiving it, the Coordinator decides whether to re-dispatch or escalate.
No Auto-Merge
Executor enters the waiting state after sending task_result. No additional modifications may be made to the branch until a review_request ACK or a new dispatch is received from the Coordinator.
03
Coordinator Reviewer
review_request
Review request. After receiving the task_result, the Coordinator packages and sends the complete context to the Reviewer, triggering the QA process.
Trigger conditions:task_result received with completion_status = complete
ACK timeout:600s(10min)
SSOT writes:Coordinator
ACK Required Timeout: 600s
payload fields
original_dispatch_ref *
string
Corresponding to task_dispatch messagemsg_id. Reviewer gets acceptance_criteria accordingly.
task_result_ref *
string
Corresponding to task_result messagemsg_id. Reviewer obtains diff_summary and self_assessment accordingly.
review_scope *
enum
full | incrementalincrementalOnly new diffs since the last verdict are reviewed.
diff_url *
string
GitHub compare URL or local git diff path. Reviewer The primary input for reviewing code.
reject_count *
int
The cumulative number of rejects for the current task_id. This is how the Reviewer perceives the proximity of Hallucination Lock.
coordinator_notes ?
string
Coordinator's additional comments on this review, such as "Admin pays special attention to performance here."
ci_status ?
object
Current CI status, such as{"xcode_cloud": "passed", "codex_review": "running"}
payload example
{
  "original_dispatch_ref": "task_dispatch-T-2026-044-...",
  "task_result_ref": "task_result-T-2026-044-...",
  "review_scope": "full",
  "diff_url": "https://github.com/.../compare/main...feature/watch-breath-v2",
  "reject_count": 0,
  "coordinator_notes": "Please focus on checking the life cycle management of WKExtendedRuntimeSession in the background",
  "ci_status": {
    "xcode_cloud": "passed",
    "codex_review": "running",
    "last_updated": "2026-02-26T14:30:00Z"
  }
}
Context Completeness
Coordinator must ensureoriginal_dispatch_refandtask_result_refThe pointed message is readable in SSOT, otherwise Reviewer cannot conduct effective review.
Lock Warning
reject_count >= 2When , the Coordinator should becoordinator_notesIt is clearly marked "Lock is approaching" to remind the Reviewer that it is currently in a high-risk iteration.
CI Gating
likeci_status.xcode_cloud = "failed", the Coordinator should not send review_request, but should directly initiate a new task_dispatch (to fix CI errors) to the Executor.
04
Reviewer Coordinator
review_verdict
Review decision. After the Reviewer completes the code review, it returns a structured judgment, including decision-making, problem classification and modification opinions. This is the core output of the QA Loop.
Trigger conditions:Reviewer completes the review of review_request
ACK timeout:60s(1min)
SSOT writes:Reviewer
ACK Required Timeout: 60s
payload fields
decision *
enum
approved | approved_with_fix | rejectedapproved_with_fixIndicates that the minor issues have been fixed directly by the Reviewer.
criteria_results *
array
The results are given one by one against the acceptance_criteria. Containscriterionpassed(bool)、evidence(string)。
issues ?
array
decision = rejectedmust be provided. Each issue containsseverityfilelinedescriptionsuggested_fix
direct_fixes ?
array
decision = approved_with_fixprovided at time. Record the content directly repaired by Reviewer, includingfilechange_type(only typo/lint/whitespace/import allowed),diff_lines(must <5).
architecture_notes ?
string
Recommendations for architectural layers beyond the scope of this assignment. It does not affect the current verdict and is for subsequent reference by Admin/Coordinator.
confidence *
float
Reviewer's confidence in this verdict, 0.0–1.0. Below 0.8 the Coordinator should consider reporting to the Admin.
payload example
{
  "decision": "rejected",
  "criteria_results": [
    {
      "criterion": "Background recovery timing error < 500ms",
      "passed": false,
      "evidence": "WKExtendedRuntimeSession is not processed applicationDidBecomeActive, and the timing will start from the beginning after recovery"
    },
    {
      "criterion": "XCode Cloud all tests passed",
      "passed": null,
      "evidence": "CI is still running"
    }
  ],
  "issues": [
    {
      "severity": "critical",
      "file": "Sources/WatchApp/BreathEngine.swift",
      "line": 87,
      "description": "No session reference is held after session.start() is called, and ARC will recycle it immediately",
      "suggested_fix": "Save session as class property and call session.invalidate() in deinit"
    }
  ],
  "architecture_notes": "It is recommended to separate the timing logic into an independent TimeKeeper actor in the future to improve testability",
  "confidence": 0.95
}
Direct Fix Scope
Reviewer’s permissions to directly repair:change_typeMust be one of typo / lint / whitespace / import_order, anddiff_lines < 5. Out of range must be rejected.
Confidence Threshold
Reviewer'sconfidence < 0.8When , the Coordinator should report to the Admin before forwarding it to the Executor, and then decide whether to continue the QA Loop.
Issue Severity
Issue severity is divided into three levels:critical(Must be repaired, blocking),major(Should be repaired, blocking),minor(Recommended fix, non-blocking).
05
Any Agent / System Admin
escalation
Exception reporting. This message must be sent when any Agent or system mechanism encounters a situation that it cannot resolve autonomously. The Admin is the sole arbiter.
Trigger source:Coordinator / Reviewer / Executor / System
ACK timeout:None (Admin asynchronous processing)
SSOT writes:triggering party
ACK Optional Admin async
payload fields
escalation_type *
enum
hallucination_lock | ack_timeout | branch_violation | ci_failure | conflict | heartbeat_timeout | permission_denied | unknown
severity *
enum
critical | warning | infocriticalAll related Agents should immediately suspend waiting for Admin instructions.
triggered_by *
enum
coordinator | executor | reviewer | system. Identify the source of responsibility.
description *
string
A human-readable description of the problem. Main messages Admin receives on Telegram/Dashboard. It should be concise, specific and actionable.
affected_msgs *
string[]
List of related msg_ids that triggered this escalation. Admins can trace the complete context in the Dashboard.
system_state_snapshot *
object
System snapshot at the time of reporting, includingtask_statusreject_countlast_successful_msg_id
suggested_actions ?
string[]
A list of Admin resolution options recommended by the triggering party, such as["Reissue the revised task", "Roll back to checkpoint-xxx", "Terminate the current task"]
auto_suspended *
bool
trueIndicates that the triggering party has suspended the operation waiting for Admin.falseIndicates that the system continues to run (info level only).
payload example — Hallucination Lock
{
  "escalation_type": "hallucination_lock",
  "severity": "critical",
  "triggered_by": "coordinator",
  "description": "T-2026-044 Hallucination Lock has been triggered: The Executor was called back by the Reviewer three times in a row, and the same logic error occurred repeatedly (WKExtendedRuntimeSession ARC problem). The system has been suspended, waiting for Admin's decision.",
  "affected_msgs": [
    "task_dispatch-T-2026-044-001",
    "review_verdict-T-2026-044-003"
  ],
  "system_state_snapshot": {
    "task_status": "locked",
    "reject_count": 3,
    "last_successful_msg_id": "task_dispatch-T-2026-044-001"
  },
  "suggested_actions": [
    "Admin directly reviews the diff and gives specific code modification guidance",
    "Split the task into smaller subtasks and re-issue them",
    "Roll back to checkpoint and terminate the current task branch"
  ],
  "auto_suspended": true
}

// —— escalation_type reference ——
// hallucination_lock reject_count > 3, systemic problem
// ack_timeout Agent does not ACK within timeout
// branch_violation Executor tries to operate the main branch
// ci_failure XCode Cloud/Codex build failed
// heartbeat_timeout Agent 30min no SSOT write
// conflict Reviewer and Executor cannot be reconciled
// permission_denied operation exceeds risk_level authorization scope
Critical = Suspend All
When severity = critical, all related agents must immediately suspend (auto_suspended = true) and must not perform any new operations until Admin issues a resume instruction via Dashboard or Telegram.
No Silent Failure
If any agent encounters a situation it cannot handle, it is forbidden to continue silently or fail silently. It must send an escalation. This is one of the most important safety principles of the protocol.
Suggested Actions
suggested_actions are recommendations, not commands. Admin may ignore all recommendations and choose a completely different response. The sender must not assume Admin will adopt them.
AMP — Agent Message Protocol  ·  v1.0  ·  2026.02.26
Authored by Reviewer Provider (claude/gemini/deepseek) (Reviewer)  ·  Reviewed by Admin