<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Context Memory on RockB</title><link>https://baeseokjae.github.io/tags/context-memory/</link><description>Recent content in Context Memory on RockB</description><image><title>RockB</title><url>https://baeseokjae.github.io/images/og-default.png</url><link>https://baeseokjae.github.io/images/og-default.png</link></image><generator>Hugo</generator><language>en-us</language><lastBuildDate>Sat, 22 Aug 2026 01:01:54 +0000</lastBuildDate><atom:link href="https://baeseokjae.github.io/tags/context-memory/index.xml" rel="self" type="application/rss+xml"/><item><title>Relay Task Kernel: One Agent Handoff Contract Standard for Claude Code, Codex, Gemini CLI and Copilot</title><link>https://baeseokjae.github.io/posts/relay-task-kernel-handoff-contract/</link><pubDate>Sat, 22 Aug 2026 01:01:54 +0000</pubDate><guid>https://baeseokjae.github.io/posts/relay-task-kernel-handoff-contract/</guid><description>One agent handoff contract standard for Claude Code, Codex, Gemini CLI and Copilot: Relay Task Kernel consolidates four rule files into one shared source of truth.</description><content:encoded><![CDATA[<p>The agent handoff contract standard you are looking for is Relay Task Kernel (RTK): a zero-dependency CLI that consolidates the four per-agent instruction files — AGENTS.md (Codex), CLAUDE.md (Claude Code), GEMINI.md (Gemini CLI), and .github/copilot-instructions.md (Copilot) — into one shared contract with thin pointer files, four scoped markdown memory files, and an idempotent merge protocol. Instead of maintaining the same rules four times and watching them drift apart, RTK gives every agent one source of truth. This guide explains the problem, how RTK works, the merge and memory contracts, presets, and how it compares to alternative handoff tools.</p>
<h2 id="the-problem-one-repo-four-agent-rule-files-zero-shared-memory">The Problem: One Repo, Four Agent Rule Files, Zero Shared Memory</h2>
<p>Modern developers do not pick one coding agent and stay loyal. Teams rotate Claude Code, OpenAI Codex, Google Gemini CLI, and GitHub Copilot in the same repository — often in the same week. The problem is that each harness reads a different instruction file:</p>
<table>
  <thead>
      <tr>
          <th>Agent</th>
          <th>Instruction file it reads</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Claude Code</td>
          <td><code>CLAUDE.md</code></td>
      </tr>
      <tr>
          <td>OpenAI Codex</td>
          <td><code>AGENTS.md</code></td>
      </tr>
      <tr>
          <td>Google Gemini CLI</td>
          <td><code>GEMINI.md</code></td>
      </tr>
      <tr>
          <td>GitHub Copilot</td>
          <td><code>.github/copilot-instructions.md</code></td>
      </tr>
  </tbody>
