Files
archie/docs/archie-core-v2-architecture.html
T

935 lines
41 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#050816">
<title>archie-core · Architecture</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&amp;family=Space+Grotesk:wght@500;600;700&amp;display=swap" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js" integrity="sha384-ZZ1pncU3bQe8y31yfZdMFdSpttDoPmOZg2wguVK9almUodir1PghgT0eY7Mrty8H" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/jspdf@2.5.2/dist/jspdf.umd.min.js" integrity="sha384-en/ztfPSRkGfME4KIm05joYXynqzUgbsG5nMrj/xEFAHXkeZfO3yMK8QQ+mP7p1/" crossorigin="anonymous"></script>
<style>
:root {
color-scheme: dark;
--canvas: #050816;
--panel: #0a1022;
--node: #0d1529;
--line: #1b2942;
--line-strong: #293b59;
--text: #f4f7fb;
--muted: #8ea0b8;
--cyan: #38bdf8;
--green: #34d399;
--violet: #a78bfa;
--amber: #fbbf24;
--rose: #fb7185;
--orange: #fb923c;
--slate: #94a3b8;
--display: "Space Grotesk", "Avenir Next", system-ui, sans-serif;
--mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}
* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
margin: 0;
min-width: 320px;
min-height: 100vh;
color: var(--text);
background:
radial-gradient(circle at 22% -8%, rgba(52, 211, 153, 0.11), transparent 36rem),
radial-gradient(circle at 88% 22%, rgba(56, 189, 248, 0.10), transparent 32rem),
var(--canvas);
font-family: var(--mono);
-webkit-font-smoothing: antialiased;
}
button, summary { font: inherit; }
.report {
width: min(1500px, 100%);
margin: 0 auto;
padding: clamp(20px, 4vw, 56px);
}
.masthead {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
gap: 28px;
align-items: end;
margin-bottom: 22px;
}
.eyebrow {
display: flex;
align-items: center;
gap: 9px;
margin: 0 0 10px;
color: var(--green);
font-size: 0.68rem;
font-weight: 600;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.live-dot {
width: 7px;
height: 7px;
border-radius: 999px;
background: var(--green);
box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
animation: beacon 2.8s ease-out infinite;
}
h1 {
max-width: 900px;
margin: 0;
font-family: var(--display);
font-size: clamp(2rem, 5vw, 4.4rem);
font-weight: 600;
letter-spacing: -0.055em;
line-height: 0.98;
}
.subtitle {
max-width: 720px;
margin: 14px 0 0;
color: var(--muted);
font-size: clamp(0.72rem, 1.2vw, 0.86rem);
line-height: 1.7;
}
.legend {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 7px;
max-width: 440px;
}
.chip {
display: inline-flex;
align-items: center;
gap: 7px;
padding: 7px 9px;
color: var(--muted);
background: rgba(10, 16, 34, 0.72);
border: 1px solid var(--line);
border-radius: 999px;
font-size: 0.62rem;
white-space: nowrap;
}
.chip::before {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--chip-color);
box-shadow: 0 0 12px color-mix(in srgb, var(--chip-color) 65%, transparent);
content: "";
}
.stage {
position: relative;
overflow: hidden;
background: linear-gradient(145deg, rgba(13, 21, 41, 0.88), rgba(7, 12, 27, 0.96));
border: 1px solid var(--line);
border-radius: 22px;
box-shadow: 0 28px 80px rgba(0, 0, 0, 0.36), inset 0 1px rgba(255, 255, 255, 0.025);
}
.stage::before {
position: absolute;
inset: 0;
pointer-events: none;
background: linear-gradient(115deg, rgba(52, 211, 153, 0.04), transparent 26%, transparent 72%, rgba(56, 189, 248, 0.045));
content: "";
}
.stage-bar {
position: relative;
z-index: 2;
display: flex;
align-items: center;
min-height: 52px;
padding: 10px 14px 10px 18px;
border-bottom: 1px solid var(--line);
}
.stage-label {
color: var(--muted);
font-size: 0.65rem;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.stage-label strong {
margin-right: 9px;
color: var(--text);
font-weight: 500;
}
.export-menu {
position: relative;
margin-left: auto;
}
.export-menu summary {
display: flex;
align-items: center;
gap: 8px;
min-height: 32px;
padding: 6px 10px;
color: var(--muted);
background: rgba(13, 21, 41, 0.8);
border: 1px solid var(--line-strong);
border-radius: 8px;
cursor: pointer;
font-size: 0.67rem;
list-style: none;
transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}
.export-menu summary::-webkit-details-marker { display: none; }
.export-menu summary::after { content: "↓"; color: var(--green); }
.export-menu[open] summary,
.export-menu summary:hover { color: var(--text); background: #101b32; border-color: #3a5278; }
.export-actions {
position: absolute;
z-index: 10;
top: calc(100% + 8px);
right: 0;
display: grid;
width: 164px;
padding: 6px;
background: #0c1428;
border: 1px solid var(--line-strong);
border-radius: 11px;
box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
}
.export-actions button {
padding: 9px 10px;
color: var(--muted);
background: transparent;
border: 0;
border-radius: 7px;
text-align: left;
cursor: pointer;
font-size: 0.67rem;
}
.export-actions button:hover { color: var(--text); background: #14213b; }
.export-actions button:disabled { opacity: 0.55; cursor: wait; }
.replay-button {
position: absolute;
z-index: 4;
right: 14px;
bottom: 14px;
display: grid;
width: 34px;
height: 34px;
padding: 8px;
place-items: center;
color: var(--muted);
background: rgba(5, 8, 22, 0.34);
border: 1px solid rgba(142, 160, 184, 0.18);
border-radius: 50%;
opacity: 0.56;
cursor: pointer;
backdrop-filter: blur(8px);
transition: color 180ms ease, opacity 180ms ease, border-color 180ms ease, background 180ms ease;
}
.replay-button:hover {
color: var(--text);
background: rgba(13, 21, 41, 0.72);
border-color: rgba(52, 211, 153, 0.42);
opacity: 1;
}
.replay-button svg { width: 100%; height: 100%; }
.replay-button.is-replaying svg { animation: replay-turn 720ms cubic-bezier(.2, .75, .25, 1); }
:focus-visible {
outline: 2px solid var(--green);
outline-offset: 3px;
}
.diagram-scroll {
position: relative;
z-index: 1;
overflow-x: auto;
scrollbar-color: var(--line-strong) transparent;
}
.architecture {
display: block;
width: 100%;
min-width: 1080px;
height: auto;
}
.boundary-fill { opacity: 0; animation: reveal 650ms ease forwards; }
.boundary-fill--cloud { fill: rgba(251, 191, 36, 0.025); }
.boundary-fill--platform { fill: rgba(52, 211, 153, 0.025); }
.boundary-outline { fill: none; stroke-width: 1; vector-effect: non-scaling-stroke; }
.boundary-outline--cloud { stroke: rgba(251, 191, 36, 0.36); stroke-dasharray: 8 8; }
.boundary-outline--platform { stroke: rgba(52, 211, 153, 0.38); }
.boundary-tag { fill: #080e1d; stroke-width: 1; }
.boundary-tag--cloud { stroke: rgba(251, 191, 36, 0.3); }
.boundary-tag--platform { stroke: rgba(52, 211, 153, 0.3); }
.boundary-label { font: 600 10px var(--mono); letter-spacing: 0.08em; }
.flow {
fill: none;
stroke: var(--flow-color, var(--slate));
stroke-width: 1.5;
opacity: 0;
vector-effect: non-scaling-stroke;
animation: flow-reveal 620ms ease forwards;
animation-delay: var(--delay, 220ms);
}
.flow--async,
.flow--control {
animation:
flow-reveal 620ms ease var(--delay, 220ms) forwards,
connector-flow 4.5s linear var(--phase, 0s) infinite;
}
.flow--async { stroke-dasharray: 8 7; }
.flow--control { stroke-dasharray: 1 6; stroke-linecap: round; }
.flow-motion {
fill: none;
stroke: var(--flow-color, var(--slate));
stroke-width: 2.7;
stroke-linecap: round;
stroke-dasharray: 24 96;
stroke-dashoffset: 0;
opacity: 0;
pointer-events: none;
filter: url(#packet-glow);
vector-effect: non-scaling-stroke;
animation:
motion-reveal 1ms linear calc(var(--delay, 220ms) + 520ms) forwards,
connector-flow 5.2s linear var(--phase, 0s) infinite;
}
.node {
opacity: 0;
animation: node-in 520ms cubic-bezier(.2, .75, .25, 1) forwards;
animation-delay: var(--delay, 700ms);
}
.node__mask { fill: var(--node); }
.node__surface {
fill: color-mix(in srgb, var(--node-accent) 8%, var(--node));
stroke: color-mix(in srgb, var(--node-accent) 78%, white 5%);
stroke-width: 1.2;
vector-effect: non-scaling-stroke;
transition: filter 180ms ease, stroke-width 180ms ease;
}
.node:hover .node__surface,
.node:focus .node__surface { filter: url(#node-glow); stroke-width: 1.8; }
.node__accent { fill: var(--node-accent); }
.node__eyebrow { fill: var(--node-accent); font: 600 9px var(--mono); letter-spacing: 0.1em; }
.node__title { fill: var(--text); font: 600 14px var(--display); }
.node__meta { fill: var(--muted); font: 400 10px var(--mono); }
.connector-label rect { fill: #080e1d; stroke: #1b2942; stroke-width: 1; }
.connector-label text { fill: var(--muted); font: 500 9px var(--mono); letter-spacing: 0.02em; }
.insights {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 12px;
margin-top: 12px;
}
.insight {
position: relative;
min-height: 132px;
padding: 18px 18px 16px;
overflow: hidden;
background: rgba(10, 16, 34, 0.72);
border: 1px solid var(--line);
border-radius: 14px;
}
.insight::after {
position: absolute;
top: 0;
right: 0;
width: 56px;
height: 2px;
background: var(--accent);
content: "";
}
.insight-kicker { margin: 0 0 18px; color: var(--accent); font-size: 0.6rem; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; }
.insight h2 { margin: 0 0 7px; font-family: var(--display); font-size: 1rem; font-weight: 600; }
.insight p { margin: 0; color: var(--muted); font-size: 0.7rem; line-height: 1.65; }
.footer {
display: flex;
justify-content: space-between;
gap: 20px;
margin-top: 16px;
color: #52647d;
font-size: 0.62rem;
}
.export-status { min-height: 1em; }
@keyframes beacon {
0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.48); }
70%, 100% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
}
@keyframes reveal { to { opacity: 1; } }
@keyframes flow-reveal { to { opacity: 0.72; } }
@keyframes motion-reveal { to { opacity: 0.86; } }
@keyframes connector-flow { to { stroke-dashoffset: -120; } }
@keyframes node-in {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes replay-turn { to { transform: rotate(-360deg); } }
.architecture.is-resetting .boundary-fill,
.architecture.is-resetting .flow,
.architecture.is-resetting .flow-motion,
.architecture.is-resetting .node { animation: none !important; }
.is-exporting *, .is-exporting *::before, .is-exporting *::after {
animation-play-state: paused !important;
transition: none !important;
}
.is-exporting .boundary-fill,
.is-exporting .node { opacity: 1 !important; }
.is-exporting .flow { opacity: 0.72 !important; }
.is-exporting .flow-motion { display: none !important; }
.export-static .boundary-fill,
.export-static .node { opacity: 1 !important; animation: none !important; }
.export-static .flow { opacity: 0.72 !important; animation: none !important; }
.export-static .flow-motion { display: none !important; }
@media (max-width: 900px) {
.report { padding: 20px 14px 30px; }
.masthead { grid-template-columns: 1fr; align-items: start; }
.legend { justify-content: flex-start; max-width: none; }
.insights { grid-template-columns: 1fr; }
.footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
scroll-behavior: auto !important;
animation-duration: 0.001ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.001ms !important;
}
.flow-motion { display: none; }
.boundary-fill, .node { opacity: 1; }
.flow { opacity: 0.72; }
}
@media print {
body { background: var(--canvas); }
.report { width: 100%; padding: 18px; }
.export-menu, .replay-button { display: none !important; }
.stage { break-inside: avoid; }
}
</style>
</head>
<body>
<main class="report" id="report-container">
<header class="masthead">
<div>
<p class="eyebrow"><span class="live-dot" aria-hidden="true"></span>Implemented topology · v2</p>
<h1>archie-core</h1>
<p class="subtitle">Single-daemon architecture: poll GitHub for labelled issues, route through label-driven workflows, run gated AI agent loops via ai-sdk, and deliver reviewed PRs — all in-process with SQLite crash recovery and an SSE observability dashboard.</p>
</div>
<div class="legend" aria-label="Component legend">
<span class="chip" style="--chip-color: var(--slate)">External</span>
<span class="chip" style="--chip-color: var(--green)">Daemon</span>
<span class="chip" style="--chip-color: var(--cyan)">Engine</span>
<span class="chip" style="--chip-color: var(--violet)">Storage</span>
<span class="chip" style="--chip-color: var(--orange)">Events</span>
</div>
</header>
<section class="stage" aria-label="Architecture diagram panel">
<div class="stage-bar">
<span class="stage-label"><strong>Issue → PR flow</strong>GitHub polled · label-driven routing · gated agent stages · deterministic git ops · crash recovery</span>
<details class="export-menu" id="export-menu">
<summary>Export</summary>
<div class="export-actions">
<button type="button" title="Copy diagram as PNG" onclick="copyPNG(this)">Copy PNG</button>
<button type="button" title="Download diagram as SVG" onclick="downloadSVG(this)">Download SVG</button>
<button type="button" title="Download diagram as PNG" onclick="downloadPNG(this)">Download PNG</button>
<button type="button" title="Download diagram as PDF" onclick="downloadPDF(this)">Download PDF</button>
</div>
</details>
</div>
<div class="diagram-scroll">
<svg class="architecture" id="architecture" viewBox="0 0 1240 720" role="img" aria-labelledby="diagram-title diagram-description">
<title id="diagram-title">archie-core implemented architecture</title>
<desc id="diagram-description">GitHub is polled by the archied daemon. Issues are enqueued in SQLite and claimed one at a time. Label-driven routing selects a workflow (bootstrap, implement, tdd, feasibility). Workflow stages run sequentially: prepare clones a worktree, then agent stages run gated ai-sdk/agentloop runs against LLM providers, deterministic stages commit, push, apply diff caps, and open PRs. An in-process event bus fans observability events to a SQLite event log and an SSE dashboard. Crash recovery re-queues stale running tasks on startup.</desc>
<defs>
<pattern id="grid" width="32" height="32" patternUnits="userSpaceOnUse">
<path d="M 32 0 L 0 0 0 32" fill="none" stroke="#18253c" stroke-width="0.55"/>
<circle cx="0" cy="0" r="1" fill="#2b3d59"/>
</pattern>
<linearGradient id="canvas-shade" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#091124"/>
<stop offset="0.55" stop-color="#080e1d"/>
<stop offset="1" stop-color="#060b18"/>
</linearGradient>
<marker id="arrow-slate" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M 0 0 L 10 5 L 0 10 z" fill="#94a3b8"/>
</marker>
<marker id="arrow-green" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M 0 0 L 10 5 L 0 10 z" fill="#34d399"/>
</marker>
<marker id="arrow-cyan" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M 0 0 L 10 5 L 0 10 z" fill="#38bdf8"/>
</marker>
<marker id="arrow-orange" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M 0 0 L 10 5 L 0 10 z" fill="#fb923c"/>
</marker>
<marker id="arrow-violet" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M 0 0 L 10 5 L 0 10 z" fill="#a78bfa"/>
</marker>
<marker id="arrow-rose" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M 0 0 L 10 5 L 0 10 z" fill="#fb7185"/>
</marker>
<filter id="node-glow" x="-30%" y="-40%" width="160%" height="180%">
<feGaussianBlur stdDeviation="3" result="blur"/>
<feMerge><feMergeNode in="blur"/><feMergeNode in="SourceGraphic"/></feMerge>
</filter>
<filter id="packet-glow" x="-300%" y="-300%" width="700%" height="700%">
<feGaussianBlur stdDeviation="2.5" result="blur"/>
<feMerge><feMergeNode in="blur"/><feMergeNode in="SourceGraphic"/></feMerge>
</filter>
</defs>
<!-- 1. Canvas -->
<rect width="1240" height="720" fill="url(#canvas-shade)"/>
<rect width="1240" height="720" fill="url(#grid)" opacity="0.58"/>
<!-- 2. Boundary fills -->
<!-- External: GitHub -->
<rect class="boundary-fill boundary-fill--cloud" x="30" y="38" width="300" height="140" rx="22"/>
<!-- External: LLM Providers -->
<rect class="boundary-fill boundary-fill--cloud" x="910" y="38" width="300" height="140" rx="22"/>
<!-- archie-core platform -->
<rect class="boundary-fill boundary-fill--platform" x="30" y="204" width="1180" height="492" rx="22" style="animation-delay: 80ms"/>
<!-- 3. Connectors -->
<g>
<!-- GitHub → archied: poll (solid) -->
<path class="flow" d="M 130 150 V 242 H 240" marker-end="url(#arrow-slate)" style="--flow-color: var(--slate); --delay: 140ms"/>
<!-- archied → GitHub: PR, comment, labels (solid, return path offset) -->
<path class="flow" d="M 340 242 V 150 H 210" marker-end="url(#arrow-slate)" style="--flow-color: var(--slate); --delay: 180ms"/>
<!-- archied → SQLite: SQL read/write (solid) -->
<path class="flow" d="M 380 340 V 380" marker-end="url(#arrow-violet)" style="--flow-color: var(--violet); --delay: 220ms"/>
<!-- archied → Workflow Engine: route + run (solid, internal) -->
<path class="flow" d="M 440 291 H 490" marker-end="url(#arrow-cyan)" style="--flow-color: var(--cyan); --delay: 260ms"/>
<!-- Workflow Engine → Worktree: clone/commit/push (solid) -->
<path class="flow" d="M 610 340 V 428" marker-end="url(#arrow-green)" style="--flow-color: var(--green); --delay: 300ms"/>
<!-- Workflow Engine → ai-sdk: agent loop (solid) -->
<path class="flow" d="M 690 290 H 770" marker-end="url(#arrow-cyan)" style="--flow-color: var(--cyan); --delay: 340ms"/>
<!-- ai-sdk → LLM Providers: HTTP (solid) -->
<path class="flow" d="M 970 282 H 1050 V 150" marker-end="url(#arrow-slate)" style="--flow-color: var(--slate); --delay: 380ms"/>
<!-- LLM Providers → ai-sdk: response (solid, return) -->
<path class="flow" d="M 1050 150 V 242 H 970" marker-end="url(#arrow-slate)" style="--flow-color: var(--slate); --delay: 420ms"/>
<!-- archied → Event Bus: publish (dashed, async) -->
<path class="flow flow--async" d="M 240 310 H 200 V 446 H 260" marker-end="url(#arrow-orange)" style="--flow-color: var(--orange); --delay: 460ms"/>
<!-- Event Bus → SQLite event log: sink (dashed, async) -->
<path class="flow flow--async" d="M 260 446 V 496 H 375 V 380" marker-end="url(#arrow-orange)" style="--flow-color: var(--orange); --delay: 500ms"/>
<!-- Event Bus → SSE Dashboard: broadcast (dashed, async) -->
<path class="flow flow--async" d="M 170 480 V 540" marker-end="url(#arrow-orange)" style="--flow-color: var(--orange); --delay: 540ms"/>
<!-- SSE Dashboard → Event Bus: subscribe (dotted, control) -->
<path class="flow flow--control" d="M 170 540 V 480" marker-end="url(#arrow-rose)" style="--flow-color: var(--rose); --delay: 580ms"/>
</g>
<!-- 4. Boundary outlines and labels -->
<rect class="boundary-outline boundary-outline--cloud" x="30" y="38" width="300" height="140" rx="22"/>
<rect class="boundary-tag boundary-tag--cloud" x="48" y="23" width="126" height="30" rx="8"/>
<text class="boundary-label" x="64" y="43" fill="#fbbf24">FORGE · EXTERNAL</text>
<rect class="boundary-outline boundary-outline--cloud" x="910" y="38" width="300" height="140" rx="22"/>
<rect class="boundary-tag boundary-tag--cloud" x="928" y="23" width="134" height="30" rx="8"/>
<text class="boundary-label" x="944" y="43" fill="#fbbf24">LLM · EXTERNAL</text>
<rect class="boundary-outline boundary-outline--platform" x="30" y="204" width="1180" height="492" rx="22"/>
<rect class="boundary-tag boundary-tag--platform" x="48" y="189" width="176" height="30" rx="8"/>
<text class="boundary-label" x="64" y="209" fill="#34d399">ARCHIE-CORE PLATFORM</text>
<!-- 5. Nodes -->
<!-- GitHub (external, left) -->
<g class="node" transform="translate(50, 68)" tabindex="0" style="--node-accent: var(--slate); --delay: 680ms">
<rect class="node__mask" width="160" height="82" rx="14"/>
<rect class="node__surface" width="160" height="82" rx="14"/>
<rect class="node__accent" width="3" height="36" x="0" y="23" rx="2"/>
<text class="node__eyebrow" x="16" y="22">FORGE</text>
<text class="node__title" x="16" y="47">GitHub</text>
<text class="node__meta" x="16" y="67">Issues · PRs · Labels</text>
</g>
<!-- LLM Providers (external, right) -->
<g class="node" transform="translate(970, 68)" tabindex="0" style="--node-accent: var(--slate); --delay: 740ms">
<rect class="node__mask" width="192" height="82" rx="14"/>
<rect class="node__surface" width="192" height="82" rx="14"/>
<rect class="node__accent" width="3" height="36" x="0" y="23" rx="2"/>
<text class="node__eyebrow" x="16" y="22">EXTERNAL</text>
<text class="node__title" x="16" y="47">LLM Providers</text>
<text class="node__meta" x="16" y="67">OpenAI · Anthropic · Ollama</text>
</g>
<!-- archied Daemon (center-top) -->
<g class="node" transform="translate(240, 242)" tabindex="0" style="--node-accent: var(--green); --delay: 800ms">
<rect class="node__mask" width="200" height="98" rx="14"/>
<rect class="node__surface" width="200" height="98" rx="14"/>
<rect class="node__accent" width="3" height="38" x="0" y="30" rx="2"/>
<text class="node__eyebrow" x="16" y="22">DAEMON</text>
<text class="node__title" x="16" y="47">archied</text>
<text class="node__meta" x="16" y="67">Poll · Enqueue · Claim</text>
<text class="node__meta" x="16" y="81">Route · Process · Reconcile</text>
<text class="node__meta" x="16" y="95">Crash recovery · Startup</text>
</g>
<!-- Workflow Engine (center) -->
<g class="node" transform="translate(490, 242)" tabindex="0" style="--node-accent: var(--cyan); --delay: 860ms">
<rect class="node__mask" width="200" height="98" rx="14"/>
<rect class="node__surface" width="200" height="98" rx="14"/>
<rect class="node__accent" width="3" height="38" x="0" y="30" rx="2"/>
<text class="node__eyebrow" x="16" y="22">WORKFLOW ENGINE</text>
<text class="node__title" x="16" y="47">4 Workflows</text>
<text class="node__meta" x="16" y="67">bootstrap · implement</text>
<text class="node__meta" x="16" y="81">tdd · feasibility</text>
<text class="node__meta" x="16" y="95">Label-driven routing</text>
</g>
<!-- ai-sdk Runtime (right-center) -->
<g class="node" transform="translate(770, 242)" tabindex="0" style="--node-accent: var(--cyan); --delay: 920ms">
<rect class="node__mask" width="200" height="82" rx="14"/>
<rect class="node__surface" width="200" height="82" rx="14"/>
<rect class="node__accent" width="3" height="36" x="0" y="23" rx="2"/>
<text class="node__eyebrow" x="16" y="22">RUNTIME</text>
<text class="node__title" x="16" y="47">ai-sdk</text>
<text class="node__meta" x="16" y="67">agentloop · runtime · core</text>
</g>
<!-- SQLite Store (below daemon) -->
<g class="node" transform="translate(260, 380)" tabindex="0" style="--node-accent: var(--violet); --delay: 980ms">
<rect class="node__mask" width="226" height="76" rx="14"/>
<rect class="node__surface" width="226" height="76" rx="14"/>
<rect class="node__accent" width="3" height="32" x="0" y="22" rx="2"/>
<text class="node__eyebrow" x="16" y="21">STORE</text>
<text class="node__title" x="16" y="44">SQLite · WAL mode</text>
<text class="node__meta" x="16" y="63">Tasks · Transitions · Event log</text>
</g>
<!-- Worktree Manager (below workflow engine) -->
<g class="node" transform="translate(510, 428)" tabindex="0" style="--node-accent: var(--green); --delay: 1040ms">
<rect class="node__mask" width="210" height="82" rx="14"/>
<rect class="node__surface" width="210" height="82" rx="14"/>
<rect class="node__accent" width="3" height="36" x="0" y="23" rx="2"/>
<text class="node__eyebrow" x="16" y="22">GIT OPS</text>
<text class="node__title" x="16" y="47">Worktree Manager</text>
<text class="node__meta" x="16" y="67">Clone · Branch · Commit · Push</text>
<text class="node__meta" x="16" y="81">GIT_ASKPASS auth</text>
</g>
<!-- Event Bus (left, below) -->
<g class="node" transform="translate(80, 412)" tabindex="0" style="--node-accent: var(--orange); --delay: 1100ms">
<rect class="node__mask" width="180" height="68" rx="14"/>
<rect class="node__surface" width="180" height="68" rx="14"/>
<rect class="node__accent" width="3" height="30" x="0" y="19" rx="2"/>
<text class="node__eyebrow" x="16" y="21">OBSERVABILITY</text>
<text class="node__title" x="16" y="43">Event Bus</text>
<text class="node__meta" x="16" y="60">In-process · Bounded subs</text>
</g>
<!-- SSE Dashboard (left, bottom) -->
<g class="node" transform="translate(80, 540)" tabindex="0" style="--node-accent: var(--orange); --delay: 1160ms">
<rect class="node__mask" width="180" height="72" rx="14"/>
<rect class="node__surface" width="180" height="72" rx="14"/>
<rect class="node__accent" width="3" height="30" x="0" y="21" rx="2"/>
<text class="node__eyebrow" x="16" y="21">DASHBOARD</text>
<text class="node__title" x="16" y="44">SSE Web UI</text>
<text class="node__meta" x="16" y="63">Live task board · Events</text>
</g>
<!-- Workflow detail callout: 4 workflow cards (right of worktree, bottom area) -->
<g class="node" transform="translate(770, 400)" tabindex="0" style="--node-accent: var(--cyan); --delay: 1220ms">
<rect class="node__mask" width="400" height="130" rx="14"/>
<rect class="node__surface" width="400" height="130" rx="14"/>
<text class="node__eyebrow" x="16" y="22">STAGE COMPOSITION</text>
<!-- bootstrap -->
<rect x="16" y="32" width="180" height="40" rx="8" fill="none" stroke="color-mix(in srgb, var(--green) 30%, transparent)" stroke-width="1"/>
<text x="24" y="48" fill="var(--green)" font="600 11px var(--display)">bootstrap</text>
<text x="24" y="63" fill="var(--muted)" font="400 9px var(--mono)">prepare → marker → commit → PR</text>
<!-- implement -->
<rect x="204" y="32" width="180" height="40" rx="8" fill="none" stroke="color-mix(in srgb, var(--cyan) 30%, transparent)" stroke-width="1"/>
<text x="212" y="48" fill="var(--cyan)" font="600 11px var(--display)">implement</text>
<text x="212" y="63" fill="var(--muted)" font="400 9px var(--mono)">plan → build → commit → PR</text>
<!-- tdd -->
<rect x="16" y="78" width="180" height="40" rx="8" fill="none" stroke="color-mix(in srgb, var(--cyan) 30%, transparent)" stroke-width="1"/>
<text x="24" y="94" fill="var(--cyan)" font="600 11px var(--display)">tdd</text>
<text x="24" y="109" fill="var(--muted)" font="400 9px var(--mono)">analyse → repro → fix → PR</text>
<!-- feasibility -->
<rect x="204" y="78" width="180" height="40" rx="8" fill="none" stroke="color-mix(in srgb, var(--cyan) 30%, transparent)" stroke-width="1"/>
<text x="212" y="94" fill="var(--cyan)" font="600 11px var(--display)">feasibility</text>
<text x="212" y="109" fill="var(--muted)" font="400 9px var(--mono)">assess → PRD → waiting_human</text>
</g>
<!-- 6. Connector labels -->
<g class="connector-label" transform="translate(114, 188)">
<rect width="44" height="20" rx="6"/><text x="22" y="14" text-anchor="middle">poll</text>
</g>
<g class="connector-label" transform="translate(324, 188)">
<rect width="42" height="20" rx="6"/><text x="21" y="14" text-anchor="middle">PR</text>
</g>
<g class="connector-label" transform="translate(362, 354)">
<rect width="42" height="20" rx="6"/><text x="21" y="14" text-anchor="middle">SQL</text>
</g>
<g class="connector-label" transform="translate(444, 275)">
<rect width="44" height="20" rx="6"/><text x="22" y="14" text-anchor="middle">route</text>
</g>
<g class="connector-label" transform="translate(592, 378)">
<rect width="42" height="20" rx="6"/><text x="21" y="14" text-anchor="middle">git</text>
</g>
<g class="connector-label" transform="translate(714, 275)">
<rect width="52" height="20" rx="6"/><text x="26" y="14" text-anchor="middle">agent</text>
</g>
<g class="connector-label" transform="translate(994, 266)">
<rect width="48" height="20" rx="6"/><text x="24" y="14" text-anchor="middle">HTTPS</text>
</g>
<g class="connector-label" transform="translate(996, 226)">
<rect width="36" height="20" rx="6"/><text x="18" y="14" text-anchor="middle">resp</text>
</g>
<g class="connector-label" transform="translate(266, 348)">
<rect width="62" height="20" rx="6"/><text x="31" y="14" text-anchor="middle">publish</text>
</g>
<g class="connector-label" transform="translate(268, 486)">
<rect width="64" height="20" rx="6"/><text x="32" y="14" text-anchor="middle">event log</text>
</g>
<g class="connector-label" transform="translate(154, 504)">
<rect width="40" height="20" rx="6"/><text x="20" y="14" text-anchor="middle">SSE</text>
</g>
<g class="connector-label" transform="translate(128, 504)">
<rect width="36" height="20" rx="6"/><text x="18" y="14" text-anchor="middle">sub</text>
</g>
</svg>
</div>
<button class="replay-button" type="button" title="Replay diagram animation" aria-label="Replay diagram animation" onclick="replayDiagram(this)">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M20 11a8 8 0 1 0-2.34 5.66" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/>
<path d="M20 5v6h-6" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</button>
</section>
<section class="insights" aria-label="Architecture notes">
<article class="insight" style="--accent: var(--green)">
<p class="insight-kicker">01 · Task flow</p>
<h2>Label-driven, in-process execution</h2>
<p>archied polls GitHub for issues matching the configured trigger (assignee, label, or either). Each issue becomes a SQLite-tracked task, claimed one at a time, and routed to a workflow by issue labels — no LLM involved in routing. All stages run sequentially inside the daemon process.</p>
</article>
<article class="insight" style="--accent: var(--orange)">
<p class="insight-kicker">02 · Failure boundaries</p>
<h2>Environmental constraints, not prompt rules</h2>
<p>The quality gate, test-file protection (TDD fix stage), and diff-size cap are code enforcement — not "please don't do that" in the system prompt. Crashed daemons re-queue stale running tasks on startup. Parks are never silent: every parked task posts a comment with the reason and gate output.</p>
</article>
<article class="insight" style="--accent: var(--cyan)">
<p class="insight-kicker">03 · Design decisions</p>
<h2>Deterministic git, fresh worktrees</h2>
<p>The model never runs git — worktree operations (clone, branch, commit, push, diff, cleanup) are deterministic steps, not agent tools. Every task gets a fresh clone under <code>~/.local/share/archie/work/</code>. Tokens are tracked per task and emitted in observability events, but not budgeted beyond the agent loop's own limits.</p>
</article>
</section>
<footer class="footer">
<span>archie-core · Single-daemon architecture · Label-driven workflows · Gated agent loops · SQLite crash recovery</span>
<span class="export-status" id="export-status" role="status" aria-live="polite">SVG export works offline · PNG/PDF require export libraries</span>
</footer>
</main>
<script>
const report = document.getElementById('report-container');
const architecture = document.getElementById('architecture');
const exportMenu = document.getElementById('export-menu');
const exportStatus = document.getElementById('export-status');
function buildFlowMotion() {
architecture.querySelectorAll('.flow').forEach((path, index) => {
const phase = -((index * 0.73) % 4.1);
path.style.setProperty('--phase', `${phase.toFixed(2)}s`);
if (path.matches('.flow--async, .flow--control')) return;
const motion = path.cloneNode(false);
motion.removeAttribute('id');
motion.removeAttribute('marker-end');
motion.setAttribute('class', 'flow-motion');
motion.setAttribute('aria-hidden', 'true');
path.after(motion);
});
}
function replayDiagram(button) {
architecture.classList.add('is-resetting');
void architecture.getBoundingClientRect();
architecture.classList.remove('is-resetting');
button.classList.remove('is-replaying');
void button.offsetWidth;
button.classList.add('is-replaying');
setTimeout(() => button.classList.remove('is-replaying'), 760);
}
buildFlowMotion();
function fileStem() {
const title = document.querySelector('h1')?.textContent || 'architecture-diagram';
return title.toLowerCase().trim().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || 'architecture-diagram';
}
function setStatus(message) {
exportStatus.textContent = message;
}
async function withExportState(button, task) {
const buttons = [...document.querySelectorAll('.export-actions button')];
const previous = button.textContent;
buttons.forEach(item => { item.disabled = true; });
exportMenu.open = false;
document.body.classList.add('is-exporting');
button.textContent = 'Preparing…';
setStatus('Preparing export…');
try {
if (document.fonts?.ready) await document.fonts.ready;
await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)));
await task();
} catch (error) {
console.error(error);
setStatus(error instanceof Error ? error.message : 'Export failed. Check the browser console.');
} finally {
document.body.classList.remove('is-exporting');
buttons.forEach(item => { item.disabled = false; });
button.textContent = previous;
}
}
async function captureReport() {
if (typeof window.html2canvas !== 'function') {
throw new Error('PNG/PDF export library did not load. Check your connection or use SVG export.');
}
const bounds = report.getBoundingClientRect();
const padding = 24;
return window.html2canvas(document.body, {
backgroundColor: '#050816',
scale: Math.min(3, Math.max(2, window.devicePixelRatio || 1)),
useCORS: true,
logging: false,
x: bounds.left + window.scrollX - padding,
y: bounds.top + window.scrollY - padding,
width: bounds.width + padding * 2,
height: bounds.height + padding * 2,
ignoreElements: element => element.classList?.contains('export-menu')
});
}
function canvasBlob(canvas) {
return new Promise((resolve, reject) => canvas.toBlob(
blob => blob ? resolve(blob) : reject(new Error('Browser could not encode the PNG.')),
'image/png'
));
}
function downloadBlob(blob, filename) {
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = filename;
document.body.appendChild(link);
link.click();
link.remove();
setTimeout(() => URL.revokeObjectURL(url), 1000);
}
function downloadSVG(button) {
return withExportState(button, async () => {
const source = document.querySelector('.architecture');
const clone = source.cloneNode(true);
clone.classList.add('export-static');
clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
const style = document.createElementNS('http://www.w3.org/2000/svg', 'style');
style.textContent = document.querySelector('style').textContent;
clone.insertBefore(style, clone.firstChild);
const xml = new XMLSerializer().serializeToString(clone);
downloadBlob(new Blob([xml], { type: 'image/svg+xml;charset=utf-8' }), `${fileStem()}.svg`);
setStatus('SVG downloaded.');
});
}
function copyPNG(button) {
return withExportState(button, async () => {
if (!navigator.clipboard?.write || typeof window.ClipboardItem !== 'function') {
throw new Error('This browser cannot copy images here. Use Download PNG instead.');
}
const blob = await canvasBlob(await captureReport());
await navigator.clipboard.write([new ClipboardItem({ 'image/png': blob })]);
setStatus('PNG copied to clipboard.');
});
}
function downloadPNG(button) {
return withExportState(button, async () => {
const blob = await canvasBlob(await captureReport());
downloadBlob(blob, `${fileStem()}.png`);
setStatus('PNG downloaded.');
});
}
function downloadPDF(button) {
return withExportState(button, async () => {
if (!window.jspdf?.jsPDF) {
throw new Error('PDF export library did not load. Check your connection or use SVG export.');
}
const canvas = await captureReport();
const { jsPDF } = window.jspdf;
const orientation = canvas.width >= canvas.height ? 'landscape' : 'portrait';
const pdf = new jsPDF({ orientation, unit: 'px', format: [canvas.width, canvas.height], hotfixes: ['px_scaling'] });
pdf.addImage(canvas.toDataURL('image/png'), 'PNG', 0, 0, canvas.width, canvas.height, undefined, 'FAST');
pdf.save(`${fileStem()}.pdf`);
setStatus('PDF downloaded.');
});
}
</script>
</body>
</html>