Skip to content
rfc-workflow Artifact [1cb36af6a8]
Login

Artifact [1cb36af6a8]

Artifact 1cb36af6a861ca9a0dc261796381d450f98184c4f7e4da073cf2cbb1a6476dd2:


Generating RFCs from Existing Source Code — A Cloner's Runbook

This repository is a neutral, source-agnostic RFC authoring workflow. Given a body of source code and its documentation, it produces publishable RFC-style Internet-Drafts while keeping a separate, auditable evidence chain that proves every public claim traces back to the source.

This runbook is the end-to-end path a fresh cloner follows to go from an empty checkout to rendered RFC drafts. It uses rsync as the worked example throughout, but nothing here is rsync-specific — swap in any codebase with a protocol, format, or data model worth specifying.

Mental model. The repo root (suite-discovery.contract.yaml, workflow.contract.yaml, core/, briefs/, toolchains/, templates/, prompts/, AGENTS.md) is reusable and never edited per project. Discovery happens first against a staged source corpus. Everything source-specific then lives in one project pack under projects/<name>/. You run suite discovery to decide the document breakdown, scaffold a pack from that decision, then run the drafting workflow against the pack.


0. Prerequisites

Verify these once, before any run:


1. Obtain the authoritative corpus

Get the ground truth onto local disk first — suite discovery and every later claim depend on it, with no network dependency at run time.

(rsync example: the reference source at a pinned commit, its shipped manpages, and the daemon-protocol note.)


2. Discover the RFC suite shape ← the pivotal pre-pack step

Run the discovery workflow — not just the prompt in isolation:

This happens before any pack is scaffolded. Its job is discovery and suite design only: no drafting, no file scaffolding, no repo tree emission.

The contract fixes a five-stage pre-pack workflow with explicit gates and outputs:

  1. discovery-scope → lock the system name, corpus boundary, observed surfaces, authority rule, and discovery-only objective.
  2. corpus-map → separate authoritative, informative, and observed materials; mark contradictions and gaps.
  3. surface-inventory → fill a normative-surface-inventory artifact covering the real algorithms, processes, formats, protocols, roles, and terminology domains.
  4. suite-shaping → turn that inventory into a suite-boundary-decision that merges weak candidates, states non-goals, assigns dependencies, and fixes terminology ownership.
  5. handoff-packaging → package the final suite-discovery-brief and pack-scaffold-inputs artifacts for downstream scaffolding.

The decision rule is the same throughout: prefer the smallest clean RFC suite that preserves clean ownership, clean-room implementability, reduced duplication, reviewable boundaries, and reuse of shared format/protocol layers. Subordinate material such as deployment guidance, UI behavior, helper code, or illustrative-only fixtures stays merged, dependent, or out of scope unless it exposes an independent normative surface.

The final handoff is a suite-discovery brief in six sections, ending in a Pack scaffold inputs block whose headings map one-to-one onto the pack generator's expected inputs. That final block is what carries the suite decision into Step 3. Prepare the inputs first: the authoritative corpus, any informative/background material, observed runtime surfaces, and the authority rule to apply when sources disagree — or an explicit unknown for discovery to infer and justify.

Why this step is load-bearing. The suite shape is what makes the output implementable rather than merely descriptive. A protocol split along its real layers — a foundational wire/format document plus the dependent documents that cite it — lets each document be specified to the byte and proven buildable on its own. Getting the breakdown right here, before a single pack file is scaffolded, is the difference between "an overview of how it behaves" and "a spec you can build against."

(rsync example: discovery returns a two-document suite — a foundational Wire Transport & Daemon Protocol document (session setup, handshake, auth, version/digest negotiation, multiplex framing, shared integer encodings) and a dependent File List & Delta Transfer Protocol document (file-list encoding, checksum negotiation, sums header, rolling/strong checksums, token stream, reconstruction) that cites the wire document for framing/encodings — plus the non-goals kept out of the suite.)


3. Scaffold the pack from the discovery handoff, and stage the corpus

Feed the discovery workflow's final Pack scaffold inputs block — the one shaped by templates/PACK-SCAFFOLD-INPUTS.md and emitted inside the suite-discovery-brief — into projects/PROMPT-GENERATE-PROJECT-PACK.md, using projects/template-ietf/ as the reusable IETF starter. This produces projects/<name>/ already reflecting the discovered breakdown:

Then stage the corpus into the pack so claims anchor to a real file:function with no run-time network dependency:

(rsync example: projects/rsync/ with briefs/wire-transport.md + briefs/delta-transfer.md, the source staged under references/rsync-src/, and a source-locator.md mapping mux framing → io.c, file-list encoding → flist.c, checksums → checksum.c.)