</table>
<p>If you have all four installed, the same project rule has to be written in four places. When one file gets updated and the others do not, three of the four agents silently keep operating on stale rules. This is the &ldquo;four-files problem&rdquo; that Relay Task Kernel is designed to solve.</p>
<p>Worse, the rules are only half of the context problem. Agent <strong>memory</strong> is equally fragmented. When a session ends with a Claude Code run and Codex starts fresh the next morning, the new agent has no idea what half-finished work is sitting in the repo, what decisions were made yesterday, or which mistakes it is told to avoid. A genuinely useful handoff contract standard has to address both rule files <strong>and</strong> memory.</p>
<h2 id="what-is-relay-task-kernel-rtk--one-contract-zero-dependencies">What Is Relay Task Kernel (RTK)? — One Contract, Zero Dependencies</h2>
<p>Relay Task Kernel is an open-source, MIT-licensed CLI published by the <code>leamagic-cyber</code> GitHub account. It is intentionally tiny: <strong>zero dependencies</strong>, Node.js &gt;= 18.17 required, and a small command surface. Its entire premise is that a handoff contract should be a <em>thin pointer layer</em> over one canonical source of truth, not a fourth place to duplicate content.</p>
<p>The core value proposition is stated in the project README:</p>
<blockquote>
<p>&ldquo;RTK — One handoff contract that Claude Code, Codex, Gemini CLI and Copilot all read.&rdquo;</p></blockquote>
<p>The tool makes the four per-agent files thin pointers that delegate to a single shared contract. You write the rules once, and every agent resolves to the same content regardless of which harness invoked it.</p>
<p>Compared to the leading coding agents it is designed to tame, RTK is intentionally minimal. For scale, Claude Code sits at roughly <strong>142,298 GitHub stars</strong>, OpenAI Codex at <strong>~111,300</strong>, and Gemini CLI at <strong>~106,607</strong> — each a mature, heavily used harness. RTK, by contrast, is a 2-star, single-author project created on 2026-08-17. That maturity gap matters and we return to it in the verdict.</p>
<h2 id="how-the-one-contract-model-works">How the One-Contract Model Works</h2>
<p>The core of the model is a machine-wide protocol plus a per-project overlay.</p>
<p><strong>Global protocol (<code>~/.rtk/</code>).</strong> Running <code>npx github:leamagic-cyber/relay-task-kernel init --global</code> writes the machine-wide contract to <code>~/.rtk/</code>. This contains:</p>
<ul>
<li><code>RTK.md</code> — the canonical global contract</li>
<li><code>rules/</code> — reusable rule fragments</li>
<li><code>templates/</code> — templates for the thin pointer files</li>
<li><code>schemas/</code> — JSON schemas for validating the contract</li>
</ul>
<p><strong>Project overlay.</strong> Running <code>rtk init</code> inside a repo creates:</p>
<ul>
<li><code>START_HERE.md</code> — the entry point a fresh agent reads</li>
<li>Thin entries for each agent (<code>AGENTS.md</code>, <code>CLAUDE.md</code>, <code>GEMINI.md</code>, <code>.github/copilot-instructions.md</code>) that all point to the shared contract</li>
<li><code>.rtk/project.md</code> — the project-specific overlay</li>
</ul>
<p><strong>The <code>--all</code> flag.</strong> Running <code>rtk init --all</code> does both the machine-wide write and the project overlay in one pass, which is the recommended starting command:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>npx github:leamagic-cyber/relay-task-kernel init --all
</span></span></code></pre></div><p><strong>Tighten-only overlay rule.</strong> A deliberate design constraint is that the project overlay may only <em>tighten</em> global rules, never loosen them. A single commit in a single repo cannot switch off a global safety rule. This prevents one project from silently weakening the standards every other project relies on.</p>
<p>The CLI surface includes <code>init</code>, <code>init --global</code>, <code>init --all</code>, <code>check</code>, <code>eject</code>, and <code>presets</code>, with flags such as <code>--dry-run</code>, <code>--yes</code>, <code>--dir</code>, <code>--preset</code>, <code>--no-backup</code>, <code>--crlf</code>, and <code>--set</code>. The <code>eject</code> command is the escape hatch: it converts the thin pointers back into self-contained files so you are never locked in.</p>
<h2 id="the-merge-contract-idempotent-non-destructive-reversible-checkable">The Merge Contract: Idempotent, Non-Destructive, Reversible, Checkable</h2>
<p>The hardest engineering problem in a shared-contract design is merging updated global rules back into already-created project files without clobbering the developer&rsquo;s own edits. RTK solves this with fenced regions wrapped in markers:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>&lt;!-- RTK:BEGIN --&gt;
</span></span><span style="display:flex;"><span>...shared content...
</span></span><span style="display:flex;"><span>&lt;!-- RTK:END --&gt;
</span></span></code></pre></div><p>Anything you write outside the markers is yours and survives every re-run. This yields four guarantees that matter for a tool that touches files on every agent run:</p>
<ul>
<li><strong>Idempotent.</strong> Re-running the merge reports 0 changed files when nothing is out of date. No churn, no noisy diffs.</li>
<li><strong>Non-destructive.</strong> Your hand-edited text outside the RTK markers is never touched. If you add project-specific instructions above or below a block, they persist across every update.</li>
<li><strong>Reversible.</strong> Before each merge, RTK writes an automatic <code>.backup</code>, so a bad merge can be rolled back.</li>
<li><strong>Checkable.</strong> <code>rtk check</code> verifies that every expected block is still present and exits with a non-zero status (1) if a block has been deleted. A missing block is a red flag that an agent, or a human, edited around the contract.</li>
</ul>
<p>This is a meaningful contrast to the &ldquo;hand-edit four files&rdquo; workflow, where silent drift is the default outcome. RTK makes drift detectable rather than invisible.</p>
<h2 id="memory-that-survives-sessions-the-four-scoped-markdown-files">Memory That Survives Sessions: The Four Scoped Markdown Files</h2>
<p>Where most rule-file tools stop at instructions, RTK treats agent memory as a first-class citizen. Memory is modeled as four plain markdown files — not a database, not a vector store, deliberately zero-dependency:</p>
<table>
  <thead>
      <tr>
          <th>File</th>
          <th>Holds</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>project-brief.md</code></td>
          <td>Why the project exists, its goals, scope, constraints</td>
      </tr>
      <tr>
          <td><code>current-state.md</code></td>
          <td>What is done, what is half-finished, what is blocked right now</td>
      </tr>
      <tr>
          <td><code>user-preferences.md</code></td>
          <td>How the user likes work done: style, conventions, tone</td>
      </tr>
      <tr>
          <td><code>mistakes-to-avoid.md</code></td>
          <td>Past incidents and the rules derived from them, so a fresh session does not repeat them</td>
      </tr>
  </tbody>
