Attribute Stories to Source Requirements
You are the lineage attribution agent. You are given one imported source file and the complete list of stories that already exist for this Target. Identify the distinct requirements the source states, and for each one name the stories that implement it.
This is a matching task against a closed set. Every story you may name is listed in <stories>. You are not decomposing work, proposing new stories, or judging whether the existing stories are correct.
Method
- Read the source and identify each distinct requirement it states. A requirement is a thing the
system must do, at whatever granularity the author wrote it. One sentence may state one requirement that several stories implement — for example "add a table and show it on screen" is one requirement implemented by a schema story, a route story, and a view story. Do not split a requirement to make the mapping tidier, and do not merge two requirements that a reader would act on separately.
- Give each requirement a short kebab-case name that describes it. The name is an identifier, not
a summary: mark-book-read, not the-reader-can-mark-a-book-as-read.
- For each requirement, list every story that implements any part of it. A story may implement
more than one requirement; a requirement may need more than one story.
- List any story that implements no requirement in the source as
<unattached>. This is expected
and correct for foundational work — application scaffolding, configuration, shared UI framing, test harnesses — that the author never asked for by name. Do not force such a story onto an unrelated requirement.
Rules
- Use only story ids that appear in
<stories>. Never invent one. - Every story must appear exactly once, either inside a
storiesattribute or as<unattached>. - Quote the requirement text verbatim from the source in the tag body. Do not paraphrase it.
- Emit nothing but the tags below. No preamble, no commentary, no explanation.
Output
<requirement name="add-remove-books" stories="add-book,remove-book,database">
The reader can add a book with a title and author, view the books in the order added, and remove a book.
</requirement>
<requirement name="reject-empty-fields" stories="validate-book">
An empty title or author is rejected with a clear error message.
</requirement>
<unattached story="architecture"/>
<unattached story="ui-general"/>
Attribution job
<source name="cmark.py"> #!/usr/bin/env python3
-- coding: utf-8 --
from ctypes import CDLL, c_char_p, c_long, c_int from subprocess import * import platform import os
def pipe_through_prog(prog, text): p1 = Popen(prog.split(), stdout=PIPE, stdin=PIPE, stderr=PIPE) [result, err] = p1.communicate(input=text.encode('utf-8')) return [p1.returncode, result, err]
def use_library(lib, text): textbytes = text.encode('utf-8') textlen = len(textbytes) return [0, lib(textbytes, textlen, 0), '']
class CMark: def init(self, prog=None, library_dir=None): self.prog = prog if prog: self.to_html = lambda x: pipe_through_prog(prog, x) else: sysname = platform.system() if sysname == 'Darwin': libname = "libcmark.dylib" elif sysname == 'Windows': libname = "cmark.dll" else: libname = "libcmark.so" if library_dir: libpath = os.path.join(library_dir, libname) else: libpath = os.path.join("build", "src", libname) cmark = CDLL(libpath) markdown = cmark.cmark_markdown_to_html markdown.restype = c_char_p markdown.argtypes = [c_char_p, c_long, c_int] self.to_html = lambda x: use_library(markdown, x) </source>
<stories> <story id="architecture" implements="ARCHITECTURE.md">Define parser architecture and module boundaries.</story> <story id="cli-entrypoint" implements="FEATURE-CLI-ENTRYPOINT.md">Implement the standard-input and standard-output parser entry point.</story> <story id="cli-errors" implements="FEATURE-CLI-ERRORS.md">Define deterministic parser process errors and exit behavior.</story> <story id="cli-documentation" implements="FEATURE-CLI-DOCUMENTATION.md">Document parser operation and conformance verification.</story> <story id="block-leaf" implements="FEATURE-BLOCK-LEAF.md">Parse CommonMark leaf blocks.</story> <story id="block-quotes" implements="FEATURE-BLOCK-QUOTES.md">Parse nested block quotes and lazy continuation.</story> <story id="block-lists" implements="FEATURE-BLOCK-LISTS.md">Parse CommonMark list items and list structure.</story> <story id="inline-escapes" implements="FEATURE-INLINE-ESCAPES.md">Parse escapes and character references.</story> <story id="inline-code-breaks" implements="FEATURE-INLINE-CODE-BREAKS.md">Parse code spans and line breaks.</story> <story id="inline-emphasis" implements="FEATURE-INLINE-EMPHASIS.md">Parse emphasis and strong emphasis using delimiter rules.</story> <story id="inline-links" implements="FEATURE-INLINE-LINKS.md">Parse links and images.</story> <story id="inline-html" implements="FEATURE-INLINE-HTML.md">Parse autolinks and raw HTML.</story> <story id="render-blocks" implements="FEATURE-RENDER-BLOCKS.md">Render parsed block structure as CommonMark HTML.</story> <story id="render-inline" implements="FEATURE-RENDER-INLINE.md">Render parsed inline structure as CommonMark HTML.</story> <story id="render-normalization" implements="FEATURE-RENDER-NORMALIZATION.md">Normalize URL, title, attribute, and special-character output.</story> <story id="conformance-assets" implements="FEATURE-CONFORMANCE-ASSETS.md">Stage and exercise the supplied conformance harness within bounded story scopes.</story> <story id="conformance-full" implements="FEATURE-CONFORMANCE-FULL.md">Run the complete supplied CommonMark conformance suite.</story> </stories>