4. Verify run prerequisites for this pack

Before translating/running, confirm:


5. Translate the workflow for your harness

Run prompts/translate-workflow-for-harness.md with concrete run facts:

It loads AGENTS.md, workflow.contract.yaml, core/, the reusable materials, and your pack, then emits a native primitive map (controller, stage-execution unit, gate mechanism, evidence/public workspaces, recursive-correction routing, escalation path) and a ready-to-run handoff.

You do not modify workflow.contract.yaml — it already specifies stage order, gates, the public/evidence split, and recursive correction. Translation maps those semantics onto your harness's primitives; it does not redesign them.


6. Run the workflow

Run prompts/run-selected-project.md with the handoff. Execution follows the contract's stage graph. The 15 stages, in order, with their gates:

# Stage Produces (family) Gate blocks until
1 scope run-brief (evidence) objective, deliverables, exclusions, authority order set
2 context-packet context-packet (evidence) vocabulary/constraints/open-questions assembled (orientation ≠ authority)
3 source-map source-map (evidence) source units named with retrieval handles; gaps marked
4 source-scout source-scout-report (evidence) narrow source reads answered with exact anchors; evidence vs inference separated
5 claim-ledger claim-ledger (evidence) every claim has authority class + anchor + status + section impact
6 capability-matrix capability-matrix (evidence) each required capability = covered/open/scoped-out/blocking
7 draft-skeleton section-map + public draft source sections map to accepted claims only (no prose from memory)
8 example-lab example-report (evidence) examples validated-from-observed or explicitly illustrative-only
9 mechanical-validation rendered public output + mechanical-report kramdown-rfc → xml2rfc renders clean; warnings vs blockers dispositioned
10 review-gauntlet review-report (evidence) no blocker findings across grounding/security/example/provenance lanes
11 reader-onramp reader-report (evidence) newcomer on-ramp judged from rendered public text alone
12 prose-audit prose-report + cleanroom-packet wording risks dispositioned without changing semantics
13 correction-loop correction-log / escalation-log (only on failure — see below)
14 clean-room-proof cleanroom-report (evidence) a fresh, non-drafting reviewer can recover the required capability from the public packet alone
15 final-packaging public-manifest + evidence-manifest deliverables complete; full proof chain retained

Running invariants the harness must enforce:

Scope tip: run suite:all (or a subset:) so coupled documents are produced together; a foundational document should be corrected before the documents that cite it.


7. Collect and package outputs

By the end of a run, projects/<name>/runs/<run-id>/ contains:

To share: bundle the public deliverables (the drafts + public manifest). Exclude the evidence tree — it contains source anchors and internal identifiers that provenance containment keeps out of anything published. Ship the evidence bundle separately only for audit.

Render/validate any draft locally:

kramdown-rfc <draft>.md > <draft>.xml
xml2rfc --text <draft>.xml -o <draft>.txt

What "success" looks like


Proving a multi-document suite

Two lessons that only surface once you actually run a multi-document protocol suite through clean-room proof. Both change how you should run Steps 6–7.

Lesson 1 — the clean-room verdict is a sample, not a theorem; use a panel

A single clean-room reviewer's PASS is not reliable. Reviewers are competent but their coverage varies: the same unchanged public text can pass one reviewer pair and then fail a fresh pair that catches a real gap the first missed (this is observed, not hypothetical).

Lesson 2 — per-document proofs pass in isolation; the seam between them does not

In a suite where document B depends on document A, each document can pass its own clean-room proof while the join between them is still broken — B delegates a mechanism to A ("see [A] for the seed exchange") that A never actually specifies. Per-document loops cannot catch this.

One-screen checklist

  1. Verify kramdown-rfc + xml2rfc (Step 0).
  2. Obtain the source tree + shipped docs locally; pin the commit (Step 1).
  3. Run the discovery workflow — suite-discovery.contract.yaml, its schema, the discovery templates, and prompts/discover-rfc-suite-shape.md — to produce a suite-discovery-brief plus final Pack scaffold inputs block (Step 2).
  4. Feed that Pack scaffold inputs block into projects/PROMPT-GENERATE-PROJECT-PACK.md (starter: projects/template-ietf/); stage the corpus under references/ + source-locator.md + authority order (Step 3).
  5. Confirm corpus/runtime version match (Step 4).
  6. prompts/translate-workflow-for-harness.md → handoff (Step 5).
  7. prompts/run-selected-project.md → run the staged graph with gates + recursive correction (Step 6).
  8. Package public drafts to share; keep evidence separate (Step 7).