</table>
<p>The most important file is <code>current-state.md</code>. It holds half-finished work that a brand-new session cannot reconstruct from the code alone — the thing you most want to hand across a boundary. When Claude Code ends a session at 11 PM and Codex opens the repo at 9 AM, <code>current-state.md</code> is the bridge that prevents &ldquo;start over from scratch&rdquo; or &ldquo;silently redo the same work.&rdquo;</p>
<p>The <code>mistakes-to-avoid.md</code> file also anchors a stronger safety claim: because it records real incidents, the rules embedded in the contract are evidence-driven rather than guessed. This is not hypothetical — RTK&rsquo;s own origin is an internal script that ran a Traditional Chinese content site of ~90 published articles daily, rotating Claude Code, Codex and Gemini. The rules in the first versions captured real incidents: a draft that got published before it was ready, an accidental production deploy, lost decisions from a restarted session.</p>
<h2 id="hardening-with-presets-and-template-variables">Hardening with Presets and Template Variables</h2>
<p>Not every project has identical risk. RTK ships presets — small JSON additions, roughly ten lines each — that encode project-specific gates:</p>
<ul>
<li><strong><code>content-site</code></strong> — adds a publishing gate so drafts never leak to production.</li>
<li><strong><code>oss-library</code></strong> — forbids agents from touching versions, tags, and releases, protecting the release contract of a public library.</li>
</ul>
<p>A preset is a declarative, auditable block rather than a natural-language instruction that an agent might silently ignore. This is consistent with the tightening-only rule: presets make rules stronger, and the merge fence makes sure they stay present.</p>
<h2 id="rtk-vs-the-alternatives">RTK vs the Alternatives</h2>
<p>RTK is not the only tool trying to solve the handoff and context problem. The ecosystem has at least four overlapping approaches, each with a different center of gravity:</p>
<table>
  <thead>
      <tr>
          <th>Tool</th>
          <th>Focus</th>
          <th>Stars</th>
          <th>How it differs</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>RTK</strong></td>
          <td>Memory + thin pointers, one shared rule contract</td>
          <td>2</td>
          <td>Rule consolidation plus scoped markdown memory, merge fences</td>
      </tr>
      <tr>
          <td><strong>brief-spec</strong></td>
          <td>Type-aware, evidence-backed delivery contract</td>
          <td>14</td>
          <td>Emphasizes a typed handoff payload and evidence rather than shared rule files</td>
      </tr>
      <tr>
          <td><strong>harness-all</strong></td>
          <td>Local-first PM + Engineering harness</td>
          <td>27</td>
          <td>Bilingual PM+Eng workflow with contract handoffs, wider in scope than agent rule files</td>
      </tr>
      <tr>
          <td><strong>MDDesign</strong></td>
          <td>Design-first orchestration plugin</td>
          <td>13</td>
          <td>Centers DESIGN.md planning orchestration; cross-IDE but design-document-first</td>
      </tr>
      <tr>
          <td><strong>coderail</strong></td>
          <td>Governance kit aligned to a &ldquo;North Star&rdquo;</td>
          <td>7</td>
          <td>Governance and goal-alignment angle; K0–K6 kernel with drift checks</td>
      </tr>
  </tbody>
