Files
kandev/docs/diagrams/agent-communication.html
2026-09-03 23:12:45 +00:00

126 lines
7.9 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kandev agent communication</title>
<link href="https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<style>
*, *::before, *::after { box-sizing: border-box; }
:root {
--paper: #0d0d10;
--ink: #ffffff;
--muted: #a1a1a1;
--soft: #737373;
--rule: rgba(255,255,255,0.12);
--accent: #6468f0;
--sans: 'Figtree', 'Geist', system-ui, sans-serif;
--serif: 'Instrument Serif', serif;
}
body {
margin: 0;
min-height: 100vh;
padding: 32px 24px 40px;
color: var(--ink);
background: var(--paper);
font-family: var(--sans);
}
.frame { width: min(100%, 960px); margin: 0 auto; }
.eyebrow {
margin: 0 0 8px;
color: var(--soft);
font: 500 10px/1.4 'Geist Mono', monospace;
letter-spacing: .18em;
text-transform: uppercase;
}
h1 {
margin: 0 0 8px;
color: var(--ink);
font: 400 clamp(28px, 4vw, 36px)/1.1 var(--serif);
letter-spacing: -.02em;
}
.lede {
max-width: 70ch;
margin: 0 0 24px;
color: var(--muted);
font-size: 14px;
line-height: 1.5;
}
svg { display: block; width: 100%; height: auto; }
</style>
</head>
<body>
<main class="frame">
<p class="eyebrow">Sequence · Kandev · doc-inline · balanced · readable</p>
<h1>Agents agree on a contract</h1>
<p class="lede">The backend and frontend agents use task messaging to propose an API shape, request one missing field, and record the shared contract before implementation.</p>
<svg viewBox="16 0 840 600" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="agent-communication-title agent-communication-desc">
<title id="agent-communication-title">Agents agree on a contract</title>
<desc id="agent-communication-desc">Agent A in the backend proposes a GET items contract to Agent B in the frontend. Agent B requests created_at, Agent A queues the reply, and Agent A confirms the agreed contract before both agents implement it.</desc>
<defs>
<marker id="agent-communication-arrow" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#a1a1a1"/>
</marker>
<marker id="agent-communication-arrow-accent" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#6468f0"/>
</marker>
</defs>
<rect x="0" y="0" width="960" height="600" fill="#0d0d10"/>
<!-- Lifelines are deliberately quiet; messages carry the sequence meaning. -->
<line x1="264" y1="104" x2="264" y2="536" stroke="#737373" stroke-width="1" stroke-dasharray="4 4"/>
<line x1="696" y1="104" x2="696" y2="536" stroke="#737373" stroke-width="1" stroke-dasharray="4 4"/>
<rect x="260" y="152" width="8" height="328" rx="2" fill="#404040"/>
<rect x="692" y="168" width="8" height="96" rx="2" fill="#404040"/>
<!-- Messages. The third message is the single focal agreement signal. -->
<path d="M264 168 H696" fill="none" stroke="#a1a1a1" stroke-width="1.2" stroke-linecap="round" marker-end="url(#agent-communication-arrow)"/>
<path d="M696 264 H264" fill="none" stroke="#a1a1a1" stroke-width="1.2" stroke-linecap="round" marker-end="url(#agent-communication-arrow)"/>
<path d="M264 360 H696" fill="none" stroke="#6468f0" stroke-width="1.4" stroke-linecap="round" marker-end="url(#agent-communication-arrow-accent)"/>
<path d="M264 456 H320 Q328 456 328 464 V480 Q328 488 320 488 H264" fill="none" stroke="#a1a1a1" stroke-width="1.2" stroke-dasharray="4 4" stroke-linecap="round" marker-end="url(#agent-communication-arrow)"/>
<!-- Arrow labels use paper masks and a compact technical register. -->
<rect x="320" y="132" width="320" height="20" rx="4" fill="#0d0d10"/>
<text x="480" y="146" text-anchor="middle" fill="#a1a1a1" font-size="12" font-family="'Geist Mono', monospace" letter-spacing="0.04em">message_task_kandev(B) · GET /items</text>
<rect x="320" y="228" width="320" height="20" rx="4" fill="#0d0d10"/>
<text x="480" y="242" text-anchor="middle" fill="#a1a1a1" font-size="12" font-family="'Geist Mono', monospace" letter-spacing="0.04em">message_task_kandev(A) · add created_at</text>
<rect x="320" y="324" width="320" height="20" rx="4" fill="#0d0d10"/>
<text x="480" y="338" text-anchor="middle" fill="#6468f0" font-size="12" font-family="'Geist Mono', monospace" letter-spacing="0.04em">message_task_kandev(B) · contract agreed</text>
<rect x="336" y="412" width="264" height="20" rx="4" fill="#0d0d10"/>
<text x="468" y="426" text-anchor="middle" fill="#a1a1a1" font-size="12" font-family="'Geist Mono', monospace" letter-spacing="0.04em">get_task_conversation_kandev(B)</text>
<!-- State notes translate the source sequence notes into visible checkpoints. -->
<rect x="608" y="192" width="176" height="40" rx="4" fill="#111114" stroke="#404040" stroke-width="1"/>
<text x="620" y="210" fill="#ffffff" font-size="12" font-family="'Geist Mono', monospace">idle → "sent"</text>
<text x="620" y="224" fill="#737373" font-size="12" font-family="'Geist Mono', monospace">new turn</text>
<rect x="176" y="288" width="176" height="40" rx="4" fill="#111114" stroke="#404040" stroke-width="1"/>
<text x="188" y="306" fill="#ffffff" font-size="12" font-family="'Geist Mono', monospace">running → "queued"</text>
<text x="188" y="320" fill="#737373" font-size="12" font-family="'Geist Mono', monospace">next turn</text>
<rect x="320" y="504" width="320" height="32" rx="4" fill="#111114" stroke="#404040" stroke-width="1"/>
<text x="480" y="524" text-anchor="middle" fill="#a1a1a1" font-size="12" font-family="'Geist Mono', monospace" letter-spacing="0.06em">CONTRACT AGREED · BOTH IMPLEMENT</text>
<!-- Participants sit above the lifelines. -->
<g role="group" aria-label="Agent A backend">
<rect x="144" y="48" width="240" height="56" rx="8" fill="#111114" stroke="#404040" stroke-width="1"/>
<text x="264" y="72" text-anchor="middle" fill="#ffffff" font-size="16" font-weight="600" font-family="'Figtree', 'Geist', sans-serif">Agent A</text>
<text x="264" y="92" text-anchor="middle" fill="#737373" font-size="8" font-family="'Geist Mono', monospace">backend</text>
</g>
<g role="group" aria-label="Agent B frontend">
<rect x="576" y="48" width="240" height="56" rx="8" fill="#111114" stroke="#404040" stroke-width="1"/>
<text x="696" y="72" text-anchor="middle" fill="#ffffff" font-size="16" font-weight="600" font-family="'Figtree', 'Geist', sans-serif">Agent B</text>
<text x="696" y="92" text-anchor="middle" fill="#737373" font-size="8" font-family="'Geist Mono', monospace">frontend</text>
</g>
<line x1="56" y1="568" x2="88" y2="568" stroke="#a1a1a1" stroke-width="1.2" marker-end="url(#agent-communication-arrow)"/>
<text x="104" y="572" fill="#a1a1a1" font-size="12" font-family="'Geist Mono', monospace" letter-spacing="0.06em">TASK MESSAGE</text>
<line x1="280" y1="568" x2="312" y2="568" stroke="#6468f0" stroke-width="1.4" marker-end="url(#agent-communication-arrow-accent)"/>
<text x="328" y="572" fill="#6468f0" font-size="12" font-family="'Geist Mono', monospace" letter-spacing="0.06em">AGREEMENT</text>
<line x1="480" y1="568" x2="512" y2="568" stroke="#a1a1a1" stroke-width="1.2" stroke-dasharray="4 4" marker-end="url(#agent-communication-arrow)"/>
<text x="528" y="572" fill="#a1a1a1" font-size="12" font-family="'Geist Mono', monospace" letter-spacing="0.06em">READ-BACK</text>
</svg>
</main>
</body>
</html>