</table>
<p>The table is useful as a mental model: every tool agrees that &ldquo;one source of truth&rdquo; matters, but they carve the problem differently. RTK focuses on <em>memory plus thin pointers</em> — the simplest possible contract that makes four agents read one file. If your pain is more about delivering <em>evidence</em> between agents, brief-spec may be closer; if you want <em>governance</em> against the project North Star, coderail; if you want a full <em>planning-and-design</em> orchestration, MDDesign.</p>
<h2 id="the-agentsmd-ecosystem-context">The AGENTS.md Ecosystem Context</h2>
<p>The RTK approach sits on top of a broader movement: <strong>AGENTS.md has become a de facto standard</strong>. Per the agents.md project, AGENTS.md is &ldquo;a simple, open format for guiding coding agents&rdquo; and is already used by <strong>more than 60,000 open-source projects</strong>. That is a large existing base of repos that treat a markdown file as the &ldquo;README for agents.&rdquo;</p>
<p>This ecosystem context matters for two reasons. First, it lowers the adoption cost of RTK: because AGENTS.md is already the common denominator that Codex and many other harnesses read, a handoff contract that centers on AGENTS.md is interoperable with a large installed base. Second, it means the <em>fragmentation problem is real and growing</em> — every new harness that introduces its own instruction file adds another place for the same rule to be written. Gemini CLI explicitly supports <code>GEMINI.md</code> as a persistent per-project context file, which confirms that per-agent context files are an intentional, widespread pattern. That is precisely the pattern a consolidation tool like RTK addresses.</p>
<h2 id="who-should-adopt-a-handoff-contract-and-who-shouldnt">Who Should Adopt a Handoff Contract (and Who Shouldn&rsquo;t)</h2>
<p><strong>Adopt it if:</strong></p>
<ul>
<li>You run two or more of Claude Code, Codex, Gemini CLI, or Copilot in the same repository.</li>
<li>You are tired of editing the same rule in four files and watching them drift.</li>
<li>You frequently hand work from one agent session to another and lose context — where the &ldquo;current state&rdquo; of half-finished work is the #1 gap.</li>
<li>You want safety rules that cannot be silently weakened by a single project.</li>
</ul>
<p><strong>Wait, or skip it, if:</strong></p>
<ul>
<li>You use exactly one agent and one rule file. Consolidation buys you nothing and adds a layer.</li>
<li>You need production stability today. RTK is a 2-star, days-old, single-author project; it has not survived the test of real-world bug reports.</li>
<li>You prefer hand-authoring every file explicitly and distrust tooling that writes your instruction files.</li>
</ul>
<p>A reasonable middle path is to <em>adopt the pattern, not the tool</em>: keep one canonical contract file, make the others thin includes, and review merges in version control. That gives you most of the value with none of the dependency.</p>
<h2 id="verdict--when-to-watch-rtk">Verdict &amp; When to Watch RTK</h2>
<p>Relay Task Kernel is a well-designed answer to a genuinely painful problem. The four-files problem is real, the memory files address an even less-solved gap (cross-session state), and the merge contract&rsquo;s idempotent/non-destructive/reversible/checkable guarantees are the right engineering priorities. As a <em>pattern</em>, the one-contract-with-thin-pointers approach deserves to be a standard.</p>
<p>As a <em>tool</em>, RTK is early. At 2 stars and one day old it has not yet proven itself in the wild, and a handoff contract that touches your instruction files on every agent run is exactly the kind of tool you want battle-tested. The good news is that the pattern is dependency-light and easy to verify: you can read the source, run <code>--dry-run</code>, inspect the <code>.backup</code> files, and watch a single <code>rtk check</code> cycle before letting it anywhere near your production repo.</p>
<p><strong>Bottom line:</strong> if you rotate multiple coding agents in one repo and you are losing state between sessions, watch Relay Task Kernel closely — and meanwhile copy the pattern. One source of truth, four thin pointers, and a <code>current-state.md</code> file is a handoff contract standard worth adopting regardless of which tool eventually wins.</p>
<h2 id="faq">FAQ</h2>
<h3 id="what-is-the-agent-handoff-contract-standard-for-multiple-coding-agents">What is the agent handoff contract standard for multiple coding agents?</h3>
<p>Relay Task Kernel (RTK) is the leading small-tool example of the standard: one shared contract (RTK.md) plus thin pointer files for AGENTS.md, CLAUDE.md, GEMINI.md, and .github/copilot-instructions.md, so all four agents read the same rules. The &ldquo;standard&rdquo; is the pattern of consolidating per-agent files into a single source of truth with non-destructive merges.</p>
<h3 id="do-i-need-rtk-if-i-only-use-claude-code">Do I need RTK if I only use Claude Code?</h3>
<p>Probably not. RTK&rsquo;s value comes from the multi-agent fragmentation: if you use a single agent reading a single file (for example only CLAUDE.md), you have no drift problem to solve, and adding a tool layer is unnecessary. Adopt it mainly when you rotate Claude Code, Codex, Gemini CLI, or Copilot in the same repo.</p>
<h3 id="how-does-rtk-prevent-instruction-files-from-drifting-apart">How does RTK prevent instruction files from drifting apart?</h3>
<p>The four agent files are generated as thin pointers to one shared contract, plus a merge protocol with fenced regions (RTK:BEGIN/END) that is idempotent, non-destructive, reversible with auto-backup, and checkable via <code>rtk check</code>. This is a deterministic source of truth instead of four manually-edited copies that silently diverge.</p>
<h3 id="what-are-the-four-memory-files-in-rtk-and-why-do-they-matter">What are the four memory files in RTK, and why do they matter?</h3>
<p>They are <code>project-brief.md</code>, <code>current-state.md</code>, <code>user-preferences.md</code>, and <code>mistakes-to-avoid.md</code> — plain markdown files, not a database. <code>current-state.md</code> is the most important because it records half-finished work and recent decisions, so a fresh agent session does not have to re-explain the project or repeat past mistakes.</p>
<h3 id="is-relay-task-kernel-production-ready-in-2026">Is Relay Task Kernel production-ready in 2026?</h3>
<p>Not yet. RTK is a 2-star, ~0-dependency, single-author project created in mid-August 2026, so it has not had a wide adoption or battle-testing cycle. The <em>pattern</em> (one contract plus thin pointers) is safe to adopt today; the specific tool is worth watching and verifying with <code>rtk check</code> and <code>--dry-run</code> before you commit to it in production.</p>
]]></content:encoded></item></channel></rss>